Posts

Showing posts from 2017

Know your options - 1 minute read

I just read a post from another developer about front-end frameworks and whether or not they're worth the trouble.  The conclusion: they're worth the trouble sometimes.  The best solution is to know your options and use them when appropriate.

There’s a solution for that! It's called, 'lots of time.' – 2 minute read

Image
One of the best investments that I made this year is a subscription to www.safaribooksonline.com ,   an online  l ibrary for technical books.    I’m working my way through the videos for Querying Data with Transact-SQL - Exam 70-761 Certification Training by Mark Long.   I got a good laugh from one of his comments: while talking about how important it is for database developers to have a good knowledge of the data that they’re working with, he said, “There’s is a solution for that!   It’s called ‘lots of time.’    After you spend lots of time with your data set, you get to know it better and better and become more proficient.” Well, I recently had a slightly different problem:   I wanted to install Node.js 8.9.1 (the current LTS version) on my Ubuntu laptop.    Since most of my OS knowledge is on Windows, I simply wasn’t able to get it to work. Then I remembered Mark’s wisdom: “There’s is a solution for that!   It’s called ‘lots of time.’”   I spent a couple of days learnin

More time coding. Less switching windows. - 1 minute read

Gulp has come through for me.  Here's a gulpfile that will save you some time toggling back and forth between your IDE and the command line: const gulp = require ( 'gulp' ); const cp = require ( 'child_process' ); gulp . task ( 'runTestsOnChange' , function runTestsOnChange () { gulp . watch ([ '**/*.js' ], function () { console . log ( 'change detected' ); try { cp . execSync ( 'jasmine' ,{ //set current directory to the child process' current working directory cwd: __dirname , //the child process will use the parent's stdin, stdout and stderr streams stdio: [ 0 , 1 , 2 ]}); } catch ( error ) { console . log ( 'Looks like your tests did not pass. No worries. Keep working!' ); } }); // gulp.watch(['**/*.js'], ['jasmine']); }); gulp . task ( 'default' ,[ 'runTestsOnChange'

Computers should do what people want them to do - 1 minute read

Sometimes I spend time (perhaps too much time) tweaking my computer.  I do this because computers should do what people want them to do.   Customization and personalization are important when it comes to the tools that we use every day. I have an Automator script that delays the startup of some applications that I commonly open.  Slack is one of these applications. I am frequently using my computer after-hours (tweaking code and researching), and I found that I got annoyed when Slack opens at those times because 1) I  don’t usually want to the interrupted at those times and 2) Slack is a leviathan application that takes an excessive amount of time to load.  So I wrote my first AppleScript to fix that problem.  I chose AppleScript because dealing with dates in bash is more difficult than it needs to be and Automator can run AppleScripts. Here it is: enjoy! --based on https://stackoverflow.com/questions/25334780/how-to-start-an-applescript-at-a-specific-time --Open Slack if

Serendipity - 1 minute read

Image
I'm always looking to get lucky.  My latest project is a website that that finds healthy food near people.   https://github.com/tmurphree/healthy-near-me   I thought I would     have to do a mash up of the Google Places API and the Nutririonix API (which has nutrition information), but apparently this is such a common use case that Nutririonix has a beta API end point for this. https://www.nutritionix.com/restaurant-map?c=38.8983:-77.0273:15   I guess the question is now, is the project worth doing? I think so. The whole point of the exercise is to deliver value to the end user. If that happens, then it’s worth doing.  Plus, depending on the quality of the endpoint, it may need augmenting anyway.  I'll post my progress as things develop!

Automatically running tests on your back-end Node.js code - 1 minute read

--deprecated: this only works intermittently-- Building something for the front-end and want to run tests on your code automatically?  Use Karma ( http://karma-runner.github.io/1.0/intro/configuration.html ).  It'll run tests in web browsers when you save your .js files. But what if you're building for the back end and don't want to run the tests in browsers?  I'm assuming that you already have nodemon installed and don't want to muddle up your Grunt / Gulp / other automation modules. Use nodemon. The general syntax is:    nodemon --watch <folder> --exec <command> For example:    nodemon --watch js/ --exec ./node_modules/.bin/jasmine

"Never miss a good chance to shut up" - 1 minute read

Image
I'm reading Duty  by Robert Gates, former Secretary of Defense under George W. Bush and Barack Obama, and it's an interesting read.  One of the more memorable quotes so far in the book is that, while regretting some comments that he made to the press, Gates moans that he forgot one of the more important rules in life: "Never miss a good chance to shut up." Although probably more applicable to Secretary of Defense than to you and me, it's still good advice for you and me. The book has left me with more patience for elected officials.  The number of complex issues that they have to deal with -- simultaneously -- it truly staggering.

JavaScript lessons learned - 1 minute read

Here’s a lesson I learned the hard way. When using Date.parse(), use this format: Date.parse(‘03 Nov 2020 00:00:00 +0000’);.  Even better, if you don’t need time zone information use Date.UTC (e.g. Date.UTC(2020,11,3,00); so there’s no chance for ambiguity). **Why?** This works on some browsers: Date.parse(‘11-03-2020’).  It’ll probably work on your desktop.  But it *won’t* work consistently, especially on mobile, and it’s a pain to troubleshoot.

Delay startup items on a Mac - 2 minute read

I like Slack, but it's taking up too many resources on startup (maybe I should have gotten the SSD . . . ). I'm all about making things work automatically and better, so here's how to save yourself some clicking: Open Automator. Set the document type to 'application.' Under Actions / Utilities, add a Pause step. Under Actions / Utilities, add a Launch Application step. Save the automation to your Applications directory. Set the automation you just made to run at startup  ( System Preferences -> Accounts -> Login items). That's it!

New gear - 1 minute read

Image
I just got a sit / stand desk from Ikea.  It cost about $500, but if it'll help me stay in shape I say it's worth it! http://www.ikea.com/us/en/catalog/products/S79022508/

Assimilation is inevitable - 1 minute read

I learned two things the hard way today: If you want to develop for iOS, it's fastest and easiest to use a Mac.  I'm a Windows guy at heart, and a new job needs me to be able to write code using the Ionic framework for iOS.  Just get a Mac: even the Ionic support team says it's the best way .  Don't tell your wife, "No, I don't need a new computer for this new project" until you're absolutely , positively , 100% SURE. Off to buy a new computer and some flowers . . . :)

Checklists gone horribly wrong - 1 minute read

I was reading this post on Medium today, and it ends with the following call to action: Are you proactive? If so, check out my 7-page checklist of the most effective morning activities. Seven pages!!??  Really?  That's a travesty.  Checklists are awesome when done right: they save lives in the operating room and make complex operations like flying an airplane routinely successful, but nobody  can live with a seven-page checklist.  For a surprisingly good read on checklists and how to use them, read The Checklist Manifesto by Atul Gawande.

How is an application like a bride's outfit? - 1 minute read

You've heard the tradition of a bride wearing "something old, something new, something borrowed, something blue."  Well, that's somewhat like a good piece of code.  Here's why: Something old: code you've already written (don't repeat yourself) if you can. Something new: customize the old framework. Something borrowed: similar to the 'something old', if you can find code that someone else has already written and has shared, use it!!  Libraries were written to be used! Something blue: OK, I admit this one is more of a stretch than the others, but bear with me: in this case, 'something blue' is to make something really useful for the user . . . and that starts with character!  Your users will use your application if it's easy to use and solves a problem, but they won't love it unless it's entertaining.  Caveat: Clippy  is proof that this last point needs to be taken with a grain of salt: sometimes, applications are better of