Background images and multiple styles in rst2pdf

Over the weekend I released rst2pdf 0.99. The list of changes is quite long as it’s been over a year since the last release.

There are some key things in this release that I’m particularly pleased about including Python 3.9 and 3.10 & Sphinx 4 support, multiple styles in the class directive and the ability to specify background images in the raw:: pdf directive. There’s also a number of bug fixes, particular to math rendering and errors.

I use rst2pdf to write the slides for talks that I give, so going to use background images and multiple styles in class a lot!

Background images

It’s not uncommon that I want a background image on a slide for a title page. Prior to 0.99, I would do this in presentation.rst:

.. raw:: pdf

PageBreak docsTitlePage

.. class:: title

Docs

with a page template defined in style.yaml:

pageTemplates:
docsTitlePage:
background: backgrounds/books.jpg
frames:
– [2%, 0%, 96%, 70%]
showFooter: true
showHeader: false

For every different background image, I have do define a new page template in my style file isn’t great.

With rst2pdf 0.99, I can specify the image in the PageBreak directive:

.. raw:: pdf

PageBreak titlePage background=backgrounds/books.jpg

.. class:: title

Docs

Now, just one page template is required for all my title pages.

Multiple styles in the class directive

Another situation I sometimes have is when I want to apply more than one style modifier to some text.

For example, rendering multiple paragraphs that need to be aligned differently with different colours. Previously, I would generate a new style for each combination:

centred-highlight:
alignment: TA_CENTER
textColor: green

left-highlight:
alignment: TA_LEFT
textColor: green

right-highlight:
alignment: TA_RIGHT
textColor: green

centred-lowlight:
alignment: TA_CENTER
textColor: darkgreen

left-lowlight:
alignment: TA_LEFT
textColor: darkgreen

right-lowlight:
alignment: TA_RIGHT
textColor: darkgreen

and so on, depending on which combinations are needed.

I can then use like this in my rst file:

.. class:: right-highlight

Text goes here.

.. class:: left-lowlight

Text goes here.

With rst2pdf 0.99, we can now specify more than one style in the class directive, so we can separate the styles:

centred:
alignment: TA_CENTER
left:
alignment: TA_LEFT
right:
alignment: TA_RIGHT
highlight:
textColor: green
lowlight:
textColor: darkgreen

and then apply them appropriately:

.. class:: right highlight

Text goes here.

.. class:: left lowlight

Text goes here.

Hopefully, this will make my style file that much clearer and easier to understand!

Try it out

With rst2pdf 0.99 we are getting very close now to 1.0 now and I’d love to see some people kick the tyres and see if it works for them. Restructured Text is a good markup format for documentation and is easy to publish to the web and PDF. Try it out and report any issues you find on GitHub.

.NET Foundation Established to Foster Open Development

At the Build 2014 conference today, Microsoft Corp. announced it is creating an independent .NET Foundation to foster open development and collaboration around the growing collection of open source technologies for .NET. It will serve as a forum for commercial and community developers alike to strengthen the future of the .NET ecosystem by promoting openness, community participation and rapid innovation.

Technology leader Xamarin also announced its support (blog/press release) for the .NET Foundation today. Microsoft will encourage further feedback and direct participation of the community so .NET continues to evolve to meet the changing needs of its broad customer base including enterprises, partners, individual developers and open source communities. As a first step, the .NET Foundation welcomes feedback on how best to frame the organization for those building .NET applications across the diverse world of connected devices and services.

The .NET Foundation will start with 24 .NET open source projects under its stewardship. Some of the more noteworthy projects that will be hosted by the .NET Foundation include the newly announced.NET Compiler Platform (“Roslyn”) as well as the ASP.NET family of open source projects, both open sourced by Microsoft Open Technologies, Inc. (MS Open Tech). Xamarin will contribute six of its projects including its open source email libraries: MimeKit and MailKit.

Many of the .NET developer technologies are already open source for areas such as Web apps, cloud apps, services and partner cross platform apps. In addition, the .NET Foundation includes new open source offerings that augment the existing .NET open source ecosystem such as the newly announced .NET Compiler Platform (“Roslyn”). These projects will be actively developed and fully supported by MS Open Tech, while their addition to the .NET Foundation will increase the level of transparency and community contributions.

For two years, the community has provided feedback to the ASP.NET Web developer tools including ASP.NET MVC, Web API, Web Pages (aka Razor), and Entity Framework open sourced by Microsoft. Developers outside Microsoft are continually monitoring the code on CodePlex, and providing feedback on code check-ins, bug fixes, and new feature development.

As S. Somasegar, Corporate Vice President of Microsoft Corp. Developer Division said, “The formation of an independent .NET Foundation with the open source community is one more way for us to support the collaborative and inventive spirit we see from developers. We’ve already seen how opening the development process to the community, in ASP.NET for example, has allowed .NET to innovate faster.”

“The .NET Foundation will help accelerate the adoption of .NET across every platform and computing form factor—servers, mobile devices and desktops,” said Miguel de Icaza, cofounder and CTO of Xamarin, and founding member of the .NET Foundation board. “We look forward to working with Microsoft and the entire .NET developer community to increase the rate of innovation.”

“We’re seeing the value and innovation being realized by our customers when the broader development community collaborates on our developer tools,” said Jay Schmelzer, partner director program manager

of .NET for the Microsoft Developer Division. “The .NET Foundation will support the long-term optimization of .NET for enterprise scenarios in an increasingly diverse IT ecosystem.”

“Community engagement through open source foundations has proven to nurture and advance core technologies that the IT industry relies upon,” said Gianugo Rabellino, senior director of open source communities for Microsoft Open Technologies, Inc. “Developers everywhere are innovating rapidly with the inherent power and flexibility of .NET, so it will be exciting to see how the future takes shape with the industry’s participation in open development projects at the .NET Foundation.”

.NET represents one of the largest communities of professional developers at over six million strong. .NET enables the rapid development of applications across devices and services, with elegant, simpler code, and the high quality and scalability required by any organization — from individual developers to large enterprises — and continues to attract support from the developer community.

Community participants welcomed the news of the .NET Foundation at Build 2014:

“In the past years, open source has gained in importance within Microsoft and I couldn’t be happier to see that happening,” said Laurent Bugnion, senior director, IdentityMine Europe. “My open source project MVVM Light has benefitted a lot from interactions with the Microsoft teams. It is very exciting and encouraging to see this new concerted effort in the .NET Foundation to support and promote open source projects.”

Umbraco Founder Niels Hartvig said, “At Umbraco we’re thrilled to see what Microsoft is doing for open source with the .NET Foundation. It’s great news for the industry in general and amazing news for anyone involved in .NET open source projects.”

“It’s great to see Microsoft making open source a first class citizen in the .NET space,” added Morten Christensen from Umbraco. “With the introduction of the .NET Foundation Microsoft is showing that they take open source serious and are supporting the community in ways not seen before.”

“Open source in .NET has huge potential. To date, we as a community have produced some amazing software, but there is still so much possibility ahead, particularly if we are able to collaborate and grow together. The .NET Foundation represents this chance; together we can create a community that is both united and driven. Together, let’s make the next generation of .NET innovation an open source one,” said Anthony van der Hoorn, co-founder of Glimpse.

“Open source is a huge deal to the health of every developer community – getting developers involved and building things together makes for better products and better developers, and I’m super excited to see Microsoft expanding their support of open source projects,” said Paul Betts with GitHub.

“As one of the developers of Caliburn Micro it’s exciting to hear about the new improvements Microsoft is bringing with their support of open source projects. Increased access, support and visibility will help in a number of ways to showcase our project to the .NET community. I can’t wait to see what’s next,” said Nigel Sampson, founder of Compiled Experience.

The .NET Foundation Adds Three New Projects

Today the .NET Foundation welcomes three new projects:

Salesforce Toolkits for .NET, which enables .NET developers to interact with Salesforce’s popular REST APIs from multiple Microsoft platforms, including .NET 4.5, Windows Phone 8 and Windows 8/8.1, as well as iOS/Android using Xamarin and Mono.NET.

MVVM Light Toolkit, which helps .NET developers accelerate the creation and development of MVVM applications in WPF, Silverlight, Windows Store (RT) and for Windows Phone.

Open XML SDK, a set of strongly-typed .NET classes that simplify the task of manipulating Open XML packages and the underlying Open XML schema elements within a package, enabling developers to perform complex operations with just a few lines of code.

We are very pleased to have these projects under the stewardship of the .NET Foundation as part of our continued growth and evolution. Many people and projects have volunteered to participate and if you’ve submitted a project you’ll be hearing from us soon.

.NET Foundation Advisory Council Call for Public Comment

Friends in the .NET community,

When the .NET Foundation was created, there was an important principle that the foundation and its work be transparent, open, and community driven. In order to ensure that the foundation delivers on this primary objective, the board of the .NET Foundation asked Shaun Walker, who has a long history leading and contributing to .NET open source projects, to develop an initial proposal for a community based advisory council to help guide the governance of the .NET Foundation. That proposal is now available for community comment.

There are many reasons we feel that an advisory council is needed. Our goal is to ensure that the foundations operation and governance is both efficient and effective when viewed from a community building perspective. Some of the practical reasons for the creation of the council are:

Providing a clear communication channel between the community and the board on the foundations community building activities. To provide a channel for community stakeholders to provide feedback and guidance on the foundations value proposition, governance model, and other important foundation level decisions.
Provide a set of known, high profile individuals who can advocate for and evangelize the benefits and services provided by the .NET foundation and evangelize the foundation’s mission.
Establishes a group of individuals, experienced in open source community cultivation and project governance, who can provide stewardship, education and leadership to open source .NET projects of all size, popularity, and stature.
To augment the capacity of the board, and distribute work of the foundation across more community members to increase the governance bandwidth of the foundation.

The proposal outlines the rationale for the advisory council, along with its mission, composition and structure. Shaun Walker did a masterful job in crafting a proposal that the board feels will contribute greatly to ensuring the foundation operates in a transparent, open, and community driven manner.

Today, we make the proposal available to you for review. Our objective is to solicit community feedback in order to improve the council proposal and ensure we are headed in an appropriate direction. The advisory council proposal review period will be 4 weeks (ending 11/10), after which Shaun and the board will incorporate appropriate feedback. The resulting proposal will be brought back to the board for discussion and, if appropriate, approval. Please direct your feedback and comments to the discussion forum.

I’d like to thank you in advance for the time you take to read the proposal and the guidance you provide to help us develop an advisory council that works for the community.

Jay Schmelzer President,
.NET Foundation

.NET Foundation Advisory Council Proposal (PDF)
Advisory Council Discussion on the Forums

Announcing new governance model and project contributions to the .NET Foundation

With more than 30 projects on the docket and a governance model well underway, the .NET Foundation is poised for future growth.

Microsoft is making headlines today for its decision to open source its popular .NET development stack, which will now be maintained under the stewardship of the .NET Foundation. This should be welcome news to the millions of developers who use .NET to build high quality applications and services that can scale from needs of individual developers to large enterprises.

As part of its announcement last spring, Microsoft released .NET code to the open source community. Today’s news builds onto that, as Microsoft aims to further make .NET Core available across platforms for Linux and Mac. The company will open source additional key .NET platform components through the foundation.

Operational Changes

Increasingly, this community has shaped the role of the .NET Foundation as a forum for dialogue about the platform’s future direction. Earlier this year, we announced the formation of the .NET Foundation, a new independent forum for commercial and community developers to engage in open development and collaboration around the growing collection of open source technologies for .NET. 

As the .NET Foundation provides the framework for making open development of .NET the norm, community feedback has greatly influenced the foundation’s structure and operations since its creation. We are excited to see this forward progress in such a short period of time. More and more, .NET technologies are using an open process that is designed to be transparent and to foster involvement and direct code contributions from the community.

In addition to the Board of Directors, an Advisory Council is being established to ensure the general community is involved and informed of decisions about the future direction and health of the .NET ecosystem. If you would be interested to help guide governance of this process, please consider joining the .NET Foundation Advisory Council: join the discussion on the forum and send Advisory Council nominations to [email protected].

New Projects Onboard

The .NET Foundation initially took stewardship of 24 .NET open source projects, including the .NET Compiler Platform “Roslyn” and the ASP.NET family of open source projects. Xamarin also contributed six unique projects to the Foundation, including a couple of open source email libraries.

In recent months, several additional projects have been added to the .NET Foundation roster, bringing the number to more than 30, including Thinktecture’s IdentityServer and IdentityManager, Orchard, and several projects from the Outercurve Foundation, among them Nuget, Kudu and the ASP.NET Ajax Library. Moving forward, we will continue working with the Outercurve Foundation to migrate relevant .NET projects to the .NET Foundation.

“The foundation is a natural progression in our evolution as a community focused .NET framework.  We recognize that without a community Orchard would not have found the success and wide adoption it has today.  The .NET foundation is built on those principals and we couldn’t be more pleased to be a founding member project of this organization,” says Ylan Kunstler Orchard Project Steering Committee member and founder of the Orchard Harvest global conferences.

“The .NET Foundation offers a great opportunity to increase the visibility of our project and broaden our ability to attract new users and contributors to Thinktecture IdentityServer and IdentityManager,” said Brock Allen, at Thinktecture.

“Microsoft’s new commitment to fostering open source projects is great, and we at Thinktecture are happy to show our support for the .NET Foundation and help foster a vibrant .NET ecosystem,” said Dominick Baier, at Thinktecture.

Here you can view the full listing of .NET Foundation projects and programs.

On behalf of the .NET Foundation Board of Directors, we want to thank the many people who have contributed to the foundations continuing growth. Onward!

Gianugo Rabellino
Board Member, .NET Foundation
Senior Director of Open Source Communities at Microsoft Open Technologies, Inc.

Advisory Council Proposal — Call for Community Feedback Extended to December 5th

The increased openness of .NET has sparked widespread interest in the .NET Foundation. As a result, its Board of Directors has decided to extend the timeframe for community feedback on the .NET Foundation Advisory Council to December, 5, 2014.

The Advisory Council will bring unique knowledge and skills to complement our Board to more effectively govern the organization. The community has already helped shape the role of the Foundation – a new organization that already includes more than 30 projects across the industry, including the initial open source projects from the .NET Framework Core, under its stewardship. An Advisory Council will help bring more practical experience and business acumen to influence key decisions affecting the direction and operation of the Foundation.

If you would be interested to help guide governance of this process, please consider joining the .NET Foundation Advisory Council: join the discussion on the forum and send Advisory Council nominations to [email protected].

We will continue to look to the community to guide the future of the .NET ecosystem. The .NET Foundation Advisory Council is a great place to make this happen!

Gianugo Rabellino
Board Member, .NET Foundation
Senior Director of Open Source Communities at Microsoft Open Technologies, Inc.

.NET Foundation Advisory Council Proposal (PDF)
Advisory Council Discussion on the Forums

Welcoming the Newly Minted .NET Foundation Advisory Council Members

It’s official – we’re happy to welcome nine community leaders to the .NET Foundation Advisory Council – leaders who will bring their experience and passion to help steward open source .NET projects and continue on a path of open and transparent governance for the foundation.

The .NET Foundation Board has been selecting these individuals from an impressive roster, and we had to make some difficult choices to come up with the initial list. A few months down the road, we expect the Advisory Council to come up with a more participatory process to ensure that the next Advisory Council is selected by the .NET community at large.

Please join me in welcoming the newly minted Advisory Council members:

Shaun Walker – Software Architect. Ex-Project leader for DotNetNuke open source product and ecosystem.
Immo Landwerth – Senior Engineer from Microsoft .NET Framework team helping lead open source initiatives.
JB Evain – Founder and Project Leader at SyntaxTree open source projects. Senior Software engineer at Microsoft.
Daniel Roth – Senior Engineer from Microsoft ASP.NET Framework team helping lead open source initiatives.
Bill Wagner – Humanitarian Toolbox contributor, author and speaker for .NET technologies. C# MVP, and Regional Director for .NET Framework.
Phil Haack– Engineering Manager at GitHub with significant open source contributions and experience.
Mirco ‘meebey’ Bauer – Co-founder of Debian Mono Group, GNOME foundation member. CTO at GSD Software Design GmbH.
Marcus Wendt – Project Leader on Composite C1 OSS project and active speaker on .NET technologies.
Dominick Baier – Project Leader on ThinkTecture projects in .NET Foundation.

Many of you may know these individuals already, by collaborating through code or conferences, on a number of .NET-related projects. Each of them brings a record of independence, impartiality and candor, which will help guide key decisions affecting the direction of the foundation. We’re proud to have them represent the community and the foundation through their continued open source evangelism.

Our heartfelt thanks go to all those who stepped up and volunteered to help, especially to those who have not been selected just yet: just like everyone in the .NET community, we are looking forward to your continued participation and assistance as we continue our journey.

Advisory Council members look forward to any suggestion, criticism and assistance, as does the foundation board. Please continue to send us feedback as we work together for a stronger .NET open source community.

 

Gianugo Rabellino

Board Member, .NET Foundation

Senior Director of Open Source Communities at Microsoft Open Technologies, Inc.

 

#Speech to text recognition with #IBM #Watson in C#

If you’ve had experience with AWS Transcribe, you will notice that despite it’s excellent accuracy, it is unfortunately very slow, which can make things awkward if your application is time-sensitive.

One alternative was IBM Watson, which I personally found to be much faster than AWS Transcribe, by an order of magnitude, and it does support keyword matching, which is great if you are looking out for key phrases in audio. However, I did find it was less accurate than AWS transcribe.

You can get started with IBM Watson for free, without a credit card, and you can subscribe to the free version of the speech to text API (500 minutes free per month), which gives you enough to test with. This example assumes you already have an API key, and service URL, which you can get from the IBM website.

So, in this example, I am using a pre-recorded WAV file, which is included in my project (Build action set to copy always). The WAV file is a 8Hkz format, which is really low quality.

So, lets include the NUGET package by typing;

Install-Package IBM.Watson.SpeechToText.v1

Then, we’ll write a bit of code to test this out – The project type is a .NET Core, Console app.

var bAudio = File.ReadAllBytes(“Sample.wav”);
var memAudio = new MemoryStream(bAudio);
const string apiKey = “xxxxxx”;
var authenticator = new IamAuthenticator(apiKey);
var service = new SpeechToTextService(authenticator);
service.SetServiceUrl(“https://api.eu-de.speech-to-text.watson.cloud.ibm.com/instances/yyyyy”);
var results = service.Recognize( memAudio, model: “en-US_NarrowbandModel”);
Console.WriteLine(results.Response);

In terms of complexity, this is certainly easier than the equivalent code for AWS Transcribe, since you don’t need to upload to S3, poll on the results, then download from S3 again.

It’s pretty much the same price as AWS at $0.02 per minute, but has different pricing tiers, so it’s hard to compare like-for-like.

Summary of reading: October – December 2021

“Chasing New Horizons: Inside the Epic First Mission to Pluto” by Alan Stern
and David Grinspoon – a fascinating account of the New Horizons mission, told
by its principal investigator. Lots of interesting scientific and engineering
details about the mission. A good portion of the book is spent on NASA
politics in the lead-up to the mission approval, which turned out to be
surprisingly interesting.
“Largo pétalo de mar” by Isabel Allende – a historical family saga spanning
several decades in the 20th century. The novel follows the journey of a family
of Spanish refugees from the 1930s civil war and ther life in Chile and
Venezuela following an escape from Europe on the famous SS Winnipeg in 1939.
Enjoyable book that served well as my yearly don’t-forget-to-read-in-Spanish
ritual.
“Site Reliability Engineering” by Murphy, Beyer et. al – the “Google SRE
book”, this is a formidable and dense tome describing how SRE work (now also
sometimes called DevOps) is done at Google scale. Lots of information, lots
of examples and quite a bit of redundancy in this book – which is natural,
given that it’s a collection of loosely-related essays by different people.
Some of the best parts are descriptions of Google-scale distributed systems,
with interesting insights about their design and maintenance. I took a slow
approach to this book reading a few pages at a time – and it took me over a
year. It was just hard to get through; not exactly light bedside reading. This
book should be fascinating and indispensible for anyone building a modern
SRE/DevOps org, though.
“American Moonshot: John F. Kennedy and the Great Space Race” by Douglas
Brinkley – (young readers edition) nice short book about the history of
the space race, focusing on the role JFK played in it. This book ends with the
assassination of Kennedy, which is a bit odd. Not sure why they didn’t keep
telling the story until the actual Apollo 11 mission.
“Gandhi: The Years that Changed the World, 1914-1948” by Ramachandra
Guha – the second half of this extensive biography of Gandhi. Certainly a
great place to learn about who Gandhi was and what he did, but if you’re
looking to learn about the history of India in these pivotal years through
Gandhi’s biography, this book falls somewhat short IMHO. It’s just hard to
see the forest for the trees; there’s so much detail about every aspect of
Gandhi’s persona – not just the admirable work for Indian unity, religious
tolerance and the untouchables, but also his celibacy and unusual economic
ideas. The author does dedicate some sections to try and derive some unified
view of Gandhi’s influence on history, but these are few and far apart.
“Alien Oceans” by Kevin Peter Hand – describes the current scientific
understanding of the possibility of life on ocean worlds in the solar system
(Europa, Titan and a couple of other moons of the giant gas planets).
Excellent book overall, with a Sagan-esque ability to evoke the magic of
science; the inferences made about a liquid, salty water ocean on Europa from
scientific observations were a particular favorite – a fascinating topic very
well presented.
“A Decent Life: Morality for the Rest of Us” by Todd May – this wasn’t a good
use of my time, at all.
“How to Walk on Water and Climb on Walls” by David L. Hu – the author is
a professor of mechanical engineering and biology, focusing on animal motion.
In this book he describes his own research and the research of some of his
colleagues on topics as diverse as the urination time of mammals, how insects
fly in the rain, shark-skin and how fish swim. Each chapter describes several
interesting research findings as well as robots that scientists built to
replicate some animal. Very interesting and well written!
“Code Talker: A Novel abotu the Navajo Marines of WWII” by Joseph Bruchac – a
short novel aimed at young readers, telling the story of a fictional Navajo
Marine who was a “code talker” during the war in the pacific; much of the
book is based on real events and real people. Nice, quick read.
“The Ray Tracer Challenge” by Jamis Buck – this book guides you through
implementing a ray tracer, using the programming language of your choice. The
book is structured as a series of “unit tests” and pieces of pseudocode that
are simple to translate into any language. It’s very well-written and
sequenced; it’s fun to build something visual while learning a new programming
language. I was somewhat disappointed that the book didn’t spend more time
explaining why the formulae and pseudocode it provides work, and didn’t help
develop intuition. This is by design – the author admits he’s not going to
do this right in the preface. This leads to a serious problem when debugging
issues, though. Since no intuition is developed, the only way to debug is
to meticulously compare your code to the book’s pseudocode, to ensure that
nothing got lost or mistyped in the transcription. I think this book is good
but it could be much better if it spent more time on explaining the why, not
just the how; it would be fine to trim out some of the advanced material if
space is of concern.
“The Vietnam War: An Intimate History” by Geoffrey C. Ward and Ken Burns – a
very detailed history of the Vietnam war, from the point of view of both
American and (mostly North) Vietnamese soldiers. Great book, though I don’t
think it’s very successful in its goal of being neutral and conveying a
balanced point of view; it clearly tilts left in its interpretation of events.
“Wanting: The Power of Mimetic Desire in Everyday Life” by Luke Burgis – I’m
genuinely puzzled about the raving reviews this book got; I found it shallow
and barely readable.
“The Autobiography of Martin Luther King, Jr” edited by Clayborne Carson –
collected from MLK’s writing and notes, and mixed with the recordings of
several of his speeches. Interesting insights into the civil right movement
from its most famous leader and symbol. MLK was a deep thinker and great
writer, as well as a fantastic orator. Some of his sermons reproduced in this
book made me think of the prophets of antiquity, and how they got proclaimed
and elevated to their “saint” status by virtue of their charisma.
“Whereabouts” by Jhumpa Lahiri – a short novel about a single middle-aged
woman living in a large Italian city. Not much happening there – just a
collection of loosely coupled very short stories from her life. Beautiful
writing that evokes a certain mood in readers; Lahiri is a master.

Re-reads:

“Exodus” by Leon Uris