Feb. 6th, 2017 11:54 pm
jbanana: Badly drawn banana (Default)
I made a thing for doodling symmetrically. Here's one of my attempts. I thought it was a bit Indian looking, but an Indian colleague at work saw it and didn't seem to agree.
jbanana: Badly drawn banana (Default)
Software releases come and go. Today I found something that have been around for quite a while, but was new to me. Plain vanilla Java includes a UI design language, FXML.

This is significant for me because I wrote something very similar, but for Swing instead of JavaFX. Maybe I should abandon that and migrate stuff to FXML. It's a little depressing.

Cycling off

Nov. 2nd, 2016 01:10 pm
jbanana: Badly drawn banana (Default)
I ride a bicycle to the station on my way to work. Yesterday the velcro on my hi-vis jacket came undone, so I was doing that up with my left hand, and I tried to change gear with my right hand, but I pulled the brake lever instead of the gear lever, the front wheel stopped, I teetered a bit, fell, and hit my knee on the ground. Comical, if it hadn't hurt.

Since I've cycled regularly, I think that this is the fifth time I've come off. I've got a metal plate in my arm from one of them, but no permanent damage from the others. I usually ride when it's early, so I may not be that alert. Only one of them happened on the way home.

Obviously I should stop to adjust things. Catching the train is less important than physical safety, and cycling one handed was a contributing factor yesterday.

Also cycling is just riskier. I've never fallen off a car, and accidentally applying a car's brakes still leaves you sitting in the car.

I did once fall off a bus, but that's a different (but equally ridiculous) story.
jbanana: Badly drawn banana (Default)
I was looking at the Shard from my office window. It occurred to me that a tall thin pyramid is a silly shape for a building.

Cuboid volume: length × width × height
Pyramid volume: length × width × height ÷ 3

So the Shard is three times the height it needs to be for its floor space, if only the walls didn't lean inwards.

(OK, not quite, because the top few floors are an empty "spire", but they're small so it doesn't make much difference.)
jbanana: Badly drawn banana (Default)
I posted before about what's wrong with elections. I think that I got it wrong. The real problem is the candidates (and therefore the selection process). Everyone in the world thinks it's mad to let Trump anywhere near an election, but Clinton's approval ratings are poor. So Americans will be choosing between the crazy bloke and the woman they dislike. WTF?

Less distressingly, in the last US presidential election straight people were split down the middle (if we believe the Wikipedia stats) so it was the gay, lesbian and bisexual vote that won Obama a second term.
jbanana: Badly drawn banana (Default)
Some software that I use always switches off the Windows option "Show window contents while dragging". That means that dragging a window just moves an outline, and the window only moves when you drop the outline. That's grim. You can switch this option in Control Panel. That's a bunch of clicks, and it'll get switched back later. Grr!

Siva Mulpuru knows enough Powershell to fix a similar setting (thanks, Google) so I borrowed that code and fixed it up to do what I wanted.
$setwindowsdragfull = @"
using System.Runtime.InteropServices;
public class dragfixer
	[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
	private static extern int SystemParametersInfo (int uAction, int uParam, string lpvParam, int fuWinIni);
	public static void SetDragFullWindows ()
		SystemParametersInfo( 0x0025, 1, "", 0x03 );
Add-Type -TypeDefinition $setwindowsdragfull
Then I had to figure out how to run a Powershell script. This batch file seems to work.
@powershell -executionpolicy bypass -File SetDragFullWindows.ps1
Then I can put an icon somewhere handy and click the annoyance away.
jbanana: Badly drawn banana (Default)
Today I forgot the most important rule of meetings: don't go in to a meeting if you think you might need to pee. Eventually I had to bail, and that never looks good.

Edit: by "bail" I meant "leave the meeting", not "scoop out liquids". Just in case you were wondering.
jbanana: Badly drawn banana (Default)
I got fed up with the font rendering in Vivaldi (shame - nice browser, but stuffed by upstream changes to Chromium).

I used to use SeaMonkey a lot, so I tried that again, and found that I could fix most of its annoyances. The addons I needed were:
  • Adblock Plus

  • Dorando keyconfig (the only way I could find to add a second key that also opens a tab was: "BrowserOpenTab();")

  • Ghostery

  • Mouse Gestures Suite

  • "Shift+LeftClick opens links in a new active tab" (delightfully named)

  • Speed Start

  • Tab Clicking Options (had to hack this one to make it work with the latest SeaMonkey, but only to change the compatibility labelling!)

  • True Full Screen

  • Undo Close Tab Button

  • British English Dictionary

There are still a few things bothering me:
  • Can't put tabs at the bottom

  • Single key shortcuts (can't stop pressing 6 to reset the zoom!)

  • Side bar pops up whenever I search from the right-click menu Edit: in the side bar, you can switch off the search tab!

  • Tab tiling (but I can work round that easily enough)
jbanana: Badly drawn banana (Default)
Here are some people who make me feel good. It's not an exhaustive list.

Click to embiggen
jbanana: Badly drawn banana (Default)
Here are two things that annoy me.
  1. Sometimes someone asks me a question and I answer, but only later it becomes clear that they were really asking something else, which bugs me no end.
    What time is it?
    Half past twelve
    Long pause where they feel hurt that I didn't realise that they wanted us to go for lunch...

  2. Sometimes when I ask a question, it's completely obvious that there's a reason for asking it, so I don't say that part, but the other person completely misses the point.
    What time is it?
    Half past twelve
    Long pause where I feel hurt that they didn't realise that I wanted us to go for lunch...
jbanana: Badly drawn banana (Default)
When Blackberries were popular, people called them Crackberries because the users spent so much time on them. Now that's just phones.
jbanana: Badly drawn banana (Default)
The command prompt in Unix/Linux has always let you do fancy stuff. For example, here's one way to edit all the Java code that contains "someSearchString":
find . -name "*.java" -exec grep -q "someSearchString" '{}' \; -exec someEditor '{}' \;
On Windows, the command prompt is less rubbish than used to be. Here's one way to do the same task:
for /f "tokens=*" %G in ('dir /s /b *.java') do @(find "someSearchString" >nul && someEditor %G)
I like the way that both examples use find but it means something completely different.

Edit: one obvious difference: the *nix version ill search for a regex, but Windows will only do plain text
Bnother edit: simplified the Windows version by redirecting to NUL.
jbanana: Badly drawn banana (Default)
A man near me was sitting doing not much. Suddenly he leaned forward to his bag, took out a belt, and put it on. Why?

Did he think his trousers would fall down when he stood up? He'd got to his seat without mishap.
Did he just like wearing an unnecessary belt? He'd put the belt in his bag instead of round his waist.

When he'd got the belt on, he carried on doing not much.
jbanana: Badly drawn banana (Default)
I prefer web mail, but I'm currently forced to use Outlook, a bizarre and Byzantine behemoth* that frustrates me if I try anything beyond "write message" and "read message". Worst of all is the search, which often doesn't find things that are definitely there, and doesn't understand "quotes means phrase search".

But I found how to make it work: obscure words. I have a long-running email chain with the word "putative" in the subject, and Outlook finds those messages easily and quickly. So when you send a new message, get your thesaurus out.

*Apologies about annoying alliteration.


Mar. 17th, 2016 12:17 pm
jbanana: Badly drawn banana (Default)
I found this on a packet of tea:
The sun streams in through the window. Rain beats down on the roof. Wind rustles through the trees. Or a blanket of snow waits outside.

Whatever you wake up to, pop the kettle on and drink in the day.
Quite poetic for marketing blurb.
jbanana: Badly drawn banana (Default)
I was trying to get my head round Java 8 streams. Here's a typical example:
List<Integer> transactionsIds =
         .filter(t -> t.getType() == Transaction.GROCERY)
"Get the grocery transactions, largest value first, and tell me their IDs."

So this seems cool, and you can make a stream parallel, so it might be a good way to implement a lot of things.

The lightbulb came on when I realised that you can only apply a predefined set of operations. The thing you're calling methods on is the stream, not the contents. So you might be able to re-write existing code in terms of filter, map, etc. but you can't just drop an existing chunk of code into a stream and get magic.
jbanana: Badly drawn banana (Default)
"If you make it publicly available, everyone can see it."
Well... yes.
jbanana: Badly drawn banana (Default)
Traditional: EventQueue.invokeLater(new Runnable(){@Override public void run(){doThings();}});
Hmm - lots of syntax to get those things done later.

Lambda style: EventQueue.invokeLater(()->doThings());
Nicer (but identical).

When you make a lambda in Java, it's an anonymous instance of some interface. But how does it know which interface? It matters, because the lambda has to have the right params, and it has to implement the right method (even though you didn't say what the method was).

Duh, stupid! The compiler figures it out from the context. "I need a Runnable here, so that's what this lambda must be." And now I'm not thinking "How can this possibly work?"

Edit: usual excellent stuff on the basics of this from Jenkov
jbanana: Badly drawn banana (Default)
Most of the time, software issues are about understanding the problem well enough and writing some clean code. It's unusual to have to deal with difficult problems, but there are some well known hard things.

Lots of people would include concurrency because it's so easy to get it wrong, but I don't think that that makes it intrinsically difficult.
jbanana: Badly drawn banana (Default)
This is a nice idea, but I'm not sure if it will succeed. Everywhere in the world can be located by three words. Similar addresses are purposely far apart: There are probably several 3m squares that cover where you live, so you get some choice about your three words.

Edit: Not sure why I find this so amusing...

Edit 2:

Edit 3:

Edit 4:

Edit 5:

Edit 6: I found a pumpkin carving party in the Caucasus Mountains nowhere near anywhere, and a scout slumber party in Kazakhstan.

Edit 7: Spend every penny in some road-side bushes in the Chicago suburbs.
Page generated Jun. 22nd, 2017 06:33 pm
Powered by Dreamwidth Studios