background preloader

Literature

Facebook Twitter

Understanding the Node.js Event Loop | NodeSource - Enterprise Node.js Training, Support, Software & Consulting, Worldwide. Node's "event loop" is central to being able to handle high throughput scenarios. It is a magical place filled with unicorns and rainbows, and is the reason Node can essentially be "single threaded" while still allowing an arbitrary number of operations to be handled in the background. This post will shed light on how the event loop operates so you too can enjoy the magic. Event Driven Programming # The first thing needed in order to understand the event loop is an understanding of the event-driven programming paradigm. This has been well understood since the 1960's. Defined simply: event-driven programming is application flow control that is determined by events or changes in state. For those familiar with client-side JavaScript development, think of all the .on*() methods, such as element.onclick(), that are used in conjunction with DOM Elements to convey user interaction.

Another common pattern is succeed or fail. The 'fs' module mostly uses the error back callback style. AllThingsSmitty/must-watch-javascript. Материалы MoscowJS 12 / Блог компании MoscowJS. Двенадцатый митап MoscowJS прошёл 26 июня в офисе компании mailru. На встрече выступили ребята из Яндекса, Mail.ru и Tai.st. Говорили об облаках, оптимизациях мобильного веба и, конечно, расчёсках! Мы собрали видео и другие материалы события в одном посте. Вот как это было… Аддоны для облачных веб-приложений: взгляд разработчика Антон Белоусов, основатель и CEO Tai.st Чем полезны аддоны для пользователей и самих облачных продуктов, какие есть технологии и подходы к их созданию.

СлайдыВидео Мобильный веб: Что же все так тормозит! Иван Чашкин, Mail.ru Group C чем мы сталкиваемся, когда делаем быстрое Single-page приложение. СлайдыВидеоДемо CSScomb.js — вторая жизнь Михаил Трошев, Яндекс «Расчёска» — инструмент для коллективной разработки. СлайдыВидеоCSScomb.js: GitHub Без Бэкенда Андрей Саломатин Как перестать беспокоиться о серверной части приложений и сосредоточиться на опыте пользователей. СлайдыВидеоСсылки Фото Фотографии с митапа собраны в нашей группе в Facebook. Благодарности Впереди MoscowJS 13!

Substack/browserify-handbook. CSS: The Good Parts. The so-called "nico-style" brought to markdown. Because Style Guide. This style guide is a jab at solving collisions between CSS class names, and issues that ultimately lead to confusion, having to use ! Important rules, copying and pasting style declarations, and other awful aspects of CSS developments. Astonishignly, this style guide won't do anything for you that you're not able to figure out for yourself. That means you won't see the benefits unless you try and follow most of the conventions laid out next. The recommendations found in this style guide are generally just guidelines and aren't set in stone. Feel free to fork this style guide, or better yet, send Pull Requests this way! Namespaces Components should always be assigned a unique namespace prefix.

Consider the following example, where we assigned ddl to a drop down list component. Good .ddl-container { // ... } .ddl-item-list { // ... } .ddl-item { // ... } Bad .uv-clearfix { // ... } .clearfix { // ... } Classes Attributes Tag Names. Nodebp May 2014: Koa. Realistic terrain in 130 lines. The magic of “overflow: hidden” — Articles — Colin Aarts, freelance web developer. Published on “overflow: hidden” is often used for the purpose of float containment. It can do more special things, however: prevent an element's margins from collapsing with its children and prevent an element from extending “behind” an adjacent floated element.

But it doesn’t make sense! ▲¶ People often wonder why overflow: hiddenoverflow: hidden results in floats being contained; if anything, they'd expect stuff to be hidden. Float: leftfloat: left and float: rightfloat: right display: inline-blockdisplay: inline-block, display: inline-tabledisplay: inline-table, display: table-celldisplay: table-cell and display: table-captiondisplay: table-caption position: absoluteposition: absolute and position: fixedposition: fixed overflow: hiddenoverflow: hidden, overflow: autooverflow: auto and overflow: scrolloverflow: scroll and their overflow-xoverflow-x and overflow-yoverflow-y counterparts. Float containment▲¶ Float containment is without a doubt the most popular application of a BFC. Руководство по basis.js. Часть 1: Начало работы, представления, модули, инструменты. Basis.js – JavaScript-фреймворк для разработки одностраничных веб-приложений, ориентированный на скорость и эффективность.

Возможно он пока не такой популярный. Но благодаря моим выступлениям на различных конференциях и meetup'ах, некоторые уже слышали о нем и заинтересовались. Однако, чтобы начать использовать фреймворк или разбираться в нем, большинству не хватает руководства. И вот, собрав волю в кулак (ну какой программист не любит писать документацию?) , я сел писать руководство. Просто, доступно, последовательно. Написав первую часть, я дал прочесть другим. В первой части руководства будет рассмотрено как начать работать с basis.js и какие инструменты можно использовать. Подготовка Для разработки нам потребуются:консоль (командная строка)локальный веб-сервербраузер (желательно Google Chrome)ваш любимый редактор Изначально считаем, что мы находимся в папке проекта и эта папка абсолютно пуста.

Dev-сервер Проекты на basis.js не требуют сборки в процессе разработки. > basis server <! Модули. TJ Holowaychuk: How is TJ Holowaychuk so insanely productive. The BMEAN Stack and Offline-First Design. Many of you would know the MEAN stack, the software stack consisting of MongoDB, Express, AngularJS and Node. However, the BMEAN stack might be new to you. The B stands for Breeze, a data management library with support for client caching. The current trend in web development is mobile first design. Recently, the “offline first” approach got attention for contributing toward better mobile user experience. Breeze provides a sample BMEAN application called Zza, but it’s not an offline application.

Scaling Node.js Applications | Colin J. Ihrig's Blog. Scaling Node.js applications can be a challenge. JavaScript’s single threaded nature prevents Node from taking advantage of modern multi-core machines. For example, the following code implements a bare bones HTTP server, which listens on the port number passed in from the command line. This code will execute in a single thread, whether it’s run on a single core machine or a 1,000 core machine. Taking Advantage of Multiple Cores With a little work, the previous code can be modified to utilize all of the available cores on a machine. In the following example, the HTTP server is refactored using the cluster module. cluster allows you to easily create a network of processes which can share ports. In this example, a separate process is spawned for each system core, as defined by the numCPUs variable.

Scaling Across Machines Nodejitsu has developed node-http-proxy, an open source proxy server for Node applications. Npm install http-proxy The actual reverse proxy server is shown below. Conclusion. How an Event Loop works | Matt's Hacking Blog. Getting into coding in Node.js came very naturally to me. Prior to this I had written a fair bit of Danga::Socket in Perl and various solutions on top of it. What that meant is that coding in Node came naturally to me – Danga::Socket is an Event Loop for Perl, so I understood the internals and how everything hung together in an Event Loop.

But it’s not that way for a large number of people coming to Node from other languages. So let’s start with the basics of how an event loop works. I’m going to start with simple timers – in Node/Javascript this is the concept of setTimeout() and setInterval(). These simply run code at a later time, a number of milliseconds in the future. If the current time in milliseconds since the epoch is 1000 (yes I know that’s nowhere near what it really is), and we ask for a setTimeout() to run in 25ms time, that means the fire time for that event is 1025. So the basics of our event loop become the following code: Two important things become obvious out of this:

Book of Modern frontend tooling. This is a free, work-in-progress open-source book introducing you to the world of tooling for modern web applications. Over the past few years, there has been a new wave of highly compelling and immersive web applications. Some of them replacing native applications as they are on par (if not better) in terms of usability and features. To build and maintain such complex applications in a collaborative environment, it is important to use the right tools.

Unfortunately, there is no single place which documents available frontend tooling and provides an opinion for a developer. The goal of this book is to walk developers through the application development lifecycle; help discover new concepts and introduce tooling that simplify building modern web applications. For context, lets look at a modern web application's development lifecycle: Scaffolding: This involves creating an application structure and adding boiler-plate code to get started.

JavaScript MVC Style Guide. Over the years I've come up with a few rules for MVC web apps that have served me well and kept large codebases from descending into chaos. While the terminology may differ, these rules should hold true for most client-side MVC frameworks such as Backbone and Ember. Some frameworks have different naming MVC conventions, and slightly different takes on separating concerns. In this document, controllers are the glue between models and views, views are HTML templates and models purely deal with data storage, retrieval and decoration.

This fits well into the Backbone & Spine terminology. Controllers Controllers are the glue between views and models. Views Should be logic less except for flow control and helper functions.Should be passed all the data they need to render directly. Models Routers Should be as logic-less as possible.Should not know about or access the DOM. Global state Should be kept to a minimum as it arguably violates MVC. Modules Pull requests accepted. «Паттерны для масштабируемых JavaScript-приложений» от Эдди Османи. Top Overlooked Security Threats to Node.js Web Applications. Machine Learning: Introduction to Genetic Algorithms | Burak Kanber's Blog. On September 4, 2012 The Introduction to “Machine Learning in Javascript” post provides a nice introduction and context for this post and the rest of the series. I like starting my machine learning classes with genetic algorithms (which we’ll abbreviate “GA” sometimes). Genetic algorithms are probably the least practical of the ML algorithms I cover, but I love starting with them because they’re fascinating and they do a good job of introducing the “cost function” or “error function”, and the idea of local and global optima — concepts both important and common to most other ML algorithms.

Genetic algorithms are inspired by nature and evolution, which is seriously cool to me. One phrase I used above is profoundly important: “general-purpose”. One application that comes to mind is bipedal robot walking. Let’s build a GA in Javascript. The Problem Build a genetic algorithm in Javascript that reproduces the text “Hello, World!”. Naturally, everything starts with “Hello, World!” The Chromosome. Failproof AJAX requests in Firefox OS | soledad penadés. Making Change.org — Promises and Error Handling. We’ve standardized on using promises to manage most of the asynchronous interactions in our JavaScript codebase. In addition to really enjoying the extra expressiveness and aggregation possibilities offered by promises, we’re benefitting greatly from richer error handling.

We’ve had some surprises though, and this post explains some things which caught us out and some guidelines we’re following to avoid similar situations in future. We use the excellent when.js library, however this post should be relevant no matter what implementation you’re using. 1. Reject what you would normally throw Rejecting a promise should be synonymous with throwing an exception in synchronous code, according to Domenic Denicola. These practices cause us additional problems with the likes of Express and Mocha since they expect their next and done callbacks to be invoked with an Error instance to trigger the failure flow, otherwise they consider it a successful operation. 2. 3. 4.

Summary We are hiring! Archives/website/2005/program/paper/wed/p301-augsten.pdf.