Monday 13 June 2011

Transparent Background PNGs and IE: Solved

It's fixed once and for all with this handy little CSS snippet.

Placement of CSS and scripts in web pages

I had no idea! You should add your CSS first, and only include javascript links at the very bottom of your page. That way the page renders before trying to process any of the linked javascript files. Cool!

Tuesday 22 March 2011

Persisting Window State in WPF

The attached article did exactly what I needed.

The only change I made was to stop it persisting window state if the application was minimised, which is something I specifically wanted to stop with this application - but you can decide for yourself in your own applications.

Thanks Erwyn!

Wednesday 16 March 2011

Jumplists!

Well, I guess they had to call them something.

Jumplists are the lists of links and tasks that appear when you right-click an application's icon in the Windows 7 taskbar.

Today I learned how to manipulate that list. I used the link above, as well as the MSDN article.

Fun stuff! Nice to embed yourself more into an OS to impress the users ;)

Thursday 3 March 2011

Refresh WPF controls just like Winforms

Remember the bad old days with forcing repaints on your Winforms applications? I was forced back into that era today. I was updating the source of an Image on a WPF window, and then taking a snapshot of the window immediately after. What led to a great deal of hair loss was that the image hadn't actually appeared by the time I was taking the snapshot, and thus it was like taking a photo of a vampire - it simply wasn't there, even though the moment I could see the window it actually was.

Instead of going down the lengthy route of delaying the snapshot and then nested events or callbacks, I went to Google, and more specifically, my dear friend Stack Overflow which eventually led me to here.

this.Dispatcher.Invoke(DispatcherPriority.Render, _emptyDelegate);

That _emptyDelegate:

private static Action _emptyDelegate = delegate() { };

Genius. Continued hair loss averted. Or rather, delayed until the next issue...

Wednesday 23 February 2011

Lorem No More?

I'm quite fond of using the Lorem Ipsum website to generate Greeking when I'm doing a website or application, but have recently discovered Fillerati.

Basically, instead of filling in (dead) Latin text, it gives me random text from random classic books to use instead!


As the Monkey King finished his story Dorothy looked down and saw the green, shining walls of the Emerald City before them. She wondered at the rapid flight of the Monkeys, but was glad the journey was over. The strange creatures set the travelers down carefully before the gate of the City, the King bowed low to Dorothy, and then flew swiftly away, followed by all his band.

"That was a good ride," said the little girl.

"Yes, and a quick way out of our troubles," replied the Lion. "How lucky it was you brought away that wonderful Cap!"

The four travelers walked up to the great gate of Emerald City and rang the bell. After ringing several times, it was opened by the same Guardian of the Gates they had met before.

"What! are you back again?" he asked, in surprise.

"Do you not see us?" answered the Scarecrow.

"But I thought you had gone to visit the Wicked Witch of the West."

"We did visit her," said the Scarecrow.

"And she let you go again?" asked the man, in wonder.

"She could not help it, for she is melted," explained the Scarecrow.

..

See? Made this look like a long post!

Profanity in commit messages

I loved this post about people swearing in the comments as they check-in their code.