Posts

Showing posts with the label NodeJS

Intuitive Third Party Packages

In relevance  to my package npm "flavorstrap" this is a little of a working progress for me and a few of my github projects I hopes it helps others. I've based this heavily on what I've seen others do  and what I think looks helpful to others. In that there enough context provided for others to go off from github package. I I face this problem with sometimes but I love to code so I spend the extra time to read someone else's code using a project as well. It helps if the documentation isn't there or if the code shows something the developer didn't think of.  Now this is just in my opinion and not so much a complain but advice for myself. I would definitely say I have used my share of third party libraries more often than actually written any but I do appreciate the ones well written. For example bootstrap and android's documentation pretty good and they even include some examples. However there are a couple of things I would suggest. For starters d…

Separate or Combined Frontend & Middle Tier Solution

Agnostic code that you can pick and choice or reuse from the browser to the server is the ideal situation to be. I believe there is only two way to get there. By a nodejs server environment or a transpilers like typescript. JavaScript isn't going anywhere and probably will be transformed as a lower level language in future generations. Which a lot of JavaScript frameworks seem to completely do.

Background
    So now some bit of my background on what I've done in the past and how I got to this way of thinking. Initial I started out with aspnet nvm and keep running into the concern of mvvm which is constant problem if your models done match. In aspnet mvc front-end is usually included in with the middle-tier. I have nested nodejs inside aspnet application and this was before aspnet core so it seemed like the right move. After my third job I wanted to completely move toward nodejs to solve this mvvm problem. However security and usability were major concerns my employer had so…

Node and NPM Configuration behind a Firewall

These are the notes for using npm behind a company firewall and a windows roaming account. With the help of a former colleague these are the steps I have used. Most of my issues with a company firewall have been with a package not being downloaded or installed properly.
​​Install Node: NPM is bundled w/ Node https://nodejs.org/download/​ Set your local proxy settings: ​run: setx HTTPS_PROXY http://YOUR-PROXADDRESS/ run: setx HTTP_PROXY http://YOUR-PROXYADDRESS/​ Configure local NPM directories: run: npm config set prefix C:\Local\npm --global​ run: npm config set cache C:\Local\npm-cache --global​ Configure PATH so that we can execute the node binaries via command line run: setx PATH "%PATH%;C:\Local\npm"​ If none of these steps resolve the issue my final solution is to install the package directly from github itself which all you need to do is list the git repo inside package.json.
Failed to install tar-2.2.1: 403 errornpm install --no-registrynpm install module --cache

My Express/Nodejs Project (5/12/16)

I currently have a project where I want build websites inside a website azure and output to github but I need to rapidly build them and demo the site without continuous integration. So basically I need something like plunker or codepen but with a more permanent repository system. I can't provide right now a url but just wanted to provide some notes and details on the project because I think it could be helpful to others who are looking for this type of solution (leave comment if you would like to see a feature).  I do have so of this project started, and currently using it for a few of the projects using bootstrap or angular.


Without Jade & Stylus
Developing template engines for ExpressHow to make an Express site without a template engine? - Stack Overflowadjohnson916/express-views-dom: A DOM view engine for Express.Sass instead of stylus

Flavorstrap npm package, in-depth Documentation

Image
There is three ways stylesheet libraries can be modified, excluding the idea of outside styling (themes). The first is through variables which limited to basic styles such as sizes, colors and other global variables. The second is extending existing css classes for example a “panel” has default, danger, warning, primary, info, and success. One could easily add a extended class called “panel-super” and continue development as any other panel variety. The last is a total rewrite of a bootstrap class, which can be avoided with flavorstrap.

Advantages/Support and reasons why!? Get any version of bootstrap you want, break it down to any level you want and without impacting it for long term maintainability!

Workflow:

Create Sass/Less Build Sass/Less + bootstrap’s Less/Sass Remove Dups and merge styles Add prefixes See your results!

Problems I faced: For a lot of sass or css optimization solutions rudy is a constant deal breaker which meant looking around for alternatives based off their rudy libr…

Wrapping Asp.net MVC with Nodejs for Development

Image
With Asp.net 5 around the corner I get all the nodejs support I could need, but convincing a team to get on board with early technology is difficult. So what I'm playing around with nodejs projects and what I'm doing with them is wrapping them around Asp.net MVC 5 projects. Having all my front-end taken care of outside the Asp.net MVC project and then severing the dependencies up in a single file. I think this is the best approach and will meet future solutions without breaking things. I'm still using Asp.net MVC's bundle feature but for personal JavaScript files I create. Nuget doesn't have that feature out of the box for Asp.net MVC applications so for now this helps adapt to the solution with taking advantage with npm packages.
Side Note I'm also looking at is using Typescript + Typelite. I'm not completely sold on typescript but I would highly recommend using typelite if you do. Synchronizing fronted model with back-end model is extremely important to me.…

Server-side Browser Detection with Bootstrap

One thing I love about bootstrap is that it eliminates the need to create separate views or pages to handle both types of clients (mobile/desktop) . A few years back when Asp.net MVC 4.0 first came out and before the big boom of "mobile first" styled css libraries there was a huge additional feature for server side detection. Now this was back in the early parts of my career so I was not sure where this feature would fit in or if it would ever. Since then I have been looking at all types of frameworks and server side detection systems but ultimately have been moving toward the bootstrap style mentality until I looked at my blog. Blogger actually does all the work for me so I didn't have do anything to create this.
    The thought behind this is to minimize the amount of information you sent to the user. Its great that you hidden it to the user on mobile devices and even design it with them in mind. However they are still getting all that information, which seems lik…

Error: No compatible version found: chalk@'0.4.0'

Image
This error actually had me stumped for a bit but that's because I thought it was something I was doing wrong. However after looking around I found that I simply needed to update my Node version. Rather than getting too deep into the technical details, I will just list my researches. I forget what version of Nodejs I was using before the update but with one simply click all my problems went away. 
The reasoning behind my thoughts earlier was because of my use with the mark ">=version" in my dependencies package.json file. This attempt was made after looking into the documentation  which I noticed that grunt-contr-uglify requires grunt 0.4.0 or great. So this all started that point on with my research.


Resources
node.js - Note to self update Nodejs!
Error: No compatible version found: chalk · Issue #23 · segmentio/metalsmith
npm install fails · Issue #163 · gruntjs/grunt-contrib-uglify - The same package I was trying to add.
https://www.npmjs.org/doc/json.html
https://gi…

Npm Install Error - Invalid Package.json

I felt pretty silly for this error I was seeing on one of my project, but lucky for me nothing a good night's sleep couldn't fix. I'm a nite programmer but that sometimes takes it's toll. The first problem was the fact I put an 's' on my file name. It should be "package.json" not "packages.json" which I carelessly did but the second for this error was actually one I think many people run into. Which is syntax, I found my mistake pretty quickly but you could always use online tools to validate your json file or use the pacakge-json-validator package.

//package.json file
{   "name": "ducksauce",
  "description": "Web Application Tool",
  "dependencies" : {
    "open" : "*", <-- Here is the problem!
  },
  "version" : "0.1.0",
  "author" : "Anthony Fassett <XXXXXX@gmail.com>",
  "keywords" : [
    "app"…

My Introduciton to Nodejs

Image
Introduction 
Much of the material here is based on the chapter 8 in the book: Programming in HTML5 with Javascript and CSS3 and the Nodes.js site.
Getting started with Nodes.js
"Nodes.js is built on the Google Chrome Javascript runtime""The Platform implements an event-driven, non-blocking I/O model and is lightweight and efficient.""data-intensive,real-time applications that run across distributed devices.""executes your Javascript by using Google's V8 virtual machine"Download Nodes.js and install, need to accept the licensing agreements. 
HelloWorld.js var http= require('http') //"http module is a core built-in, low-level module highly optimized." http.createServer(function (request, response) { response.writeHead(200, {'Content-Type':'text/plain'}); response.end('Hello World from Nodes.js!\n'); console.log('Handled request'); }).listen(8080, 'localhost'); console.log('Server running at …