Tuesday, October 4, 2016

Debugging With Node.js

I feel that debugging is as crucial a part of the development cycle as any other. So it's always good practice to demystify the job of debugging, making it easier and less time-consuming, so that we can end work on time and reduce stress. 

Like the majority of languages out there, Node provides some excellent debugging tools which make defects in code easily found and fixed. I always advocate the usage of a debugger because personally I find using debuggers really eliminates the need for any guesswork and makes us better developers in general. 

This guide is for developers and administrators that work with Node already. It presumes a fundamental understanding of the language at a practical level.

Using the Debugger

Node.js includes a full-featured out-of-process debugging utility accessible via a simple TCP-based protocol and built-in debugging client.

For example, to use the debugger to debug a file named script.js, you can simply call node using the debug flag as so:

Breakpoints

Now that you have started a debugging session, anywhere in your script that you call debugger from will be a breakpoint for the debugger. 

So, for example, let's add a debugger statement to the script.js:

Now if we run this script the debugger will be called on our breakpoint and we can control the script control via using the cont or next commands (c or n for short).

We can pause the script execution at any time by using p.

REPL

The Read-Eval-Print-Loop of the debugger allows you to enter code interactively during execution and thus access the state of the application and all of its variables and methods at the point of breaking execution. This is a very powerful tool which you can use to quickly sanitize your app.

In general, the REPL is available as a standalone and as part of the debugger, and it allows you to run JavaScript interactively. For example, just type node at the prompt with no options, and you will be given a REPL interface that you can write code into and see the output.

Stepping In & Stepping Out

Earlier I mentioned the cont and next (c and n) commands, which allow us to continue code execution once a breakpoint has been reached. In addition to this, as we walk through the code we can also step in to a method or step out to its parent scope.

Use the commands step to step in and out to step out, or s and o for short.

Backtracing

Use backtrace or bt to get an output of the backtrace for the current execution frame.

Restarting

Use restart or r to restart your script from the beginning of execution.

Alternative Ways to Connect to the Debugger

Advanced users can access the debugger also by starting Node.js with the --debug command-line flag, or alternatively by signaling an existing Node.js process with SIGUSR1.

Once a process has been set into the debug mode this way, it can then be connected to by using the Node.js debugger by either using the pid of the running process or via a URI reference (e.g localhost:port) to connect the listening debugger:

  • node debug -p <pid> connects to the process via the pid.
  • node debug <URI> connects to the process via the URI such as localhost:5858.

Using Node Inspector

In addition to the CLI debug tool, Node Inspector also provides a GUI inspector inside the web browser (currently only supporting Chrome and Opera).

To use the debugger, simply install as so:

npm install -g node-inspector

Now that we have the Node inspector installed, we can debug our script.js with:

node-debug script.js

Your shell will now output the following, and probably open the web browser to the URL if you have Chrome or Opera set as your default on your development OS.

In your web browser, you will now be able to debug your application in a similar environment to the developer tools package. Setting breakpoints and viewing code is now integrated with your browser view. Enjoy!

Conclusion

Debugging doesn't need to be a nightmare, nor does it need to be stressful. 

Setting breakpoints and stepping through code is so simple in Node. It's a very similar experience to Ruby, and if you are trying to understand an application you have been given, opening the app in debug mode and pausing execution is a fantastic way to learn in a rapid timeframe. 


by Tom Whitbread via Envato Tuts+ Code

7 Ways to Improve Your Search Rank With Social Media

jj-improve-search-rank-600

Do you want to improve the search rank for your website or blog? Wondering how social media can help? Social media and search engine optimization (SEO) are undoubtedly connected and will only become more interdependent in the future. In this article, you’ll discover seven ways you can use social media to boost your search rankings. [...]

This post 7 Ways to Improve Your Search Rank With Social Media first appeared on .
- Your Guide to the Social Media Jungle


by John Jantsch via

6 Ways to Use Facebook 360 Photos for Business

ck-business-facebook-360-photo-600

Have you heard of Facebook 360 photos? Wondering how your business can use them? Facebook 360 photos let you create an immersive 360-degree experience for fans on your Facebook page. In this article, you’ll discover six ways to use Facebook 360 photos for business. What Are Facebook 360 Photos? Unlike normal photos, Facebook 360 photos let [...]

This post 6 Ways to Use Facebook 360 Photos for Business first appeared on .
- Your Guide to the Social Media Jungle


by Christian Karasiewicz via

What UX designers need to know about product management

As a product manager by trade, I’ve had countless conversations with UX designers about what product management is really about. Online, there’s plenty of chatter that seeks to justify the existence of product managers to curious UX-kinfolk.

Today, I want to shift the conversation to something more interesting – celebrating shared objectives and considering product management as a viable career path for UX professionals.

As is typical of product managers, I fell into the role by accident. I had to look up what a product manager even did before my first interview for the role back in 2001.

‘Product manager’ is one of those roles that draws in people from a myriad of trades and industries. Regardless of qualifications and experience, excellent product managers share common traits like customer empathy, curiosity, great communication, good listening and a philosophy of continuous improvement.

Even though you can’t pursue a degree in product management at university, you’ll find us in the thick of the action in many product-centric companies today – leading from the front.  

So, what is product management?

You know what UX is, so I won’t preach to the choir a first principles definition of user experience or user experience design. But, for the sake of alignment, in my mind, the fundamental mission of UX is to present to your user the fastest path to satisfaction.

If I boil down the essence of why a business needs product management, it’s to answer these two questions:

  • What problems are we solving?
  • Who are we solving it for?

It sounds basic, but around half of all new product development efforts fail because these two questions are not adequately answered.

On a broader level, organisations invest in product management as a business strategy to achieve sustained competitive advantage. These organisations typically have growth objectives – to grow profit or market share, for example.

Sustained growth requires sustained competitive advantage. To achieve this, a business needs to invest in differentiated, hard to copy, value creation – that plays to the strengths of the business – over a sustained period. Product management is the practice of delivering this sustained competitive advantage.

For product-led companies, great product managers are a business necessity. They’re the people who ensure scarce company resources are allocated to making the right products and helping the business grow.

Product management ≠ UX

There’s a decent overlap between the role of a product manager and a UX designer – both roles seek to understand customer problems and empathise with the user. So it’s no surprise that on occasion UX designers and product managers clash.

Product Managers and UX Designers both play a role owning the customer problem.

Product managers and UX designers both play a role owning the customer problem.

Power struggles arise over who makes the call on delivering value to the customer – especially in recently expanded teams with the introduction of one of the roles (UX or product management). The roles are not the same, though, nor should they be trying to do the same thing. When this happens, someone isn’t playing to their position on the field.

You could say a product manager is a Jack of all trades and a master of none. Interestingly, the number one challenge of any product manager is competing priorities. There’s always more to do than available hours in a day. Product managers can’t try to be experts at everything. Whether that’s trying to optimise a remarketing program in Adwords, or spending too much time computing price elasticity for their high volume product. Trying to out-design a UX specialist on the interface for a new cloud offering means they miss the big picture.

Any product manager who doesn’t embrace UX expertise needs their head read. UX shares the customer research load, guides best practice in product design and shepherds that through development. UX designers are critical to a product manager’s success.

Why a career in product management?

Recent research shows that product management is now the highest paid role in Silicon Valley. A product manager in Sydney can earn, on average, $100,000 p.a. and a Senior Product Manager $145,000 according to job website Glassdoor.

The most rewarding aspect of product management is having a diverse and profound impact on the success of a business and its customers. You get to direct the energy of a talented group of people towards helping customers. It’s quite a buzz when done well. 

In many organisations, product management is a high profile role. You get great exposure to senior leadership and it opens up more diverse career advancements in senior management. Of course, it’s not without its challenges. Occasionally it can feel like an overwhelming, thankless, 24-7 arse-kicking. But, if your organisation has strong leadership, and you can balance your attention between the finer details and the big picture, it’s a rewarding way to develop your career.

Want to learn more?

If you want to learn more about product management and hear from an inspirational speaker lineup, Leading the Product could be the conference for you. This 1-day event brings together more than 500 product professionals on 20 October in Melbourne, and 25 October in Sydney. UX Mastery is a proud sponsor of this year’s event.

Leading the Product has an impressive lineup of UX speakers, including:

See the full speaker lineup

How about a free ticket?

UX Mastery has a free pass to Leading the Product to giveaway! To enter, you just need to tell us: “What’s one thing you wish you could get Product Managers to understand?” Entries close on Friday 7 October so be quick! Enter here.

The post What UX designers need to know about product management appeared first on UX Mastery.


by Sean Richards via UX Mastery

Aimy

Aimy

Long scrolling launching soon page for a focus and goal tracking app called 'Aimy'. Neat intro demo video within the hand and device.

by Rob Hope via One Page Love

Monday, October 3, 2016

Media Election

A look at the relationship of media attention and polling data in the 2016 Presidential Election
by via Awwwards - Sites of the day

How To Get Online Campaigns Tracking Right

How To Get Online Campaigns Tracking Right

Campaign tracking is an essential component of any serious online marketing strategy. After all, it is only through tracking that you can measure your important growth metrics and understand your ROI, optimize campaigns to achieve the best possible results as well as end campaigns that are failing to generate sufficient returns.

Modern tools like Google Analytics and Adobe Analytics have made this easier, but you would still be surprised how many small to medium-sized businesses either fail to pay enough attention to their campaigns, or fail to monitor certain important traffic sources. Here, we take a look at ways to get your online campaigns tracking properly.

by Guest Author via Digital Information World