Friday, December 1, 2017

SlideShare: How to Make It Work for Your Business - #infographic

SlideShare manually curates content for its homepage and features presentations. And each month it posts themes—two topics chosen by SlideShare’s team—for users to create and upload presentations and be featured on the homepage. Being on the site’s homepage certainly drives views and...

[ This is a content summary only. Visit our website http://ift.tt/1b4YgHQ for full links, other content, and more! ]

by Web Desk via Digital Information World

Land Engaged Readers: Boost your Content's IQ - #infographic

The content universe is ever expanding, as more is being launched into digital galaxy each day. Buyers want to find nuggets of informational goodness that will comprehensively and intelligently solve their problem or answer their question. Most marketing content today is hard to find, poorly...

[ This is a content summary only. Visit our website http://ift.tt/1b4YgHQ for full links, other content, and more! ]

by Web Desk via Digital Information World

5 Instagram Hacks and Features You Probably Didn’t Know About

So, you feel like you've moved on from being an Instagram newbie and want to know the more advanced tips, tricks and hacks? You've come to the right place. Here's what you need to know to step up your Instagram game.

[ This is a content summary only. Visit our website http://ift.tt/1b4YgHQ for full links, other content, and more! ]

by Irfan Ahmad via Digital Information World

This week's JavaScript news, issue 363

This week's JavaScript newsRead this e-mail on the Web
JavaScript Weekly
Issue 363 — December 1, 2017
A low-level look at what V8’s Turbofan optimizing compiler does behind the scenes to get your code running faster.
Benedikt Meurer

From environments, response times, context, parsing, compiling and executing, to bundle sizes and shipping less code.
Ivan ฤŒuriฤ‡

Frontend Masters
Upgrade your skills this weekend with Kyle Simpson's JavaScript courses: Deep JS Foundations, ES6: The Right Parts, Functional-Lite, and more. ๐Ÿš€ Don't delay — courses are only free through Monday.
Frontend Masters   Sponsor

Built with Electron, Vuetron is a Vue-oriented debugger that lets you navigate between states, monitor state changes and API requests, etc.
vuetron

Looking for something to do this weekend? Consider noodling with ReasonML, an OCaml-inspired language that compiles to JS. Dr. Axel has a getting started post, and Keira Hodgkinson has a great 25 minute introduction video.
Dr. Axel Rauschmayer

A practical 30 minute introduction to Aurelia, a popular modular frontend framework that integrates with Web Components.
YouTube

A well-presented guide covering most of JavaScript in detail. A handy refresher.
Ilya Kantor

A standards-themed tale of what can happen if you spend a lot of time working with the details of the ECMAScript spec.
Mike Pennisi

Jobs

In Brief

Building a Simple Regex Engine in Under 40 Lines of Code tutorial
Nick Drane

An Introduction to ES6 Template Literals tutorial
Sarah Chima

Scaffolding a GraphQL API Server with Node tutorial node
Tom Lagier

The Practicalities of Contributing to ECMAScript tutorial
Want to work on the standard? Here are the processes involved.
TC39

A Story of pgrading An Angular App From 1.6 to Angular 4 tutorial
Abou Kone

Implementing the Sieve of Eratosthenes in JavaScript tutorial
Ben McCormick

Using Nested Child Routes in a Vue App tutorial
Nic Raboy

Building a Voice-Activated Movie Search App Powered by Amazon Lex, Lambda, and MongoDB Atlas (Part 1) tutorial
mongodb  Sponsor

What Types of Project Aurelia Works Well For opinion
Sean Hunter

React Food Truck: A Curated Set of VS Code Extensions tools
Several useful React extensions together in a single bundle.
Burke Holland

Sencha Ext JS: Build an App, Not a Framework tools
With Ext JS you only have to develop your app once for multiple platforms and devices, try it free.
Sencha, Inc.  Sponsor

Rapid.js: An ORM-Like Interface and Router for Outgoing API Requests code
Create chainable API wrappers by defining models and routes.

Lite Editor: A Modern WYSIWYG Editor Focusing on Inline Elements code
appleple

Literally Canvas: An HTML5-Based Drawing Widget code

Telemachy: Easy 'Guided Tours' for Angular Apps code
Code Orange

Superstruct: A Simple, Composable Way to Validate Data code
Designed for validating data at runtime with a type annotation API inspired by TypeScript and Flow.
Ian Storm Taylor

Wijmo Typescript UI Controls Support Angular 5. No Dependencies. code
Wijmo’s UI components include Angular v5 support, full IntelliSense, and the best JS grid available.
GrapeCity Wijmo  Sponsor

Curated by Peter Cooper and published by Cooperpress.

Like this? You may also enjoy: FrontEnd Focus : Node Weekly : React Status

Stop getting JavaScript Weekly : Change email address : Read this issue on the Web

© Cooperpress Ltd. Fairfield Enterprise Centre, Lincoln Way, Louth, LN11 0LS, UK


by via JavaScript Weekly

How Psychology Can Make Your Emails More Appealing - #infographic

Your email marketing campaigns aren’t as effective as they could be. How do we know? Well, unless you’re getting a 100% open rate on every campaign — which is rare or nonexistent — there’s room for improvement. When was the last time you examined the appeal and effectiveness of your email marketing...

[ This is a content summary only. Visit our website http://ift.tt/1b4YgHQ for full links, other content, and more! ]

by Web Desk via Digital Information World

Refining the Message: The Journey, Episode 8

The Journey, a Social Media Examiner production, is an episodic video documentary that shows you what really happens inside a growing business. //www.youtube.com/watch?v=-CPH2nuwsDw Watch The Journey: Episode 8 Episode 8 of The Journey follows Michael Stelzner, founder of Social Media Examiner, as he continues to pursue what many will see as an impossible goal: to [...]

This post Refining the Message: The Journey, Episode 8 first appeared on .
- Your Guide to the Social Media Jungle


by Michael Stelzner via

Introduction to Python Generators

Generators make it easy to create iterations in Python and in return write less code. This tutorial will introduce you to Python generators, their benefits, and how they work.

Basics

A generator is a function that returns a generator object on which you can call the next() method, so that for every call it returns a value or the next value. A normal Python function uses the return keyword to return values, but generators use the keyword yield to return values. This means that any Python function containing a yield statement is a generator function.

The yield statement usually halts the function and saves the local state so that it can be resumed right where it left off. Generator functions can have one or more yield statements.

A generator is also an iterator, but what is an iterator? Before we dive into the details of generators, I think it's important to know what iterators are because they form an integral part of this discussion.

Python Iterators

A Python iterator is simply a class that defines an __iter__() method. Most Python objects are iterable, which means you can loop over each and every element in the objects. Examples of iterables in Python include strings, lists, tuples, dictionaries, and ranges.

Let's consider the example below, in which we are looping over a list of colors:

Behind the scenes, the for statement will call iter() on the list object. The function will then return an iterator object that defines the method __next__(), which will then access each color, one at a time. When there are no more colors left, __next__ will raise a stopIteration exception, which will in turn inform the for loop to terminate.

Iterating Over a Dictionary

Iterating Over Rows in a CSV File

Iterating Over a String

Benefits of Using Generators

Let's discuss some of the benefits of using generators as opposed to iterators:

Easy to Implement

Building an iterator in Python will require you to implement a class with __iter__() and __next__() methods as well as taking care of any errors that may cause a stopIteration error.

As you can see above, the implementation is very lengthy. All this burden is automatically handled by generators.

Less Memory Consumption

Generators help to minimize memory consumption, especially when dealing with large data sets, because a generator will only return one item at a time.

Better Performance and Optimisation

Generators are lazy in nature. This means that they only generate values when required to do so. Unlike a normal iterator, where all values are generated regardless of whether they will be used or not, generators only generate the values needed. This will, in turn, lead to your program performing faster.

How to Create a Generator in Python

Creating a generator is very easy. All you need to do is write a normal function, but with a yield statement instead of a return statement, as shown below.

While a return statement terminates a function entirely, yield just pauses the function until it is called again by the next() method.

For example, the program below makes use of both the yield and next() statements.

How Python Generators Work

Let's  see how generators work. Consider the example below.

In the function above, we define a generator named myGenerator, which takes a list l as an argument. We then define a variable total and assign to it a value of zero. In addition, we loop through each element in the list and subsequently add it to the total variable.

We then instantiate newGenerator and call the next() method on it. This will run the code until it yields the first value of total, which will be 0 in this case. The function then keeps the value of the total variable until the next time the function is called. Unlike a normal return statement, which will return all the values at once, the generator will pick up from where it left off.

Below are the remaining subsequent values.

If you try to call the function after it has completed the loop, you will get a StopIteration error.

StopIteration is raised by the next() method to signal that there are no further items produced by the iterator.

Example 2

In this example, we show how to use multiple yield statements in a function.

Whereas a normal function returns all the values when the function is a called, a generator waits until the next() method is called again. Once next() is called, the colors function resumes from where it had stopped.

Conclusion

Generators are more memory efficient, especially when working with very large lists or big objects. This is because you can use yields to work on smaller bits rather than having the whole data in memory all at once.

Additionally, don’t forget to see what we have available for sale and for study on Envato Market, and don't hesitate to ask any questions and provide your valuable feedback using the feed below.

Furthermore, if you feel stuck, there is a very good course on Python generators in the course section. 


by Esther Vaati via Envato Tuts+ Code