In doing some analysis work on performance, a consultant recently asked for an extract of all of our AX2012’s COA validation rules.
The below SQL is an attempt at regenerating the rules based off the data in the various related tables.
NB: I’m not 100% certain that this gives all rules as they’d appear in the application, but a few initial tests prove promising; so hopefully this SQL can be reused by others with similar requirements.

In answering a question on Stack Overflow[1], I discovered that the Get-Hotfix cmdlet doesn’t list all hotfixes on your machine. Rather, if the fix is included in a CU, details of the installed CU will be presented, with no apparent way to drill down into the information and check for a specific fix.
So far as I can tell, there are no services / open databases which would allow you to programmatically retrieve this information. The only way currently is to manually head to the CU or fix’s related knowledge base site and read the contents.
As a very rough hack-around, I created a scraping script which will interrogate the MS knowledge-base for information on each hotfix, finding whether it’s a CU or not (based on the hotfix’s description in the page’s title) and if so try to find all related fixes. I only go down one level – to avoid the risk of an infinite loop & save time; should anyone want to go deeper, a caching mechanism could be used to store previous results and thus prevent the risk of a loop and also potentially improve performance.
As with most of the scripts on this site, this is more for me to play with PowerShell than to be of much practical use; but hopefully it could be to someone…

Warning: this post is not useful unless you just like playing with scripts & APIs.

Reading a few posts on StackExchange’s Meta site, I saw that there was demand for, but no intent to, create some kind of synonym sub-type feature for tags.
e.g. Users looking for items tagged PowerShell would also see those tagged only PowerShell-1.0, PowerShell-2.0, PowerShell-ISE, etc.
Users looking for PowerShell-1.0 are being more specific though, so shouldn’t see those tagged simply PowerShell, and definitely not those tagged PowerShell-2.0.

Since SE have no intention of creating this, I figured it would be useful to have a site which could present a view over Stack Exchange sites, giving users these additional features.
Since I don’t have time to do that though, I satisfied my craving to build something by knocking up a quick script to play with the SE API.
…And since implementing synonyms would require a huge dictionary, which I’d have to create, I sufficed myself with simply playing with the API without the synonymn hierarchy feature.
So this is just me playing about with my new favourite scripting language and an API I hope one day to play more with (though then it would be with some other language).
Here’s what I came up with…

Auto.ps1 allows me to host the script on a server (or wherever), whilst others can use it by dropping input files into a queue folder, without needing to touch powershell (which may be scary to non-programmers, or may require additional setup or permissions).ADGetUsersByEmailAdvanced.ps1 gets AD info based on email addresses; without requiring exchange modules, and includes workarounds to cope with missing information.

Auto.ps1

Monitors a folder for new text files. Once found, passes that file to a script to be processed. On completion moves the source file to the same directory & renames to begin with the same timestamp as the generated output file.

Given a text file containing a list of email addresses, attempts to resolve those to corresponding AD users, taking advantage of email information in AD where available, then gracefully degrading to more hacky methods. Works its way through a list of domains in case the users are in the same company but on a different domain.

Script could be improved by allowing auto to kick off jobs so multiple instances of the worker script can be run simultaneously. Also changing the main script to make use of workflows and take advantage of the parallel foreach method should significantly improve it’s performance. However I’m still pretty new to PowerShell, so those steps will have to come later.

I recently came across the Postgres generate_series function whilst reading a blog post.
So far as I can tell, there’s no equivalent in T-SQL. To make up for this, I coded my own, making use of the recursive nature of common table expressions:

2014-09-10

This script monitors a connection, reporting when the connection drops and when it’s recovered.
The script monitors by pinging an IP, or by running an HTTP Get against a defined IP/URL.
The URL option’s provided in case run from behind a firewall blocking ICMP.

2014-08-22

The following script (heavily based on http://www.the-fays.net/blog/?p=334) polls all servers in a given text file, returning information about their disk capacity, # of cpus (sockets & cores), amount of RAM, and OS info.

2013-07-28

Every now and then I try to create programs to solve puzzles as a way to introduce myself to new ideas & test my coding skills. My latest self-challenge was to write SQL code to solve the Countdown Numbers Round. The idea is; given 6 random numbers (each of which may be used at most once) and using only basic arithmetic (i.e. addition, subtraction, multiplication and division) to get to a randomly generated target number. e.g. Given the numbers 3, 7, 9, 10, 50 & 75, and the target 396 one solution would be: 3 * (75 + 50 + 7).

Background
For the last few years my company’s been doing annual employee engagement surveys; a questionnaire asking how much you enjoy working at the place, what the best and worst things are, whether you’re thinking of leaving, etc. All of this data is aggregated and anonymised then a few months later presented back to us where we’re asked to help guide the company forwards to get the scores up the following year (and hopefully make the company a better place to work in the process).

Problem
The issue with this is you’re collecting data one day a year.

It’s pretty hard to remember what’s happened in that year, not comment on things from previous years, determine what’s still relevant to report on and mostly avoid biasing your results based on your current mood / the week’s events. As a result this kind of information isn’t very revealing.

As things are applied to try to resolve any issues and improve work life in general there’s no official feedback mechanism until the following year; at which point it’s hard to rate what worked and what didn’t.

Proposed Solution
A button. At the end of each day before going home employees go to a page on the intranet and press a button [“Woo” | “Meh” | “Ugh”] (number of options and their descriptions can vary per implementor’s preference). They may optionally also add a short comment (though should use this feature sparingly). This is then registered along with the date and their username (anonymised if required; but in such a way that the user cannot submit multiple answers per day) and fed into a database. Next you have a graph showing an aggregated view of all employees satisfaction ratings (depending on anonymity preferences you can do this at individual levels, for teams, for offices, or for the whole company). You can now compare these results with any activities taking place to see what’s upsetting people and what’s keeping them motivated. You can also see problem areas and upcoming issues (if there’s a long period of negative scores or everyone on a team gives a negative at the same time) and thus investigate and resolve them before they escalate. The comment function may provide additional information on why the scores are good/bad, and will also be useful if you continue with the annual detailed questionnaire as employees can look at their mood changes and the few comments they made throughout the year to remember key events to feed into this detail. Other benefits can come from including other info into your analytics (project deadlines, holidays, sick days, socials, weather (you can’t control it but can see its effect and compensate), etc).
Since it’s just a button it’s not a burden – so people will be likely to use it. You also get the satisfaction of stamping a close to your work day.

Questions

What do you guys think?

Has anyone done something like this at their place?

Anyone know of a LifeHacker style site for doing this kind of thing already which could be utilised (it’s pretty easy to build, but if there’s stuff out there which already includes common data sets (e.g. weather in your area, ability to log meals to allow individuals to make themselves happier by eating healthier, etc. so much the better)?