One of the pleasures in life is mentoring another developer, particularly when the other developer is smart and motivated to learn. This article, on populating a tree from a collection of paths, was the result of some weekend prep work and is a good case study on refactoring. By going through the process myself and documenting it, I was able to present the problem in general terms, and the person I was mentoring did the heavy mental lifting with only occasional guidance on my part. This worked because I was prepared — had I not done this prep work, I would have taken away from my mentee’s experience to actually solving the problem himself.
Well, that was a “first!” — Two articles:
Understanding Merkle Trees
Full Duplex Asynchronous Read/Write with Named Piped
have won first place in Code Project‘s monthly article competition in the categories of “Best Everything Else” and “Best C# Article” for the month of March 2017.
And as always, with great appreciation to the amazing people @codeproject who have made Code Project possible!
Six lines (not including imports) of Python code to scrape the website onthisday.com for the “persons of interest.” Impressive!
pip install lxml
pip install cssselect
pip install requests
The Python code:
from lxml import html
from lxml.cssselect import CSSSelector
from lxml import etree
page = requests.get("http://www.onthisday.com/birthdays/august/19")
tree = html.fromstring(page.content)
sel = CSSSelector('.section--person-of-interest')
pois = sel(tree)
for poi in pois:
The results (for my birthday):
'1871 Orville Wright, aviator (Wright Brothers), born in Dayton, Ohio (d. 1912)'
'1878 Manuel Luis Quezon y Molina, Second President of the Philippines (1935-42), born in Baler, Aurora, Philippines (d. 1944)'
'1919 Malcolm Forbes, American publisher of Forbes Magazine, born in Brooklyn, New York (d. 1990)'
'1946 Bill Clinton [William Jefferson], 42nd US President (Democrat, 1993-2001), born in Hope, Arkansas'
'1967 Satya Nadella, Indian-American businessman (CEO of Microsoft), born in Hyderabad'
From Code Project:
If it walks like a duck, and quacks like a duck, it’s probably gonna throw exceptions at runtime. – Mladen Janković
I’ve posted a new article on Code Project, explaining Merkle trees and providing an interactive demo of how audit and consistency proofs work. Read all about it!
Move aside IDE’s (Integrated Developer Environment) – it’s time for the new kid on the block, the Integrated Developer Experience!
Ok, so the acronym is already taken (Internet Data Exchange, Indonesia Stock Exchange, and probably others) but I’m co-opting it for how to talk about FlowSharpCode. I’m actually surprised “Integrated Developer Experience” isn’t used somewhere already. Maybe my google-fu is not up to snuff right now.
I’ve added some select DRAKON shapes for creating flowcharts. The Python code in the lower right editor is generated from the flowchart, and the output from the run is shown on the left.
PyLint is also now integrated into FlowSharpCode’s PythonCompilerService. This really improves the development process as many syntactical errors are detected before even running the code.
Also, the code generator creates an execution tree which independent of the language syntax, which means that support for other languages is easily added. Now granted, the code itself in each of the DRAKON shapes is Python code, but I have some ideas of how to make that code agnostic as well.