git init - Initializes the current directory with all the git goodness. Basically it adds a hidden .git folder to your directory to maintain all the changes, repo information and commit history. (Start with this command if you are creating an entirely new project)

git add - Adds a file, or multiple files, to the staging area

git commit - Commits changes to the local repo, you can only commit files that were previously added with the add command.

git status - Shows you the files that have changed, or are the same, between your working branch and staging area and what needs to be committed.

I encountered some frustrations last night, largely due to my inexperience with Git, GitHub, and NPM. In summary, following the recipe in Chapter 3, prior to creating a NPM(odule), it appeared that I first needed a code repo on GitHub. I muddled my way through creating one, only to find out that there was a bug in my posted code, shortly thereafter I realized that I had no idea how to update a GitHub repo and/or NPM.

While I was able to complete the Chapter 3 project, using the author's censorify NPM, I am still not any closer to being able to patch my version, called censorify-robgtx.

This morning I found a few things that I hope to work through today and this evening.

Tuesday, March 13, 2018

Here is what I leaned in Chapter 3. The chapter starts out with a little background and history on the creation of Node.js. Node.js was developed in 2009 by Ryal Dahl and its “run time engine” is based on Google V8 JavaScript engine (from Chrome).

Node.js has a lively and active developer community and new extensions are being created all the time. Node.js. That said, Node.js ships with many built-in modules right out of the box (includes a long multi-page listing of module features: Command line and Console, Crypto, Debugger, OS, HTTP/HTTPS, OS, Compression and more)

Review of installation (see previous post) and a healthy discussion on. NPS (I found this part pretty interesting. Very helpful to execute the example as you read, creating a Node Package Module, using Node Package Manager, etc. Some highlights:

Sign up for an account at www.npmjs.org (http://www.npmjs.org/) (I'm https://www.npmjs.com/~robgtx)

Everting is accessible via CLI (Command Line Interface) for example, from CLI

npm search openssl

is similar to https://www.npmjs.com/search?q=openssl

Create a new project

Create a new folder \\nodejs_projects\chapt3

Create a new project using** npm init**, using the example on page 47 (Name: my_module, version: 0.1.0, take all the other defaults)

Use npm install express to include express as a dependency

Type tail package.json to display the contents of the resulting package.json, note that express ^4.16.3 is listed as a dependency. you could manually change this to “latest” as in the example on page 47

PS: In the examples ahead, you will also need a github account

Example/walkthrough of creating a Node.js Packaged Module

Toget started, create a new folder structure for your project. In my case, this was the creation of the folder \nodejs_projects\censorify-robgtx (you will need to create your own using you name).

Complete the example code provided (see attached)

Create the file package.json by running the command npm init (see attached). IMPORTANT NOTE: What they don't tell you is that it seems your project name needs to be unique across npmjs.org (http://npmjs.org/) (hence I used censorify-robgtx within my package.json file)

Manually created a README.md file

used the npm pack utility to create censosrify-robgtx-0.1.1.tgz file

Side Note: tgz is a Gzipped Tar File...long story here by Unix historically used the format TAR (Tape Archive), then Zip compression came along in the late 80s, and eventually Gnu made a clone of Zip, called Gzip, the result is the TGZ format (aka Zipped tar-ball)

Next, and I was not expecting this just yet, had jump over to github to create a public repository. I previously had a github account, TexasRob https://github.com/TexasRob, then spent some time attempting to figure out what Git/Github is all about. The the books fault, but page 50 completely glazes over the whole create a create a public repo thing, so here is what I did...Google to the rescue, followed this recipe https://codeburst.io/how-to-create-and-publish-your-first-node-js-module-444e7585b738. I kinda got lost for a while, but I think I found my way back to the main road.

Key points:

Create a GitHub account

Goto https://git-scm.com/book/en/v2/Getting-Started-Installing-Git download and install. I previously had git 2.14.3 installed, but the latest version is 2.16.2

Quickly found myself not knowing how to do anything from the git CLI, so I downloaded https://desktop.github.com/, signed in and was eventually able to publish my repo here: https://github.com/TexasRob/censorify

updated the package.json per page 51

and finally, executed **npm publish** (Took me a while, but I eventually figured out that I needed a unique NPM name, I used )

Results here: https://www.npmjs.com/package/censorify-robgtx

Deep sigh of relief!

Side note: If you ever need to “unpublish” an NPM from the NPM Registry, use the command npm unpublish ,so in my example npm unpublish censorify-robgtx

Next up, we will create another js project that requires the previously created NPM(odule)

Create another directory structure, again in my nodejs_projects folder, this one called readwords. We will eventually call the previously created censorify from this new project, thereby demonstrating modularity. In my example, I reverted to using the author's censorify NPM as mine had some bugs and I am uncertain how to update existing NPMs and Git Repos at this point.

From the command prompt CD to the newly created folder and type the command npm install censorify. The result, in my case, seemed to be a bunch of warnings...No description, No repository file, No README, No license file. That said, it seems to have copied everything previously created for me, so I this we are good to go...onward!

Created a file called readwords.js that includes the following commands.

I had to do the above, because I don't yet know how to update npm and/or git projects. But hey, at least I learned how to “include” and npm. From here I need to find some side reading on git and npm, because as far as that goes, I am really lost.

Saturday, March 10, 2018

Chapter 2: JavaScript Primer. Chapter 2 is a review of, or crash course in, the JavaScript language. While very comprehensive, the text makes the assumption that you have some JavaScript in your background. As such, it focuses only on syntax and almost no time on theory.

I wanted to test the examples as I moved through the chapter/ There are 3 basic ways to do this.

Write an HTML file that directly includes the tags, with the script you want to execute inside, the load the HTML file with your browser.

Write an HTML file that references a js file , then run this HTML file in your browser

Since we are learning Node.js, and Node.js == JavaScript, we can just directly execute the JavaScript file using the command node chapt2.js, where chapt2.js is a file of all the script commands we created.

In either case, you can use console.log() to output either to the Terminal screen where you execute node chat2.js or the Chrome console if you are executing through the browser (Use option-command-J to display the JavaScript Console in Chrome on Mac, I'm not 100% sure but I think you just press F12 on Windows).

You can see from my chapt2.js file, that I just made 1 long JavaScript file with all the commands and threw in some Console.log announcements to let me know where I was.

A solid alternative to this chapter is watching some getting started videos. I found this one, JavaScript Fundamentals For Beginners, seemed to be fairly decent and covered all the basics. There are much longer courses available, this video is just over 1 hour and all I needed to dust off the cobwebs.

This weekend I plan to tackle at least Chapter 3 "Getting Started with Node.js"

AngularJS is a structural framework for dynamic web apps. It lets you use HTML as your template language and lets you extend HTML's syntax to express your application's components clearly and succinctly.

AngularJS is what HTML would have been, had it been designed for applications.

From Mac Terminal, type the following. Basically I am creating a directory structure to save my projects. “nodejs_projects” will be the main folder in my home directory, “myapp” will be my first project.

mkdir nodejs_projects

cd nodejs_projects

mkdir myapp

cd myapp

Next type “npm init”, this will invoke a utility to create a package.json file to store all my project stuff. This will prompt me for a variety of things, all that I really need is the project name. I will take the default “myapp” which defaults from the folder where I invoked the command.

Following the prompts, I will take all the defaults, however I will put my name in for author and give the project a description “This is my very first node.js project”

Finally to install Express and choose the option to save it to the project dependencies list (frankly I don't know if I should or should not save?!?...save it is.)

npm install express --save

This seems to have created a node_modules subdirectory. I guess it worked ?!?!

Chapter 1 covers the basics of the Node.js to Angular stack. From the user, through the Browser to the Webserver, discussed the classic JavaScript/XLM/HTML/CSS on the client side to an Apache/IIS webserver with various server-side scripting technologies (PHP/Java/.Net/etc.) through to a database (MySQL, Oracle, SQL Server, etc.)

Then compares this with the cleaner Node.js to Angular stack:

For the most part, things are the same of the client side

Node.js is the development framework, based on Google's V8 JavaScript engine. Therefore Node.js is written in JavaScript and compiled to machine code by V8 to be executed.

JavaScript end to end (from the client, through to the Webserver - Gives the benefit of using the same language from end to end (client side and server side)

I just decided to learn a new language, even though I have not coded professionally in 10+ years. While I have authored a few declarative AppExchange packages in the in recent historyI have not so much as dusted off my JavaScript skills in quite some time.

To that end, I am taking on the endeavor to learn Node.js and Angular, along with MongoDB, all on the Heroku platform. Follow along if you like, I will be blogging my experience as often as possible.

Stuff I hope to learn:

M.E.A.N.: MongoDB, Express, Angular, Node.js

JavaScript skills refresher

Figure how Git fits into the whole schema

Figure out how all this stuff runs on Heroku as well as understand the competition

Eventually learn more about Postgres

For the onset, I am walking through this book Node.js, MongoDB and Angular Web Development (2nd Edition) http://amzn.to/2tvZrWy. It would be great if you picked up a copy, but don't let that stop you, I am finding that there is a ton of helpful articles and videos that might be enough to work through things on the cheap.

Tuesday, October 08, 2013

Dreamforce 2013 will mark my 6th consecutive DF. Over
the years I started associating the Dreamforce band and the key announcements.
Back in the day it was easy, 1 or 2 major product announcements.
However, for the past few years we have been making so many revolutionary product announcements that it's getting hard to keep things straight. The fact that I' getting older does not help matters much ;)

Monday, July 15, 2013

A common request that I receive is regarding posting videos in Chatter, specifically: "Can I post video files in Chatter?". The current answer is somewhat convoluted, while you can indeed post any file you like in Chatter, when it comes to video files, typically people want streamable playback.

Unfortunately what you get is download, followed by local playback.

However there are a few workarounds that can help get you closer to where you want to be.

Option 1: YouTube
If you first upload your video content to YouTube, then share the resulting URL as a Link in Chatter, Chatter embeds the video within the Chatter feed. This gives the impression that the video is actually in Chatter.

The downside of this is that YouTube videos are public, more often than not, and in some cases your company might be blocking YouTube entirely.

While YouTube allows some privacy, it can be somewhat inflexible. Currently you have 2 options "unlisted" which means that a user needs to specifically know a given video URL. This would be practical for non-sensitive videos, however most would consider this to be "security-by-obscurity" (aka not secure). The other option is "private", this would have promise, however anyone you share your video with must already be a YouTube user. Not very practical for corporations.

Option 2: Vimeo.com
Vimeo offers an interesting take on video sharing, unlike YouTube, you can add a simple password to a video to limit the viewing audience. While not as secure as having the video behind your firewall, this does offer a slightly better security experience.

Step 1: Upload your video to Vimeo and click the Video Settings button (gear icon in the top left). Several options exist, including the option to password protect.

Step 2: Grab the link using the Share button in Vimeo

Step 2: Create your Chatter post, use the link that you created in Step 2 as the Link in your Chatter post

Notice that the video thumbnail and event the video name are obfuscated.

Step 3: Click play on the video and the user is prompted for a password

After the password is provided, the video plays inside the Chatter feed

In Closing
While Salesforce.com does not (yet) provide native video embedding in Chatter, such functionality can be achieved by leveraging the services of YouTube or Vimeo. Vimeo has the advantage of accommodating individual video paswords.

Disclaimer

I am a Customer Success Manager for Salesforce.com. While I work for Salesforce.com, I am not an official spokesperson for Salesforce.com. All information within this blog is freely and publicly available and/or my own personal opinion.