Skip to main content

Posts

First Twitch Stream

Inspired by what Jeff Fritz ( https://www.twitch.tv/csharpfritz ) said on .net rocks ( https://www.dotnetrocks.com/?show=1575 ), I decided to try doing a very small F# tutorial using Twitch: https://www.twitch.tv/videos/716521139

How to debug workflow console projects in Visual Studio 2019 using Designer Breakpoints

I ran into an issue with debugging a Workflow Foundation workflow by using breakpoints in the designer in Visual Studio 2019. The breakpoints in the designer were not being hit when running the console workflow program in debug mode.  A question posted by another member of the community at https://developercommunity.visualstudio.com/content/problem/846593/not-able-to-debug-windows-workflow-designer.html led me to another link at https://docs.microsoft.com/en-us/dotnet/framework/migration-guide/retargeting/4.7.2-4.8#windows-workflow-foundation-wf .  In that last page, at the bottom, under the "Workflow XAML checksums for symbols changed from SHA1 to SHA256", I found the piece of configuration code to add to my app.config file in the console workflow VS project. The following is the full configuration of my project that allowed VS to pause at the designer breakpoints: <?xml version="1.0" encoding="utf-8" ?> <configuration>     <startup>   ...

Previously trusted client certificate not longer trusted by IIS

I was getting the following error from iSS when testing locally a web api that requires ssl client certificates: 403.16  The client certificate used for this request is not trusted by the Web server One way to troubleshoot is to use the certutil tool that comes with Windows. There is a verify switch that you can use to verify the public portion of the client certificate: certutil -f -urlfetch -verify "public client cert.cer" The tool will show any errors encountered when validating the cert, such as a failure to lookup the revocation list (CRL) of the issuer. You can also capture the details of the client certificate, like the subject name, issuer and serial number, by adding custom fields to your IIS log. Instructions are here and the fields are under "Server Variables".  The specific issue I was having, however, is described in the answer to  https://stackoverflow.com/questions/26247462/http-error-403-16-client-certificate-trust-issue  . I had a Trusted Root cert...

Power Automate: SFTP action "Test connection failed"

When I added an SFTP create file action to my Power Automate flow ( https://flow.microsoft.com ) , I got the following error in the action step, within the designer: "Test connection failed" To troubleshoot the Power Automate connection, I had to: go the Power Automate portal then "Data"->"Connections"  the sftp connection was there, I clicked on the ellipsis, and entered the connection info It turns out, that screen provides more details about the connection error. In my case, it was complaining that "SSH host key finger-print xxx format is not supported. It must be in 'MD5' format". I had provided the sha fingerprint that WinScp shows. Instead, I needed to use the MD5 version of the fingerprint. To get that, I had to run in command line (I was in a folder that had openssh in it): ssh -o FingerprintHash=md5 mysftpsite.com To get the fingerprint in MD5 format. I took the string (without the "MD5:" part of the string) and put ...

Windows Workflows Foundation in Azure Functions

Unfortunately, I have not been able to make the CoreWf library ( https://github.com/UiPath-Open/corewf ) run on an Azure v2 or v3 functions. Something about the Azure function runtime not able to fins the dependencies like System.Xaml or System.CodeDom. However, Azure v1 functions (which run on .net 4.6.1) have no problems running a Workflow created using the Workflow Designer in Visual Studio. A sample of such function is in  https://github.com/jptarqu/WorkflowForCorePlayground/tree/master/src/AzureSamples  .  I did run into an issue creating from Visual Studio the Function App Service with runtime version of "1". I was seeing "runtime: error" in the portal's overview page for the app service. To work around that issue, I created the function app service inside the Azure Portal and then changed it to version 1 inside the portal (the default is v3 and you cannot change it until the App Service is created).

Workflows using CoreWF in .net core

Workflow Foundation is a great tool when designing workflows for .net. Unfortunately, just like WCF, that technology is not going to be ported to .net core. However, a company named UI Path ( https://www.uipath.com/ )  that heavily relies on Windows Workflow Foundation, has started an unofficial port to .net ( https://github.com/UiPath-Open/corewf ). In order to see how compatible would be the the new port with the current Windows Workflow for simple workflows, I created a playground project at   https://github.com/jptarqu/WorkflowForCorePlayground  . The Visual Studio solution contains two projects: WorkflowForCorePlayground  : a VB.net Windows Workflow project created using the VS template for .net 4.8.  CoreWfSample  : a .net core console app that runs a cleaned version of the same xaml that project #1 has. The idea is to explore the possibility of still having business users design the workflow using the regular .net framework 4.8 beautif...

Inexpensive, Non-realtime Sites using Queues

A lot of the sites for small and medium businesses rely on dynamic engines (such as ASP.NET, PHP, etc) to generate most of the content at run-time. This kind of typical setup requires expensive hosting (relative to a small and medium size company) and (if not designed properly) may not perform very well. I would like to argue that most of those sites could be served with static HTML pages generated offline at different time intervals (either fixed or on-demand intervals, discussed later) and a Javascript Client front end that communicates with a slim server side service whose only job is to store commands from visitors into a queue. The queue can then be read and processed by non-hosted computers, freeing the business from having to pay extra hosting fees for application server. The costs are reduced by the following: Static HTML sites mean less power required. Queue storages are usually cheaper services than full SQL Databases. A slim service that just relays the commands fr...

R Cookbook

The R Cookbook by  Paul Teetor ( O'Reilly Media) aims and succeeds in introducing programmers to the technical aspects of the R language. R is a programming language designed for Statistical work, therefore it might not share too much ground with other typical languages like Python or C. The R Cookbook gives a tour to programmers to this wonderful language, from the very screen output beginnings, through ploting, to the creation of statistical models and Time Series. The author does a great job exposing the differences and similarities of R to other languages. For example, the author, explains how in R the single brackets applied to a vector (myvector[1]) mean "give me a vector of one item from myvector", he then explains that the correct way to get a single item is myvector[1]. Comparisons to other languages like SQL are dispersed through the chapters. Mr. Teetor provides a throughout explanation of other aspects of R that might not be common in other computer lang...

List to ICollection AutoMapper and WebAPI problem

I was getting an exception from Automapper when it tried to map a List to an ICollection . The problem was that WebApi was building the MyClass from the xml sent by the client and instead of using a List for the ICollection property, it used a plain array. When Automapper tried to map the List to the Array, it failed because even though Arrays are ICollections, they do not support some of the ICollection operations, such as Add.  To solve the problem, I used Json in the client side when posting. After that, webapi chose to use List instead of an Array when the data came as Json.

Cryptic message when serializing Computed Observable to JSON

If you have an error in one of your computed observable in Knockout.js, the toJson function will set the value of that property to a cryptic script snipped when serializing it to JSON. For example: var SortField = function (expression) { this .FieldDef = ko.observable( null ); this .SortOrder = ko.observable( "" ); this .ExpressionType = "SortField" ; this .Label = ko.computed( function () { return this . FieldDef () == null ? "" : this . FieldDef ().Label + ' ' + this .SortOrder(); }, this ); } var FieldDefinition = function (table_name, field_name, table_alias) { this .TableName = table_name; this .TableAlias = ko.observable(table_alias); this .FieldName = field_name; this .Label = ko.computed( function () { return this .TableAlias() + '⇨' + field_name; }, this ); In this example SortField’s Label function ...

Compile Postgres in Windows with GSSAPI

Configuration Phase Install the 64 bit versions of OpenSSL and MIT Kerberos Get the professional version of Visual Studio 2010 or 2012. Open the 64Bit of the Visual Studio Command Prompt (not the 32 bit version) cd to src\tools\msvc in the folder that contains Postgres’ source code Change the config_default.pl: add these lines: includes => 'C:\\Program Files\\MIT\\Kerberos\\include:C:\\OpenSSL-Win64\\include', libraries => 'C:\\Program Files\\MIT\\Kerberos\\lib\\amd64:C:\\OpenSSL-Win64\\lib', after  “iconv   => undef,” change the krb5 and ssl lines to: krb5    => 'C:\\Program Files (x86)\\MIT\\Kerberos',    # --with-krb5= openssl => 'C:\\OpenSSL-Win64',    # --with-ssl= Build Phase in the vs command prompt, type Build When done, if no errors, then type Install C:\PathWhereYouWanToInstallPostgres Go to the folder where OpenSSL is installed Search in the folder and subfolders for libeay32 and ssleay.dll a...

How to use Windows SSO with OpenXava

One of the nice things about the .NET web environment is the dead easy way to implement Single Sign On in your web apps through Active Directory authentication. In the Java world there are multiple alternatives to use Windows’ Single Sign On with Java based web apps. One of those alternatives is Waffle . Waffle allows your Java web app to authenticate against Active Directory groups (and users). The only caveat is that your web server needs to be running in Windows, which kind of makes sense. In this article, you will learn the steps required to have your OpenXava web application use Waffle to authenticate your Windows users. The first step is to download Waffle from their site and then copy the JAR files outlined in https://github.com/dblock/waffle/blob/master/Docs/tomcat/TomcatSingleSignOnValve.md to the OpenXava’s tomcat server. In your OpenXava project, create servlets.xml in the Web-inf, containing the following: <!-- the role name (the domain gorup) must be e...

Data Science for Business by Foster Provost & Tom Fawcett O’Reilly Media

Data Science for Business is a book that makes a phenomenal job teaching the fundamental concepts of Data Science (a.k.a. Data Analysis and Data Mining). Foster Provost and Tom Fawcett explain in plain English, clear examples and beginner-level math the processes surrounding Data Science and the basics of its algorithms. The authors go over the various steps of the CRISP method using situations found in the real world such as Customer Churn and Online Advertising. The most common data analysis models are reviewed and explained in detail such as Clustering, Decision Trees and Support Vector Machines. Extensive explanation is given to the difference between supervised and unsupervised methods. Even if you use software tools that create those models, this book will help you understand how to use/test them correctly and how to avoid over-fitting. Multiple examples are given in each chapter and most of the math is visually aided with graphs. The authors explain step by step any eq...

How to make MS SQL integrated security work in Spoon

How to make Micorsoft SQL Server's integrated security (SSPI) work in Spoon: Download the MS SQL JDBC sql drivers Copy enu\auth\x64\sqljdbc_auth.dll to {spoon installtion folder}\libswt\win64 Copy enu\auth\x64\sqljdbc_auth.dll  to {spoon installtion folder}\libswt\win32 Copy C:\sqljdbc_4.0\enu\sqljdbc4.jar to {spoon installtion folder}\libext\JDBC Open Spoon When creating the data source, make sure to check "Use integrated authentication" Please note that you are copying the 64 bit version of sqljdbc_auth.dll to both \libswt\win64 and \libswt\win32 if you have a 64 bit processor.

Alert if file missing using Powershell

The following Powershell script can be used to send an email alert when a file is missing from a folder or it is the same file from a previous check: $path_mask = "yourfile_*.txt" $previous_file_store = "lastfileread.txt" $script_name = "File Check" ###### Functions ########## Function EMailLog($subject, $message) {    $emailTo = "juanito@yourserver.com"    $emailFrom = "alert@yourserver.com"    $smtpserver="smtp.yourserver.com"       $smtp=new-object Net.Mail.SmtpClient($smtpServer)    $smtp.Send($emailFrom, $emailTo, $subject, $message) } Try {    #get files that match the mask    $curr_file = dir $path_mask |  select name    if ($curr_file.count -gt 0)    {        #file found        #check if the file is differe...

Thoughts on how to prevent Abortions

I would like to first set the scope of this article; this is about abortions in cases where the couple had consensual sex and there is no life-or-death health risk to the pregnant mother. In regards to cases of rape or life-or-death risks to the mother, I think it is best for a panel of women (both pro-choice and pro-life) to discuss it. The panel should include people who have gone through those situations and who have taken either direction. No man (pro-choice or pro-life) should be included in that panel and meetings. I also want to clarify before we being that I am pro life in that I believe life begins as soon as the baby starts forming in the womb. Having set the scope of this article, it is important to address the fact that it is very important to point out that when a baby is conceived, the couple is pregnant  not just the mother. The responsibility falls to both the man and the woman. Paying child sup...

How to easily import data from SQL Server into PostgreSQL

I was looking for an ETL software similar to SSIS that would allow me to easily move data from SQL Server to PostgreSQL. I tried using SSIS, but I was never able to make BIDS generated the schema of the destination table automatically like it would do with a SQL server destination table. I downloaded Pentaho’s Spoon data integrator and it surpised how easy it was to do it there. The designer is somewhat similar to BIDS. You drop your input tables (from SQL Server) and then you drop your destination tables (PostgreSQL tables). The good thing is that you do not need to create the tables in PostgreSQL beforehand. You just need to create the destination database. When you open the properties of the Table Output, you can enter the name of the new table and then do the following to create the table based on the data input: Click “Database Fields” Click “SQL” Click “Execute” That’s it. Your table will be created in PostgreSQL using the correct data types. Pentaho’s Spoo...

Authenticate OpenXava users with ActiveDirectory

The following allows you to use JNDIRealm 's LDAP authentication to authenticate users of OpenXava application with Active Directory. The users will be prompt to enter their windows credentials, when entering the usernames they need to avoid entering the domain name; they just need to enter the username. If you have multiple Active Directory domains to authenticate against, you can use  org.apache.catalina.realm.CombinedRealm to allow Tomcat to search on both. In the web.xml you will need to specify the security-constraint setting. This will force the user to authenticate when they reach any OpenXava module. in role-name, you have to enter the Windows Group name of that is allow to access the application. If you need finer restrictions, you can use OpenXava's Users.getCurrent() to get the username of the current user in your Java code. For example, you could have a validation logic to prevent a certain user from creating a new record. Please note that you must use a ...

A Solution to the Marriage Dilemma

In the midst of the raging battle between those who want to legalize homosexual marriages and those who oppose it, a solution could be implemented that would fit the goals of both sides. The problem with the traditional marriage constitutional amendment is that it asks the Government for the wrong thing. Asking the Government to define marriage as one man and one woman is a huge mistake because it takes away that power from religion and puts that power in a Government that is already taking too much power. It is extremely important for the survival of the Church that the government stays away from her . If we let the Government take that power,  not only would break the first amendment, but it also would teach future Christians generations that it does not matter what the Bible says what marriage is, all it matters is what the Government says it is. The definition of marriage belongs to culture and religion and it should stay there.  Instead, I would like to propose the...

Construct2: surpassing GameMaker and Multimedia Fusion

I a few years ago, I posted an article about why I preferred GameMaker over Multimedia Fusion. A lot has happened since then, Clickteam released many exporters for MMF (Flash, IOS and others) and YoYo Games have made HTML5 gaming GameMaker’s new target. Another product has been in the works too, Scirra produced Construct2 as a HTML5 game maker. Just like I reached my conclusion back then through spending time on GameMaker, I have come to the conclusion that Scirra’s Construct2 is a very worthy contender to both by spending some time using it and writing plugins for it. Construct2’s main target is HTML5 gaming, however, it is straight forward to create exporters for it and I am actually working on a XNA exporter for it. I have also created plugins that allow Construct2 games to create simple 3D games (WebGL via Copperlicht), online multiplayer games (through websockets) and isometric games (through a Z sorter plugin).   Construct2 enjoys an easy-to-use event-driven inter...