The document summarizes the RProtoBuf package, which implements Protocol Buffers (a data serialization format) for R. RProtoBuf uses C++ bindings to expose Protocol Buffer objects to R in a way that makes them behave like standard R lists. This allows easy creation, manipulation, parsing and serialization of Protocol Buffer messages from R. Examples show how to define message types in Proto files, create messages in R, and read serialized data efficiently into R for analysis. Benchmarking demonstrates that the compiled C++ reader is over 20x faster than a pure R implementation.
File Operation such as
Reading the file content
Writing the content to the file
Copying the content from one file to another file
Counting the number of character, words and lines of the file
Language-agnostic data analysis workflows and reproducible researchAndrew Lowe
This was a talk that I gave at CERN at the Inter-experimental Machine Learning (IML) Working Group Meeting in April 2017 about language-agnostic (or polyglot) analysis workflows. I show how it is possible to work in multiple languages and switch between them without leaving the workflow you started. Additionally, I demonstrate how an entire workflow can be encapsulated in a markdown file that is rendered to a publishable paper with cross-references and a bibliography (and with raw LaTeX file produced as a by-product) in a simple process, making the whole analysis workflow reproducible. For experimental particle physics, ROOT is the ubiquitous data analysis tool, and has been for the last 20 years old, so I also talk about how to exchange data to and from ROOT.
File Operation such as
Reading the file content
Writing the content to the file
Copying the content from one file to another file
Counting the number of character, words and lines of the file
Language-agnostic data analysis workflows and reproducible researchAndrew Lowe
This was a talk that I gave at CERN at the Inter-experimental Machine Learning (IML) Working Group Meeting in April 2017 about language-agnostic (or polyglot) analysis workflows. I show how it is possible to work in multiple languages and switch between them without leaving the workflow you started. Additionally, I demonstrate how an entire workflow can be encapsulated in a markdown file that is rendered to a publishable paper with cross-references and a bibliography (and with raw LaTeX file produced as a by-product) in a simple process, making the whole analysis workflow reproducible. For experimental particle physics, ROOT is the ubiquitous data analysis tool, and has been for the last 20 years old, so I also talk about how to exchange data to and from ROOT.
Python uses DYNAMIC typing AND A COMBINATION of reference counting AND A cycle-detecting GARBAGE collector for memory MANAGEMENT. It ALSO FEATURES DYNAMIC NAME RESOLUTION(LATE binding) which binds methods AND VARIABLE NAMES during PROGRAM execution.
As we know, whenever we run ANY APPLICATION it gets LOADED into RAM AND some memory gets ALLOCATED by OS for THAT APPLICATION.
Learn more about Python PRogramming with Learnbay.
Visit:https://www.learnbay.co/data-science-course/
SOFTWARE TOOL FOR TRANSLATING PSEUDOCODE TO A PROGRAMMING LANGUAGEIJCI JOURNAL
Pseudocode is an artificial and informal language that helps programmers to develop algorithms. In this
paper a software tool is described, for translating the pseudocode into a particular programming
language. This tool takes the pseudocode as input, compiles it and translates it to a concrete programming
language. The scope of the tool is very much wide as we can extend it to a universal programming tool
which produces any of the specified programming language from a given pseudocode. Here we present the
solution for translating the pseudocode to a programming language by implementing the stages of a
compiler.
The C++ Programming Language is basically an extension of the C Programming Language. The C Programming language was developed from 1969-1973 at Bell labs, at the same time the UNIX operating system was being developed there. C was a direct descendant of the language B, which was developed by Ken Thompson as a systems programming language for the fledgling UNIX operating system. B, in turn, descended from the language BCPL which was designed in the 1960s by Martin Richards while at MIT.
In 1971 Dennis Ritchie at Bell Labs extended the B language (by adding types) into what he called NB, for "New B". Ritchie credits some of his changes to language constructs found in Algol68, although he states "although it [the type scheme], perhaps, did not emerge in a form that Algol's adherents would approve of" After restructuring the language and rewriting the compiler for B, Ritchie gave his new language a name: "C".
The future of DSLs - functions and formal methodsMarkus Voelter
I have used domain-specific languages to empower non-programmers in healthcare, finance, aerospace, automotive and public administration for years. My approach relies on growing the DSL from a functional programming core, combining the flexibility and power of an algorithmic language with domain-specific constructs that range from temporal data types, state machines and data models to polymorphic dispatch between versions of calculation rules. I rely on the open source MPS workbench to define the languages and their IDE. I am looking to incremental model transformations to desugar domain-specific constructs back to a minimal core language in realtime. That core language will have an interpreter for in-IDE execution and a compiler for deployment. The language will be integrated with formal methods to verify properties of programs, enabling advanced analyses for DSL users. In this talk, I will demo some existing DSLs, provide an illustration of how they are built, and demo prototypes of the future approach while discussing their integration with formal methods.
C is mother language of all programming language.
It is a system programming language. It is a procedure-oriented programming language. It is also called mid-level programming language.
C evolved from a language called B, written by Ken Thompson at Bell Labs in 1970. Ken used B to write one of the first implementations of UNIX. B in turn was a descendant of the language BCPL (developed at Cambridge (UK) in 1967), with most of its instructions removed.
So many instructions were removed in going from BCPL to B, that Dennis Ritchie of Bell Labs put some back in (in 1972), and called the language C.
The famous book The C Programming Language was written by Kernighan and Ritchie in 1978, and was the definitive reference book on C for almost a decade.
The original C was still too limiting, and not standardized, and so in 1983, an ANSI committee was established to formalize the language definition.
It has taken until now (ten years later) for the ANSI ( American National Standard Institute) standard to become well accepted and almost universally supported by compilers.
Python uses DYNAMIC typing AND A COMBINATION of reference counting AND A cycle-detecting GARBAGE collector for memory MANAGEMENT. It ALSO FEATURES DYNAMIC NAME RESOLUTION(LATE binding) which binds methods AND VARIABLE NAMES during PROGRAM execution.
As we know, whenever we run ANY APPLICATION it gets LOADED into RAM AND some memory gets ALLOCATED by OS for THAT APPLICATION.
Learn more about Python PRogramming with Learnbay.
Visit:https://www.learnbay.co/data-science-course/
SOFTWARE TOOL FOR TRANSLATING PSEUDOCODE TO A PROGRAMMING LANGUAGEIJCI JOURNAL
Pseudocode is an artificial and informal language that helps programmers to develop algorithms. In this
paper a software tool is described, for translating the pseudocode into a particular programming
language. This tool takes the pseudocode as input, compiles it and translates it to a concrete programming
language. The scope of the tool is very much wide as we can extend it to a universal programming tool
which produces any of the specified programming language from a given pseudocode. Here we present the
solution for translating the pseudocode to a programming language by implementing the stages of a
compiler.
The C++ Programming Language is basically an extension of the C Programming Language. The C Programming language was developed from 1969-1973 at Bell labs, at the same time the UNIX operating system was being developed there. C was a direct descendant of the language B, which was developed by Ken Thompson as a systems programming language for the fledgling UNIX operating system. B, in turn, descended from the language BCPL which was designed in the 1960s by Martin Richards while at MIT.
In 1971 Dennis Ritchie at Bell Labs extended the B language (by adding types) into what he called NB, for "New B". Ritchie credits some of his changes to language constructs found in Algol68, although he states "although it [the type scheme], perhaps, did not emerge in a form that Algol's adherents would approve of" After restructuring the language and rewriting the compiler for B, Ritchie gave his new language a name: "C".
The future of DSLs - functions and formal methodsMarkus Voelter
I have used domain-specific languages to empower non-programmers in healthcare, finance, aerospace, automotive and public administration for years. My approach relies on growing the DSL from a functional programming core, combining the flexibility and power of an algorithmic language with domain-specific constructs that range from temporal data types, state machines and data models to polymorphic dispatch between versions of calculation rules. I rely on the open source MPS workbench to define the languages and their IDE. I am looking to incremental model transformations to desugar domain-specific constructs back to a minimal core language in realtime. That core language will have an interpreter for in-IDE execution and a compiler for deployment. The language will be integrated with formal methods to verify properties of programs, enabling advanced analyses for DSL users. In this talk, I will demo some existing DSLs, provide an illustration of how they are built, and demo prototypes of the future approach while discussing their integration with formal methods.
C is mother language of all programming language.
It is a system programming language. It is a procedure-oriented programming language. It is also called mid-level programming language.
C evolved from a language called B, written by Ken Thompson at Bell Labs in 1970. Ken used B to write one of the first implementations of UNIX. B in turn was a descendant of the language BCPL (developed at Cambridge (UK) in 1967), with most of its instructions removed.
So many instructions were removed in going from BCPL to B, that Dennis Ritchie of Bell Labs put some back in (in 1972), and called the language C.
The famous book The C Programming Language was written by Kernighan and Ritchie in 1978, and was the definitive reference book on C for almost a decade.
The original C was still too limiting, and not standardized, and so in 1983, an ANSI committee was established to formalize the language definition.
It has taken until now (ten years later) for the ANSI ( American National Standard Institute) standard to become well accepted and almost universally supported by compilers.
ZENUS INFOTECH is best Python Training institute in Roorkee and an ISO 9001:2008 Certified Engineer’s Training Company in Roorkee & provides training to the B.E./B.TECH/DIPLOMA/MCA/BCA and related field students in 35+ cutting-edge technologies like AutoCAD, Solid-Works, CATIA, REVIT, Pro-E, UG-NX .NET, JAVA, PHP, GST Tally and Wireless & Telecommunication and many more.
Building scalable and language independent java services using apache thriftTalentica Software
This presentation is about the key challenges of cross language interactions and how they can be overcome. We discuss the Apache Thrift as a solution and understand its principle of Operation with code snippets and examples.
Kosmik is the best institute for Python training in Hyderabad Kukatpally/KPHB. kosmik provides lab facilities with complete real-time training with live sessions
call now: +91-8712186898, +91-8179496603, +91-6309565721
Microservices for building an IDE – The innards of JetBrains Rider - TechDays...Maarten Balliauw
Ever wondered how IDE’s are built? In this talk, we’ll skip the marketing bit and dive into the architecture and implementation of JetBrains Rider. We’ll look at how and why we have built (and open sourced) a reactive protocol, and how the IDE uses a “microservices” architecture to communicate with the debugger, Roslyn, a WPF renderer and even other tools like Unity3D. We’ll explore how things are wired together, both in-process and across those microservices. Let’s geek out!
Turning to the Functional Side using C# and F#. In this tutorial, we introduce essential functional concepts using analogies from the object-oriented world. We also look at a real-world point of sale application written using Silverlight and asynchronous workflows.
Python Course In Ghaziabad. Scode network is best training institute for Python which provides Online Python course with complete certificates at an affordable price.
While python is widely used for automating administration tasks, it’s not still widely known and used between system administrators.
iPython is an interactive python shell that embeds bash functionalities. We’ll show how to :
* replace some bash tasks avoiding common errors
* resembling some bash behaviour
* create testing (nose) and monitoring scripts
* use flask to expose those scripts on HTTP
Il TechAdvisor Roberto Polli condivide l'esperienza maturata su iPython, una potente shell interattiva nata per affiancare la classica shell Bash comunemente utilizzata dagli amministratori di sistema. Attraverso degli esempi pratici mostra le principali differenze tra i due approcci ed aiuta a comprendere quale sia lo strumento più adatto a specifici casi d'uso.
Durante la presentazione mostra inoltre come:
- evitare errori comuni negli script bash;
- velocizzare la creazione di script per l'esecuzione di test mediante la libreria nose;
- riutilizzare moduli Python esistenti nella shell interattiva;
- usare il framework Flask per convertire facilmente gli script in web services.
Code
http://ipython.org/
http://flask.pocoo.org/
http://nose.readthedocs.org/
https://github.com/ioggstream/dsadmin/
Babel
http://www.babel.it
http://vaunaspada.babel.it/blog
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...James Anderson
Effective Application Security in Software Delivery lifecycle using Deployment Firewall and DBOM
The modern software delivery process (or the CI/CD process) includes many tools, distributed teams, open-source code, and cloud platforms. Constant focus on speed to release software to market, along with the traditional slow and manual security checks has caused gaps in continuous security as an important piece in the software supply chain. Today organizations feel more susceptible to external and internal cyber threats due to the vast attack surface in their applications supply chain and the lack of end-to-end governance and risk management.
The software team must secure its software delivery process to avoid vulnerability and security breaches. This needs to be achieved with existing tool chains and without extensive rework of the delivery processes. This talk will present strategies and techniques for providing visibility into the true risk of the existing vulnerabilities, preventing the introduction of security issues in the software, resolving vulnerabilities in production environments quickly, and capturing the deployment bill of materials (DBOM).
Speakers:
Bob Boule
Robert Boule is a technology enthusiast with PASSION for technology and making things work along with a knack for helping others understand how things work. He comes with around 20 years of solution engineering experience in application security, software continuous delivery, and SaaS platforms. He is known for his dynamic presentations in CI/CD and application security integrated in software delivery lifecycle.
Gopinath Rebala
Gopinath Rebala is the CTO of OpsMx, where he has overall responsibility for the machine learning and data processing architectures for Secure Software Delivery. Gopi also has a strong connection with our customers, leading design and architecture for strategic implementations. Gopi is a frequent speaker and well-known leader in continuous delivery and integrating security into software delivery.
Generating a custom Ruby SDK for your web service or Rails API using Smithyg2nightmarescribd
Have you ever wanted a Ruby client API to communicate with your web service? Smithy is a protocol-agnostic language for defining services and SDKs. Smithy Ruby is an implementation of Smithy that generates a Ruby SDK using a Smithy model. In this talk, we will explore Smithy and Smithy Ruby to learn how to generate custom feature-rich SDKs that can communicate with any web service, such as a Rails JSON API.
The Art of the Pitch: WordPress Relationships and SalesLaura Byrne
Clients don’t know what they don’t know. What web solutions are right for them? How does WordPress come into the picture? How do you make sure you understand scope and timeline? What do you do if sometime changes?
All these questions and more will be explored as we talk about matching clients’ needs with what your agency offers without pulling teeth or pulling your hair out. Practical tips, and strategies for successful relationship building that leads to closing the deal.
Epistemic Interaction - tuning interfaces to provide information for AI supportAlan Dix
Paper presented at SYNERGY workshop at AVI 2024, Genoa, Italy. 3rd June 2024
https://alandix.com/academic/papers/synergy2024-epistemic/
As machine learning integrates deeper into human-computer interactions, the concept of epistemic interaction emerges, aiming to refine these interactions to enhance system adaptability. This approach encourages minor, intentional adjustments in user behaviour to enrich the data available for system learning. This paper introduces epistemic interaction within the context of human-system communication, illustrating how deliberate interaction design can improve system understanding and adaptation. Through concrete examples, we demonstrate the potential of epistemic interaction to significantly advance human-computer interaction by leveraging intuitive human communication strategies to inform system design and functionality, offering a novel pathway for enriching user-system engagements.
UiPath Test Automation using UiPath Test Suite series, part 4DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 4. In this session, we will cover Test Manager overview along with SAP heatmap.
The UiPath Test Manager overview with SAP heatmap webinar offers a concise yet comprehensive exploration of the role of a Test Manager within SAP environments, coupled with the utilization of heatmaps for effective testing strategies.
Participants will gain insights into the responsibilities, challenges, and best practices associated with test management in SAP projects. Additionally, the webinar delves into the significance of heatmaps as a visual aid for identifying testing priorities, areas of risk, and resource allocation within SAP landscapes. Through this session, attendees can expect to enhance their understanding of test management principles while learning practical approaches to optimize testing processes in SAP environments using heatmap visualization techniques
What will you get from this session?
1. Insights into SAP testing best practices
2. Heatmap utilization for testing
3. Optimization of testing processes
4. Demo
Topics covered:
Execution from the test manager
Orchestrator execution result
Defect reporting
SAP heatmap example with demo
Speaker:
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
Connector Corner: Automate dynamic content and events by pushing a buttonDianaGray10
Here is something new! In our next Connector Corner webinar, we will demonstrate how you can use a single workflow to:
Create a campaign using Mailchimp with merge tags/fields
Send an interactive Slack channel message (using buttons)
Have the message received by managers and peers along with a test email for review
But there’s more:
In a second workflow supporting the same use case, you’ll see:
Your campaign sent to target colleagues for approval
If the “Approve” button is clicked, a Jira/Zendesk ticket is created for the marketing design team
But—if the “Reject” button is pushed, colleagues will be alerted via Slack message
Join us to learn more about this new, human-in-the-loop capability, brought to you by Integration Service connectors.
And...
Speakers:
Akshay Agnihotri, Product Manager
Charlie Greenberg, Host
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Ramesh Iyer
In today's fast-changing business world, Companies that adapt and embrace new ideas often need help to keep up with the competition. However, fostering a culture of innovation takes much work. It takes vision, leadership and willingness to take risks in the right proportion. Sachin Dev Duggal, co-founder of Builder.ai, has perfected the art of this balance, creating a company culture where creativity and growth are nurtured at each stage.
Key Trends Shaping the Future of Infrastructure.pdfCheryl Hung
Keynote at DIGIT West Expo, Glasgow on 29 May 2024.
Cheryl Hung, ochery.com
Sr Director, Infrastructure Ecosystem, Arm.
The key trends across hardware, cloud and open-source; exploring how these areas are likely to mature and develop over the short and long-term, and then considering how organisations can position themselves to adapt and thrive.
GraphRAG is All You need? LLM & Knowledge GraphGuy Korland
Guy Korland, CEO and Co-founder of FalkorDB, will review two articles on the integration of language models with knowledge graphs.
1. Unifying Large Language Models and Knowledge Graphs: A Roadmap.
https://arxiv.org/abs/2306.08302
2. Microsoft Research's GraphRAG paper and a review paper on various uses of knowledge graphs:
https://www.microsoft.com/en-us/research/blog/graphrag-unlocking-llm-discovery-on-narrative-private-data/
Transcript: Selling digital books in 2024: Insights from industry leaders - T...BookNet Canada
The publishing industry has been selling digital audiobooks and ebooks for over a decade and has found its groove. What’s changed? What has stayed the same? Where do we go from here? Join a group of leading sales peers from across the industry for a conversation about the lessons learned since the popularization of digital books, best practices, digital book supply chain management, and more.
Link to video recording: https://bnctechforum.ca/sessions/selling-digital-books-in-2024-insights-from-industry-leaders/
Presented by BookNet Canada on May 28, 2024, with support from the Department of Canadian Heritage.
DevOps and Testing slides at DASA ConnectKari Kakkonen
My and Rik Marselis slides at 30.5.2024 DASA Connect conference. We discuss about what is testing, then what is agile testing and finally what is Testing in DevOps. Finally we had lovely workshop with the participants trying to find out different ways to think about quality and testing in different parts of the DevOps infinity loop.
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Tobias Schneck
As AI technology is pushing into IT I was wondering myself, as an “infrastructure container kubernetes guy”, how get this fancy AI technology get managed from an infrastructure operational view? Is it possible to apply our lovely cloud native principals as well? What benefit’s both technologies could bring to each other?
Let me take this questions and provide you a short journey through existing deployment models and use cases for AI software. On practical examples, we discuss what cloud/on-premise strategy we may need for applying it to our own infrastructure to get it to work from an enterprise perspective. I want to give an overview about infrastructure requirements and technologies, what could be beneficial or limiting your AI use cases in an enterprise environment. An interactive Demo will give you some insides, what approaches I got already working for real.
1. Protocol Buffers RProtoBuf Summary / Outlook
RProtoBuf: Protocol Buffers for R
Romain François1 Dirk Eddelbuettel2
1R Enthusiasts
2 Debian Project
useR! 2010
National Institute of Standards and Technology (NIST)
Gaithersburg, Maryland, USA
Romain François and Dirk Eddelbuettel RProtoBuf: Protocol Buffers for R @ useR! 2010
2. Protocol Buffers RProtoBuf Summary / Outlook
Outline
1 Protocol Buffers
2 RProtoBuf
3 Summary / Outlook
Romain François and Dirk Eddelbuettel RProtoBuf: Protocol Buffers for R @ useR! 2010
3. Protocol Buffers RProtoBuf Summary / Outlook Overview Example
Outline
1 Protocol Buffers
Overview
Example
2 RProtoBuf
3 Summary / Outlook
Romain François and Dirk Eddelbuettel RProtoBuf: Protocol Buffers for R @ useR! 2010
4. Protocol Buffers RProtoBuf Summary / Outlook Overview Example
Brief Description
Google’s Protocol Buffers are a flexible, efficient,
automated mechanism for serializing structured
data—think XML, but smaller, faster, and simpler.
Users define the data structures in a proto file, and then
use special generated source code. Code is forwards- and
backwards-compatible to proto changes.
This permits to easily write and read structured data to and
from a variety of data streams, and using a variety of
officially supported languages— Java, C++, or Python.
Or one can use third-party implementations for languages
such as C#, Perl, Ruby, Haskell, and now R via the
RProtoBuf package.
Romain François and Dirk Eddelbuettel RProtoBuf: Protocol Buffers for R @ useR! 2010
5. Protocol Buffers RProtoBuf Summary / Outlook Overview Example
Features
Protocol Buffers compare
favourably against a
number of competing
data / messaging formats.
Source: http://http://www.slideshare.net/kevinweil/
protocol-buffers-and-hadoop-at-twitter
Romain François and Dirk Eddelbuettel RProtoBuf: Protocol Buffers for R @ useR! 2010
6. Protocol Buffers RProtoBuf Summary / Outlook Overview Example
Example proto file from Tutorial
package tutorial;
message Person {
required string name = 1;
required int32 id = 2; // Unique ID number for person.
optional string email = 3;
enum PhoneType {
MOBILE = 0; HOME = 1; WORK = 2;
}
message PhoneNumber {
required string number = 1;
optional PhoneType type = 2 [default = HOME];
}
repeated PhoneNumber phone = 4;
}
// Our address book file is just one of these.
message AddressBook {
repeated Person person = 1;
}
Romain François and Dirk Eddelbuettel RProtoBuf: Protocol Buffers for R @ useR! 2010
7. Protocol Buffers RProtoBuf Summary / Outlook Overview Example
Example C++ usage
#include "addressbook.pb.h"
using namespace std;
// Iterates though all people in the AddressBook
// and prints info about them.
void ListPeople(const tutorial::AddressBook&
address_book) {
for (int i=0; i < address_book.person_size(); i++) {
const tutorial::Person& person =
address_book.person(i);
cout << "Person ID: " << person.id() << endl;
cout << " Name: " << person.name() << endl;
if (person.has_email()) {
cout << " E-mail address: "
<< person.email() << endl;
}
Romain François and Dirk Eddelbuettel RProtoBuf: Protocol Buffers for R @ useR! 2010
8. Protocol Buffers RProtoBuf Summary / Outlook Overview Example
Example C++ usage (cont.)
for (int j = 0; j < person.phone_size(); j++) {
const tutorial::Person::PhoneNumber
&phone_number = person.phone(j);
switch (phone_number.type()) {
case tutorial::Person::MOBILE:
cout << " Mobile phone #: ";
break;
case tutorial::Person::HOME:
cout << " Home phone #: ";
break;
case tutorial::Person::WORK:
cout << " Work phone #: ";
break;
}
cout << phone_number.number() << endl;
}
}
}
Romain François and Dirk Eddelbuettel RProtoBuf: Protocol Buffers for R @ useR! 2010
9. Protocol Buffers RProtoBuf Summary / Outlook Overview Examples Writer R Readers
Outline
1 Protocol Buffers
2 RProtoBuf
Overview
Examples
Adressbook
(Stylized) High-Frequency Financial Data
Writer
R Readers
3 Summary / Outlook
Romain François and Dirk Eddelbuettel RProtoBuf: Protocol Buffers for R @ useR! 2010
10. Protocol Buffers RProtoBuf Summary / Outlook Overview Examples Writer R Readers
Brief Description
The RProtoBuf package implements R bindings to the
C++ protobuf library from Google.
RProtoBuf uses features of the protocol buffer library to
support creation, manipulation, parsing and serialization of
protocol buffers messages.
Taking advantage of facilities in the Rcpp package,
RProtoBuf uses S4 classes and external pointers to
expose objects that look and feel like standard R lists, yet
are managed by the underlying C++ library.
These objects also conform to the language-agnostic
definition of the message type allowing access to their
content from other supported languages.
Romain François and Dirk Eddelbuettel RProtoBuf: Protocol Buffers for R @ useR! 2010
11. Protocol Buffers RProtoBuf Summary / Outlook Overview Examples Writer R Readers
Addressbook example from R
See demo(addressbook)
> # load the package
> require( RProtoBuf )
> # read the proto file
> readProtoFiles( files="addressbook.proto" )
> # create a prototype with a call to new
> # on the descriptor for the Person type,
> romain <- new( tutorial.Person )
> # then update the message
> romain <- update( romain ,
+ email = "romain@r-enthusiasts.com",
+ id = 1, name = "Romain Francois",
+ phone = new(tutorial.Person.PhoneNumber,
+ number = "+33(0)...", type = "MOBILE"))
Romain François and Dirk Eddelbuettel RProtoBuf: Protocol Buffers for R @ useR! 2010
12. Protocol Buffers RProtoBuf Summary / Outlook Overview Examples Writer R Readers
Addressbook example from R (cont)
> # directly supply parameters to the ctor
> dirk <- new( tutorial.Person,
+ email = "edd@debian.org",
+ id = 2, name = "Dirk Eddelbuettel" )
> # update the phone repeated field with list
> dirk$phone <- list(
+ new( tutorial.Person.PhoneNumber,
+ number = "+01...", type = "MOBILE" ),
+ new( tutorial.Person.PhoneNumber ,
+ number = "+01...", type = "HOME" ) )
Romain François and Dirk Eddelbuettel RProtoBuf: Protocol Buffers for R @ useR! 2010
13. Protocol Buffers RProtoBuf Summary / Outlook Overview Examples Writer R Readers
Addressbook example from R (cont)
> # build the address book
> book <- new( tutorial.AddressBook,
+ person = list( romain, dirk ) )
> # debug content - this is not wire content
> writeLines( as.character( book ) )
> # the serialized message,
> # see also the io demo
> serialize( book, NULL )
Romain François and Dirk Eddelbuettel RProtoBuf: Protocol Buffers for R @ useR! 2010
14. Protocol Buffers RProtoBuf Summary / Outlook Overview Examples Writer R Readers
Example proto file for Financial Data
// Namespace
package TradeData;
// A simple Fill, ie a completed trade
message Fill {
required double timestamp = 1;
required string symbol = 2;
required double price = 3;
required int32 size = 4;
}
// A sequence of Fills
message Trades {
repeated Fill fill = 1;
}
See inst/examples/HighFrequencyFinance/ in the RProtoBuf package.
Romain François and Dirk Eddelbuettel RProtoBuf: Protocol Buffers for R @ useR! 2010
15. Protocol Buffers RProtoBuf Summary / Outlook Overview Examples Writer R Readers
Example C++ data creator
int main(int argc, char **argv) {
const char* pbfile = "trades.pb";
const int N = 1000;
set_seed(123, 456);
double tstamp = 1277973000; // 2010-07-01 08:30:00
double tprice = 100.0; // gotta start somewhere
char sym[] = "ABC";
TradeData::Trades tr;
for (int i=0; i<N; i++) {
TradeData::Fill *fill = tr.add_fill();
tstamp += runif(0.000, 0.100);
tprice += round(rt(5) * 0.01 * 100)/100;
int tsize = 100 + round(runif(0,9))*100;
fill->set_timestamp(tstamp);
fill->set_price(tprice);
fill->set_symbol(sym);
fill->set_size(tsize);
}
std::fstream output(pbfile, std::ios::out | std::ios::binary);
if (!tr.SerializeToOstream(&output)) {
std::cerr << "Failed to write data." << std::endl;
return -1;
}
return 0;
}
See inst/examples/HighFrequencyFinance/protoCreate.cpp
Romain François and Dirk Eddelbuettel RProtoBuf: Protocol Buffers for R @ useR! 2010
16. Protocol Buffers RProtoBuf Summary / Outlook Overview Examples Writer R Readers
Extensibility
We could add this to the proto file:
enum exchType {
NYSE = 0; NASDAQ = 1; ARCS = 2; BATS = 3;
}
optional exchType exchange = 5 [default = NYSE];
If you want your new buffers to be backwards-compatible,
and your old buffers to be forward-compatible [...]:
you must not change the tag [...] of any existing fields.
you must not add or delete any required fields.
you may delete optional or repeated fields.
you may add new optional or repeated fields but you
must use fresh tag numbers [...]
See http://code.google.com/apis/protocolbuffers/
docs/cpptutorial.html
Romain François and Dirk Eddelbuettel RProtoBuf: Protocol Buffers for R @ useR! 2010
17. Protocol Buffers RProtoBuf Summary / Outlook Overview Examples Writer R Readers
Example R reader: Simple
> basicUse <- function(verbose=TRUE) {
+ readProtoFiles("TradeData.proto")
+ x <- read( TradeData.Trades, "trades.pb")
+ xl <- as.list(x)
+ df <- do.call(rbind,
+ lapply(as.list(xl$fill),
+ function(.)
+ as.data.frame(as.list(.))))
+ df[,1] <- as.POSIXct(df[,1], origin="1970-01-01")
+ if (verbose) print(summary(df))
+ invisible(df)
+ }
See inst/examples/HighFrequencyFinance/loadInR.r
Romain François and Dirk Eddelbuettel RProtoBuf: Protocol Buffers for R @ useR! 2010
18. Protocol Buffers RProtoBuf Summary / Outlook Overview Examples Writer R Readers
Example R reader: Smarter
> betterUse <- function(verbose=TRUE,
+ file="trades.pb") {
+ readProtoFiles("TradeData.proto")
+ x <- read( TradeData.Trades, "trades.pb")
+ xl <- lapply( x$fill, as.list )
+
+ df <- data.frame(timestamp= as.POSIXct(sapply(xl,
+ "[[", "timestamp" ),
+ origin="1970-01-01"),
+ symbol = sapply(xl,"[[","symbol"),
+ price = sapply(xl,"[[","price"),
+ size = sapply(xl,"[[","size"))
+ if (verbose) print(summary(df))
+ invisible(df)
+ }
See inst/examples/HighFrequencyFinance/loadInR.r
Romain François and Dirk Eddelbuettel RProtoBuf: Protocol Buffers for R @ useR! 2010
19. Protocol Buffers RProtoBuf Summary / Outlook Overview Examples Writer R Readers
Example R reader: Manual via Rcpp
> compiled <- function(verbose=FALSE,
+ file="trades.pb") {
+
+ stopifnot(file.exists(file))
+
+ df <- .Call("pbload", file);
+
+ if (verbose) print(summary(df))
+
+ invisible(df)
+ }
See inst/examples/HighFrequencyFinance/loadInR.r
Romain François and Dirk Eddelbuettel RProtoBuf: Protocol Buffers for R @ useR! 2010
20. Protocol Buffers RProtoBuf Summary / Outlook Overview Examples Writer R Readers
Example R reader: C++ support
extern "C" SEXP pbload(SEXP b) {
std::string pbfile = Rcpp::as<std::string>(b);
TradeData::Trades tr;
std::fstream fs(pbfile.c_str(), std::ios::in | std::ios::binary);
if (!tr.ParseFromIstream(&fs)) {
std::cerr << "Trouble parsing..." << std::cout;
return R_NilValue;
}
int n = tr.fill_size();
Rcpp::DatetimeVector timestamp(n);
Rcpp::CharacterVector tsym(n);
Rcpp::NumericVector tprice(n);
Rcpp::IntegerVector tsize(n);
for (int i=0; i<n; i++) {
const TradeData::Fill &fill = tr.fill(i);
timestamp[i] = fill.timestamp();
tsym[i] = fill.symbol();
tprice[i] = fill.price();
tsize[i] = fill.size();
}
return Rcpp::DataFrame::create(Rcpp::Named("times") = timestamp,
Rcpp::Named("symbol") = tsym,
Rcpp::Named("price") = tprice,
Rcpp::Named("size") = tsize);
}
See inst/examples/HighFrequencyFinance/protoModule.cpp
Romain François and Dirk Eddelbuettel RProtoBuf: Protocol Buffers for R @ useR! 2010
21. Protocol Buffers RProtoBuf Summary / Outlook Overview Examples Writer R Readers
Timing comparison
Running the script loadInR.r from the aforementioned
examples directory in the RProtoBuf package:
Version Elapsed Time Relative
Compiled 0.006 1.0000
betterUse 0.138 23.0000
basicUse 4.606 767.6667
Times are total in seconds from on three replications each on
relatively recent server, using the rbenchmark package.
Romain François and Dirk Eddelbuettel RProtoBuf: Protocol Buffers for R @ useR! 2010
22. Protocol Buffers RProtoBuf Summary / Outlook Summary Outlook
Outline
1 Protocol Buffers
2 RProtoBuf
3 Summary / Outlook
Summary
Outlook
Romain François and Dirk Eddelbuettel RProtoBuf: Protocol Buffers for R @ useR! 2010
23. Protocol Buffers RProtoBuf Summary / Outlook Summary Outlook
Summary
We have introduced the Google Protocol Buffers library as
a means to generating efficient data interfacing code: fast,
auto-generated and extensible.
We illustrated its use via our nascent RProtoBuf package.
RProtoBuf brings autogenerated accessors to R—which
may however not be the fastest access.
The Rcpp package makes it easy to manually add
Protocol Buffers capabilities to our R analyses.
Romain François and Dirk Eddelbuettel RProtoBuf: Protocol Buffers for R @ useR! 2010
24. Protocol Buffers RProtoBuf Summary / Outlook Summary Outlook
Outlook
Goal: Use the new Modules feature in Rcpp to get at
(almost) auto-generated yet very efficient (C++-based)
access from R.
Second Goal: Add networking capabilities, maybe via R’s
built-in http server.
Romain François and Dirk Eddelbuettel RProtoBuf: Protocol Buffers for R @ useR! 2010