Educating the world

Our blog has over 10,000 readers a month

Copying files to a remote share on windows

April 13th, 2010

When you are writing batch scripts (programs that run in the background without user intervention) you often need to copy a file on to a remote machine. If you are not already connected to the machine you will get this message when you try to initiate the copy:

C:\>copy file.txt \\remote-host\c$
Logon failure: unknown user name or bad password.
0 file(s) copied.

You have tried to access a share that is password protected. You must connect to the share and authenticate yourself. It’s easy to do this via Windows Exploder->Tools->Map Network Drive… but how do you do it without using the Windows user interface?

As with all Windows commands it is overly complicated and not very simple to remember, so here are a couple of cheat sheets to connect to, view and disconnect from windows shares.

Connect to a share

net use z: /user:domain\user \\host\share password

See the status of a share

net user z:

Disconnect from a share

net use z: /delete

If you don’t specify a drive letter to map the share on to then you can only reference the share by its full name (\\host\share). You must also disconnect using the full path as well, for example:

net use \\host\share /delete

So to copy a file to a remote machine you can use the following lines:

net use z: /user:domain\user \\host\share password
copy my-file.txt z:\their-file.txt
net use z: /delete

or

net use /user:domain\user \\host\share password
copy my-file.txt \\host\share\their-file.txt
net use \\host\share /delete

depending on whatever floats your boat! Well ok, it’s not that complicated.

Change Plesk 9.3 Horde IMP mail list rows to be selectable

April 6th, 2010

The current version of Plesk 9.3 uses Horde 3.1.7/Imp 4.1.6 which is a little on the old side, but I’m pretty sure this change hasn’t made its way into the new version either.

One of the features of the current mailbox page is that when you select the checkbox it highlights the row. This is very nice, but from a user’s point of view the whole row should be a selectable object. Why should the user have to click the tiny area of the checkbox when the row spans the whole page.

So the problem is how can I make clicking on the row check or uncheck the checkbox.

The solution requires you to update the horde/imp sources so you must have access to them. It is also in an area of Plesk that will be overwritten by future Plesk updates.

First we must move the selectRow onClick operation from the checkbox to the row.
Go to : /usr/share/psa-horde/imp/templates/mailbox

Edit: mailbox.html

Change table row element to:

XML

<tr id="row<tag:messages.uid>" class="<tag :messages.bg>" onclick="selectRow(<tag :messages.uid>);">

and remove the onClick from the checkbox element changing it to:

XML

<tag:overflow_begin><input id="check<tag:messages.uid />" type="checkbox" class="checkbox" name="indices[]" value="<tag :messages.uid><if :search_mbox><tag :idx_separator><tag :messages.mbox></tag></tag></if>" /><if :messages.status><tag :messages.uid>"><tag :messages.status></tag></tag></if><tag:overflow_end>

Next edit javascript.inc and search for “function selectRow".

Change the if statement to:

Code

if (rowOb.className.indexOf('selectedRow') != -1) {
  rowOb.className = rowColors[rowId];
  rowOb = document.getElementById('check' + rowId);
  rowOb.checked = false;
} else {
  rowColors[rowId] = rowOb.className;
  rowOb.className = 'selectedRow';
  rowOb = document.getElementById('check' + rowId);
  rowOb.checked = true;
}

All done!

My perfect 10 pin bowling conditions

April 1st, 2010

Due to the fact that I currently go 10 pin bowling about once a year with work’s sports and social, I forget what conditions I need to set up for myself to play well. It usually takes 2 games of fiddling to remember my technique (such as it is), by which point it is too late.

This is after all my blog and this is something I want to remember, so sorry if it’s not relevant for you. Well it might be if you are shaped like me. These are my conditions for bowling well:

Shoes: Size 10.5
Ball: Weight 12
Stance: Slightly to the right of the central floor marking, angle body a tiny bit to the right.
Bowl: Wiggle your bum, take 3 steps and throw.

The wiggling your bum part turned out to be quite important. It turned it into a joke and made me more relaxed. When I knew victory was within my grasp I could feel the adrenaline start pumping and that’s when things started to go pear shaped.

Evidence:
Score before wiggling 95.
Score with wiggling 165.

Japanese Tour - Conclusion

March 20th, 2010

There’s no way you could say you’ve seen England if you had just visited London and Birmingham, so I won’t try to make you believe I understand Japan from seeing Tokyo and Osaka.

When I told people I was going to Japan, everyone said “it’s really expensive", “no one speaks English” and “they only use cash, so no credit cards". All of these statements turned out to be false.

Maybe it’s just me, but I found the best places to eat were Japanese noodle bars. These are canteen style food bars which sold udon (thick) noodles and rarmen noodles in a soup with vegetables or meat. Some rice dishes were also available. A filling meal could be bought for ¥450-600, and they didn’t hang around when it came to serving. Some of these food places (particularly at stations) were standing room only. They were frequented by most of the locals from business man to street workers. I didn’t seen any non-Japanese people at any of these places.

A great man once said: “Communication is more than just about words” (thanks Dad) and he is absolutely right: there’s pointing and jumping around. But seriously, I found that almost everyone I came across knew a couple of words relating to their job. For example, the station master knew “platform” and numbers. Most of the people in the street knew a splattering of English and everyone else could signal “straight on then turn left". For all those other things I had Swifty’s “Point It” book - a handy book with 1,200 pictures of every day items.

A lot of the restaurants had photos and in most cases they had made the actual meal and left it outside in a glass box so you could see what you were getting. I purposely picked things I didn’t recognise (blind ordering) because I wanted to experiment with the local food.

Pretty much every sign post had an English translation underneath. The spelling was pretty bad, but it has to be said, better than mine! Most of the shopping centres were filled with British and American stores. After travelling through most of them I was surprised how little Japanese there actually was. Since the last Emperor embraced western culture in the spirit of learning, even to the point to wearing western suits, the whole country has followed behind him.

I brought ¥40,000 (£315) out here with me for 7 full days and I’m bringing home ¥7,000, and I haven’t been watching the pennies. It was around ¥2,500 per night in the hostels and they all accepted credit cards. Day passes for the metro where only ¥1,000. Most of the tourist attractions were either free or ¥600-700. The most expensive things where coffee and posh cakes in western style coffee shops. One couldn’t Switch a loaf of bread and a pint of milk like you could in England but who cares.

The restaurant that Koichie took me to was pretty expensive and if you ate like that every night then I can see how the cost would crank up. I wanted to do what they do, live how they live, which is why I got up early and did the journey to the tourist spots with the commuters. After a day of tourist stuff, I switched district with them. If there is one thing I’ll say about communing, it’s that it is eerily quiet!

I found the Japanese people warm and welcoming. The cities seemed crime free and I hardly saw any dodgy people. I didn’t feel like I had to watch my bags or my back!

The whole ethos of the country is different. They are one, working and living to serve the country as a whole. There’s almost no fat people partly because of the low fat diet but mostly because everyone is active. There is a job for every one - even if it is guarding a hole in the ground. You never see anyone working on there own, even in tiny shops there are 2 assistants. I’m sure it is more expensive to run an economy this way but the total cost is balanced across the whole of it. Low unemployment, people can retire at 60 but most of them stay on with a small wage from the government to sweep the streets or supervise road maintenance safety - and they do it because they want to.

On the whole, I have enjoyed my time here and can thoroughly recommend it. When I’ve seen the rest of the world this will be the first place I will see again. Thank-you Japan.

Here are all the journal entries:

  • Japanese tour day 1 - Travelling to Tokyo, Virgin Atlantic’s lovely air stewardess, Asakusa.
  • Japanese tour day 2 - Tsukijishijo fish market, Amidi Budda temple, Ginza, Nissan Gallery, Imperial Palace, Japanese government buildings, real pawn sushi diner.
  • Japanese tour day 3 - Imperial Palace Gardens, Emperor official gift museum, currency museum, Suitengu Shrine - Seven Deities of Good Luck, Akihabara, make friends with noodle bar family.
  • Japanese tour day 4 - private train lines, Shinkansen (or Bullet Train), Shin-Osaka, Osaka, Yakuza, making more friends in a pub/noodle bar.
  • Japanese tour day 5 - Osaka Castle, befriended by a Japanese tourist, Peace Osaka, resturant recommended by friendly stranger, an Englishman working there, Tenjimbashi-suji shopping corridor, Mitzumi and the mad woman, map mystry solved, Namba, Takayumi, sketch for diner.
  • Japanese tour day 6 - Sycophantic Floating Garden Observatory, super effecient Shinkansen (or Bullet Train), Sanyo Fin, kimono, Koichi’s chicken diner, more girls than boys, Mount Fuji.
  • Japanese tour day 7 - showing people around, you again!, Odaiba, Shimbashi mono rail, Fuji TV, White Day, shopping centre, Liar Game, Menji park and shrine, Akihabara, big sushi meal.

Japanese Tour Day 7

March 7th, 2010

6 March 2010

Not sure if it’s the fact I’ve got over my jet lag or the 2 pints I had last night with Koichi but I slept in to 9 this morning. It’s probably the ending of the jet lag which is typical seeing as I’m leaving tomorrow morning.

Met some new arrivals who looked a bit green so I offered to take them to the metro station and show them how to get the one-day metro pass. After breakfast they said they would just have a shower and meet me downstairs. I should have known better - an English girl and an American girl disappeared and re-appeared in the blink of an hour! Amazing! What do they do with the time?

On the way to the station I bumped into a girl I met in Osaka Castle. I love travelling! This kind of coincidence happens all the time!

Koichi recommended I go to Odaiba. This town was the last line of defence from naval invaders. Part of the name “Odaiba” means canon so there would be some history there.

Caught the Ginza metro to Shimbashi, then hopped on the mono rail. Odaiba is on a set of little islands off the south coast, so there is a suspension bridge which looks very like the one in San Francisco, only white. The bridge must have been built after the town because on one side the bridge comes down as you would expect but on the other side it turns 270 degrees looping under itself coming down parallel to the coast line. Unfortunately, there wasn’t much history when I got there.

To be fair I had actually gone to see the Fuji TV (TV station) which is another tall building with an observation platform. Unfortunately it was really chucking it down again and I didn’t have the heart to pay entry to see another grey skyline, so I just looked around the shops.

At the end of the island there are a set of hotels. One of the hotels was a really posh affair and was totally set up for your “White Day". You’ve guessed it weddings! I really don’t think anyone does anything else in their spare time other than get married!

The shopping centre was having a press release for a film called Liar Game. The stars of the film were here doing interviews and there were hundreds of people screening and waving. It is a Japanese film so there is no one I recognised but the crowd was going mental each time the stars turned around.

I had seen enough and headed back to Shimbashi (the start of the monorail and the edge of the metro), then over to Shibuya. Had a spot of lunch in a restaurant next to the park - a bowl of paste with “special meat sauce” which turned out to be bolognese sauce with no meat in it! Can’t grumble as it cost less than a pint of beer. The restaurant was packed but for some reason I was the only man! Heaven!

After re-energising I went over the road to Yoyogi Park. The closest thing I can liken it to was Hesketh Park only Japanese style. Loads bigger, the paths were 2 or 3 times wider; it was more like a massive coppice. It was in fact very mellow, I could easily have spent all day there. There was a huge shrine in the middle and gardens created for Emperor Meiji.

The weather was miserable so I decided to give Akihabara another go. Walked up and down the main strip and went into a couple of computer shops. It was just like Tottenham Court Road. The prices were similar too. There were plenty of nice cameras, but I don’t know enough about them to make a sensible purchase. Besides, I didn’t actually need anything.

I did come across another porn related craze over here. Ultra-hardcore cartoon porn. It ranged from the very disturbing under aged (4-5) stuff right the way through to adults. The shop had a video playing the most bizarre thing: a school girl (in uniform of course) getting raped my a huge monster which had its tentacles penetrating her every orifice and the really strange bit was the part where the tentacle entered her body was pixelated out. It beggared belief. I was getting peckish so I headed back!

I had really enjoyed the shrimp sushi a couple of days ago, so I wanted to try a bit more. Trekked around Asakusa, which I know pretty well now and found the alley where the restaurant was. The same chefs were working again; they recognised me from last time and welcomed me in. I went for the assorted menu. Four sets of fish meat of various colours. I have to be honest - it all kind of tasted similar but it was nice. I’m sure once I eat more, which I will certainly do, I will learn to taste the difference.

Photos on my FaceBook page.