F# code to fetch a registry key
42 people like thisPosted: 14 years ago by Tuomas Hietanen
Timestamp: Time format in ISO 8601 with timezone. YYYYMMDDhhmmssffff+zzzz For example 2011-05-17 19:01:10.000 -0200 would be: 20110517190110000-0200
5 people like thisPosted: 13 years ago by Tuomas Hietanen
Silverlight default architecture is Model-View-ViewModel. This code gives full design time support for Microsoft Expression Blend. The F# ViewModel is seen as strongly typed data source in the Blend UI. There are two properties binded to the view: HiLabel (OneWay data binding) and MyName (TwoWay data binding). ViewModel implements the INotifyPropertyChanged to support the binding. The view project (HelloApp) is made with Blend (by designers) and it is Silverlight 5.0 project. The view codebehind is c# file and it has only this.DataContext -assignment. The viewmodel project (HelloApp.ViewModel) is F# Silverlight 4.0 library. It is made with VS2010 and F# (by developers). It contains the logical functionality of the current view.
5 people like thisPosted: 13 years ago by Tuomas Hietanen
This program reads all *.csproj-files from a path and then uses Linq2Xml to show data about the projects. This should be a good template for scripts to manage tons of c#-project files. F# and LINQ-to-XML is very powerful combination.
9 people like thisPosted: 13 years ago by Tuomas Hietanen
Team Foundation Server (TFS): Check Out a file.
3 people like thisPosted: 12 years ago by Tuomas Hietanen
You can use numeric literals, constant expressions and operator overloading to make your own arithmetics. Useful in DSL languages. With NumericLiterals, you can use any of Q, R, Z, I, N, G. Basic syntax: [Number][Letter] will forward the call to the type NumericLiteral[Letter] to FromInt32 [Number] (or FromInt64 or FromString...)
9 people like thisPosted: 12 years ago by Tuomas Hietanen
Simple Computational expressions / monad / builder -example, using .NET Nullable as demo.
3 people like thisPosted: 12 years ago by Tuomas Hietanen
Agent that can upgrade its functionality on the fly. (F# MailboxProcessor containing function in the loop...)
5 people like thisPosted: 11 years ago by Tuomas Hietanen
Log file parser for log4Net files
3 people like thisPosted: 11 years ago by Tuomas Hietanen
String.notNullOrEmpty extension to strings
2 people like thisPosted: 10 years ago by Tuomas Hietanen
For tutorial, the same functionality, different styles of pattern matching.
4 people like thisPosted: 10 years ago by Tuomas Hietanen
Small quiz-game with World Bank TypeProvider (from FSharp.Data Nuget-package): Which country has the capital city of (random capital)? (Three options)
3 people like thisPosted: 10 years ago by Tuomas Hietanen
Analyse word count from files. You can use it e.g. to create Tag Clouds
3 people like thisPosted: 10 years ago by Tuomas Hietanen
With the usual Western music it is common to use the Equal temperament: http://en.wikipedia.org/wiki/Equal_temperament http://hyperphysics.phy-astr.gsu.edu/hbase/music/et.html Then the note frequencies are calculated by this formula. For more information: http://en.wikipedia.org/wiki/Pitch_(music) http://en.wikipedia.org/wiki/Musical_tuning#Tuning_systems
2 people like thisPosted: 10 years ago by Tuomas Hietanen
Querying NuGet package manager via OData TypeProvider
3 people like thisPosted: 9 years ago by Tuomas Hietanen
One script to create MS-SQL-database and host OWIN Web-server with SignalR-clients
1 people like thisPosted: 9 years ago by Tuomas Hietanen
F# lambda (quotation) to C# Expression
Posted: 9 years ago by Tuomas Hietanen
Calculate MD5 hash that can be used when interacting with a PHP-website. Note: MD5 has been cracked and shouldn't be used in new systems.
5 people like thisPosted: 8 years ago by Tuomas Hietanen
Calculate distance between two GPS latitude-longitude points.
3 people like thisPosted: 8 years ago by Tuomas Hietanen
1) Create TransactionScope, on Mono and in .NET, and the later one supports TransactionScopeAsyncFlowOption. 2) Then, complete the transaction automatically if no exceptions has been thrown. If Async or Task, then automatically await the result before complete without blocking the thread.
3 people like thisPosted: 8 years ago by Tuomas Hietanen
Fetch EUR based currency rates of the day.
1 people like thisPosted: 8 years ago by Tuomas Hietanen
This is more generic variant of http://www.fssnip.net/c4 if you want to memoize over different functions / code paths that calls the same to-be-cached-code.
7 people like thisPosted: 8 years ago by Tuomas Hietanen
This is variant of http://www.fssnip.net/sA that is having a time-out. You may want to use this if you e.g. cache a database query result or other mutable data source.
3 people like thisPosted: 8 years ago by Tuomas Hietanen
Using FSharp.Data
2 people like thisPosted: 7 years ago by Tuomas Hietanen
This example uses the same data and methods as http://accord-framework.net/docs/html/T_Accord_Statistics_Models_Regression_LogisticRegression.htm
8 people like thisPosted: 7 years ago by Tuomas Hietanen
Function to get all possible combinations of list items. There are some Euler problems (like 77 & 78) to get total amounts. But e.g. for some card game implementations you will need the real items.
4 people like thisPosted: 7 years ago by Tuomas Hietanen
Wine-quality decision-tree using machine-learning tool Accord.Net with F#
1 people like thisPosted: 7 years ago by Tuomas Hietanen
More parallel calculating alternative option for ``mine to correct`` for http://www.fssnip.net/7RY/title/Using-NBitcoin-to-create-private-BlockChain-with-F-FSharp
0 people like thisPosted: 7 years ago by Tuomas Hietanen
FTPS = SSL encrypted FTP. SFTP = FTP over SSH.
9 people like thisPosted: 7 years ago by Tuomas Hietanen
Async.Start with timeout in seconds
3 people like thisPosted: 6 years ago by Tuomas Hietanen
Sometimes mailboxprocessor may corrupt on errors and the state is not clear. Sometimes you don't care about the existing queue, but you want to have always a processor listening.
1 people like thisPosted: 6 years ago by Tuomas Hietanen
Bitcoin transfers. I'm not responsible if your money gets lost. Have fun!
2 people like thisPosted: 5 years ago by Tuomas Hietanen
Converting F# LINQ queries to SQL: - Basic example of simple group-by - Also if you want to have multiple aggregates (SUM, COUNT, MAX, MIN, AVG, ...) in the same SQL-clause, that is done with groupBy over a constant value.
2 people like thisPosted: 5 years ago by Tuomas Hietanen
In Windows you can press WindowsKey & dot to open Emoji menu.
8 people like thisPosted: 4 years ago by Tuomas Hietanen
There is a namespace System.Runtime.Serialization.Json To serialize generic object you can do like this...
3 people like thisPosted: 3 years ago by Tuomas Hietanen
This F# code decrypts an encrypted string using Rijndael symmetric encryption algorithm. It uses key and initialization vector stored in a registry key.
2 people like thisPosted: 2 years ago by Tuomas Hietanen
Find binding-redirects with linq-to-xml from a .config file. This might be useful for then parsing config-changes e.g. by System.Linq.Enumerable.Except
4 people like thisPosted: 1 year ago by Tuomas Hietanen
Making QR-code image having contact information (VCard) with Google Chart API. If you scan this image with mobile phone, you can directly add new person to your contacts.
7 people like thisPosted: 6 months ago by Tuomas Hietanen
Get Stock Quote Data and Historical Stock Prices from Yahoo Finance.
237 people like thisPosted: 13 years ago by Tuomas Hietanen
Generates SHA512 hash code from a string. Usually used in some kind of validity checks, e.g. check first timestamp and then check SHA-hash over id and timestamp to ensure a valid session.
4 people like thisPosted: 13 years ago by Tuomas Hietanen
You can use this code to make a async WebRequest from Silverlight to update ViewModel.
5 people like thisPosted: 13 years ago by Tuomas Hietanen
Subject is a class that implements both IObservable<'T> and IObserver<'T>
6 people like thisPosted: 13 years ago by Tuomas Hietanen
This program reads all *.csproj-files from a path and then uses Linq2Xml to show or modify data about the projects. This should be a good template for scripts to manage tons of c#-project files. F# and LINQ-to-XML is very powerful combination.
7 people like thisPosted: 12 years ago by Tuomas Hietanen
A small sample how to use F# 3.0 Entity Framework (EF) Type Provider. Visual Studio 11 Beta (and Northwind sample database) needed.
5 people like thisPosted: 12 years ago by Tuomas Hietanen
In mathematics, the Fibonacci numbers or Fibonacci series or Fibonacci sequence are the numbers in the following integer sequence: [0; 1; 1; 2; 3; 5; 8; 13; 21; 34; 55; 89; 144; 233; 377; ...] http://en.wikipedia.org/wiki/Fibonacci_number
5 people like thisPosted: 12 years ago by Tuomas Hietanen
File parsing, based on multiple lines, using recursive pattern matching with many :: (cons) operator
2 people like thisPosted: 11 years ago by Tuomas Hietanen
Actors with control actor. No mutable state.
3 people like thisPosted: 11 years ago by Tuomas Hietanen
Using task based async, won't block the thread.
2 people like thisPosted: 10 years ago by Tuomas Hietanen
For tutorial, example how to use option type.
3 people like thisPosted: 10 years ago by Tuomas Hietanen
Using Azure Table Storage with WindowsAzure.Storage
3 people like thisPosted: 10 years ago by Tuomas Hietanen
Microsoft Kinect Body Basics with Kinect SDK 2.0 and F-Sharp
7 people like thisPosted: 10 years ago by Tuomas Hietanen
Idea from Guy L. Steele - Organizing Functional Code for Parallel Execution; or, foldl and foldr Considered Slightly Harmful - https://vimeo.com/6624203
9 people like thisPosted: 9 years ago by Tuomas Hietanen
Getting started with Akka.NET
7 people like thisPosted: 9 years ago by Tuomas Hietanen
To avoid too huge lists when doing recursion, SQL-IN-clauses, etc... Use the F# core version: chunkBySize
2 people like thisPosted: 9 years ago by Tuomas Hietanen
Simple OWIN Self-Host web-server with static files support and request deflate/gzip compression.
3 people like thisPosted: 8 years ago by Tuomas Hietanen
Get local IPv4-address of the computer
1 people like thisPosted: 8 years ago by Tuomas Hietanen
Quite similar to http://www.fssnip.net/eg but authentication, html-messages and async sending.
4 people like thisPosted: 8 years ago by Tuomas Hietanen
Counter part for http://www.fssnip.net/1n
4 people like thisPosted: 8 years ago by Tuomas Hietanen
Correct and Incorrect Way to Use ConcurrentDictionary
8 people like thisPosted: 8 years ago by Tuomas Hietanen
Generate rss news feed from a list of F# record items using Linq2Xml. To use e.g. to generate feeds from your web server.
2 people like thisPosted: 8 years ago by Tuomas Hietanen
How you can programmatically use GraphViz from F#.
8 people like thisPosted: 8 years ago by Tuomas Hietanen
This is just an initial example / tech-demo.
4 people like thisPosted: 7 years ago by Tuomas Hietanen
Example follows this, translated to FSharp: https://msdn.microsoft.com/en-us/library/dn903708.aspx Just instead of copy&pasting C#, add a new F# class library and paste this code to there, then add that to reference to your C#-project.
3 people like thisPosted: 7 years ago by Tuomas Hietanen
GitHub has a public JsonApi to expose file download count.
0 people like thisPosted: 7 years ago by Tuomas Hietanen
In statistics, one of the standard ways to calculate an estimate/estimation quality, to be able to compare how good are different estimates.
1 people like thisPosted: 7 years ago by Tuomas Hietanen
SFTP with SSH.Net
4 people like thisPosted: 7 years ago by Tuomas Hietanen
Emailage email fraud detection query, using https://www.emailage.com/ Supports emails and IPs.
0 people like thisPosted: 6 years ago by Tuomas Hietanen
Bit like http://www.fssnip.net/a7 but send as async.
3 people like thisPosted: 6 years ago by Tuomas Hietanen
Identify user's browser, Os and device by the browser's UserAgent string.
3 people like thisPosted: 5 years ago by Tuomas Hietanen
As described in https://en.wikipedia.org/wiki/Harshad_number
1 people like thisPosted: 5 years ago by Tuomas Hietanen
A simple expression tree visitor, to inject a lambda inside another lambda parameters.
4 people like thisPosted: 5 years ago by Tuomas Hietanen
Initial example of using PKCS#11 from F#
1 people like thisPosted: 4 years ago by Tuomas Hietanen
PGP F# with PGPCore https://blog.bitscry.com/2018/07/05/pgp-encryption-and-decryption-in-c/
0 people like thisPosted: 2 years ago by Tuomas Hietanen
Generate random hex-string and calculate base58encode. I made these for some initial BTC-testing, but didn't test too much... seems to work, but would need some unit-tests... :-) Feel free to update or add new versions.
7 people like thisPosted: 2 years ago by Tuomas Hietanen
High-performance JSON parsing with System.Text.Json and F#
1 people like thisPosted: 1 year ago by Tuomas Hietanen
Just use the concat
0 people like thisPosted: 10 days ago by Tuomas Hietanen