A look at a modern programming language and how it can enhance the productivity and workflow of developers while promising higher execution performance. We will be talking about metaprogramming, functional programming and type systems in a pragmatic way mixed with some examples from `vibe.d` web framework.
By Yazan Dabain - Senior System Engineer, Arabia Weather
Depuis son origine, Java fournit plusieurs classes et interfaces destinées à la programmation réseau, à cause de son API qui a été bien conçu et riche d'une côté, et traité la plupart des interfaces, protocoles et plateformes d'autres côté; la programmation des applications réseaux en JAVA est devenue un choix primordial.
Support de cours EJB :
- Architecture JEE
- Séparer le code métier et le code technique
- Inversion de contrôle
- EJB session
- EJB Entity
- Mise en oeuvre des projets EJB
- EJB et Web services
- JMS
- MDB
- Gestion de transactions avec EJB
- Application
Depuis son origine, Java fournit plusieurs classes et interfaces destinées à la programmation réseau, à cause de son API qui a été bien conçu et riche d'une côté, et traité la plupart des interfaces, protocoles et plateformes d'autres côté; la programmation des applications réseaux en JAVA est devenue un choix primordial.
Support de cours EJB :
- Architecture JEE
- Séparer le code métier et le code technique
- Inversion de contrôle
- EJB session
- EJB Entity
- Mise en oeuvre des projets EJB
- EJB et Web services
- JMS
- MDB
- Gestion de transactions avec EJB
- Application
DVWA ou Damn Vulnerable Web Applications fait généralement partie des premiers travaux pratiques sur lesquels on se penche pour débuter en audit/pentest de sécurité.
Nous commençons donc avec les failles de type CSRF.
Sécurité : Fonctionnement et impact d’une attaque CSRF
L’objectif même de l’attaque est généralement d’exécuter une action, exemple : Créer un utilisateur sur un site web.
Workshop Spring - Session 1 - L'offre Spring et les basesAntoine Rey
Rejoignez les millions de développeurs Spring
De par sa forte pénétration dans les entreprises, tout développeur Java /JEE a ou aura à travailler sur une application s’appuyant sur Spring. Or Spring dépasse le cadre du simple framework open source.
Cette série de 5 workshops a pour objectif de faire un tour d’horizon de l’écosystème des technologies supportées par Spring avant de se focaliser plus spécifiquement sur certaines d’entre elles.
Retours d’expérience, bonnes pratiques, techniques avancées seront de partie.
Propulsée dans Java EE 6 avec CDI et plus récemment au sein de JavaScript avec Google Gin, l’injection de dépendance sera au cœur du premier workshop.
Voici le support de présentation du workshop sur Spring que j'ai animé en novembre 2011 au sein de ma SSII et que j'ai réactualisé avant sa diffusion sur Slideshare.
Au sommaire du workshop :
1. Zoom sur le portfolio Spring Source
1. Le cœur du framework Spring : IoC, AOP et support
2. Le support proposé par Spring : persistance, présentation, communication, test, outils …
2. Les fondamentaux
1. Fonctionnement du conteneur léger
2. Les beans Spring
3. Les design patterns rencontrés dans Spring
Système de détection d'intrusion (Intrusion Detection System)YousraChahinez
Un système de détection d'intrusion, (ou IDS pour Intrusion detection system), tente de découvrir ces exploits illégaux commis sur le système en s’appuyant sur une norme. Si les activités s’éloignent de la norme, l’IDS lance une alerte.
Présentation effectuée au Rencontres Mondiales du Logiciel Libre (RMLL) 2017 par Christophe Villeneuve sur "Comprendre la securite web".
Vous allez voir pourquoi la sécurité ne doit pas être pris à la légère. Mais heureusement des solutions existes
Intervention sur la cybersécurité en BTS SIO, pour les SISR (admin sys et réseau) et les SLAM (développeurs).
Ce document commence par un questionnement sur les meilleurs moyens de sécuriser un SI. Ensuite, une petite partie de sensibilisation explique les risques que les étudiants ne devront pas prendre en entreprise (quels que soient leurs postes). L'intervention poursuit avec une présentation de la cybersécurité, des métiers et des activités qui y sont liés ainsi que des besoins en entreprise. Enfin, ces slides permettront d'identifier des points sensibles de la cybersécurité dans leurs activités respectives (en tant que développeur ou en tant qu'administrateur).
Le tout est entrecoupé de petites parties pratiques qui permettent de démontrer les faits et qui renforceront les compétences techniques des étudiants.
Qu'est ce que Java et JEE ?
Comment se fait l'évolution de Java ?
Les architectures SOA.
Les technologies (JSR).
Les frameworks.
Le middleware.
Les outils.
DVWA ou Damn Vulnerable Web Applications fait généralement partie des premiers travaux pratiques sur lesquels on se penche pour débuter en audit/pentest de sécurité.
Nous commençons donc avec les failles de type CSRF.
Sécurité : Fonctionnement et impact d’une attaque CSRF
L’objectif même de l’attaque est généralement d’exécuter une action, exemple : Créer un utilisateur sur un site web.
Workshop Spring - Session 1 - L'offre Spring et les basesAntoine Rey
Rejoignez les millions de développeurs Spring
De par sa forte pénétration dans les entreprises, tout développeur Java /JEE a ou aura à travailler sur une application s’appuyant sur Spring. Or Spring dépasse le cadre du simple framework open source.
Cette série de 5 workshops a pour objectif de faire un tour d’horizon de l’écosystème des technologies supportées par Spring avant de se focaliser plus spécifiquement sur certaines d’entre elles.
Retours d’expérience, bonnes pratiques, techniques avancées seront de partie.
Propulsée dans Java EE 6 avec CDI et plus récemment au sein de JavaScript avec Google Gin, l’injection de dépendance sera au cœur du premier workshop.
Voici le support de présentation du workshop sur Spring que j'ai animé en novembre 2011 au sein de ma SSII et que j'ai réactualisé avant sa diffusion sur Slideshare.
Au sommaire du workshop :
1. Zoom sur le portfolio Spring Source
1. Le cœur du framework Spring : IoC, AOP et support
2. Le support proposé par Spring : persistance, présentation, communication, test, outils …
2. Les fondamentaux
1. Fonctionnement du conteneur léger
2. Les beans Spring
3. Les design patterns rencontrés dans Spring
Système de détection d'intrusion (Intrusion Detection System)YousraChahinez
Un système de détection d'intrusion, (ou IDS pour Intrusion detection system), tente de découvrir ces exploits illégaux commis sur le système en s’appuyant sur une norme. Si les activités s’éloignent de la norme, l’IDS lance une alerte.
Présentation effectuée au Rencontres Mondiales du Logiciel Libre (RMLL) 2017 par Christophe Villeneuve sur "Comprendre la securite web".
Vous allez voir pourquoi la sécurité ne doit pas être pris à la légère. Mais heureusement des solutions existes
Intervention sur la cybersécurité en BTS SIO, pour les SISR (admin sys et réseau) et les SLAM (développeurs).
Ce document commence par un questionnement sur les meilleurs moyens de sécuriser un SI. Ensuite, une petite partie de sensibilisation explique les risques que les étudiants ne devront pas prendre en entreprise (quels que soient leurs postes). L'intervention poursuit avec une présentation de la cybersécurité, des métiers et des activités qui y sont liés ainsi que des besoins en entreprise. Enfin, ces slides permettront d'identifier des points sensibles de la cybersécurité dans leurs activités respectives (en tant que développeur ou en tant qu'administrateur).
Le tout est entrecoupé de petites parties pratiques qui permettent de démontrer les faits et qui renforceront les compétences techniques des étudiants.
Qu'est ce que Java et JEE ?
Comment se fait l'évolution de Java ?
Les architectures SOA.
Les technologies (JSR).
Les frameworks.
Le middleware.
Les outils.
The objective of the Level 5 Diploma in Information Technology is to provide learners with an excellent foundation for a career in a range of organisations. It designed to ensure that each learner is ‘business ready’: a confident, independent thinker with detailed knowledge of Information Technology, and equipped with the skills to adapt rapidly to change.
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!
The sole purpose of sharing these slides are to educate the beginners of IT and Computer Science/Engineering. Credits should go to the referred material and also CICRA campus, Colombo 4, Sri Lanka where I taught these in 2017.
What features of modern programming languages allow you to maximise creativity and express solutions to problems elegantly and efficiently. This is a summary of features of the latest languages and how they help.
Much of the software world has moved to microservices and a Service-Oriented Architecture (SOA) when designing large-scale systems. An alternate, less-known philosophy of building large systems is called Data-Oriented Architecture (DOA), which trades off the scale and maintainability challenges of SOA with a rigorous focus on schema representation in a monolithic data access layer. For microservices-based systems where scale across verticals is a challenge, DOA might be an appropriate alternative.
Speaker: Eyas Sharaiha - Senior Software Engineer at Google
How can we apply machine learning techniques on graphs to obtain predictions in a variety of domains? Know more from Sami Abu-El-Haija, an AI Scientist with experience from both industry (Google Research) and academia (University of Southern California).
Open source is an important part of the engineering infrastructure at OpenSooq, and mobile is no exception. OpenSooq team presents their development toolbox, modules they use, and how OpenSooq tests its apps at scale and speed.
Presentation about digital transformation driven by big data, and how to navigate from data to insight to action. Presentation given by Hamzah Amin, a Senior Data Scientist & Analytics Consultant at Jordan Business Systems. He is also a Master's student in Data Science at Princess Sumaya University for Technology.
By Hamzah Amin at the JOSA Data Science Meetup on 14/9/2019.
Applications of Data Science in Drug Discovery, Financial Services, Project Management, Human Resources and Marketing.
By Dr. Laila Alabidi at the JOSA Data Science Meetup on 17/8/2019.
Slides for 'JOSA TechTalks: Arabic NLP in Practice' with an introduction to Natural Language Understanding (NLU) with focus on Arabic, covers main issues in (Arabic) NLU and used tools and resources.
By Dr. Samir Tartir - Senior Research Scientist of AI at Mawdoo3
Docker is an open platform for developers and system administrators to build, ship and run distributed applications. Using Docker, companies in Jordan have been able to build powerful system architectures that allow speeding up delivery, easing deployment processes and at the same time cutting major hosting costs.
Osama Jaber shares his experience at ArabiaWeather in how they moved away from AWS to a highly-redundant, high-performance and low-cost solution using docker and other open-source technologies.
Docker is an open platform for developers and system administrators to build, ship and run distributed applications. Using Docker, companies in Jordan have been able to build powerful system architectures that allow speeding up delivery, easing deployment processes and at the same time cutting major hosting costs.
George Khoury shares his experience at Salalem in building flexible and cost effective architectures using Docker and other tools for infrastructure orchestration. The result allows them to easily and quickly move between different cloud providers.
With the exponential growth of the Internet, inundating text is being generated through articles, blogs, comments, and tweets. For computing systems, text is merely a series of bytes with no meaning. This renders the text obsolete for any further processing.
Multiple methods have been applied to make computers infer word meanings, but none of them was accurate and practical as much as Word2Vec. Word2Vec opened a new horizon for industries that allowed them to apply various Natural Language Processing (NLP) tasks such as machine translation, sentiment analysis, word similarity, text summarization, chat bots ...etc.
This was part of JOSA TechTalks project within Jordan Open Source Association, presented by Wael Farhan.
As applications grow in complexity, web developers and front-end developers all suffer the hassle of building and maintaining complex web applications; managing and maintaining consistency of application state. This presentation goes through what's special about React and Redux.
This was part of JOSA TechTalks project within Jordan Open Source Association, presented by Ali Sa'o and Omar Abdelhafith.
Everyday we create services for our systems. A lot of people create RESTful APIs but much more can be accomplished by following best practices and treating your APIs as a product to be consumed by fellow team members, systems and 3rd party consumers.
We will discuss what makes a great RESTful API and share some of our experiences building some that power real systems.
This was part of JOSA TechTalks project within Jordan Open Source Association, presented by Yazan Quteishat and Tambi Jalouqa.
Any non-trivial solution will be spread across multiple servers in different data centers. A lot of system administrators use external tools for monitoring, health-checking, and alerts. In this session, we will discuss ways to build your own monitoring and alert system to keep an eye on all kinds of running systems.
RDBMS gave us table schemas. A table schema, which is an essential metadata component, gave us the power to validate data types, and enforce constraints. In the age of varying data and schema-less data stores, how can we enforce these rules and how can we leverage metadata (even in RDBMS) to empower data validity, code checks, and automation.
This is a brief background into Big data (data lake) to put in context the importance of metadata from a governance perspective and more especially in todays heterogeneous big data platforms.
In this session, Sinan introduces Supervised Learning, help you build an intuition about it, and walk you through an example with Python using scikit-learn. You'll see it is pretty straightforward, and you might find room to apply Supervised Learning in your current or next project!
Presented by: Sinan Taifour, CTO at CashBasha.com
Session video recording is on: https://youtu.be/nfbBrPk3EiQ
Docker and Containers are proven solutions, but are they ready to replace your current deployment? And more importantly, are you aware of the changes you'll have to make to accommodate them? Are there any risks involved? This talk will answer these questions and talk about how to plan, automate, build, deploy, and orchestrate the whole process.
Introducing containers and docker, answering questions like: What are software containers? What is Docker? Who and why should I use Docker?
Slides also discuss the role of dev-ops and Docker and walk you through some examples.
By Aram Yegenian — System Administrator
Scala, Haskell and LISP are examples of programming languages using the functional programming paradigm. Join us in this TechTalk to know why functional programming is so important, how to implement some of its core concepts in your existing programming languages, and how functional programming inspired Google's Map Reduce, Twitter's Algebird, and many other technologies.
By Mohammad Ghabboun - Senior Software Engineer, SOUQ.com
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...DanBrown980551
Do you want to learn how to model and simulate an electrical network from scratch in under an hour?
Then welcome to this PowSyBl workshop, hosted by Rte, the French Transmission System Operator (TSO)!
During the webinar, you will discover the PowSyBl ecosystem as well as handle and study an electrical network through an interactive Python notebook.
PowSyBl is an open source project hosted by LF Energy, which offers a comprehensive set of features for electrical grid modelling and simulation. Among other advanced features, PowSyBl provides:
- A fully editable and extendable library for grid component modelling;
- Visualization tools to display your network;
- Grid simulation tools, such as power flows, security analyses (with or without remedial actions) and sensitivity analyses;
The framework is mostly written in Java, with a Python binding so that Python developers can access PowSyBl functionalities as well.
What you will learn during the webinar:
- For beginners: discover PowSyBl's functionalities through a quick general presentation and the notebook, without needing any expert coding skills;
- For advanced developers: master the skills to efficiently apply PowSyBl functionalities to your real-world scenarios.
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Albert Hoitingh
In this session I delve into the encryption technology used in Microsoft 365 and Microsoft Purview. Including the concepts of Customer Key and Double Key Encryption.
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.
In his public lecture, Christian Timmerer provides insights into the fascinating history of video streaming, starting from its humble beginnings before YouTube to the groundbreaking technologies that now dominate platforms like Netflix and ORF ON. Timmerer also presents provocative contributions of his own that have significantly influenced the industry. He concludes by looking at future challenges and invites the audience to join in a discussion.
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
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.
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/
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.
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.
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.
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.
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofsAlex Pruden
This paper presents Reef, a system for generating publicly verifiable succinct non-interactive zero-knowledge proofs that a committed document matches or does not match a regular expression. We describe applications such as proving the strength of passwords, the provenance of email despite redactions, the validity of oblivious DNS queries, and the existence of mutations in DNA. Reef supports the Perl Compatible Regular Expression syntax, including wildcards, alternation, ranges, capture groups, Kleene star, negations, and lookarounds. Reef introduces a new type of automata, Skipping Alternating Finite Automata (SAFA), that skips irrelevant parts of a document when producing proofs without undermining soundness, and instantiates SAFA with a lookup argument. Our experimental evaluation confirms that Reef can generate proofs for documents with 32M characters; the proofs are small and cheap to verify (under a second).
Paper: https://eprint.iacr.org/2023/1886
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.
Unlocking Productivity: Leveraging the Potential of Copilot in Microsoft 365, a presentation by Christoforos Vlachos, Senior Solutions Manager – Modern Workplace, Uni Systems
2. WHAT IS D?
A statically typed, compiled language with C-like syntax.
A languages that provides productivity and modelling power at the same time as
high performance and efficiency.
“D demonstrates that it is possible to build a powerful programming language that is both easy to use and generates fast code.”
4. WALTER BRIGHT
Creator of the D programming language.
Developer of multiple C and C++ compilers:
Zorland C, Zortech C++, Digital Mars C++, ...
Aware of the problems in the existing languages,
he decided to write his own language.
And so, D started out in 1999.
5. ANDREI ALEXANDRESCU
Co-designer of the D programming language.
Joined in 2006.
Renowned author/co-author of:
Modern C++ Design: Generic Programming
and Design Patterns Applied [2001]
C++ Coding Standards: 101 Rules, Guidelines,
and Best Practices [2004]
The D Programming Language [2009]
6. TIMELINE OF PROGRAMMING LANGUAGES
1970 1975 1980 1985 1990 1995 2000 2005 2010 2015
D2.068.1
C C++
Objective-C
Perl
Erlang
Bash
Haskell
Python
Visual Basic
Lua
PHP
Java
JavaScript
Ruby
D1
Python 2
C#
Scala D2
Python 3
Go
C++11
Java 7
C++14
Swift
Java 8
7. QUICK LOOK AT DSYNTAX
import std.stdio;
void main()
{
writeln("Hello JOSA!");
}
/**
* Returns the sum of elements.
*
* Params:
* elements = array of integers to sum
*/
int sum(int[] elements)
{
int sum = 0;
foreach (element; elements)
sum += element;
return sum;
}
/**
* Writes each argument and its length
* to stdout.
*/
void main(string[] args)
{
import std.stdio;
foreach (arg; args[1 .. $])
writefln("%s: %s", arg, arg.length);
}
» ./main Welcome to JOSA TechTalks
Welcome: 7
to: 2
JOSA: 4
TechTalks: 9
8. QUICK LOOK AT DSYNTAX - BASIC TYPES,
ARRAYS AND ASSOCIATIVE ARRAYS
// logical data type:
bool
// integral data types:
byte, short, int, long, cent
ubyte, ushort, uint, ulong, ucent
// floating data types:
float, double, real
// character data types
char, wchar, dchar
// defining arrays:
int[] nums = [1, 2, 3, 4];
// accessing arrays:
int sum = nums[0] + nums[$ 1];
// slicing arrays:
int[] slice = nums[0 .. $ / 2];
// defining an associative array:
int[string] wordCount;
// setting a value:
wordCount["hello"] = 1;
// check if key exists:
bool exists = "hello" in wordCount;
// reading a value:
int count = wordCount["hello"];
// reading a value with a default:
int count = wordCount.get("hello", 0);
9. QUICK LOOK AT DSYNTAX - TYPE INFERENCE
// without type inference
int num = 0;
string str = "D rocks!";
DateTime time = DateTime(2015, 9, 16);
// with automatic type inference
auto num = 0;
auto str = "D rocks!";
auto time = DateTime(2015, 9, 16);
10. QUICK LOOK AT DSYNTAX - LAMBDAS
// function declaration
int square(int x)
{
return x * x;
}
// in lambda form
auto summation = (int x, int y) => x + y;
auto multiplication = (int x, int y) => x * y;
auto subtraction = (int x, int y) => x y;
// usage like a normal function
auto result = summation(5, 10);
11. QUICK LOOK AT DSYNTAX - UNIFORM FUNCTION
CALL SYNTAX
auto withLastName(string firstName, string lastName) {
return firstName ~ " " ~ lastName;
}
// can be used as:
auto fullName = "Yazan".withLastName("Dabain");
import std.datetime;
auto duration = 5.days + 12.hours;
// vs
auto duration = days(5) + hours(12);
12. QUICK LOOK AT DSYNTAX
// Example:
// find all words which are 4 letters or more
// ps. no need to be picky about punctuation
import std.algorithm;
auto quote = "I would love to change the world, "
"but they won't give me the source code.";
// without UFCS
auto result = filter!(word => word.length >= 4)(splitter(quote));
// with UFCS
auto result = quote.splitter().filter!(word => word.length >= 4)();
16. CODE DUPLICATION AND VERBOSITY
int add(int a, int b)
{
return a + b;
}
float add(float a, float b)
{
return a + b;
}
// what we want is something similar to:
Type add(Type a, Type b)
{
return a + b;
}
28. COMPILE TIME FUNCTION EVALUATION (CTFE)
“Compile-time function evaluation is the ability of a compiler, that would
normally compile a function to machine code and execute it at run time, to
execute the function at compile time.”
29. COMPILE TIME FUNCTION EVALUATION (CTFE)
auto fromRoman(string roman) {
auto flat = roman
.replace("IV", "IIII")
.replace("IX", "VIIII")
.replace("XL", "XXXX")
.replace("XC", "LXXXX");
auto value =
flat.count('I')
+ flat.count('V') * 5
+ flat.count('X') * 10
+ flat.count('L') * 50
+ flat.count('C') * 100;
return value;
}
struct Roman {
enum opDispatch(string name)
= fromRoman(name);
}
void main()
{
writeln(Roman.XV);
writeln(Roman.IIX);
writeln(Roman.VXCII);
}
0000000000432708 <_Dmain>:
push %rbp
mov %rsp,%rbp
mov $0xf,%edi
callq 4334a0 <std.stdio.writeln>
mov $0xa,%edi
callq 4334a0 <std.stdio.writeln>
mov $0x61,%edi
callq 4334a0 <std.stdio.writeln>
xor %eax,%eax
pop %rbp
retq
xchg %ax,%ax
30. REFLECTION
“Reflection is the ability of a computer program to examine and modify its own
structure and behavior (specifically the values, meta-data, properties and
functions).”
31. COMPILE-TIME REFLECTION IN D
struct Person {
int id;
string username;
DateTime birthdate;
}
// we can use the compiler to tell us
// what members Person struct contain
[__traits(allMembers, Person)].writeln();
// prints ["id", "username", "birthdate"]
// or if Person has some specific member
if (__traits(hasMember, Person, "fname"))
writeln("Yes, Person has a firstname");
void create(string title, float price) {
…
}
// we can also retrieve function parameter
// names, default values, ...
assert(
[ParameterIdentifierTuple!create] ==
["title", "price"]
);
32. COMPILE-TIME REFLECTION AND CODE
GENERATION
auto smaller(T)(T a, T b) {
foreach (member; __traits(allMembers, T)) {
if (__traits(getMember, a, member) < __traits(getMember, b, member))
return true;
else if (__traits(getMember, a, member) > __traits(getMember, b, member))
return false;
}
return false; // equal
}
struct Person {
string username;
DateTime birthdate;
}
auto one = Person("joe", DateTime(1990, 1, 1));
auto two = Person("john", DateTime(1980, 1, 1));
writeln(smaller(one, two));
33. POWERFUL COMBINATION OF FEATURES
import pegged.grammar;
/// Numbers
mixin(grammar(`
Number:
Scientific <~ Floating ( ('e' / 'E' ) Integer )?
Floating <~ Integer ('.' Unsigned )?
Unsigned <~ [09]+
Integer <~ Sign? Unsigned
Hexa <~ [09afAF]+
Sign < '' / '+'
`));
auto tree = Number("25.12e+21");
// use the parse tree
34. POWERFUL COMBINATION OF FEATURES
import vibe.data.json;
struct Foo {
int number;
string str;
}
auto f = Foo(12, "hello");
string json = serializeToJsonString(f);
assert(json == `{"number":12,"str":"hello"}`);
f = deserializeJson!Foo(`{"number": 42, "str": "the answer"}`);
assert(f.number == 42);
assert(f.str == "the answer");
39. REST INTERFACE - SERVER
class WeatherProvider : WeatherAPI {
private string m_location;
Weather getWeather() { return Weather("sunny", 25); }
@property void location(string location) { m_location = location; }
@property string location() { return m_location; }
}
shared static this() {
auto router = new URLRouter();
router.registerRestInterface(new WeatherProvider());
auto settings = new HTTPServerSettings;
settings.port = 8080;
listenHTTP(settings, router);
}
40. REST INTERFACE - REMOTE CLIENT
auto client = new RestInterfaceClient!WeatherAPI("http://127.0.0.1:8080/");
auto weather = client.getWeather();
logInfo("Weather: %s, %s °C", weather.status, weather.temperature);
client.location = "Paris";
logInfo("Location: %s", client.location);
41. REST INTERFACE - JS CLIENT
shared static this() {
auto restSettings = new RestInterfaceSettings();
restSettings.baseURL = URL("http://127.0.0.1:8080/");
auto router = new URLRouter();
router.registerRestInterface(new WeatherProvider(), restSettings);
router.get("/weather.js", serveRestJSClient!WeatherAPI(restSettings));
auto settings = new HTTPServerSettings;
settings.port = 8080;
listenHTTP(settings, router);
}
<! in javascript >
<script src="weather.js"></script>
var weather = WeatherAPI.getWeather();
console.log(weather.status);
console.log(weather.temperature);
42. LINKS AND RESOURCES
D Programming Language dlang.org
D forums forum.dlang.org
Programming in D - Ali Çehreli ddili.org/ders/d.en/
TDPL - Andrei Alexanderscu
D Templates - Philippe Sigaud github.com/PhilippeSigaud/D-templates-tutorial
Rosetta Code (various tasks solved in D) rosettacode.org/wiki/Category:D
IRC channel #d on freenode.org
Dub package manager code.dlang.org