This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- Fill in the name of your DB in @dbname then run the following as the admin user, should be all updated to utf8mb4! | |
| -- mysql --silent < generateAlter.sql > alterTables.sql | |
| -- mysql < alterTables.sql | |
| SET @dbname = "myla_dev"; | |
| use information_schema; | |
| -- Update DB to utf8mb4 | |
| SELECT "SET FOREIGN_KEY_CHECKS=0;"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 1. Substitute the NaN's in a dataframe with values from another dataframe | |
| If you have two DataFrames of the same shape, then: | |
| df[df.isnull()] = d2 | |
| 2.Replace values in a dataframe with values from another dataframe by conditions |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def recursiveFormat(args, **kwargs): | |
| """ | |
| Recursively apply `string.format()` to all strings in a data structure. | |
| This is intended to be used on a data structure that may contain | |
| format strings just before it is passed to `json.dump()` or `dumps()`. | |
| Ideally, I'd like to build this into a subclass of `json.JsonEncoder`, | |
| but it's tricky to separate out string handling in that class. I'll | |
| continue to think about it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| import functools | |
| from django.contrib.admin import ModelAdmin | |
| from django.contrib.admin.options import InlineModelAdmin | |
| from django.contrib.admin.utils import flatten_fieldsets | |
| from django.core.exceptions import ObjectDoesNotExist | |
| from django.db.models import OneToOneField, ForeignKey | |
| from django.forms import ModelForm | |
| from django.forms.models import BaseModelFormSet, modelformset_factory |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| jupyter: | |
| image: jupyter/datascience-notebook | |
| environment: | |
| - PASSWORD=${PASSWORD} | |
| nginx: | |
| image: nginx | |
| links: | |
| - jupyter |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## Initial setup you should only have to do this once | |
| # Checkout docker stacks project | |
| git clone https://github.com/jupyter/docker-stacks | |
| cd docker-stacks/base-notebook | |
| # Clone the telemetry in this directory, this is currently a private repo. | |
| git clone https://github.com/educational-technology-collective/hwf-jupyterlab-telemetry | |
| # git needs to be added to base image |
Examples of processing QTI data with Python.
I attempted to use pyslet, which was designed for this purpose,
but I found it awkward to use and its documentation unclear. Instead, I tried to use beautifulsoup4, but I
learned that library doesn't support XPath to query for specific elements of the data. I turned to using the
simple XML processing library lxml. It has similarities to other XML parsing libraries I've used before, but
it has many unique features of its own.
Note that of the examples below, each does something a little differently. They don't all have the same output.
That's because they were mostly tests to see whether we preferred working with one library over another. Some
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Add field | |
| echo '{"hello": "world"}' | jq --arg foo bar '. + {foo: $foo}' | |
| # { | |
| # "hello": "world", | |
| # "foo": "bar" | |
| # } | |
| # Override field value | |
| echo '{"hello": "world"}' | jq --arg foo bar '. + {hello: $foo}' | |
| { |