2.24.2020

Tech Book Face Off: Programming Elixir ≥ 1.6 Vs. Metaprogramming Elixir

Since I wasn't quite satisfied with the first Elixir book I read, and I wanted to learn more about this rich, complex programming language, I selected a couple more books to help me explore the more advanced aspects of Elixir. The first selection, Programming Elixir ≥ 1.6 by Dave Thomas, promises to cover all of the major parts of Elixir with a clean, well-written book from the coauthor of the excellent The Pragmatic Programmer. The second selection, Metaprogramming Elixir by Chris McCord, focuses on the ways that a programmer can write code to write code in Elixir, always a fascinating endeavor. Both of these books are again by The Pragmatic Programmers publishing company, since I've been mostly pleased with the books they put out. I might just have another of their books waiting in the wings for a review later this year, but let's take a look at how these two Elixir books stack up.

Programming Elixir ≥ 1.6 front coverVS.Metaprogramming Elixir front cover

Programming Elixir ≥ 1.6

This book is pretty much exactly what I expected it to be. Dave Thomas is an excellent writer who is able to explain difficult programming language concepts with an ease and fluidity that is a joy to read. His writing speaks in a way that feels entirely natural, and he gives the distinct impression of a father explaining how things work to his kids. That's a compliment; I don't mean that he lectures in a patronizing way. I mean that it's comfortable and completely understandable in the same way that your dad showing how to change the tires on a car or how to throw a baseball would be. He's good at it, and his writing flows off the page and into my head almost effortlessly.

At the same time that this book is easy to understand, the explanations are concise because Thomas has a lot to cover while keeping his promise of not making the book as long as his Programming Ruby book. He jumps right in with chapters on pattern matching and immutability, two of the main features of Elixir that will be used constantly when programming in it. Then he runs through the basics of the base types and operators in Elixir, as well as anonymous and named functions.

Next, lists and recursion are introduced together since they are inseparable in a functional language, followed by the rest of the compound data types: maps, keyword lists, sets, structs, strings, and binaries. Thomas really brought out the mystique of using lists and recursion here:
At this point, part of your brain is telling you to go read today's XKCD—this list stuff can't be useful. Ignore that small voice, just for a second. We're about to do something magical.
He goes on to show how easily values can be pulled out of lists using pattern matching, and things progress from there. The main way to process these compound data types with the Enum and Stream modules is covered at this point in the book, and other control flow structures were put off until after the more important declarative programming methods were covered. While if, cond, and case structures are still used in Elixir, they're just not as important as pattern matching and multi-headed functions.

With most of the syntax and basic features of Elixir out of the way, we're ready to tackle a non-trivial example project, so Thomas takes us through building a little application that accesses GitHub and builds a table of code repository issues for a given URL. It's a nice project to show off most of what we've learned so far before heading into the more advanced Elixir features. The more advanced features being concurrent programming with multiple processes, OTA, tasks, and agents. This was the stuff that was missing from Learn Functional Programming with Elixir, and it was covered well here. Normally, processes are a heavy-handed solution to the concurrent programming problem, but Thomas explains why Elixir is different:
[T]he cool thing about Elixir is that you write your code using lots and lots of processes, and each process has its own heap. The data in your application is divvied up between these processes, so each individual heap is much, much smaller than would have been the case if all the data had been in a single heap. As a result, garbage collection runs faster. If a process terminates before its heap becomes full, all its data is discarded—no garbage collection is required.
There's an incredible amount of power in the concurrent programming features of Elixir built on the solid foundation of the Erlang VM, and Thomas does a great job of explaining how each of them work and why you would choose to use OTA or agents or tasks in different situations.

The last few chapters of the book go into metaprogramming with macros, behaviors, protocols, and writing your own sigils. The one thing I thought suffered a little in this part was the examples. Throughout the book most of the examples were short and sweet, simply to show the syntax and how working code would be written with the newly introduced features, but with metaprogramming it's hard to understand exactly why you would want to use it if the examples are too simple and useless. To get a good understanding of when and why you would use metaprogramming requires a motivated example that shows how some tedious, verbose, ugly code can be transformed into a succinct, dynamic, beautiful piece of code that writes code. That type of example was missing from the metaprogramming section.

Setting aside that one complaint, this book was an excellent overview of Elixir from the basics of the language to the advanced concurrent programming features that make it such a compelling language for modern multi-core processors. If you need to learn Elixir well enough to start writing solid concurrent applications, or even are just curious about an entirely different and powerful way to program, Programming Elixir ≥ 1.6 is definitely worth checking out.

Metaprogramming Elixir

Whereas Programming Elixir ≥ 1.6 was a general tour of Elixir, this book focused on one specific feature of Elixir: metaprogramming. Luckily, this is the feature that was least well described in Programming Elixir ≥ 1.6, so having an entire book on it proves quite helpful. Metaprogramming Elixir is also a relatively short book, clocking in at just over 100 pages of real material, and it was a quick read.

What made the read even quicker was the fact that most of the coding examples were repeated within and between chapters, resulting in a few core examples that were extended multiple times with different metaprogramming features. This method worked great for instruction, since later examples were immediately familiar, even though it tended to pad the page count of the book. If not for the repetition, this book could have been 70 pages or less.

That's not to say it's a bad thing that the book is so short and contains a fair amount of repetition. I found the explanations to be extremely clear and easy to read. The code examples were well thought out and served their purpose in showing how to use all of the metaprogramming features, as good examples should do. Everything fit together nicely, and the chapters had a smooth flow, developing from basic macros into an advanced DSL example.

This development is split into six chapters, starting with an introduction to Elixir macros and the abstract syntax tree (AST). Similar to Lisps, Elixir code is represented as an AST that is accessible at compile time, and it can be easily changed and added to while compiling. With this power comes the tendency to over-engineer, and McCord offers up some clear warnings about overusing it:
It's easy to get caught in our own web of code generation, and many have been bitten by reckless complexity. When taken too far, macros can make programs difficult to debug and reason about. There should always be a clear advantage when we attack problems with metaprogramming. In many cases, standard function definitions are a superior choice if code generation is not required.
These warnings are sprinkled throughout the book for the various metaprogramming features. Each feature gives the programmer more power to change code at will, but at the risk of making the code an opaque, untestable maintenance nightmare. The judicious use of metaprogramming can neatly solve otherwise tedious problems, but it should only be used when necessary.

Chapter 2 gets into how nearly all of Elixir can be changed and extended with metaprogramming. The core of the language is quite small, and most of the language that's used is implemented with macros already, even the basic if expression. The example in this chapter shows how easy it is to create a unit test library using macros, and McCord takes the opportunity to discuss some metaprogramming best practices:
This [example] also highlights an effective approach to macros, where the goal is to generate as little code as possible within the caller's context. By proxying to an outside function, we keep the code generation as straightforward as possible. As you'll see later, this approach is pivotal to writing maintainable macros.
It also makes it much easier to test the macros, since most of the code will be contained in functions that you can call from tests and see what's going on, instead of trying to posit what all of the generated code looks like.

Chapter 3 shows how to use macros to generate code from data, both through reading from a file and from a web API. Not only is this ability slick as hell, it's highly performant because the code is generated only once at compile time and then during runtime it's all internal function calls—no latency-ridden I/O. The benefits of this approach cannot be emphasized enough:
Let sink in for a moment what we just accomplished in 20 lines of code. We hit a remote JSON API over the Internet and embedded the data directly into a module as functions. The API call only happens a single time when the module is compiled. At runtime, we have the GitHub data cached directly within function definitions. While just a fun example, it really shows how Elixir lends itself to extension.
The next few chapters round out the book, with chapter 4 focusing on how to test macros, followed by an extended example of writing a DSL to generate HTML code directly from Elixir syntax instead of parsing a template language, and finishing with a short chapter on some final tips, tricks, and warnings on metaprogramming in Elixir.

Metaprogramming Elixir was at the same time complete and accessible. It was short and sweet, and an excellent companion to Programming Elixir ≥ 1.6. It filled in the only real gap in the latter book, and helps give a real appreciation for one of Elixir's best features. Along with pattern matching, immutable functions, and rock-solid concurrent programming, metaprogramming makes Elixir a fascination language for a whole host of modern day back-end programming. These two books will help you get up to speed with this powerful language, and let you have some fun with that new-found power.

2.23.2020

5 GAMES FOR SEPTEMBER

https://collectionchamber.blogspot.com/p/3d-ultra-nascar-pinball-aka-3d-ultra.html https://collectionchamber.blogspot.com/p/bat-ii-koshan-conspiracy.html https://collectionchamber.blogspot.com/p/cybermage-darklight-awakening.html https://collectionchamber.blogspot.com/p/hi-res-adventures-0-6.html https://collectionchamber.blogspot.com/p/simfarm.html

There are actually 12 games in September's monthly 5 if you include ports and compilations so it'll keep you busy as Autumn officially rolls in. First up is the 4th 3D Ultra Pinball game; the stock car themed 3D Ultra NASCAR Pinball. Next is the cyberpunk stylings of B.A.T. II: The Koshan Conspiracy, the bigger-budgeted sequel to last months adventure/RPG hybrid. The legendary developers at ORIGIN added some fantasy to their cyberpunk in the ahead-of-its-time FPS CyberMage: Darklight Awakening. Then travel back in time to a compilation of early Sierra graphical text adventures under the Hi-Res Adventures banner, including the official tie-in to The Dark Crystal film (damn, that Netflix prequel show was good!). Then, tend to a farm in another entry into Maxis' Sim series in the aptly titled SimFarm.

Read more »

2.21.2020

Blender 2.80 Released, Gets Industry Sponsorship


The amazing libre 3D modeling tool Blender needs no introductions at this point. Suffice to say that what began as a humble Free Software alternative to most heavy-duty proprietary 3D software is slowly becoming a new industry standard. The newly released version 2.80 is a testimonial of this.

The new release adds not only a much needed upgrade to the UI, but along comes an improved real time renderer and much more. All new features and improvements can be checked here.


Finally, some of you might have already heard in the past few weeks the gaming industry titans Epic Games and Ubisoft have officially began sponsoring the Blender foundation with grant funds. These are welcoming news since it means Blender will only see better and more regular updates from increased sources of income. Even if the money comes from proprietary software business, libre developers alike can also reap the benefits.

Blender can be downloaded for free on its official download page.

Code license: GPLv2

Via GamingOnLinux.

Got comments? Post them on our forum thread.

2.20.2020

Oceanhorn On Nintendo Switch - OUT NOW!


Today, Oceanhorn is being released on Nintendo Switch!



Nintendo Switch is an amazing video game console and when I first got my hands on it, I immediately fell in love with it. The ability to go from portable mode to TV works flawlessly, and it all comes down to the genius design of the console. Nintendo has nailed the screen size of the device, to diminish the disparity between the modes – making sure the same game works perfectly on both modes. We investigated a lot of this when we ported a portable game (iPhone, iPad) to the big screen for PC and consoles and it is not as simple as it sounds. People have different expectations when it comes to big screen titles.

Oceanhorn on Switch is probably the most definite version of the game. The game is based on the remastered PC version of Oceanhorn and you can play it in both portable and TV mode. The game runs beautifully 60 fps / 1080p in docked mode and equally impressively 60 fps / 720p in portable mode. The game includes an amazing soundtrack from the industry legends Nobuo Uematsu and Kenji Ito, and our own brilliant composer Kalle Ylitalo. Voice talents range from Ray Chase (Final Fantasy XV, Noctis) and Kevan Brighting (Stanley Parable, Narrator) to Fryda Wolf (Mass Effect Andromeda, Sara Ryder). We could not be more excited to give Nintendo fans a chance to enter the world of Oceanhorn.

Oceanhorn on Switch is probably the most definite version of the game.

From the personal perspective of a small indie developer, this moment feels historical. Like many others, I grew up with Nintendo consoles and games, and this Kyoto-based company will always have a special place in my heart. Nintendo has played a crucial part in the history of video games ever since the dawn of home consoles, and they keep setting the standard for video game entertainment from one decade to another.

From this love and admiration, comes my driving force to cherish the experiences I had in my childhood. I got into making video games, because of the ever-inspiring experiences such as Final Fantasy, Chrono Trigger, Secret of Mana, and Zelda.

Oceanhorn is a game for the Nintendo fans, because it was made by a bunch of them. We are well aware that it is a smaller title and a different title from many of the console experiences that inspired it – but I truly believe that we were able to capture some of the essence of the classics in this game, as well as establish Oceanhorn as a franchise of its own.

Have a great adventure, Switch owners!

Heikki Repo
The creator of Oceanhorn

Need For Speed Games Part 3: Need For Speed: Porsche 2000 (Aka Porsche Unleashed)

This week on Super Adventures, I've been playing through all the Need for Speed games released during their first decade. Well maybe not all of them, I'm sure there's one I've accidentally skipped, because they just kept making the things! There are more Need for Speed games than there are Bond movies at this point. Well, kind of. It depends on whether you count games like Need for Speed: V-Rally and Over Drivin' Skyline Memorial. Or if you count games like Porsche 2000, Porsche 2000 and Porsche 2000.

Speaking of which, today I'm writing about Need for Speed: Porsche 2000, also known as Porsche Unleashed, or sometimes just Porsche. Once again the US version has the better name, as I don't think a game has any business having '2000' in its title when it actually came out during the year 2000. FIFA 2000 coming out in 1999, that's fine. Death Race 2000 coming out in 1975, that's cool too. But this I don't like.

This is the third part of four. If you want to go back to an earlier part you can find them here and here.

(If I don't mention what system a screenshot came from, it's from the PC version.)

Read on »

OSR Like A Fucking Boss


I decided to go ahead and fucking do it!  ;)

This is the link.

Hope you enjoy this quick and dirty foray into the OSR, from my perspective, that is.

Definitely spread the news around social media.  Thanks!

VS

2.19.2020

Shining Spears And Other Euphemisms

The Falcon turrets are nearly ready for paint, in the meantime I've been working on the Shining Spears. The white and blue is finished on these guys, just the metal, gems and decals left to go.

Epic Eldar Shining Spears Epic Eldar Shining Spears Epic Eldar Shining Spears Epic Eldar Shining Spears

DE: Black Heart Might Be The Best Kabal

At first, I was afraid, I was petrified.

That's right folks, you heard it here first.  While I was balls deep in Flayed Skull in the beginning of all the rumors and previews, but now I think I might be some kind of Black Heart convert.  OK, hear me out, I can justify it I think.

Here is my reasoning:
  • The 6+++ bonus literally affects everything, from flesh to metal, right from the get-go to the rest of the game.  You always have it.
  • You don't need additional Archon tax to access the best Strategems, Warlord traits and artifacts in the book.  Instead of paying Archon tax, you're one step closer to buying a Warrior unit in a Venom.
  • With the improvement to our weapons, our damage certainly went up for the points. However, one thing remains unchanged and that's our durability.  Spirit Stones on everything will help keep our important pieces alive longer so we don't attrition as hard.
  • The Living Muse artifact makes that one Archon the single biggest damage amplifier in the codex (gives all Black Heart units within 6" of the Warlord re-roll 1s to Wound).  It affects every weapon type and is super good, but you have to walk around like a baller.

Just one little note about Writ of the Living Muse:  It's a huge damage amplifier but keeping everything that I can within 6" of the damn Archon might be a huge challenge.  It also makes that particular HQ a huge pain in everyone's ass and everyone is going to be gunning for him.  However, I'll just have to play him well and use all the long-range firepower that I have to really deliver some results in the opening phases of the game.  Otherwise, I'm kind of screwed!

Now when I look back at Flayed Skull, I think that the 3" extra move is the single best bonus it provides.  The re-roll 1s for Rapid Fire only really kick in with Splinter Rifles and if I'm not taking many Venoms or Warriors double-tapping, I'm not getting the best out of it.  The ignore cover part is also really nice since there's always some crap out there like CW Rangers, but I've been thinking back to all the 8th games where cover was game-changing.  Can't really think of times where it decided the game if I'm to be honest.

With that being said, I could argue that Agents of Vect and Labyrinthine Cunning was enough to win me over, but the sustained durability of all our units really did it for me.  Not paying additional Archon tax means that I can fit in more units and I think my next game will be full Kabal of the Black Heart.

Case in point, I'm going to roll with this in my Weds game this week:

2000 // 7 CP
Black Heart Battalion +3 CP

HQ:
Archon, Agonizer, Blaster = 91
Archon, VB, Blaster = 89

TROOP:
5x Warriors, Blaster = 47
Venom = 65
112

5x Warriors, Blaster = 47
Raider, Dark Lance = 85
132

10x Warriors, 2x Blaster, Dark Lance = 114
Raider, Dark Lance = 85
199

10x Warriors, 2x Blaster, Dark Lance = 114
Raider, Dark Lance = 85
199

10x Warriors, 2x Blaster, Dark Lance = 114
Raider, Dark Lance = 85
199

10x Warriors, 2x Blaster, Dark Lance = 114
Raider, Dark Lance = 85
199

HEAVY:
Ravager, 3x Dinsintegrators = 125
Ravager, 3x Dinsintegrators = 125
Ravager, 3x Dinsintegrators = 125

+++

Black Heart Air Wing +1 CP

FLYER:
Razorwing, 2x Dinsintegrators = 135
Razorwing, 2x Dinsintegrators = 135
Razorwing, 2x Dinsintegrators = 135

>>>

Firepower:
15 Disintegrators at BS3+
9 Dark Lances at BS3+
10 Blasters at BS3+
2 Blasters at BS2+
1 Splinter Cannon at BS3+
44 Splinter Rifles at BS3+
3 Razorwing Missiles at BS3+

If you look at the firepower arrangement of this list compared to the other ones I've poured out over the last couple of days, I think this is the most optimized and most balanced.  I got my command Raider where my Archons can go chill and I'm able to fit an extra Venom in there due to the points gained from not having a third detachment.  This also allowed me to take 4x full gunboats instead of the previous 3 while still having my 3/3 ratio of Ravagers and Razorwings.

I think tomorrow, I'll talk about shoving Wyches into someone's face at the start of the game because why not.  It only costs 160 points for 20 of them and Succubi are much cheaper now!

2.13.2020

Brave Browser the Best privacy-focused Browser of 2019



Out of all the privacy-focused products and apps available on the market, Brave has been voted the best. Other winners of Product Hunt's Golden Kitty awards showed that there was a huge interest in privacy-enhancing products and apps such as chats, maps, and other collaboration tools.

An extremely productive year for Brave

Last year has been a pivotal one for the crypto industry, but few companies managed to see the kind of success Brave did. Almost every day of the year has been packed witch action, as the company managed to officially launch its browser, get its Basic Attention Token out, and onboard hundreds of thousands of verified publishers on its rewards platform.

Luckily, the effort Brave has been putting into its product hasn't gone unnoticed.

The company's revolutionary browser has been voted the best privacy-focused product of 2019, for which it received a Golden Kitty award. The awards, hosted by Product Hunt, were given to the most popular products across 23 different product categories.

Ryan Hoover, the founder of Product Hunt said:

"Our annual Golden Kitty awards celebrate all the great products that makers have launched throughout the year"

Brave's win is important for the company—with this year seeing the most user votes ever, it's a clear indicator of the browser's rapidly rising popularity.

Privacy and blockchain are the strongest forces in tech right now

If reaching 10 million monthly active users in December was Brave's crown achievement, then the Product Hunt award was the cherry on top.

The recognition Brave got from Product Hunt users shows that a market for privacy-focused apps is thriving. All of the apps and products that got a Golden Kitty award from Product Hunt users focused heavily on data protection. Everything from automatic investment apps and remote collaboration tools to smart home products emphasized their privacy.

AI and machine learning rose as another note-worthy trend, but blockchain seemed to be the most dominating force in app development. Blockchain-based messaging apps and maps were hugely popular with Product Hunt users, who seem to value innovation and security.

For those users, Brave is a perfect platform. The company's research and development team has recently debuted its privacy-preserving distributed VPN, which could potentially bring even more security to the user than its already existing Tor extension.

Brave's effort to revolutionize the advertising industry has also been recognized by some of the biggest names in publishing—major publications such as The Washington Post, The Guardian, NDTV, NPR, and Qz have all joined the platform. Some of the highest-ranking websites in the world, including Wikipedia, WikiHow, Vimeo, Internet Archive, and DuckDuckGo, are also among Brave's 390,000 verified publishers.

Earn Basic Attention Token (BAT) with Brave Web Browser

Try Brave Browser

Get $5 in free BAT to donate to the websites of your choice.