# Monday, 16 July 2018
# Sunday, 15 July 2018

TheJungleBrace yourself before reading Upton Sinclair's the The Jungle.

The Jungle tells the story of European immigrants lured to Chicago with promises of high-paying jobs in the meat packing industry. The promises of a good life turn out to be false - particularly for the family of Lithuanian immigrant Jurgis Rudkus. Jurgis arrives believing that he can handle the hard work and provide for his new wife and his extended family. He is strong and hard-working, and he quickly finds a job in the local stockyards.

But they have entered a world where the entire system conspires to keep down the poor. Wages are reduced downward and workers are not paid for time lost.

Even time lost to injury or illness.

Even injury or illness caused by unsafe and unsanitary working conditions, which is the norm in Chicago's meatpacking industry.

A dishonest realtor tricks the family into buying a home with hidden costs and his entire family must go to work to make ends meet. The meat trust exploits them all by keeping them in in unsafe and unhealthy conditions. Foremen, policemen, businessmen, judges, and politicians are all corrupt and use their power to prey on the powerless.

As time passes, the family falls farther into debt and deeper into despair. Some die, some are maimed, some are arrested, some are blacklisted by all the local companies, one is raped with impunity by her boss, and one disappears without a trace. Despite their best efforts, their fate seems almost inescapable. They work hard and play by society's rules but are cast aside anyway. Before long, the hope and optimism with which they arrived slips away.

Sinclair was a devout socialist and concludes the novel with a pitch for socialism as a cure for the dangers of unchecked capitalism. It's interesting to read this today over a hundred years after its publication and with the perspective of history. Socialism never took over the US and has produced mixed results in those nations where it was adopted.

But the novel did have an impact on society - mostly by calling attention to the unsanitary products sold by the meat packers. This led to increased regulation and the formation of what would become the Food and Drug Administration.

The preaching about socialism in the last few pages makes the ending feel a bit weak, but the story is a powerful one and I could not help but feel for the heartbreak experienced by Jurgis and his family. The reader feels both sympathy and outrage at the injustices they suffer.  There is a reason why this novel is considered an American classic.

Sunday, 15 July 2018 22:54:53 (GMT Daylight Time, UTC+01:00)
# Thursday, 12 July 2018

GCast 6:

Azure SQL Database

How to create an Azure SQL database in the Azure portal.

Thursday, 12 July 2018 09:16:00 (GMT Daylight Time, UTC+01:00)
# Tuesday, 10 July 2018

I needed to convert a bunch of PDF files with pictures into image files.

I volunteered to create a slideshow for a family reunion and and one cousin sent me dozens of PDFs, which don't play nice with my editing software.

After playing around with several online converters, I settled on PDFtoPNG.

You don't need to install anything to use this tool.

Open a browser and navigate to https://pdftopng.online/

The start page shown in Fig 1 is  pretty intuitive.

P2P01-StartPage
Fig 1

Click the large green [Choose File] button to open a "File Open" dialog, as shown in Fig. 2.

P2P02-SelectPdf
Fig 2

Select a file and click [Open]. You can only convert one file at a time, but each file takes only a few seconds.

A "Converting file" message (Fig 3) displays, while the system does its thing.

P2P03-Converting
Fig 3

When the conversion process is complete, a [Download] button displays, as shown in Fig 4.

P2P04-Done
Fig 4

Click this button to save your newly-created PNG file to disc. If the PDF file contains multiple images, a ZIP file containing all the images is created.

Using this tool, I was able to quickly convert dozens of PDFs to PNG files and add them to my slideshow. It was simple, free, and I did not need to install or uninstall any software.

Photos | Tech
Tuesday, 10 July 2018 17:10:56 (GMT Daylight Time, UTC+01:00)
# Monday, 09 July 2018
Monday, 09 July 2018 09:38:00 (GMT Daylight Time, UTC+01:00)
# Thursday, 05 July 2018

GCast 5:

Azure Databricks

Learn how to create a free library and Jupyter notebooks hosted in Azure.

Thursday, 05 July 2018 09:43:00 (GMT Daylight Time, UTC+01:00)
# Monday, 02 July 2018
Monday, 02 July 2018 09:35:00 (GMT Daylight Time, UTC+01:00)
# Sunday, 01 July 2018

7/1
Today I am grateful for:
-My first pair of prescription eyeglasses
-A visit yesterday to the Chicago Women's Park and Gardens

6/30
Today I am grateful for my first visit to IKEA.

6/29
Today I am grateful to David for taking time yesterday to answer all my questions.

6/28
Today I am grateful that I can binge-watch TV shows on demand.

6/27
Today I am grateful to hear Laretha Weathersby and the JW Williams Blues Band at Blue Chicago last night on my first visit to the venue.

6/26
Today I am grateful for a conversation with a financial adviser yesterday.

6/25
Today I am grateful to attend the Chicago Food Truck Festival yesterday.

6/24
Today I am grateful to the organizers of #BeerCityCode for an excellent conference.

6/23
Today I am grateful for:
-Drinks with J. Tower at Founder's last night
-The hospitality of Chris and Tracy last night

6/22
Today I am grateful for a nice Italian dinner with friends last night to celebrate the end of the school year.

6/21
Today I am grateful
-to go to an optometrist yesterday after years of neglect
-to go to the Art Institute of Chicago for the first time this year.

6/20
Today I am grateful to celebrate Father's Day last night with my son Tim.

6/19
Today I am grateful to spend a night in my own bed.

6/18
Today I am grateful for a week in Norway - my first visit to this country.

6/17
Today, I am grateful for:
-a walk around Bergen, Norway
-a visit to 2 art museums
-a chance to try some exotic Norwegian foods

6/16
Today I am grateful for a train ride across Norway and a boat ride through the fjords.

6/15
Today I am grateful for my first time speaking at and attending NDC-Oslo.

6/14
Today I am grateful for the #ndcoslo after-party.

6/13
Today I am grateful for a boat ride around Oslo.

6/12
Today I am grateful to work on a Machine Learning project this week with a train company in Oslo.

6/11
Today I am grateful for BBQ in Norway with Jimmy, Adam, and Dominick.

6/10
Today I am grateful for a few days in Romania

6/9
Today I am grateful to play Dungeons & Dragons in Transylvania.

6/8
Today I am grateful for another excellent #itcamp

6/7
Today I am grateful to Dan for picking me up at the CLJ airport and driving me to my hotel late last night.

6/6
Today I am grateful for free wine on European airlines.

6/5
Today I am grateful to finish a bunch of blog posts and screencasts yesterday.

6/4
Today I am grateful for dinner with Tim last night and to Adam and his daughter for stopping by.

Sunday, 01 July 2018 15:10:52 (GMT Daylight Time, UTC+01:00)
# Saturday, 30 June 2018

DarknessAtSethanonA Darkness at Sethanon concludes Raymond Feist's Riftwar Saga - a trilogy that became a tetralogy when Feist decided to rewrite volume 1, splitting it into 2 books.

An invasion by the dark sorcerer Murmandamus threatens the world of Midkemia and ultimately all other worlds in the Riftwar universe. Murmandamus is determined to capture the city of Sethanon and the powerful lifestone buried beneath it. Our heroes from the previous novels (Pug, Tomas, Arutha, and others) gather the knowledge, weapons, and allies they need to try to defeat Murmandamus.

There are twists. Characters we thought dead are found alive, former foes become allies, and Murmandamus's motivation is not what it seems.

This book is larger in scope than its predecessor as the characters travel across dimensions and even travel backwards in time to the beginning of their universe. The time travel sequence gives the characters and the reader insights into the history of the universe and its many sentient and magical races.

Feist is better at action than at character development. Not that the characters are bad - it's just that he jumps them ahead abruptly, rather than letting us watch them mature and otherwise change. And this book has plenty of action, including several large battle scenes.

I'm glad I stuck with this series, as it got better as it went along.

Saturday, 30 June 2018 16:55:28 (GMT Daylight Time, UTC+01:00)
# Friday, 29 June 2018

The .NET framework provides the FtpWebRequest class to assist you in managing FTP commands.

A common use of this class is to upload a file to an FTP site.

To do this in C#, we create an FtpWebRequest object (the WebRequest object has a static factory method to do this) on the object, set our intended method, and specify the FTP site's login credentials, as shown below.

string ftpUrl = @"ftp://blah.ftp.blah.com";
ftpUrl = ConfigurationManager.AppSettings["ftpUri"];
string userName = ConfigurationManager.AppSettings["userName"];
string password = ConfigurationManager.AppSettings["password"];

string ftpDestinationFolder = "site/wwwroot/content/Giard";
string localFolderSource = @"C:\Test\_source";
string fileName = "testfile.txt";

string sourcePath = @"C:\Test\_source\testfile.txt";
string destinationPath = @"ftp://blah.ftp.blah.com/folder1/testfile.txt";

FtpWebRequest request = (FtpWebRequest)WebRequest.Create(destinationPath);
request.Method = WebRequestMethods.Ftp.UploadFile;
  

A common mistake is to set only the site and folder name (and skip the filename) in the destinationPath.

To send a file via FTP, we need to read the file from disk and convert it into a Stream.

byte[] fileContents;
using (StreamReader sourceStream = new StreamReader(sourcePath))
{
	fileContents = Encoding.UTF8.GetBytes(sourceStream.ReadToEnd());
}
  

We then write this StreamReader to the FTP request object

request.ContentLength = fileContents.Length;
using (Stream requestStream = request.GetRequestStream())
{
	requestStream.Write(fileContents, 0, fileContents.Length);
}
  

Finally, we retrieve the FTP response.

using (FtpWebResponse response = (FtpWebResponse)request.GetResponse())
{
	var responseText = response.StatusDescription;
	Console.WriteLine("Completed uploading file {0}!", fileName);
	Console.WriteLine("Status={0}", responseText);
}
  

The full code of my console app is here:

using System;
using System.Configuration;
using System.IO;
using System.Net;
using System.Text;

namespace DemoFtp
{
    class Program
    {
        static void Main(string[] args)
        {
            string ftpUrl = @"ftp://blah.ftp.blah.com";
            // Note: I stored some values in app.config
            // I had to set a reference to System.Configuration to read these values
            ftpUrl = ConfigurationManager.AppSettings["ftpUri"];
            string userName = ConfigurationManager.AppSettings["userName"];
            string password = ConfigurationManager.AppSettings["password"];

            string ftpDestinationFolder = "site/wwwroot/content/Giard";
            string localFolderSource = @"C:\Test\_source";
            string fileName = "testfile.txt";

            string sourcePath = Path.Combine(localFolderSource, fileName);
            string destinationPath = Path.Combine(ftpUrl, ftpDestinationFolder, fileName);

            FtpWebRequest request = (FtpWebRequest)WebRequest.Create(destinationPath);
            request.Method = WebRequestMethods.Ftp.UploadFile;

            request.Credentials = new NetworkCredential(userName, password);

            byte[] fileContents;
            using (StreamReader sourceStream = new StreamReader(sourcePath))
            {
                fileContents = Encoding.UTF8.GetBytes(sourceStream.ReadToEnd());
            }

            request.ContentLength = fileContents.Length;
            using (Stream requestStream = request.GetRequestStream())
            {
                requestStream.Write(fileContents, 0, fileContents.Length);
            }

            using (FtpWebResponse response = (FtpWebResponse)request.GetResponse())
            {
                var responseText = response.StatusDescription;
                Console.WriteLine("Completed uploading file {0}!", fileName);
                Console.WriteLine("Status={0}", responseText);
            }

            Console.ReadLine();
        }
    }
}
  

You can find this console app in my github repository at https://github.com/DavidGiard/Demo-FTP-CSharp

.Net | C# | Web
Friday, 29 June 2018 07:38:00 (GMT Daylight Time, UTC+01:00)