The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My work

  • My badges

  • Twitter Updates

  • My Flickr Stream

    20140508-Delphi-2007--Project-Options--Cannot-Edit-Application-Title-HelpFile-Icon-Theming

    20140430-Fiddler-Filter-Actions-Button-Run-Filterset-now

    20140424-Windows-7-free-disk-space

    More Photos
  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,677 other followers

Archive for the ‘Development’ Category

Consensus systems (Zookepper, etcd, consul) – what are they?

Posted by jpluimers on 2016/12/06

A while ago,  wrote these very nice G+ posts

The English text is about a year older, but the German text Google Translates pretty well.

The most important points in ot for me were these:

  • Consensus systems are distribute systems, so take at least the P (partitioned) from the CAP theorem.
  • In addidtion, Consensus systems also chose the C (consistent) from the CAP theorem.
  • Since in CAP you can only pick 2 out of 3, the A (available) isn’t guaranteed on Consensus systems.
  • Only three systems get this right: Zookeeper, etcd, Consul. All others shred data eventually.
  • Leader election algorithms Paxos and Raft.
  • Cluster a.k.a. Ensemble provide a consistent view of the data no matter to what member of the Cluster/Ensemble you talk to
  • The (set of) connection(s) from a client to the Cluster/Ensemble is called session
  • Cluster/Ensemble operations are on a tree with nodes that can have atomic operations on them
  • Nodes can be persistent or ephemeral (temporal)
  • All nodes can have data (keep it small enough ~4kilobyte max)
  • Directories in the tree are usually persistent; leaf nodes often ephemeral
  • Useful operations: load balancing, queueing, data availability
  • There are transactions so you can make atomic operations larger. Don’t make them too long.
  • Consistency takes time; expect at max ~1000s of write operations per second
  • Not being available is a feature (it means it still is P and C, just not reachable right now)
  • Clients must cope with the Cluster/Ensemble being temporarily being read-only or unavailable
  • Applications should always re-create any persistent nodes they create (just in case – during non availability – from one consistent phase to another consistent phase) a persistent node is no more.

Some more keywords and links from the article:

–jeroen

Posted in Development, Distributed Computing, Software Development | Leave a Comment »

How do I embed multiple sizes in an .ico file? – Super User

Posted by jpluimers on 2016/12/06

Scripts are soooo coool.

I remember doing similar things in Windows, but couldn’t find the batch files any more. There is an example (thanks Rob W for answering, thanks Suchipi for asking) that works in Mac/Linux:

ImageMagick (Windows/Mac/Linux) contains a command-line tool called convert that can be used for many things, including packing multiple images in one icon:

convert 16.png 32.png 48.png 128.png 256.png -colors 256 icon.ico

The previous command takes 5 PNG images, and combines them into a single .ico file.

Unlike the other answers, this method can easily be used in batch scripts to automatically generate several icon files. In one of my projects, I have a single vector image (SVG), and use Inkscape to generate png’s of various sizes, followed by convert to create a icon container. This is a reduced example (in a bash script):

#!/bin/bash
for size in 16 32 48 128 256; do
    inkscape -z -e $size.png -w $size -h $size icon.svg >/dev/null 2>/dev/null
done
convert 16.png 32.png 48.png 128.png 256.png -colors 256 icon.ico

–jeroen

via:

Posted in bash, Development, Scripting, Software Development | Leave a Comment »

C13/C14 wiring diagram live/neutral/earth

Posted by jpluimers on 2016/12/02

Thanks Simon Carter for this info:

C14 (male; left) and C13 (female; right)

C14 (male; left) and C13 (female; right)

Viewing a socket (line or chassis) from the front, i.e. the side that the plug fits into, the connections are:

  • Left Pin: Neutral
  • Centre Pin: Earth
  • Right Pin: Live

Source: Electronics 2000 | Pin-outs | IEC Connectors

If you wire it, the colours depend on where you live. I live in the Netherlands so this shortened table does apply:

IEC (most of Europe) AC power circuit wiring color codes.

Function label Color, IEC Color, old IEC
Protective earth PE green-yellow green-yellow
Neutral N blue blue
Line, single phase L brown brown or black

Longer tables and infographics are here:

–jeroen

Posted in Development, Electronics Development, LifeHacker, Power User | Leave a Comment »

Adding staged updates to SourceTree | SourceTree Blog

Posted by jpluimers on 2016/12/01

My experience is that early upgrades are very unstable and they take an eternity to fix bugs, I need to find a way to push myself from the early stage to the late stage.

[WayBackAdding staged updates to SourceTree | SourceTree Blog

–jeroen

Read the rest of this entry »

Posted in Development, DVCS - Distributed Version Control, git, Mercurial/Hg, Source Code Management, SourceTree | Leave a Comment »

WinSCP can be embedded and scripted as can PSFTP but not FileZilla

Posted by jpluimers on 2016/12/01

In a quest to perform SFTP in Delphi next to FTP, I first researched what I was up against. A tiny voice in the back of my head said “SFTP is totally unlike FTP” and it was right: SFTP means SSH File Transfer Protocol, not Simple File Transfer Protocol nor FTP over SSH nor FTP over SSL aka FTPS – the latter is supported by Indy but the former isn’t.

I decided against SecureBlackBox (providing SFTPBlackbox) and IPWorks (SSH) as I tried both a while ago for S/MIME support and was disappointed about both the lack of features and documentation; in the end I went for wrapping OpenSSL for the “encrypt-then-sign” process and Indy for the SSMTP part. The merger of the SecureBlackBox and IPWorks made me even less happy.

The Chilkat alternative for SFTP isn’t too compelling either: ActiveX or DLL black-box without a lot of insight on how many people do use it.

So when I had to do SFTP and knew there are no free or open source SFTP components for Delphi available I opted for thinking outside the Delphi realm.

My basic idea was to embed either of these:

  1. Filezilla (as Filezilla on Windows is waaaay faster than WinSCP)
  2. WinSCP (a Windows SCP and SFTP client written in C++ Builder)
  3. PSFTP (the Putty SFTP client)

FileZilla

FileZilla internally uses FzSFtp.exe which is based on PSFTP code (but with some buffers making it faster than PSFTP or WinSCP).

According to the author, neither FzSFtp.exe nor FileZilla can be automated:

FileZilla cannot make any automated transfers at all. Neither FileZilla.exe nor fzsftp.exe (is for SFTP) can be used for any batch processing.

Source: run filezilla tzsftp from batch command line – FileZilla Forums

The WinSCP author commented in a similar fashion:

FileZilla does not have any command line arguments (nor any other way) that allow automatic transfer.

Source: windows – Command line option to download file in FileZilla – Stack Overflow

In addition, FileZilla is always a GUI program, so running it as a console app (which I’d prefer) would be impossible.

WinSCP

WinSCP can be automated in two ways:

  1. The WinSCP.exe command-line allows for a /console and /script switch enabling scripting mode that you can use for Scripting and Task Automation :: WinSCP
  2. A wrapper around WinSCP.exe is availble as WinSCP .NET Assembly and COM Library :: WinSCP which requires both .NET to be installed and (from Delphi) calling through COM which I don’t like much

Since I already had good Delphi wrapping code round starting/waiting-for running processes, I’d opt for using WinSCP.com scripting.

There used to be wrapping code around: Use with Delphi :: Support Forum :: WinSCP

PSFTP

These Using PSFTP to transfer files securely links should get me going:

Chapter 6: Using PSFTP to transfer files securely

Practical examples:

Source locations

For my own reference, the open source locations:

Some semi-random Delphi SSL related postss

During the search above I found the below links that will be useful to me one day:

–jeroen

Posted in .NET, Delphi, Development, Software Development, SSH, TCP | 5 Comments »

 
%d bloggers like this: