office basic source code management - fosdem · pokémon go iv calculator it is entirely in my...

57
Office Basic Source Code Management imacat [email protected] 2017/2/4

Upload: others

Post on 15-Sep-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Office Basic Source Code Management - FOSDEM · Pokémon GO IV Calculator It is entirely in my folder. – I work seamlessly on my PC and my laptop. – I do not worry if my hard

Office BasicSource CodeManagement

[email protected]

2017/2/4

Page 2: Office Basic Source Code Management - FOSDEM · Pokémon GO IV Calculator It is entirely in my folder. – I work seamlessly on my PC and my laptop. – I do not worry if my hard

“Office Basic Source Code Management” is created by imacat (Yang Shih-Ching),and licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License

Page 3: Office Basic Source Code Management - FOSDEM · Pokémon GO IV Calculator It is entirely in my folder. – I work seamlessly on my PC and my laptop. – I do not worry if my hard

imacat / Yang Shih-Ching

● Taiwan OpenOffice/LibreOffice community● Apache OpenOffice PMC● Women in FOSS in Taiwan

Page 4: Office Basic Source Code Management - FOSDEM · Pokémon GO IV Calculator It is entirely in my folder. – I work seamlessly on my PC and my laptop. – I do not worry if my hard

OpenOffice Basic is cool!

Page 5: Office Basic Source Code Management - FOSDEM · Pokémon GO IV Calculator It is entirely in my folder. – I work seamlessly on my PC and my laptop. – I do not worry if my hard

It connects programmingwith everybody’s daily routines.

Page 6: Office Basic Source Code Management - FOSDEM · Pokémon GO IV Calculator It is entirely in my folder. – I work seamlessly on my PC and my laptop. – I do not worry if my hard

I create Basic toolkit applicationsfor all kinds of jobs.

Page 7: Office Basic Source Code Management - FOSDEM · Pokémon GO IV Calculator It is entirely in my folder. – I work seamlessly on my PC and my laptop. – I do not worry if my hard

For example,

Page 8: Office Basic Source Code Management - FOSDEM · Pokémon GO IV Calculator It is entirely in my folder. – I work seamlessly on my PC and my laptop. – I do not worry if my hard

Accounting Sheet

Page 9: Office Basic Source Code Management - FOSDEM · Pokémon GO IV Calculator It is entirely in my folder. – I work seamlessly on my PC and my laptop. – I do not worry if my hard

Meet-up Sign Book

Page 10: Office Basic Source Code Management - FOSDEM · Pokémon GO IV Calculator It is entirely in my folder. – I work seamlessly on my PC and my laptop. – I do not worry if my hard

Mosaic Spreadsheet

Page 11: Office Basic Source Code Management - FOSDEM · Pokémon GO IV Calculator It is entirely in my folder. – I work seamlessly on my PC and my laptop. – I do not worry if my hard

Geometrical Paintings

Page 12: Office Basic Source Code Management - FOSDEM · Pokémon GO IV Calculator It is entirely in my folder. – I work seamlessly on my PC and my laptop. – I do not worry if my hard

Piano

Page 13: Office Basic Source Code Management - FOSDEM · Pokémon GO IV Calculator It is entirely in my folder. – I work seamlessly on my PC and my laptop. – I do not worry if my hard

Christmas Tree

Page 14: Office Basic Source Code Management - FOSDEM · Pokémon GO IV Calculator It is entirely in my folder. – I work seamlessly on my PC and my laptop. – I do not worry if my hard

Pokémon GO IV Calculator

Page 15: Office Basic Source Code Management - FOSDEM · Pokémon GO IV Calculator It is entirely in my folder. – I work seamlessly on my PC and my laptop. – I do not worry if my hard

But still,OpenOffice Basic sucks!

Page 16: Office Basic Source Code Management - FOSDEM · Pokémon GO IV Calculator It is entirely in my folder. – I work seamlessly on my PC and my laptop. – I do not worry if my hard

I lost all my Basic macroswhen I reinstall my system,

if I forget to export them.

Page 17: Office Basic Source Code Management - FOSDEM · Pokémon GO IV Calculator It is entirely in my folder. – I work seamlessly on my PC and my laptop. – I do not worry if my hard

I cannot synchronizing my Basic macrosamong my office PC, my home PC,

and my laptopunless I keep export and import

everything, everyday.

Page 18: Office Basic Source Code Management - FOSDEM · Pokémon GO IV Calculator It is entirely in my folder. – I work seamlessly on my PC and my laptop. – I do not worry if my hard

Finally, Basic IDE sucks.

Page 19: Office Basic Source Code Management - FOSDEM · Pokémon GO IV Calculator It is entirely in my folder. – I work seamlessly on my PC and my laptop. – I do not worry if my hard

And the macros are exported XML files,which I cannot work with directly.

XML

</>

Page 20: Office Basic Source Code Management - FOSDEM · Pokémon GO IV Calculator It is entirely in my folder. – I work seamlessly on my PC and my laptop. – I do not worry if my hard

This means I cannot do complicated thingsthat Basic IDE does not support.

Things like…

Page 21: Office Basic Source Code Management - FOSDEM · Pokémon GO IV Calculator It is entirely in my folder. – I work seamlessly on my PC and my laptop. – I do not worry if my hard

…regular expression search and replace,

/\w+@\w+(\.\w+)+/

/\w+@\w+(\.\w+)+/

/\w+@\w+(\.\w+)+/

/\w+@\w+(\.\w+)+/

Page 22: Office Basic Source Code Management - FOSDEM · Pokémon GO IV Calculator It is entirely in my folder. – I work seamlessly on my PC and my laptop. – I do not worry if my hard

…looking into all the occurrence of somethingfor code refactoring,

grep -r "getNumUsers" *.*

grep -r "getNumUsers" *.*

grep -r "getNumUsers" *.*

grep -r "getNumUsers" *.*

Page 23: Office Basic Source Code Management - FOSDEM · Pokémon GO IV Calculator It is entirely in my folder. – I work seamlessly on my PC and my laptop. – I do not worry if my hard

…and many, many more.

Page 24: Office Basic Source Code Management - FOSDEM · Pokémon GO IV Calculator It is entirely in my folder. – I work seamlessly on my PC and my laptop. – I do not worry if my hard

So, I wonder:Can I write Basic macros

outside of Basic IDE?

Page 25: Office Basic Source Code Management - FOSDEM · Pokémon GO IV Calculator It is entirely in my folder. – I work seamlessly on my PC and my laptop. – I do not worry if my hard

What do I needif I want to write Basic macros

outside of Basic IDE?

Page 26: Office Basic Source Code Management - FOSDEM · Pokémon GO IV Calculator It is entirely in my folder. – I work seamlessly on my PC and my laptop. – I do not worry if my hard

I can keep a source directory.Whenever I update my macro sources,I copy-and-paste them into Basic IDE.

Page 27: Office Basic Source Code Management - FOSDEM · Pokémon GO IV Calculator It is entirely in my folder. – I work seamlessly on my PC and my laptop. – I do not worry if my hard

But this doesn’t make things easier.

Page 28: Office Basic Source Code Management - FOSDEM · Pokémon GO IV Calculator It is entirely in my folder. – I work seamlessly on my PC and my laptop. – I do not worry if my hard

Or I can create a tool to do this.Whenever I update my macro sources,it copy-and-pastes them into Basic IDE.

Page 29: Office Basic Source Code Management - FOSDEM · Pokémon GO IV Calculator It is entirely in my folder. – I work seamlessly on my PC and my laptop. – I do not worry if my hard

To do this,I need to be able

to read and update the Basic macros.

Page 30: Office Basic Source Code Management - FOSDEM · Pokémon GO IV Calculator It is entirely in my folder. – I work seamlessly on my PC and my laptop. – I do not worry if my hard

This reminds me ofsomething similar I’d done before.

Page 31: Office Basic Source Code Management - FOSDEM · Pokémon GO IV Calculator It is entirely in my folder. – I work seamlessly on my PC and my laptop. – I do not worry if my hard

Calc Mosaichttp://sf.net/p/calcmosaic

Page 32: Office Basic Source Code Management - FOSDEM · Pokémon GO IV Calculator It is entirely in my folder. – I work seamlessly on my PC and my laptop. – I do not worry if my hard

In Calc Mosaic,after all the mosaic sheets are created,

Basic macros are inserted to play these sheets.

Page 34: Office Basic Source Code Management - FOSDEM · Pokémon GO IV Calculator It is entirely in my folder. – I work seamlessly on my PC and my laptop. – I do not worry if my hard

System and UserBasic Macro Storage

● But the system and user Basic macros arestored together at a different location, theApplicationScriptLibraryContainer service.

ApplicationApplication

ApplicationScriptLibraryContainerApplicationScriptLibraryContainer

Basic LibraryBasic Library

Basic Module (String)Basic Module (String)

app_libs = service_manager.createInstance(

"com.sun.star.script.ApplicationScriptLibraryContainer")

Page 35: Office Basic Source Code Management - FOSDEM · Pokémon GO IV Calculator It is entirely in my folder. – I work seamlessly on my PC and my laptop. – I do not worry if my hard

Basic Library Storage

● ApplicationScriptLibraryContainer has the XNameAccess interface.– Use hasByName() to check if a library exist.

– Use getByName() to obtain a library.

ApplicationApplication

Basic LibraryBasic Library

Basic Module (String)Basic Module (String)

ApplicationScriptLibraryContainerApplicationScriptLibraryContainer

Page 36: Office Basic Source Code Management - FOSDEM · Pokémon GO IV Calculator It is entirely in my folder. – I work seamlessly on my PC and my laptop. – I do not worry if my hard

Basic Library

● The Basic library is an XNameContainer.– Use getByName() to obtain a module.

– Use replaceByName() to update a module.

– Use insertByName() to add a module.

– Use removeByName() to delete a module.

ApplicationApplication

ApplicationScriptLibraryContainerApplicationScriptLibraryContainer

Basic Module (String)Basic Module (String)

Basic LibraryBasic Library

Page 37: Office Basic Source Code Management - FOSDEM · Pokémon GO IV Calculator It is entirely in my folder. – I work seamlessly on my PC and my laptop. – I do not worry if my hard

Basic Module

● The Basic module obtained with the previousgetByName() is a String that contains one ormore Basic subroutines as Basic macros.

ApplicationApplication

ApplicationScriptLibraryContainerApplicationScriptLibraryContainer

Basic LibraryBasic Library

Basic Module (String)Basic Module (String)

Page 38: Office Basic Source Code Management - FOSDEM · Pokémon GO IV Calculator It is entirely in my folder. – I work seamlessly on my PC and my laptop. – I do not worry if my hard

The logic is simple.

Page 39: Office Basic Source Code Management - FOSDEM · Pokémon GO IV Calculator It is entirely in my folder. – I work seamlessly on my PC and my laptop. – I do not worry if my hard

Synchronize BetweenFiles and Basic Storage

Page 40: Office Basic Source Code Management - FOSDEM · Pokémon GO IV Calculator It is entirely in my folder. – I work seamlessly on my PC and my laptop. – I do not worry if my hard

Update Basic Modules(Upload / Check In)

● Add the missing Basic modules.● Replace the updated Basic modules.● Delete the obsoleted Basic modules.

Page 41: Office Basic Source Code Management - FOSDEM · Pokémon GO IV Calculator It is entirely in my folder. – I work seamlessly on my PC and my laptop. – I do not worry if my hard

Update Source Files(Download / Check Out)

● Add the missing source files.● Replace the updated source files.● Delete the obsoleted source files.

Page 42: Office Basic Source Code Management - FOSDEM · Pokémon GO IV Calculator It is entirely in my folder. – I work seamlessly on my PC and my laptop. – I do not worry if my hard

(obasync Demonstration)

Page 43: Office Basic Source Code Management - FOSDEM · Pokémon GO IV Calculator It is entirely in my folder. – I work seamlessly on my PC and my laptop. – I do not worry if my hard

So,what’s so good

to leave Basic IDE?

Page 44: Office Basic Source Code Management - FOSDEM · Pokémon GO IV Calculator It is entirely in my folder. – I work seamlessly on my PC and my laptop. – I do not worry if my hard

Developers can store the source fileswith cloud sync servicescloud sync services,

and access their source files EVERYWHERE!

Page 45: Office Basic Source Code Management - FOSDEM · Pokémon GO IV Calculator It is entirely in my folder. – I work seamlessly on my PC and my laptop. – I do not worry if my hard

Developers can apply version control systemversion control systemto manage their source files.

CVSCVS

Page 46: Office Basic Source Code Management - FOSDEM · Pokémon GO IV Calculator It is entirely in my folder. – I work seamlessly on my PC and my laptop. – I do not worry if my hard

Developers can host their projectshost their projectson common project hosting services.

Page 47: Office Basic Source Code Management - FOSDEM · Pokémon GO IV Calculator It is entirely in my folder. – I work seamlessly on my PC and my laptop. – I do not worry if my hard

Developers can apply build toolsbuild toolsto automate extension packaging,

unit tests, and releases.

makemake

Page 48: Office Basic Source Code Management - FOSDEM · Pokémon GO IV Calculator It is entirely in my folder. – I work seamlessly on my PC and my laptop. – I do not worry if my hard

In addition, with the build tools,we can establish

project layout rulesproject layout rules and templatestemplatesto simplify and automate project management.

makemake

Page 49: Office Basic Source Code Management - FOSDEM · Pokémon GO IV Calculator It is entirely in my folder. – I work seamlessly on my PC and my laptop. – I do not worry if my hard

Take my Pokémon GO IV Calculatorfor example.

Page 50: Office Basic Source Code Management - FOSDEM · Pokémon GO IV Calculator It is entirely in my folder. – I work seamlessly on my PC and my laptop. – I do not worry if my hard

Pokémon GO IV Calculator

● It is entirely in my folder.– I work seamlessly on my PC and my laptop.

Page 51: Office Basic Source Code Management - FOSDEM · Pokémon GO IV Calculator It is entirely in my folder. – I work seamlessly on my PC and my laptop. – I do not worry if my hard

Pokémon GO IV Calculator

● It is entirely in my folder.– I work seamlessly on my PC and my laptop.

– I do not worry if my hard disk dies.

Page 52: Office Basic Source Code Management - FOSDEM · Pokémon GO IV Calculator It is entirely in my folder. – I work seamlessly on my PC and my laptop. – I do not worry if my hard

Pokémon GO IV Calculator

● It is entirely in my folder.– I work seamlessly on my PC and my laptop.

– I do not worry if my hard disk dies.

● I use for version control.

Page 53: Office Basic Source Code Management - FOSDEM · Pokémon GO IV Calculator It is entirely in my folder. – I work seamlessly on my PC and my laptop. – I do not worry if my hard

Pokémon GO IV Calculator

● It is entirely in my folder.– I work seamlessly on my PC and my laptop.

– I do not worry if my hard disk dies.

● I use for version control.● I host my project on .

Page 54: Office Basic Source Code Management - FOSDEM · Pokémon GO IV Calculator It is entirely in my folder. – I work seamlessly on my PC and my laptop. – I do not worry if my hard

Pokémon GO IV Calculator

● It is entirely in my folder.– I work seamlessly on my PC and my laptop.

– I do not worry if my hard disk dies.

● I use for version control.● I host my project on .

● I use with a build.xml and afixed project template to build and release.

Page 55: Office Basic Source Code Management - FOSDEM · Pokémon GO IV Calculator It is entirely in my folder. – I work seamlessly on my PC and my laptop. – I do not worry if my hard

Pokémon GO IV CalculatorProject Structure

rootroot PokemonGoIVPokemonGoIV

oxtoxt META-INFMETA-INF

PokemonGoIVPokemonGoIV

pkg-descpkg-desc

Main.vb, …etc.

Addons.xcu

description.xml

build.xml

README

VERSION

Main.vb, …etc.manifest.xml

pkg-description.txt

Main.xba, …etc.

Page 56: Office Basic Source Code Management - FOSDEM · Pokémon GO IV Calculator It is entirely in my folder. – I work seamlessly on my PC and my laptop. – I do not worry if my hard

Try obasync!PyPI: https://pypi.python.org/pypi/obasyncGitHub: https://github.com/imacat/obasync

Page 57: Office Basic Source Code Management - FOSDEM · Pokémon GO IV Calculator It is entirely in my folder. – I work seamlessly on my PC and my laptop. – I do not worry if my hard

Thank you.Any questions?