georgik.rocks @jurajmichalek c language › pb071 › lectures › lecture-12-c-lang...windows, mac...

78
C language in our world 6.5. 2019 FI MUNI Brno @jurajmichalek https://georgik.rocks https://www.ysofters.com

Upload: others

Post on 07-Jul-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source

C language in our world

6.5. 2019 FI MUNIBrno

@jurajmichalekhttps://georgik.rocks

https://www.ysofters.com

Page 2: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source

Grab the source code

https://github.com/ysoftdevs/cpp-examples

Page 3: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source

Who am I?

Blog: https://georgik.rocks

YSofters Blog: https://www.ysofters.com

Page 4: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source

C language todayDocker

Console: Minunit, Check, CurlUI: Allegro5, SDL2, GTK3, QT

Server: CUPSGradle

IDEs, NuGet, IoTJenkins, Bamboo, TeamCity

Node, Go language2xFI MUNI theses

Page 5: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source

Technologies influencing each other

Page 6: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source

Programming languages we know strongly influence the way we think about programming.

- JS Conf 2014 - Jenna Zeigen

Page 7: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source

Breeze of fresh ideas starts blowingfrom other technologies...

Page 8: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source

Containers- Linux based, Windows based- hub.docker.com

Page 9: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source
Page 10: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source

Allegro

Page 11: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source
Page 12: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source

Allegro 5

Win, Lin, Mac

iOS, Android

http://alleg.sourceforge.net/a5docs/refman/

Page 13: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source

Initialization

al_init();

Page 14: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source

Graphic environment

al_create_display(int w, int h)

Page 15: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source

MobaXTermhttps://mobaxterm.mobatek.net/

Page 16: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source

Conemu Maximus 5

Powerful terminal for Windowsuse with PowerShell, Python, Ruby…

https://code.google.com/p/conemu-maximus5/

Page 17: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source

Yum/Apt-like installation of Win packageshttps://chocolatey.org

Page 18: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source
Page 19: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source

Made with SDL

Page 20: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source

Made with SDL

Page 21: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source

NuGet - http://www.nuget.org

Page 22: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source
Page 23: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source
Page 24: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source

Multiplatform

SDL officially supports Windows, Mac OS X, Linux, iOS, and Android.

Support for other platforms may be found in the source code.

Page 25: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source

SDL versions

1.2 stable - rock solid

2.x development - new features

Page 26: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source

SDL_init(flags)

SDL_INIT_TIMER - The timer subsystemSDL_INIT_AUDIO - The audio subsystemSDL_INIT_VIDEO - The video subsystemSDL_INIT_CDROM - The cdrom subsystemSDL_INIT_JOYSTICK - The joystick subsystemSDL_INIT_EVERYTHING - All of the aboveSDL_INIT_NOPARACHUTE - Prevents SDL from catching fatal signalsSDL_INIT_EVENTTHREAD - Runs the event manager in a separate thread

Page 27: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source

Quit application

SDL_quit()

Page 28: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source

Window

SDL_CreateWindow("Hello World!", 100, 100, 640, 480, SDL_WINDOW_SHOWN);

Page 29: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source

Load bitmap

SDL_Surface *bmp = nullptr;bmp = SDL_LoadBMP("smajlik.bmp");

Page 30: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source

Visual data

SDL_RendererSDL_Texture

Page 31: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source

Keyboard

SDL_PollEvent(SDL_Event *event)

event.key.keysym.sym

Page 32: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source

Timer

SDL_TimerID SDL_AddTimer( Uint32 interval, SDL_TimerCallback callback, void* param)

Page 33: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source

Mouse

SDL_GetMouseState(*x, *y);

Page 34: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source

Text

Not implemented

Page 35: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source

Extensions

extension for many languages:

C++, Java, PHP, Python, Ruby

Page 36: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source

PyGame

Power of C and Power of Pythonhttp://www.pygame.org

Page 37: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source

Kivy.org

iOSAndroidWindows DesktopWindows PhoneRaspberry Pi

Cross-platform development of smartphone application with the Kivy framework - Master thesis - Mgr. Ondřej Chrastina: http://is.muni.cz/th/430596/fi_m/

Page 38: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source

Gradle Native BuildsC/C++, Objective-C

http://gradle.org/getting-started-native/

Page 39: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source

Build tool

Exensible by plugins

Power of Domain Specific Language

Page 40: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source

http://plugins.gradle.org

Page 41: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source

Project structure

Convention over configuration

Decrease number of decisions that developers need to makehttp://en.wikipedia.org/wiki/Convention_over_configuration

Page 42: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source

C plugin

Page 43: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source

Gradle command line & GUI

Page 44: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source

gradle components

Page 45: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source

Gradle build Linux package

Netflix Nebula OS Package plugin:http://plugins.gradle.org/plugin/nebula.os-package

Page 46: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source
Page 47: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source

Build package

Note: Gradle supports abbreviation. You can write hE instead of helloExecutable

Page 48: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source

SDL2 and Android

Android Studio + NDK + Gradlehttps://github.com/georgik/sdl2-android-examplehttps://georgik.rocks/tag/sdl2/

Page 49: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source

GTKhttps://www.gtk.org/

Page 50: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source

YSoft + CUPS + QT

Thesis: Dávid Kaya - Linux client for YSoft SafeQhttps://is.muni.cz/th/409878/fi_b/

Page 51: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source

CUPShttps://github.com/apple/cups

Server, backend, filter

Page 52: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source

IDE & Text editors

Page 53: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source

A hackable text editorfor the 21st Century

https://atom.io/

Page 54: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source

Sublime Text

Page 55: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source

Visual Studio Code

Code editing. Redefined. - https://code.visualstudio.com/

Page 56: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source
Page 57: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source

Toolchain detection

Page 58: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source

Edit project

Page 59: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source

Leverage Refactor

Page 60: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source

Use Debugger

Page 61: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source

Fine tune

Disabled by default for all JetBrains tools :-(

Page 62: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source

C in embedded and IoT world

Page 63: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source

Arduino + Platform IO

http://platformio.org/

Page 64: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source

LampESP example

https://github.com/georgik/LampESP- OTA- WifiManager- Web Server- MQTT Client (works also with Bluemix)- TaskScheduler (async style)More info: http://georgik.rocks/category/iot/

Page 65: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source

https://nodered.org/

Page 66: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source

Monkey C

Garmin Connect IQ- https://developer.garmin.com/connect-iq

Page 67: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source

Iot-inc - podcast

http://www.iot-inc.com/category/mediatype/podcasts/

Page 68: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source

Continuous integration

Page 69: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source

Jenkins

Hit for Windows users: Do not install Jenkins into path with special characters and blank space.E.g: Wrong: C:\Program Files (x86)\Jenkins. Correct: Use C:\projects\jenkins

Page 70: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source

From desktop to cloud

Software is slowSoftware is hard to writeSoftware is hard to scale

Page 71: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source

Go

http://golang.org

Authors:● Ken Thompson - known for Unix● Rob Pike - known for UTF-8● Robert Griesemer

Page 72: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source

Main features of languagesyntax patterns from dynamic languagesperformance of Cblazing fast compilationoutput one binaryconcurrencylibraries from internet (e.g. Github)works on: Mac, Linux, Windows and more...

Page 73: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source

Materials

Andreas Krennmairhttp://synflood.at/tmp/golang-slides/mrmcd2012.html#1

Steve Franciahttp://spf13.com/presentation/first-go-app/

Page 74: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source

Thanks to artistsimages used in this presentation were published under creative commons license. Links to originals:

http://www.flickr.com/photos/fatboyke/3405148748/ http://www.flickr.com/photos/teveve/6301993588/ http://www.flickr.com/photos/stevewilhelm/6242822362/ http://en.wikipedia.org/wiki/Chess http://www.flickr.com/photos/akosma/9486807123/ http://www.flickr.com/photos/charlestilford/6362884553/ http://www.flickr.com/photos/ciat/6917871707/ http://www.flickr.com/photos/anieto2k/4455227465/ http://www.geograph.ie/photo/1113036 http://commons.wikimedia.org/wiki/File:Dark_Sky_(3274525313).jpg http://www.elfwood.com/~arknott/Red-Dragon.2539297.html http://commons.wikimedia.org/wiki/File:Wolf-River-swamp-North-Mississippi.jpg http://pako0007.deviantart.com/art/Zombie-Imp-2-267822507 http://www.flickr.com/photos/bogenfreund/367091428/ http://www.flickr.com/photos/infinite-magic/4016608841/ http://www.flickr.com/photos/lennysan/4403695597/ http://www.flickr.com/photos/avaverino/4870587458/

Page 75: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source

L10N - verify your translations

http://www.microsoft.com/Language

Page 76: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source

Swiss knife tool for web https://curl.haxx.se/

Generate source code:curl http://www.ysoft.com -o index.html --libcurl download.c

Page 77: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source

The future is already here — it's just not very evenly distributed.

Page 78: georgik.rocks @jurajmichalek C language › pb071 › lectures › lecture-12-c-lang...Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source

YSofters

Twitter: @ysoftdevsGitHub: github.com/ysoftdevs

Blog: www.ysofters.comThesis: [email protected]