18
Aug 14

Leverage the 10000ft API to create custom exports to Excel

At IXDS we have a bunch of exports off of 10000ft, which we created manually in the past. For example, a weekly overview of over hours or the utilisation of employees etc. When 10000ft published their API, we happily jumped at it to automate these exports. This is a little example showing the basic workflow of getting data from 10.000ft, to exporting it to an excel file. We based our export tool on Python with Flask and some helpful libraries as Xlsx Writer.

1. Get some data from 10000ft.

base_url = 'http://api.10000ft.com'
auth_token = 'YOUR_AUTH_TOKEN_HERE' # [1]

headers = {
  'content-type': 'application/json'
}

params = {
  'per_page': '9999',
  'fields': 'availabilities, tags',
  'auth': self.auth_token
}

url = self.base_url + '/api/v1/holidays' # [2]
r = requests.get(url=url, params=params, headers=headers)
data = json.loads(r.text)

# [1] You can get your api authentication token by
# contacting 10.000ft support.
# [2] or "/api/v1/users" for users, "/api/v1/projects"
# for projects .. you get the drill. For all possible
# data-sets visit the 10.000ft api website.

2. Parse the data into your own data structure. (We do this to do operations on the data, and it’s more handy having proper objects than operating directly on a json structure).

holidays_raw = data

# we parse the raw data into our own model structure
holidays = []
for holiday in holidays_raw['data']:
  h = Holiday(holiday)
  holidays.append(h)

3. Export data into an excel file.

filename = 'export.xlsx'

workbook = xlsxwriter.Workbook(filename)
worksheet = workbook.add_worksheet('Holidays')

# widths
worksheet.set_column('A:A', 15)
worksheet.set_column('B:B', 30)

# put data
row = 1
for holiday in holidays:
  worksheet.write(row,0, holiday.date)
  worksheet.write(row,1, holiday.name)
  row += 1

# save
workbook.close()

Useful resource: 10.000ft API documentation.

You can download an example app of the above code here (in Python, needs Flask and Xlsx Writer and Requests installed).


17
Jul 14

Touchless-Touch with Leap Motion and openFrameworks

In recent projects we used the Leap Motion controller for exploring Touchless-Touch. For this purpose we developed the extension ofxLeapTouch for openFrameworks to map the leap space to screen space and emit touch events.

It should be simple to combine the addon with touch responsive UIs, forward the touch events via the TUIO protocol or handle them by yourself. Have a look at the examples and additional features in the README.

The addon is built upon ofxLeapMotion by Theo Watson, which is already using the new Leap Motion SDK (v2 beta) – featuring a promising skeleton model and a significantly improved hand tracking.


10
Jul 14

QtScreenGrabber – Recording your QtWidgets

It turns out recording your Qt screen/widget from your Qt code as a video is quite tricky.

I created the QtScreenGrabber for making this process faster and easier. It makes it this easy to record your widget and output to a video file:

ScreenGrabber *grabber = new ScreenGrabber;
grabber->setup(QString("output.mpg"), width, height);
grabber->setPixmapSourceWidget(view);
grabber->startRecording(20); // record for 20 seconds

It is based on ofxFFMPEGVideoWriter (developed by Roy Shil)  and one of the Qt examples (Animated Tiles).

You can find the full example here on GitHub:

https://github.com/IxDS/QtScreenGrabber

This is for capturing your widget as a video, but if you need to save the screen once in a while there is an example for that distributed with Qt examples.