Nicola Del Gobbo presented on developing Node.js native addons from scratch. Native addons allow integration of C/C++ code and libraries with Node.js for performance benefits. They can be loaded using require() but require special handling to interface with JavaScript. The presentation covered why to use native addons, how to structure a project, asynchronous programming, and interfacing with Node.js objects like EventEmitters and streams. Upcoming N-API will improve compatibility across Node.js versions and platforms.
Spring Northwest Usergroup Grails Presentationajevans
This is a presentation I gave at the Spring Northwest Usergroup (Manchester) 01/12/2009 . I quickly go over the basics of grails / groovy and then demonstrate using Spring AOP in grails showing how easy it is to use your existing spring beans and spring projects.
Minko - Build WebGL applications with C++ and asm.jsMinko3D
This document summarizes an HTML5 Meetup about building WebGL applications with C++ and ASM.js. It discusses how C++ is more expressive than JavaScript for complex 3D applications and allows leveraging existing C++ libraries and performance through GPU programming. It outlines using Emscripten to cross-compile C++ to JavaScript, generating optimized ASM.js code. It also discusses tools like Premake for cross-platform building and Vagrant for consistently provisioning the build environment. Examples are given of building a 3D application with C++ and WebGL that runs across desktop, mobile and web with good performance and binary size.
Serverless is new trend in software development. It’s confusing many developers around the world. In this talk I’ll explain how to build not only crop images or select data from DynamoDB, but build real application, what kind of troubles are we should expect, how to make decision is your task fit into serverless architecture in Python or may be you should use, general approach. How fast serverless applications and more important how to scale it.
This document discusses the benefits of implementing infrastructure, pipelines, images, servers, orchestration, and chat operations as code. Key benefits include being reproducible, saving time, avoiding human error, and not becoming outdated. It outlines tools like Terraform, Jenkins, Packer, Kubernetes, Docker, configuration management, and Hubot. Code samples and demos are provided to define infrastructure with Terraform, transform jobs into pipelines with Jenkins, build images with Packer, define containers in Kubernetes, build servers with Docker, and interact with services through Hubot chat. A link is provided to access additional sample code.
C# Async on iOS and Android - Craig Dunn, Developer Evangelist at XamarinXamarin
Fast, fluid, instant-gratification apps are a must for mobile and C# async makes this much easier to accomplish. Xamarin Developer Evangelist, Craig Dunn, demos C# async on mobile apps.
Slides are from the Xamarin webinar on C# Async on iOS and Android on August 15, 2013.
The React team rewrote the book on developing components. Before we had a choice between classes and functional components. Yet many components needed to be classes. A functional component was often too limited. Now, using hooks, we can extend functional components to be as powerful as we want.
Suspense and asynchronous rendering is in the future of React. It will make large applications much more responsive and easier to deal with. Getting started with suspense and asynchronous rendering isn't hard as you will discover.
Come to this session to learn what React hooks are and how to get started using hooks. But be warned, once seen React hooks can’t be unseen and your React components will never be the same again.
C# Async on iOS and Android - Miguel de Icaza, CTO of XamarinXamarin
Fast, fluid, instant-gratification apps are a must for mobile and C# async makes this much easier to accomplish.
Slides are from the Xamarin CTO and cofounder Miguel de Icaza to understand how and why you should use async for your mobile apps.
Nicola Del Gobbo presented on developing Node.js native addons from scratch. Native addons allow integration of C/C++ code and libraries with Node.js for performance benefits. They can be loaded using require() but require special handling to interface with JavaScript. The presentation covered why to use native addons, how to structure a project, asynchronous programming, and interfacing with Node.js objects like EventEmitters and streams. Upcoming N-API will improve compatibility across Node.js versions and platforms.
Spring Northwest Usergroup Grails Presentationajevans
This is a presentation I gave at the Spring Northwest Usergroup (Manchester) 01/12/2009 . I quickly go over the basics of grails / groovy and then demonstrate using Spring AOP in grails showing how easy it is to use your existing spring beans and spring projects.
Minko - Build WebGL applications with C++ and asm.jsMinko3D
This document summarizes an HTML5 Meetup about building WebGL applications with C++ and ASM.js. It discusses how C++ is more expressive than JavaScript for complex 3D applications and allows leveraging existing C++ libraries and performance through GPU programming. It outlines using Emscripten to cross-compile C++ to JavaScript, generating optimized ASM.js code. It also discusses tools like Premake for cross-platform building and Vagrant for consistently provisioning the build environment. Examples are given of building a 3D application with C++ and WebGL that runs across desktop, mobile and web with good performance and binary size.
Serverless is new trend in software development. It’s confusing many developers around the world. In this talk I’ll explain how to build not only crop images or select data from DynamoDB, but build real application, what kind of troubles are we should expect, how to make decision is your task fit into serverless architecture in Python or may be you should use, general approach. How fast serverless applications and more important how to scale it.
This document discusses the benefits of implementing infrastructure, pipelines, images, servers, orchestration, and chat operations as code. Key benefits include being reproducible, saving time, avoiding human error, and not becoming outdated. It outlines tools like Terraform, Jenkins, Packer, Kubernetes, Docker, configuration management, and Hubot. Code samples and demos are provided to define infrastructure with Terraform, transform jobs into pipelines with Jenkins, build images with Packer, define containers in Kubernetes, build servers with Docker, and interact with services through Hubot chat. A link is provided to access additional sample code.
C# Async on iOS and Android - Craig Dunn, Developer Evangelist at XamarinXamarin
Fast, fluid, instant-gratification apps are a must for mobile and C# async makes this much easier to accomplish. Xamarin Developer Evangelist, Craig Dunn, demos C# async on mobile apps.
Slides are from the Xamarin webinar on C# Async on iOS and Android on August 15, 2013.
The React team rewrote the book on developing components. Before we had a choice between classes and functional components. Yet many components needed to be classes. A functional component was often too limited. Now, using hooks, we can extend functional components to be as powerful as we want.
Suspense and asynchronous rendering is in the future of React. It will make large applications much more responsive and easier to deal with. Getting started with suspense and asynchronous rendering isn't hard as you will discover.
Come to this session to learn what React hooks are and how to get started using hooks. But be warned, once seen React hooks can’t be unseen and your React components will never be the same again.
C# Async on iOS and Android - Miguel de Icaza, CTO of XamarinXamarin
Fast, fluid, instant-gratification apps are a must for mobile and C# async makes this much easier to accomplish.
Slides are from the Xamarin CTO and cofounder Miguel de Icaza to understand how and why you should use async for your mobile apps.
René Gröschke gave a talk on the latest features and future direction of Gradle. Some of the key points included:
- Gradle is moving to a Kotlin-based DSL for improved performance, tooling support, and bringing application patterns to builds.
- Performance improvements include a dedicated performance team that has improved Android Gradle Plugin build times significantly.
- Composite builds allow including external projects to debug dependencies or test plugins against real projects.
- Build cache and distributed build cache are incubating features to cache and share build results for faster rebuilds.
- Gradle build scans provide insights into builds to debug issues, optimize performance, and compare builds
How to model Infrastructure as Code as part of CI / CD, incorporating it into your standard application development lifecycle, execute infrastructure changes in your CI/CD pipeline, and get additional benefits, such as reducing configuration errors and provisioning faster. All this leveraging IaC Tools on AWS like AWS CloudFormation, AWS SAM & AWS CDK
Efficient DevOps Tooling with Java and GraalVMQAware GmbH
The document discusses using Java and GraalVM to build efficient DevOps tooling. It describes how GraalVM can eliminate extraneous cognitive load through polyglot programming and ahead-of-time compilation. It provides examples of using Picocli and GraalVM to build command line interfaces for operations tasks like container orchestration and managing Kubernetes deployments through operators.
Applying principles and practices towards IaC automation. Presented at ThoughtWorks Gurgaon GeekNight Feb 2018
DEMO: https://github.com/hrmeetsingh/terraform-aws-vpc
This document discusses using Emscripten to compile C++ code to JavaScript. It shows how Emscripten adds an asm.js backend to LLVM, allowing any LLVM-supported language like C++ to target JavaScript. Benchmarks show Emscripten-compiled code runs faster than native JavaScript for tasks like summing arrays and matrix multiplication by using optimized libraries and compiler optimizations not available to JavaScript. The document advocates using Emscripten to compile C++ to JavaScript when performance is important, as it allows using the best tools and libraries for the job.
Serverless has gained a lot on popularity recently and changed the way we develop the applications. We no longer need to care about setting up and managing the servers, scalability and deployment is simplified. Serverless is very often referred to as the approach which will let you to shift focus to implementing business logic when writing the code. But where has the complexity moved to now? How performant is Java code in serverless solution? Is serverless good for complex solutions? What are the benefits? During my talk I’d like to answer those questions based on our experiences of working on serverless solution written fully in Java.
This document discusses serverless computing with AWS Lambda. It begins by explaining that serverless does not mean there are no servers, but rather code is executed when triggered by events. An example is given of a serverless API using API Gateway to trigger a Lambda function. The document outlines some key aspects of how serverless works with Lambda such as supported languages, logging to CloudWatch, and resource limits for Lambda functions. Overall limits are discussed and it is noted autoscaling can provide more resources when needed. The document concludes by mentioning potential use cases for serverless and posing questions.
Graph ql subscriptions through the looking glassGerard Klijs
This document summarizes a reflection on GraphQL subscriptions and four GraphQL server implementations on the JVM. It provides an overview of GraphQL and how subscriptions work over websockets. It then evaluates lacinia-pedestal, graphql-spring-boot-starter, graphql-kotlin, and micronaut-graphql in terms of their source, engine used, support for only subscriptions over websockets, and whether they are code or schema first. Performance tests showed average end-to-end latency and throughput of up to 300 new subscriptions/second. The document concludes with questions and future directions for GraphQL subscriptions.
Building occasionally connected applications using event sourcingDennis Doomen
I've recently got the opportunity to work on a large enterprise-class system that needs to be deployed on multiple occasionally connected oil platforms and boats. Already the system's architecture was based on the Command Query Separation principles, this gave us a completely new challenge. After several months of looking at alternatives, we decided to go the Event Sourcing direction. In this in-depth session, I'd like you to learn the many alternatives we observed, the pros and cons, and the technical details of our final solution in which we use EventStore 3.0 and elements of NCQRS and Lokad.CQRS to synchronize systems over unreliable connections in a very efficient way.
The Alfresco Development Framework (ADF) provides over 100 reusable Angular components and services, development tools to streamline building applications, and is based on standard technologies like Angular and Material Design; it has four pillars including the JavaScript library, Angular components, app generator, and example apps; and the framework core utilizes technologies like JavaScript, HTML5, CSS, TypeScript, Angular, and development tools like Node, NPM, and GitHub.
1) The document discusses managing short-lived Kubernetes deployments and outlines the steps taken to implement a DevOps process using Kubernetes and Azure Container Services.
2) Key priorities included enabling CI/CD, automatic provisioning, and minimizing the need for operations work.
3) The solution implemented Kubernetes with Azure Container Services using Azure as the IaaS provider to enable on-demand development and test environments identical to production.
Powering machine learning workflows with Apache Airflow and PythonTatiana Al-Chueyr
This document provides an overview of using Apache Airflow to power machine learning workflows with Python. It discusses Airflow concepts like DAGs, operators, relationships and visualizations. It also covers installing Airflow, common issues experienced like debugging and versioning, and using Airflow for machine learning tasks like model building and hyperparameter tuning. Examples of Airflow pipelines for data ingestion and machine learning are demonstrated. The presenter's background and the BBC Datalab team are briefly introduced.
Everything-as-code. Polyglotte Software-Entwicklung in der Praxis.QAware GmbH
OOP 2017, München: Vortrag von Mario-Leander Reimer (@LeanderReimer, Cheftechnologe bei QAware).
Abstract: Als zeitgemäßer Entwickler muss man eine Vielzahl an Sprachen sicher beherrschen. Wir definieren unsere Entwicklungsumgebung mit Gradle, wir bauen unsere Software in Java, Kotlin oder sogar JavaScript. Wir verwenden Groovy und Scala, um unsere Software zu testen. Die Build-Pipeline wird per DSL und JSON definiert. Mit YAML und Python beschreiben wir die Infrastruktur und das Deployment unserer Anwendungen. Die Dokumentation unserer Architekturen erledigen wir mit AsciiDoc und JRuby. Willkommen in Babel! Hallo Software-Industrialisierung!
Use the right tool for the job! Das ist das Motto dieser Session. Jede Sprache hat Stärken in einer bestimmten Domäne. Diese Stärken gilt es zu nutzen. Aber einfach blind jede gerade angesagte Sprache einzusetzen, ist sicher nicht die Lösung. Genau das versuchen wir mit dieser Session zu vermitteln. Stattdessen braucht es eine gut integrierte und abgestimmte Tool-Chain. Wir berichten aus der Praxis: what worked for us and what did not.
Developing Microservices with Apache CamelClaus Ibsen
Red Hat Microservices Architecture Day - New York, November 2015. Presented by Claus Ibsen.
Apache Camel is a very popular integration library that works very well with microservice architecture. This talk introduces you to Apache Camel and how you can easily get started with Camel on your computer. Then we cover how to create new Camel projects from scratch as microservices, which you can boot using Camel or Spring Boot, or other micro containers such as Jetty or fat JARs. We then take a look at what options you have for monitoring and managing your Camel microservices using tooling such as Jolokia, and hawtio web console.
Presentation of a session about how we use AWS Neptune graph database and the road that we took from 0 to production as it was given at GeekTime Code conference by Ohad Israeli Tech Engineering Architect @ Natural Intelligence
Continuous deployment of Rails apps on AWS OpsWorksTomaž Zaman
This document discusses continuous deployment of Rails applications on AWS OpsWorks. It begins with introductions and then covers:
- Using SCRUM methodology for development
- Git workflow with feature branches and pull requests
- Tools for monitoring gems (Gemnasium) and code quality (CodeClimate, Travis CI)
- An overview of AWS OpsWorks including stacks, layers, apps, and using Chef for automation
- How OpsWorks deployments work by pulling from GitHub and running deployment hooks
- Other AWS services that can be used like RDS, ElastiCache, S3
- Logging to external services like Loggly
- Approaches for running background jobs like Sidekiq
-
Aws lambda best practices - ignite - dev opsdays-charlotteDerek Ashmore
The document discusses best practices for AWS Lambda functions including:
1. Logging all inputs and environment variables on exceptions, checking arguments up front, and documenting the source repository to make support easier.
2. Separating Lambda code from business logic to improve reusability and local development/debugging.
3. Automating builds and deployments while only installing Lambda functions once to avoid duplicative work.
4. Using configuration injection and secrets managers instead of hardcoded secrets to improve security.
5. Avoiding heavy dependency packages to reduce cold start times.
Cortex: Prometheus as a Service, One Year OnKausal
Presented by Tom Wilkie at PromCon 2017
With Speaker Notes: https://goo.gl/V9qGva
At PromCon 2016, I presented "Project Frankenstein: A multitenant, horizontally scalable Prometheus as a service". It's now one year later, and lots has changed - not least the name! This talk will discuss what we've learnt running a Prometheus service for the past year, the architectural changes we made from the original design, and the improvements we've made to the Cortex user experience.
Node.js Native AddOns from zero to hero - Nicola Del Gobbo - Codemotion Rome ...Codemotion
This talk is about creating Node.js interfaces for native libraries written in C or C++. It starts with various situations in which you need to build native addons and the common problems in doing that. I'll discuss the reference provided by the new N-API (Node-API) that helps mantainers to support a wide variety of Node.js releases without needing recompilation or abstraction layers. With all these tools and knowledge I'll show you how to build some addons from scratch and how to convert existing addons using the new N-API. The last part is related to future developments about addons.
Node.js is a JavaScript runtime built on Chrome's V8 engine that allows JavaScript code to be run outside of a browser. It introduces asynchronous and event-driven programming to JavaScript. Native addons allow integrating C/C++ code and libraries into Node.js applications for performance reasons or to interface with legacy code. The N-API provides a stable API for building native addons that is compatible across Node.js versions to avoid breakage. Examples demonstrate how to create asynchronous native addons that interface between JavaScript and C++ code.
René Gröschke gave a talk on the latest features and future direction of Gradle. Some of the key points included:
- Gradle is moving to a Kotlin-based DSL for improved performance, tooling support, and bringing application patterns to builds.
- Performance improvements include a dedicated performance team that has improved Android Gradle Plugin build times significantly.
- Composite builds allow including external projects to debug dependencies or test plugins against real projects.
- Build cache and distributed build cache are incubating features to cache and share build results for faster rebuilds.
- Gradle build scans provide insights into builds to debug issues, optimize performance, and compare builds
How to model Infrastructure as Code as part of CI / CD, incorporating it into your standard application development lifecycle, execute infrastructure changes in your CI/CD pipeline, and get additional benefits, such as reducing configuration errors and provisioning faster. All this leveraging IaC Tools on AWS like AWS CloudFormation, AWS SAM & AWS CDK
Efficient DevOps Tooling with Java and GraalVMQAware GmbH
The document discusses using Java and GraalVM to build efficient DevOps tooling. It describes how GraalVM can eliminate extraneous cognitive load through polyglot programming and ahead-of-time compilation. It provides examples of using Picocli and GraalVM to build command line interfaces for operations tasks like container orchestration and managing Kubernetes deployments through operators.
Applying principles and practices towards IaC automation. Presented at ThoughtWorks Gurgaon GeekNight Feb 2018
DEMO: https://github.com/hrmeetsingh/terraform-aws-vpc
This document discusses using Emscripten to compile C++ code to JavaScript. It shows how Emscripten adds an asm.js backend to LLVM, allowing any LLVM-supported language like C++ to target JavaScript. Benchmarks show Emscripten-compiled code runs faster than native JavaScript for tasks like summing arrays and matrix multiplication by using optimized libraries and compiler optimizations not available to JavaScript. The document advocates using Emscripten to compile C++ to JavaScript when performance is important, as it allows using the best tools and libraries for the job.
Serverless has gained a lot on popularity recently and changed the way we develop the applications. We no longer need to care about setting up and managing the servers, scalability and deployment is simplified. Serverless is very often referred to as the approach which will let you to shift focus to implementing business logic when writing the code. But where has the complexity moved to now? How performant is Java code in serverless solution? Is serverless good for complex solutions? What are the benefits? During my talk I’d like to answer those questions based on our experiences of working on serverless solution written fully in Java.
This document discusses serverless computing with AWS Lambda. It begins by explaining that serverless does not mean there are no servers, but rather code is executed when triggered by events. An example is given of a serverless API using API Gateway to trigger a Lambda function. The document outlines some key aspects of how serverless works with Lambda such as supported languages, logging to CloudWatch, and resource limits for Lambda functions. Overall limits are discussed and it is noted autoscaling can provide more resources when needed. The document concludes by mentioning potential use cases for serverless and posing questions.
Graph ql subscriptions through the looking glassGerard Klijs
This document summarizes a reflection on GraphQL subscriptions and four GraphQL server implementations on the JVM. It provides an overview of GraphQL and how subscriptions work over websockets. It then evaluates lacinia-pedestal, graphql-spring-boot-starter, graphql-kotlin, and micronaut-graphql in terms of their source, engine used, support for only subscriptions over websockets, and whether they are code or schema first. Performance tests showed average end-to-end latency and throughput of up to 300 new subscriptions/second. The document concludes with questions and future directions for GraphQL subscriptions.
Building occasionally connected applications using event sourcingDennis Doomen
I've recently got the opportunity to work on a large enterprise-class system that needs to be deployed on multiple occasionally connected oil platforms and boats. Already the system's architecture was based on the Command Query Separation principles, this gave us a completely new challenge. After several months of looking at alternatives, we decided to go the Event Sourcing direction. In this in-depth session, I'd like you to learn the many alternatives we observed, the pros and cons, and the technical details of our final solution in which we use EventStore 3.0 and elements of NCQRS and Lokad.CQRS to synchronize systems over unreliable connections in a very efficient way.
The Alfresco Development Framework (ADF) provides over 100 reusable Angular components and services, development tools to streamline building applications, and is based on standard technologies like Angular and Material Design; it has four pillars including the JavaScript library, Angular components, app generator, and example apps; and the framework core utilizes technologies like JavaScript, HTML5, CSS, TypeScript, Angular, and development tools like Node, NPM, and GitHub.
1) The document discusses managing short-lived Kubernetes deployments and outlines the steps taken to implement a DevOps process using Kubernetes and Azure Container Services.
2) Key priorities included enabling CI/CD, automatic provisioning, and minimizing the need for operations work.
3) The solution implemented Kubernetes with Azure Container Services using Azure as the IaaS provider to enable on-demand development and test environments identical to production.
Powering machine learning workflows with Apache Airflow and PythonTatiana Al-Chueyr
This document provides an overview of using Apache Airflow to power machine learning workflows with Python. It discusses Airflow concepts like DAGs, operators, relationships and visualizations. It also covers installing Airflow, common issues experienced like debugging and versioning, and using Airflow for machine learning tasks like model building and hyperparameter tuning. Examples of Airflow pipelines for data ingestion and machine learning are demonstrated. The presenter's background and the BBC Datalab team are briefly introduced.
Everything-as-code. Polyglotte Software-Entwicklung in der Praxis.QAware GmbH
OOP 2017, München: Vortrag von Mario-Leander Reimer (@LeanderReimer, Cheftechnologe bei QAware).
Abstract: Als zeitgemäßer Entwickler muss man eine Vielzahl an Sprachen sicher beherrschen. Wir definieren unsere Entwicklungsumgebung mit Gradle, wir bauen unsere Software in Java, Kotlin oder sogar JavaScript. Wir verwenden Groovy und Scala, um unsere Software zu testen. Die Build-Pipeline wird per DSL und JSON definiert. Mit YAML und Python beschreiben wir die Infrastruktur und das Deployment unserer Anwendungen. Die Dokumentation unserer Architekturen erledigen wir mit AsciiDoc und JRuby. Willkommen in Babel! Hallo Software-Industrialisierung!
Use the right tool for the job! Das ist das Motto dieser Session. Jede Sprache hat Stärken in einer bestimmten Domäne. Diese Stärken gilt es zu nutzen. Aber einfach blind jede gerade angesagte Sprache einzusetzen, ist sicher nicht die Lösung. Genau das versuchen wir mit dieser Session zu vermitteln. Stattdessen braucht es eine gut integrierte und abgestimmte Tool-Chain. Wir berichten aus der Praxis: what worked for us and what did not.
Developing Microservices with Apache CamelClaus Ibsen
Red Hat Microservices Architecture Day - New York, November 2015. Presented by Claus Ibsen.
Apache Camel is a very popular integration library that works very well with microservice architecture. This talk introduces you to Apache Camel and how you can easily get started with Camel on your computer. Then we cover how to create new Camel projects from scratch as microservices, which you can boot using Camel or Spring Boot, or other micro containers such as Jetty or fat JARs. We then take a look at what options you have for monitoring and managing your Camel microservices using tooling such as Jolokia, and hawtio web console.
Presentation of a session about how we use AWS Neptune graph database and the road that we took from 0 to production as it was given at GeekTime Code conference by Ohad Israeli Tech Engineering Architect @ Natural Intelligence
Continuous deployment of Rails apps on AWS OpsWorksTomaž Zaman
This document discusses continuous deployment of Rails applications on AWS OpsWorks. It begins with introductions and then covers:
- Using SCRUM methodology for development
- Git workflow with feature branches and pull requests
- Tools for monitoring gems (Gemnasium) and code quality (CodeClimate, Travis CI)
- An overview of AWS OpsWorks including stacks, layers, apps, and using Chef for automation
- How OpsWorks deployments work by pulling from GitHub and running deployment hooks
- Other AWS services that can be used like RDS, ElastiCache, S3
- Logging to external services like Loggly
- Approaches for running background jobs like Sidekiq
-
Aws lambda best practices - ignite - dev opsdays-charlotteDerek Ashmore
The document discusses best practices for AWS Lambda functions including:
1. Logging all inputs and environment variables on exceptions, checking arguments up front, and documenting the source repository to make support easier.
2. Separating Lambda code from business logic to improve reusability and local development/debugging.
3. Automating builds and deployments while only installing Lambda functions once to avoid duplicative work.
4. Using configuration injection and secrets managers instead of hardcoded secrets to improve security.
5. Avoiding heavy dependency packages to reduce cold start times.
Cortex: Prometheus as a Service, One Year OnKausal
Presented by Tom Wilkie at PromCon 2017
With Speaker Notes: https://goo.gl/V9qGva
At PromCon 2016, I presented "Project Frankenstein: A multitenant, horizontally scalable Prometheus as a service". It's now one year later, and lots has changed - not least the name! This talk will discuss what we've learnt running a Prometheus service for the past year, the architectural changes we made from the original design, and the improvements we've made to the Cortex user experience.
Node.js Native AddOns from zero to hero - Nicola Del Gobbo - Codemotion Rome ...Codemotion
This talk is about creating Node.js interfaces for native libraries written in C or C++. It starts with various situations in which you need to build native addons and the common problems in doing that. I'll discuss the reference provided by the new N-API (Node-API) that helps mantainers to support a wide variety of Node.js releases without needing recompilation or abstraction layers. With all these tools and knowledge I'll show you how to build some addons from scratch and how to convert existing addons using the new N-API. The last part is related to future developments about addons.
Node.js is a JavaScript runtime built on Chrome's V8 engine that allows JavaScript code to be run outside of a browser. It introduces asynchronous and event-driven programming to JavaScript. Native addons allow integrating C/C++ code and libraries into Node.js applications for performance reasons or to interface with legacy code. The N-API provides a stable API for building native addons that is compatible across Node.js versions to avoid breakage. Examples demonstrate how to create asynchronous native addons that interface between JavaScript and C++ code.
Node.js is a server-side JavaScript environment that allows building scalable network applications. It uses Google Chrome's V8 JavaScript engine and runs on a single thread without blocking I/O operations. Node.js is optimized for non-blocking event-driven operations and has a large ecosystem of reusable modules. Some common uses of Node.js include real-time web applications, REST APIs, streaming data applications, and networking servers.
Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5David Voyles
The video for this talk can be found here:https://channel9.msdn.com/Blogs/raw-tech/Getting-started-with-Emscripten--Transpiling-C--C-to-JavaScript--HTML5
I cover how to transpile code from C/C++ to HTML5/JS using Emscripten, an open source compiler tool from Mozilla and Alon Zakai.
This document provides an overview of topics that will be covered at a Microsoft Dev Camp in 2015. The topics include introductions to ASP.NET, Visual Studio web tools, ASP.NET Web API, building real-time web applications with SignalR, and Azure services. Sessions will cover web front-end development, ASP.NET updates, consuming and building Web APIs, and real-world scenarios for scaling, updating, and deploying applications on Azure.
React is a JavaScript library for building user interfaces that aims to solve issues with data changing over time in large web applications. It introduces components, re-rendering on data changes rather than mutating data, and a virtual DOM for efficient re-rendering. React uses a unidirectional data flow and one-way data binding that improves design architecture and code reusability. Related technologies like JSX, Flux, GraphQL, Relay, and React Native further enhance React's capabilities.
Unlike Node, which is a monolithic project, Deno is organized into a collection of Rust crates. I will summarize the history of why Ryan Dhal made this choice and what each crate is for. These include:
deno - Deno executable
deno_core - Ops and Resources
rusty_v8 Rust interface to V8
deno_typescript - type-checking and type-stripping at compile-time
Node.js Development with Apache NetBeansRyan Cuprak
This session covers the basics of developing Node.js applications with NetBeans. NetBeans includes fully integrated support for both JavaScript and Node.js. You’ll get a tour of the features and learn how NetBeans can accelerate your projects. The presentation looks at basic code editing capabilities provided by the IDE, tool integration (npm/Grunt/Bower/Webpack), frameworks such as Express, and debugging capabilities. You’ll see why NetBeans is the best free JavaScript/Node.js IDE.
dotnetconf 2020 è andato e ci ha lasciato .NET 5. Ovvero una delle più importanti release di .NET di sempre. Cosa significa per il nostro lavoro? Scopriamolo assieme
This document introduces CloudBridge, a Python library that provides a simple, uniform API for interacting with multiple cloud providers. It aims to allow users to write code once that can run on any supported cloud without specialization for individual providers. CloudBridge focuses on mature cloud APIs and offers a set of conformance tests to ensure compatibility without needing separate testing for each provider. The document outlines the goals, design, and features of CloudBridge, and provides code samples for setting up a provider and launching an instance using the uniform API.
The document provides an overview of the MEAN stack, which is a full-stack JavaScript solution for building web applications. It consists of MongoDB (a NoSQL database), Express (a Node.js web application framework), AngularJS (a client-side framework), and Node.js (a JavaScript runtime). The document discusses each component, how they work together, advantages like using a single programming language throughout and ability to build fast applications, and disadvantages like MongoDB not being as robust as SQL databases. It concludes that MEAN provides a fast, easy way to create modern, responsive dynamic web sites.
In 2014, users simply expect more from web apps, developers expect less complexity.
This presentation explains, why Meteor is the next generation platform that delievers a better user experience with less development effort and shows the three main traits that help evolve programming from the dinosaur stage to the modern web.
This document discusses delivering developer tools at scale for Oracle Bare Metal Cloud Services. It outlines the challenges of supporting many programming languages, tools, services, features and rapid innovation with a small team. The solutions discussed are using Swagger to declaratively describe APIs, open sourcing tools to engage the community, and maintaining API consistency. It also addresses handling multiple release scopes by using custom fields in the Swagger specification.
The document discusses how JavaScript can be used from the user interface on mobile and web apps through to the server and database using techniques like Node.js. It provides examples of how Node.js allows for high performance server-side JavaScript and how MongoDB can be used as a database. The document outlines lessons learned around challenges of multi-platform development and benefits of outsourcing databases and other services.
MongoDB World 2016: Get MEAN and Lean with MongoDB and KubernetesMongoDB
1) The document discusses using MongoDB and Kubernetes to reduce impedance mismatches in software stacks and deployment processes.
2) It proposes using a MEAN stack with MongoDB as the database to align the client, server, and data layers. Docker is used to package the application and Kubernetes manages deploying containers across a cluster.
3) The presentation includes demos of deploying a MEAN app to Kubernetes and running MongoDB on Kubernetes, including recovering from node failures through replication and services.
1> What is node
2> What is node.js
3> Installation steps
4> Create first Node application
5> How it works ?
6> Why node is so popular ?
7> Where to use ?
8> Advantages
9> Disadvantages
10> Statistics
Docker is a system for running applications securely isolated in a container to provide a consistent deployment environment. The document introduces Docker, discusses the challenges of deploying applications ("the matrix from hell"), and how Docker addresses these challenges by allowing applications and their dependencies to be packaged into lightweight executable containers that can run on any infrastructure. It also summarizes key Docker tools like Docker Compose for defining and running multi-container apps, Docker Machine for provisioning remote Docker hosts in various clouds, and Docker Swarm for clustering Docker hosts.
Announcing AWS CodeBuild - January 2017 Online Teck TalksAmazon Web Services
Today’s cutting edge companies have software release cycles measured in days instead of months. This agility is enabled by the DevOps practice of continuous integration and delivery, which automates building, testing, and deploying all code changes. This automation helps you catch bugs sooner and accelerates developer productivity. In this session, we’ll share the processes followed by Amazon engineers and discuss how you can bring them to your company by using a set of application lifecycle management tools from AWS: the newly announced AWS CodeBuild service, AWS CodePipeline, and AWS CodeDeploy.
Learning Objectives:
• Understand the concepts of DevOps, continuous integration, and continuous delivery
• Learn about Amazon’s DevOps practices
• Hear an overview of how to build a continuous integration and continuous delivery workflow using the combination of CodeBuild, CodePipeline, and CodeDeploy
This document discusses sharing code between React Native and native Android apps at Eaze. It describes Eaze's decision to use React Native to leverage their existing React JS team and share resources between mobile and web. While React Native provided initial velocity, native Android development improved performance. The document outlines their approach to sharing code between the platforms using a publish-subscribe model, serializing data and emitting events between native and JS layers via module bindings and callbacks.
The world of Node native add-on development continues to rapidly evolve. After widespread adoption of N-API starting last year, the Node native add-on ecosystem is gaining momentum as the underlying technology and tools continue to advance.
This workshop, offered by experts from the N-API team, describes important new features essential to the performance of your native add-on. These new features include asynchronous operations which permit you to safely and reliably spread your work across multiple threads. Context awareness permits your add-on to be loaded multiple times without the multiple copies interfering with each other. Finally, adopting thread-safe functions insures your functions run reliably regardless of the thread from which they are called or in which they run.
Whether you are just starting out with native add-ons or are an old pro looking for an update on N-API, bring your project or work through the workshop tutorials under the helpful guidance of the N-API experts. You’ll leave this workshop with a solid understanding of these important new technologies and how they apply to your own projects. And perhaps, with a bit of luck, working code!
This document summarizes Express, a web application framework for Node.js. It notes that Express is minimalist, unopinionated, and fast, processing around 21k requests per second. It discusses key Express features like middleware for request/response processing, error handling, routing, and template engines. It provides examples of middleware, security, and input validation packages that can be used with Express. The overall document introduces Express and its core capabilities for building web applications and APIs.
Dalla più semplice informazione, con una fotografia dei fatti chiara e documentata, alla più complessa fornitura di dati di ricerca e analisi comparate
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slackshyamraj55
Discover the seamless integration of RPA (Robotic Process Automation), COMPOSER, and APM with AWS IDP enhanced with Slack notifications. Explore how these technologies converge to streamline workflows, optimize performance, and ensure secure access, all while leveraging the power of AWS IDP and real-time communication via Slack notifications.
UiPath Test Automation using UiPath Test Suite series, part 5DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 5. In this session, we will cover CI/CD with devops.
Topics covered:
CI/CD with in UiPath
End-to-end overview of CI/CD pipeline with Azure devops
Speaker:
Lyndsey Byblow, Test Suite Sales Engineer @ UiPath, Inc.
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...Neo4j
Leonard Jayamohan, Partner & Generative AI Lead, Deloitte
This keynote will reveal how Deloitte leverages Neo4j’s graph power for groundbreaking digital twin solutions, achieving a staggering 100x performance boost. Discover the essential role knowledge graphs play in successful generative AI implementations. Plus, get an exclusive look at an innovative Neo4j + Generative AI solution Deloitte is developing in-house.
Essentials of Automations: The Art of Triggers and Actions in FMESafe Software
In this second installment of our Essentials of Automations webinar series, we’ll explore the landscape of triggers and actions, guiding you through the nuances of authoring and adapting workspaces for seamless automations. Gain an understanding of the full spectrum of triggers and actions available in FME, empowering you to enhance your workspaces for efficient automation.
We’ll kick things off by showcasing the most commonly used event-based triggers, introducing you to various automation workflows like manual triggers, schedules, directory watchers, and more. Plus, see how these elements play out in real scenarios.
Whether you’re tweaking your current setup or building from the ground up, this session will arm you with the tools and insights needed to transform your FME usage into a powerhouse of productivity. Join us to discover effective strategies that simplify complex processes, enhancing your productivity and transforming your data management practices with FME. Let’s turn complexity into clarity and make your workspaces work wonders!
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionAggregage
Join Maher Hanafi, VP of Engineering at Betterworks, in this new session where he'll share a practical framework to transform Gen AI prototypes into impactful products! He'll delve into the complexities of data collection and management, model selection and optimization, and ensuring security, scalability, and responsible use.
Full-RAG: A modern architecture for hyper-personalizationZilliz
Mike Del Balso, CEO & Co-Founder at Tecton, presents "Full RAG," a novel approach to AI recommendation systems, aiming to push beyond the limitations of traditional models through a deep integration of contextual insights and real-time data, leveraging the Retrieval-Augmented Generation architecture. This talk will outline Full RAG's potential to significantly enhance personalization, address engineering challenges such as data management and model training, and introduce data enrichment with reranking as a key solution. Attendees will gain crucial insights into the importance of hyperpersonalization in AI, the capabilities of Full RAG for advanced personalization, and strategies for managing complex data integrations for deploying cutting-edge AI solutions.
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...SOFTTECHHUB
The choice of an operating system plays a pivotal role in shaping our computing experience. For decades, Microsoft's Windows has dominated the market, offering a familiar and widely adopted platform for personal and professional use. However, as technological advancements continue to push the boundaries of innovation, alternative operating systems have emerged, challenging the status quo and offering users a fresh perspective on computing.
One such alternative that has garnered significant attention and acclaim is Nitrux Linux 3.5.0, a sleek, powerful, and user-friendly Linux distribution that promises to redefine the way we interact with our devices. With its focus on performance, security, and customization, Nitrux Linux presents a compelling case for those seeking to break free from the constraints of proprietary software and embrace the freedom and flexibility of open-source computing.
Securing your Kubernetes cluster_ a step-by-step guide to success !KatiaHIMEUR1
Today, after several years of existence, an extremely active community and an ultra-dynamic ecosystem, Kubernetes has established itself as the de facto standard in container orchestration. Thanks to a wide range of managed services, it has never been so easy to set up a ready-to-use Kubernetes cluster.
However, this ease of use means that the subject of security in Kubernetes is often left for later, or even neglected. This exposes companies to significant risks.
In this talk, I'll show you step-by-step how to secure your Kubernetes cluster for greater peace of mind and reliability.
Removing Uninteresting Bytes in Software FuzzingAftab Hussain
Imagine a world where software fuzzing, the process of mutating bytes in test seeds to uncover hidden and erroneous program behaviors, becomes faster and more effective. A lot depends on the initial seeds, which can significantly dictate the trajectory of a fuzzing campaign, particularly in terms of how long it takes to uncover interesting behaviour in your code. We introduce DIAR, a technique designed to speedup fuzzing campaigns by pinpointing and eliminating those uninteresting bytes in the seeds. Picture this: instead of wasting valuable resources on meaningless mutations in large, bloated seeds, DIAR removes the unnecessary bytes, streamlining the entire process.
In this work, we equipped AFL, a popular fuzzer, with DIAR and examined two critical Linux libraries -- Libxml's xmllint, a tool for parsing xml documents, and Binutil's readelf, an essential debugging and security analysis command-line tool used to display detailed information about ELF (Executable and Linkable Format). Our preliminary results show that AFL+DIAR does not only discover new paths more quickly but also achieves higher coverage overall. This work thus showcases how starting with lean and optimized seeds can lead to faster, more comprehensive fuzzing campaigns -- and DIAR helps you find such seeds.
- These are slides of the talk given at IEEE International Conference on Software Testing Verification and Validation Workshop, ICSTW 2022.
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Speck&Tech
ABSTRACT: A prima vista, un mattoncino Lego e la backdoor XZ potrebbero avere in comune il fatto di essere entrambi blocchi di costruzione, o dipendenze di progetti creativi e software. La realtà è che un mattoncino Lego e il caso della backdoor XZ hanno molto di più di tutto ciò in comune.
Partecipate alla presentazione per immergervi in una storia di interoperabilità, standard e formati aperti, per poi discutere del ruolo importante che i contributori hanno in una comunità open source sostenibile.
BIO: Sostenitrice del software libero e dei formati standard e aperti. È stata un membro attivo dei progetti Fedora e openSUSE e ha co-fondato l'Associazione LibreItalia dove è stata coinvolta in diversi eventi, migrazioni e formazione relativi a LibreOffice. In precedenza ha lavorato a migrazioni e corsi di formazione su LibreOffice per diverse amministrazioni pubbliche e privati. Da gennaio 2020 lavora in SUSE come Software Release Engineer per Uyuni e SUSE Manager e quando non segue la sua passione per i computer e per Geeko coltiva la sua curiosità per l'astronomia (da cui deriva il suo nickname deneb_alpha).
20 Comprehensive Checklist of Designing and Developing a WebsitePixlogix Infotech
Dive into the world of Website Designing and Developing with Pixlogix! Looking to create a stunning online presence? Look no further! Our comprehensive checklist covers everything you need to know to craft a website that stands out. From user-friendly design to seamless functionality, we've got you covered. Don't miss out on this invaluable resource! Check out our checklist now at Pixlogix and start your journey towards a captivating online presence today.
Threats to mobile devices are more prevalent and increasing in scope and complexity. Users of mobile devices desire to take full advantage of the features
available on those devices, but many of the features provide convenience and capability but sacrifice security. This best practices guide outlines steps the users can take to better protect personal devices and information.
Communications Mining Series - Zero to Hero - Session 1DianaGray10
This session provides introduction to UiPath Communication Mining, importance and platform overview. You will acquire a good understand of the phases in Communication Mining as we go over the platform with you. Topics covered:
• Communication Mining Overview
• Why is it important?
• How can it help today’s business and the benefits
• Phases in Communication Mining
• Demo on Platform overview
• Q/A
Sudheer Mechineni, Head of Application Frameworks, Standard Chartered Bank
Discover how Standard Chartered Bank harnessed the power of Neo4j to transform complex data access challenges into a dynamic, scalable graph database solution. This keynote will cover their journey from initial adoption to deploying a fully automated, enterprise-grade causal cluster, highlighting key strategies for modelling organisational changes and ensuring robust disaster recovery. Learn how these innovations have not only enhanced Standard Chartered Bank’s data infrastructure but also positioned them as pioneers in the banking sector’s adoption of graph technology.
Climate Impact of Software Testing at Nordic Testing DaysKari Kakkonen
My slides at Nordic Testing Days 6.6.2024
Climate impact / sustainability of software testing discussed on the talk. ICT and testing must carry their part of global responsibility to help with the climat warming. We can minimize the carbon footprint but we can also have a carbon handprint, a positive impact on the climate. Quality characteristics can be added with sustainability, and then measured continuously. Test environments can be used less, and in smaller scale and on demand. Test techniques can be used in optimizing or minimizing number of tests. Test automation can be used to speed up testing.
3. What is Node.js Native Addon?
In a very simple way Native Addons could be considered as
C / C++ code called from JavaScript
BRIDGE
Native environment JavaScript environment
4. From Node.js documentation
Node.js Addons are dynamically-linked shared objects, written in
C++, that can be loaded into Node.js using the require() function, and
used just as if they were an ordinary Node.js module.
They are used primarily to provide an interface between JavaScript
running in Node.js and C/C++ libraries.
5. How is it possible?
All the magic is behind the Node.js architecture
6. Why should you implement new Native Add-on?
Performance
In general C / C++ code performs better than JavaScript code, but it’s
really true for CPU bounds operations
• Image processing (in average 6 times faster)
• Video processing
• CRC cyclic redundancy check (in average 125 times faster)
• Compression
• Scientific calculus
• Algorithms that execute CPU heavy tasks
7. Why should you implement new Native Add-on?
Integrate legacy application
You have the source code of an old C / C++ application and want to
expose something of its functionalities through the new Node.js
application
8. Why should you implement new Native Add-on?
You don’t find what fits your specific needs on npm
Sometimes completely reimplementing the module in JavaScript is
not the right solution
Think at libraries like:
• ImageMagick
• Ghostscript
• FFmpeg
• TensorFlow
You have to concentrate on business logic of
your application and not on developing a single
module
9. Why should you implement new Native Add-on?
Desktop application
You want to use the local underlying CPU or GPU resources to
execute the most complex tasks
Es. Electron or NW.js
• Better performance on the local side
• Better performance on the server
10. Why should you implement new Native Add-on?
Better error handling
Even if you will use an old C / C++ library you will get an error
code that explains the error that just happened.
In new C / C++ library you have the exception
You don’t have to parse some string to identify if there was an
error and what kind of it
11. Problems
Fragmentation API
0.8 - 0.10.x - 0.12.x - 1.x - 2.x - 3.x - 4.x - 5.x - 6.x - 7.x - 8.x
The API to implement Native Add-Ons have been changed across
different version of Node.js
Most of the changes were on V8 API and ObjectWrap API
For more info http://v8docs.nodesource.com/
12. Problems
Fragmentation API
Need an adapter to stay compatible across different version of
Node.js
• NAN - Native Abstraction for Node.js
• API compatibility
• Strong bonded with V8 API
• You have to recompile your native add-ons switching to different
version of Node.js
13. Problems
Write portable C / C++ code
At one point your native code must compile on different:
ARCHITECTURE PLATFORM COMPILER
14. Problems
Documentation
• C / C++ libraries that you are integrating are not well
documented
• There are good references but not so much practical guide
focusing on concepts about Native Add-Ons
15. How to organize your native Addon project
src C/C++ code and maybe dependencies
binding.gyp building configurations
lib JavaScript code
package.json
18. Example: the binding.gyp
Sometimes finding the right settings for binding.gyp is not easy
Refer to GYP documentation
https://gyp.gsrc.io/docs/UserDocumentation.md
More useful examples to take inspiration from other developers
https://github.com/nodejs/node-gyp/wiki/”binding.gyp”-files-out-in-the-wild
19. Which kind of Addon should you implement?
TIME: Amount of processing time spent on the C++
code
DATA: Amount of data flowing between C++ and
JavaScript
22. ObjectWrap API
• ObjectWrap is a way to expose your C++ code to JavaScript
• You have to extend ObjectWrap class that includes the plumbing to connect
JavaScript code to a C++ object
• Classes extending ObjectWrap can be instantiated from JavaScript using the
new operator, and their methods can be directly invoked from JavaScript
• Unfortunately, the wrap part really refers to a way to group methods and
state
• It’s your responsibility write custom code to bridge each of your C++
class methods.
24. Lessons learned from my experience
• Create simple interface between C / C++ and JavaScript
• Insert complexity on the JavaScript side
• Think carefully at JavaScript interface
• Use ObjectWrap API to return C / C++ object to JavaScript
• Validate the types on the native side
• Expose only the functionalities you need
• Don’t block the event loop, stay asynchronous: this is a must if you will
use the Addons on a distributed system
• Use Buffer to pass big quantity of data
• If you have many parameters use JSON to pass and parse data
• Consider the using of protobuf
25. Present and future
• The largest number of native addons is written using NAN
• NAN helps stay compatible with old versions of Node.js
• N-API will be a game changer on the native addon
development
• ABI compatibility
• New ES6 types
• Isolated from V8 API (VM agnostic)
• C / C++
• Conversion tool that helps to migrate from NAN
• Great developer experience for mantainers
26. Implement high performance
key value database
Binding to Vedis an embeddable datastore C library
https://github.com/NickNaso/conf-ni-
2017
Good afternoon everyone. Thank you to attend my talk, today I’m very honored to be here and share my ideas with all of you.
My name is Nicola Del Gobbo and I’m developer at Packly. In my every day work I take care of building Packly’s backend systems. In my spare time I try to give my contribution to all frameworks, libraries and modules that I use in my work and obviously I like creating new one. Today the talk is focused on Node.js native addon start with its definition.
In a very simple way Native Addons could be considered as C / C++ code called from JavaScript. They are a bridge between our Application programming language JavaScript and Native environment that is completely written in C / C++. This allow us to call C / C++ functions and methods directly from JavaScript.
If we take a look at Node.js documentation under Addons section Native Addons are defined as: dynamically-linked shared objects, written in C++, that can be loaded into Node.js using the require() function, and used just as if they were an ordinary Node.js module
Their main purpose is to provide an interface between JavaScript running in Node.js and C / C++ libraries.
This increase the developer experience because if you are using a Native Addon you don’t care of this, but you just use it as any other pure JavaScript module.
How is it possible?
All the magic is behind the Node.js architecture.
Node.js is built on some C / C++ libraries the most important for us as native addon developers are V8 and libuv.
V8 is a JavaScript engine that take care to compile JavaScript code, execute it and give us great performance.
Through the V8 APIs we can create function, object and do almost everything that we do on the JavaScript side.
Libuv is a high performance evented I/O library and has the responsibility to handle the event loop (our main thread) and all the asynchronous tasks.
Why should you implement new Native Add-On?
The first reason is for performance
In general C / C++ code performs better then JavaScript code, but it’s really true for CPU bounds operations.
Think for example at:
Image processing | Video processing | Compression | Scientific calculus | Cyclic redundancy check and all algorithms that at one point execute some CPU heavy tasks.
In all these cases you can gain more in performance.
Sometimes you want just integrate a legacy application
So you have the source code of an old C / C++ application and want to expose something of its functionalities through new Node.js application
Even if npm is a very large repo where you can find almost everything sometimes you don’t find what fits your specific needs and in this case you have to take a choice.
Completely reimplementing the module in JavaScript, but in my opinion it’s an insane idea to reimplement from the ground solutions like ImageMagick | Ghostscript | Ffmpeg and TensorFlow because you will lose all your time on develop a module and not to concentrate on business logic of your application. In these cases the
When I start to develop a new native addon I use the boilerplate depicted on the slide. Here the most important elements are the SRC and LIB folders.
SRC folder contains the C / C++ code and the native dependencies
while
the LIB folder contains the JavaScript code
There are also the usual package.json file and the binging.gyp file that contains all the building configurations for the addon.
At the end our addon will be composed by two parts one written in C++ and another written in JavaScript and usually the JavaScript part will use the
native code to expose some features
In the example we can see the JavaScript part of bcrypt addon.
For who of you that don’t know it: Bcrypt is a module that help us to hash passwords.
In the reported portion of code it import the addon and call its function: gen_salt_sync.
To understand how to create this function we have to take a look at C / C++ part of the module
What happen here?
The macro NODE_MODULE creates code that will register a module named ”bcypt_lib” and in addition it will ensure that a function init is called when the module is required.
In the init we export our function or object. In the reported example we export gen_salt_sync and you can find the code executed by this function in the method GenerateSaltSync.
As first thing we validate the input data, then transfer the JavaScript input to C++ data structure. C++ code perform the requested computation and before returning transfer the output data to JavaScript context.
This is the most straightforward integration pattern that you can realize to pass data between JavaScript and C / C++ . The main reason for using this approach is simplicity and because you can integrate the C++ without modification. In addition we have a complete decoupling of the JavaScript and C++ code.
In our binding.gyp we need to set the target name that will match the module name. The reported example is almost simple sometimes finding the right settings for binding.gyp is not easy so I suggest to take a look at GYP documentation or at nodey-gyp wiki where there are examples of existing binding.gyp and use them as source of inspiration to solve your problems with these kind of configurations.
We can categorize the different use cases for addons considering the amount of time we’ll spend in the C++ code and the amount of data flowing between C++ and JavaScript.
If you are in the left quadrant maybe your native addon can be synchronous and this means that the native code will be executed directly on the event loop when called.
In the right quadrants for sure, you have to implement the addon using the asynchronous pattern.
The difference between the top and bottom quadrants is often overlooked, but it is equally important.
Sometimes the cost of copying all data between JvaScript to C++ and vice versa usually kills the performance benefits you obtained from C++.
In this scenarios we should consider to use the Buffer to pass the data because it uses the memory outside the V8 heap, this means that it’s not subject to the multi-threading rules of V8
and we can interact with it in place from a C++.
In an asynchronous addon function, the calling JavaScript code returns immediately.
The calling code passes a callback function to the addon, and the addon does its work in a separate worker thread.
This avoids locking up the Node.js event loop, as the addon function does not block.
Store a reference to this constructor so it can be called in New if New is called without constructor syntax