skip to main content - dyslexic font - mobile - text - print

Hacker Public Radio

Your ideas, projects, opinions - podcasted.

New episodes Monday through Friday.


Welcome to HPR the Community Podcast Network

We started producing shows as Today with a Techie 10 years, 6 months, 25 days ago. Our shows are produced by listeners like you and can be on any topic that "are of interest to Hackers". If you listen to HPR then please consider contributing one show a year. If you record your show now it could be released in 31 days.

Latest Shows



hpr2019 :: a pi project and an owncloud project

A short episode where I describe a couple of geeky projects I've been working on


Hosted by Matt McGraw (g33kdad) on 2016-04-28 and released under a CC-BY-SA license.
Listen in ogg, spx, or mp3 format. Comments (1)

HPR - A couple of Projects I've been working on

  1. Intro

    • Please record a show!!!!!
    • Couple of Projects
  2. Pi Project

    • Love of Music
    • Digital, of course and webradio
    • Sonos, other proprietary solutions
    • Got a Pi2 for XMas
    • Pi Music Box
    • RuneAudio
    • Arch Based
    • underlying tech is MPD
    • flash SD Card
    • boot with network cable attached
    • add music and webradios to library
    • .pls and .m3u files
  3. PhotoFrame Project

    • proprietary items
    • tablet/smart phone lying around
    • ownCloud
    • update for my parents on the road

Links and other Goodies

Pi Project
SomaFM
Capital Public Radio
Sonos
Samsung Shape
PiMusicBox
Rune Audio
Music Player Daemon
USB Audio Dongle (amazon link... NOT an affiliate link)

PicFrame Project
ownCloud
Kindle Fire HD 6
PicFrame
PicFrame Android App

Contact Info
Matt McGraw - matty at the strangeland dot net
Stay-At-Home G33k Dad ~ Fatherhood in the digital age
@sahg33kdad
Google+ www.google.com/+MattMcGraw

The following link includes a photo of the RPi in the bookshelf with the stereo as well as a screenshot of the Rune Audio app running on my Android phone.
https://cloud.thestrangeland.net/index.php/s/CdbU1povrcproZQ


hpr2018 :: How to make Komboucha Tea

Here, I describe how to brew your own komboucha tea.

Hosted by b-yeezi on 2016-04-27 and released under a CC-BY-SA license.
Listen in ogg, spx, or mp3 format. Series: Home Brewing | Comments (0)

How to Make Kamboucha Tea

Makes about 1 gallon

Ingredients

Ingredient US Metric
water 3 1/2 quarts ??
white sugar 1 cup ??
black tea 8 bags (or 2 tablespoons loose tea) ??
starter tea from last batch of kombucha or store-bought 2 cups ??
scoby 1 per fermentation jar N/A

Optional flavoring extras for bottling: 1 to 2 cups chopped fruit, 2 to 3 cups fruit juice, 1 to 2 tablespoons flavored tea (like hibiscus or Earl Grey), 1/4 cup honey, 2 to 4 tablespoons fresh herbs or spices

Equipment

  • Stock pot
  • 1-gallon glass jar or two 2-quart glass jars
  • Bottles: Six 16-oz glass bottles with plastic lids, 6 swing-top bottles, or clean soda bottles

Instructions

Note: Avoid prolonged contact between the kombucha and metal both during and after brewing. This can affect the flavor of your kombucha and weaken the scoby over time.

1. Make the Tea Base: Bring the water to a boil. Remove from heat and stir in the sugar to dissolve. Drop in the tea and allow it to steep until the water has cooled. Depending on the size of your pot, this will take a few hours. You can speed up the cooling process by placing the pot in an ice bath.

2. Add the Starter Tea: Once the tea is cool, remove the tea bags or strain out the loose tea. Stir in the starter tea. (The starter tea makes the liquid acidic, which prevents unfriendly bacteria from taking up residence in the first few days of fermentation.)

3. Transfer to Jars and Add the Scoby: Pour the mixture into a 1-gallon glass jar (or divide between two 2-quart jars, in which case you'll need 2 scobys) and gently slide the scoby into the jar with clean hands. Cover the mouth of the jar with a few layers of cheesecloth or paper towels secured with a rubber band.

4. Ferment for 7 to 10 Days: Keep the jar at room temperature, out of direct sunlight, and where it won't get jostled. Ferment for 7 to 10 days, checking the kombucha and the scoby periodically.

It's not unusual for the scoby to float at the top, bottom, or even sideways. A new cream-colored layer of scoby should start forming on the surface of the kombucha within a few days. It usually attaches to the old scoby, but it's ok if they separate. You may also see brown stringy bits floating beneath the scoby, sediment collecting at the bottom, and bubbles collecting around the scoby. This is all normal and signs of healthy fermentation.

After seven days, begin tasting the kombucha daily by pouring a little out of the jar and into a cup. When it reaches a balance of sweetness and tartness that is pleasant to you, the kombucha is ready to bottle.

5. Remove the Scoby: Before proceeding, prepare and cool another pot of strong tea for your next batch of kombucha, as outlined above. With clean hands, gently lift the scoby out of the kombucha and set it on a clean plate. As you do, check it over and remove the bottom layer if the scoby is getting very thick.

6. Bottle the Finished Kombucha: Measure out your starter tea from this batch of kombucha and set it aside for the next batch. Pour the fermented kombucha (straining, if desired) into bottles, along with any juice, herbs, or fruit you may want to use as flavoring. Leave about a half inch of head room in each bottle. (Alternatively, infuse the kombucha with flavorings for a day or two in another jar covered with cheesecloth, strain, and then bottle. This makes a cleaner kombucha without "stuff" in it.)

7. Carbonate and Refrigerate the Finished Kombucha: Store the bottled kombucha at room-temperature out of direct sunlight and allow 1 to 3 days for the kombucha to carbonate. Until you get a feel for how quickly your kombucha carbonates, it's helpful to keep it in plastic bottles; the kombucha is carbonated when the bottles feel rock solid. Refrigerate to stop fermentation and carbonation, and then consume your kombucha within a month.

8. Make a Fresh Batch of Kombucha: Clean the jar being used for kombucha fermentation. Combine the starter tea from your last batch of kombucha with the fresh batch of sugary tea, and pour it into the fermentation jar. Slide the scoby on top, cover, and ferment for 7 to 10 days.

Additional Notes:

• Batch Size: To increase or decrease the amount of kombucha you make, maintain the basic ratio of 1 cup of sugar, 8 bags of tea, and 2 cups starter tea per gallon batch. One scoby will ferment any size batch, though larger batches may take longer.

• Putting Kombucha on Pause: If you'll be away for 3 weeks or less, just make a fresh batch and leave it on your counter. It will likely be too vinegary to drink by the time you get back, but the scoby will be fine. For longer breaks, store the scoby in a fresh batch of the tea base with starter tea in the fridge. Change out the tea for a fresh batch every 4 to 6 weeks.

• Other Tea Options: Black tea tends to be the easiest and most reliable for the scoby to ferment into kombucha, but once your scoby is going strong, you can try branching out into other kinds. Green tea, white tea, oolong tea, or a even mix of these make especially good kombucha. Herbal teas are ok, but be sure to use at least a few bags of black tea in the mix to make sure the scoby is getting all the nutrients it needs. Avoid any teas that contain oils, like earl grey or flavored teas.

• Avoid Prolonged Contact with Metal: Using metal utensils is generally fine, but avoid fermenting or bottling the kombucha in anything that brings them into contact with metal. Metals, especially reactive metals like aluminum, can give the kombucha a metallic flavor and weaken the scoby over time.

Troubleshooting Kombucha

• It is normal for the scoby to float on the top, bottom, or sideways in the jar. It is also normal for brown strings to form below the scoby or to collect on the bottom. If your scoby develops a hole, bumps, dried patches, darker brown patches, or clear jelly-like patches, it is still fine to use. Usually these are all indicative of changes in the environment of your kitchen and not a problem with the scoby itself.

• Kombucha will start off with a neutral aroma and then smell progressively more vinegary as brewing progresses. If it starts to smell cheesy, rotten, or otherwise unpleasant, this is a sign that something has gone wrong. If you see no signs of mold on the scoby, discard the liquid and begin again with fresh tea. If you do see signs of mold, discard both the scoby and the liquid and begin again with new ingredients.

• A scoby will last a very long time, but it's not indestructible. If the scoby becomes black, that is a sign that it has passed its lifespan. If it develops green or black mold, it is has become infected. In both of these cases, throw away the scoby and begin again.

• To prolong the life and maintain the health of your scoby, stick to the ratio of sugar, tea, starter tea, and water outlined in the recipe. You should also peel off the bottom (oldest) layer every few batches. This can be discarded, composted, used to start a new batch of kombucha, or given to a friend to start their own.

• If you're ever in doubt about whether there is a problem with your scoby, just continue brewing batches but discard the kombucha they make. If there's a problem, it will get worse over time and become very apparent. If it's just a natural aspect of the scoby, then it will stay consistent from batch to batch and the kombucha is fine for drinking.


hpr2017 :: Here are my thoughts on a 3D printer Kit.

Bought a 3D printer kit. My thoughts on how it went together.

Hosted by cheeto4493 on 2016-04-26 and released under a CC-BY-SA license.
Listen in ogg, spx, or mp3 format. Comments (0)

I purchased a 3D printer kit from AliExpress.

http://www.aliexpress.com/item/Free-shipping-High-Quality-Precision-Reprap-Prusa-i3-DIY-3d-Printer-kit-with-2-Roll-Filament/32424257787.html

Here are some after thoughts on how I liked it, a little overview of 3D printers and why I bought this one.

Pictures of the printer as assembled, and a few items I printed http://www.travestylabs.com/3Dprinter/

I hope to make this into a series about software, tips and modifications, and other thoughts I have to share about it.


hpr2016 :: Echoprint

I share what I've learned about the Echoprint music identification system


Hosted by laindir on 2016-04-25 and released under a CC-BY-SA license.
Listen in ogg, spx, or mp3 format. Comments (1)

Ken's message asking about programmatically checking for the intro and outro: http://thread.gmane.org/gmane.network.syndication.podcast.hacker-public-radio/1039

The Echoprint website: http://echoprint.me

Codegen source code: https://github.com/echonest/echoprint-codegen

Echoprint - An Open Music Identification Service: https://www.ee.columbia.edu/~dpwe/pubs/EllisWP11-echoprint.pdf

Server source codehttps://github.com/echonest/echoprint-server


hpr2015 :: Linux in the Church

How I'm using Linux for many of my projects at church.

Hosted by Joe on 2016-04-22 and released under a CC-BY-SA license.
Listen in ogg, spx, or mp3 format. Comments (2)

Linux has been my exclusive OS for many years. When I became the tech director at my church I wanted to utilize the power and freedom of Open Source so I'm gradually implementing it on many of my projects.

Photo of the rig in the church


hpr2014 :: A first look at the Owon B35T Part 2

More clicking of things, Bluetooh happens, things are taken apart...


Hosted by NYbill on 2016-04-21 and released under a CC-BY-SA license.
Listen in ogg, spx, or mp3 format. Comments (3)

In this episode of HPR you get to hear more of the things on NYbill's electronics bench that make clicking noises.

The review of the Owon B35T's continues. Bluetooth is now working. And we get an inside look at the meter.


hpr2013 :: Parsing XML in Python with Xmltodict

A quict introduction to xmltodict, an XML parser for Python.

Hosted by klaatu on 2016-04-20 and released under a CC-BY-SA license.
Listen in ogg, spx, or mp3 format. Series: A Little Bit of Python | Comments (2)

If Untangle is too simple for your XML parsing needs, check out xmltodict. Like untangle, xmltodict is simpler than the usual suspects (lxml, beautiful soup), but it's got some advanced features as well.

If you're reading this article, I assume you've read at least the introduction to my article about Untangle, and you should probably also read, at some point, my article on using JSON just so you know your options.

Quick re-cap about XML:

XML is a way of storing data in a hierarchical arrangement so that the data can be parsed later. It's explicit and strictly structured, so one of its benefits is that it paints a fairly verbose definition of data. Here's an example of some simple XML:

<?xml version="1.0"?>
<book>
   <chapter id="prologue">
      <title>
     The Beginning
  </title>
      <para>
     This is the first paragraph.
      </para>
    </chapter>

    <chapter id="end">
      <title>
     The Ending
  </title>
      <para>
     Last para of last chapter.
      </para>
    </chapter>
</book>

And here's some info about the xmltodict library that makes parsing that a lot easier than the built-in Python tools:

Install

Install xmltodict manually, or from your repository, or using pip:

$ pip install xmltodict

or if you need to install it locally:

$ pip install --user xmltodict

Xmltodict

With xmltodict, each element in an XML document gets converted into a dictionary (specifically an OrderedDictionary), which you then treat basically the same as you would JSON (or any Python OrderedDict).

First, ingest the XML document. Assuming it's called sample.xml and is located in the current directory:

>>> import xmltodict
>>> with open('sample.xml') as f:
...     data = xmltodict.parse(f.read())

If you're a visual thinker, you might want or need to see the data. You can look at it just by dumping data:

>>> data
OrderedDict([('book', OrderedDict([('chapter',
[OrderedDict([('@id', 'prologue'),
('title', 'The Beginning'),
...and so on...

Not terribly pretty to look at. Slightly less ugly is your data set piped through json.dumps:

>>> import json
>>> json.dumps(data)
'{"book": {"chapter": [{"@id": "prologue",
"title": "The Beginning", "para": "This is the first paragraph."},
{"@id": "end", "title": "The Ending",
"para": "This is the last paragraph of the last chapter."}]
}}'

You can try other feats of pretty printing, if they help:

>>> pp = pprint.PrettyPrinter(indent=4)
>>> pp.pprint(data)
{ 'book': { 'chapter': [{'@id': 'prologue',
                         'title': 'The Beginning',
             'para': 'This is the ...
                         ...and so on...                 

More often than not, though, you're going to be "walking" the XML tree, looking for specific points of interest. This is fairly easy to do, as long as you remember that syntactically you're dealing with a Python dict, while structurally, inheritance matters.

Elements (Tags)

Exploring the data element-by-element is very easy. Calling your data set by its root element (in our current example, that would be data['book']) would return the entire data set under the book tag. We'll skip that and drill down to the chapter level:

>>> data['book']['chapter']
[OrderedDict([('@id', 'prologue'), ('title', 'The Beginning'),
('para', 'This is the first paragraph.')]),
OrderedDict([('@id', 'end'), ('title', 'The Ending'),
('para', 'Last paragraph of last chapter.')])]

Admittedly, it's still a lot of data to look at, but you can see the structure.

Since we have two chapters, we can enumerate which chapter to select, if we want. To see the zeroeth chapter:

>>> data['book']['chapter'][0]
OrderedDict([('@id', 'prologue'),
('title', 'The Beginning'),
('para', 'This is the first paragraph.')])

Or the first chapter:

>>> data['book']['chapter'][1]
OrderedDict([('@id', 'end'), ('title', 'The Ending'),
('para', 'Last paragraph of last chapter.')])

And of course, you can continue narrowing your focus:

>>> data["book"]["chapter"][0]['para']
'This is the first paragraph.'

It's sort of like Xpath for toddlers. Having had to work with Xpath, I'm happy to have this option.

Attributes

You may have already noticed that in the dict containing our data, there is some special notation happening. For instance, there is no @id element in our XML, and yet that appears in the dict.

Xmltodict uses the @ symbol to signify an attribute of an element. So to look at the attribute of an element:

>>> data['book']['chapter'][0]['@id']
'prologue'

If you need to see each attribute of each chapter tag, just iterate over the dict. A simple example:

>>> for c in range(0,2):
...     data['book']['chapter'][c]['@id']
...
'prologue'
'end'

Contents

In addition to special notation for attributes, xmltodict uses the # prefix to denote contents of complex elements. To show this example, I'll make a minor modification to sample.xml:

<?xml version="1.0"?>
<book>
   <chapter id="prologue">
      <title>
     The Beginning
  </title>
      <para class="linux">
     This is the first paragraph.
      </para>
    </chapter>

    <chapter id="end">
      <title>
     The Ending
  </title>
      <para class="linux">
     Last para of last chapter.
      </para>
    </chapter>
</book>

Notice that the <para> elements now have a linux attribute, and also contain text content (unlike <chapter> elements, which have attributes but only contain other elements).

Look at this data structure:

>>> import xmltodict
>>> with open('sample.xml') as g:
...     data = xmltodict.parse(g.read())
>>> data['book']['chapter'][0]
OrderedDict([('@id', 'prologue'),
('title', 'The Beginning'),
('para', OrderedDict([('@class', 'linux'),
('#text', 'This is the first paragraph.')]))])

There is a new entry in the dictionary: #text. It contains the text content of the <para> tag and is accessible in the same way that an attribute is:

>>> data['book']['chapter'][0]['para']['#text']
'This is the first paragraph.'

Advanced

The xmltodict module supports XML namespaces and can also dump your data back into XML. For more documentation on this, have a look at the module on github.com/martinblech/xmltodict.

What to Use?

Between untangle, xmltodict, and JSON, you have pretty good set of options for data parsing. There really are diferent uses for each one, so there's not necessarily a "right" or "wrong" answer. Try them out, see what you prefer, and use what is best. If you don't know what's best, use what you're most comfortable with; you can always improve it later.

[EOF]

Made on Free Software.


hpr2012 :: Parsing XML in Python with Untangle

A quict introduction to Untangle, an XML parser for Python.

Hosted by klaatu on 2016-04-19 and released under a CC-BY-SA license.
Listen in ogg, spx, or mp3 format. Series: A Little Bit of Python | Comments (1)

XML is a popular way of storing data in a hierarchical arrangement so that the data can be parsed later. For instance, here is a simple XML snippet:

<?xml version="1.0"?>
<book>
   <chapter id="prologue">
      <title>
     The Beginning
 </title>
   </chapter>
</book>

The nice thing about XML is that it is explicit and strictly structured. The trade-off is that it's pretty verbose, and getting to where you want to go often requires fairly complex navigation.

If you do a quick search online for XML parsing in Python, your two most common results are lxml and beautifulsoup. These both work, but using them feels less like opening a dictionary (as with JSON) to look up a definition and more like wandering through a library to gather up all the dictionaries you can possibly find.

In JSON, the thought process might be something like:

"Go to the first chapter's title and print the contents."

With traditional XML tools, it's more like:

"Open the book element and gather all instances of titles that fall within those chapters. Then, look into the resulting object and print the contents of the first occurrence."

There are at least two libaries that you can install and use to bring some sanity to complex XML structures, one of which is untangle.

Untangle

With untangle, each element in an XML document gets converted into a class, which you can then probe for information. Makes no sense? well, follow along and it will become clear:

First, ingest the XML document. Assuming it's called sample.xml and is located in the current directory:

>>> import untangled
>>> data = untangle.parse('sample.xml')

Now our simple XML sample is sitting in RAM, as a Python class. The first element is <book> and all it contains is more elements, so its results are not terribly exciting:

>>> data.book
Element(name = book, attributes = {}, cdata = )

As you can see, it does identify itself as "book" (under the name listing) but otherwise, not much to look at. That's OK, we can keep drilling down:

>>> data.book.chapter
Element(name = chapter, attributes = {'id': 'prologue'}, cdata = )

Now things get more interesting. The next element identifies itself as "chapter", and reveals that it has an attribute "id" which has a value of "prologue". To continue down this path:

>>> data.book.chapter.title
Element(name = title, attributes = {}, cdata = The Beginning )

And now we have a pretty complete picture of our little XML document. We have a breadcrumb trail of where we are in the form of the class we are invoking (data.book.chapter.title) and we have the contents of our current position.

Sniping

That's very linear; if you know your XML schema (and you usually do, since XML is quite strict) then you can grab values without all the walking. For instance, we know that our chapters have 'id' attributes, so we can ask for exactly that:

>>> data.book.chapter['id']
'prologue'

You can also get the contents of elements by looking at the cdata component of the class. Depending on the formatting of your document, untangle may be a little too literal with how it stores contents of elements, so you may want to use .strip() to prettify it:

>>> data.book.chapter.title.cdata.strip()
'The Beginning'

Dealing with More Than One Element

My example so far is nice and tidy, with only one chapter in the book. Generally you'll be dealing with more data than that. Let's add another chapter to our sample file, and some content to each:

<?xml version="1.0"?>
<book>
   <chapter id="prologue">
      <title>
     The Beginning
  </title>
      <para>
     This is the first paragraph.
      </para>
    </chapter>

    <chapter id="end">
      <title>
     The Ending
  </title>
      <para>
     Last para of last chapter.
      </para>
    </chapter>
</book>

Accessing each chapter is done with index designations, just like with a dict:

>>> data.book.chapter[0]
Element(name = chapter, attributes = {'id': 'prologue'}, cdata = )
>>> data.book.chapter[1]
Element(name = chapter, attributes = {'id': 'end'}, cdata = )

If there is more than one instance of a tag, you must use a designator or else untangle won't know what to return. For example, if we want to access either the title or para elements within a chapter:

>>> data.book.chapter.title
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'list' object has no attribute 'title'

Oops. But if we tell it which one to look at:

>>> data.book.chapter[0].title.cdata.strip()
'The Beginning'
>>> data.book.chapter[1].title.cdata.strip()
'The Ending'

Or you can look at the paragraph instead of the title. The lineage is the same, only instead of looking at the title child, you look at the para child:

>>> data.book.chapter[0].para.cdata.strip()
'This is the first paragraph.'
>>> data.book.chapter[1].para.cdata.strip()
'Last para of last chapter.'

You can also iterate over items:

>>> COUNT = [0,1]
>>> for TICK in COUNT:
...     print(data.book.chapter[TICK])
Element <chapter> with attributes {'id': 'prologue'} and children
[Element(name = title, attributes = {}, cdata = The Beginning ),
Element(name = para, attributes = {}, cdata = This is the first paragraph.)]

Element <chapter> with attributes {'id': 'end'} and children
[Element(name = title, attributes = {}, cdata = The Ending ),
Element(name = para, attributes = {}, cdata = Last para of last chapter.)]

And so on.

Easy and Fast

I'll admit the data structure of the classes does look odd, and you could probably argue it's not the cleanest and most elegant of all output; it's unnerving to see empty cdata fields or to constantly run into the need to strip() whitespace. However, the ease and speed and intuitiveness of parsing XML with untangle is usually well worth any trade-offs.

[EOF]

Made on Free Software.


hpr2011 :: Introduction to sed - part 4

How sed really works. Less frequently used sed commands


Hosted by Dave Morriss on 2016-04-18 and released under a CC-BY-SA license.
Listen in ogg, spx, or mp3 format. Series: Learning sed | Comments (3)

Introduction to sed - part 4

In the last episode we looked at some of the more frequently used sed commands, having spent previous episodes looking at the s command, and we also covered the concept of line addressing.

In this episode we will look at how sed really works in all the gory details, examine some of the remaining sed commands and begin to build useful sed programs.

To read the rest of the notes for this episode follow this link: http://hackerpublicradio.org/eps/hpr2011/full_shownotes.html