3 Things I Learned This Week 2016-06-03

node-notifier: cross platform pop up notifications for node.js

I had a little node script that would warm up a server by hitting a bunch of URLS and wanted it to send a notification when it finished. I found node-notifier that makes it easy to add this. And it’s even cross-platform!

1
2
3
4
5
6
const notifier = require("node-notifier");
notifier.notify({
        title: "Warmup complete!",
        message: "You should be able to use the site now.",
        sound: true
});

Webforms with multiple submits

So in Webforms there is a single HTML form element for the whole page. The downside of this is that if you have multiple inputs with submit buttons on your page, for example a search box in the top and a log-in form in the middle, you will get surprising behavior when you press the Enter key.

HTML treats an Enter press as a click to the first submit button on the page, which may not be what the user expected. For example, if you press enter after typing your password it would send a click against the search button, since that came first in the markup.

Luckily you can wrap each user input area in a panel with the and set the DefaultButton property with the ID of the expected button.

THat renders a mess of inline javascript (because of course it does). This will make your FE team cry, but you’re using webforms so perfect markup is obviously not that high on your priority list.

Kentico CacheDependencies

When using the CacheHelper class you can define a cache dependency. These are magic strings that indicate what changes in the system should invalidate the cached object. For example if you were caching a list of instances of a custom Page Type, you might use the cache dependency to tell the system to drop the cache if there are any changes to that Page Type.

Comments