Coder Social home page Coder Social logo

ofxexpire's Introduction

#ofxExpire#

OpenFrameworks addon to "expire" an app (prevent it from running after a given date).

Sometimes you have to send your app over the internets. Or maybe it's an art installation for a show but you won't be there during teardown. Most of the time, we trust people to be decent and not re-use your app or project without your consent. Most of the time, the people we trust actually are decent and would never do that.

Sometimes though, for those rare times you've got a bad vibe, or if you don't really know who you're working with, or if the needs of the project dictate it, it would be great if your app just expired.

This is for those rare times.


As soon as an ofxExpire instance is created, it checks whether or not it's expired and quits the app (with a modal warning) if it is.

It probably makes the most sense to do this at the top of setup(), although I'm sure people will find reasons to do it elsewhere.

Required arguments are the month, day, and year of the last day the app will work. Month names are predefined, so you can't enter "smarch." Lousy smarch weather.

ofxExpire e(august, 11, 2015);

It's using ofGetMonth() etc. to do the actual checking, so I imagine that if the computer's system time and date is incorrect, you will run into problems.

I prefer the above syntax, but some people think either of the below declarations is clearer. They all behave the same in this case, although they are technically different. Just FYI if it helps you understand what's going on.

ofxExpire e = ofxExpire(august, 11, 2015);
ofxExpire(august, 11, 2015);

The default alert message is "This app has expired and will now quit" This can be overridden:

ofxExpire e(august, 11, 2015, "Custom Alert Message");

Aggressive Mode

This last feature only works in OS X for now. I don't plan on implementing it for other platforms, but feel free if you want to have a crack.

I debated whether or not to even include this, but I can definitely see it being useful. JUST BE CAREFUL! Look at the source code and see what it actually does.

In OS X, you can specify to actually delete the app if it is run after the expiration date. On other systems this will do nothing.

You do this by passing an additional argument at the end:

ofxExpire e(august, 11, 2015, binary) will delete the app binary (technically all the contents of the .app file)

ofxExpire e(august, 11, 2015, both) will delete the binary AND its data directory

WARNING WARNING WARNING WARNING WARNING
This actually uses an rm command under the hood. If you don't know what that is, definitely don't use it.

If your app has somehow changed its system working directory, or if there is an existing directory called data next to your app, BAD THINGS WILL HAPPEN

You have been warned!

Ivaylo
@ivaylopg

www.luxloop.com
@luxloop

ofxexpire's People

Contributors

ivaylopg avatar

Stargazers

 avatar Ryan avatar Marcel Schwittlick avatar  avatar James Alliban avatar VanTa avatar muharrem yildirim avatar Blair Neal avatar  avatar  avatar Savvas avatar Davide Prati avatar nariakiiwatani avatar Motoi Shimizu avatar Hideyuki Saito avatar Akira Hayasaka avatar Naoto Hieda avatar Do avatar

Watchers

James Cloos avatar  avatar Mandy Mandelstein avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.