I was given the synopsis to Brave New World as follows:
Set in the 7th century AF (After Ford). Brave New World paints a grim picture of a future world in which human embryos are hatched in incubators and conditioned to collectivism and passivity. Bernard Marx, an unorthodox and unhappy ‘alpha-plus’ returns to London with a ’savage’ from New Mexico. Having educated himself by reading Shakespeare and the like, the savage believes in individual freedom and in this new world goes berserk and kills himself.
and asked to choose a style of writing (SciFi/Comedy/Horror/etc) and create an opening. I’d never heard of Brave New World which probably helped because I only had the synopsis to go on. I chose Science Fiction and here’s my beginning:
New beginning of Brave New World
“What’s the current percentage split?”
“Ok, we’d better make this batch female then, pass the oestrogen supplement injector.”
Jones leaned over the counter and passed a thick hypodermic contraption to Doctor Marx who squeezed the contents into the vat and gave it a stir.
“That ought to do it. Set the timer for 6 hours and we’ll call it a night.”
Dr. Bernard Marx had been working at Fry’s People Farm for 12 years and the crushing responsibility was slowly getting to him. Each batch could only be pushed towards a gender and it was tough keeping the balance. Only a few millilitres out could result in a wasted generation. He needed a break. Science was a single man’s game and he needed something to distract him from the monotony of the Farm.
“Goodnight Jones, see you tomorrow.”
Marx was tired. His head was hanging like a puppet with broken strings. He dragged himself into the airlock separating the sterile laboratory and entered the Aplha’s locker room.
Next we had to create an ending to The Living and the Dead. I’d never heard of this book either, so I had no pre-conceptions. Didn’t have time to copy the synopsis but I’m sure you can find it on the inter-web.
New ending to The Living and the Dead
Eden wept. Tears rolled down her face. It had been 10 years since her mother had died, but the grief was still as real now as it was when the bombs dropped. Eden still had her mother’s name so from that respect she was different but she couldn’t help feeling like a failure. She had made her choices and she had to accept them now. It looked like another war was coming but in spite of everything she was happy.
You know how I love my optical illusions so here is a nice one from Mozilla. When I saw it first I just saw a mess of concentric circles. Now whenever I look at it, I can only see the 3D shape.
During Spring development I got this exception, but there was almost no reference to what caused it. So after a lot of searching I found out the cause and thought I’d blog it for others struggling with the same problem.
java.lang.IllegalStateException: Active Spring transaction synchronization or active JTA transaction with specified [javax.transaction.TransactionManager] required at org.springframework.jdbc.support.lob.LobCreatorUtils.registerTransactionSynchronization(LobCreatorUtils.java:79) at org.springframework.orm.hibernate3.support.AbstractLobType.nullSafeSet(AbstractLobType.java:185) at org.hibernate.type.CustomType.nullSafeSet(CustomType.java:146) at org.hibernate.persister.entity.AbstractEntityPersister.dehydrate(AbstractEntityPersister.java:1997) at org.hibernate.persister.entity.AbstractEntityPersister.dehydrate(AbstractEntityPersister.java:1974) at org.hibernate.persister.entity.AbstractEntityPersister$3.bindValues(AbstractEntityPersister.java:2152) at org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:32) at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2158) at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2638) at org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:48) at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:250) at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:298) at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:181) at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:107) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:187) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:172) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:94) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70) at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:507) at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:499) at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:495) at org.springframework.orm.hibernate3.HibernateTemplate$16.doInHibernate(HibernateTemplate.java:696) at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:373) at org.springframework.orm.hibernate3.HibernateTemplate.saveOrUpdate(HibernateTemplate.java:693) at uk.co.bigsoft.Manager.thumbs.ClipThumbnailManagerDaoHibernate.setClipThumbnail(ClipThumbnailManagerDaoHibernate.java:66) at uk.co.bigsoft.Manager.thumbs.ClipThumbnailManager.setClipThumbnail(ClipThumbnailManager.java:25) at uk.co.bigsoft.Manager.corba.ThumbnailReader.newThumbnail(ThumbnailReader.java:106) at uk.co.bigsoft.corba_2_3.ThumbnailListenerPOATie.newThumbnail(ThumbnailListenerPOATie.java:53) at uk.co.bigsoft.corba_2_3.ThumbnailListenerPOA._invoke(ThumbnailListenerPOA.java:50) at org.jacorb.poa.RequestProcessor.invokeOperation(RequestProcessor.java:299) at org.jacorb.poa.RequestProcessor.process(RequestProcessor.java:602) at org.jacorb.poa.RequestProcessor.run(RequestProcessor.java:745)
In order to add large binary objects to a hibernate persistent store (database), the action must be part of a transaction.
In the springframework you must have several beans set up. The first is a datasource bean. This describes how to talk to the database; what language to use, and how to access it.
The default behaviour of the DriverManagerDataSource is to use database transactions if possible. However you need a transaction manager inside the spring application to manage the transaction as a whole; i.e. there may be more transactional units other than a database transaction that need to be tied together, such as a Java Message Queue Transaction. It is this overall Transaction manager that controls whether a particular transaction is committed or rolled back.
Spring provides a factory for creating (or reusing already existing) transaction objects depending on the code we are currently running through.
The transaction manager organises the rules of how one transaction interacts with another, for example we don’t want to fail a larger transaction because a smaller unit of work fails - we would want to retry the smaller transaction several times before failing the larger transaction. The transaction manager manages this.
We would like to use annotations in our code so we will need to tell the xml engine how to understand <tx : ??> namespace tags.
Next we set the transaction manager to use when we use transaction annotations in our code.
Large binary objects need to run inside a transaction because they may have several stages that need to be completed before we can continue. If one of the stages fails, we need to be sure that the system will be able to clean up after us. Spring enforces this as a requirement.
We need a bean to manage the handling of a Large Object (LOB). Spring’s job is to abstract away the complexities of handling 3rd party APIs. Different databases handle LOBs in different ways so we need a LOB handler to take care of them for us:
We are going to use Hibernate as our object persistence store, so we need a session factory to get our Hibernate sessions. The Session Factory needs to know how to talk to the database and how to handle LOBs. We’ll use a bean for that.
Unfortunately I wrote this ages ago but never finished it and never published it. I don’t work in this area any more and don’t have the will power to get back into Spring. So I publish it uncompleted with just a reference to what I was going to put in it. Maybe the first part will give help to some one looking for the meaning of the exception.
show an hbm mapping for the database
show a pojo using input stream
show doa using @Transaction
without @Transactional you get the error.
The last couple of lessons have centred around dialogue.
We had also been discussing how the descriptive text surrounding the dialogue can change everything. I tried to create the same scenario with the same characters but couldn’t quite manage it. The original idea was to have 2 passages which present a different view of the same situation and alter the readers perspective by altering the flowering around the dialogue.
I was going to link direct and indirect discourse to Wikipedia but surprisingly their definitions didn’t seem to fall in line with what teacher said. In fact I couldn’t find a good explanation of what direct and indirect discourse was from Google’s first page. So I provide these passages for you as examples. Can you spot which is direct discourse and which is indirect discourse?
Professor James Monroe slowed the car to a stop. There was almost nobody around. Shadows hid the space between the pavement and the factory doorways. Street lamps flickered and buzzed. The council hadn’t been here for a while.
A woman approached James’ passenger window and tapped on the glass with her ring.
“What do you want?", she asked in a quiet but bold voice.
This was James’ first time down Loose Lover’s Court. Trying to hide inside the car he said sheepishly, “Not really sure, what do you do?".
The woman listed the standard services with prices for each.
“We can talk about any specialist requests you might have, but we can do that later.”
James took a moment to think. Sweat was running down the sides of his waist. He felt so far out of his comfort zone that he started to shake. The woman leaned in through the window and with a comforting voice said, “Don’t worry, I’ll look after you, it’ll be all right. We don’t have to do anything you’re not comfortable with; we can just talk if you like.”
James looked visibly relieved. “Okay” he said.
Jane Bishop was sitting behind her desk looking around her new office. The broom cupboard she had when she was a lecturer was pitifully small compared to a professor’s office.
There was a gentle knocking at the door. “What do you want?” she shouted.
The door opened a jar and a young man stuck his head around.
“Not really sure, what do you do?", he said with a nervous voice that kept cutting out.
Jane had gone to a lot of trouble to get her name and job title embossed on her office door and was about to launch into a diatribe about students walking around with their eyes closed when she noticed a guide dog sniffing at his heals. She took a breath and explained her new position with obvious glee which was clearly lost on John. She when on to explain which philosophy courses they ran at the college and finished with “We can talk about any specialist requests you might have, but we can do that later.”
John seemed at ease, but Jane felt guilty about what she almost said. She re-assured him with “Don’t worry, I’ll look after you, it’ll be all right. We don’t have to do anything you’re not comfortable with; we can just talk if you like.”
“Okay", said John, pleased that he wouldn’t have to do any writing.
I include my first attempt at the “Just starting” story but I had to bin it half way through because I felt like I had got myself into a pickle.
Second story first draft
Professor James was absently staring out of the window of his new office when there was a knock on his door. Before he could say anything the door flew open and his latest project walked in. Maria was a prostitute from the east end of town. She was on her third strike and has been told to co-operate or it was jail.
“What do you want?” she snapped impatiently. She didn’t want to be there, but for her there was no choice.
James didn’t know who the police would be sending, he only knew the area of town they’d be from.
“Not really sure, what do you do?".
She explained that she’d been busted last week for solicitation and possession. James explained that he was writing a book about the underworld and he’d needed her help.
I tried to think of situations that would allow the man to say “We can talk about any specialist..” but struggled so I started again.
Teacher and class comments
- Easier to visualise.
- Good use of indirect discourse which maintained the pace of the story.
- Story showed her sensitivity.
- Good use of “Showing” when talking about Monroe sweating.
- Difficult to follow.
- Very quickly the story reveals lots of facts about the Professor: happy, new job, etc.
- Clever plot twist making John blind, no one expected that.
- Introduced people early.
- Most of the class enjoyed the Just starting better.
- The tension was palpable.
Second story first draft
- “Latest project” liked that, good twist.
- Didn’t need to say she was a prostitute because it would be referred to later in the passage.
This phrase was thought up by Stephen Fry. He enlisted the help of the engraver Graham Short to write it on the side of a fountain pen which would be auctioned in aid of English Pen the body that represents imprisoned writers around the world:
Waggled in the right way this inky little stick can change the world.