text:
# Awesome .NET Performance
A curated list of awesome .NET Performance books, courses, trainings, conference talks, blogs and most inspiring open source contributors. Inspired by awesome-... stuff.

- [Awesome .NET Performance](#awesome-dot-net-performance)
	- [Books](#books)
	- [Video Courses](#video-courses)
	- [On-Site Trainings](#on-site-trainings)
	- [Conference Talks](#conference-talks)
	- [Blogs](#blogs)
	- [Inspiring Open Source Contributors](#inspiring-open-source-contributors)
	- [Performance measurement](#performance-measurement)
	- [High Performance Libraries](#high-performance-libraries)
	- Article series
		- [Benchmarking](#benchmarking)
		- [JIT Optimizations](#jit-optimizations)
		- [Refs](#refs)
		- [Threading](#threading)

## Books

* [Pro .NET Performance](https://www.amazon.com/dp/1430244585) by Sasha Goldshtein, Dima Zurbalev, Ido Flatow
* [CLR via C#](https://www.amazon.com/dp/0735667454) by Jeffrey Richter
* [Pro Asynchronous Programming with .NET](https://www.amazon.com/dp/1430259205) by Richard Blewett, Andrew Clymer
* [Writing High-Performance .NET Code](https://www.amazon.com/dp/0990583430) by Ben Watson
* [Advanced .NET Debugging](https://www.amazon.com/dp/0321578899) by Mario Hewardt
* [Concurrent Programming on Windows](https://www.amazon.com/dp/032143482X) by Joe Duffy
* [.NET IL Assembler](https://www.amazon.com/dp/1430267615) by Serge Lidin
* [High-Performance Windows Store Apps](https://www.amazon.com/dp/0735682631) by Brian Rasmussen
* [Customizing the Microsoft® .NET Framework Common Language Runtime](https://www.amazon.com/dp/0735619883) by Steven Pratschner
* [Under the Hood of .NET Memory Management](https://www.red-gate.com/library/under-the-hood-of-net-memory-management) by Chris Farrell and Nick Harrison

## Video Courses

* [Mastering .NET Performance Tuning](https://wintellectnow.com/Home/SeriesDetail?seriesId=mastering-dotnet-performance-tuning) by John Robbins
* [Using Threads Effectively to Build Scalable, Responsive, and Fast .NET Applications and Components](https://wintellectnow.com/Home/SeriesDetail?seriesId=using-threads-effectively-to-build-scalable-responsive-and-fast-dotnet-applications-and-components) by Jeffrey Richter
* [Making .NET Applications Faster](https://www.pluralsight.com/courses/making-dotnet-applications-faster) by Sasha Goldshtein
* [Making .NET Applications Even Faster](https://www.pluralsight.com/courses/making-dotnet-applications-even-faster) by Sasha Goldshtein
* [Measuring .NET Performance](https://app.pluralsight.com/library/courses/measuring-dotnet-performance) by Sasha Goldshtein
* [PerfView Tutorial](https://channel9.msdn.com/Series/PerfView-Tutorial) by Vance Morrison
* [Defrag Tools - Perf View](https://channel9.msdn.com/Search?term=%22Defrag%20Tools%22%20%2B%20%22PerfView%22#ch9Search) by Vance Morrison

## On-Site Trainings

* [.NET Performance and Debugging Workshop](http://www.sela.co.il/syl/Syllabus.aspx?CourseCode=DNWSH&CategoryID=165) by SELA (Israel)
* [.NET Performance](http://www.sela.co.il/syl/Syllabus.aspx?CourseCode=50153&CategoryID=165) by SELA (Israel)
* [Asynchronous Computing and Composing Asynchronous and Event-Based](http://www.sela.co.il/syl/Syllabus.aspx?CourseCode=RXTDF&CategoryID=165) by SELA (Israel)
* [Parallel Programming with the TPL](http://www.sela.co.il/syl/Syllabus.aspx?CourseCode=ParallelWS&CategoryID=165) by SELA (Israel)
* [Solid Async in .NET](http://www.rocksolidknowledge.com/Courses/SolidAsync) by Rock Solid Knowledge (UK)
* [Mastering .NET Performance Tuning](http://wintellect.com/software-development-training/courses/mastering-net-performance-tuning) by Wintellect (USA)
* [Mastering .NET Threading](http://wintellect.com/software-development-training/courses/mastering-dotnet-threading) by Wintellect (USA)

## Conference talks

Sorted from newest to oldest:
* 2017
	* [Look Mommy, No GC!](https://www.youtube.com/watch?v=G49baWvzCOI) by Dina Goldshtein (2017.03.23, NDC)
	* [Squeezing the Hardware to Make Performance Juice](https://www.youtube.com/watch?v=5jKLVGI3B4g) by Sasha Goldshtein (2017.03.17, DotNext)
	* [Performance tuning Stack Overflow tags](https://www.youtube.com/watch?v=bd5WYql5vlg) by Marco Cecconi (2017.03.17, DotNext)
	* [Multithreading Deep Dive](https://www.youtube.com/watch?v=z2QYa2RW9c8) by Gael Fraiteur (2017.03.17, DotNext)
	* [Stack Overflow — It's all about performance!](https://www.youtube.com/watch?v=9_pluQPfbBk) by Marco Cecconi (2017.03.17, DotNext)
	* [ETW — Monitor Anything, Anytime, Anywhere](https://www.youtube.com/watch?v=s213p-zB7G4) by Dina Goldshtein (2017.03.17, DotNext)
	* [Exceptional Exceptions in .NET](https://youtu.be/U92Ts53win4?t=1786) by Adam Sitnik (2017.03.17, DotNext)
* 2016
	* [PerfView: Measure and Improve Your App's Performance For Free](https://www.youtube.com/watch?v=eX644hod65s) by Sasha Goldshtein (2016.11.02, DotNext)
	* [The C++ and CLR Memory Models](https://www.youtube.com/watch?v=6wZVpg2SyJQ) by Sasha Goldshtein (2016.11.02, DotNext)
	* [Safe Systems Programming in C# and .NET](https://www.infoq.com/presentations/csharp-systems-programming) by Joe Duffy (2016.08.20, QCon)
	* [ASP.NET Core Kestrel: Adventures in building a fast web server](https://www.youtube.com/watch?v=kej3YJDMAW4) by Damian Edwards & David Fowler (2016.08.12, NDC)
	* [Performance and How to Measure It](https://www.infoq.com/presentations/dot-net-performance) by Matt Warren (2016.07.28, ProgSCon)
	* [Performance Optimizations in the Wild](https://vimeo.com/171927596) by Oren Eini (Ayende) (2016.06.23, NDC)
	* [The Vector in Your CPU: Exploiting SIMD for Superscalar Performance](https://www.youtube.com/watch?v=WeJ8b3WRSmM) by Sasha Goldshtein (2016.04.19, DotNext)
	* [Lessons in Extreme .NET Performance](https://www.infoq.com/presentations/bing-net-performance) by Ben Watson (2016.03.13, QCon)
* Older
	* [Making .NET applications faster](https://www.youtube.com/watch?v=jz3SvJhdtEw) by Sasha Goldshtein (2015.10.30, DevWeek)
	* [The zen of async: Best practices for best performance](https://channel9.msdn.com/Events/Build/BUILD2011/TOOL-829T) by Stephen Toub (2011.09.13, Build)

## Blogs

* [Matt Warren](http://mattwarren.org)
* [Andrey Akinshin](http://aakinshin.net)
* [Oren Eini aka Ayende](https://ayende.com/blog)
* [Sasha Goldshtein](http://blogs.microsoft.co.il/sasha)
* [Alexandre Mutel aka xoofx](http://xoofx.com/blog)
* [Jack Mott aka PerlinMandleBro](https://jackmott.github.io)
* [Vladimir Sadov](http://mustoverride.com/)

## Inspiring Open Source Contributors

* [Ben Adams](https://github.com/benaadams)
* [Jan Kotas](https://github.com/jkotas)
* [Stephen Toub](https://github.com/stephentoub)
* [omariom](https://github.com/omariom)
* [James Ko](https://github.com/jamesqo)
* [mikedn](https://github.com/mikedn)
* [Justin Van Patten](https://github.com/justinvp)
* [nietras](https://github.com/nietras)
* [Vladimir Sadov](https://github.com/VSadov)
* [Federico Andres Lois](https://github.com/redknightlois)

## Performance measurement
* [BenchmarkDotNet](https://github.com/PerfDotNet/BenchmarkDotNet) - Powerful .NET library for benchmarking.
* [NBench](https://github.com/petabridge/NBench) - Cross-platform performance benchmarking and testing framework for .NET applications.
* [xunit.performance](https://github.com/Microsoft/xunit-performance) - Provides extensions over xUnit to author performance tests.
* [Prefix](http://stackify.com/prefix) - Free lightweight profiler for ASP.NET apps shows everything your code is doing across 30+ common libraries
* [App Metrics](https://github.com/alhardy/AppMetrics) - App Metrics is an open-source and cross-platform .NET library used to record and report metrics within an application and reports it's health. See the docs for [more](https://alhardy.github.io/app-metrics-docs/getting-started/intro.html) details.

## High Performance Libraries
* [MathNet](http://www.mathdotnet.com/) - Math.NET is an opensource initiative to build and maintain toolkits covering fundamental mathematics, targetting advanced but also every day needs of .Net developers.
* [Nessos Streams](https://github.com/nessos/Streams) - A lightweight F#/C# library for efficient functional-style pipelines on streams of data.
* [SIMD Array](https://github.com/jackmott/SIMDArray) - SIMD and other Performance enhanced Array operations for F#.
* [markdig](https://github.com/lunet-io/markdig) - Markdig is a fast, powerful, CommonMark compliant, extensible Markdown processor for .NET.
* [Wire](https://github.com/AsynkronIT/Wire) - A high performance polymorphic serializer for the .NET framework.
* [Disruptor-Net](https://github.com/disruptor-net/Disruptor-net) - .NET port of LMAX Disruptor, a faster alternative to BlockingCollection.
* [SimpleInjector](https://github.com/simpleinjector/SimpleInjector) - Fast Dependency Injection library that promotes best practice to steer developers towards the pit of success.
* [NativeInterop](https://bitbucket.org/frank_niemeyer/nativeinterop) - Generic pointers and native 64-bit arrays for .NET
* [MPMCQueue.NET](https://github.com/alexandrnikitin/MPMCQueue.NET) - Bounded multiple producers multiple consumers queue for .NET

## Article series

### Benchmarking
* [The Art of Benchmarking](http://mattwarren.org/2014/09/19/the-art-of-benchmarking/) by Matt Warren
* [Adventures in Benchmarking - Memory Allocations](http://mattwarren.org/2016/02/17/adventures-in-benchmarking-memory-allocations/) by Matt Warren
* [Micro-Benchmarking Done Wrong, And For The Wrong Reasons](http://blogs.microsoft.co.il/sasha/2012/06/22/micro-benchmarking-done-wrong-and-for-the-wrong-reasons/) by Sasha Goldshtein
* [Stopwatch under the hood](http://aakinshin.net/en/blog/dotnet/stopwatch/) by Andrey Akinshin
* [DateTime under the hood](http://aakinshin.net/en/blog/dotnet/datetime/) by Andrey Akinshin
* [Benchmarking made easy](http://blogs.msmvps.com/jonskeet/2009/01/26/benchmarking-made-easy/) by Jon Skeet
* [Simple microbenchmarking in C#](http://www.yoda.arachsys.com/csharp/benchmark.html) by Jon Skeet
* [Acquiring high-resolution time stamps](https://msdn.microsoft.com/library/windows/desktop/dn553408.aspx)
* [On ‘stackalloc’ Performance and The Large Object Heap](http://blogs.microsoft.co.il/sasha/2013/10/17/on-stackalloc-performance-and-the-large-object-heap/) by Sasha Goldshtein
* [Micro-Benchmarking Considered Harmful](http://blogs.microsoft.co.il/sasha/2009/05/08/micro-benchmarking-considered-harmful/) by Sasha Goldshtein
* [On Measuring Performance](http://blogs.microsoft.co.il/sasha/2007/12/27/on-measuring-performance/) by Sasha Goldshtein
* [Performance exercise: Minimum](http://aakinshin.net/en/blog/dotnet/perfex-min/) by Andrey Akinshin
* [Performance exercise: Division](http://aakinshin.net/en/blog/dotnet/perfex-div/) by Andrey Akinshin

### JIT Optimizations
* [JIT Optimizations](http://www.codeproject.com/Articles/25801/JIT-Optimizations) by Sasha Goldshtein
* [JIT Optimizations, Inlining, and Interface Method Dispatching (Part 1 of N)](http://blogs.microsoft.co.il/sasha/2007/02/27/jit-optimizations-inlining-and-interface-method-dispatching-part-1-of-n/) by Sasha Goldshtein
* [JIT Optimizations, Inlining, and Interface Method Dispatching (Part 2 of N)](http://blogs.microsoft.co.il/sasha/2007/08/12/jit-optimizations-inlining-and-interface-method-dispatching-part-2-of-n/) by Sasha Goldshtein
* [Performance differences between debug and release builds](http://stackoverflow.com/questions/4043821/performance-differences-between-debug-and-release-builds/4045073#4045073) by Hans Passant
* [Aggressive Inlining in the CLR 4.5 JIT](http://blogs.microsoft.co.il/sasha/2012/01/20/aggressive-inlining-in-the-clr-45-jit/) by Sasha Goldshtein
* [Jit Optimizations: Inlining (I)](https://blogs.msdn.microsoft.com/davidnotario/2004/10/28/jit-optimizations-inlining-i/) by David Notario
* [Jit Optimizations: Inlining (II)](https://blogs.msdn.microsoft.com/davidnotario/2004/11/01/jit-optimizations-inlining-ii/) by David Notario
* [More on inlining…](https://blogs.msdn.microsoft.com/ericgu/2004/01/29/more-on-inlining/) by Eric Gunnerson
* [To Inline or not to Inline: That is the question](https://blogs.msdn.microsoft.com/vancem/2008/08/19/to-inline-or-not-to-inline-that-is-the-question/) by Vance Morrison
* [Some Notes on Using Machine Learning to Develop Inlining Heuristics](https://github.com/AndyAyersMS/PerformanceExplorer/blob/master/notes/notes-aug-2016.md) by Andy Ayers
* [The JIT does dead-code elimination in Debuggable code](http://blogs.msdn.com/b/jmstall/archive/2006/03/13/dead-code-elimination.aspx) by Mkie Stall
* [Does the JIT take advantage of my CPU?](https://blogs.msdn.microsoft.com/davidnotario/2005/08/15/does-the-jit-take-advantage-of-my-cpu/) by David Notario
* [Unrolling of small loops in different JIT versions](http://aakinshin.net/en/blog/dotnet/unrolling-of-small-loops-in-different-jit-versions/) by Andrey Akinshin
* [RyuJIT CTP5 and loop unrolling](http://aakinshin.net/en/blog/dotnet/ryujit-ctp5-and-loop-unrolling/) by Andrey Akinshin
* [RyuJIT RC and constant folding](http://aakinshin.net/en/blog/dotnet/ryujit-rc-and-constant-folding/) by Andrey Akinshin
* [A story about JIT-x86 inlining and starg](http://aakinshin.net/en/blog/dotnet/inlining-and-starg/) by Andrey Akinshin
* [LegacyJIT-x86 and first method call](http://aakinshin.net/en/blog/dotnet/legacyjitx86-and-first-method-call/) by Andrey Akinshin
* [Do PDB Files Affect Performance?](http://devcenter.wintellect.com/jrobbins/do-pdb-files-affect-performance) by John Robbins
* [What does the optimize switch do?](https://blogs.msdn.microsoft.com/ericlippert/2009/06/11/what-does-the-optimize-switch-do/) by Eric Lippert

### Refs
* [ref returns are not pointers](http://mustoverride.com/refs-not-ptrs/) by Vladimir Sadov
* [managed pointers](http://mustoverride.com/managed-refs-CLR/) by Vladimir Sadov
* [Local variables cannot be returned by reference](http://mustoverride.com/ref-returns-and-locals/) by Vladimir Sadov
* [Safe to return rules for ref returns](http://mustoverride.com/safe-to-return/) by Vladimir Sadov
* [Why ref locals allow only a single binding?](http://mustoverride.com/ref-locals_single-assignment/) by Vladimir Sadov

### Threading
* [Threading in C#](http://www.albahari.com/threading/) by Joseph Albahari

repository: dadhi/awesome-dot-net-performance

repo_name: dadhi/awesome-dot-net-performance


text:
composite-value-objects

 [![Latest Stable Version](http://poser.pugx.org/apie/composite-value-objects/v)](https://packagist.org/packages/apie/composite-value-objects) [![Total Downloads](http://poser.pugx.org/apie/composite-value-objects/downloads)](https://packagist.org/packages/apie/composite-value-objects) [![Latest Unstable Version](http://poser.pugx.org/apie/composite-value-objects/v/unstable)](https://packagist.org/packages/apie/composite-value-objects) [![License](http://poser.pugx.org/apie/composite-value-objects/license)](https://packagist.org/packages/apie/composite-value-objects) [![PHP Version Require](http://poser.pugx.org/apie/composite-value-objects/require/php)](https://packagist.org/packages/apie/composite-value-objects) [![Code coverage](https://raw.githubusercontent.com/apie-lib/composite-value-objects/main/coverage_badge.svg)](https://apie-lib.github.io/coverage/composite-value-objects/index.html)

[![PHP Composer](https://github.com/apie-lib/composite-value-objects/actions/workflows/php.yml/badge.svg?event=push)](https://github.com/apie-lib/composite-value-objects/actions/workflows/php.yml)

This package is part of the [Apie](https://github.com/apie-lib) library.
The code is maintained in a monorepo, so PR's need to be sent to the [monorepo](https://github.com/apie-lib/apie-lib-monorepo/pulls)

## Documentation
Composite value objects is mainly a trait that can be used inside value objects for value objects that are a composite of value objects or primitives. For example a range value object is often best used as a value object itself because the start and the end of the range should be in a restricted range..

### Usage
All you need to do is make an object with the ValueObjectInterface and the CompositeValueObject trait. Then all you need are properties and fromNative and toNative will change accordingly.

For example:
```php
<?php
use Apie\CommonValueObjects\Texts\DatabaseText;
use Apie\CompositeValueObjects\CompositeValueObject;
use Stringable;

final class StreetAddress implements ValueObjectInterface, Stringable
{
    use CompositeValueObject;

    public function __construct(private DatabaseText $street, private DatabaseText $streetNumber)
    {}

    public function __toString(): string
    {
        return $this->street . ' ' . $this->streetNumber;
    }
}

// creates a StreetAddress value object from an array.
$address = StreetAddress::fromNative([
    'street' => 'Example Street',
    'streetNumber' => 42
]);
// $addressDisplay = 'Example Street 42';
$addressDisplay = (string) $address;

// return array again
$address->toNative();

// throws error for missing street number
$address = StreetAddress::fromNative([
    'street' => 'Example Street'
]);

```

Remember that the example has a constructor, but this is not required, but if you do forget to add one someone could misuser your
value object incorrectly by just calling new ValueObject() without constructor arguments. You could also make a private constructor
to force people to use fromNative() to create your object.

### Optional fields
By default all non-static fields are required and will throw an error if missing. To make a field optional you have 2 options.
You either add the Optional attribute to a property, or you give the property a default value.

Both examples below have the same result:

```php
<?php
use Apie\CommonValueObjects\Texts\DatabaseText;
use Apie\CompositeValueObjects\CompositeValueObject;

final class StreetAddress implements ValueObjectInterface
{
    use CompositeValueObject;

    private function __construct()
    {
        // this enforces other programmers to use fromNative
    }

    private DatabaseText $street;
    private DatabaseText $streetNumber;
    private ?DatabaseText $streetNumberSuffix = null;
}
```

```php
<?php
use Apie\CommonValueObjects\Texts\DatabaseText;
use Apie\CompositeValueObjects\CompositeValueObject;
use Apie\Core\Attributes\Optional;

final class StreetAddress implements ValueObjectInterface
{
    use CompositeValueObject;

    private function __construct()
    {
        // this enforces other programmers to use fromNative
    }

    private DatabaseText $street;
    private DatabaseText $streetNumber;

    #[Optional]
    private DatabaseText $streetNumberSuffix;
}
```
Remember that in PHP you will get errors if you try to read typehinted properties if they are not set. toNative() will not return
a value if they are not set.

### Validation
To add validation you can add a method validateState(). If the current state is invalid this method should throw an error.
It is being called by fromNative() if the method exists and should also be called with any custom constructor.

A good example is [time ranges](https://github.com/apie-lib/common-value-objects/blob/main/src/Ranges/DateTimeRange.php#L43) where the start time needs to be created before the end time.

Here we give an example of a combination of first and last name and the total length of both fields should not extend 255 characters.

```php
<?php
use Apie\CompositeValueObjects\CompositeValueObject;

final class FirstNameAndLastName implements ValueObjectInterface, Stringable
{
    use CompositeValueObject;

    private string $firstName;

    private string $lastName;

    public function __construct(private string $firstName, private string $lastName)
    {
        $this->validateState();
    }

    public function __toString(): string
    {
        return $this->firstName . ' ' . $this->lastName;
    }

    private function validateState(): void
    {
        if (strlen((string) $this) > 255) {
            throw new RuntimeException('Length of first name and last name should not exceed 255 characters');
        }
    }
}

### Union typehints
The composite value object trait supports union typehints. To avoid accidental casting and that the reflection API of PHP
will always return typehints in the same order(you don't have control over this) we check specific types first.

If the input is a string and string is a typehint it will pick string.

Otherwise the order of doing typecast is:
- objects+other types
- float
- int
- string

```php
<?php
use Apie\CommonValueObjects\Texts\DatabaseText;
use Apie\CompositeValueObjects\CompositeValueObject;
use Apie\Core\Attributes\Optional;

final class Example implements ValueObjectInterface
{
    use CompositeValueObject;

    private function __construct()
    {
        // this enforces other programmers to use fromNative
    }

    private string|int $value;

    public function getValue(): string|int
    {
        return $this->value;
    }
}
// getValue() returns '12' and is not casting to integer.
Example::fromNative(['value' => '12'])->getValue();
// getValue() returns 12 and is not casting to string.
Example::fromNative(['value' => 12])->getValue();
```

license: MIT

repository: apie-lib/apie-lib-monorepo

branch_name: refs/heads/main

extension: md

gha_language: PHP

gha_license_id: MIT

license_type: permissive

repo_name: apie-lib/apie-lib-monorepo


text:
# Introduction:

Welcome to the home of the Puppet Classifier. This perl-based Dancer2 web and
database application is designed to allow managing the Puppet classes that are
assigned to a given host. Currently, the database portion requires MySQL or a
fully MySQL compatible database, like MariaDB.

repository: greeneg/classifier

branch_name: refs/heads/master

repo_name: greeneg/classifier


text:
# inside_square
## Problem: Calculate the inner blue square in the image shown

### There are mutiple ways to solve the problem.  One way is to use the Altitude-on-hypotenuse Theorem

```math
h^2=m*n
b^2=a*m
c^2=a*n
```
In this project we want to dynamically show and calculate the area of the inner square for various values of the outer square from 0 to 100


text:
You’ll normally see a message on the site before we store a cookie on your computer.

Find out more about [how to manage cookies](http://www.aboutcookies.org/){rel=external}.

## How cookies are used on NHS.UK

### Measuring website usage (Google Analytics and Webtrends)

We use Google Analytics and Webtrends software to collect information about
how you use NHS.UK. We do this to help make sure the site is meeting the needs
of its users and to help us make improvements, for example improving site search.

Google Analytics and Webtrends store information about:

* the pages you visit on NHS.UK
* how long you spend on each NHS.UK page
* how you got to the site
* what you click on while you’re visiting the site

We don’t collect or store your personal information (for example your name or address) so this information
can’t be used to identify who you are.

repository: nhsuk/betahealth

branch_name: refs/heads/develop

gha_language: JavaScript

repo_name: nhsuk/betahealth


text:
# Voxon
VoxMecanica Object Notation - The Dialog JSON

A VoxMec dialog, between human and device, is represented in an machine readable format based on JSON called `VoxON` or `VoxMecanica Object Notation`.  The dialog is made up of dialog parts that are rendered as vocal interactions by specifying when the device listens for voice input from user or when and how the device can vocalize a response back to the user.

Devices that implements VoxMecanica's object notation are expected to have the following minimum capabilities:
* Text-to-Speech - ability to render text as spoken word using some TTS engine.
* Automatic Speech Recognition (ASR) - ability to do speech recognition.
* Optional features can include: display screen, a browser, etc.

## Voxon 0.1 Representation

### Dialog
The following outlines the representation of JSON file used for dialog.  A voxmec runtime executes the file as an interactive dialog on supported devices such as Android or Chrome browser.
```JSON
{
  "properties":{
    "originUri":"string <origin URL for dialog>",
    "submitUri":"string - <URL for dialog submission>",
    "submitMethod":"string - <POST|GET>",
    "submitFormat":"string - <submission format {PLAIN|JSON}>"
  },

  "parts":[
    {
      "type":"string - <required {INPUT|SPEAK|PLAYBACK|DISPLAY|DIRECTIVE} valid dialog parts>",
      "id":"string - <optional identifier for part>",
      "title":"string - <optional title for part>",
      "alt":"string - <optional text for speech>",
      "src":"string - <url for a resource>",
      "text":"string - <text used for output by device>",
      "href":"string - <link associated with dialog part>",

      "pitch":"numeric - <a directive to alter the pitch value used for TTS>",
      "rate":"numeric - <a directive to alter speech rate used for TTS",
      "voice":"string - <a directive to alter set the voice to used for TTS>",
      "pause":"numeric  - <a directive to pause the dialog in millisecs>",

      "inputMode":"string - <mode for input: {ASR|ALPHANUM|NUM|REC}>",
    }
  ],

  "params":[
    {
      "id":"string - identifier of parameter",
      "value":"string - value of parameter"
    }
  ]
}
```

### Dialog Result
A dialog result represents the data collected from a dialog.  The result of a dialog is a collection of input values (from listen commands) and parameters (params object).  The dialog result can optionally store remote submission directives if the result of the dialog is to be sent to an HTTP server for further handling.

```JSON
{
  "params":[
    {
      "id":"string - <id of parameter>",
      "mode":"string - <{ASR|ALPHANUM|NUM|REC|PARAM} how the param was collected",

      "asr":{
        "matches":"array - [strings of matches from ASR]",
        "confidence":"array [confidence scores for each match]"
      },

      "value":"string - val for param when non-ASR"
    }
  ],

  "remote":{
    "origin":"string - <origin url for dialog>",
    "submit-to":"string - <URL for dialog submission>",
    "method":"string - <POST|GET>"
  },
}
```

repository: voxmec/voxon-doc

repo_name: voxmec/voxon-doc


text:
---
title: "Tips"
weight: 50
description: Some tips that may help
---

## Use stderr to debug

Currently, CP Editor doesn't have a built-in GUI debugger, but this doesn't mean it's hard to debug codes using CP Editor.

Besides single-stepping, the most used debugging approach is to output some variables. Do you remember the times you tried hard to distinguish the debugged variables from the normal outputs? You don't have to do this in CP Editor.

The key is: Use stderr to output debug information. In C++, this means to use `cerr` instead of `cout` to output. CP Editor will show the stderr of your program in the Messages section.

## Run on only selected test cases

In CP Editor, you don't have to always run on all test cases.

To tell CP Editor not to run on a certain test case, just uncheck the checkbox of that test case. You can also use the "More" menu to manage the checks: you can Check All, Uncheck All, Uncheck Accepted (very useful when you passed most test cases and want to debug on the unaccepted ones) and Invert.

If you want to run on a single test case, you can simply click the "Run" button of that test case.

## Copy output to expected for problems with multiple correct answers

Sometimes you are solving a problem that has more than one correct answer. The online judge has a checker, but you don't, and you don't have the time to write one. Leaving them in the "WA" verdict could be annoying, or even inconvenient because you have to manually check again after modifying your codes.

CP Editor provides a solution: Copy Output to Expected. This could be done in either the right-click menu of the Expected section for a single test case or in the "More" menu for all selected test cases. With this function, you can easily copy the accepted outputs to expected, and they will be in the AC verdict as long as their outputs are not changed.

## Load, edit and save test cases

You can load test cases from files, edit test cases in bigger windows and save a test case in a file in the right-click menu of the test cases.

## Testlib checkers are compiled at runtime

Testlib checkers are compiled when changing the checker or changing the preferences, so you may have to wait for it after the execution is finished.

## Drag and drop files

You can drag files and drop them into the main editor or the input/expected part of test cases.

## Shortcuts in the code editor

Besides the shortcuts in the menu, you can use the [Read-only Key Bindings](https://doc.qt.io/qt-5/qtextedit.html#read-only-key-bindings) and the [Editing Key Bindings](https://doc.qt.io/qt-5/qtextedit.html#editing-key-bindings). There are also some hidden shortcuts: Tab (when there's a selection) and Shift+Tab for indent and unindent, Ctrl+Enter and Ctrl+Shift+Enter for inserting line after and before, Shift+Delete for deleting the current line.

## Switching between tabs

You can use Ctrl+Tab and Ctrl+Shift+Tab to switch to the next/previous tab.

## The right-click menu of the tabs

You can right-click on the tabs to get a useful context menu, including:

-   Manage tabs: Close Others, Close to the Right, etc.
-   Duplicate tab. Very useful when you want to make experimental changes with the original code untouched or use different approaches to solve a problem without parsing it twice.
-   Set compile command/time limit for a single tab. If you are solving a special problem.
-   Reveal source/executable file. To easily find your code and the executable file.
-   Manage the problem URL: Open Problem in Browser, Set Codeforces URL, etc.

## Shortcuts in the preferences window

You can use Ctlr+D, Ctrl+R and Ctrl+S for "Default", "Reset" and "Apply" respectively.

You can use Ctlr+Tab and Ctlr+Shift+Tab to go through the preferences pages.

## Change the view mode

-   Editor mode: You can focus on your codes.
-   IO mode: You can investigate the outputs and errors.
-   Split mode: You can see both the codes and the test cases.

You can set a hotkey for switching view modes in [Preferences](../preferences/key-bindings/\_index.ru.md).

## Launch CP Editor in the command line

CP Editor supports some command-line options, run `cpeditor --help` for more information.

On Windows, it's better to use UNIX-like shells like git bash.

In the command line, you can open a non-existing file as a tab by `cpeditor <path>` (and you can save to this path later), open all C++ files in a directory recursively by `cpeditor --cpp <directory>` or temporarily disable [Restore last session at startup](../preferences/actions/\_index.ru.md#restore-last-session-at-startup) by `cpeditor --no-hot-exit`.

CP Editor normally closes when receiving SIGINT and SIGHUP, so if you start CP Editor in the command line, you can safely press Ctrl+C to quit.

branch_name: refs/heads/hugo

gha_language: HTML


text:
move-lines
==========

Emacs package that moves current line or lines surrounding region up or down.

Configuration
=============

Copy the provided version of ``move-lines.el`` in a directory which is in the
Emacs ``load-path``. Then, execute the following code either directly or in
your .emacs file:

    (require 'move-lines)
    (move-lines-binding)

After that, you can move the line(s) up by **M-p** or **M-\<up\>** or down by
**M-n** or **M-\<down\>**.


text:
There is one red ball and the rest are green.
The balls move at random velocities.
The balls also wrap around the window if they move off screen.
If the red ball collides with a green ball, the green ball is deleted and the red ball gets a new random velocity.
The up and down arrows on keyboard will slow down or speedup the animation.
Clicking the mouse in window will create a new green ball at the location of the pointer.
Clicking and dragging the mouse in the window will create many green balls along the path the mouse was dragged.

Known Bugs:
Balls sometime get stuck at the corners of the window.

license: Unlicense

repository: Daniel-Glauber/wrap-around-moving-balls

repo_name: Daniel-Glauber/wrap-around-moving-balls


text:
# Privacy Policy

No data or personal information is collected by Refined GitHub.

##### Contact

If you have any questions or suggestions regarding this privacy policy, do not hesitate to [contact us](https://sindresorhus.com/contact).

branch_name: refs/heads/upstream

gha_language: TypeScript


text:
# High Level Architecture Overview

KillrVideo is a video sharing web application. As such, it's got a tiered setup that's
pretty common for web applications:

- **Web Client:** The web UI that runs in a browser and is interacted with by the user. It
sends requests to a Web Server (via HTTP, web sockets, etc.)
- **Web Server:** Serves up static assets for the client (i.e. JavaScript, CSS, images) and
responds to requests from the Web Client by routing them to the appropriate service(s) on
the backend.
- **Microservices Tier:** A tier of independent services that house the data and the logic
for the features and functionality of the site.

We'll get into the details of how these tiers are actually implemented in the [next section][next],
but first let's take a closer look at the Microservices Tier conceptually.

## Microservices Tier

KillrVideo uses a [microservices](http://martinfowler.com/articles/microservices.html) style
architecture where the site is broken up into multiple smaller services where each service
is responsible for providing the functionality for a specific feature. This is the current
list of services and the functionality they are responsible for:

- **Comments:** Allows users to comment on videos and keeps track of those comments.
- **Ratings:** Allows users to rate videos (on a scale of 1-5) and keeps track of those
ratings.
- **Search:** Indexes the available videos for searching by keyword and provides search
suggestions (i.e. typeahead) support.
- **Statistics:** Keeps track of statistics for videos like how many times they've been
played back.
- **Suggested Videos:** Provides suggestions for videos similar to another video as well
as personalized video suggestions for a particular user.
- **Uploads:** Allows users to upload videos to the site and handles converting uploaded
video files to a format that's compatible with the site.
- **User Management:** Manages user accounts including signing up and logging in/out.
- **Video Catalog:** Keeps track of all the videos available for playback and the details
of those videos (i.e. title, description, etc.)

Each of these services is designed to be completely independent and not have a dependency
on any other service being available to do its job. What does this mean in practice? That
the implementations of our services shouldn't be making calls to other service APIs in
order to do their work when at all possible.

So if we don't want our services directly calling other service APIs, how will the services
interact with each other?

## Using Events for Service Collaboration

In KillrVideo we've chosen to use [events for collaboration](http://martinfowler.com/eaaDev/EventCollaboration.html)
between services rather than having services calling each other directly. Each service is
for publishing events about interesting things that happen inside of them. Other services
can then subscribe to any events they are interested in and react accordingly.

> #### An Example from KillrVideo
> Whenever a new YouTube video is added to the video catalog, the **Video Catalog**
> service publishes a `YouTubeVideoAdded` event. That event contains some of the details
> of the video that was added (like it's id, name, description, etc.). Other services can
> (and do) subscribe to this event if they are interested. For example, the **Search**
> service might want to add the video to its index so the video starts showing up in
> search results. Or the **Suggested Videos** service may want to figure out what other
> videos are similar to that one so it can offer suggestions.

If services are publishing events and possibly subscribing to them as well, this implies
that we'll need some sort of mechanism for doing [Publish-subscribe](https://en.wikipedia.org/wiki/Publish%E2%80%93subscribe_pattern)
messaging. We'll cover the specifics of actually implementing pub-sub shortly.

[Next: Web Tier Implementation][next]

[next]: /docs/guides/web-tier/

branch_name: refs/heads/source


text:
# Hendrix
![license](https://img.shields.io/badge/License-MIT-yellow.svg)
## Table of Content
* [Project Links](#Project-Links)
* [Screenshots-Demo](#Screenshots)
* [Project Objective ](#Project-Objective)
* [Installation](#Installation)
* [Technologies](#Technologies)
* [Contact](#Contact)
* [License](#License)
## Project Links
[Github Repo](https://github.com/silvia-taliana/review-web)

[Heroku Deployment](https://powerful-cliffs-81150.herokuapp.com/)
## Screenshots - Demo

![Home screen](./assets/home.png)

![View businesses](./assets/dashboardview.png)

![View reviews](./assets/businessview.png)

## Project Objective
Working with a team of developers, we set out to create an application incorporating a MVC and a mySQL server.
The main purpose of this application is to provide a platform for businesses to not only promote their pages but for consumers to voice their opinions of their service.
The website allows business owners and consumers to create accounts and freely post reviews.

Design process:
-      Brainstorming an idea
-      Designing database models
-      Designing page format
-      Linking routes and fetch requests for a responsive website
-      Creating a chat room via the use of socket.io

## Installation
This is a web based application which is already deployed at heroku.

## Technologies
-      mySQL
-      Javascript
-      Handlebars
-      Sequelize
-      socket.io

## Future Development
-      Allow for users to privately chat with business owners.
-      Create maps with businesses location
-      A form of booking restaraunts/pubs
## Author Contact
Contact the author with any questions!
Github link: [Travis](https://github.com/Travis297)
Github link: [Silvia](https://github.com/silvia-taliana)
Github link: [Shelly](https://github.com/zoeshelly-tan)
Github link: [Suri](https://github.com/netsy001)
## License
This project is [MIT](https://choosealicense.com/licenses/MIT/) licensed.

repository: Travis-Witts/hendrix

repo_name: Travis-Witts/hendrix


text:
# CustomTransitions

This project contains the examples that go along with the Objective Toast article titled [Custom Transitions on iOS](http://objectivetoast.com/2014/03/17/custom-transitions-on-ios/).

## Notes

When you run the app, you will first see a menu with a list of the examples. After you run each example, you can return to the main menu by tapping anywhere in the example view (the one with the colorful background).

repository: huangboju/Pandora

repo_name: huangboju/Pandora


text:
---
title: "Getting started with Azure Machine Learning"
date: 2020-05-06T14:33:02+08:00
draft: false
author: "Setu Chokshi"
authorLink: ""
description: ""

tags: ["Starting up", "Machine Learning", "Azure"]
categories: ["Azure Machine Learning"]
featuredImage: "/images/posts/getting_started_with_AML/decisiontree.jpg"

hiddenFromHomePage: false
hiddenFromSearch: false

toc:
  enable: true
  auto: true
code:
  copy: true
math:
  enable: true
---

## Introduction and Motivation
If you are reading this then you probably understand the need and the importance of machine learning. You probably are itching to get started with machine learning. But everywhere you look, job boards, tutorials, etc. you find that there ask is always for a PhD or having expertise in statistics, linear algebra or programming or any combination of the three. Even when you want to just get started, the courses start off with a deep dive into Math. There is no doubt that the math is important, but when you are starting out, trying to understand and build intuition about the machine learning algorithms, simple explanations of the models help.

I recently attended the awesome Deep Learning Tutorials by Jeremy Howard and Rachel Thomas of [fast.ai](http://www.fast.ai/) . In the introduction they gave an analogy that has stuck in my mind. It goes this way:

Lets say when you were a kid and wanted to get started playing a sport, like football or even hit the ball. You went and told your parent that “Hey, can we get started with football”.  You, most likely, took a ball, went to the field and got started. No physics, no rules. You just got started. And once you started to love the sport, you learnt the rules. You learnt the physics. You learnt all the nitty gritty details that was to learn about the sport. But the first step was to build an interest in the sport.

I am hoping that these set of tutorials will help you develop an interest in machine learning and help you kick start you love and passion for the area. In the course of this blog series, we will build not only the intuition for the models, but take some time to understand the math, hopefully in a fun way. I will try to build most of the models in Excel to explain the math and how and why it works (where its possible).

And that is also the reason and my motivation to pick Azure Machine Learning (Azure ML) as the base to help you get started. I do not want to overwhelm you with the programming details, where most likely you will copy paste the code. But hopefully with Azure ML you will develop and gain an intuitive understanding to help you build your super awesome chat bot or a machine learning model.

Azure ML also allows you to take your model into production with a few clicks of a button. So in case you plan to continue towards using Azure ML, you can be assured that your learning and models won’t go to waste.

So lets get stared.

## 5 questions data science can answer for us
Before we get going, lets spend sometime to understand what machine learning can do for us. Though the number of applications are large, all of them can be grouped into 5 questions that data science can answer for us.

### 1. Is this A or B? or C or D…?
You would have seen a lot of examples of these types of algorithms in daily life. For example, when you click a picture, how does the app know that you are a male or female? Have you see the results from [how-old.net](https://how-old.net/)? With a fairly decent accuracy its able to predict whether the person is male or female and their age as well.

{{< figure src="/images/posts/getting_started_with_AML/howoldnet.jpg" title="Output of How-Old.Net" >}}

But if the person, as you see in the image above, changes their expressions, suddenly the tool goes from identifying the same person as a young female to an aged man. There are limitations to what classifications can do and we will cover them as we get deeper into the classification models. When classification is done between two classes, Is this A or B, its called binary classification or two class classification. When you have more than two classes its called multi-class classification (Is this A or B or C or D or…).

### 2. Is this weird?
This question is usually answered by a family of algorithms called Anomaly detection algorithms. In this you would want to (quickly) identify which are the weird data points that are not only rare and hard to find but they could have a material impact on the process. Lets take a couple of examples:
    * Am I being hacked? Out of the total network traffic, the intrusion traffic is going to much less. But if not detected, can wreck your critical infrastructure.
    * Detecting fraudulent transactions on your credit card to prevent abuse. Of the total transactions, the fraudulent transactions amount to a very small number.
    * Medical diagnoses to identify if the pixels represent a cancerous growth. Again, of the total pixels in an image, you will be looking at a very small number of pixels to identify cancerous cells.

Unlike classification algorithms, a metric of accuracy would not be a correct way to evaluate the model. Why? Lets take another example. Lets say you are trying to diagnose a disease that occurs only 1 in a million people. If you were using accuracy as your metric, then your best algorithm just says there is no disease as it will have the accuracy or 99.9999%. But that is incorrect. Instead we end up using a metric called Detection Rate (Recall). Recall can be defined as the ration between the correctly identified ‘anomalous’ events to the total number of ‘anomalous’ events. So in our example, the Recall would be 0 as we failed to identify the diseases in that one person.

### 3. How much? or How many?
When you are looking to predict a number to answer the questions of how much or how many, you will refer to the regression algorithm family. If you have heard about Linear regression or Ordinary Least Square (OLS) regression, then you have already know quite a bit about them. These have often been used for example:
    * What effect of price and promotion on the sales of a product?
    * How many parts of an engine will fail in next two years?
{{< figure src="/images/posts/getting_started_with_AML/weibull.jpg" title="Weibull curve [Source](http://www.weibull.com/hotwire/issue14/relbasics14.htm)" >}}

### 4. How is this organized?
When you want to understand how is the underlying data organized and you don’t have examples that you have know outcome for. Clustering algorithms help you gather a bunch of data and separate them into groups with similar properties or characteristics. You can then explore these groups to understand what makes them similar (or different). By exploring these groups you can then clearly extract the insights that will help you make better decisions.

These are useful when you are trying to recommending movies based on their viewing habits or even grouping your financial investments to ensure a diversified portfolio.

Clustering algorithms fall into a family of Unsupervised Learning. This means that the data is not labeled and does not have a known result. For example, in your clustering algorithm you can determine the number of groups your data will be clustered into but cannot dictate what the groups will be clustered into.

### 5. What should I do now?
When you are trying to determine what should I do now, you will want to explore the family of algorithms called “Reinforcement Learning Algorithms”. You would have (un)knowingly used these algorithms while training a pets. When they do a good thing, you give them a small treat. Or in a your day to day life where good behaviors are encouraged either verbally or monetarily.

{{< figure src="/images/posts/getting_started_with_AML/nutonomy.jpg" title="nuTonomy self driving car" >}}

Reinforcement algorithms learn as they go. They often learn based on the examples and training that is provided. For example, the famous AlphaGo played a lot of games against itself to help it determine the best possible move(s). In case of self driving car, it needs to make decision whether to stop or continue when it sees an object on the road.

How you ask a question is a clue to get you to the right family of algorithms that will help you answer your question. And yes make sure that you have the data to answer your question.

I am planning to the following algorithms in detail with the basics worked out in excel. We will also explore these algorithms in Azure Machine Learning to firm up your grasp on them.

 1. Classification Algorithms:
    * Decision Trees which will include decision forest, decision jungles and boosted decision tree.
    * Support Vector Machines
    * Logistic Regression.

2. Recommendation system algorithms: We will cover the data sets where we have explicit and implicit ratings data like movie ratings and come up with near state of the art results with the algorithm available on the Azure Machine Learning.

3. Regression algorithms.
    * Linear Regression
    * Decision Forest and Gradient Boosted Decision Tree (GBDT).

4. Anomaly detection
    * Support vector machines
    * K-Means

5. Reinforcement learning
    * Multi arm bandit algorithms.

These cover 13 algorithms out of the 24 that are available in Azure Machine Learning platform. I have also included the
reinforcement learning algorithm that is available as a service called [Azure Personalizer](https://azure.microsoft.com/en-us/services/cognitive-services/personalizer/).

One more thing, a sharp eyed reader would have noticed that some regression algorithms are used for classifications and
some of them have been used in various other families. Don’t worry, we will cover them as we go along and will explain
the how’s and the why’s as well.

repository: setuc/blog

repo_name: setuc/blog


text:
# Introduction

Vue CLI is a full system for rapid Vue.js development, providing:

- Interactive project scaffolding via `@vue/cli`.
- Zero config rapid prototyping via `@vue/cli` + `@vue/cli-service-global`.
- A runtime dependency (`@vue/cli-service`) that is:
  - Upgradeable;
  - Built on top of webpack, with sensible defaults;
  - Configurable via in-project config file;
  - Extensible via plugins
- A rich collection of official plugins integrating the best tools in the frontend ecosystem.

Vue CLI aims to be the standard tooling baseline for the Vue ecosystem. It ensures the various build tools work smoothly together with sensible defaults so you can focus on writing your app instead of spending days wrangling with configurations. At the same time, it still offers the flexibility to tweak the config of each tool without the need for ejecting.

- Overview
- CLI
  - Creating a Project
  - Plugins and Presets
  - Instant Prototyping
  - CLI UI
- Development
  - The CLI Service
  - Browser Compatibility
  - HTML and static assets
  - Mode and Environment Variables
  - Git Hooks
  - Building as a Library
  - Building as Web Components
  - Deployment

branch_name: refs/heads/dev


text:
# pebble-counter

A counter for pebble.
Goes from 0000 to 9999

Click up to add one, down to subtract one, and center to reset.

When counting quantities repetitively, this counter helps you to keep track of larger numbers. It may replace mechanical one handed click counters.

This may be useful for market research, or sports, counting people passing by or sitting at events,
passing cars, completed laps, hits, goals, passes.

repository: cessor/pebble-counter

repo_name: cessor/pebble-counter


text:
# Candle:
PyTorch utilities for pruning and quantization.

## How to Install PyTorch on RPi
1. Increase swap space to 1-2 GB
2. Install PyTorch as usual

## Notes:
- When designing architectures, it's helpful to interleave batch normalization with quantized layers. This reduces covariate shift, which can be quite extreme for binary weights.
- It also helps to "prime" weights by pre-training with full-precision using a soft quantize penalty (see `quantized_loss`). This loss should increase according to a schedule. Sometimes, this will make the difference between convergence and divergence.
- Having a good pruning schedule is quite important. On the simple MNIST dataset, an absolute difference of 0.5-1 point can occur, depending on the pruning schedule used.
- Model compression varies from architecture to architecture per task. For MNIST, a simple conv net with 1.7M parameters can be pruned to ~1.2% of the original model size without loss in accuracy (99.5%).
- Learning to prune can be directly incorporated as part of the model training _and_ finetuning. The weight decay term effectively sets the compression rate.

repository: paiforsyth/candle

repo_name: paiforsyth/candle


text:
# Infinity Hurdle Racer
This is a simple game I made using pygame in python.

## About Game:
It is a hurdle game which gets faster and faster as you play on. It's sort of like the google no-internet T-Rex game.

## How to run:
To open the game you must have the pygame library installed.
To run the game, first go to the folder using the cd command in the terminal. Then use the python main.py to run the game.
Make sure you install pygame first (you can use pip install pygame in terminal)

repository: anshullaikar/infinityhurdleracer

repo_name: anshullaikar/infinityhurdleracer


text:
---
layout: post
title: Linux | Windows for Linux
menu: linux
date: 2009-03-21 05:31:36
weight: 40
category: technology
tags: [linux, windows]
image: linux-tux.jpg
---

## Introduction

Coping with Windows applications on Linux is probably the biggest problem that you will face.  Your options are:

 * [Install on Linux](#install-on-linux)
 * [Use a Linux alternative](#use-a-linux-alternative)
 * [Install under Wine](#install-under-wine)
 * [Publish to Linux desktop](#publish-to-linux-desktop)
 * [Virtualise](#virtualise)

<!--more-->

## Install on Linux

This may be a waste of time, but it's at least worth checking whether your favourite applications have a Linux version.

## Use a Linux alternative

You definitely should investigate open source alternatives, some of the applications currently available under Linux are simply stunning.

 * http://www.osalt.com/
 * http://linuxappfinder.com/
 * http://www.tuxsoftware.com/

The following applications are particularly good:

## Office suite

Options:

   * OpenOffice - more like Microsoft Office than Microsoft Office 2007
   * KOffice - fast but less compatible with Microsoft Office

Benefits:

   * OpenOffice comes in for a fair amount of criticism for being slow, but on modern hardware this is simply not a problem
   * Openoffice is also criticised for trying too hard to emulate Microsoft Office, but for users used to Microsoft, this is a huge advantage
   * Includes built-in PDF support with automatic creation of PDF bookmarks (gorgeous)
   * Almost 100% compatible with Microsoft Office
   * Already compatible with Office 2007 (which you cannot say for Microsoft Office 2002)
   * OpenOffice Drawing has no Office equivalent and is simply superb for flow charts
   * OpenOffice is free - and versions are available for Windows and Linux

**Currently using Windows?  Ease the transition by installing OpenOffice on your existing Windows server.  And encourage your users to install it at home!**

## PIM/Email

Options:

   * Evolution
   * Kontact
   * Thunderbird (email only)

Benefits:

   * Both Evolution and Kontact have their proponents and their detractors, but the truth is that both these applications do a superb job of replacing Outlook
   * Evolution is probably the only option if you are wedded to Microsoft Exchange Server, and is more unified
   * Kontact is really a suite of programs beautifully welded together into a single application, but nevertheless they are separate and this does effect usability
   * Thunderbird is available for Windows and Linux

Our MD was passionate about Microsoft Outlook, but was swiftly reassured following a demonstration of Evolution and Kontact.  Any small misgivings remaining were dispelled once he realised how much faster Kontact was able to download, sort and filter his messages.

**If you don't require a full PIM, then Mozilla Thunderbird is probably the best mail-only client, and you could install it on your existing Windows server to get your users used to it!**

## Web Browser

   * Firefox (called Iceweasel under Debian) is a superb browser and is available for Windows and Linux
   * Konqueror is fast, but, currently at least, problematic with certain plug-ins

However good Firefox undoubtedly is, you will always have the odd website that simply does not work on anything except Internet Explorer.  If you're really unlucky, this will effect a website that is mission-critical for you.  You have been warned.  Fortunately Firefox is achieving market penetration levels which is forcing webmasters to take notice, so things can only get better.

One particular issue is any website still using Active-X, which is simply not supported on Linux.  Fortunately the world seems to agree that Active-X is about the worst thing ever to come out of Redmond, so its impact is on the wane.

**Install Firefox on your Windows server to familiarise your users before their transition to Linux**

## Desktop Publishing

   * Scribus is absolutely brilliant.
   * Having used QuarkXPress, I found Scribus easier to use and the built-in PDF support fantastic.
   * Scribus is available for Windows and Linux

**Make sure you install the development branch "scribus-ng" rather than the standard version, as the standard version is almost unusable.**

**Scribus is free - so why not give it to all your users?**

## Install under Wine

`Wine` is not an emulator, rather it is a collection of Linux-compatible Windows libraries.  This means that applications installed under Wine are running natively, and in my experience some applications actually run faster than under Windows.

Since the transition to version 1, Wine has become very much more effective a tool and applications that were buggy under Wine have suddenly become much more usable.  That said, my advice to anyone is to try Wine for each application and then give up if it doesn't work well.  Don't do what I did, which was spend weeks of my life and still end up with something less than usable.

Depending on the importance of the application, you could also consider [Crossover Linux by Codeweavers](http://www.codeweavers.com/products/cxlinux/).  They offer Microsoft Office for Linux and have worked to get Wine working better for many applications.  As I understand it, they are actually using an older version of Wine than currently available from WineHQ, so sometimes applications will work better under Wine than under Crossover Linux (at least so I have been told).

Internet Explorer is available from [IES4Linux](http://www.tatanka.com.br/).  This worked superbly well for us, until recently when it started hogging vast amounts of CPU, and we had to remove it from all users.  Reaches the websites that Firefox cannot reach, but probably cannot be relied upon for mission-critical use; so if you simply have to have Internet Explorer this is probably not your best option.

**IES4Linux requires a Microsoft Windows licence for each user, which, unless you have lived on the moon for the past decade, you should be able to provide.  There is at least a question-mark over this licensing, so you should make your own enquiries - start at the IES4Linux website.**

## Publish to Linux desktop

Applications can be published from a Windows server to the Linux desktop:

   * Rdesktop
   * Citrix
   * 2x
   * SeamlessRDP

### Rdesktop

   * http://www.rdesktop.org/

On the positive side, Rdesktop is open source, and is a robust application.  It's probably already installed on your Linux system, and, if not, is only an apt-get away.  If it is already installed, then simply typing "rdesktop *serverip*" will give you a login screen, so this is by far the simplest option available.  By itself, Rdesktop is only going to provide you a Windows desktop within your Linux desktop.  I.e. you will end-up with a desktop within a desktop.  This can be confusing for users, particularly those just learning to cope with Linux.  It's also less secure than providing access to the applications only.

**If you are planning an LTSP roll-out and you wish to use this rdesktop-only option, then consider using a screen-script to bypass the Linux desktop and give you a Windows logon instead**

### Citrix

   * http://www.citrix.com/

Installed on a Windows Terminal Server, Citrix does a superb job of publishing applications to a Linux desktop.  We currently have Citrix Metaframe 1.8 (Windows 2000 Server) and it is simply superb when published to a Linux desktop.  Hard to fault, it is nevertheless stupendously expensive - I recently calculated that, for us, it would treble the cost of the Windows Terminal Server and for that reason we are moving away from Citrix.

   * Install Citrix Presentation Server Client

### 2x

   * http://www.2x.com/

Similar to Citrix, but very much simpler to install.  I tested this and found it very simple to install and use.  Very much cheaper than Citrix, 2x will only marginally increase your Windows cost.

Unfortunately, at the time of my testing 2x, the features did not include the ability to set a client hostname (which was required to work with a particular Windows application) nor did it support client drive mapping.  In particular the latter meant that it was not easy to map the Windows "My Documents" folder to the users' Linux home directory.

I would hope that by now these features would be included, but at the time of writing I could not find out this information from their website.  You should make your own enquiries.

   * Install 2x client

### SeamlessRDP

   * http://www.rdesktop.org/
      * http://www.cendio.com/seamlessrdp/
         * http://www.fontis.com.au/rdesktop

This is the only open-source route to application publishing.  The good aspects are that it is fully featured - supporting client hostnames, client devices, sound, drive mapping and much else besides.  The negatives are that, sadly, there are some issues.  Using patched versions of rdesktop this is rather experimental.

That said it is the route we have currently taken and it is working.  The issues for us are: Microsoft Word cannot be run as the first application, or for some bizarre reason the File Open dialog opens behind the application window; one particular application cannot be restored when minimised with multiple windows open.

## Virtualise

If you are going to run a Windows server, then most Linux advocates would advise you to virtualise it.  We have gone one step further in running it in snapshot mode, so that at any time we can kill it and restart it back to the snapshot.  This has proved absolutely bulletproof - so far.

   * Windows Virtualisation


text:
---
layout: post
title: The gyro wine cave or gyrocave
subtitle: A project for a beautiful and more practical apartment wine cooler
tags: [design, woodworking, project]
category: design
bigimg: /img/woodworking/gyrocave/gyro_cave_concept_commented.png
---
![the gyro cave concept](/img/woodworking/gyrocave/gyro_cave_concept_commented.png)
I worked on this design when I tried to think of a wedding present for a couple in my very close friends.

I knew both enjoyed wine, yet lived in city apartment, usually a bad place to keep wine bottles
(to warm, to much vibration).
Besides, the more traditional cubic wine cooler furniture was out of question:
quite ugly, and not practical at all.
![Traditionnal appartment wine cooler](/img/woodworking/gyrocave/wine_cooler_example.jpg).

First, finding a particular bottle is tiresome, as you have to pull and replace every single bottle
to read its label, which is exceptionally annoying.

Furthermore, the fridge look is ugly, and I find the object conceptually very cold and out of touch with what wine is about,
that is life, fruit, warmness and nice flavor.

So that's were come the re-design.

![the gyro cave concept](/img/woodworking/gyrocave/gyro_cave_concept.jpg)

I started from the very form of a barrel, because it is at the very basis of wine fabrication,
and because it is a wooden object that has a natural warm feeling.

Then I imagined a system akin to a big/ferris wheel, where each bottle is on its own basket,
so that the label of the bottle is always facing upward,
and that the wine is not disturbed by the wheel rotation.

In fact, there are two wheels, one for red wine (12 bottles), and one for white wine (6 bottles).

Starting from these ideas, there are many design possibilities opening up,
i tried to lay some in my schematics.

Devil is in the details, especially considering the refrigeration part (Pelletier effect with feedback loop).
As another reference to wine world, I thought of cork lining for the inside walls,
as cork is a perfect material in this case: it dampens vibration, it isolates from outside temperature,
and regulates moisture level!

Overall it is a nice design experiment, along a good woodworking challenge,
because I designed the pieces so to be able to build it, and so it would (hopefully)
be very durable, yet not too bulky.

![the gyro cave](/img/woodworking/gyrocave/gyro_cave_1.jpg)
![the gyro cave](/img/woodworking/gyrocave/gyro_cave_2.jpg)
![the gyro cave](/img/woodworking/gyrocave/gyro_cave_3.jpg)
![the gyro cave](/img/woodworking/gyrocave/gyro_cave_4.jpg)
![the gyro cave](/img/woodworking/gyrocave/gyro_cave_5.jpg)
![the gyro cave](/img/woodworking/gyrocave/gyro_cave_6.jpg)


text:
---
layout: post
category : nodejs
title: Hello, World! with Node js
tags : [nodejs, beginner, helloworld, tutorial]
---

Today we are going to learn how to build a hello world application with Node.js.
but before we build our first application on Node JS, you need to have following softwares installed.

Prerequisite
-------------

- Download [Node.js](http://nodejs.org/download/){:target="_blank"} and install it. You can follow instruction given on [setting up Node JS on windows](http://strongloop.com/strongblog/install-node-js-windows/){:target="_blank"}/[linux](https://github.com/joyent/node/wiki/installation#installing-on-linux){:target="_blank"}/[Mac](https://github.com/joyent/node/wiki/installation#installing-on-mac){:target="_blank"}.
Don't worry about the StrongLoop part when you are installing it for windows. You can ignore it.
- Simple text editor ( We like [Sublime](http://www.sublimetext.com/download){:target="_blank"} )
- Browser

Once you're done with Node.js installation, run the below command to make sure that it has been installed successfully.

{% highlight tcsh%}
$ node -v
{%endhighlight%}

And you should see something like following:

{% highlight tcsh%}
v0.10.33in: Thu Feb 19 16:15:58 on console
{%endhighlight%}

If you are running node on windows or Linux , just run the same command as above and output of that command will be similar.

Now download this Node.js [Hello world]({{ site.url }}/assets/Hello-world.zip "Hello, World!") project and unzip it wherever you want. I use Mac so I generally keep it in [/Users/degarg/Documents].

You should see two files in the unzipped folder as below.

Don't worry about the details in the files, we will tell you what these files are and what each file contains. For now we will just focus on running the application.

Now go to the folder where you have unzipped the Hello world application and run below command.

{% highlight tcsh%}
$ node server.js
{%endhighlight%}

And you should see the following output:

If everything is fine then you would see following output  when you go to [http://<IP_ADDRESS>:1337/] in the browser.

Congratulations! you have a working Node.js Hello World app.

Details about the app will be explained in the next blog, so stay tuned.


text:
Neopets Java SDK
================
Neopets Java SDK provides Java APIs to various Neopets activities and services.
Each API wraps around a set of HTTP requests that would be made when normally playing Neopets on your web browser.

## Features
Currently, APIs for the following services are implemented:

* The National Neopian Bank
* The Neopets Stock Market

## Usage
This SDK is organized at the service level.
Each service has its own client class that provides an interface to various actions.
Account information is given during a client's instantiation by the [NeopetsCredentials](https://github.com/pslawski/np-java-sdk/tree/master/src/main/java/com/neopets/auth/NeopetsCredentials.java)
interface.

Below displays how bank interest can be collected.

```java
NeopetsCredentials credentials = new BasicNeopetsCredentials("username", "password");

NeopetsBank bank = new NeopetsBankClient(credentials);

GetBankRecordResult results = bank.getBankRecord();

if (results.getBankRecord().canCollectInterest()) {
  bank.collectInterest();
}
```

Samples to each service API can be found in [src/samples](https://github.com/pslawski/np-java-sdk/tree/master/src/samples).

repository: pslawski/np-java-sdk

repo_name: pslawski/np-java-sdk


text:
## Name

![Icon](/res/icons/16x16/app-terminal.png) Terminal - Serenity terminal emulator

[Open](file:///bin/Terminal)

## Synopsis

```**sh
$ Terminal [options]
```

## Description

Terminal is a terminal emulator application for Serenity.

## Options

* `-e`: Execute this command inside the terminal

## Examples

```sh
$ Terminal -e Shell
```

repository: bgianfo/serenity

repo_name: bgianfo/serenity


text:
---
path: 'installation/migration/migration-2-7-to-2-8'
title: 'Migrate from 2.7 to 2.8'
description: 'Migrating Spring Cloud Data Flow from version 2.7 to 2.8'
---

# Composed Task Property Syntax

In the 2.8 release of Spring Cloud Data Flow the syntax for specifying properties has been simplified.
In the past the syntax for setting a property in composed task runner was as follows:
`app.<composed task definition name>.<app label>.property`. We have removed the
requirement that you have to specify the `Composed Task Definition Name`, so now to set a property
for a composed task looks like `app.<app label>.property`. The old property format is still supported,
but it is encouraged to use the new format.

<!--NOTE-->

**NOTE:** You can read more about setting composed task properties [here](%currentPath%/feature-guides/batch/composed-task/#setting-property-at-composed-task-launch-time).

<!--END_NOTE-->

# Microsoft SQL Server

In 2.8 there have been some modifications to the Spring Cloud Data Flow schema for Microsoft SQL Server.
The `TASK_SEQ` sequence table has been replaced with a `TASK_SEQ` sequence. This
migration should occur when Spring Cloud Data Flow 2.8.x is run for the first time
on the database instance.


text:
---
layout: default
---

# 1995-10-20 - Ginetta Sagan to give Jing Lyman Lecture at Stanford

## Header Data

From<EMAIL_ADDRESS>(Todd Glassey)

To<EMAIL_ADDRESS>Message Hash: 3d66b21469338b87f8479251269212779d2565bb51174b987ab53594bee49fc5

Message ID<EMAIL_ADDRESS>Reply To: _N/A_

UTC Datetime: 1995-10-20 01:45:26 UTC

Raw Date: Thu, 19 Oct 95 18:45:26 PDT

## Raw message

```
{% raw  %}From<EMAIL_ADDRESS>(Todd Glassey)
Date: Thu, 19 Oct 95 18:45:26 PDT
To<EMAIL_ADDRESS>Subject: Ginetta Sagan to give Jing Lyman Lecture at Stanford
Message-ID<EMAIL_ADDRESS>MIME-Version: 1.0
Content-Type: text/plain

My apologies for cross posting this but she is really  a great speaker...

Todd

>Date: Thu, 19 Oct 1995 17:38:43 -0700 (PDT)
>From: Samson Tu<EMAIL_ADDRESS>>Sender: Samson Tu<EMAIL_ADDRESS>>Subject: Ginetta Sagan to give Jing Lyman Lecture at Stanford
>To<EMAIL_ADDRESS><EMAIL_ADDRESS>><EMAIL_ADDRESS>>MIME-Version: 1.0
>
>Jing Lyman Lecture on Visionary Women
>
>Women in the Resistance During World War II and After
>
>               Ginetta Sagan
>Honorable Chair, Amnesty International USA Board of Directors
>
>Time: Noon-1pm, Wednesday October 25
>Place: Oak East, Tresidder Union
>       Stanford University Campus, Stanford
>Sponsored by: Institute for Research on Women and Gender
>
>end official announcement and begin personal plug:
>
>For those of you who don't know, Ginetta Sagan, a participant in the Italian
>Resistance during the WW II, is the godmother of Amnesty activities in the Bay
>area and beyond. She is a spunky, dynamic woman, and a great storyteller. Even
>though the title of the talk is about the past, she promises to mention
>Amnesty's current concerns. When I last talked to her, she was on the phone
>with the IS researcher on Algeria, getting the latest scoop. I especially urge
>Stanford Amnesty members to come and see a local celebrity and a great human
>rights activist. (Her husband, Dr. Sagan, is a consulting professor at
>Stanford.)
>

Regards,

T. S. Glassey
Chief Technologist
Looking Glass Technologies
<EMAIL_ADDRESS>
(415) 324-4318

-----BEGIN PGP SIGNATURE-----
Version: 2.6

iQB1AwUBMFu5E6gNRnWhagU5AQHI+gL+Mwpcd3lAWd8FF06qcG6rnLhIYveHW71a
XC7xh1T0uu8qnYX31yMp17OG28jWpKUbWec1IM9/eXOi+gInA7rKICWczV8zo9Z0
0puxjRRN7yO4KfRb3cPpk+r0p6pDg01Y
=bTYb
-----END PGP SIGNATURE-----

{% endraw %}
```

## Thread

+ Return to [October 1995](/archive/1995/10)

+ Return to<EMAIL_ADDRESS>(Todd Glassey)](/authors/todd_at_lgt_com_todd_glassey_)"

+ 1995-10-20 (Thu, 19 Oct 95 18:45:26 PDT) - Ginetta Sagan to give Jing Lyman Lecture at Stanford -<EMAIL_ADDRESS>(Todd Glassey)_


text:
# Key Concepts

This document explains the key concepts of *Data-Forge*.

## Series

A series is an indexed sequence of values and is implemented by the `Series` class. By default a series has an integer index starting at 0 and counting up (just like arrays). Series will often be used with a date-time index, something usually known as a [time series](https://en.wikipedia.org/wiki/Time_series).

All values in a series are generally expected to have the same type, although this is not specifically a requirement of *data-forge-js*.

## DataFrame

A dataframe is the *main* concept and type of data structure in data-forge. It is implemented by the `DataFrame`. It is a sequence of rows. It can also be considered a matrix (rows and columns) of structured data. Think of it as a spreadsheet in memory.

A *data-frame* can be easily constructed from various formats and it can be exported to various formats.

`DataFrame` is actually a sub-class of `Series`, so it inherits all the functions of `Series`.

## Value / row

A single piece of data in a sequence.

For `DataFrame` a value is a JavaScript object, each field of which represents a column in the dataframe.

For `Series` each value can be any valid JavaScript value.

## Column

A column is a single *named* series of data in a data-frame. Each column is simply a series with a name, the values of the series are the values of the column. A column is a slice of data through all rows.

## Index

An index sequence of values that is used to index a data-frame or series. When the data is a *time-series* the index is expected to contain *Date* values.

Used for operations that search and merge data-farmes and series.

If not specified an integer index (starting at 0) is generated based on row position. An index can be explicitly by specifying a column by name.

## Pair

Through this documentation and the Data-Forge code you will occasionally see a reference to a *pair* or *pairs*. Series and DataFrames are actually sequences of *pairs*, where each pair contains a index and a value or row.

## Lazy Evaluation

Data-frames, series and index are only fully evaluated when necessary. Operations are queued up and only fully evaluated as needed and when required, for example when serializing to csv or json (`toCSV` or `toJSON`) or when baking to values (`toArray` or `toRows`).

A data-frame, series or index can be forcibly evaluated by calling the `bake` function.

## Iterator

Iterates the rows of a data-frame, series or index. Iterators allow lazy evaluation (row by row evaluation) of data frames, series and index. This is the same concept as an [iterator in JavaScript](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Iterators_and_Generators) or an [enumerator in C#](https://msdn.microsoft.com/en-us/library/system.collections.ienumerator(v=vs.110).aspx).

The specification for an iterator is simple:

	var anIterator = {

		moveNext: function () {
			// Move to the next element in the sequence.
			// Return true if the sequence contains more elements.
			// Return false when the sequence is exhausted.
		},

		getCurrent: function () {
			// Return the current element in the sequence.
		},

	};

## Iterable

An *iterable* is an anonymous function that instantiates and returns an *iterator*. A iterable conceptually represents *a sequence that can be iterated*.

An example iterable:

	var myIterable = function () {
		var myIterator = ... create an iterator for the sequence ...
		return myIterator;
	};

## Selector

A *selector* is a user-defined function (usually anonymous) that is passed to Data-Forge functions to process or transform each value in the sequence. Selectors are also used to instruct Data-Forge on which part of the data to work with.

For example say you have a row that looks as follows:

	{
		Column1: "some data",
		Column2: 42,
	},

Here is an example a *selector* that identifies *Column2*:

	var mySelector = function (row) {
		return row.Column2;
	};

Selectors are usually passed each row in the Data-Frame or each value in the Series.

Selectors are usually also passed the *index* for the value (although you can ignore this as demonstrated in the previous snippet).

An example of a selector that works with index rather than row:

	var mySelector = function (row, index) {
		return index;
	};

## Predicate

A *predicate* function is similar to a *selector*, but returns a boolean value (technically you can return any value that can be considered *truthy* or *falsey*).

An example predicate function:

	var myPredicate = function (row) {
		return row.Column2 >= 42;
	};

Predicates can also take the index:

	var myPredicate = function (row, index) {
		return index > 20;
	};

## Comparer

A *comparer* method is used to compare to values for equality. It returns true (or *truthy*) to indicate equality or false (or *falsey*) to indicate inequality.

An example:

	var myComparer = function (row1, row2) {
		return row1.ClientName === row.ClientName; // Row comparison based on client name.
	};

## Generator

A generator is a function that produces zero or more values to be inserted into a Series or DataFrame.

A generator may take arguments and it can return an array of values or rows:

	var myGenerator = function (... appropriate arguments ...) {
		return [
			[ .. generated row 1 .. ],
			[ .. row 2 .. ],
			[ .. row 3 .. ],
			[ .. etc .. ]
		];
	};

Alternatively (to support lazy evaluation) a generator may return a lazily evaluated *iterable*, that is a function that returns an iterator for a sequence of values or rows:

	var myGenerator = function (... appropriate arguments ...) {
		return function () {
			var myIterator = ... some iterator for a sequence of values or rows ...
			return myIterator;
		};
	};

## Group / Window

A Series where each value in the series is itself another Series or DataFrame. Think of it as a sequence of groups. This concept is used by the multiple Data-Forge functions that create groups and windows, for example `groupBy`, `window` and `rollingWindow`.


text:
---
type: rule
title: Numbers - Do you use numbers digits instead of words?
uri: use-digits-instead-of-words
authors:
  - title: Adam Cogan
    url: https://www.ssw.com.au/people/adam-cogan
related:
  - make-numbers-more-readable
redirects:
  - do-you-use-words-instead-of-digits-for-low-numbers
  - use-words-instead-of-digits-for-low-numbers
created: 2016-04-21T05:57:12.000Z
archivedreason: null
guid: cacddfdb-8ee8-4322-b4db-db071702b258

---

Whenever writing numbers, it's generally a good idea to use numerals, especially for complicated numbers. Numerals are more easily noticed when a page is scanned by a user's eye.

For example:

<!--endintro-->

::: greybox
There are seventy three good reasons to do this.
:::
::: bad
Figure: Bad example - The number is spelled out
:::

::: greybox
There are 73 good reasons to do this.
:::
::: good
Figure: Good example - This is easier to read and more noticeable
:::

::: info
Certain editorial guidelines suggest using numerals for numbers 10 and above, while numbers 9 and below should be written out. However, when it comes to web content, we generally prefer using numerals regardless.
:::

gha_language: TSQL


text:
# ThingWorx Examples #

This document describes the example application provided with the [ThingWorx library](../README.md).

## DataSender Example ##

This example creates a ThingWorx Thing named `test_thing` (if it does not exist already) with two predefined Properties:

- *data* — An integer value, converted to string, which starts at 1 and increases by 1 with every update. It restarts from 1 every time the example is restarted.
- *measure_time* — An integer value, which is the time in seconds since the epoch.

The application updates the Properties values every 10 seconds.

## Setup and Run ##

### ThingWorx Evaluation Server Configuration ###

- Login to the [ThingWorx Developer Portal](https://developer.thingworx.com/login) in your web browser.
- Click the **Evaluation Server** icon in the top right corner. **Note** The initial provisioning of Evaluation Server for a new account usually takes between 3-5 minutes.
- Copy the **Hostname** value from the pop-up and paste it into a plain text document or equivalent. This will be used as the value of the *THING_WORX_ENDPOINT* constant in the imp agent code:
![LaunchThingWorx](../png/LaunchThingWorx.png?raw=true)
- Click **Launch**. You will be redirected to the ThingWorx Composer page (usually a new browser tab)
- In the **ThingWorx Composer** page’s **Home** tab, click **+** under **Application Keys** in the **SECURITY** section:
![AddAppKey](../png/AddAppKey.png?raw=true)
- Enter any Application Key **Name**, eg. `testAppKey`.
- Click **Search** in the **User Name Reference** field under **General Information**, and choose the **Administrator** user:
![AppKeyUser](../png/AppKeyUser.png?raw=true)
- Choose a date and time for **Expiration Date** field.
- Click **Done** then click **Save**:
![AppKeyExpirationDate](../png/AppKeyExpirationDate.png?raw=true)
- On the **General Information** page select and copy the **keyId** field and paste into a plain text document or equivalent. This will be used as the value of the *THING_WORX_APPLICATION_KEY* constant in the imp agent code:
![AppKeyId](../png/AppKeyId.png?raw=true)

### Setting Up and Running the Application ###

- In [Electric Imp’s impCentral™](https://impcentral.electricimp.com) create a Product and Development Device Group.
- Assign a development device to the newly created Device Group.
- Open the code editor for the newly created Device Group.
- Copy the [DataSender source code](./DataSender.agent.nut) and paste it into the code editor as the agent code.
- Set the *THING_WORX_ENDPOINT* constant in the agent example code to the value of Evaluation Server Hostname you retrieved and saved above. Ensure it is prefixed with `https://`. The value should look like `"https://PP-1802281448E8.Devportal.Ptc.Io"`.
- Set the *THING_WORX_APPLICATION_KEY* constant in the agent example code to the value of the Application Key ID you retrieved and saved above:
![SetThingWorxConsts](../png/SetThingWorxConsts.png?raw=true)
- Click **Build and Force Restart**.
- Use the code editor’s log pane to confirm that data is being sent successfully:
![DataSenderLogs](../png/DataSenderLogs.png?raw=true)

### Notes ###

- The hosted ThingWorx Evaluation Server is stopped after three hours of inactivity and, typically, it takes about one minute to start it again.
- You need to ensure the Server is started before running the example. To start the Server:
    - Click the **Evaluation Server** icon in the top right corner of the ThingWorx Developer Portal.
    - Check the Server status in the pop-up. If it is **Stopped**, click **Start**.

### Monitor the Properties Values in ThingWorx ###

- In the **ThingWorx Composer** page’s **Home** tab, click **Things** in the **MODELING** section.
- Click *test_thing* in the **Things** table:
![ThingsTable](../png/Things.png?raw=true)
- In the **test_thing** tab, click **Properties** in the **ENTITY INFORMATION** section.
- Ensure the Properties table contains **data** and **measure_time** Properties, and that their values are updated periodically if **Values** column’s refresh button is clicked:
![ThingProperties](../png/ThingProperties.png?raw=true)

repository: ragrus-nbl/ThingWorx

repo_name: ragrus-nbl/ThingWorx


text:
# redis-php
Simple php implementation of Redis for data caching.

Redis is an open source (BSD licensed), in-memory data structure store, used as a database, cache and message broker.
[More details...](https://redis.io/)

repository: IsraelGboluwaga/redis-php

repo_name: IsraelGboluwaga/redis-php


text:
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tfp.mcmc" />
<meta itemprop="path" content="Stable" />
</div>

# Module: tfp.mcmc

TensorFlow Probability MCMC python package.

## Classes

[`class HamiltonianMonteCarlo`](../tfp/mcmc/HamiltonianMonteCarlo.md): Runs one step of Hamiltonian Monte Carlo.

[`class MetropolisAdjustedLangevinAlgorithm`](../tfp/mcmc/MetropolisAdjustedLangevinAlgorithm.md): Runs one step of Metropolis-adjusted Langevin algorithm.

[`class MetropolisHastings`](../tfp/mcmc/MetropolisHastings.md): Runs one step of the Metropolis-Hastings algorithm.

[`class RandomWalkMetropolis`](../tfp/mcmc/RandomWalkMetropolis.md): Runs one step of the RWM algorithm with symmetric proposal.

[`class ReplicaExchangeMC`](../tfp/mcmc/ReplicaExchangeMC.md): Runs one step of the Replica Exchange Monte Carlo.

[`class SliceSampler`](../tfp/mcmc/SliceSampler.md): Runs one step of the slice sampler using a hit and run approach.

[`class TransformedTransitionKernel`](../tfp/mcmc/TransformedTransitionKernel.md): TransformedTransitionKernel applies a bijector to the MCMC's state space.

[`class TransitionKernel`](../tfp/mcmc/TransitionKernel.md): Base class for all MCMC `TransitionKernel`s.

[`class UncalibratedHamiltonianMonteCarlo`](../tfp/mcmc/UncalibratedHamiltonianMonteCarlo.md): Runs one step of Uncalibrated Hamiltonian Monte Carlo.

[`class UncalibratedLangevin`](../tfp/mcmc/UncalibratedLangevin.md): Runs one step of Uncalibrated Langevin discretized diffusion.

[`class UncalibratedRandomWalk`](../tfp/mcmc/UncalibratedRandomWalk.md): Generate proposal for the Random Walk Metropolis algorithm.

## Functions

[`default_exchange_proposed_fn(...)`](../tfp/mcmc/default_exchange_proposed_fn.md): Default exchange proposal function, for replica exchange MC.

[`effective_sample_size(...)`](../tfp/mcmc/effective_sample_size.md): Estimate a lower bound on effective sample size for each independent chain.

[`make_simple_step_size_update_policy(...)`](../tfp/mcmc/make_simple_step_size_update_policy.md): Create a function implementing a step-size update policy.

[`potential_scale_reduction(...)`](../tfp/mcmc/potential_scale_reduction.md): Gelman and Rubin (1992)'s potential scale reduction for chain convergence.

[`random_walk_normal_fn(...)`](../tfp/mcmc/random_walk_normal_fn.md): Returns a callable that adds a random normal perturbation to the input.

[`random_walk_uniform_fn(...)`](../tfp/mcmc/random_walk_uniform_fn.md): Returns a callable that adds a random uniform perturbation to the input.

[`sample_annealed_importance_chain(...)`](../tfp/mcmc/sample_annealed_importance_chain.md): Runs annealed importance sampling (AIS) to estimate normalizing constants.

[`sample_chain(...)`](../tfp/mcmc/sample_chain.md): Implements Markov chain Monte Carlo via repeated `TransitionKernel` steps.

[`sample_halton_sequence(...)`](../tfp/mcmc/sample_halton_sequence.md): Returns a sample from the `dim` dimensional Halton sequence.

repository: matthew-mcateer/probability

repo_name: matthew-mcateer/probability


text:
### Introduction

These documents describe provisioning a server and deploying the application to that server. Once your local machine
is setup with the proper tools and credentials, this all can be done with less than a handful of commands and in under 15
minutes (most of which is time waiting for the code to run).

1. [Requirements](requirements.md) - shows you how to set up your local machine for privisioning.
2. [Provisioning](provisioning.md) - shows you how to do a provisioning.
3. [Setup](setup.md) - shows you how to setup a provisioned server.
4. [Deploy](deploy.md) - shows you how to deploy the application.

repository: shimada-toy-box/babywearing

repo_name: shimada-toy-box/babywearing


text:
---
title: "Getting Truffle and Ganache Working with Docker"
date: "2022-03-09"
tags:
  - "web3"
  - "docker"
  - "tutorial"
slug: "getting-truffle-and-ganache-working-with-docker"
heroImage<EMAIL_ADDRESS>unsplash: "Jessica Loaiza"
unsplashURL: "jessicaloaizar"
description: "I recently had an issue installing Truffle locally on my computer. There was an issue with my version of Node.js or NPM... Instead of messing up or polluting my global NPM installs further, I took to Docker to get Truffle and Ganache working for me. This post details that journey."
---

We have been experimenting on how to introduce [web3](https://en.wikipedia.org/wiki/Web3) at work.
After using [hardhat](https://hardhat.org/) for all of the [Buildspace](https://buildspace.so/) classes, I thought exploring [Truffle](https://trufflesuite.com/docs/truffle/) and [Ganache](https://trufflesuite.com/docs/ganache/) would be interesting for comparison.
Unfortunately, not everything worked out-of-the-box for me.
And it lead me to try to get a working Truffle/Ganache setup using Docker.

## Understanding the Technology

That introduction used a lot of terms that you might not be familiar with.
You also might not know what in the world _web3_ is.
If so, this section is for you.
If the introduction did not sound like Greek to you, feel free to skip this section and go directly to the [problem statement](#the-problem).

### web3 & Ethereum

Web3 is an iteration of web development based on blockchain technology.
The hopes of this iteration is to decentralize data throughout the web and establish a more universal, accessible economy. [1](https://en.wikipedia.org/wiki/Web3)
The two largest blockchain technologies today is Bitcoin and Ethereum.
Ethereum is the blockchain which the libraries mentioned above use.

Ethereum is a decentralized, open-source blockchain technology that has built-in smart contract capability. [2](https://en.wikipedia.org/wiki/Ethereum)
The ability for smart contracts is what makes Ethereum so attractive to developers.
This attractiveness is why there is so much tooling around these contracts.

### Solidity

Solidity is a programming language that one uses to write smart contracts. This is the language that is used when you initialize a project with either Hardhat or Truffle.
Even though Solidity was first developed to work with the Ethereum blockchain, it has since expanded to work with different blockchains.
This fact makes it useful to learn if you want to dive into smart contract development.

### Hardhat

Hardhat is an NPM package that creates a development environment to compile, deploy, test, and debug your Ethereum software. [3](https://hardhat.org/getting-started/)
This is the most popular tool to develop Ethereum smart contracts.

### Truffle

Truffle is another NPM package.
It is a development environment, testing framework and asset pipeline for blockchains using the Ethereum Virtual Machine.
[4](https://trufflesuite.com/docs/truffle/)
Very much like Hardhat, Truffle makes contract development smoother.

### Ganache

Ganache is the third NPM package listed here.
It is a personal blockchain for Ethereum distributed application development. [5](https://trufflesuite.com/docs/ganache/)
This allows you to deploy your smart contracts locally and saves you from testing on the real blockchains.
It's the first time that I have explored running my own blockchain.
I usually just use the testnets, but this was a nice alternative.
And I can see using this going forward.

## The Problem

I had issues installing Truffle globally on my computer. (Which is the preferred method per their documentation.)
There seems to be an issue with Truffle and the latest version of NPM; which seems to have been around for [a while](https://github.com/trufflesuite/truffle/issues/1616).
I could not get Truffle to install locally without messing with my global Node.js install.
 System Darwin 18.7.0
npm ERR! gyp ERR! command "/nodejs/16.3.0/bin/node" "/nodejs/16.3.0/.npm/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd /nodejs/16.3.0/.npm/lib/node_modules/truffle/node_modules/ganache/node_modules/leveldown
npm ERR! gyp ERR! node -v v16.3.0
npm ERR! gyp ERR! node-gyp -v v8.4.1
npm ERR! gyp ERR! not ok

```

I am not a huge fan of installing things globally, especially when it does not work with the latest version of Node.js or NPM.
Luckily, we have tools to help us in these situations.

## Docker

Docker has been around for a while.
But in case you are unfamiliar, Docker is a set of tools that facilitates OS-level virtualization.<sup>[6](<https://en.wikipedia.org/wiki/Docker_(software)>)</sup>
These tools will allow us to containerize the Truffle and Ganache setup removing the need of global installation.
It's a win-win.
The Docker container we build can be used anywhere, and we no longer need to worry about the version of Node.js we have installed on our computer.

If you do not have Docker installed on your machine yet, go [here](https://docs.docker.com/get-docker/).
It's beyond the scope of this post, but the linked directions should be pretty straight forward.
But once installed, let's clone my init example where we will keep the code we need for Docker.
Run the following commands to set up this directory:

```bash
$ git clone https://github.com/joshfinnie/truffle-init-example.git <PATH>
$ cd <PATH>
$ touch Dockerfile
$ touch docker-compose.yml
```

This will give you the default files we will need to get Truffle and Ganache installed in a Docker container.
It's a bit odd, but I had to figure out how to get the default Truffle folder structure without installing it globally.
This [repo](https://github.com/joshfinnie/truffle-init-example) was generated for this post and gives you the default folders and files a `truffle init` will do.
Give it a ⭐ if you find it helpful!

### Dockerfile

Below is the code for the Dockerfile.
We'll go into some depth asto what's going on here.

```docker
FROM node:16-bullseye-slim as base

RUN apt-get update && \
    apt-get install --no-install-recommends -y \
        build-essential \
        python3 && \
    rm -fr /var/lib/apt/lists/* && \
    rm -rf /etc/apt/sources.list.d/*

RUN npm install --global --quiet npm truffle ganache

FROM base as truffle

RUN mkdir -p /home/app
WORKDIR /home/app

COPY package.json /home/app
COPY package-lock.json /home/app

RUN npm install --quiet

COPY truffle-config.js /home/app
COPY contracts /home/app/contracts
COPY migrations /home/app/migrations/
COPY test /home/app/test/

CMD ["truffle", "version"]

FROM base as ganache

RUN mkdir -p /home
WORKDIR /home
EXPOSE 8545

ENTRYPOINT ["ganache", "--host <IP_ADDRESS>"]
```

The first block of code I will breakdown is the code that builds our "base" container.
I have long ago adopted [multi-stage builds](https://docs.docker.com/develop/develop-images/multistage-build/) as a way to optimize my Dockerfiles, and feel like this is the ideal reason why.
Having a "base" container allows us to make sure the default `node:16-bullseye-slim` Docker image is up-to-date and has all our required packages installed.

```docker
FROM node:16-bullseye-slim as base

RUN apt-get update && \
    apt-get install --no-install-recommends -y \
        build-essential \
        python3 && \
    rm -fr /var/lib/apt/lists/* && \
    rm -rf /etc/apt/sources.list.d/*

RUN npm install --global --quiet npm truffle ganache

```

We install `build-essenials` and `python3` from the Debian package manager.
These are dependencies for Truffle.
And we install `truffle` and `ganache` using NPM.

Taking from our created "base" image, we then buildout our truffle container.

```docker
FROM base as truffle

RUN mkdir -p /home/app
WORKDIR /home/app

COPY package.json /home/app
COPY package-lock.json /home/app

RUN npm install --quiet

COPY truffle-config.js /home/app
COPY contracts /home/app/contracts
COPY migrations /home/app/migrations/
COPY test /home/app/test/

CMD ["truffle", "version"]
```

We create a working directory, copy our `package.json` file, and install the required packages.
We then copy over the rest of the files needed to run the Truffle project.
Lastly calling `truffle version` to spit out our version of Truffle installed.
**Note** This command would be doing something more exciting here, but for this blog post, that is all we're doing.

Lastly, we build out our Ganache container.
This one is a tad less complex due to Ganache being a tool that runs in the background.

```docker
FROM base as ganache

RUN mkdir -p /home
WORKDIR /home
EXPOSE 8545

ENTRYPOINT ["ganache-cli", "--host <IP_ADDRESS>"]
```

In this container, we again take from the "base" container, expose the default Ganache port of `8545` and run it.
**Note** we use the `--host` flag here to change the default host from <IP_ADDRESS> to <IP_ADDRESS>.

### docker-compose.yml

Below is the [Docker Compose](https://docs.docker.com/compose/) file.
Even though you don't need a Compose file, I find them easier to deal with and love to include them.
There's something satisfying about running `docker compose up` and having your entire system running within Docker.

```yaml
version: "3.4"
services:
  truffle:
    build:
      context: .
      target: truffle
    depends_on:
      - ganache
    networks:
      - backend
    volumes:
      - .:/home/app
      - /home/app/node_modules
  ganache:
    build:
      context: .
      target: ganache
    ports:
      - 8545:8545
    networks:
      - backend
networks:
  backend:
    driver: "bridge"
```

## Conclusion

I hope this post helps anyone struggling to install Truffle locally.
I never understood the reasoning NPM libraries needing global installation.
Hardhat fixes this by using `npx` and I would love to see Truffle move to this paradigm.
It would make using it much easier in my mind.
But it would also require them to fix this issue with the latest version of Node.js.
If anyone knows of another way to fix this, feel free to chat with me on [Twitter](https://twitter.com/joshfinnie).

## Also might enjoy

- [Using Latex Through Docker](/blog/latex-through-docker)
- [My Basic Python Dockerfile](/blog/basic-python-dockerfile)

gha_language: MDX