Social network all’italiana

Come tutti sappiamo la politica italiana ha sempre considerato l’informatica un dettaglio, per non dire un fastidio. Lo Stato non ci ha mai investito, se non a livello di rete dove più che investimenti abbiamo visto sprechi e regali. I privati (che in buona parte succhiano soldi allo Stato) non hanno fatto molto meglio.

Nella patria del body rental non ha senso sperare che qualcuno parli di IT in modo ragionevole, da questo assunto la minchiata del giorno è “chiediamo i documenti a chi si registra ai social network”.

Invece di preoccuparsi che:

  • I sistemi operativi (Microsoft, Apple, Google)
  • I social network (Facebook, Twitter, Instragram)
  • Le piattaforme email (Gmail, Outlook, Yahoo, AOL)
  • Il Cloud (Amazon, Google, Microsoft, Apple)
  • L’e-commerce (Amazon)

Tutto questo sia “made di USA”… di cosa si preoccupa la politica italiana? Di chiedere i documenti a chi si registra ad un “social network”!

C’è poi da capire cosa si intenda con social network? Io che ho un merdoso blog che consente i commenti, dovrei chiedere i documenti?

Facebook (e tutti gli altri soggetti interessati) dovrebbero integrarsi con tutte le anagrafi del pianeta? Oppure questo obbligo varrebbe solo per chi si connette da un IP di un provider italiano? In questo caso, uno che usa TOR o qualsiasi altra VPN è esentato? E uno straniero che vive in Italia come dovrebbe fare? Lo Stato Italiano garantirebbe un documento Francese o Brasiliano?

A me pare che sia una cazzata, utile giusto a occupare spazio sui giornale per non parlare di cose serie.

Create Windows bootable USB with macOS

If you need to create a Windows 10 installation USB key using a macOS, you can use these commands to do it simply.
This procedure deletes all data from the USB stick, so be careful 🙂

Open Terminal and use the following commands

diskutil list
diskutil eraseDisk MS-DOS "WIN10" GPT <USB disk>
hdiutil mount <path to the Windows 10 ISO file>
cp -rp /Volumes/<ISO mounting point> /Volumes/WIN10
hdiutil unmount /Volumes/<ISO mounting point>
hdiutil unmount /Volumes/WIN10

About autonomous driving

In these days I’m driving an Infiniti Q30, I find it very pretty and even if it has the wrong wheel drive, it can be fun too 🙂

One of the things I like best about this machine is electronic stuff. One of the driving aids I noticed is the autonomous reading of the road signs. I found the thing interesting also because I immediately looked at it from the standpoint of autonomous driving. Right about this context yesterday I noticed something that I did not like. Passing behind a tourist bus I noticed that the car read as a speed limit, as reported by the heavy vehicle that preceded me in a sticker that reported its maximum speed on the highway. In the picture you can see little because I was driving and I took it at a run. However, you can guess what happens: the car signals me as a speed limit of 80 km / h (instead of the 50 real ones) because the coach in front has a sticker that indicates its maximum speed on the highway in 80 km / h.

I noticed this behavior on several occasions between yesterday and today.

Today this is not a big problem, I guide and I know the limits and I know what directions to follow. But if she were driving, wouldn’t it be too easy to deceive her? And in the case of autonomous driving, any fines, who should pay them? Who was in the car? No, he wasn’t driving! The owner? No, he didn’t even drive! The manufacturer of the vehicle? Who hadn’t passed a patch in time?

I leave you with these doubts and with the invitation to use the right pedal until we can do it 🙂

Wait for an event in a WaterfallDialog

Working on a Skill, I needed to block the execution of a WaterfallDialog while waiting for a specific event to arrive.
The solution is simple and based on the use of EventPrompt. Below I show how to use it.

Register EventPrompt in the constructor

AddDialog(new WaterfallDialog(nameof(WaterfallDialog), new WaterfallStep[]
{
	HelloAsync,
	WaitForEventAsync,
	DoneAsync
}));

AddDialog(new EventPrompt(nameof(EventPrompt), "SampleEvent", Validate));

InitialDialogId = nameof(WaterfallDialog);

Implement the three dialog steps

private async Task<DialogTurnResult> HelloAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken)
{
	await stepContext.Context.SendActivityAsync(MessageFactory.Text("Hello :)"), cancellationToken);

	return await stepContext.NextAsync(cancellationToken);
}

private async Task<DialogTurnResult> WaitForEventAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken)
{
	return await stepContext.PromptAsync(nameof(EventPrompt), new PromptOptions { Prompt = MessageFactory.Text("Waiting for the event") });
}

private async Task<DialogTurnResult> DoneAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken)
{
	await stepContext.Context.SendActivityAsync(MessageFactory.Text("After I receive the event."), cancellationToken);

	return await stepContext.NextAsync(cancellationToken);
}

Implement the event validator

async Task<bool> Validate(PromptValidatorContext<Activity> promptContext, CancellationToken cancellationToken)
{
	var activity = promptContext.Recognized.Value;
	if (activity.Type == ActivityTypes.Event)
	{
		try
		{
			string eventValue = (string)activity.Value;
			
			if(eventValue == "OK")
			{
				return true;
			}
		}
		catch { }
	}

	return false;
}