Skip to content

Instantly share code, notes, and snippets.

@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 <richwareham@users.sourceforge.net>
*
* 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
# 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 / .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.

@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.

Infoworks ICM - GUIs with Ruby (Part 2)

In the last part of this series we explored how we could use the Windows Forms .NET framework from Ruby using an intermediate Powershell script. This time we will go down a completely different route. Today we will build GUIs using the popular web technologies - HTML, CSS and JavaScript.

Why web technologies?

Web technologies over the years have improved greatly. Open source JavaScript engines have become faster at processing data and HTML and CSS have greatly improved to provide clean interfaces for the ever growing market of the web. JavaScript, executed from Chrome's V8 Engine, is currently one of the fastest interpreted languages on the market. This is largely due to the fact that there is a huge demand for bigger, faster webpages.

Recently there has been an emerging trend of web technologies being used for desktop applications. Frameworks such as, Electron and NW.js make this not only possible, but both easy t

Issue:

#"Starting REPL..."
3743
#>3743
sim = _.db.model_object_from_type_and_id("Sim",3743)
#>#<WSSimObject:0x00000031f63c28>
sim.list_max_results_attributes
#> Error: The method cannot be run from the user interface

MapBasic - Comments in MapInfo Project File.md

2 years ago I visited the MapInfo User Group UK conference held at the Institution of Engineering and Technology (IET), Birmingham. At the conference I met Peter Horsbøll Møller. At the time I hadn't had much experience with MapBasic Project (.mbp) files. A MapBasic project is often required when working on large projects or using libraries that others have made. The basic layout of a MapBasic project is as follows:

[Link]
Application = UpdateFromAmp5.mbx
Module = UpdateFromAmp5.MBO  
Module = FULL_RIBBON.MBO

ListView control in Excel spreadsheets

List view controls can be exceptionally useful for viewing data on a spreadsheet.

Step 1: Add control to spreadsheet.

Click on the Insert dropdown button in the Controls group of the Developer tab. When here click the More controls button of the ActiveX Controls sub menu.

Step 2: Find ListView control

Hello everyone! In this video we will briefly cover the current features of the health and safety database, as well as those currently waiting to be implemented.

When you first launch the viewer you are greeted with a password box. If you enter a password incorrectly you well be prompted and will have to try again. If you don’t know the password then you won’t be able to access any new information from the server.

After entering the password you'll be greeted with the 'search engine'. Here you can type any text and the database will score every record against the text you entered. For example, if I wanted to search for an employee, I can simply type the employees name. To search for a specific department, I can type all or part of the department's name, "Quantity" in this example. To search for all employees who are managed by a particular person, I can type that person's name, in this example "Hamilton". The more the query I enter is mentioned for a specific employee, the higher that employee will rank in