jbanana: Badly drawn banana (Default)
This bloke concentrates on photographing one place, and it's worked for him.

Thornham Staithe: 'Magical' Norfolk coast captured in photographs
jbanana: Badly drawn banana (Default)
I got a bird feeder as a present a couple of Christmases back. It's a metal pole about 6ft tall with branches on top to hang things. I like to spend a minute or two watching the birds on it.

I'm puzzled about the lack of variety in the birds. There are blue tits all the time, an occasional sparrow, and pigeons and blackbirds underneath cleaning up the bits the other birds drop. I've seen magpies a couple of times, and now I know there's a crow. But where are the other small birds? I had a bird feeder as a kid, and got great tits, coal tits, bullfinches, yellowhammers, and occasional "WTF is that" birds.

I thought feeding birds would be straightforward: I put out food, and birds eat it. No. I put out seed mix and fat balls from the garden centre and the birds mostly ignore it. Maybe they get better quality stuff from my neighbours? The squirrels like it, but I'm not trying to feed them. I buy a squirrel baffle and more expensive seed mixes and fat-in-a-coconut-shell. Yes, they like that better. Then I find the coconut shell on the ground. Was it windy enough to blow that off? I replace it. Next morning, it's on the ground again. I tie the next one on more firmly. Today my SO sees the seed holder on the ground, the plastic water tray in pieces and a large crow waddling away. Well, that explains the vandalism.
jbanana: Badly drawn banana (Default)
This seems painful. Googling provides much conflicting advice. No idea if I did this right.
  1. I read up on the Filesystem Hierarchy Standard
  2. I put the software in /opt/myapp/
  3. I put the config file in /etc/opt/myapp/
  4. I configured it to write logs to /var/log/myapp/
  5. I created a user to run it by doing
    sudo adduser --system --no-create-home --group --disabled-login myapp
  6. I got an init script template from a github repo
  7. I copied the init script to /etc/init.d/ and renamed it myapp
  8. I edited it as described in the documentation and made it executable
  9. I set up more init script stuff by doing
    sudo update-rc.d myapp defaults
    (some things were created in /etc/rc?.d/ - let's hope that's right)
  10. Reboot, and let's hope it works
Heh - I have to post this *before* the reboot...

Edit: seems to be working...
Edit 2: not quite - I hadn't fixed the log file permissions so that the new user could write there.

Source for some of this: https://stackoverflow.com/a/7221787
jbanana: Badly drawn banana (Default)
I have a backup that writes changed files to a USB stick, and I had exactly the problem that this bloke had: Why do file timestamps compare differently every time-change? There's no solution, so I updated the timestamps on the USB stick, and I'll have to change them back in October. Sigh.

TL/DR: Windows gets file times wrong when the clocks change, and different file systems are differently broken. Live with it.
jbanana: Badly drawn banana (Default)
When you click a mailto link, a mail program opens, which is useless if you use web mail - GMail, Outlook.com, Yahoo, whatever. That's always frustrated me.

Turns out it was my fault for not installing a browser extension.
  1. Get a suitable extension for you browser (I got mailto from the chrome webstore - works fine in Vivaldi)
  2. Wonder why the "compose message" page opens but doesn't inset the email address
  3. GoogleDuckDuckGo the correct URL format
  4. Configure the extension to get rid of the broken default
  5. Sit down with a cup of tea and congratulate self on a job well done
Edit: works for some links, fails for others. WTF?
jbanana: Badly drawn banana (Default)
We have learned how to run one test from Maven, and how to tell Maven you want to debug the test.

But if you want to use jdb as your debugger, you need to connect it something like this:
jdb -connect com.sun.jdi.SocketAttach:hostname=localhost,port=5005 -sourcepath src\test\java\;src\main\java\
jbanana: Badly drawn banana (Default)
You can turn a Java String into an IntStream, but that's annoyingly different to a regular Stream.

Getting a map of character counts:
        (map, value)->{
            Integer oldCount = map.get(value);
            map.put(value, null == oldCount ? 1 : oldCount + 1 );

Hmm, that's a lot of map-making boilerplate inside the collect bit. We can make it a Stream<Integer> and it's much simpler:
    .boxed()  // this bit makes collect easier

It's funny how the first example is now considered "boilerplate". Imagine doing it with anonymous inner classes instead of lambdas and method references.

It's also funny how chaining methods is the new normal. Some places where I worked would have to change their style guide.
jbanana: Badly drawn banana (Default)
I got a new computer, so I have the MS Edge web browser. I'm not excited, but I noticed something good today. The context menu includes "Read aloud". A nice chap reads the page to me!

There are some voice options. I like George. He sounds like a character actor. The intonation isn't too mechanical and the pronunciation isn't bad most of the time.
jbanana: Badly drawn banana (Default)
One at a time, these would be OK, but when they're all on one page it makes it seem like they're made up.

jbanana: Badly drawn banana (Default)
Apparently in Bali (and probably elsewhere) your hotel will serve you "floating breakfast" in the pool, which looks nice in a photo. But who wants to get out of bed and into a swimming pool to eat? I'd choose a table and chair, and I bet that in Bali I could sit outside with a nice view. Have another croissant. They're yummy.
jbanana: Badly drawn banana (Default)
Hey, future me! Let's hire a boat on the canal and take a picnic lunch, and then let's have tea in the Barbican conservatory.

Sounds like a day out, and a nice surprise for family members who don't read this.
jbanana: Badly drawn banana (Default)
I added colour to my symmetrical doodling thing. Here's an example.
jbanana: Badly drawn banana (Default)
Thanks to Wikipedia, I now have doubled the number of "chocolate teapot" web pages I've read.
  1. An Appraisal of the Utility of a Chocolate Teapot
    (TL/DR: "a chocolate teapot is of no use at all")
  2. How useless is a Chocolate Teapot?
    (TL/DR: "a chocolate teapot is really not very useful, but slightly more so than you would expect")

Also from the Wikipedia teapot article:
Early teapots are small by western standards because they are generally designed for a single drinker, and the Chinese historically drank the tea directly from the spout.
Wow! I've never tried that.
jbanana: Badly drawn banana (Default)
Live apps write logs. Usually they splurge a huge amount of repetitive meaningless noise: the same thing reported again and again. Fixing things in live apps means fishing in lots of logs among all the dross for a clue as to what went wrong.

One thing that makes this hard is that different logs don't agree about the format for time stamps. These are all the same:
25-Oct-2018 16:45:00
2018-10-25 16:45:00
So if I think the problem was logged at 16:45 in one of the logs, how do I search? Say hello, timepattern
#!/usr/bin/env bash
case ${month} in
  1|01) mword=Jan ;;
  2|02) mword=Feb ;;
  3|03) mword=Mar ;;
  4|04) mword=Apr ;;
  5|05) mword=May ;;
  6|06) mword=Jun ;;
  7|07) mword=Jul ;;
  8|08) mword=Aug ;;
  9|09) mword=Sep ;;
    10) mword=Oct ;;
    11) mword=Nov ;;
    12) mword=Dec ;;
     *) mword=zzz ;;
echo "(${day}-${mword}-${year} |${year}-${month}-${day} |${day}/${mword}/${year}:)${hour}:${minute}:"

You can use it like this:
grep -Ea "$(timepattern 2018 10 25 16 45)" $(findallthelogs)
"Search in all the logs for the messages with the right time pattern"

Windows users: install Cygwin


Oct. 17th, 2018 12:13 pm
jbanana: Badly drawn banana (Default)
I once posted about how hard it is watching people do things wrong and not saying anything. Similarly, it's really hard to keep quiet when people talk nonsense.
jbanana: Badly drawn banana (Default)
My friend's son is having a stag do (translation for furriners: "bachelor party") and his brothers are invited, but his sister isn't. I said: why not invite her too? It's unconventional to invite women, but I've been on a hen night (furriners: no idea - work it out for yourselves) and it was fine. But the reply was that she fancies one of the blokes who will be there, and they can't get together because if they later split up it will be awkward.

Is that a thing? Once you've ended a relationship with someone you must never see them again? Wow! Now I don't have much experience here. I've been in the same relationship most of my life, but if I saw someone from before that, I'd be happy to sit and have a catch up. I suppose that if it ended dramatically then it might be a problem, but if you think that your sister and your friend couldn't be civilised about something like that, you've got a bad opinion of them, haven't you?
jbanana: Badly drawn banana (Default)
I work at home part of the time, and one thing I've noticed is the number of phone scams going on.

I get automated voices asking me to press 1 for whatever, or 9 to never hear from them again. I read once that this is an attempt to trick a switchboard into making an outbound call to a premium rate number. It certainly makes some interesting noises if I press 9.

Another one tells me that my IP address is compromised "from many countries". Today I thought I'd waste a bit of someone's time, so pressed 1 to speak to someone, and I kept the call centre bloke on the phone for as long as I could. Right at the start I told him that it was a scam and I didn't believe him, but he was very persistent. I tried telling him I had a Mac, but I couldn't keep that up. He got a little heated a couple of times that I wouldn't follow his script, but it took 16 minutes before he said "Go to hell" and hung up.
Page generated Apr. 19th, 2019 10:31 pm
Powered by Dreamwidth Studios