Tick tuples within Storm
Tick tuples are useful when you want to execute some logic within your bolts on a schedule. For example, refreshing a cache every 5 minutes.
Within your bolt, first enable receiving the tick tuples and configure how often you want to receive them:
@Override
public Map<String, Object> getComponentConfiguration() {
// configure how often a tick tuple will be sent to our bolt
Config conf = new Config();
conf.put(Config.TOPOLOGY_TICK_TUPLE_FREQ_SECS, 300);
return conf;
}
Next create the isTickTuple helper method to determine whether or not we’ve received a tick tuple:
Knockout Validation: Multiple email addresses
A simple rule for validating an observable which could contain multiple email addresses.
Assuming you have an observable like self.emailTO = ko.observable('');
, you would just extend it to have self.emailTO.extend({ multiemail: true });
. Use it with the required validator if you want at least one email address.
ko.validation.rules['multiemail'] = {
validator: function (val, validate) {
if (!validate) { return true; }
var isValid = true;
if (!ko.validation.utils.isEmptyVal(val)) {
// use the required: true property if you don't want to accept empty values
var values = val.split(';');
$(values).each(function (index) {
isValid = ko.validation.rules['email'].validator($.trim(this), validate);
return isValid; // short circuit each loop if invalid
});
}
return isValid;
},
message: 'Please enter valid email addresses (separate multiple email addresses using a semicolon).'
};
Requires Knockout.js, Knockout Validation, and jQuery.
Pass user information from SharePoint 2013 to InfoPath 2013
InfoPath is a common tool used to create forms hosted on SharePoint. Due to the limited development options available for Office 365, I think this places an increased focus on InfoPath when it comes to creating a solution. Unfortunately, I found that it was relatively difficult to get the current user’s information to be displayed or saved within an Infopath form.
Use jQuery to call the Microsoft Translator AJAX API
First, make sure you have subscribed to the Microsoft Translator API on Azure Marketplace and registered your application Azure DataMarket. For testing, you can use the free subscription which lets you submit up to 2 million characters a month. Registering your app will create a Client ID and a Client Secret which you need to get authorization.
In order to protect your Client Secret, you’ll need to write server-side code to get your access token. The access code is then passed to the Microsoft Translator API via AJAX.
Convert from HandySafe to Sky Wallet
I wrote a small python script to help convert Handy Safe to Sky Wallet. I definitely learned a lot about python and even though I wasn’t very familiar with the available API I was able to come up with a pretty nifty script.
Using JsRender to create SOAP Envelopes
I am working on a small query tool that will be used to make AJAX calls against SharePoint’s Enterprise Search Query Web Service. Previously, I created the SOAP messages by appending a gigantic series of strings together. In this iteration, I wanted to use JsRender (my template engine of choice right now and the successor to jQuery templates).
Using slices in Golang
I started helping my brother with some GO projects. One really interesting concept in Go are slices… which make working with arrays easier.
At anytime you can “chop” out interesting portions of a slice to use using [start:finish].
There is the special append keyword to add things onto the end of the slice dynamically (as opposed to using the make keyword to declare it up front).
And there is a range keyword to mimic how foreach works in a higher level language.
Custom Debug JsRender tag
I’ve been learning a lot about JsRender and Knockout.js after finding Ryan’s answer on StackOverflow. I’ve created a couple of templates and started to use the {{for}}{{/for}}
tag.
I was having trouble figuring out how to access the parent object’s data from within the for loop. After reading John Papa’s awesome posts, Using JsRender with JavaScript and HTML and Advanced JsRender Templating Features I came up with a quick custom “Debug” tag to help me understand.
Adding minified javascript/css files to ClearCase
I had an issue trying to add some minified JavaScript files to ClearCase.
Created branch "dev" from "[file]" version "\main\0".
Type manager "text_file_delta" failed create_version operation.
It looks like files that have over 8000 characters on a single row are unable to be added to version control using normal methods.
Thankfully, I was able to find a solution here:
cleartool ci -nc jquery-1.2.6.min.js
Adding the file to clearcase as a “compressed file” means it doesn’t try to do a file delta!
Top 3 Features missing from SSRS 2008 R2
A list of gripes about features I feel are missing from Microsoft SQL Server Reporting Services 2008 R2.