Most of the time my computer runs using the Balanced power plan. This turns the display off after 10 minutes and puts the computer to sleep after 30 minutes. So you can imagine how upset I get when the computer goes to sleep after 30 minutes, before it can complete the 2 hour download or 3 hour video transcode.
In the control panel (Control Panel -> Hardware and Sound -> Power Options) you can select different power plans. You can then set up desktop shortcuts to configure the system to use the different power profiles. Sadly this is something that you have to remember to do before you start the special program and again after the special program has completed.
I looked all over the internet for a program that will alter the power options (or power plan) automatically depending on which applications were running. Needless to say I couldn’t find one! So I’ve had to write it myself using PowerShell.
Version 1 of the program is really simple. The program has 2 power states, one for when a special program is running and one for when no special programs are running.
There are a few things you need to do to get yourself going.
- Open a Control Panel -> Hardware and Sound -> Power Options find or create 2 power plans. I changed Balanced to turn off the display after 10 minutes and send the computer to sleep after 30 minutes. I created another power plan called No Sleep which switches the display off after 5 minutes and never puts the computer to sleep.
- Open a command prompt and type:
Existing Power Schemes (* Active)
Power Scheme GUID: 381b4222-f694-41f0-9685-ff5bb260df2e (Balanced) *
Power Scheme GUID: 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c (High performance)
Power Scheme GUID: a1841308-3541-4fab-bc81-f71556f20b4a (Power saver)
Power Scheme GUID: b1b44a00-a3a0-4cf7-9ef1-a2a1c117dc5f (No Sleep)
- Pick the 2 power schemes from the list and update the variables
$programs_not_running_cfg_guidinside the program.
- Next we have to find out the names of the special programs, so we can watch for them. Open a Powershell command line. Type:
Get-Process. Load in the special program and type
Get-Processagain. Compare the outputs of the command to yield the process name.
PS C:\Users\mrn> Get-Process
Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName
——- —— —– —– —– —— – ———–
152 15 3364 8776 57 1864 Azureus
- Do this for each special program you want to add.
- Take the ProcessNames and add them as a quoted comma separated list to the variable
Finally, add the program to your start menu Startup folder. If this is the first time you are using PowerShell you may have to change the execution policy to RemoteSigned to allow it to run.
Obviously the program is really simple so if anyone creates an update or a better version then I’d be happy to update this post to share the changes. So without further a do, here it is:
Woke up before the alarm at 6.20, cold shower (no hot water) then down to breakfast.
Mary and Rob had been bitten to death by mosquitoes so gave them some of my Piriton (antihistamine). We left Chitwan at 8am bound for Lumbini, home place of the Buddha.
Stopped at a little village about 10 minutes away. The village had been there for 1200 years. The villagers survived the malaria epidemic by smoking the cannabis which grows locally all around the village, well that was their excuse! The houses or huts were made from mud and clay.
On arriving at the village 2 boys came to say hello and then they said “Candy". What a cheek! Had a rummage around my bag and found a chocolate bar from the last road trip that I hadn’t eaten yet, and gave it to the boys. I gestured that they had to share it. They scampered off a couple of meters and after struggling to get into the packet, the eldest split it into two and they started happily munching away.
At the back of the village there was an animal pen and a vegetable patch. A little girl came to watch us watching the pigs. After two minutes she said sheepishly “Candy". I had another look in the bag to see how much lunch I had left. Found a bag of sweet croissants and in the time it took to get up the girl had been joined by six other children including the two from earlier. I split them so they could share the food equally amongst themselves. Rob made a joke that if we came back in a year, they would have got rid of their village statue of Shiva and replaced it with a statue of me handing out chocolate and cakes to the children!
Back in the coach for 2 hours. After we had a rest stop there was a quiz. Steve is by far in a way the worst quiz master ever. It’s so bad it’s good! Yet again the quiz was full of ambiguous multi-choice questions which we all had a laugh about.
Stopped for lunch at a school about an hour from Lumbini. There was a shaded area outside the classrooms so we sheltered under there while eating our pack lunches. Quite a crowd of women and children started watching us from doorways and other shaded areas. Various people in our group had left overs, so walked over to the onlookers and distributed them.
The area was very rural and I think foreigners were a bit unusual. In spite of being a very poor area all the school kids had a school uniform. Most of the uniforms were western in style: shirt, tie, trousers (or skirt) and in some cases a jumper, blazer or both - yes a jumper in 32°C! but they didn’t seem to mind. Back in the coach for the final leg to Lumbini.
We stayed in the Buddhist pilgrim monastery on the edge of town. Tourists are usually not allowed but Losan knew some people in monk-world and so was able to get us in. After arrival we unpacked and relaxed for a bit before meeting in the lobby.
Today was a cycle tour of Lumbini: Development Trust. It was a 1.5km by 6km square block of land which was devoted to Buddha. Bab’s had popped her knee getting down from her bathing elephant so Mary and her were met by a Rickshaw outside the monastery and the rest of us had to walk down to the cycle hire shop. My bike had a dodgie seat and only one break but it seemed to work ok. It was nice to see I could still cycle with no hands when the road (or path) was flat enough.
Losan (our friendly neighbourhood monk) and Steve guided us to the centre where Buddha’s birth place was. The actual spot was enclosed in a white castle building. We had to take our shoes off, so I was getting smiles from everyone because I wear odd socks and they were more obvious now. There was a pool at the back called “The Puskarini, The Holy Pond“. Steps led down to the murky light jade coloured water. Visibility was only a few centimetres and after seeing a turtle we starred in contemplation wondering how deep it actually was. At that point an absolutely monster fish appeared from no where and then was gone. I think the pond was an up-side-down pyramid and the steps to it were just the first steps of many to the bottom.
The whole park was very relaxing and we sat in a semi-circle surrounding Losan while he talked about Buddhism. He explained how to sit and hold your hands. Then we started to meditate. After listening to Losan talking us through meditation for about 30 minutes I realised that I actually meditate quite regularly at home and in my normal life, I just never referred to it as meditation. The were various members of the group who were very spiritual and bought into the whole ethos of relaxing and sitting around doing nothing, but I’m sorry it’s not for me! I use it for sensory exercise - “use it or lose it” (I’ll probably get another blog article out of that when I’ve finished my trip articles.)
During Losan’s meditation under the trees in Buddha’s garden a lot of people came and sat in our semi-circle. I think they thought “our” monk was a general monk for everyone which was okay at the beginning but the numbers soon grew to include hordes of Indian children who were fighting and disrupting what we were doing so we called it a day. We had the rest of the afternoon to ourselves on the proviso that we had the bikes back by 6.
The park has a long channel of water (or canal) that connected Buddha’s birth site in the Sacred Garden to the World Peace Pagoda about 3 km away. Along the canal were the various headquarters of Buddhist factions from around the world. At the end is a World Peace monument with an inscription along the lines of “…Buddha freeing us from the shackles of Gods…". It reminds us that fighting and killing each other over made-up space fairies was no way to behave and we should all just concentrate on keeping ourselves happy by being nice to each other. I had a lot of exposure to Buddhism when I was travelling around Japan and if I had to choose a religion to follow this would be it.
Back on the bikes and the scenic route back to the hire shop. I had caught the sun so I risked an ice lolly! before heading back to the monastery for a shower and dinner.
Drinking and smoking were forbidden at the monastery so a small contingent of people decided to venture out to find somewhere for a post-dinner pre-bed drink. By a strange coincidence the only people who stayed out were from science related professions (engineering, I.T. and analysis). All the nurses, environmental health officers and accountants stayed in. Just had one bottle of Gurka beer (650ml) for 180rs (£1.65).
There was a huge Hindu festival on in the park. A man’s voice came over the public address system when we dropped off the bikes. The voice sounded like it was announcing something but then the drums came and the announcing changed into manic Indian ranting, almost like he was trying to whip the audience into a frenzy. Tractors with trailers full of revellers had been driving up to the festival site and back all evening and at 10pm when we wanted to go to bed it was showing no sign of stopping, even manic Indian man was still ranting down the P.A. only now he was banging drums too.
Jon and I had checked the room for mosquitoes before hitting the lights but it was still really hot. The extra noise wasn’t helping me sleep. After about an hour the manic Indian shouting and drumming was replaced by 2 voices monastically chanting. This was much easier on the ears and I soon fell asleep.
Featured in BBC2’s Dara O Briain’s Science Club on 22 August 2013. Dara was interviewing Professor Dame Sally Davies the UK Chief Medical Officer.
Dara: What are the major health challenges that we face?
Sally: Well, clearly there’s always what we call health protection. Infections, and we’ve talked already about antimicrobial resistance and that going to become worse. We’ve had a pandemic in 2009, we know there’s flu in China at the moment, we know there’s a novel coronavirus coming out of the Middle East. But as well as that, we have new epidemics and people talk about the non-communicable diseases but there are lifestyle ones. There are size, because we like food. It’s an abuse of alcohol particularly in our young and our young women and it’s a lack of exercise.
If there’s a magic bullet, it’s exercise.
Up at 6am for breakfast at 7. We were in Southern Nepal now so the temperature was a few degrees more, we were in the malarial zone and the humidity had increased. The hotel ran on its own generator for about 6 hours each day, usually during the evening. There had been no air-conditioning in our bedrooms so the night had been a little bit hot and sticky.
Buffalo sausages and toast for breakfast. We also listened to some of the other guests showing off the mosquito bites they got during the night. Jonathan and I had yet again escaped unharmed.
The first activity of the day was crocodile and bird spotting on the river. There was a mist on the early morning river which gave quite a calming feeling. The only noises were the natural sound of the river and odd splashes from boats and birds taking off. It was quite eerie. The river was very clear and reeds flowed by. You kind of wanted to put your hands in the water and feel its cold loveliness but I had to keep reminding myself that it was full of crocodiles and bugs designed to give me the trots!
The boats were made out of hollowed out trees and felt distinctly unstable. It didn’t help that there was a man standing on a little ledge at the back steering with a gondola style stick and a man standing on another edge in front of us describing what we were seeing. It took quite a while for us passengers to get used to riding in the boat. It was a little bit like riding pillion on a motorbike. You had to let the boat rock naturally which was very unnerving. There were quite a few fast deep intakes of breath as people thought the boat was going to tip over, but after about half an hour I think we’d all got the hang of it. This was lucky because that’s when we hit the rapids! I’m not talking New Zealand white water rapids but when you have 12 people sitting on a stick moving through crocodile infested waters then it was just as scary.
I caught a glimpse of a baby crocodile poking its head out of the water so the trip was a success. It was a lucky sighting as we had arrived at our stopping point at the edge of the jungle. We de-camped, added more sun-cream and deet and headed into the jungle in search of rhinos, tigers and other jungle beasties.
It was really hot, walking around the jungle for 2 hours especially as the only thing we saw were a few tiger tracks and a few bugs. At one point everyone had to go quiet as the ranger moved stealthily in for a closer look but it turned out to be another party who thought we were a tiger too! We walked all the way back to the place we had climbed into the boats.
The next activity was elephant bathing. We had to sign a disclaimer for this activity but Steve said it was fun. He’d done it and said it was great fun but couldn’t do it with us because it’s too dangerous. It took a while to work out what he meant: it’s ok to do it as a one-off but doing it each time would increase the risk. Everyone was a little bit apprehensive but Rob and I had seem some people doing it as we walked back through the jungle and thought it looked all right. We bravely stepped forwards as first to have a go. Or more, they asked who wanted a go and I foolishly jumped in and made Rob follow me!
I climbed on to the bare back of the elephant. It was a lot warmer and hairier than I had imagined. The elephant man stood on its back behind Rob and me and walked us all out into the river where it was a bit deeper. The elephant slowly bent its head down slurped a considerable volume of river water up its trunk, then raised its trunk up over its head and expelled all of it at a considerable force straight into my face. From that point I could not stop laughing. It was pure fun. After a couple of blasts I predicted when the next one was coming and at the last moment I bent forward over the elephant’s head, the jet of water completely missed me and hit Rob in the face. After the usual complaints about not being ready he was laughing uncontrollably too.
Babs popped her knee when she came down from the elephant and there were a couple of other minor injuries as people fell off the elephants but all-in-all it was well worth it. Left the elephant men with a little tip and went back to the hotel for a shower and lunch. Lunch was pretty nice, some kind of clear vegetable soup and a mixture of eastern and western food. Pabi was sitting on her own so I sat with her. I explained to her that leaving someone to eat on their own was considered rude, so we had a little food related-cultural exchange over lunch which was interesting.
No time to rest and we were back in the Jeep travelling to the Elephant Reserve. We spend the afternoon riding elephants through the jungle looking for tigers, rhino and deer. 4 people per elephant sitting in a metal poled box with our legs dangling over the edge. Once you got used to the walking motion of the elephant it was okay. Still didn’t see any tigers but we did get quite close to a rhino. The park ranger told us that rhinos were more dangerous than tigers so that made us feel better!
One thing that we all commented on was how rude we thought the Indian people were. They turned up tried to jump the queue and left a trail of litter behind them. It was clear that the park rangers had a lot of work to do and we could tell that they were very disappointed with the Indians casually discarding their litter into the river or where ever they were standing. There were litter bins all over the reserve but they just couldn’t be bothered to use them.
We had a free night and we had all thought that it was so nice sitting next to the river that we went back after dinner. I spend a bit more time chatting to Julian and played with the sunset settings on my camera.
Half the battle is getting the Raspberry Pi up and running with Java installed. Once you’ve done that, the rest is pretty simple.
- Firstly Install Rasbian wheezy on your Raspberry Pi.
- Then install Java 8.
- Create somewhere nice for us to work.
- For the latest version of the Finch development kit go to http://www.finchrobot.com/raspberry-pi. Search for BBTechSoftwareForPi and download it.
- They’ve done that thing where you don’t get a containing folder inside the zip, so we’ll have to make it.
Zips don’t hold unix permissions so we’ll have to add execute permissions to anything we want to run.
chmod +x Configure
- We need to run this as
rootbecause it copies libraries into protected places.
- That’s kind of it. Make sure the Finch robot is connected.
- Enter the Java folder
- Compile the sample program
javac -classpath :finch.jar Code/simpleInput/LEDSetter.java
- And run it
java -classpath :finch.jar Code/simpleInput/LEDSetter