jbanana: Badly drawn banana (Default)
A big new thing is Kotlin (presumably because it's supported on Android) so I hacked up some support in Compositor. It wasn't too hard - an afternoon's work including learning a bit of Kotlin, so that was good.

Now the world's Kotlin developers can rush to Compositor to make desktop apps. Ahem.
jbanana: Badly drawn banana (Default)
  1. I wrote some entries for Rosetta Code a few years ago. One was for 3D text output in Java. I found today that someone has translated my code into another language that I'd never heard of, and credited me. I'm flattered and baffled at the same time.
  2. I was looking for a cheap hair cut, and I found a barber that looked promising. At the bottom of their web site it says
    Best viewed in 1028 x 768 with IE5     Last Updated: 21/08/05
    Aww, bless!
jbanana: Badly drawn banana (Default)
This morning while I was looking at our bug tracker, my laptop switched itself off. No error shutdown sequence. No blue screen of death. Just off. That's not good.

I went to lunch knowing I had to be back for a 2pm meeting. While I was out, the meeting was moved to 1:30. That's not good.

This afternoon the debugger didn't want to step in to the relevant bit of code. Then it told me it was executing blank lines. That's not good.

Can I go home now, please?
jbanana: Badly drawn banana (Default)
I wrote a desktop thing for symmetrical doodling (doodling image, doodling video), but it's not so easy for other (non-techie) people to install, so I tried a web version - decreased usability, increased availability. You can't win.

Hmm - software development is like thermodynamics?

Anyway, here's a doodle I did with the web version.

Click to embiggen
jbanana: Badly drawn banana (Default)
I wrote about reading binary data formats and I wasn't happy. The other day I had another look and I found Katai which seems to be exactly what I want.

If I ever get around to using it, we'll find out. I have a new thing in mind that this might be good for, and I have parsers for EXIF and Java class files that could do with some love.

Edit: ...or maybe Preon?

Another edit: I was considering writing something to read and write .ico files, which seem to be reasonably well documented.
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.
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)
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)
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)
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.
jbanana: Badly drawn banana (Default)
I was trying to get my head round Java 8 streams. Here's a typical example:
List<Integer> transactionsIds = transactions.stream()
         .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)
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)
Remember my UI generator, Compositor, that I mentioned before? Never mind. 8~)

I released a new version today: http://sourceforge.net/projects/compositor/files/0.4/
jbanana: Badly drawn banana (Default)
Find all the branches to master since the versions/1.7 branches were created:
(for %H in (repo1 repo2 repo3 etc) do @(echo %H & pushd C:\Users\JBanana\Documents\work\%H & (git checkout versions/1.7 & git pull & git checkout master & git pull & for /f %G in ('git merge-base --fork-point master versions/1.7') do @(git log --merges %G..HEAD > c:\temp\%H_merges.txt)) & popd & echo.)) & echo Finished!
I put it here because I might need it again one day, and because it makes me smile ruefully.

Edit: I needed it the next day. 8~)
jbanana: Badly drawn banana (Default)
At the command prompt on Linux/Unix/Cygwin/etc make a file called mouse and put this in it:
                _ |\_
                \` ,,\
           __,.-"  =Y=
         ."        )     
   _    /   ,    \/\_     ) __QQ 
  ((___(     )_-\ \_-`   (_(_)_">
  `-----'`-----` `--`       " "
Now when you say cat mouse, that's exactly what you get.

Edit: Guess what this does:
cat mouse | cat mouse -
jbanana: Badly drawn banana (Default)
I thought that this might be a problem that only bothered me. Google proved me wrong, and there's a solution:
jbanana: Badly drawn banana (Default)
I said how to run one test from maven. I still can't run tests in Eclipse (but for a different reason now) so I found out how to debug tests running in Maven.
mvn -Dmaven.surefire.debug -DskipTests=false -Dtest=[testclass] test
Then you can attach the debugger on port 5005. That part does work in Eclipse.
jbanana: Badly drawn banana (Default)
Well done, Martin Ridgers. You fixed the Windows prompt.


If you have Chocolatey, open an admin prompt, and cinst clink
jbanana: Badly drawn banana (Default)
I've changed some details to fooBar to protect the guilty. It wasn't me.
// delegate the saveView logic to fooBarSupport
return fooBarSupport.getSaveView(fooBarID, form, model, isNew);
Page generated Oct. 22nd, 2017 05:10 pm
Powered by Dreamwidth Studios