These slides illustrate 20 different examples on using Domain-Specific Modeling: Models are expressed using directly the concepts of the problem domain and generate the code for a given target/programming language.
These slides illustrate 20 different examples on using Domain-Specific Modeling: Models are expressed using directly the concepts of the problem domain and generate the code for a given target/programming language.
Internal DSLs For Automated Functional TestingJohn Sonmez
Automated functional testing is one of the hardest things to get right on a project. Many people with high hopes set out to develop fully automated regression tests, only to be caught up in the tangle of fragile tests which are always broken. In this session I will present a clean way to build a framework using free tools to develop an internal Domain Specific Language custom to the application being testing. I will show the benefits of this approach versus the record and modify methods of most automated testing tools. In addition, I will talk about a real working practical example I have developed for the Dept of Health in Welfare in testing their new case management system.
Session presented at the 6th IndicThreads.com Conference on Java held in Pune, India on 2-3 Dec. 2011.
http://Java.IndicThreads.com
---
My talk would describe how to build DSL’s using Scala, what features in Scala help make it a great option for building DSL’s and some examples of DSL’s built in Scala.
http://www.indicthreads.com/9254/using-scala-for-building-dsls/
A talk given at ScalaUA 2016 in Kiev, Ukraine.
Scala combines a powerful type system with a lean but flexible syntax. This combination enables incredible flexibility in library design, most particularly in designing internal DSLs for many common scenarios: specification definition and matching in Specs² and ScalaTest, request routing in Spray and query construction in Squeryl, just to name a few. The budding DSL designer, however, will quickly realize that there are precious few resources on how to best approach the problem in Scala; the various techniques, limitations and workarounds are not generally well understood or documented, and every developer ends up running into the same challenges and dead-ends. In this talk I'll attempt to summarize what I've learned from reading, extending and designing Scala DSLs in the hopes that it'll save future Scala library designers a whole lot of pain.
How Spark is Making an Impact at Goldman Sachs by Vincent SaulysSpark Summit
In this keynote, Vincent Saulys will discuss how Spark was brought into Goldman, the impact its making today (lessons learned along the way), and where they expect to apply Spark in the future
Python is a high level language focused on readability. The Python community developed the concept of "Pythonic Code", requiring not only semantic correctness, but also conformity to universally acknowledged stylistic criteria.
A pre-requisite to write pythonic code is to write idiomatic code. Using the right idioms is a matter of acquired taste and experience, however, some idioms are quite easy to learn.
This presentation focuses on some of these idioms and other stylistic criteria:
* for vs. while
* iterators, itertools
* code conventions (space invaders)
* avoid default values bugs
* first order functions
* internal/external iterators
* substituting the switch statement
* properties, attributes, read only objects
* named tuples
* duck typings
* bits of metaprogramming
* exception management: LBYL vs. EAFP
From Java to Parellel Clojure - Clojure South 2019Leonardo Borges
Java still ranks at the top of the TIOBE index. The JVM is a trusted platform which has stood the test of time and is used widely to develop complex, reliable and high performing systems. By choosing to target the JVM, Clojure can leverage all of its power while bringing new ways of writing reliable software into the mix. But why should a Java developer care?
In this talk we will examine the main differences between Java and Clojure, pointing out new patterns and tools and finally ending with a discussion of the concurrency and parallelism abstractions provided by Clojure.
By the end of this talk you will have developed an understanding of Clojure’s fundamental building blocks for writing concurrent applications.
We'll discuss our experiences with tooling aimed at finding and fixing performance problems in a production Rust application, as experienced through the eyes of somebody who's more familiar with the Go ecosystem but grew to love Rust. We'll cover CPU and Heap profiling, and also briefly touch causal profiling.
They are a block of code plus the bindings to the environment they came from (RagusaIdiom).
Closures are reusable blocks of code that capture the environment and can be passed around as method arguments for immediate or deferred execution.
[Session given at Engage 2019, Brussels, 15 May 2019]
In this session, Tim Davis (Technical Director at The Turtle Partnership Ltd) takes you through the new Domino Query Language (DQL), how it works, and how to use it in LotusScript, in Java, and in the new domino-db Node.js module. Introduced in Domino 10, DQL provides a simple, efficient and powerful search facility for accessing Domino documents. Originally only used in the domino-db Node.js module, with 10.0.1 DQL also became available to both LotusScript and Java. This presentation will provide code examples in all three languages, ensuring you will come away with a good understanding of DQL and how to use it in your projects.
Router is one of the most important feature or component in Web application framework,
ant it is also one of the performance bottlenecks of framework.
In this session, I'll show you how to make router much faster than ever.
Oktest - a new style testing library for Python -kwatch
Oktest is a new-style testing library for Python. It helps you to read & write tests very much. Oktest is available with (or without) standard 'unittest' module.
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf91mobiles
91mobiles recently conducted a Smart TV Buyer Insights Survey in which we asked over 3,000 respondents about the TV they own, aspects they look at on a new TV, and their TV buying preferences.
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.
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.
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.
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.
JMeter webinar - integration with InfluxDB and GrafanaRTTS
Watch this recorded webinar about real-time monitoring of application performance. See how to integrate Apache JMeter, the open-source leader in performance testing, with InfluxDB, the open-source time-series database, and Grafana, the open-source analytics and visualization application.
In this webinar, we will review the benefits of leveraging InfluxDB and Grafana when executing load tests and demonstrate how these tools are used to visualize performance metrics.
Length: 30 minutes
Session Overview
-------------------------------------------
During this webinar, we will cover the following topics while demonstrating the integrations of JMeter, InfluxDB and Grafana:
- What out-of-the-box solutions are available for real-time monitoring JMeter tests?
- What are the benefits of integrating InfluxDB and Grafana into the load testing stack?
- Which features are provided by Grafana?
- Demonstration of InfluxDB and Grafana using a practice web application
To view the webinar recording, go to:
https://www.rttsweb.com/jmeter-integration-webinar
Accelerate your Kubernetes clusters with Varnish CachingThijs Feryn
A presentation about the usage and availability of Varnish on Kubernetes. This talk explores the capabilities of Varnish caching and shows how to use the Varnish Helm chart to deploy it to Kubernetes.
This presentation was delivered at K8SUG Singapore. See https://feryn.eu/presentations/accelerate-your-kubernetes-clusters-with-varnish-caching-k8sug-singapore-28-2024 for more details.
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.
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
4. What is DSL (Domain Specific Language?)
DSL
Google Search
5. Internal DSL v.s. External DSL
•Internal DSL (内部DSL)
•Written inside an existing host language
既存の言語を使って、その言語の文法を使って書かれたDSL
•No need to implement parser
パーサを書く必要なし
•Some lang are not good at internal DSL
言語によっては苦手な場合がある
•External DSL (外部DSL) Python?
•Original, indendent syntax
独自の文法
•Need to implement parser
パーサを実装する必要あり
•All languages have same power about external DSL
言語による得手不得手は、ほぼない
7. What is 'with' statement?
•Enforces finishing ## Python 2.4
process f = open('file')
終了処理を強制する機能 try:
•ex: close opened file text = f.read()
certainly finally:
例:ファイルを必ず閉じる f.close()
## Python 2.5 or later
with open('file') as f:
text = f.read()
8. How to use 'with' statement in DSL?
•Appends pre-
Append pre-process
process and post- 前処理を追加
process around
}
block x=1
ブロックに前処理と後処理をくっ
y=2 code block
つける z=3
Append post-process
後処理を追加
9. Case Study: Change Directory (Kook)
## before ## after
chdir('build') with chdir('build'):
cp('../file', 'file') cp('../file', 'file')
system('cmd...') system('cmd...')
chdir('..')
10. Case Study: Start/Stop time (Benchmarker)
## before ## after
t1 = time.time() bm = Benchmarker()
for i in xrange(N): with bm('func'):
func() for i in xrange(N):
t2 = time.time() func()
print('func: %s'
% (t2-t1))
11. Case Study: Form Builder
## before
<form action="/" method="POST">
<input type="hidden" name="_csrf"
value="${request.csrf()}" />
<input type="text" ... />
<input type="submit" ... />
</form>
12. Case Study: Form Builder
## after
% with FormBuilder(request, "/") as fb:
<input type="text" ... />
<input type="submit" ... />
% endwith
13. Pitfall: Variable Scope
with test("arithmetic operation"):
with test("1+1 should be 1"):
x = 1+1
assert x == 2
with test("1-1 should be 0"):
x = 1-1 Identical variable because
assert x == 0 scope is not independented
スコープが独立してないので変数も共有される
14. Pitfall: Cannot Skip Block!
<div>
% with cache("key", 60*60*1):
<ul>
% for item in get_items():
<li>${item}</li>
% endfor You may want to skip block
</ul> when cache is not expired,
% endwith but Python doesn't allow it!
</div> キャッシュが生きている間はブロックを
スキップしたいんだけど、実はできない
16. What is 'for' statement?
•Iterates code block ## repeat 100 times
ブロックを繰り返す機能 for i in xrange(100):
•ex: repeat block for N print("i=%s" % i)
times
例:ブロックをN回実行 ## read lines from file
with open('file') as f:
•ex: read each line for line in f:
from opened file
print(line)
例:オープンしたファイルから
1行ずつ読み込む
17. How to use 'for' statement in DSL? #1
•Appends pre-
Append pre-process
process and post- 前処理を追加
process around
}
iteration block x=1
繰り返し用のブロックに
y=2 iteration block
前処理と後処理をくっつける z=3
Append post-process
後処理を追加
18. How to use 'for' statement in DSL? #1
•Appends pre-
def gfunc():
process and post-
process around
iteration block
....
.... }pre-process
繰り返し用のブロックに for i in xrange(n):
} exec block
前処理と後処理をくっつける
yield
....
.... } post-process
19. Case Study: Start/Stop time (Benchmarker)
## before ## after
t1 = time.time() bm = Benchmarker(
for i in xrange(N): repeat=N)
func1() for _ in bm('func'):
t2 = time.time() func1()
print('func: %s'
% (t2-t1))
20. How to use 'for' statement in DSL? #2
•Iterate code block
def gfunc():
only once
ブロックを1回だけ繰り返す
....
.... } pre-process
yield } exec block
(only once!)
•Emulates 'with' stmt ....
by 'for' stmt .... } post-process
with文をfor文でエミュレート
21. Case Study: Change Directory (Kook)
## before ## after
chdir('tmp') for _ in chdir('tmp'):
cp('../file', 'file') cp('../file', 'file')
system('cmd...') system('cmd...')
chdir('..')
Use 'for' as alternative
of 'with' in Python 2.4
Python2.4では 'with' が使えない
ので、代わりとして 'for' を使う
22. How to use 'for' statement in DSL? #3
•Iterate block in 0 or
def gfunc():
1 time
ブロックを0回または1回だけ
繰り返す
....
.... }pre-process
if condition:
}
•Emulates 'if' stmt by
'for' stmt to skip yield exec block
block according to ....
condition
if文をfor文でエミュレートし、条
.... } post-process
件によってブロックをスキップ
23. Case Study: Fragment Cache (Tenjin)
<div>
% for _ in cache("key", 60*60*1):
<ul>
% for item in get_items():
<li>${item}</li>
% endfor You can skip block when
</ul> cache is not expired! Wow!
% endfor with文と違い、キャッシュが生きている
</div> ときにブロックをスキップできる! ステキ!
24. Case Study: Java and JSP
<div>
<% for (int _: cache("key",60)) { %>
<ul>
<% for (Item item: getItems()) { %>
<li>${item}</li>
<% } %>
</ul>
<% } %>
</div>
26. What is Decorator?
•Higher-order function class Hello(object):
to manipulate
declaring function or @classmethod
class def fn(cls):
宣言中の関数やクラスを操作する print("Hello")
高階関数
•ex: @classmethod(), ## above is same as
@property() def fn(cls):
例:@classmethod(),
print("Hello")
@property fn = classmethod(fn)
27. How to use Decorator in DSL? #1
•Mark function with
def deco(func):
or without args
func._mark = True
関数に目印をつける
return func
def deco_with(arg):
def deco(func):
func._mark = arg
return func
deco
29. How to use Decorator in DSL? #2
•Syntax sugar to
def fn(arg):
pass function arg
print(arg)
引数として関数を渡すときの
シンタックスシュガー func(x, y, fn)
@func(x, y)
def fn(arg):
print(arg)
30. Case Study: Event Handler
## before ## after
def _(): @button.onclick
do() def _():
some() do()
thing() some()
button.onclick(_) thing()
More readable because
@onclick appears first
ブロックより先に@onclickが
きているのでより読みやすい
31. Case Study: Database Transaction
## before ## after
def _(): @transaction
do() def _():
some() do()
thing() some()
transaction(_) thing()
More readable because
@transaction appears first
ブロックより先に@transactionが
現れるので、より読みやすい
32. Case Study: unittest
## before ## after
def _(): @assertRaise2(Err)
do() def _():
some() do()
thing() some()
assertRaise(Err, _) thing()
More readable because
assertRailse() appears first
assertRaises2()のほうがブロックより
先に現れるので、より読みやすい
33. How to use Decorator in DSL? #3
•Alternative syntax of
with func(arg) as x:
with- or for-
....
statement
with文やfor文の代替
•Independent scope!
独立したスコープ!
@func(arg)
•Nested scope! def _(x):
入れ子になったスコープ! ....
34. Case Study: open()
## before ## after
with open('file', @open('file', 'w')
'w') as f: def _(f):
f.write("....") f.write("....")
35. How to use Decorator in DSL? #4
•Alternative syntax of
class Foo(object):
class definition
def meth1(self):
class定義の代替
....
•More natural
representation of
inheritance structure
@classdef
継承構造のより自然な表現
def _():
•More natural scope @methoddef
より自然なスコープ
def _():
....
36. Class Inheritance
class Parent(object):
....
class Child(Parent):
....
Inheritance structure
class Baby(Child): is not represented
.... visually
継承構造が視覚的には
表現されていない
37. Nested Class Definition
class Parent(object):
class Child(Parent):
Represents
class Baby(Child): inheritance structure
.... visually, but not
possible in Python!
こう書けば継承構造が視
覚的に表現できるけど、
Pythonではこう書けない!
38. Nested Structure by with-statement
with define('Parent'):
with define('Child'):
with define('Baby'): Represents structure
.... visually, but scopes
are not independent
構造は視覚的に表現でき
ているが、スコープが独
立していない (共有される)
39. Nested Structure with Decorator
@defclass
def Parent():
@defclass
def Child(): Represents structure
visually, and scopes
@defclass are not shared
def Baby(): 継承構造を視覚的に表現
できるし、スコープも共
.... 有されない (独立している)
40. Strange Scope Rule (for beginner) in Class Definition
1: class Outer(object):
2: VAR = 1
3:
4: class Inner(object):
5: # error
6: print(VAR) Why I can't access
7: # error, too to outer variable?
8: print(Outer.VAR) どうして外側の変数に
アクセスできないの?
41. Natural Scope Rule (for beginner) with Function
1: def outer():
2: VAR = 1
3:
4: def middle():
5: print(VAR) # OK More natual
6: scope rule
7: def inner(): (especially for beginner)
8: print(VAR) # OK より自然なスコープルール
(特に初心者にとっては)
49. Case Study: Modern O/R Mapper (SQLAlchemy)
Python SQL
==
x == 1 x=1
x 1
==
x == None x is null
x None
50. Case Study: Assertion (Oktest)
Assertion When Failed
## Python AssertionError:
assert x == y (no message)
## Nose AssertionError:
ok_(x == y) (no message)
## Oktest AssertionError:
ok (x) == y 1 == 2 : failed
Shows actual & expected values
失敗時に、実際値と期待値を表示してくれる
53. Case Study: String Interpolation (Kook)
http://www.kuwata-lab.com/kook/pykook-users-guide.html#cookbook-prod
CMD = 'rst2html -i utf-8'
@recipe('hello')
@ingreds('hello.c')
def compile(c):
prod, ingreds = c.product, c.ingreds
system(c%"$(CMD) $(ingreds[0]) > $(prod)")
Operator Indexing
override Both global and available
演算子オーバーライド local var available 添字も利用可能
グローバル変数とローカル
変数の両方が利用可能
54. Case Study: Method Chain Finishing Problem
AppointmentBuilder()
.From(1300)
.To(1400)
.For("Dental")
.done()
Method chain requires end of chain.
メソッドチェーンでは、チェーンの終わりを明示する必要がある
55. Case Study: Method Chain Finishing Problem
- AppointmentBuilder()
.From(1300)
.To(1400)
.For("Dental")
Unary operator works at end of chain!
単項演算子はチェーンの終わりに実行される!
Very similar to unordered list or bullet!
見た目が箇条書きそっくり!
57. Reflected operator
def __add__(self, other):
...
int.__add__ = __add__
1 + Foo() Not possible ;<
Pythonではできない
class Foo(object):
def __radd__(self, other):
... No problem :)
1 + Foo() 問題なし
58. Case Study: Should DSL
http://www.should-dsl.info/
def test1(self):
self.player |should| have(11).cards
def test2(self):
self.player.name |should|
equal_to('John Doe')
Instead of adding method to any object,
use bit operator which has low priority
ビットOR演算子の優先順位が低いことを利用して、任意のオブジェクトに
メソッドを追加できないというPythonの欠点を克服した、絶妙なDSL