C Programming Training in Ambala ! Batra Computer Centrejatin batra
Batra Computer Centre is An ISO certified 9001:2008 training Centre in Ambala.
We Provide C Programming Training in Ambala. BATRA COMPUTER CENTRE provides best training in C, C++, S.E.O, Web Designing, Web Development and So many other courses are available.
Bartosz Milewski, “Re-discovering Monads in C++”Platonov Sergey
Once you know what a monad is, you start seeing them everywhere. The std::future library of C++11 was an example of an incomplete design, which stopped short of recognizing the monadic nature of futures. This is now being remedied in C++17, and there are new library additions, like std::expected and the range library, that are much more monad-conscious. I’ll explain what a monad is using copious C++ examples.
C Programming Training in Ambala ! Batra Computer Centrejatin batra
Batra Computer Centre is An ISO certified 9001:2008 training Centre in Ambala.
We Provide C Programming Training in Ambala. BATRA COMPUTER CENTRE provides best training in C, C++, S.E.O, Web Designing, Web Development and So many other courses are available.
Bartosz Milewski, “Re-discovering Monads in C++”Platonov Sergey
Once you know what a monad is, you start seeing them everywhere. The std::future library of C++11 was an example of an incomplete design, which stopped short of recognizing the monadic nature of futures. This is now being remedied in C++17, and there are new library additions, like std::expected and the range library, that are much more monad-conscious. I’ll explain what a monad is using copious C++ examples.
Rainer Grimm, “Functional Programming in C++11”Platonov Sergey
C++ это мультипарадигменный язык, поэтому программист сам может выбирать и совмещать структурный, объектно-ориентированный, обобщенный и функциональный подходы. Функциональный аспект C++ особенно расширился стандартом C++11: лямбда-функции, variadic templates, std::function, std::bind. (язык доклада: английский).
Evgeniy Muralev, Mark Vince, Working with the compiler, not against itSergey Platonov
The talk will look at limitations of compilers when creating fast code and how to make more effective use of both the underlying micro-architecture of modern CPU's and how algorithmic optimizations may have surprising effects on the generated code. We shall discuss several specific CPU architecture features and their pros and cons in relation to creating fast C++ code. We then expand with several algorithmic techniques, not usually well-documented, for making faster, compiler friendly, C++.
Note that we shall not discuss caching and related issues here as they are well documented elsewhere.
Антон Бикинеев, Writing good std::future< C++ >Sergey Platonov
В докладе Антон расскажет о грядущих мажорных изменениях языка, которые, не войдя в Стандарт 17-го года и оставшись в Technical Specifications, будут ждать своего мержа в 20-м, а также быть уже реализованными в некоторых компиляторах. Осветятся также минорные, уже одобренные фичи следующего Стандарта, как языковые, так и библиотечные. Антон расскажет об их целях, покажет методы использования, а также осветит некоторые гайдлайны и трики.
Не так давно Гор Нишанов представил свой доклад: C++ Coroutines a negative overhead abstraction. В этом докладе Гор упомянул, что предложенный дизайн корутин позволяет их использовать практически в любых окружениях, в том числе и с "бедным" C++ рантаймом.
Я решил попробовать запустить корутины в следующих окружениях: обычное приложение, драйвер ОС Windows, EFI приложение. Только в одном из этих окружений есть полноценный C++ рантайм и поддержка исключений, в остальных ничего этого нет. Более того, EFI приложение вообще выполняется до старта ОС.
Я хочу рассказать о том, как мне удалось запустить корутины в этих окружениях, поговорим о том, какие проблемы существуют в асинхронном системном программировании и как их можно обойти.
While porting 32-bit software to 64-bit systems there may appear some errors in the code of applications which were written in C++ language. The cause for these hides in the alteration of the base data types (to be more exact, in the relations between them) with the new hardware platform.
http://techtalks.nsu.ru
Видеозапись: https://www.youtube.com/watch?v=1AW9aus1mTE
3 ноября 2015. Алексей Жидков (Excelsior) рассказывает про Kotlin
«Kotlin — это относительно молодой JVM-based язык, поддерживающий в том числе компиляцию в Javascript. В этом докладе мы расскажем о том, зачем создавался Kotlin, покажем наиболее интересные его фичи путем решения небольшой, но реальной практической задачи, а также дадим простой рецепт, который позволит определить, нужен ли вам Kotlin или нет.
К слову, Kotlin был создан в России. Часто ли вы пишете на языках отечественного производства?»
Лекция прочитана в рамках проекта Tech Talks @NSU – серии открытых лекций о разработке ПО и карьере в IT, проводимых в Новосибирском государственном университете.
Подробности: http://techtalks.nsu.ru
Rainer Grimm, “Functional Programming in C++11”Platonov Sergey
C++ это мультипарадигменный язык, поэтому программист сам может выбирать и совмещать структурный, объектно-ориентированный, обобщенный и функциональный подходы. Функциональный аспект C++ особенно расширился стандартом C++11: лямбда-функции, variadic templates, std::function, std::bind. (язык доклада: английский).
Evgeniy Muralev, Mark Vince, Working with the compiler, not against itSergey Platonov
The talk will look at limitations of compilers when creating fast code and how to make more effective use of both the underlying micro-architecture of modern CPU's and how algorithmic optimizations may have surprising effects on the generated code. We shall discuss several specific CPU architecture features and their pros and cons in relation to creating fast C++ code. We then expand with several algorithmic techniques, not usually well-documented, for making faster, compiler friendly, C++.
Note that we shall not discuss caching and related issues here as they are well documented elsewhere.
Антон Бикинеев, Writing good std::future< C++ >Sergey Platonov
В докладе Антон расскажет о грядущих мажорных изменениях языка, которые, не войдя в Стандарт 17-го года и оставшись в Technical Specifications, будут ждать своего мержа в 20-м, а также быть уже реализованными в некоторых компиляторах. Осветятся также минорные, уже одобренные фичи следующего Стандарта, как языковые, так и библиотечные. Антон расскажет об их целях, покажет методы использования, а также осветит некоторые гайдлайны и трики.
Не так давно Гор Нишанов представил свой доклад: C++ Coroutines a negative overhead abstraction. В этом докладе Гор упомянул, что предложенный дизайн корутин позволяет их использовать практически в любых окружениях, в том числе и с "бедным" C++ рантаймом.
Я решил попробовать запустить корутины в следующих окружениях: обычное приложение, драйвер ОС Windows, EFI приложение. Только в одном из этих окружений есть полноценный C++ рантайм и поддержка исключений, в остальных ничего этого нет. Более того, EFI приложение вообще выполняется до старта ОС.
Я хочу рассказать о том, как мне удалось запустить корутины в этих окружениях, поговорим о том, какие проблемы существуют в асинхронном системном программировании и как их можно обойти.
While porting 32-bit software to 64-bit systems there may appear some errors in the code of applications which were written in C++ language. The cause for these hides in the alteration of the base data types (to be more exact, in the relations between them) with the new hardware platform.
http://techtalks.nsu.ru
Видеозапись: https://www.youtube.com/watch?v=1AW9aus1mTE
3 ноября 2015. Алексей Жидков (Excelsior) рассказывает про Kotlin
«Kotlin — это относительно молодой JVM-based язык, поддерживающий в том числе компиляцию в Javascript. В этом докладе мы расскажем о том, зачем создавался Kotlin, покажем наиболее интересные его фичи путем решения небольшой, но реальной практической задачи, а также дадим простой рецепт, который позволит определить, нужен ли вам Kotlin или нет.
К слову, Kotlin был создан в России. Часто ли вы пишете на языках отечественного производства?»
Лекция прочитана в рамках проекта Tech Talks @NSU – серии открытых лекций о разработке ПО и карьере в IT, проводимых в Новосибирском государственном университете.
Подробности: http://techtalks.nsu.ru
Infinum Android Talks #20 - Benefits of using KotlinInfinum
After this talk, using plain old Java for Android development will no longer be good enough for you. You have been warned. Presented by Dino Kovač from Infinum.
If you still haven't heard of it, there is a new star in JVM sky - Kotlin. This short presentation will serve as intro for those who wan't to hear what's all the fuss about and dive deeper into this new alternative to Java
Kotlin advanced - language reference for android developersBartosz Kosarzycki
StxNext Lightning Talks - Mar 11, 2016
Kotlin Advanced - language reference for Android developers
This presentation contains the second talk on Kotlin language we had at STXNext. We try go deeper into language specifics and look at the positive impact new syntax can have on boilerplate removal and readability improvement.
Kotlin really shines in Android development when one looks at “Enum translation”, “Extension functions”, “SAM conversions”, “Infix notation”, “Closures” and “Fluent interfaces” applied to lists. The talk, however, compares language-specifics of Java & Kotlin in terms of “Type Variance”, “Generics” and “IDE tools” as well.
We present real-world example based on Stx-Insider project written in Kotlin which incorporates Dagger 2, Kotterknife, Retrofit2 and is composed of 5+ Activities.
Full agenda
Live templates
Enum translation
Calling extension functions from Kotlin/Java
Constructors with backing fields
Warnings
F-bound polymorphism
Variance (Covariance/Contravariance)
Variance comparison in Kotlin/Java/Scala
Annotation processing - KAPT
SAM conversions
Type equality
Lambda vs Closure
Reified generics
Fluent interfaces
Infix notation
Static extension methods in Kotlin
Generic types
Sealed classes
Dokka - documentation in Kotlin
J2K converter
Real-world example
Reflection
Presentation is accompanied with an example project (StxInsider):
https://github.com/kosiara/stx-insider
While the Java platform has gained notoriety in the last 15 years as a robust application platform with a thriving ecosystem and well-established practices, the Java language has had its share of criticism. Highly verbose, overly didactic, limited feature set; whichever flavor of criticism you prefer, it's patently obvious that Java is playing catch up to more modern languages with a less rigid evolution path.
The language landscape today is vastly different than it had been five or ten years ago; a wide array of languages are available, designed to suit a variety of flavors: Groovy, Clojure, Scala, Gosu, Kotlin... which should you choose? This lecture focuses on one company's decision to focus on Scala, and presents a case study based on our experiences using Scala in practice, in the hope of providing much-needed real world context to assist your decision.
This presentation was used for the Scala In Practice lecture at the Botzia Israeli Java User Group meeting, May 3rd 2012.
(video of these slides available here http://fsharpforfunandprofit.com/fppatterns/)
In object-oriented development, we are all familiar with design patterns such as the Strategy pattern and Decorator pattern, and design principles such as SOLID.
The functional programming community has design patterns and principles as well.
This talk will provide an overview of some of these, and present some demonstrations of FP design in practice.
Rust: код может быть одновременно безопасным и быстрым, Степан КольцовYandex
Последние 15 лет между разработчиками на Java и на C++ ведётся спор о том, какой язык программирования хуже — Java или C++. Программы на C++ глючат, падают, и в них утекает память. Программы на Java тормозят и требуют слишком много памяти.
Rust — новый язык программирования, разрабатываемый компанией Mozilla — решает проблемы Java и C++: программы, написанные на Rust, одновременно быстрые и безопасные. Rust является таким же низкоуровневым, close-to-metal языком программирования, как и C++, однако в язык встроены конструкции, позволяющие на этапе компиляции доказывать, что в программе не случится обращения к неинициализированной памяти (механизм borrowed pointers). Большая часть моего рассказа будет посвящена описанию этого механизма.
Rust — это современный, практический, быстрый и безопасный язык программирования. Некоторые говорят, что Rust — это как C++, если бы его писал человек, знающий Haskell.
Система типов Rust решает главную проблему C++ — небезопасность. C++ очень легко сделать ошибки, которые приведут к поломкам (например, use after free). Rust позволяет писать безопасный код, сохраняя при этом выразительность и околонулевые накладные расходы C++. В докладе будут подробно описаны механизмы языка, которые контролируют безопасность программы.
Хотя в данный момент Rust ещё не подходит для использования в продакшне, его всё равно стоит изучать. Во-первых, потому что это очень интересный подход к программированию, а во-вторых, потому что через несколько лет для разработки требовательных к ресурсам программ будет необходим именно Rust или другой похожий инструмент.
Highlighted notes of:
Introduction to CUDA C: NVIDIA
Author: Blaise Barney
From: GPU Clusters, Lawrence Livermore National Laboratory
https://computing.llnl.gov/tutorials/linux_clusters/gpu/NVIDIA.Introduction_to_CUDA_C.1.pdf
Blaise Barney is a research scientist at Lawrence Livermore National Laboratory.
JVM Mechanics: When Does the JVM JIT & Deoptimize?Doug Hawkins
HotSpot promises to do the "right" thing for us by identifying our hot code and compiling "just-in-time", but how does HotSpot make those decisions?
This presentation aims to detail how HotSpot makes those decisions and how it corrects its mistakes through a series of demos that you run yourself.
Azul Virtual Machine Engineer Douglas Hawkins describes how decisions made by the JVM affect how your code is compiled and run. Learn how this affects application performance and what steps you can take to optimize how the JVM acts on your code.
After reimplement many features several times in different platforms is time to think that it should be a better way. There are many frameworks that allows the developers to write the code once and deploy it "everywhere", but the final result is an app with a non native look and feel or with an emulated look and feel that the users can see and rate according to the quality.
There are other ways to develop apps for multiple platforms without rewriting the same code over and over. I'll talk about one of that ways which consists on developing the core with C++ and implement the UI natively. This method could sound very scary because of the C++ reputation (memory leaks, the standard library, etc), but with C++11 all this has been improved in a very sweet way, so maybe it is time to take an other look at this language and see how can we take advantage of it.
Have you ever heard of FreeBSD? Probably.
Have you ever interacted with its kernel? Probably not.
In this talk, Gili Yankovitch (nyxsecuritysolutions.com) will talk about the FreeBSD operating system, its network stack and how to write network drivers for it.
The talk will cover the following topics:
* Kernel/User interation in FreeBSD
* The FreeBSD Network Stack
* Network Buffers API
* L2 and L3 Hooking
1. [2/2] Find scary C++ bugs
before they find you
Konstantin Serebryany, Google
May 2014 @compsciclub.ru
[1/2] Fantastic C++ Bugs
and Where to Find Them
2. Agenda
● How bad the bugs are?
● Most common C++ bugs
○ Memory access bugs
○ Threading bugs
○ Other undefined behavior bugs
● Quiz
● Lecture 2/2: tools that find bugs
3. Why bugs are scary
● Increased development cost
● Increased CPU/RAM consumption
● Decreased user satisfaction
● May cost money or even lives
● Security!
4. Undefined Behavior (UB)
● UB != undefined result
● UB: the program may misbehave depending
on compiler, hardware, system load, current
date, outside temperature, etc
● UB: the program may turn hostile to the host
system or launch nuclear missiles
6. Typical Address Space Layout
Stack
Heap
Globals
Constants (RO)
Code
NULL Page
Malloc Header
User Chunk
Malloc Header
User Chunk
...
Return Address
Local Variables
Return Address
Local Variables
...
Global Variable
Global Variable
...
7. Virtual Function Table (VPTR)
class Foo {
public:
virtual void f1();
virtual void f2();
private:
int data1;
int data2;
};
VPTR
data1
data2
f1
f2
8. Buffer overflow (global, heap, stack)
● Access invalid memory
○ SEGV (Good!!)
● Access some other object in memory
○ Read garbage or corrupt data
■ Subvert further execution
○ Leak private data or memory layout
○ Overwrite function pointers or VPTR
int ar[10];
… ar[i]…
9. Buffer overflow (stack)
int foo(int i) {
int ar[10];
… ar[i] …
● May access the return address and
call arbitrary code
10. Buffer overflow (stack)
void bad() {
std::cout << "I am BADn";
}
int main() {
long a, b, ar[10];
std::cin >> a >> b;
ar[a] = b;
}
11. Buffer overflow (heap)
int foo(int i) {
int *ar = new int [10];
… ar[i] ...
● Access malloc header
○ Crash later in new/delete
○ Deallocate wrong amount of memory
12. Buffer overflow (heap)
void good() {
cout << "I am goodn";
}
void bad() {
cout << "I am BADn";
}
typedef void (*F)(void);
struct Object {
Object(F f) : f_(f) {}
F f_;
};
int main() {
long a, b;
long *x = new long[1];
Object *o = new Object(good);
cin >> a >> b;
x[a] = b;
o->f_();
}
13. Erroneous type cast
struct Base { int data; };
struct Derived : Base { int more_data; };
Base b;
int main() {
Derived *d = (Derived*)&b;
d->more_data = 0; // OOPS
}
14. Use-after-free (heap)
● Even worse than heap-buffer-overflow
because touches arbitrary part of heap
int *x = new int[10];
delete [] x;
x[5] = 0;
15. Use-after-free: privilege escalation
struct Thing { bool has_access; };
int main() {
Thing *security_check = new Thing;
security_check->has_access = false;
delete security_check;
int *x = new int(42);
if (security_check->has_access) // OOPS
cout << "Access Grantedn";
}
16. Use-after-return (stack)
● Relatively rare, but
combines the worst of
heap-use-after-free and
stack-buffer-overflow
int *x;
void foo() {
int local;
x = &local;
}
*x = ...
18. Use-after-scope (stack)
int *p;
if (...) {
int a;
p = &a;
}
if (...) {
int b[100];
*p = … // oops
}
● Behavior depends on
compiler version, flags,
function size, etc
20. Memory leaks, other resource leaks
● Excessive memory consumption
● [D]DOS attacks
void foo() {
int *x = new int [10];
if (...) return;
delete [] x;
}
21. Use of uninitialized memory
● Reading garbage from
heap or stack
● Results change from
run-to run
● Values could be
controlled by attacker
void foo() {
int x[10];
if (x[5])
Something();
}
22. Use after destruction
struct Foo {
void set(string *s) {
s_ = s;
}
~Foo () {
cout << *s_ << endl;
}
string *s_;
};
struct Bar {
Foo foo;
string s;
};
int main() {
Bar b;
b.s = "hello world";
b.foo.set(&b.s);
}
26. Data Races
int var;
void Thread1()
{ var--; }
void Thread2()
{ var++; }
● Two accesses to the same
memory location
● At least one is a store
● No happens-before relation
(no explicit synchronization)
27. Race on a bitfield
struct Foo {
int a : 20;
int b : 12;
};
Foo foo;
void Thread1() {
foo.a++;
}
void Thread2() {
foo.b++;
}
28. Race During Destruction
std::set<int> s; // Global variable
void Thread() {
for (int i = 0; i < 1000000; i++)
s.insert(rand());
}
int main() { new std::thread(Thread); }
29. struct A {
virtual ...
};
struct B : public A {
virtual ...
};
B b;
● ‘A’ is constructed
○ VPTR = A::VPTR
● ‘B’ is constructed
○ VPTR = B::VPTR
● ‘B’ is destroyed
○ VPTR = B::VPTR
● ‘A’ is destroyed
○ VPTR = A::VPTR
VPTR: construction order
37. Init Order Fiasco
// in a.cc
int foo();
int X = foo();
// in b.cc
int Y = X;
int foo() {
return 42;
}
38. ODR (one definition rule) Violation
// in a.cc/a.so
int X;
// in b.cc/b.so
double X;
39. Lack of Sequence Point
int i = 0;
i = ++i + i++;
// What is i?
std::map<int> m;
m[10] = m.size();
// What is m[10]?
● Clang and GCC will
give different
answers (GOOD!)
40. Integer Overflow
Remember:
UB != undefined result
void f (int *array) {
int val = 0x03020100;
for(int i = 0; i < 64; i++) {
array[i] = val;
// Overflow when i==63
val += 0x04040404;
}
}
41. Some more...
● Shift by oversized or negative value
● Missing return statement
● Infinite loops
● ...
42. Quiz: find all bugs
#include <thread> // C++11
int main() {
int *a = new int[4];
int *b = new int[4];
std::thread t{[&](){b++;}};
delete a;
t.detach();
return *a + (*++b) + b[3];
}