Web development

How to Create an On-Demand Feature for Your Alexa Skill

Submitted by Danny on Fri, 07/02/2021 - 13:18

As 2020 was coming to a close and 2021 was just around the corner, I was finishing development of a new version of our skill for the Alexa smart speaker. It was a total re-write, and it changed the skill from being able to perform only a single intent (play our live stream) to providing a dialog-based menu of many intents to choose from. With the new skill, listeners can choose to either play our live stream, play our HD2 live stream, play the latest newscast recording, or play an on-demand. (One day I would like to add another intent: make a donation.)

How to use versioning with AWS Lambda and Alexa Skills Kit (ASK), a step by step guide

Submitted by dannix on Fri, 04/05/2019 - 14:15

I learned a valuable lesson on the morning after submitting my latest Alexa skill for certification. I had an email from the Alexa certification team letting me know that their tests had failed. I thought that was odd because everything was working perfectly fine when I left work the previous day. I was using AWS Lambda to host the back-end code (within a Node.js environment) and hadn't set up the versioning system because I didn't know about it. [update: I'm now using the AWS CLI to locally host my code and push it to Lambda, which is what I recommend.

Make your own conditional fields in Drupal 7 by "hacking" the hook_form_alter() function with JavaScript injection

Submitted by Danny on Fri, 04/14/2017 - 16:44

When I needed a conditional field for a Drupal 7 content type, of course I just googled "drupal conditional fields" to see if a module exists. One did exist, but its D7 release came with a big, red flag warning any would-be downloaders that it's not supported any longer and is vulnerable to security issues. Instead of risking it on the entrerprise-level website, I decided to code up a solution myself. And I would use JavaScript inserted by the PHP code. Easy!

Exporting/migrating a Joomla website to Drupal7, with code

Submitted by Danny on Thu, 05/19/2016 - 14:16

After building the new webiste for Kansas Public Radio using Drupal 7, I needed a way to export all of the old articles from our Joomla website to the new website. I could have experimented with the Feeds module for Drupal or another Joomla to Drupal solution, but our installation of Joomla was sooooo old and outdated that I couldn't trust anything. I decided to write my own bit of code.

The Reviews are In: Functional Programming in JavaScript "is AWESOME"

Submitted by Danny on Thu, 08/06/2015 - 12:57

From the very beginning, the goal with Functional Programming in JavaScript was to strip the veneer off the language to expose its inner beauty and functional roots, a necessary step in helping the reader to fully understand both the language and the functional programming paradigm. And now that some reviews are coming in, it appears that the goal has been met.

Creating Podcast XML from Drupal content

Submitted by Danny on Thu, 07/09/2015 - 13:11

I needed to create some podcasts for Kansas Public Radio, which uses the Drupal Content Management System (CMS). I couldn't find a satisfactory Drupal module that could create the RSS data that iTunes needs, so I had to come up with my own solution. IIRC, Drupal Feeds would have worked great but iTunes needs specific XML tags (i.e. <itunes:description>, <itunes:category>, etc) that Drupal Feeds couldn't provide. I also dried Drupal Views PHP but it was too buggy and I also couldn't get the code to output outside of the template.

I think I wrote a book: Functional Programming in JavaScript

Submitted by Danny on Thu, 04/23/2015 - 14:56

You never know where life will take you. It may take you rock climbing in Argentina, it may take you to a farm in Nebraska, it may take you to a high-rise building in San Jose. Starting in October 2014, life took me (or, my name at least) to a publishing company in Birmingham, United Kingdom. A colleague of mine, Trent Hauck, wrote a book for the same publishing company and asked me to be a technical editor. I said sure! Little did I know that the experience would end up with me writing a book of my own.

Functional Programming in JavaScript by Dan Mantyla

Using Javascript/jQuery to check if offsite file exists with given URL

Submitted by Danny on Thu, 10/09/2014 - 15:30

So I needed to see if an MP3 was successfully uploaded to our streaming server, and display the status on our website where our user's access the upload form. However, I ran into some issues with Access-Control-Allow-Origin access headers and with just how to acquire the status code. It always fails, whether or not the file does exists, because the browser doesn't allow XMLHttpRequest from a different domain to try and prevent cross-site-scripting. The solution? Using the JSONP datatype, a sort of consensual cross-site scripting hack!

How to add Google Web Fonts directly to your stylesheet

Submitted by Danny on Mon, 05/19/2014 - 12:15

If you're using a CMS such as Drupal or Wordpress, it's not possible to add the link tag for the css file that google provides you&ndash; i.e. <link href='http://fonts.googleapis.com/css?family=Oswald:400,700,300' rel='stylesheet' type='text/css'>&ndash;without installing a module that would allow it (and who wants another module to maintain?). Here's a quick workaround I discovered that makes it really easy to simply add the css code you need directly to your stylesheet.

Inspect and save apache request headers

Submitted by Danny on Tue, 04/22/2014 - 13:07

I wrote this function because one of our web apps that was communicating with our web server suddenly began receiving Error 406: Not Acceptable (The requested resource is only capable of generating content not acceptable according to the Accept headers sent in the request). So I inserted this bit of code to capture exactly what that accept header was and see if we could fix the problem. It writes the output to a file on the webserver.

Why You Should Not Use WYSIWYG Website Editors

Submitted by Danny on Tue, 12/03/2013 - 15:20

I built a perfect, beautiful, wonderful website using the Drupal CMS, Amason S3 and CloudFront for Atipa Technologies. Everything worked flawlessly and looked amazing. After I left the company, they decided to duplicated the work of a real web developer with one of those WYSWYG website editor (Adobe Muse by the looks of the source code). The result, as you can see, is pitiful. An uninspired child could make a better website than that. For shame...