npm does not support Node.js v9.0.0

Node.js v9.0.0 has just been released but the current npm version, npm 5.5.1, does not seem to support it.  Consequently, unless you have a specific reason for upgrading Node from its stable v8.9 version, it is probably best to wait a few days until npm makes the change or Node.js fixes the issue.

I’m keeping an eye on this problem and I’ll post more information as soon as there is a positive change.

Cheers,
Tony

Note on 11/11/17

Node.js 9.1.0 is out. The problem persists. Here’s a solution:
If you currently have Node.js 9.0.0 or 9.1.0, uninstall it. Windows users, use the regular “uninstall a program” routine to uninstall Node. Then, rename or remove these two folders from your USER/AppData/Roaming folder: npm and npm-cache. Finally, reinstall Node 9.1.0. The npm version that comes with Node should work fine.

p.s. Are you plannig to learn TypeScript or Angular? I have just upgraded my two TypeScript and Angular volumes. You can read more about it here: typescript-plain-language-angular-5/

TypeScript in Plain Language with Angular 5

Hello fellows,  just dropping a note to announce that both TypeScript eBooks have been reviewed and updated for Angular 5.

This is a great time to download a copy and learn TypeScript as well as Angular.

If you are currently reading Volumes 1 or 2, I want to assure you that you are up-to-date since I constantly review these books and the online exercises.

Aside from a couple of typos that I’ve corrected, everything else is pretty much the same.

All exercises have been tested with the following tool versions:

  • TypeScript 2.6.0
  • Angular core 5
  • Angular/cli 1.5.0
  • Node 9.1.0
  • NPM 5.5.1

Thank you!

How the Web Was Created: Timeline History

HAVE YOU EVER WONDERED HOW THE WEB WAS CREATED?

The World Wide Web was officially introduced to the world on August 6, 1991, by Sir Tim Berners-Lee. The following Web history highlights were originally referenced from the BBC. The resource links have been added for your convenience.

  • 1957: The United States Department of Defense formed a small agency called ARPA (Advanced Research Projects Agency) to develop military science and technology.
  • 1961-1965: The Massachusetts Institute of Technology (MIT) started to research sharing information in small, phone-linked networks. ARPA was one of their main sponsors.
  • 1966: The first ARPAnet plan is unveiled by Larry Roberts of MIT. Packet switching technology is getting off the ground, and small university networks are beginning to be developed.
  • 1969: The Department of Defense commissions the fledgling ARPAnet for network research. The first official network nodes were UCLA, Standford Research Institute, UCSB, and the University of Utah. The first node-to-node message was sent from UCLA to SRI.
  • 1971: More nodes join the network, bringing the total to 15. These new nodes include Harvard and NASA.
  • 1973: ARPAnet goes global when the University College of London and Norway’s Royal Radar Establishment join up.
  • 1974: Network intercommunication is becoming more sophisticated; data is now transmitted more quickly and efficiently with the design of TCP (Transmission Control Program).
  • 1976: Unix is developed at AT&T; Queen Elizabeth sends out her first email message.
  • 1979: USENET, the mother of all networked discussion groups, is developed.
  • 1982: Internet technology protocols are developed, commonly known as TCP/IP (Transmission Control Protocol and Internet Protocol). This leads to one of the first definitions of an “internet” being a connected set of networks.
  • 1984: Number of hosts is now up to 1000, with more being added every day.
  • 1985: The first registered domain is Symbolics.com.
  • 1987: Number of hosts breaks the 10,000 mark.
  • 1988: First large-scale Internet worm affects thousands of Internet hosts.
  • 1991: Tim Berners-Lee develops the World Wide Web. Tim Berners-Lee formally introduced his project to the world on the alt.hypertext newsgroup. In the post, he said the project “aims to allow links to be made to any information anywhere“. It did this by using hypertext a method for linking between different documents. Although invented many years earlier Mr. Berners-Lee’s invention married hypertext with the internet. He also made available all of the files necessary for people to replicate his invention.
  • 1993: The World Wide Web’s annual growth is now at a staggering 341,634%. Tim Berners-Lee managed to persuade CERN to provide the web technology and program code for free so that anyone could use and improve it. The decision is credited as one of the key reasons the web grew so quickly. The HTML markup language used to create webpages is released.
  • 1994: ARPAnet celebrates the 25th anniversary. Yahoo was started by Stanford University students David Filo and Jerry Yang. It was originally called “Jerry’s Guide to the World Wide Web” a site featuring a hierarchical directory of other sites. It was renamed Yahoo soon after. The name stands for Yet Another Hierarchical Officious Oracle.  PHP is developed by Rasmus Lerdorfm which in turn facilitates the creation of Wikipedia (2001), WordPress (2003), Drupal (2000), Facebook (2004) and many other empowering web platforms. President Bill Clinton puts whitehouse.gov on the web.
  • 1995-1997: RealAudio introduces Internet streaming technology, dial-up systems emerge (America Online, Compuserve), the Internet backbone continues to be strengthened with the addition of MCI, Microsoft and Netscape fight for WWW browser supremacy, and there are now more than 70,000 mailing lists. The online bookstore was originally founded as Cadabra.com by Jeff Bezos in 1994. It was one of the first major companies to sell goods on the web. Although it started as an online bookstore it now sells music, electronics, furniture, and even food. Microsoft’s Internet Explorer is released as part of Windows 95.
  • 1998: Google opens its first office in a garage in California. MySpace was originally an online storage and file sharing firm but was shut down in 2001. The social networking site in its present form launched in July 2003. It was set up 2003 by Tom Anderson, Chris DeWolfe, and a small team of programmers. MySpace now has close to 100 million users. The site lets users build a personalized home page, blogs, photos, music, and a messaging system. In 2005, media tycoon Rupert Murdoch paid 580m for the site. MySpace paved the way for other social media sites, such as Facebook, Twitter, and Pinterest.
  • 1998-2000: The dot-com bubble had been growing since 1997. The excitement surrounding the web caused share prices to soar. In January 2000 it reached its peak when the Dow Jones Industrial Average closed at a record level never reached before or since. On March 10 the NASDAQ Composite Index also reached an all-time high. Soon after, the markets began to crash and with it went many of the start-up companies bankrolled during the dot-com boom. Nearly 20 million websites online at this point.
  • 2000-2014: The “Wardrobe Malfunction” Becomes the Most Searched For Image in Web History: January 5, 2004. During a halftime show with Justin Timberlake at the Superbowl pop star, Janet Jackson had a “wardrobe malfunction”. Following the event search engines reported a surge in searches for terms such as Janet Jackson and Super Bowl as people looked for images of the event. According to Internet statistics, after reaching 1 billion websites in September of 2014, a milestone confirmed by NetCraft in its October 2014 Web Server Survey and that Internet Live Stats was the first to announce. We can still read  Tim Berners-Lee tweet  about the event.
  • Future: There are (at the time of this post) 1,269,711,977 websites online.
  • Further reading:  World Wide Web Foundation.

JAVASCRIPT PROMISES HANDS-ON INTRODUCTION

JavaScript Promises bring many benefits to the Web development community. The Promise object has been designed to make programmer’s life easier by simplifying implementation of callback functions.

Now that JavaScript Promises are part of the JavaScript core system, everyone should understand what Promises are and how to incorporate them in their code.

Even if you don’t see yourself writing a Promise object in the near future, the fact is that Promise objects are being used by libraries and modules, without you even noticing.

Understanding Promises, helps us realize the reasons why modern modules do certain things in specific ways, which is far better than just memorizing implementations without even realizing that a Promise object is being used.

If you have been avoiding writing Promises or you have never heard of them, this book of exercises will help you get started, and it will guide you toward further study of Promises on your own.

The introduction of Promise objects in the JavaScript core has opened new ways of writing applications.

This book will give you the foundation needed to understand other (more difficult) implementations of the Promise object.

In order to test your exercises you will need to have Node.js installed in your system, be able to work on the command line to do simple commands, and use a text editor such as Notepad to write your code.

What does a Promise look like?

Just look at the illustration shown below to see an abstraction of a Promise object in JavaScript.

JavaScript Promises Diagram

  • This diagram will be explained in detail the book.

JavaScript Promises are a modern approach to callback functions. They simplify the implementation of callbacks and add some new features to make your life a lot easier.

How do I start with JavaScript Promises?

Start by downloading the eBook from Amazon. This should be no more than a weekend reading if you put in the time.

Here is a code sample from the book (pretty easy stuff once explained):


multiplyMe(2, 4)
    .then(addNum(10))
    .then(addNum(12))
    .then((myResolve) => console.log(myResolve))
    .catch((myReject) => console.log(myReject));


Conclusion

Link to Amazon
Node.js Easy Exercises JavaScript Promises A Hands-no Introduction

If you always wanted to learn more about JavaScript Promises but kept putting off, this is the right time and the  right introductory eBook has just arrived. Go ahead and click on the eBook image to visit Amazon and download your copy of the book.

Thanks,

Tony de Araujo

Creating a WordPress Subtheme and Code Highlighting

Code highlighting is not a standard feature on WordPress. This is understandable since most WP users don’t need this option –  and even those who do, have different preferences about the way they want to display their code.

Note: The following procedure works only if you are self-hosting your WordPress blog.

After looking around I’ve decided to use Prismjs, which is very lightweight and easy to install once you become familiar with the procedure.

To use Prismjs I had to customize my theme by adding a style-sheet and a JavaScript file to it.

When customizing theme-files, it is advisable to create a sub-theme, which is also known as a theme child on WordPress lingo. This is because any code customization performed in the original theme will be lost the next time the original theme is upgraded and that can happen automatically.  Fortunately, this procedure is easier to do than what it sounds.

  1. Following the instructions from the URL given below, I created a theme-child instance in a matter of minutes (thanks Nick):

smashingmagazine.com/2016/01/create-customize-wordpress-child-theme

Later, if you want to know more about this topic, WordPress has a nice section about sub themes:

codex.wordpress.org/Child_Themes

  1. Once I had a child theme instantiated and properly working, the next step was to download Prismjs from source:

prismjs.com

For that, I followed the easy instructions given on crambler.com:

crambler.com/how-to-implement-prism-js-syntax-highlighting-into-your-wordpress-site

and here it is:

 let func = 123; 

How to configure the code to be displayed

To properly configure your code highlighting for a specific post, you need to declare the language your syntax intends to represent, like for example, JavaScript. This must be one of the languages you had selected before downloading the files.

Here’s how I did it for the example shown before (small screen users, please slide the code-window  horizontally to see the whole script):

<pre><code class="language-javascript.line-numbers"> 
let func = 123; 
</code></pre>

Above, there are two classes connected together. The line-numbers class does not have to be there unless you want line numbers.

Speaking of line-numbers, you can use the data-start=”number” attribute to start your line on a number other than 1. See below:

<pre data-start="3"><code class="language-javascript.line-numbers"> 
let func = 123; 
</code></pre>

Wrapping up

Well, I hope this little adventure comes handy for someone out there. I was an avid user of WordPress in the early days but it has been more than a decade since my last installation. Most of my early projects were done with Drupal 7. So much has changed since then. WordPress is now a force to be reckoned with.

How do you currently highlight syntax in your blog?

Cheers,

Tony De Araujo

First Post

“Whose woods these are I think I know.
His house is in the village though;
He will not see me stopping here
To watch his woods fill up with snow.”

Robert Frost

What’s your favorite poem?