Skip to content

Instantly share code, notes, and snippets.

@sancarn
sancarn / .InfoWorks ICM - Node naming defaults with Ruby.md
Last active February 5, 2018 10:57
InfoWorks ICM - Node naming defaults with Ruby

InfoWorks ICM - Node naming defaults with Ruby

Many water companies provide guidelines to their consultants/staff defining how to name dummy nodes in a hydraulic model. This gives the water company full leverage over the hydraulic model externally and keeps data organised. However, for the most part, these conventions are easy to talk about but difficult to remember...

A hydraulic modeller often doesn't get payed for searching through the, often verbose, documentation on model building to find what they should use while naming their nodes. Instead, they often choose one standard and stick with it. To make the modeller's lives a little easier we can build a 'model build' ruby script library/add-on. Something which provides functionality which is so useful a modeller is insentifised to use it. In such a library we can include our node-naming conventions.

Custom node naming defaults

A well known feature of ICM is that you can automatically generate node names following a selected format.

@sancarn
sancarn / .Ruby InfoWorksICM Encryption.md
Last active February 5, 2018 10:58
Article to transfer to linkedin

Encryption in InfoWorks ICM using Ruby

What is Encryption?

Over the past few months I have been spending a large amount of time wondering how to encrypt data using Ruby, in InfoWorks ICM. For those who don't know, encryption refers to the process of transforming sensitive data into an unreadable form where it is unlikely to be intercepted by unauthorized viewers.

Note: Encryption does have other uses, for example, file modification prevention and software signing.

From the description above you might be able to see why encryption is so important, especially when handling sensitive client data. In hydraulic modelling this is often overlooked. However if the results or comments inside a hydraulic model became public, clients may be put in an uncomfortable position. Of course, as professionals this is something that we would like to avoid at all costs.

# This method of obtaining objects is WIP
$instances = {}
$instances[:WSOpenNetwork] = WSApplication.current_network
$instances[:WSDatabase] = WSApplication.current_database
$instances[:WSModelObjectCollection] = $instances[:WSDatabase].model_object.collection("Model Group")
$instances[:WSModelObject] = $instances[:WSModelObjectCollection][0]
$instances[:WSNumbatNetworkObject] = $instances[:WSDatabase].model_object.collection("Model Network")[0]
$instances[:WSSimObject] = $instances[:WSDatabase].model_object.collection("Sim")[0]
@sancarn
sancarn / CGSPrivate.h
Created May 15, 2017 20:30 — forked from siddhantjain/CGSPrivate.h
CGSPrivate.h - undocumented APIs for OSX. Re-licensed under MIT licence.
/* CGSPrivate.h -- Header file for undocumented CoreGraphics stuff. */
/* This file is a relicensed portion of DesktopManager and was originally released under
* the terms of the GNU General Public Licence. Original licence text follows the new terms.
* The contents of this file has been re-released by the original author under the following terms:
*
* Copyright (C) 2003, 2004, 2013 Richard J Wareham <[email protected]>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this
* software and associated documentation files (the "Software"), to deal in the Software