Adding a custom NIS/YP map

December 7th, 2012 § 0 comments § permalink

If you use NIS or YP (yellow pages) and want to add your own custom map, here’s how to do it.

First off, edit /var/yp/Makefile to add in the new map. You’ve probably got something like this:

PASSWD = $(YPPWDDIR)/passwd

We need to add a new line for the new map. I want to map usernames between local and central usernames

USERMAP = $(YPSRCDIR)/usermap

YPSRCDIR is /etc in my case, but obviously choose the path that suits you the best.

Now find a line that starts “all: “. This is the list of maps to update. Add your new map to the end, so it’ll be something like

all: auto.home auto.master group hosts netgrp passwd usermap

Further down where there is a group of lines like this:

passwd:         passwd.byname passwd.byuid

you should add in your own map:

usermap : usermap.byname

The “byname” part is an indicator for what the map key is and isn’t that important for us.

You now need to add a section to tell the makefile how to update your map:

usermap.byname: $(USERMAP) $(YPDIR)/Makefile
        @echo "Updating $@..."
        @$(AWK) -F: '!/^[-+#]/ { if ($$1 != "" && $$2 != "" ) \
                print $$1"\t"$$2 }' $(USERMAP) \
                | $(DBLOAD) -i $(USERMAP) -o $(YPMAPDIR)/$@ - $@
        -@$(NOPUSH) || $(YPPUSH) -d $(DOMAIN) $@

This processes the file /etc/usermap and generates the map file. Essentially you just need to print “key\tvalue” into $(DBLOAD) …. This example extracts data from the file assuming it is in the format “key:value”.

Now edit /var/yp/nicknames to add your new map:

usermap    usermap.byname

then run make in /var/yp as normal.

If you have a slave server you’ll probably have a timeout with the new map at this point. To get round this, you need to run ypxfr on the slave to get the map first:

/usr/lib/yp/ypxfr -d <yp domain> -h <yp master host> usermap.byname

Changing java swing look and feel

February 17th, 2010 § 2 comments § permalink

To run, say, the wmqttSample java application using the gtk look and feel for swing:

  • java -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel -jar wmqttSample.jar

Thanks to Andy Piper.

Also, from http://seysayux.wordpress.com/2009/01/11/make-java-use-the-gtk-look-feel-on-linux/ :

First, you’ll have to locate the directory your JVM is residing in. Unless your distribution did some real weird things, it’s usually either /usr/lib/jvm/<version> or /usr/java/[<version>] . Wherever it might be located, i’ll use /usr/lib/jvm/jre-1.6.0_10/ for the examples.

Locate the file named /usr/lib/jvm/jre-1.6.0_10/lib/swing.properties. If it doesn’t exist, create it.

Put the following inside the file:

swing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel

Package in ubuntu!

February 17th, 2010 § 0 comments § permalink

Today a new package was added to the “universe” repository for the upcoming version of Ubuntu Linux. This means that when the “Lucid Lynx” (the codename for the next release of Ubuntu) is released, anybody will be able to easily install sqlite3-pcre, which is an extension for sqlite3 that implements regular expression searching.

I didn’t write sqlite3-pcre, but I did package it for Ubuntu so I’m pleased it’s made it in before the deadline.

Thanks to all of the people on the #ubuntu-motu channel for their help.

Behind the hype

February 15th, 2010 § 0 comments § permalink

Back in July 2009, at the Functional Optical Imaging conference we organised at work, I met someone from Oxford University who was using a very interesting technique to do some high speed imaging. This led to a lot of excitement because it was obvious that we could make a camera to do the same thing much more easily and make the system a lot easier to use. Our two groups have since been working towards putting grant applications together – they are interested in imaging cardiac cells and whole hearts and we hope to design cameras that will make previously impossible things possible. It’s fair to say there’s still a lot of excitement both ends and there’s a good chance a lot of good science will come out of it.

To further flesh out ideas for grants, and for everybody in Oxford to see Nottingham, today was their first visit as a group to see us. This was great – very useful day, fixed some problems with the camera they already have, generated more enthusiasm, made plans for further grant applications and more. Now the slightly odd bit is that they had an article accepted in Nature Methods last week. This is a pretty good thing in its own right, but New Scientist got wind of it and decided to write a press release and other press organisations did the same. This was all under embargo until 6pm yesterday, when the article was published under the Advance Online Publication scheme. This made for an interesting day, because as we were sat talking, someone would periodically note the different publications that the press release had made it to and the ridiculousness of the headline (the award for most ridiculous goes to all those that herald the end of photography as we know it, e.g. the telegraph – I wonder who they think they’re quoting in the headline?)

I’m especially interested in this because we’re going to be developing the chip based version of this technology (which I realise I haven’t explained). We even get a small mention in a lot of the articles – nothing like a bit of reflected glory! :)

So, some links:

Photonics West 2010

February 8th, 2010 § 0 comments § permalink

Photonics West is the largest photonics conference in the world. ~15k attendees, 3680 talks (before ones that were cancelled) and a couple of massive trade exhibitions. I went this year for the first time. In case you’re not sure, wikipedia reckons that photonics is “the science of photonics includes the generation, emission, transmission, modulation, signal processing, switching, amplification, detection and sensing of light”.

I went to present some of my work on making cameras and maybe learn some other things. The whole thing was a week – Saturday at 8am until Thursday 5pm, although thankfully I didn’t have to stay at the conference the whole time. More on that later.

My talk was on Thursday morning, so I’d already had chance to see lots of talks – some good, some less so. There were stacks of rooms (as you might expect for 3680 talks) all a variety of sizes. I found the room I’d be talking in on the first day and it was one of the big ones – I did a count of seats and there were around 200 or so. The small rooms could fit maybe 30 people, but if it looked like an interesting talk they’d be overflowing with people – I’m not sure whether that would’ve been worse.

I was the third talk of the session. The first talk went well, the second was a bit difficult to follow and then it was me. There were about 40 people in the session, which was a good number. I talked, I didn’t clam up and I looked at the audience. I probably could’ve done with a bit more gesturing with a laser pointer on occasion, but too much of that annoys me in a talk. Overall, it went well. Everybody seemed to be paying attention which is a good thing and I got about six sensible questions, which I could answer as well. One of the questions was “are these cameras available to buy?” – actually we’re after collaborators at the moment really rather than customers as such. I had four or five people come express interest after the session and have to get in touch with them.

All in all, it was a good success. I gave a good talk and went to a lot of talks as well. I learned quite a bit!

Bike

January 7th, 2010 § 4 comments § permalink

When my car got hit, it wasn’t the end of the world because I’d bought a motorbike just a few days before. This is something I’ve been meaning to do for ages, so I’m glad I’ve actually got round to it. To give you some sort of idea – I was buying kit around this time last year, having done the CBT the previous September. I took a leisurely approach to doing lessons (and was busy)and finally took the test in July.

I’d originally planned to go for a Suzuki SV650, but it turned out that I’m the wrong size so my knees ended up in an awkward place on the petrol tank. After trying a few different bikes, I settled on this Honda CBR600F. It’s nice. It also looks good, unlike a significant proportion of the others I’d seen where the designers had decided that it’d be a good idea to see just how many colour clashes they could fit onto a single bike. Amazingly, this is the only photo I have of it.

Peak power (that’s actual power, not power to weight ratio) is more than my car was, which is a bit daunting, but that’s a 11,000 rpm and it’s pretty sensible at lower revs.

I’ve ridden a reasonable amount now, but nothing too interesting – mostly just going to work and back because, again, I’ve been too busy on weekends.

The sad thing is, of course, that it’s been locked up for almost two months now. Never mind riding on ice, I just don’t want it to go anywhere near the nasty salt that’s on the roads.

Roll on spring time!

Car

January 5th, 2010 § 5 comments § permalink

There’s lots I want to write about, but that just means I never get round to writing anything.

So. Something that’s new – I have no car for the first time in about 9 years. Some bugger crashed into me on the way back from hockey (overtaking in a village at ~50 mph) and didn’t stop. The damage was reasonably minimal considering, but it smashed the driver side headlamp and put a big concertina pattern in the wheel arch. It was still ok to drive after getting a new headlamp fitting, but I wasn’t 100% sure of its structural integrity and the MOT was due mid December. With the damage and a few other problems it didn’t seem worth even trying for to get it through, so on the day before it was due I sold it for the staggering sum of £40.

I am looking for a new car, but it’s difficult to be enthusiastic about spending that much money. I want something at least half way reasonable, with better fuel efficiency, etc. etc. The damn scrappage scheme seems to have resulted in used prices increasing so there’s not much out there for me. I’m tempted to see how long I can manage without.

Beard dye

December 26th, 2009 § 0 comments § permalink

Having set up this new blog, I’ve been checking the server logs a little bit to make sure things are getting redirected properly. One thing I noticed was an awful lot of hits to a certain few pictures. It turns out that if you do a google (or bing or yahoo) search for beard dye, some pictures of me pop up. I’m the top image for google!

If this is my fifteen minutes of fame, I want to return it and try again thanks.

New blog

December 24th, 2009 § 2 comments § permalink

I got bored of my old blog and stopped updating it. Lots of things have changed since then and I feel like putting pen to paper again. I rejoined twitter (as ralight),but some times that just isn’t quite enough. I’m looking forward to using some of the many fancy features that wordpress has that my self coded site didn’t have.

The old blog is still online at old blog, and I’ve got rewrite rules in place so none of the old links should break. No guarantees though!