A small introduction on the C++14 improved static introspection of the IOD library and the C++14 web framework Silicon.
https://github.com/matt-42/silicon
https://github.com/matt-42/iod
Fun with Lambdas: C++14 Style (part 1)Sumant Tambe
If virtual functions in C++ imply design patterns, then C++ lambdas imply what? What does it really mean to have lambdas in C++? Frankly, I don't know but I've a hunch: It's BIG.
Just like virtual functions open doors to the OO paradigm, lambdas open doors to a different paradigm--the functional paradigm. This talk is not a praise of functional programming or some elusive lambda-based library. (Although, I'll mention one briefly that tops my list these days.) Instead, the goal is to have fun while working our way through some mind-bending examples of C++14 lambdas. Beware, your brain will hurt! Bring your laptop and code the examples right along because that may be the fastest way to answer the quiz.
Fun with Lambdas: C++14 Style (part 1)Sumant Tambe
If virtual functions in C++ imply design patterns, then C++ lambdas imply what? What does it really mean to have lambdas in C++? Frankly, I don't know but I've a hunch: It's BIG.
Just like virtual functions open doors to the OO paradigm, lambdas open doors to a different paradigm--the functional paradigm. This talk is not a praise of functional programming or some elusive lambda-based library. (Although, I'll mention one briefly that tops my list these days.) Instead, the goal is to have fun while working our way through some mind-bending examples of C++14 lambdas. Beware, your brain will hurt! Bring your laptop and code the examples right along because that may be the fastest way to answer the quiz.
Computer science Investigatory Project Class 12 C++Rushil Aggarwal
This project is based on File Handling . An innovative project on petrol pump management , deals with basic function in a petrol pump .
Do like , share and comment if my work helped you ;)
The new standard for C++ language has been signed in 2011. This new (extended) language, called C++11, has a number of new semantics (in terms of language constructs) and a number of new standard library support. The major language extensions are discussed in this presentation. The library will be taken up in a later presentation.
Practical Class 12th (c++programs+sql queries and output) Aman Deep
Just download this and do some specific changes in the name section and roll no section . and submit it as it is to your teacher this will surely work and help you out your class 12th board practicals exam . no worries ! ENJOY :) !
Despite all of the recent interest, concurrency in standard C++ is still barely in its infancy. This talk uses the primitives supplied by C++14 to build a simple, reference, implementation of a task system. The goal is to learn to write software that doesn’t wait.
Computer science Investigatory Project Class 12 C++Rushil Aggarwal
This project is based on File Handling . An innovative project on petrol pump management , deals with basic function in a petrol pump .
Do like , share and comment if my work helped you ;)
The new standard for C++ language has been signed in 2011. This new (extended) language, called C++11, has a number of new semantics (in terms of language constructs) and a number of new standard library support. The major language extensions are discussed in this presentation. The library will be taken up in a later presentation.
Practical Class 12th (c++programs+sql queries and output) Aman Deep
Just download this and do some specific changes in the name section and roll no section . and submit it as it is to your teacher this will surely work and help you out your class 12th board practicals exam . no worries ! ENJOY :) !
Despite all of the recent interest, concurrency in standard C++ is still barely in its infancy. This talk uses the primitives supplied by C++14 to build a simple, reference, implementation of a task system. The goal is to learn to write software that doesn’t wait.
Build 2016 - B880 - Top 6 Reasons to Move Your C++ Code to Visual Studio 2015Windows Developer
Visual Studio 2015 provides the best in class C++ development experience whether you are targeting Android, iOS, Linux, Windows, or IoT. With a good mix of demos and showcase for new C++ experiences, this talk goes over six great reasons why you should migrate to Visual Studio 2015 today.
Modern Release Engineering in a Nutshell - Why Researchers should Care!Bram Adams
Invited talk at the Leaders of Tomorrow Symposium of the 23rd IEEE International Conference on Software Analysis, Evolution, and Reengineering (SANER 2016).
The presentation (and its accompanying paper, see http://mcis.polymtl.ca/publications/2016/fose.pdf) explain the basics of release engineering pipelines, common challenges industry is facing as well as pitfalls software engineering researchers are falling into.
Speakers are Bram Adams (MCIS, http://mcis.polymtl.ca) and Shane McIntosh (McGill University, http://shanemcintosh.org).
A video-taped version of the talk will be available soon at https://www.youtube.com/channel/UCL8yG6qpHk7V66l1Jt3aZrA/featured.
Multiplatform shared codebase with Kotlin/Native - UA Mobile 2019Eugene Kurko
f you want to share the code between Android and iOS but you don't feel like doing C++/JNI, React Native, Flutter, you must try Kotlin/Native! In this presentation we will see how Kotlin/Native is different and in some aspects superior, and how easy it becomes to develop, debug and maintain a common codebase with JetBrains tools and without sacrificing runtime performance.
Multiplatform shared codebase with Kotlin/Native - UA Mobile 2019UA Mobile
If you want to share the code between Android and iOS but you don't feel like doing C++/JNI, React Native, Flutter, you must try Kotlin/Native! In this presentation we will see how Kotlin/Native is different and in some aspects superior, and how easy it becomes to develop, debug and maintain a common codebase with JetBrains tools and without sacrificing runtime performance.
The Present and The Future of Functional Programming in C++Alexander Granin
Keynote talk for C++ Siberia 2019.
I'm speaking about why Functional Programming is important in C++ world, what is the philosophy of FP in C++, and what features do we have. I'm presenting a connection of constexpr and template metaprogramming to pure FP, and talking about why monads are inevitable. I'm also discussing an upcoming features in C++.
Easing offline web application development with GWTArnaud Tournier
At this current time, HTML5 APIs are mature enough so that the web browser can now be a very good platform for applications that were before only implemented as native applications : offline applications with locally stored data, embedded SQL engines, etc. Although there are many good Javascript frameworks out there, the Java language allows to build, maintain, debug and work with ease on really big applications (> 100,000 LOC).
You'll discover in this presentation all the tools we assembled to make an application available with its data 100% of the time, even without internet!
Slides from my presentation, "Creating a Plug-In Architecture in .NET". Code is available as well at https://github.com/ondrejbalas/plugin-architecture
Code reviews are vital for ensuring good code quality. They serve as one of our last lines of defense against bugs and subpar code reaching production.
Yet, they often turn into annoying tasks riddled with frustration, hostility, unclear feedback and lack of standards. How can we improve this crucial process?
In this session we will cover:
- The Art of Effective Code Reviews
- Streamlining the Review Process
- Elevating Reviews with Automated Tools
By the end of this presentation, you'll have the knowledge on how to organize and improve your code review proces
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus
As part of the DOE Integrated Research Infrastructure (IRI) program, NERSC at Lawrence Berkeley National Lab and ALCF at Argonne National Lab are working closely with General Atomics on accelerating the computing requirements of the DIII-D experiment. As part of the work the team is investigating ways to speedup the time to solution for many different parts of the DIII-D workflow including how they run jobs on HPC systems. One of these routes is looking at Globus Compute as a way to replace the current method for managing tasks and we describe a brief proof of concept showing how Globus Compute could help to schedule jobs and be a tool to connect compute at different facilities.
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Anthony Dahanne
Les Buildpacks existent depuis plus de 10 ans ! D’abord, ils étaient utilisés pour détecter et construire une application avant de la déployer sur certains PaaS. Ensuite, nous avons pu créer des images Docker (OCI) avec leur dernière génération, les Cloud Native Buildpacks (CNCF en incubation). Sont-ils une bonne alternative au Dockerfile ? Que sont les buildpacks Paketo ? Quelles communautés les soutiennent et comment ?
Venez le découvrir lors de cette session ignite
Enhancing Research Orchestration Capabilities at ORNL.pdfGlobus
Cross-facility research orchestration comes with ever-changing constraints regarding the availability and suitability of various compute and data resources. In short, a flexible data and processing fabric is needed to enable the dynamic redirection of data and compute tasks throughout the lifecycle of an experiment. In this talk, we illustrate how we easily leveraged Globus services to instrument the ACE research testbed at the Oak Ridge Leadership Computing Facility with flexible data and task orchestration capabilities.
Accelerate Enterprise Software Engineering with PlatformlessWSO2
Key takeaways:
Challenges of building platforms and the benefits of platformless.
Key principles of platformless, including API-first, cloud-native middleware, platform engineering, and developer experience.
How Choreo enables the platformless experience.
How key concepts like application architecture, domain-driven design, zero trust, and cell-based architecture are inherently a part of Choreo.
Demo of an end-to-end app built and deployed on Choreo.
First Steps with Globus Compute Multi-User EndpointsGlobus
In this presentation we will share our experiences around getting started with the Globus Compute multi-user endpoint. Working with the Pharmacology group at the University of Auckland, we have previously written an application using Globus Compute that can offload computationally expensive steps in the researcher's workflows, which they wish to manage from their familiar Windows environments, onto the NeSI (New Zealand eScience Infrastructure) cluster. Some of the challenges we have encountered were that each researcher had to set up and manage their own single-user globus compute endpoint and that the workloads had varying resource requirements (CPUs, memory and wall time) between different runs. We hope that the multi-user endpoint will help to address these challenges and share an update on our progress here.
Experience our free, in-depth three-part Tendenci Platform Corporate Membership Management workshop series! In Session 1 on May 14th, 2024, we began with an Introduction and Setup, mastering the configuration of your Corporate Membership Module settings to establish membership types, applications, and more. Then, on May 16th, 2024, in Session 2, we focused on binding individual members to a Corporate Membership and Corporate Reps, teaching you how to add individual members and assign Corporate Representatives to manage dues, renewals, and associated members. Finally, on May 28th, 2024, in Session 3, we covered questions and concerns, addressing any queries or issues you may have.
For more Tendenci AMS events, check out www.tendenci.com/events
How Recreation Management Software Can Streamline Your Operations.pptxwottaspaceseo
Recreation management software streamlines operations by automating key tasks such as scheduling, registration, and payment processing, reducing manual workload and errors. It provides centralized management of facilities, classes, and events, ensuring efficient resource allocation and facility usage. The software offers user-friendly online portals for easy access to bookings and program information, enhancing customer experience. Real-time reporting and data analytics deliver insights into attendance and preferences, aiding in strategic decision-making. Additionally, effective communication tools keep participants and staff informed with timely updates. Overall, recreation management software enhances efficiency, improves service delivery, and boosts customer satisfaction.
How to Position Your Globus Data Portal for Success Ten Good PracticesGlobus
Science gateways allow science and engineering communities to access shared data, software, computing services, and instruments. Science gateways have gained a lot of traction in the last twenty years, as evidenced by projects such as the Science Gateways Community Institute (SGCI) and the Center of Excellence on Science Gateways (SGX3) in the US, The Australian Research Data Commons (ARDC) and its platforms in Australia, and the projects around Virtual Research Environments in Europe. A few mature frameworks have evolved with their different strengths and foci and have been taken up by a larger community such as the Globus Data Portal, Hubzero, Tapis, and Galaxy. However, even when gateways are built on successful frameworks, they continue to face the challenges of ongoing maintenance costs and how to meet the ever-expanding needs of the community they serve with enhanced features. It is not uncommon that gateways with compelling use cases are nonetheless unable to get past the prototype phase and become a full production service, or if they do, they don't survive more than a couple of years. While there is no guaranteed pathway to success, it seems likely that for any gateway there is a need for a strong community and/or solid funding streams to create and sustain its success. With over twenty years of examples to draw from, this presentation goes into detail for ten factors common to successful and enduring gateways that effectively serve as best practices for any new or developing gateway.
Check out the webinar slides to learn more about how XfilesPro transforms Salesforce document management by leveraging its world-class applications. For more details, please connect with sales@xfilespro.com
If you want to watch the on-demand webinar, please click here: https://www.xfilespro.com/webinars/salesforce-document-management-2-0-smarter-faster-better/
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar
The European Union Agency for Law Enforcement Cooperation (Europol) has suffered an alleged data breach after a notorious threat actor claimed to have exfiltrated data from its systems. Infamous data leaker IntelBroker posted on the even more infamous BreachForums hacking forum, saying that Europol suffered a data breach this month.
The alleged breach affected Europol agencies CCSE, EC3, Europol Platform for Experts, Law Enforcement Forum, and SIRIUS. Infiltration of these entities can disrupt ongoing investigations and compromise sensitive intelligence shared among international law enforcement agencies.
However, this is neither the first nor the last activity of IntekBroker. We have compiled for you what happened in the last few days. To track such hacker activities on dark web sources like hacker forums, private Telegram channels, and other hidden platforms where cyber threats often originate, you can check SOCRadar’s Dark Web News.
Stay Informed on Threat Actors’ Activity on the Dark Web with SOCRadar!
May Marketo Masterclass, London MUG May 22 2024.pdfAdele Miller
Can't make Adobe Summit in Vegas? No sweat because the EMEA Marketo Engage Champions are coming to London to share their Summit sessions, insights and more!
This is a MUG with a twist you don't want to miss.
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns
Unlocking Business Potential: Tailored Technology Solutions by Prosigns
Discover how Prosigns, a leading technology solutions provider, partners with businesses to drive innovation and success. Our presentation showcases our comprehensive range of services, including custom software development, web and mobile app development, AI & ML solutions, blockchain integration, DevOps services, and Microsoft Dynamics 365 support.
Custom Software Development: Prosigns specializes in creating bespoke software solutions that cater to your unique business needs. Our team of experts works closely with you to understand your requirements and deliver tailor-made software that enhances efficiency and drives growth.
Web and Mobile App Development: From responsive websites to intuitive mobile applications, Prosigns develops cutting-edge solutions that engage users and deliver seamless experiences across devices.
AI & ML Solutions: Harnessing the power of Artificial Intelligence and Machine Learning, Prosigns provides smart solutions that automate processes, provide valuable insights, and drive informed decision-making.
Blockchain Integration: Prosigns offers comprehensive blockchain solutions, including development, integration, and consulting services, enabling businesses to leverage blockchain technology for enhanced security, transparency, and efficiency.
DevOps Services: Prosigns' DevOps services streamline development and operations processes, ensuring faster and more reliable software delivery through automation and continuous integration.
Microsoft Dynamics 365 Support: Prosigns provides comprehensive support and maintenance services for Microsoft Dynamics 365, ensuring your system is always up-to-date, secure, and running smoothly.
Learn how our collaborative approach and dedication to excellence help businesses achieve their goals and stay ahead in today's digital landscape. From concept to deployment, Prosigns is your trusted partner for transforming ideas into reality and unlocking the full potential of your business.
Join us on a journey of innovation and growth. Let's partner for success with Prosigns.
Large Language Models and the End of ProgrammingMatt Welsh
Talk by Matt Welsh at Craft Conference 2024 on the impact that Large Language Models will have on the future of software development. In this talk, I discuss the ways in which LLMs will impact the software industry, from replacing human software developers with AI, to replacing conventional software with models that perform reasoning, computation, and problem-solving.
Quarkus Hidden and Forbidden ExtensionsMax Andersen
Quarkus has a vast extension ecosystem and is known for its subsonic and subatomic feature set. Some of these features are not as well known, and some extensions are less talked about, but that does not make them less interesting - quite the opposite.
Come join this talk to see some tips and tricks for using Quarkus and some of the lesser known features, extensions and development techniques.
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamtakuyayamamoto1800
In this slide, we show the simulation example and the way to compile this solver.
In this solver, the Helmholtz equation can be solved by helmholtzFoam. Also, the Helmholtz equation with uniformly dispersed bubbles can be simulated by helmholtzBubbleFoam.
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTier1 app
Even though at surface level ‘java.lang.OutOfMemoryError’ appears as one single error; underlyingly there are 9 types of OutOfMemoryError. Each type of OutOfMemoryError has different causes, diagnosis approaches and solutions. This session equips you with the knowledge, tools, and techniques needed to troubleshoot and conquer OutOfMemoryError in all its forms, ensuring smoother, more efficient Java applications.
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...Juraj Vysvader
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I didn't get rich from it but it did have 63K downloads (powered possible tens of thousands of websites).
Enterprise Resource Planning System includes various modules that reduce any business's workload. Additionally, it organizes the workflows, which drives towards enhancing productivity. Here are a detailed explanation of the ERP modules. Going through the points will help you understand how the software is changing the work dynamics.
To know more details here: https://blogs.nyggs.com/nyggs/enterprise-resource-planning-erp-system-modules/
1. Motivations C++11/14 Static introspection in the IOD library The Silicon Web Framework Conclusion
High performance web programming with C++14
Matthieu Garrigues, ENSTA-ParisTech
May 13, 2015
High performance web programming with C++14 1 / 61 Matthieu Garrigues
2. Motivations C++11/14 Static introspection in the IOD library The Silicon Web Framework Conclusion
Outline
1 Motivations
2 C++11/14
3 Static introspection in the IOD library
4 The Silicon Web Framework
5 Conclusion
High performance web programming with C++14 2 / 61 Matthieu Garrigues
3. Motivations C++11/14 Static introspection in the IOD library The Silicon Web Framework Conclusion
Outline
1 Motivations
2 C++11/14
3 Static introspection in the IOD library
4 The Silicon Web Framework
5 Conclusion
High performance web programming with C++14 3 / 61 Matthieu Garrigues
4. Motivations C++11/14 Static introspection in the IOD library The Silicon Web Framework Conclusion
Motivations
C++ is one of the most efficient language for web programming:
techempower.com/benchmarks
High performance web programming with C++14 4 / 61 Matthieu Garrigues
5. Motivations C++11/14 Static introspection in the IOD library The Silicon Web Framework Conclusion
Motivations
But, it is not really famous for its productivity and ease of use.
High performance web programming with C++14 5 / 61 Matthieu Garrigues
6. Motivations C++11/14 Static introspection in the IOD library The Silicon Web Framework Conclusion
Motivations
So, let’s leverage the new C++14 to ease the writting of web
services without impacting its speed of execution...
High performance web programming with C++14 6 / 61 Matthieu Garrigues
7. Motivations C++11/14 Static introspection in the IOD library The Silicon Web Framework Conclusion
Outline
1 Motivations
2 C++11/14
3 Static introspection in the IOD library
4 The Silicon Web Framework
5 Conclusion
High performance web programming with C++14 7 / 61 Matthieu Garrigues
8. Motivations C++11/14 Static introspection in the IOD library The Silicon Web Framework Conclusion
C++11/14
The C++11/14 greatly improves C++, but C/C++ web
frameworks were created with C++98:
TreeFrog
cppnetlib
Wt
CppCMS
lwan
h2o
Facebook Proxygen
....
High performance web programming with C++14 8 / 61 Matthieu Garrigues
9. Motivations C++11/14 Static introspection in the IOD library The Silicon Web Framework Conclusion
C++11/14
Let’s take a look at some of the C++11/14 new features.
High performance web programming with C++14 9 / 61 Matthieu Garrigues
10. Motivations C++11/14 Static introspection in the IOD library The Silicon Web Framework Conclusion
C++11/14: auto
Automatic type inference
auto i = 42;
for ( auto it = v . begin () ; it != v . end () ; it++)
{ . . . }
template <typename A , typename B>
auto fun ( A a , B b ) { return a + b ; }
High performance web programming with C++14 10 / 61 Matthieu Garrigues
11. Motivations C++11/14 Static introspection in the IOD library The Silicon Web Framework Conclusion
C++11/14: decltype
Automatic type computation
using a_type =
decltype (/ a complex expression .
You do not want to manually compute its
type . / )
High performance web programming with C++14 11 / 61 Matthieu Garrigues
12. Motivations C++11/14 Static introspection in the IOD library The Silicon Web Framework Conclusion
C++11/14: lambda functions
Lambda functions
std : : vector<int> V = { 3 , 6 , 2 , 5 , 6 , 7 , 5};
std : : sort ( V . begin () , V . end () ,
[ ] ( int a , int b ) { return a > b ; }) ;
High performance web programming with C++14 12 / 61 Matthieu Garrigues
13. Motivations C++11/14 Static introspection in the IOD library The Silicon Web Framework Conclusion
C++11/14: What’s new?
Generic lambda functions
auto print = [ ] ( auto e )
{
cout << e << endl ;
};
print (1) ; // i n t
print (2. 3 f ) ; // f l o a t
print ( "test" ) ; // const char ∗
High performance web programming with C++14 13 / 61 Matthieu Garrigues
14. Motivations C++11/14 Static introspection in the IOD library The Silicon Web Framework Conclusion
C++11/14: What’s new?
Variadic templates
void variadic_printf () {}
template <typename A , typename . . . T>
void variadic_printf ( const A& a , T &&... tail )
{
std : : cout << a ;
variadic_printf ( std : : forward<T>(tail ) . . . ) ;
}
High performance web programming with C++14 14 / 61 Matthieu Garrigues
15. Motivations C++11/14 Static introspection in the IOD library The Silicon Web Framework Conclusion
C++11/14: What’s new?
The constexpr keyword
constexpr int
compile_time_add ( int a , int b )
{
return a + b ;
}
High performance web programming with C++14 15 / 61 Matthieu Garrigues
16. Motivations C++11/14 Static introspection in the IOD library The Silicon Web Framework Conclusion
C++11/14: What’s new?
They are great features. But how do they help Web Programming?
High performance web programming with C++14 16 / 61 Matthieu Garrigues
17. Motivations C++11/14 Static introspection in the IOD library The Silicon Web Framework Conclusion
Outline
1 Motivations
2 C++11/14
3 Static introspection in the IOD library
4 The Silicon Web Framework
5 Conclusion
High performance web programming with C++14 17 / 61 Matthieu Garrigues
18. Motivations C++11/14 Static introspection in the IOD library The Silicon Web Framework Conclusion
Our problem
A kind of static introspection exists in C++.
But, it does not help to build:
Automatic serialization / deserialization
Object relational mapping
⇒ Let’s improve C++ introspection.
High performance web programming with C++14 18 / 61 Matthieu Garrigues
19. Motivations C++11/14 Static introspection in the IOD library The Silicon Web Framework Conclusion
Definition of a symbol
A symbol is a meta object member carrying its own static
introspection data.
Let dig into the symbol car:
struct _car_t
{
// symbol to s t r i n g .
const char∗ name () { return "car" ; }
template <typename T>
struct variable_type // Meta v a r i a b l e
{
T car ; // car member .
using symbol_type = _car_t ;
auto symbol () const { return _car_t () ; }
};
}
_car_t _car ; // Symbol d e f i n i t i o n .
High performance web programming with C++14 19 / 61 Matthieu Garrigues
20. Motivations C++11/14 Static introspection in the IOD library The Silicon Web Framework Conclusion
Symbol definition
By convention symbols start with . They are included in the
namespace s to avoid name conflicts.
A macro function helps the definition of symbols:
iod_define_symbol ( car ) ; // d e f i n e s s : : c a r
iod_define_symbol ( name ) ; // d e f i n e s s : : name
High performance web programming with C++14 20 / 61 Matthieu Garrigues
21. Motivations C++11/14 Static introspection in the IOD library The Silicon Web Framework Conclusion
Using symbols
Using the symbol car:
auto x = _car_t : : variable_type<string >() ;
x . car = "BMW" ;
// x . value () == ”BMW”
// x . symbol () r e t u r n s c a r t () ;
// x . symbol () . name () r e t u r n s ”car ”;
High performance web programming with C++14 21 / 61 Matthieu Garrigues
22. Motivations C++11/14 Static introspection in the IOD library The Silicon Web Framework Conclusion
Only one member?
Just one member per object is quite a limitation, so...
High performance web programming with C++14 22 / 61 Matthieu Garrigues
23. Motivations C++11/14 Static introspection in the IOD library The Silicon Web Framework Conclusion
Statically introspectable objects
Let’s stack them together into IOD’s statically introspectable
objects (SIO).
template <typename . . . Members>
struct sio : public Members . . .
{
sio ( Members . . . s ) : Members ( s ) . . . {}
};
using person_type =
sio<_id_t : : variable_type<int>,
_name_t : : variable_type<string>>;
IOD relies on inheritance to stack the members id and name
together.
High performance web programming with C++14 23 / 61 Matthieu Garrigues
24. Motivations C++11/14 Static introspection in the IOD library The Silicon Web Framework Conclusion
Statically introspectable objects
The D helper is our friend.
auto john = D ( _id = 42 ,
_name = "John" ) ;
// john . i d == 42;
// john . name == ”John ”;
High performance web programming with C++14 24 / 61 Matthieu Garrigues
25. Motivations C++11/14 Static introspection in the IOD library The Silicon Web Framework Conclusion
Inside SIOs
Behind the scene, D puts the introspection data in the SIO type:
decltype ( john )
==
iod : : sio<s : : _id_t : : variable_type<int>,
s : : _name_t : : variable_type<string>>
High performance web programming with C++14 25 / 61 Matthieu Garrigues
26. Motivations C++11/14 Static introspection in the IOD library The Silicon Web Framework Conclusion
Foreach
Then, iod::foreach can easily iterate on statically introspectable
objects.
Let’s write a generic serializer:
foreach ( any_sio_object ) | [ ] ( auto& m )
{
std : : cout << m . symbol () . name ()
<< ": " << m . value () << std : : endl ;
};
=> Unrolled at compile time, no runtime cost.
High performance web programming with C++14 26 / 61 Matthieu Garrigues
27. Motivations C++11/14 Static introspection in the IOD library The Silicon Web Framework Conclusion
Foreach
iod::foreach also handles multiple arguments, the creation of new
objects...
auto sum =
foreach ( o1 , o2 ) | [ ] ( auto& m1 , auto& m2 )
{
return m1 . symbol () = m1 . value () + m2 . value () ;
};
Note: o1 and o2 must have the same number of members.
High performance web programming with C++14 27 / 61 Matthieu Garrigues
28. Motivations C++11/14 Static introspection in the IOD library The Silicon Web Framework Conclusion
Foreach
... and tuples
auto sum =
foreach ( tuple1 , tuple2 ) | [ ] ( auto& e1 , auto& e2 )
{
return e1 + e2 ;
};
Note: tuple1 and tuple2 must have the same number of elements.
High performance web programming with C++14 28 / 61 Matthieu Garrigues
29. Motivations C++11/14 Static introspection in the IOD library The Silicon Web Framework Conclusion
Static instropection: What for?
On top of static introspection (and other utilities), the IOD library
implements:
JSON serialization / deserialization
Dependency injection
High performance web programming with C++14 29 / 61 Matthieu Garrigues
30. Motivations C++11/14 Static introspection in the IOD library The Silicon Web Framework Conclusion
Outline
1 Motivations
2 C++11/14
3 Static introspection in the IOD library
4 The Silicon Web Framework
5 Conclusion
High performance web programming with C++14 30 / 61 Matthieu Garrigues
31. Motivations C++11/14 Static introspection in the IOD library The Silicon Web Framework Conclusion
The Silicon Web Framework: Goal
The Silicon Web Framework leverages static introspection to
ease the writting of web services, without impacting the
performances.
High performance web programming with C++14 31 / 61 Matthieu Garrigues
32. Motivations C++11/14 Static introspection in the IOD library The Silicon Web Framework Conclusion
The Silicon Web Framework: Hello world
Let’s build a simple hello world api.
High performance web programming with C++14 32 / 61 Matthieu Garrigues
33. Motivations C++11/14 Static introspection in the IOD library The Silicon Web Framework Conclusion
The Silicon Web Framework: Hello world
To serve this simple procedure via http:
[ ] { return "hello world" ; }
High performance web programming with C++14 33 / 61 Matthieu Garrigues
34. Motivations C++11/14 Static introspection in the IOD library The Silicon Web Framework Conclusion
The Silicon Web Framework: Hello world
Wrap it in an API and map the function to the route /hello:
make_api ( _hello = [ ] { return "hello world" ; }) ;
Note the use of IOD statically introspectable objects to model the
API.
High performance web programming with C++14 34 / 61 Matthieu Garrigues
35. Motivations C++11/14 Static introspection in the IOD library The Silicon Web Framework Conclusion
The Silicon Web Framework: Hello world
Let’s launch the microhttpd HTTP backend to serve our API.
Because the API is actually a SIO, the backend can bind the route
/hello to our lambda function.
mhd_json_serve ( make_api ( _hello = [ ] {
return "hello world" ;
}) , 9999) ;
That’s it.
curl "http ://127.0.0.1:9999/ hello"
hello world
Up to 285000 requests/seconds on a 4 cores Intel I5 3GHz: Exactly
what you get with a plain C microhttpd hello world server.
High performance web programming with C++14 35 / 61 Matthieu Garrigues
36. Motivations C++11/14 Static introspection in the IOD library The Silicon Web Framework Conclusion
The Silicon Web Framework: Procedure Arguments?
Procedures can take arguments:
auto api = make_api (
_hello ( _name = string () ) = [ ] ( auto params ) {
return "hello " + params . name ; }
) ;
The backend is responsible for deserialization and validation of the
procedure arguments.
High performance web programming with C++14 36 / 61 Matthieu Garrigues
37. Motivations C++11/14 Static introspection in the IOD library The Silicon Web Framework Conclusion
The Silicon Web Framework: Returning objects
Procedures can also return statically introspectable objects:
auto api = make_api (
_hello ( _name = string () ) = [ ] ( auto params ) {
return D ( _message = "Hello" + params . name ) ; }
) ;
The backend is responsible for serialization of the procedure return
values.
High performance web programming with C++14 37 / 61 Matthieu Garrigues
38. Motivations C++11/14 Static introspection in the IOD library The Silicon Web Framework Conclusion
Middlewares And Dependency injection
We need to provide access to middlewares:
Databases
Sessions
Logging
...
High performance web programming with C++14 38 / 61 Matthieu Garrigues
39. Motivations C++11/14 Static introspection in the IOD library The Silicon Web Framework Conclusion
Middlewares And Dependency injection
However, not all procedures need an access to all middlewares.
High performance web programming with C++14 39 / 61 Matthieu Garrigues
40. Motivations C++11/14 Static introspection in the IOD library The Silicon Web Framework Conclusion
Middlewares And Dependency injection
We want to require access to the middlewares just by declaring
them as argument:
auto api = make_api (
_a_procedure = [ ] ( sqlite_connection& c ,
logger& l ) {
// . . .
}
) ;
The framework introspects the function signature to inject the
matching middlewares as arguments.
High performance web programming with C++14 40 / 61 Matthieu Garrigues
41. Motivations C++11/14 Static introspection in the IOD library The Silicon Web Framework Conclusion
Middlewares And Dependency injection
Most middlewares cannot be created from nothing. Some need
factories.
The bind_factories method attaches factories to a given API:
auto api = make_api (
_procedure1 = [ ] ( sqlite_connection& c ) {} ,
_procedure2 = [ ] ( my_logger& l ) {} ,
_procedure3 = [ ] ( my_logger& l , sqlite_connection& c )
{}
) . bind_factories (
sqlite_connection_factory ( "blog.sqlite" ) ,
my_logger_factory ( "/tmp/server.log" )
) ;
IOD’s dependency injection takes care of binding the right factory
to the right procedure arguments.
High performance web programming with C++14 41 / 61 Matthieu Garrigues
42. Motivations C++11/14 Static introspection in the IOD library The Silicon Web Framework Conclusion
Anatomy of middleware
A middleware factory is a plain C++ class with one instantiate
method: the dependency injection entry point.
Let’s have a look at session_factory::instantiate:
session instantiate ( cookie& ck , db_connection& con )
{
return session ( ck , con , this−>sql_session_table ) ;
}
session is the middleware type.
Its instantiation depends on two middlewares: cookie and
db_connection.
High performance web programming with C++14 42 / 61 Matthieu Garrigues
43. Motivations C++11/14 Static introspection in the IOD library The Silicon Web Framework Conclusion
Inter Middleware Dependencies
cookie and db_connection also have factories, and their instantiation
may depend on other middlewares.
⇒ This leads to a dependency tree, resolved by IOD’s dependency
injection at compile time.
High performance web programming with C++14 43 / 61 Matthieu Garrigues
44. Motivations C++11/14 Static introspection in the IOD library The Silicon Web Framework Conclusion
Inter Middleware Dependencies
In other words, if a procedure requires a session object:
auto api = make_api ( _procedure1 = [ ] ( session& s ) {}) ;
High performance web programming with C++14 44 / 61 Matthieu Garrigues
45. Motivations C++11/14 Static introspection in the IOD library The Silicon Web Framework Conclusion
Inter Middleware Dependencies
The framework generates a code similar to this:
cookie ck = cookie_factory . instantiate () ;
db_connection con= db_connection_factory . instantiate () ;
session s = session_factory . instantiate ( ck , con ) ;
api . procedure1 ( s ) ;
High performance web programming with C++14 45 / 61 Matthieu Garrigues
46. Motivations C++11/14 Static introspection in the IOD library The Silicon Web Framework Conclusion
SQL Middlewares
Silicon SQL middlewares provide a basic interface with SQL
databases.
Sqlite and MySQL are already available.
[ ] ( sqlite_connection& c ) {
int i ;
c ( "Select 1 + 2" ) >> i ;
}
High performance web programming with C++14 46 / 61 Matthieu Garrigues
47. Motivations C++11/14 Static introspection in the IOD library The Silicon Web Framework Conclusion
SQL Middlewares: Iterations on Result Sets
Straightforward iteration on a result set:
c ( "SELECT name , age from users" ) () |
[ ] ( std : : string& name , int& age )
{
std : : cout << name << " " << age << std : : endl ;
};
Again, introspection on the lambda function arguments helps to
write zero cost abstractions.
High performance web programming with C++14 47 / 61 Matthieu Garrigues
48. Motivations C++11/14 Static introspection in the IOD library The Silicon Web Framework Conclusion
SQL Middlewares: Prepared statements
For better performance, prepared statements are created, cached,
and reused whenever a request is triggered more than once.
// F i r s t c a l l , prepare the SQL statement .
c ( "INSERT into users(name , age) VALUES (?, ?)" )
( "John" , 12) ;
// Second c a l l , reuse the cached statement .
c ( "INSERT into users(name , age) VALUES (?, ?)" )
( "Bob" , 14) ;
High performance web programming with C++14 48 / 61 Matthieu Garrigues
49. Motivations C++11/14 Static introspection in the IOD library The Silicon Web Framework Conclusion
SQL ORM Middlewares
It is pretty easy to generate SQL requests from statically
introspectable objects.
Let’s declare our statically introspectable User data type:
typedef
decltype ( D ( _id = int () ,
_login = string () ,
_password = string () ) )
User ;
High performance web programming with C++14 49 / 61 Matthieu Garrigues
50. Motivations C++11/14 Static introspection in the IOD library The Silicon Web Framework Conclusion
SQL ORMs
And give the ORM hints for the SQL generation:
typedef
decltype ( D ( _id ( _auto_increment ,
_primary_key ) = int () ,
_login = string () ,
_password = string () ) )
User ;
High performance web programming with C++14 50 / 61 Matthieu Garrigues
51. Motivations C++11/14 Static introspection in the IOD library The Silicon Web Framework Conclusion
SQL ORM Middlewares: Example
// The middleware type .
typedef sqlite_orm<User> user_orm ;
typedef sqlite_orm_factory<User> user_orm_factory ;
// An API making use of the ORM.
auto api = make_api (
_test_orm ( _id = int () ) = [ ] ( auto p , user_orm& users )
{
User u = users . find_by_id ( p . id ) ;
u . login = "Rob" ;
users . update ( u ) ;
}
// The f a c t o r i e s .
) . bind_factories ( sqlite_connection_factory ( "db.sql" ) ,
user_orm_factory ( "user_table" ) ) ;
High performance web programming with C++14 51 / 61 Matthieu Garrigues
52. Motivations C++11/14 Static introspection in the IOD library The Silicon Web Framework Conclusion
SQL CReate Update Delete
sql_crud generates Create Update and Delete routes for a given
ORM type:
auto api = make_api ( _user = sql_crud<user_orm >() ) ;
mhd_json_serve ( api , 9999) ;
Creates the following routes:
/user/create
/user/update
/user/destroy
And saves you tens of lines of code.
High performance web programming with C++14 52 / 61 Matthieu Garrigues
53. Motivations C++11/14 Static introspection in the IOD library The Silicon Web Framework Conclusion
SQL CReate Update Delete
The parameters of sql_crud allow to handle:
validation of objects
user authentication
pre/post processing.
High performance web programming with C++14 53 / 61 Matthieu Garrigues
54. Motivations C++11/14 Static introspection in the IOD library The Silicon Web Framework Conclusion
SQL CReate Update Delete
This parameterization relies on lambda functions and dependency
injection (DI). Let’s write an example with the _write_access
option:
sql_crud<user_orm >(
_write_access = [ ] ( user& u , session& s ) {
return u . id == s . user_id ;
}
)
Thanks to dependency propagation, the middlewares (session in
this example) and the current user object are accessible from the
callback.
High performance web programming with C++14 54 / 61 Matthieu Garrigues
55. Motivations C++11/14 Static introspection in the IOD library The Silicon Web Framework Conclusion
Silicon Backends
We have APIs and middlewares, let’s plug everything into the
network.
High performance web programming with C++14 55 / 61 Matthieu Garrigues
56. Motivations C++11/14 Static introspection in the IOD library The Silicon Web Framework Conclusion
Silicon Backends
Silicon backends leverage the introspection on Silicon APIs to serve
them via:
Differents protocols: HTTP/1, HTTP/2, Websockets...
Differents message formats: JSON, XML, ...
Differents protocol implementations: microhttpd, h2o, ...
As of today, April 2015, Silicon includes microhttpd/json and
websocketpp/json.
High performance web programming with C++14 56 / 61 Matthieu Garrigues
57. Motivations C++11/14 Static introspection in the IOD library The Silicon Web Framework Conclusion
Limitations of the framework
Slow compilation
2s for the hello world one liner
35s for a complex 110 lines API
GCC error messages
Static introspection can generate very, very long types
GCC error messages get hard to digest
Much better with Clang shortening long types
High performance web programming with C++14 57 / 61 Matthieu Garrigues
58. Motivations C++11/14 Static introspection in the IOD library The Silicon Web Framework Conclusion
Future works
Lower compilation time
More database middlewares (PostgreSQL, Redis, ...)
More backends (HTTP/2, ...)
Suggestions?
⇒ Contributions are welcome
High performance web programming with C++14 58 / 61 Matthieu Garrigues
59. Motivations C++11/14 Static introspection in the IOD library The Silicon Web Framework Conclusion
Outline
1 Motivations
2 C++11/14
3 Static introspection in the IOD library
4 The Silicon Web Framework
5 Conclusion
High performance web programming with C++14 59 / 61 Matthieu Garrigues
60. Motivations C++11/14 Static introspection in the IOD library The Silicon Web Framework Conclusion
Conclusion
The new C++ features enabled us to build zero cost abstractions
for building web services:
Simple to write
Without impacting running time
Where most bugs are reported by the compiler at compile time
With a tiny framework of less than 10000 C++ lines.
Open source (MIT): github.com/matt-42/silicon
High performance web programming with C++14 60 / 61 Matthieu Garrigues
61. Motivations C++11/14 Static introspection in the IOD library The Silicon Web Framework Conclusion
Question?
_ask ( _question ) = [ ] ( auto p , my_smart_middleware& m )
{
return m . answer ( p . question ) ;
}
Or visit http://siliconframework.org
High performance web programming with C++14 61 / 61 Matthieu Garrigues