"Mr Branding" is a blog based on RSS for everything related to website branding and website design, it collects its posts from many sites in order to facilitate the updating to the latest technology.
To suggest any source, please contact me: Taha.baba@consultant.com
Tuesday, April 4, 2017
Predicting 2017’s Content Marketing Trends
[ This is a content summary only. Visit our website http://ift.tt/1b4YgHQ for full links, other content, and more! ]
by Guest Author via Digital Information World
Debugging JavaScript with the Node Debugger
It’s a trap! You’ve spent a good amount of time making changes, nothing works. Perusing through the code shows no signs of errors. You go over the logic once, twice or thrice, and run it a few times more. Even unit tests can’t save you now, they too are failing. This feels like staring at an empty void without knowing what to do. You feel alone, in the dark, and starting to get pretty angry.
A natural response is to throw code quality out and litter everything that gets in the way. This means sprinkling a few print lines here and there and hope something works. This is shooting in pitch black and you know there isn’t much hope.
Does this sound all too familiar? If you’ve ever written more than a few lines of JavaScript, you may have experienced this darkness. There will come a time when a scary program will leave you in an empty void. At some point, it is not smart to face peril alone with primitive tools and techniques. If you are not careful, you’ll find yourself wasting hours to identify trivial bugs.
The better approach is to equip yourself with good tooling. A good debugger shortens the feedback loop and makes you more effective. The good news is Node has a very good one out of the box. The Node debugger is versatile and works with any chunk of JavaScript.
Below are strategies that have saved me from wasting valuable time in JavaScript.
The Node CLI Debugger
The Node debugger command line is a useful tool. If you are ever in a bind and can’t access a fancy editor, for any reason, this will help. The tooling uses a TCP-based protocol to debug with the debugging client. The command line client accesses the process via a port and gives you a debugging session.
You run the tool with node debug myScript.js
, notice the debug
flag between the two. Here are a few commands I find you must memorize:
sb('myScript.js', 1)
set a breakpoint on first line of your scriptc
continue the paused process until you hit a breakpointrepl
open the debugger’s Read-Eval-Print-Loop (REPL) for evaluation
Don’t Mind the Entry Point
When you set the initial breakpoint, one tip is that it's not necessary to set it at the entry point. Say myScript.js
, for example, requires myOtherScript.js
. The tool lets you set a breakpoint in myOtherScript.js
although it is not the entry point.
For example:
// myScript.js
var otherScript = require('./myOtherScript');
var aDuck = otherScript();
Say that other script does:
// myOtherScript.js
module.exports = function myOtherScript() {
var dabbler = {
name: 'Dabbler',
attributes: [
{ inSeaWater: false },
{ canDive: false }
]
};
return dabbler;
};
If myScript.js
is the entry point, don’t worry. You can still set a breakpoint like this, for example, sb('myOtherScript.js', 10)
. The debugger does not care that the other module is not the entry point. Ignore the warning, if you see one, as long as the breakpoint is set right. The Node debugger may complain that the module hasn’t loaded yet.
Time for a Demo of Ducks
Time for a demo! Say you want to debug the following program:
function getAllDucks() {
var ducks = { types: [
{
name: 'Dabbler',
attributes: [
{ inSeaWater: false },
{ canDive: false }
]
},
{
name: 'Eider',
attributes: [
{ inSeaWater: true },
{ canDive: true }
]
} ] };
return ducks;
}
getAllDucks();
Using the CLI tooling, this is how you'd do a debugging session:
> node debug debuggingFun.js
> sb(18)
> c
> repl
Continue reading %Debugging JavaScript with the Node Debugger%
by Camilo Reyes via SitePoint
Directive Consulting
Directive Consulting is a search marketing agency that specializes in B2B and enterprise campaigns.
by csreladm via CSSREEL | CSS Website Awards | World best websites | website design awards | CSS Gallery
SixtyNineStudio – WordPress Theme
SixtyNineStudio is a corporate web solution for individual’s or business agencies. This multi-functional responsive theme provides several layout options to take care of any possible screen resolution. Be sure that it will fit any viewing device.
by csreladm via CSSREEL | CSS Website Awards | World best websites | website design awards | CSS Gallery
Entice Energy
Interactive video, clean animation, and UI design come together to let users dive into enjoyable easy going service of Entice Energy.
by csreladm via CSSREEL | CSS Website Awards | World best websites | website design awards | CSS Gallery
SEOEXPERTS – SEO, SEM, Social Media
SEOEXPERT is a clean HTML5 site template suitable for agencies that provide SEO, SEM, Digital marketing, Social Media Martketing services. It comes with powerful contact forms to hook potential customers; you will get all the elements necessary to cr
by csreladm via CSSREEL | CSS Website Awards | World best websites | website design awards | CSS Gallery
Flight Safety Foundation
WDG positioned FSF to succeed as they engage members and provide crucial thought leadership. This project exemplifies the need for any industry to create and execute a comprehensive digital strategy; from federated search to email marketing.
by csreladm via CSSREEL | CSS Website Awards | World best websites | website design awards | CSS Gallery