We started producing shows as Today with a Techie on 2005-09-19, 13 years, 5 months, 4 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 18 days.
Using Fritzing to help reverse engineer a circuit in a winter model village windmill
Hosted by Ken Fallon on 2019-02-15 is flagged as Clean and released under a CC-BY-SA license. Tags:Fritzing, Reverse Engineering, LED.
Listen in ogg, spx, or mp3 format.
Series: Hobby Electronics | Comments (0)
In this episode Ken uses Fritzing tool to keep track of how a winter model village windmill is wired together. Leading to identifying the problem component.
Fritzing is an open-source initiative to develop amateur or hobby CAD software for the design of electronics hardware, to support designers and artists ready to move from experimenting with a prototype to building a more permanent circuit. It was developed at the University of Applied Sciences of Potsdam.
From https://en.wikipedia.org/wiki/Fritzing
Thoughts about RPG character building, modern RPG play style compared to the Old School, and more
Hosted by klaatu on 2019-02-14 is flagged as Clean and released under a CC-BY-SA license. Tags:rpg, game, gaming.
Listen in ogg, spx, or mp3 format.
Comments (0)
Out-takes from episode 2743. This is commentary about modern RPG play style, the character build process, Starfinder as a system, and more.
Did you know that Lostnbronx and Klaatu have a gaming blog? We do! You should go subscribe to it at mixedsignals.ml
The blog features commentary about gaming, tech, geek culture, a podcast or two, and lots more.
tuturto walks through implementation of special events in web based game
Hosted by tuturto on 2019-02-13 is flagged as Clean and released under a CC-BY-SA license. Tags:haskell, yesod.
Listen in ogg, spx, or mp3 format.
Comments (0)
Intro
I was tasked to write kragii worms in the game and informed that they’re small (10cm / 4 inches) long worms that burrow in ground and are drawn to farming fields and people. They’re dangerous and might eat harvest or people.
Special events build on top of the new system I explained in episode 2733. They are read from same API as regular news and need same ToJSON, FromJSON, ToDto and FromDto instances as regular news (for translating them data transfer objects and then into JSON for sending to client).
Loading
Starting from the API interface, the first real difference is when JSON stored into database is turned into NewsArticle. Two cases, where special news have available options added to them and regular news are left unchanged. These options tell player what choices they have when dealing with the situation and evaluated every time special event is loaded, because situation might have changed since special event got stored into database and available options might have changed.
addOptions (key, article) = case article of
Special news ->
(key, Special $ availableOptions news)
_ ->
(key, article)
availableOptions :: SpecialNews -> SpecialNews
availableOptions x =
case x of
KragiiWorms event _ choice ->
KragiiWorms event (eventOptions event) choice
eventOptions is one of the events defined in SpecialEvent type class that specifies two functions every special event has to have. eventOptions lists what options the event has currently available and resolveEvent resolves the event according to choice user might have made (hence Maybe in it).
Type class is parametrized with three types (imaginatively named to a, b and c). First is data type that holds information about special event (where it’s happening and to who for example), second one is one that tells all possible choices player has and third one lists various results that might occur when resolving the event. In this example they’re KragiiWormsEvent, KragiiWormsChoice and KragiiResults.
data KragiiWormsEvent = KragiiWormsEvent
{ kragiiWormsPlanetId :: Key Planet
, kragiiWormsPlanetName :: Text
, kragiiWormsSystemId :: Key StarSystem
, kragiiWormsSystemName :: Text
, kragiiWormsDate :: Int
}
data KragiiWormsChoice =
EvadeWorms
| AttackWorms
| TameWorms
data KragiiResults =
WormsStillPresent
| WormsRemoved
| WormsTamed
| CropsDestroyed (RawResource Biological)
| FarmersInjured
Definition of the SpecialEvent type class is shown below. Type signature of resolveEvent is gnarly because it’s reading and writing database.
class SpecialEvent a b c | a -> b, a -> c where
eventOptions :: a -> [UserOption b]
resolveEvent :: ( PersistQueryRead backend, PersistQueryWrite backend
, MonadIO m, BaseBackend backend ~ SqlBackend ) =>
(Key News, a) -> Maybe b -> ReaderT backend m (Maybe EventRemoval, [c])
One more piece we need is UserOption. This records options in a format that is useful in the client side. Each option player has are given title and explanation that are shown on UI.
data UserOption a =
UserOption { userOptionTitle :: Text
, userOptionExplanation :: [Text]
, userOptionChoice :: a
}
Current implementation of eventOptions doesn’t allow database access, but I’m planning on adding that at the point where I need it. Example doesn’t show all different options, as they all have same structure. Only first option in the list is shown:
eventOptions _ = [ UserOption { userOptionTitle = "Avoid the worms"
, userOptionExplanation = [ "Keep using fields, while avoiding the worms and hope they'll eventually leave."
, "50 units of biologicals lost"
, "25% chance of worms leaving"
]
, userOptionChoice = EvadeWorms
}
, ...
]
Making choice
putApiMessageIdR handles updating news with HTTP PUT messages. First steps is to check that caller has autenticated and retrieve id of their faction. News article that is transferred in body as JSON is parsed and checked for type. Updating regular news articles isn’t supported and is signaled with HTTP 403 status code. One more check to perform is to check that news article being edited actually belong to the faction player is member of. If that’s not the case HTTP 404 message is returned.
If we got this far, news article is updated with the content sent by client (that also contains possible choice made by user). There’s no check that type of news article doesn’t change or that the option selected doesn’t change (I need to add these at later point). In the end, list of all messages is returned back to the client.
putApiMessageIdR :: Key News -> Handler Value
putApiMessageIdR mId = do
(_, _, fId) <- apiRequireFaction
msg <- requireJsonBody
let article = fromDto msg
_ <- if isSpecialEvent article
then do
loadedMessages <- runDB $ selectList [ NewsId ==. mId
, NewsFactionId ==. fId ] [ Asc NewsDate ]
if length loadedMessages == 0
then apiNotFound
else runDB $ update mId [ NewsContent =. (toStrict $ encodeToLazyText article) ]
else apiForbidden "unsupported article type"
loadAllMessages fId
Resolving event
Special event occured, user made (or did not) a choice. Now it’s time to simulate what happens. Below is resolveEvent for kragii attack.
runWriterT and runMaybeT are used as code being called uses monad transformers to add some extra handling. WriterT adds ability to record data (KragiiResult in this case) and MaybeT adds ability to stop computation early if one of the steps return Nothing value.
Let’s walk through what happens when user has chosen to avoid kragii worms and keep working only part of the fields. First step is to load faction information. If faction couldn’t be found, we abort. Next amount of biological matter consumed and how much is left is calculated. Again, if calculation isn’t possible, we’ll abort. This step reaches into database and updates amount of biological matter stored by the faction (again, possibility to stop early). Final step is to check if kragii leave or not (again, chance of abort).
Loading faction has several step. Id is stored in the event is used to load planet. Planet might or might have an owner faction, depending on if it has been settled. This faction id is used to load faction data. Loading might fail if corresponding record has been removed from database and planet might not be settled at the given time. Any of these cases will result Nothing be returned and whole event resolution being aborted. I’m starting to really like that I don’t have to write separate if statements to take care of these special cases.
getFaction :: ( MonadIO m, PersistStoreRead backend
, BaseBackend backend ~ SqlBackend ) =>
KragiiWormsEvent
-> MaybeT (WriterT [KragiiResults] (ReaderT backend m)) (Entity Faction)
getFaction event = MaybeT $ do
planet <- lift $ get $ kragiiWormsPlanetId event
let owner = join $ fmap planetOwnerId planet
res <- lift $ mapM getEntity owner
return $ join res
Amount of biological matter in store is stored in faction information. If it’s zero or less, Nothing is returned as there’s nothing to do really. In other cases, amount of biological matter left is calculated and result returned in form of ( cost, biological matter left ). I’m carrying around the cost, as it’s later needed for reporting how much matter was removed.
calculateNewBio :: Monad m =>
RawResource Biological -> Faction
-> MaybeT (WriterT [KragiiResults] m) ((RawResource Biological), (RawResource Biological))
calculateNewBio cost faction = MaybeT $ do
let currentBio = factionBiologicals faction
return $ if currentBio > 0
then Just $ ( cost
, RawResource $ max 0 (currentBio - unRawResource cost))
else Nothing
destroyCrops updates database with new amount of biological matter in store for the faction and records amount of destruction in CropsDestroyed. tell requires that we have Writer at our disposal and makes recording information nice and easy.
Final step is to roll a percentile die against given odds and see what happens. In case of Success, we record that worms were removed and value of function will be Just RemoveOriginalEvent. If we didn’t beat the odds, WormsStillPresent gets recorded and value of function is Just KeepOriginalEvent. Return value will then be used later to mark special event handled.
removeNews :: ( PersistStoreWrite backend, MonadIO m, BaseBackend backend ~ SqlBackend ) =>
PercentileChance -> MaybeT (WriterT [KragiiResults] (ReaderT backend m)) EventRemoval
removeNews odds = MaybeT $ do
res <- liftIO $ roll odds
case res of
Success -> do
_ <- tell [ WormsRemoved ]
return $ Just RemoveOriginalEvent
Failure -> do
_ <- tell [ WormsStillPresent ]
return $ Just KeepOriginalEvent
So result of this whole matter is:
( [KragiiResults], Maybe EventRemoval )
and whole lot of database activity.
Handling events during simulation
Pieces are now in place, time to put things in motion. When handling special events for a faction, first step is to load all unhandled ones and then call handleSpecialEvent for each of them.
resolveEvent resolves event based on choice user maybe made (this is what we explored earlier in the episode). Depending on the result of resolveEvent, event gets marked to handled and dismissed. In any case, a news article spelling out what happend is created and saved.
handleSpecialEvent :: (PersistQueryWrite backend, MonadIO m
, BaseBackend backend ~ SqlBackend) =>
Key Faction -> Time -> (Key News, SpecialNews) -> ReaderT backend m (Key News)
handleSpecialEvent fId date (nId, (KragiiWorms event _ choice)) = do
(removal, results) <- resolveEvent (nId, event) choice
_ <- when (removal /= Just KeepOriginalEvent) $
updateWhere [ NewsId ==. nId ]
[ NewsSpecialEvent =. HandledSpecialEvent
, NewsDismissed =. True ]
insert $ report fId date event choice results
Result article creation is abstracted by ResultReport type class. It has single function report that takes parameters: database key of the faction the event concerns of, current time, special event that was processed, choice that was made and list of records telling what happened during resolution. It will return News that is ready to be saved into database.
class ResultsReport a b c | a -> b, a -> c where
report :: Key Faction -> Time -> a -> Maybe b -> [c] -> News
quite long and verbose instance
essentially take event, choice and results and build a string explaining what actually happened
<> is monoid operation for combining things, here used for text
Instance declaration is pretty long, because there’s many different cases to account for and by definition they’re all pretty verbose. I have included it in its entirity below, as it might be interesting to glance over and see different kinds of combinations that resolution might create.
instance ResultsReport KragiiWormsEvent KragiiWormsChoice KragiiResults where
report fId date event choice results =
let
content = KragiiNews { kragiiNewsPlanetId = kragiiWormsPlanetId event
, kragiiNewsPlanetName = kragiiWormsPlanetName event
, kragiiNewsSystemId = kragiiWormsSystemId event
, kragiiNewsSystemName = kragiiWormsSystemName event
, kragiiNewsExplanation = repText
, kragiiNewsDate = timeCurrentTime date
}
in
mkNews fId date $ KragiiResolution content
where
repText = header choice <> " " <> removed choice (WormsRemoved `elem` results) <> " " <> injury <> " " <> destruction <> " "
header (Just EvadeWorms) = "Local farmers had chosen to work on their fields, while avoiding the kragii worms."
header (Just AttackWorms) = "Local farmers had decided to attack the worms with chemicals and burning."
header (Just TameWorms) = "Decision to try and tame the kragii had been taken."
header Nothing = "No decision what to do about worms had been taken."
removed (Just EvadeWorms) True = "After some time, there has been no new kragii sightings and it seems that the threat is now over."
removed (Just AttackWorms) True = "Attacks seem to have worked and there has been no new kragii sightings."
removed (Just TameWorms) True = "Kragii has been tamed and put into use of improving soil quality."
removed Nothing True = "Despite farmers doing nothing at all about the situation, kragii worms disappeared eventually."
removed (Just EvadeWorms) False = "Kragii are still present on the planet and hamper farming operations considerability."
removed (Just AttackWorms) False = "Despite the best efforts of farmers, kragii threat is still present."
removed (Just TameWorms) False = "Taming of the worms was much harder than anticipated and they remain wild."
removed Nothing False = "While farmers were debating best course of action, kragii reigned free and destroyed crops."
injury = if FarmersInjured `elem` results
then "Some of the personnel involved in the event were seriously injured."
else "There are no known reports of personnel injuries."
totalDestroyed = mconcat $ map (x -> case x of
CropsDestroyed n -> n
_ -> mempty) results
destruction = if totalDestroyed > RawResource 0
then "In the end, " <> pack (show (unRawResource totalDestroyed)) <> " units of harvest was destroyed."
else "Despite of all this, no harvest was destroyed."
While there are still pieces left that need a bit work or are completely missing, the overall structure is in place. While this one took quite a bit of work to get working, I’m hoping that the next special event will be a lot easier to implement. Thanks for listening the episode.
Easiest way to catch me nowdays is either via email or on fediverse where I’m tuturto@mastodon.social
Hosted by brian on 2019-02-12 is flagged as Explicit and released under a CC-BY-SA license. Tags:automotive.
Listen in ogg, spx, or mp3 format.
Comments (0)
a 914 shows up…
it has a 911 engine…
i check the oil…
the car lives…
Hosted by Tony Hughes AKA TonyH1212 on 2019-02-11 is flagged as Clean and released under a CC-BY-SA license. Tags:Linux Mint 19.1,utilities.
Listen in ogg, spx, or mp3 format.
Comments (0)
Good day to all in HPR land, this is Tony Hughes coming to you from Blackpool in the UK again. This is a second instalment about some of the software I use on Linux Mint 19.1, on a regular basis. So without further ado lets get on with the show.
USB Image writer
VirtualBox – Virtualisation software to virtualise x86 and AMD64 bit PC’s
OBS – Open Broadcast software
Brasero/XFburn – CD/DVD writing software
GIMP – GNU Image manipulation Program
So that’s it for this episode. I’ll be back to talk about some of the utilities I use on Mint on another show. This is Tony Hughes signing off for now.
Hosted by Ahuka on 2019-02-08 is flagged as Clean and released under a CC-BY-SA license. Tags:YouTube, Channels, Subscriptions.
Listen in ogg, spx, or mp3 format.
Series: YouTube Subscriptions | Comments (0)
I am subscribed to a number of YouTube channels, and I am sharing them with you
Yet another rambling attempt at making a show on the way into work
Hosted by MrX on 2019-02-07 is flagged as Explicit and released under a CC-BY-SA license. Tags:Podcast, Cars.
Listen in ogg, spx, or mp3 format.
Comments (0)
I came across this show sitting in my digital recorder I recorded it back in November 2017 but never posted it, my thoughts on some of the things I mention in this show have since evolved, I’ll stick these changed thoughts at the end of these notes and may also stick in an extra recorded section at the end of the show.
Here are the changes since I recorded this show in November 2017, it is now October 2018.
Think there was a £4,500 pound grant on new EV cars however it has been announced that this grant will in the near future will be cut to £3500.
I think the Government and Nissan together had a £2000 contribution scheme when you traded in an old car for a 2nd hand leaf I think this is no longer available now that the leaf is more popular.
Fuel costs have gone up and I may have miscalculated I think my true annual fuel bill is nearer to £2,000
Nissan leaf road tax is free
Because of supply and demand the depreciation situation has completely changed had I bought this leaf in November 2017 it would now be worth more today in October 2018. Only time will tell how it all pans out, things are changing rapidly.
After further investigation it looks like battery degradation is less than I first thought and would likely still be in pretty good condition at 6 years old, particularly in a cooler country like here in the UK in Scotland.
Klaatu and Lostnbronx build an RPG character in the d20 system of Starfinder
Hosted by klaatu on 2019-02-06 is flagged as Clean and released under a CC-BY-SA license. Tags:Starfinder,RPG,character,build.
Listen in ogg, spx, or mp3 format.
Series: Information Underground | Comments (1)
Klaatu and Lostnbronx spend an hour building an RPG character at a leisurely, and hopefully informative, pace. While the build process here is technically specific to the sci-fi (or science fantasy, really) game Starfinder, the idea is to convey the generic process of stepping through a character build instruction, cross-referencing important rules, and generally learning how to build a character in an unfamiliar system.
Hosted by JWP on 2019-02-05 is flagged as Clean and released under a CC-BY-SA license. Tags:SAP HANA,certification.
Listen in ogg, spx, or mp3 format.
Comments (0)
These are comments which have been made during the past month, either to shows
released during the month or to past shows.
There are 29 comments in total.
There are 8 comments on
4 previous shows:
hpr2629
(2018-08-30) "Thoughts on language learning part 3 - game/story mode."
by dodddummy.
Comment 2:
dodddummy on 2019-01-08:
"The Stanley Parable"
hpr2668
(2018-10-24) "Explaining the controls on my Amateur HF Radio Part 3"
by MrX.
Comment 3:
MrX on 2019-01-10:
"Re Comment 1 from Michael"
Comment 4:
MrX on 2019-01-10:
"Re Comment 2 from lostnbronx"
Policy decisions surrounding HPR are taken by the community as a whole. This
discussion takes place on the Mail List which is open to all HPR listeners and
contributors. The discussions are open and available on the HPR server under
Mailman.
The threaded discussions this month can be found here:
Google+ is going away on April 2nd. Everything is going to be deleted so backup your files before then.
Mad Sweeney wrote to inform us about https://dnsflagday.net/ Some “DNS software and service providers […] have agreed to coordinate removing accommodations for non-compliant DNS implementations from their software or services, on or around February 1st 2019”
Tags and Summaries
Over the period tags and/or summaries have been added to 11 shows which were without them.
Released: 2019-02-01. Duration: 00:07:18. Flag: Clean. Tags:linux,distro,distribution,pop_os,system76,ubuntu.
In this episode, Yannick does a quick review of Pop OS 18.10
Released: 2019-01-29. Duration: 00:23:01. Flag: Clean. Tags:audio, vintage audio, stereo components, audio tape, recording.
An intro to more of my legacy audio equipment.
Released: 2019-01-28. Duration: 00:18:24. Flag: Explicit. Series:Bash Scripting. Tags:Bash,ShellCheck.
Some suggestions on how to improve a Bash script
Released: 2019-01-25. Duration: 00:02:18. Flag: Clean. Series:Cooking. Tags:Food, cookery, how to, food preparation.
A short episode on a common cookery technique
Released: 2019-01-23. Duration: 00:47:17. Flag: Clean. Tags:haskell, yesod.
tuturto talks about the game they're writing in Haskell and convoluted news system they made.
Released: 2019-01-22. Duration: 00:28:12. Flag: Explicit. Series:Information Underground. Tags:story, character, plot, writing.
Telling a story? want a reaction? USE THE FORMULA
Released: 2019-01-21. Duration: 00:26:19. Flag: Clean. Tags:retro,BBC,8bit,assembler.
I got a new, old computer for Christmas - an Acorn BBC microcomputer model B.
Released: 2019-01-18. Duration: 00:11:28. Flag: Explicit. Tags:GraphicsMagick, ImageMagick, VCard, Android, LinageOS.
Automating the steps needed to get images formatted for VCard import into Android phones
Released: 2019-01-16. Duration: 00:13:34. Flag: Clean. Series:Random Elements of Storytelling. Tags:stories,storytelling,narration,lostnbronx.
Lostnbronx looks at unreliable narrators and narrative techniques in stories.
Released: 2019-01-15. Duration: 00:07:47. Flag: Clean. Series:Privacy and Security. Tags:Information Security for Everyone.
How to do passwords better.
Released: 2019-01-14. Duration: 00:20:49. Flag: Clean. Tags:kodi, deluge,Sonarr,Plex,Subsonic,SpiderOakONE,Zoneminder,Borg Backup,rclone,Redshift,Audacity.
I go over a high level of my notes for the software on my Media box as it relates to TV/Movies/Music
Released: 2019-01-10. Duration: 00:09:09. Flag: Explicit. Tags:3D printing,DIN rail,Raspberry Pi.
I created DIN rail fittings for attaching my RPi 3B+ and an SSD disk
Released: 2019-01-07. Duration: 01:10:47. Flag: Explicit. Series:HPR Community News. Tags:Community News.
HPR Volunteers talk about shows released and comments posted in December 2018
Released: 2019-01-04. Duration: 00:24:07. Flag: Explicit. Tags:youtube, youtube-dl, channels, playlists, xmlstarlet.
Ken shares a script that will allow you to quickly keep up to date on your youtube subscriptions
Released: 2019-01-02. Duration: 00:12:30. Flag: Clean. Tags:stories,storytelling,genre,lostnbronx.
Lostnbronx takes a look at the importance of genre in storytelling.
Released: 2018-12-31. Duration: 00:07:21. Flag: Clean. Tags:RSS, YouTube, PeerTube, TInyTinyRSS, Internet Video.
Thaj explains how he makes YouTube come to him using RSS feeds
Released: 2018-12-28. Duration: 00:10:18. Flag: Explicit. Series:Networking. Tags:Networking,ONAP,Open Networking Automation Platform.
The Linux foundations ONAP project all about it
Released: 2018-12-24. Duration: 00:05:36. Flag: Clean. Tags:raspberry pi, review.
In this episode of HPR, I will do a quick review of the Raspberry Pi 3A+.
Released: 2018-12-21. Duration: 00:14:04. Flag: Explicit. Tags:youtube, youtube-dl.
A followup to hpr2675 how you can download an entire youtube channel for local playout
Released: 2018-12-18. Duration: 00:14:24. Flag: Clean. Tags:Steganalysis, steganography.
Steganalysis is the process of identifying the presence of, and decrypting, steganography.
Released: 2018-12-17. Duration: 00:28:34. Flag: Explicit. Tags:as400, ibm, computing, midrange.
A short talk about how I came to love the IBM As/400 systems and why.
Released: 2018-12-14. Duration: 00:16:53. Flag: Clean. Series:Health and Healthcare. Tags:Health, Medicine, Evidence, Science.
Medicine should be based on objective scientific evidence
Released: 2018-12-13. Duration: 00:39:40. Flag: Clean. Series:Privacy and Security. Tags:design, steganography, scribus, layout.
Klaatu provides an overview of Scribus in part 1 of a mini-series about steganography
Released: 2018-12-10. Duration: 00:32:06. Flag: Clean. Series:Hobby Electronics. Tags:Odroid-go.
I ramble on about my first impressions of the odroid-go