Friday, December 23, 2011

I wrote a Novel!

During the month of November I took part in a novel writing competition called www.nanowrimo.org

Basically the idea is to write a 50,000 word novel in 30 days.

Well I did it and completed the 50,000 words in the time limit, but I hadn't finished the story.  I carried on into December and today I finally finished my story.  It's a very rough first draft but I have decided to post the first 3 chapters here for people to read to see if it gathers any interest.

Hope you enjoy it.


Pause - Chapter 3


Corporation

Sebastian Parkington-Bowles stood proudly gazing over the river Thames through the tinted glass of his penthouse office suite. Designer glasses perched on the bridge of his nose, with decorative writing stencilled on the arms. It may of well have said "successful" on them, such was his demeanour.
He was looking down over London at his current and prospective customers. There were buildings as far as the eye could see in every direction. From the exclusive riverside apartments of Chelsea in the West to the shoe box "down town Beirut" tower blocks of the East end. Each and every one housed potential income for his corporation.

Sebastian was a trim 45 year old, kept himself in good shape with a personal trainer, Trudy. He was not quite winning the battle of the middle aged spread but you had to "oil the wheels of business" with those long exuberant lunches at the Gentleman's clubs the city offered.

Tanned from his regular visits to one of his many villas or his yacht. Hairline slightly receding with a bit of a widows peak and "distinguished" greying of the temples.

The young girls in the office still flirted with him at whatever opportunity they had so he must still be a good looking guy. Sadly he was unaware that most of the girls feared so much for their jobs that it was literally an unwritten contract for fawn over the CEO and pamper his ego.

Clinicál was Sebastian's company, a cosmetics corporation whose slogan was "Because we care". They specialised in health and skincare products for the more affluent market sector. Sebastian lovingly referred to his customers as the "leather handbags" whose skin was already so knackered and probably riddled with skin cancer from spending six months every year in the Med and the remainder under their private sunbeds. He often joked that they would have as much luck reviving their wrinkled, saggy skin with sandpaper and a blowtorch as to use any of Clincál's product offerings.

"Because we care" didn't really care about the customers, it was "Because we care - about making obscene amounts of money". It was "Because we care - about pushing our share price into the stratosphere". It was "Because we care - f*ck all about our customers".

Sebastian was the youngest of twins by 5 minutes. "Always second in life Seb...", his more successful, better looking, younger looking, more popular brother Rupert regularly reminded him. Throughout his childhood Sebastian had tried to better his brother and failed on every occasion. Rupert was the school Head boy, captain of the rugger team, crowned most successful student, had the fittest girlfriends.

What really galled Sebastian the most was that Rupert was clearly also his father's favourite son. He craved the attention and acknowledgement of his father. He would walk over hot coals just for the phrase "well done Seb" to pass his father's lips. But these words had never been delivered. To an outside observer people would consider him a very successful businessman. However deep in his heart he was looking for a small piece of recognition.

His father, Sir Bernard Parkington-Bowles, was also a VERY successful businessman, an international oil magnate whose business dealt with volumes of cash that could consume Clinicál in a heartbeat. Yes he had even received a knighthood for his business endeavours for the British import/export market. How could Sebastian possibly compete with that? Sir Bernard's job took him on a endless cycle of business travel where his feet barely touched British soil. Leaving mother at home to tend Parkington Hall in Surrey, with the servants.

Meanwhile Rupert ran his own media/production company spanning, TV, film, music and games. He didn't appear to ever be that busy. His life was just a merry-go-round of hob-nobbing with the rich and famous. The more hectic his party lifestyle the more business he drummed up for the company. Never a week went by without him gracing the gossip pages of the tabloids, TV interviews, chat shows, awards ceremonies. Sebastian found it infuriating that the less Rupert worked the more successful he became. This weeks crowning glories were Rupert being voted "Britain's most eligible bachelor", entering the top 100 rich list and Cosmo's "who would you most like to shag if stuck in a lift?" poll.

Sebastian's concentration was suddenly broken by a gentle ringing sound from the P.W.I. on the office wall. The P.W.I. was his "Personal Wealth Indicator" a hand crafted mahogany device that was very similar to the sliding scoreboards used in snooker halls. However the P.W.I. Was fitted vertically with 3 rails on it. On each rail was a beautifully carved letter in ornate font. A "B", "S" and "R" to represent each of their personal fortunes. Sir Bernard's "B" was teetering as the top of the rail near the billion pound marker. Rupert's "R" was halfway up the wall at the five hundred million mark. Whereas Sebastian's "S" was only at a modest three hundred and fifty million.

The P.W.I had been designed to fit into the surrounding décor of the mahogany panelled office, which wouldn't look out of place in the hallowed halls of Oxbridge. The only distraction to the panelling was the completely glass outer wall with its panoramic view of the city. It had an old money meets new money feel about it.

The ringing sound was made by a small brass bell at the top of the P.W.I. this ringing was to signify that the personal fortunes of one of the three Parkington-Bowles had altered. Behind all of this traditional grandeur was a complex mathematical model for assessing their personal worth.

In the bowels of the Clinicál head office was the I.T. Department. Within it's racks upon racks of hardware was a lone server. The server had been labelled with the name "Providence" which was a geeky joke referring to the "All seeing eye of Providence". Sebastian had commissioned a number of his best software engineers to developer the EOP system. The software was constantly monitoring the personal fortunes of the Parkington-Bowles. It derived their wealth based upon company share prices, private investments, property assets and stock market analysts forecasts of their businesses. The three men shared the same broker and accountant for their financial affairs and both were amenable to the occasional bride. Therefore the software engineers had implemented some simple "read only" gateways into the broker's and accountant's I.T. Systems to periodically glean the latest figures.

Sebastian's share trading fortunes had been about as successful as his other endeavours. "Never catch a falling knife" his financial advisor would suggest. Unfortunately whenever Sebastian invested in a rising share he often became the knife thrower. Repeatedly purchasing shares in his portfolio immediately prior to their price tanking.

Ironically this whole exercise had been at great expense and shaved a couple more million off his personal worth only to discover that he was trailing far behind the others. Not to be discouraged Sebastian looked up the P.W.I. as his motivation to drive forward his company and therefore outstrip his brothers successes.

Clincál's products were as old as its rapidly diminishing customer base, the "leather handbags" wouldn't live forever. They had to do something New and Bold to turn the fortunes of the company around. Establishing new market sectors and inventing new products. The door to door sales of the 70's was far, far behind them now.

They had engaged in the services of a management consultancy called "Schafté" (lovingly referred to as "Shafters") that had caused the letter "S" to gravitate nearer the floor. But their general advice was sound. (Probably no better or worse than you would get chatting to your mates in the pub, but considerably more expensive and therefore far more "qualified"). "You need to speculate to accumulate!". "Hire the brightest minds and protect your inventions with patents!".

This "seminal" advice invoked a recruitment drive of scientists, lawyers and all the associated admin baggage to keep the former, happy, honest and legal.

"Because we care – about the future" was scribbled on whiteboards around the office. Printed on re-branded stationary and regurgitated at shareholder meetings.

Clinicál was reinventing itself to become a very different company indeed.




Pause - Chapter 2


Rebound

Over the next few days the truth about George slowly unravelled. He did unfortunately meet his demise and it was down to his impeccable punctuality.

Sunday afternoon 3pm George had agreed to service the church clock. With 3pm being the optimum time to access to clock movement mechanism and adjust the hands of the clock to be precisely the right time.

At approximately 3:05pm the church bell ringing group had arranged an impromptu bell ringing session, after being kicked out of the local pub due to early closing on a Sunday afternoon. As they began their rowdy practice session they were oblivious to George staggering about in the tower clutching his ears in agony.

George was struck full in the face with the largest of the bells and hurtled down the clock tower. He somersaulted backwards hands still over his ears like a Russian circus performer exercising a back flip. His body finally came to rest impaled on the B flat pipe of the church organ.

From that day on ceremonies at the church would have to endure the occasional dull "futt" note in their hymns, due to the bent pipe. The congregation agreed to keep the pipe as it was as an eternal reminder of their beloved George.

Cynthia stopped making noises like an approaching police car and returned to her motherly self. Digging deep in her emotional reserves and taking full responsibility for keeping the family together.
She took over running the shop and resurrected the jewellery side of the business and also combined it with sewing and knitting. A somewhat unique combination of retail outfits that happened to suit her more creative side.

The shop made enough income to keep a roof over their heads and food on the table. The premises were already paid for after George had studiously saved money over the years and bought the lease outright from the landlord.

Jake disappeared to college to study, Business Studies, Economics and Psychology. Taking a large slice of his fathers savings with him for "important books and stuff".

People still returned to the shop with things that needed fixing. Some out of habit and a reason to reminisce with Cynthia, some out of unawareness that George had died.

Phil had noticed that more and more people were bringing computers into the shop. Most of the "problems" people were having with these were not faults with the devices themselves but the fact that the people didn't really know what they were doing.

Phil discussed with his mother the opportunity to lend a hand in the shop on evenings and weekends for a bit of extra pocket money. He also selflessly offered this to give his poor mother a break from the 14 hour days.

Phil already had a good rapport with a lot of the established customers, knowing him as "George's son" or "George's lad". He had a skill with being comfortable using computers but also being able to explain clearly and concisely to others how to use them. The customers did not find him a "smart Alec" of "condescending little shit" as many of the computer boffins were represented in the media. He was just a bright helpful lad who pointed them in the right direction without making them feel like complete luddites.

And so this was how over the next few years George's jeweller's and general repair shop morphed into Phil's computer shop. Following in his father's footsteps he became the reliable figure who could be counted on. He regularly overhead conversations in the local shops and pubs stating, "yeah Phil'll fix it". Which he adopted as the name for the shop. "Phil'll fix-it - Computers" was emblazoned on the front in neon day-glo orange. Artistic taste not being one of Phil's stronger qualities.

As the popularity of the shop increased and Phil embraced the lucrative mail order business of the late 80's he had to expand, hiring an assistant called Chan. Chan's family was originally of Chinese decent but he was born and bred in Walthamstow.

Growing up surrounded by a Chinese speaking family had effectively made Chan practically bi-lingual. He was a chameleon who could lapse into either dialect effortlessly. When negotiating with off shore suppliers for cheap components he was a god send. Much happier to deal with a native speaker the discounts received could be gob-smacking. When chasing up unpaid invoices from London based businesses he could adopt and almost East end gangster voice. Without verbally threatening to "send in the boys" the customers on the other end of the phone would visualise a 6 foot plus heavy who wasn't going to take no for an answer. A long way away from Chan's diminutive and delicate status.

Chan was most comfortable though speaking English with a Chinese twang. It probably required the least effort mentally and was a half way house between home and work. When answering the phone to customers "Phil'll fix-it computers" gradually deteriorated into "Felix computers" which ended up as the unofficial name of the company thereafter.

Chan was the most devout worker Phil could of dreamed of and they developed more of a best mates in business relationship than an employer / employee one. Cynthia often referred to Chan as her adopted son and regularly invited him upstairs for dinner as one of the family at the end of the working day.
Phil sometimes guiltily wished Chan had been his brother instead of Jake who had disappeared into the world as a "Graduate Trainee" at a large management consultancy. Occasionally gracing the family table at Christmas to regale them with details of his working the way up the corporate ladder at the expense of unsuspecting businesses that had engaged in the services of said consultancy. Often turning up empty handed present-wise because his job kept him "Soooo busy!", but not leaving until he had made a sizeable dent in the contents of the kitchen and mini-bar.

During the mid 90's Phil and Chan were ready to monopolise on the onset of the internet as a business model, being involved right from it's infancy. They'd already ridden the wave of the bulletin boards of the late 80's. Made a tidy sum selling modem's and IBM compatible PC's to enthusiasts and small businesses.

Having already computerised their whole operation internally it was not a major programming effort to set up their own e-commerce store touting their computer wares and services to a broader audience. Life was good, business was thriving and Phil and Chan had a world of opportunity in the palm of their hands.

Meanwhile Jake had quit his job at the management consultancy to form his own internet start-up. He tried to persuade Phil to get involved as the venture capitalists were "virtually throwing money" at him. Had Jake had a more sensible idea than an "internet based book shop", Phil might've been more inclined to get involved. He had inherited his father's cautious gene that warned him if something was too good to be true it probably was. Plus, anything to do with Jake was generally a disaster and he was loathed to get involved. Jake on the other hand threw himself into the venture with abandon. Re-mortgaging his house to way beyond its market value and playing zero percent roulette with a wallet full of credit cards.

Unsurprisingly Jake's start-up rapidly burnt through the venture capitalist's money and Jake's own cash too. Foosball tables, Frappacino machines, and pastel coloured break out areas didn't come cheap. Neither did premium rate contract hired developers whose coding skills we so in demand that they could happily renegotiate their hourly rate on a daily basis. In terms of ruthlessness the developers made Jake appear almost Mother Theresa like.

With hindsight Jake's "internet bookshop" idea was probably brilliant afterall Amazon did finally turn a profit and ended up a world conquering business. The main flaw in Jakes idea was that his developers were building a fully 3D immersive bookshop experience in a browser. For customers to stroll around Jakes store and browse the shelves. 20 years later and the technology might of been feasible. Sadly in the mid 90's an Internet Explorer 3.0 machine would just about render the cover of a book and the contents page before the phone connection dropped.

The developers dressed up their code with sufficient smoke and mirrors to keep Jake enthused long enough till the money ran out. Then they all hopped onto the next dot.com bubble like a character in an arcade game. Leaving Jake jobless, penniless, homeless and shortly afterwards wife-less.
For a short while Jake had to swallow his pride and return home, shacking up in his old bedroom that his mother had dutifully maintained for this very occasion. Phil had contain his smugness each morning as he passed his brothers old bedroom on his way to work. The sight of a fully grown man barely snuggled beneath a "Roy of the Rovers" duvet cover being flanked by a squadron of air-fix kit aircraft was hilarious. "Oh how the mighty have fallen" Phil thought to himself with a wry smile.
But soon Jake was back on his feet "chasing the dream" and profiting off of other peoples suffering. "Bubble-Burster's" was his brainchild, a support group (consultancy) to help the poor unfortunates overcome the stresses and strains of the dot.com boom and bust. A noble pursuit from someone who "had been there, man" like a grizzled post war veteran. Predictably Jake's scheme was more a way of milking the gullible of any remaining assets and cash they had, but offered "free" advice on refinancing their debts to one easy package. Carol Vorderman would've been proud. Obviously this refinancing came with healthy back handers to Jake from the banks, and he appeared as their saviour charging in on his white horse during their darkest hour.

With Phil's prudent approach to his business he continued to turn in a tidy profit year on year. Never over stretching himself, with no aspirations of developing the next mega corp. He looked forwards to his stroll downstairs for another day with Chan.

Surfing the net and accumulating random and obscure facts. Setting each other online challenges for who could discover an answer the fastest, who could collect the most "googlewacks". Solving technical problems for customers, family and friends gave his a sense of satisfaction.

Chan used to laugh at the way people who were never interested in computers before had become obsessively attached to the social networks. Barely raising their eyes above their smartphones to utter a few txt abbreviated grunts. Was this really the communication revolution?

Phil and Chan liked to think they had "their" obsession under control and used the net for far more useful purposes. Like collating top 5 lists like the characters from the record store in Hi-Fidelity. The net was their playground but also their bread and butter.

Life was good right up until early 2005 when Mum started becoming ill.

Pause - Chapter 1


Promise

"Good night Mum, I'm gonna fix this OK?" Phil promised as he kissed his mother on the forehead to conclude his nightly vigil at the local hospital. She was so weak it looked like it was almost too much effort to raise her eyelids to bid him goodnight.

"Night son, you take care of yourself, don't worry about your old Mum" she croaked, words rasping in her dry throat. He could see she was fighting the onset of sleep just to be polite.

He lifted his polar fleece from the back of the chair and put it on before leaving the ward. His mother's words of advice ringing in his ears from his childhood. "Don't forget to take your coat off inside, or you won't feel the benefit when you go out!". His bottom lip trembled a little, thinking of the irony of how the roles in this relationship had been cruelly reversed.

As a child his mother, Cynthia, was a big strong woman, raised as a the daughter of a mechanic she was a Tom-boy as a girl and the backbone of their family unit. She lived for her family, held down numerous jobs to provide for him and his older brother Jake. She vigorously upheld family values and shaped their family into a close knit unstoppable force to be reckoned with. No one crossed the Jones' without her knowing about it.

Everything that went on in that household was the business of the whole family. They all went to school plays, graduations, swimming galas, sports days, parties, funerals and sometimes even doctors appointments. She felt that family life was about sharing the highs and lows and becoming stronger from it. Little did she know that she would end up laying dying in a second rate NHS hospital with hardly any visitors.

Jake's career took him overseas as a motivational speaker on the effects of positive thinking. He was so committed to his work on "positivity" that he had left behind a collapsed marriage and three dysfunctional children. Such was the power of "positive thought" that he really didn't give a shit about anyone else and had grown up into such a selfish git that he couldn't be arsed to visit or even phone his ailing mother during her initial sickness.

Cynthia would be devastated to see the trail of damage and bullshit he was haemorrhaging around the globe. A long way away from the two boys she brought up so lovingly. Rubbing Vick on their chests when they had a nasty cold and putting on a paraffin night light if it was particularly bad. Getting up an hour before them so their breakfast and clothes were ready and waiting. Jake and Phil skipping to school thinking they were glowing like a couple of Ready Brek kids with their stomachs full of porridge.

This was not to say that the boy's father was absent in the family, like Cynthia, her late husband George had been just as firmly committed to his family. He worked tirelessly as a jeweller and they lived above his humble shop in Walthamstow. Unfortunately the neighbourhood was not affluent enough to sustain a jewellery business alone so George decided to expand his business into watch and clock repairs, at which he was particularly adept. The repair business completely subsumed the jewellery trade so that in the end George was known as "Mr Fix-it" and could turn his hand to the repair of most mechanical and electrical household items.

Phil fondly remembered peering over his father's work bench to see a multitude of disassembled devices, incredulous that his father could meticulously reassemble the parts back into a fully functioning device. George taught Phil how to pragmatically tackle problems of devices he never understood, decomposing it to simple manageable parts so that anything seemed achievable. Isolating the failed components via a series of logical deductions. George was Phil's hero and inspiration. Sadly Jake did not follow Phil's enthusiasm in his father's business. Much happier burning through the profits of his father's labours in college funds, university grants, house purchases and failed business ventures. Where Phil saw a fountain of knowledge and wonderment, Jake saw a badly attended open wallet ripe for the picking.

Phil inherited his dad's logical prowess and thirst for understanding how things work when he was presented with his first home computer in 1982 at the age of 12. George's eyesight was beginning to fail due to a lifetime behind his jeweller's monocle, and with the early onset of Parkinsons his hands had occasional shakes too. However he regularly spent a Sunday evening with Phil reading out program listings from a magazine as Phil's younger nimbler fingers keyed them in. Often spotting the typo's well before his young son.

Between them grew a love for computers, but George sadly had to admit defeat of the modern miracles only because his body was gradually failing him. Providing him no longer with the physical and mental dexterity he had as a younger man.

Jakes love a computers only transpired as far as endlessly playing computer games, monopolising the family television set and making a tidy profit circulating pirate copies of games in the school playground.

Then one Sunday afternoon Phil was waiting for his father's slow heavy footsteps on the stairs to announce the onset of another father / son programming session. Normally this was their special shared time, the only day of the week that the shop downstairs was closed. All other chores and homework were out of the way.

He looked at the clock, it was 4pm. As a clock repairer/maker George's punctuality was exceptional. He was never late for anything.

The clock on the mantelpiece seemed to tick louder and slower than ever. It was late autumn and dusk was beginning to settle outside casting long dark shadows through the net curtains. Phil had the computer plugged into the TV and the magazine folded crisply at the page ready for typing. His dad hated it when he started without him because he said he struggled to follow the flow of the logic unless he was involved from the start.

Jake was in his bedroom blasting out the top of the pops chart countdown whilst simultaneously recording it on his cassette recorder. No doubt he would try and flog off a few copies of the chart hits to unsuspecting punters at school by sneakily cutting the recordings short before the DJ's spoke.
4:10 pm still no sign, Phil was feeling uncomfortable and a little anxious.

4:30 pm the phone rang and he heard his Mum answering it in the hallway. He could hear her muffled voice, a series of polite "yes", "OK", "ah-ha's" followed by a timid "thanks for letting me know". Then a clunk as she dropped the phone on the floor. Followed by a disturbing, sliding, crumpling, collapsing thud of his mother feinting and tumbling from her hallway phone seat.

Phil rushed into the hallway confronted by the sight of his mother spread eagled and unconscious. The "drrrrrr" tone of the dead phone ringing in his ears. Strangely the first thing he did was return the phone to its cradle as his parents had constantly reminded him how important the phone was, it was not a toy and you could easily run up massive bills if you don't hang up correctly etc.

Finally his senses really kicked in and he realised he should be comforting his mother. He called out to Jake for help, but he was far too engrossed in the latest Dexy's Midnight Runners hit to be of any real use. When he finally opened his bedroom door after Phil's constant hammering it was to give him a mouthful about spoiling the recording of this weeks number one.

Only when he spied his mothers prone body over Phil's shoulder did he reply with a slack jawed "oh, shit!".

Between them the boys managed to sit Cynthia up. Jake being the stronger older brother he lifted her from behind whilst Phil slid her legs around. Leaving her resting somewhat awkwardly but upright against the kitchen door. The colour began to return to her cheeks, her eyelids fluttered and slowly she came to, as Phil held her hand nervously.

"Are you OK Mum?" asked Phil tentatively, "Can we get you a glass of water or something?"
"You went down like a sack of spuds, Mum" Jake added jovially trying to lighten the mood.
But Cynthia just stared blankly towards the phone not responding to either of her boys. A single tear welled up in her right eye and slowly rolled down her cheek and onto the curl of her top lip.
Phil looked at the tear with bemusement, he couldn't remember the last time he had seen his Mum cry. She never cried, not even when their old dog died she soldiered on and dealt with it all in a good old "stiff upper lip" fashion.

"Mum...." , "...Mum?" "who was on the phone, what is it?" he croaked, finding it difficult to form the words in his throat, asking the question that he didn't want to ask, didn't want to know the answer to.
"Mum?, Mum?" echoed Jake "c'mon were on the edge of our seats here!", that was Jake subtle as a brick, oblivious to people's feelings and emotions.

Then she began to wail, a low guttural wail, almost like an old fashioned siren approaching from over a hill. Both boys had never heard their mother make a noise like that, never heard anyone make a noise like that.

The next few minutes were a bit of a blur. A man from the local church knocked at the door, came in and took Mum into the living room. The boys were sent to Jake's room to listen to the radio with orange juice and a whole packet of bourbons. Normally this would be seem as an unbelievable treat but they just sat opposite each other on the bed slightly numb.

"It's dad, isn't it? Something has happened" queried Phil.

"You don't think he's left her do you? Done a runner with one of his customers?" joked Jake.
"I'm serious Jake, something is up, he's never late, and Mum is acting weird." replied Phil.

"Mmmm, yeah" murmured Jake. It was clear that his goldfish like attention span had subsided and he was on the far more pressing task of labelling his latest C90 cassettes with the playlist of todays charts. Phil sat knees up on the bed cuddling them and rocking gently.

It was then that the man from the church entered the room. Phil noticed he had a tiny bit of fluff trapped in his left eyebrow. He was good at noticing small details, his dad always credited him on that skill. Hearing the words "... about your Dad..." sprung his mind back into the conversation. This fluffy eyebrowed man from the church was talking about his Dad, he wondered if he had missed anything important.

"... we pass on our condolences to you and your family" the man said sombrely.
"condolences" thought Phil, "isn't that one of those big words they use when talking about dead people?" "Erm, yeah, thanks...." he politely replied. His parents would be proud of his manners, he was a good kid, had been brought up well.

Jake busied himself untangling a mangled cassette from the cassette recorder and trying to salvage the twisted tape the best he could with the aid of a HB pencil. He had not heard a word the man had just said and all Phil had caught were his "condolences".

The man backed out of the room and replaced his hat, clearly he had removed it earlier as a mark of respect to whatever had happened. Gently closing the door behind him after courteously conducting his civic duties.

Slowly the gears meshed into place in Phil's mind, the planets aligned, the penny dropped, the bell rang. It finally dawned on him that his father was dead. He was clueless to find our how? Why? When? His brother was all consumed in his record empire and is mother was probably still a gibbering wreck.
With no-one else to turn to he sought solstice in the only "friend" he could turn to. He returned to the living room and was bathed in the fluorescent glow of the television. The friendly prompt flashed on the screen begged for his input. Happy to perform whatever operations he wished.
"Ready?"

Tuesday, July 05, 2011

Android devices appears as "???????? no permissions" in adb

Whilst tinkering with some Android development I ran into a nasty problem on Ubuntu where "adb" didn't seem to be recognising my android devices when connecting them to my pc.

I diligently followed the instructions here:-

http://developer.android.com/guide/developing/device.html

My device was being "seen" but not identified.

When performing an "adb devices" I was receiving:-

???????? no permissions


One recommendation was to run adb as 'root' with the following commands:-

adb kill-server
adb start-server
adb devices



But doing anything as root makes me nervous, an alternate solution that is not as well documented is to include your own username in the /etc/udev/rules.d/51-android.rules file.


SUBSYSTEM=="usb", SYSFS{idVendor}=="0b05", MODE="0666", USER="rob"

By including the USER parameter in the file adb now happily recognises my Android tablet when its plugged in without running adb as root.

Back to the development...

Friday, March 11, 2011

Message Broker Maven Plugin code released

This post harks back to some work I did last year on automating builds on IBM Message Broker using Hudson.

http://robbaines.blogspot.com/2010/09/message-broker-continuous-integration.html

I have recently been asked if the source code is available.

After a few enquiries I got the thumbs up the release the code.

Here is it:-
https://code.google.com/p/maven-rsb-wmb-plugin/source/browse/#svn%2Ftrunk%2Fmaven3%2Fdocs

One caveat is that I have had to desensitise both the code and the supporting documentation to make it available to the open source community, basically ripping out references to any company related IP.

I am not currently developing on Message Broker so was doing these changes blind.  Hopefully the code is still in a functional state.  I also checked in a fairly extensive instruction doc as well.

So there you go, have fun....

Monday, March 07, 2011

Python coding on the bus

I have recently acquired an android phone and discovered the android-scripting project:- http://code.google.com/p/android-scripting/  Now I'm able to crank out simple python programs even on the bus ;)

The code below is for a silly app I wrote whilst trying to get my 10 year old son to learn his times tables.

I wrote the bulk of it at the table whilst quizzing him.  Refining the code the following day on the bus.  It originated from the "speak.py" script provide with SL4A.

He was almost in tears of laughter hearing a mobile phone swear at him but it did encourage him to practice times tables and did well in his test.


""" maths test - by Rob Baines"""
import android
import random

def yes_no_dialog(message):
  title = 'Alert'
 
  droid.dialogCreateAlert(title, message)
  droid.dialogSetPositiveButtonText('Yes')
  droid.dialogSetNegativeButtonText('No')
  droid.dialogShow()
  response = droid.dialogGetResponse().result
  return response['which'] in ('positive')

droid = android.Android()
name = droid.getInput('what is your name?').result
loop=True
droid.ttsSpeak("hi " + name +" sit your arse down its time for your maths test" )
another=True
total_questions=0
correct_answers=0
while another:
    num1=int(random.random()*13)
    num2=int(random.random()*13)
    answer = str(num1 * num2)
    total_questions+=1
    message = name +" what is "+ str(num1) + " times " + str(num2) +"?"
    droid.ttsSpeak(message)
    message = "the answer is " +str(answer)+" were they right?."
    correct_answer=yes_no_dialog(message)
    if correct_answer:
        message = "well done"
        correct_answers+=1
    else:
        message = "the answer is "+ answer
   
    droid.ttsSpeak(message)
    message = 'would you like another question? '
    another=yes_no_dialog(message)
result="you got " + str(correct_answers) + " out of " + str(total_questions)
droid.ttsSpeak(result)
droid.dialogGetInput('', 'press enter to end the program', '')
alert =droid.dialogCreateAlert('bye', result)
droid.dialogShow()

Thursday, January 06, 2011

Continuous integration with Hudson, virtualenv, pinax/django

Continuous integration with Hudson, virtualenv, pinax/django

And once again I'm back on the CI bandwagon...

We have been recently working on a project at working involving Python/Django and Pinax.  However to get off on the right footing we felt it was important to get a decent CI solution in place to support test driven development (TDD) including automated unit tests and code coverage.

The organisation is already a heavy user of Java and so python was something new on the table.  Hudson, Maven et al was already is use elsewhere and so to prove that python could also cut the mustard for TDD as well.

I have trawled the net for a number of solutions that led me along this path:-


Thanks to these pages and probably a few others I have achieved the complete working solution I desired.

Hopefully the notes below will help you too.


Prerequisites:-

Install virtualenv
Install python 2
Install database (eg mysql) (if running test locally)

Assumptions

Currently this guide assumes that the host system is Linux. Changes will have to be made for other platforms such as Windows.

Hudson plugins

Setenv plugin (for setting environment variables) V1.1
Cobertura plugin (for coverage reporting) V1.0


Configuration
Create a new Hudson job:-

(Note do not have any spaces in project name, at this creates a matching directory in the /var/lib/hudson/job/ path and spaces can affect running the python interpretor under "virtualenv")
 

Job settings

This first section of the config describes the project and defines where to retrieve the latest source code from the source repository.

Build environment

PATH=.env/bin:$PATH

The "setenv" plugin is used to prefix the main path used by shell scripts with ".env/bin".  The ".env" will be create in the next section of the hudson job if it does not already exist.

Build steps

The build section of the job has been split into 4 logical shell scripts.  This could easily be incorporated into one single script is have been done purely for readability and logical separation of the steps involved.

Step 1: create virtual env (if it doesn't exist)

#!/bin/bash
if [ -d ".env" ]; then
        echo "**> virtualenv exists"
else
        echo "**> creating virtualenv"
        virtualenv .env
fi 
source .env/bin/activate

The last statement in this script "activates" the virtual environment.  This means that any python packages will be installed inside the local environment and leave the host machine unaltered.

Step 2: install required dependencies

pip install -r /requirements/project.txt

# add locally for now, this should be done at machine level
pip install MySQL-python==1.2.3

This script installs the required dependencies for the project.  These can be found in two files in the projects source code under the "requirements" folder.
base.txt contains the base dependencies for a standard "social" pinax project.  This includes django, and all associated django applications for the pinax project.
project.txt contains additional dependencies that have been discovered during the projects development.  Any new dependencies must be added to project.txt NOT base.txt

For our project the project.txt contained the following dependencies:-

coverage==3.4
unit-test-xmlreporting==1.0.3

plus other stuff unique our project.

The virtual environment is not recreated for each build so only missing dependencies will be added by subsequent builds.

Step 3: prepare local_settings.py
#!/bin/bash
# delete local_settings.py if it exists
rm /local_settings.py
# rename hudson specific file
mv /local_settings.py.hudson /local_settings.py
echo "local_settings.py replaced with hudson version"

This script "prepares" the local_settings.py file with hudson specific configuration.  
local_settings.py.hudson is the file checked into SVN (There will be a number of local_settings.py.XXXX files for different environment etc)
Note:- local_settings.py must NEVER be checked into source control but developers are able to maintain their own local version on their development machine for their own personal settings (eg. database credentials etc)
Any values defined in settings.py can be overridden by values in local_settings.py as it is executed at the very end of settings.py

The script deletes any existing local_settings.py and renames local_settings.py.hudson to local_settings.py

Step 4: execute tests , generate coverage reports
#!/bin/bash
source .env/bin/activate
cd 
# delete old coverage data
coverage erase
# run tests - recording coverage
coverage run --source="apps/,apps/" manage.py test   
# generate an xml coverage report
coverage xml -o coverage.xml
# generate html coverage reports
coverage html -d ../../builds/${BUILD_ID}/coverage_html

This script activates the virtual environment.  
Navigates to the main  directory where the application is located.
Deletes and pre-existing coverage data.

# run tests - recording coverage
coverage run --source="apps/,apps/" manage.py test  
This line runs the "manage.py" python script and executes tests within the  and  application.
Note:- if adding any new applications to your project this line should be amended to include the directory of the code in the --source parameter and the application name in the test parameter.

Normally you would use the following command:-

python manage.py test  

However by replacing "python" with the "coverage" command you are able to execute the code whilst performing code coverage monitoring.  The "--source" parameter allow you to specify a comma separated list of "directories" to monitor for coverage.
Warning do not include any spaces in this list.  During testing I used "apps/ , apps/" instead of "apps/,apps/" and only the  code was monitored.

# generate an xml coverage report
coverage xml -o coverage.xml
After execution the "coverage xml" generates and xml formatted report of the coverage that is compatible with cobertura plugin.

# generate html coverage reports
coverage html -d ../../builds/${BUILD_ID}/coverage_html
This final statement generates some additional html formatted in a folder called "coverage_html".  I have not worked out how to make this folder visible from the hudson front end yet.
The benefit of these coverage reports is that they are based upon the python syntax, whereas the cobertura reports do not deal with python comments correctly so some colour coding is wrong.


Tuesday, September 14, 2010

Message Broker - continuous integration - with Maven

And once again I'm back onto continuous integration...

I wrote about this quite a while ago and got a certain distance using an ant based build and cruise control. However due to work commitments, deadlines blah, blah, blah I never finished what I'd first started. It was really a pet project and not part of my official role.

Fast forward 12 something months and I'm tasked with the same challenge again but this time for real. Therefore I can spend real time on the solution rather than noodling about on my PC on the train.

However this time there is a new kid on the block called "maven" http://maven.apache.org/. (Actually not really that new but as a corporation we have adopted it as a "standard" build tool.

Therefore the previous work I did is kinda irrelevant but the principals the same.

There are plenty of sites providing tutorials on maven that go way beyond the realms of my knowledge. The important factors to get IBM Websphere Message Broker playing nicely with maven are the plug-ins. Note all this work has been done on version 6.1 of the Broker.

There are already a couple of plugins kicking about in the open source community that I tried to use but didn't work (for me). They did world on simple projects but when getting into multi project dependencies etc they didn't quite cut the mustard.

As part of my solution I developed 3 separate plugins to wrap existing broker commands. Allowing them to be invoked as part of the build process.

mqsicreatebar
mqsideploy
mqsiapplybaroverride

For know I'll talk about the first one.

mqsicreatebar

Uses the maven pom.xml file to pass parameters to the plugin. This plugin will create a empty eclipse workspace for building and then only add the required projects to the workspace. Seasoned broker developers will know the joys of working with the eclipse toolset and watching their life waste away watching the "rebuilding workspace" message.

To code looks at the main .project file and drills down through any child project files collecting project references to include in the build.

These references are collated for form parameters for the mqsicreatebar command. The code also collects references to .jar, .outadapter, .mset files also required to successfully deploy the message flow.
(Note the code only includes .outadapter files because we are only using SAP outbound adapters, it could easily include .inadapter files to I guess.)

The end result of a successful build should be a .bar file containing a single controlling message flow, with all its associated .jar, .mset, adapter files. Meaning that there are no other dependencies to deploy this message flow.

Now wouldn't it be perfect if everything "always" worked that easily. Until you get some rogue developer who breaks the build. What the plugin also does it create an additional .bar file after compilation containing all the source code of the referenced projects. So if your project does fail to build you can unpack the bar file and import it into an EMPTY workspace and try and compile it manually.

The toolkit should then be kind enough to pinpoint who's broken the code and must buy all the doughnuts. (<-- notice the British spelling ;) )

Well that is the createbar plugin basically covered. I'll try to write up the other plugins and see it I can get approval to release the code. (Maybe minus the corporate namespaces...)

There is a big push here to embrace the open source community so its time we gave something back too...

Next time mqsideploy.

Friday, February 05, 2010

A2B interest wanes

As expected the interest I have in developing A2B is beginning to wane.

I feel I have coded a near complete game which is rough around the edge but ticks all the boxes. Rather than fester on my harddrive I have at least released the source to the community (warts and all). If some brave soul wishes to take up the baton away they go.

However my butterfly like interest has moved onto pastures new. After spending the bulk of my professional career on system integration and "back-end" systems. I feel the need to indulge myself in a bit of client side web development.

My head has been recently buried in a book on Mashup development and jQuery. I am planning something new involving Google App Engine. Python based site with jQuery in the client.

Watch this space.