The Mystery of the Unsharable Calendar

I was working with my good buddy Rotimi on a Google Calendar issue tonight. His school (like mine) uses a Google Calendar for campus events with an iframe used to display events on the school website’s calendar page.

Unfortunately, something changed so that events only showed “busy” with  no descriptions or details when viewed by anyone who wasn’t logged in to a school-managed Google account. Rotimi logged into the calendar owner’s account but he was not able to change the sharing settings to show all event details to the public as that option was greyed out and unavailable:

I thought that there may have been a change in the Google Admin Control Panel for the account’s OU, but that turned out not to be the case. Rotimi went back to the user account that owned the calendar and looked more closely at the list of people in the “Share with specific people” section. Interestingly, two of those who were able to make changes and manage sharing were domain admins. When Rotimi accessed the sharing page from his Google Administrator account (rather than the calendar owner’s account) he was able to access the “See all event details” option in the calendar sharing settings. As soon as he saved this setting, all event details were once again showing on the website even if the viewer was not logged into a school Google account.

We think that one of the domain admins may have inadvertently  changed the sharing settings for this calendar to hide event details from viewers who are not logged into a school account. Apparently, if a domain administrator changes the sharing settings of an individual user’s calendar, it overrides the sharing settings available to the calendar’s owner so that he/she can no longer share it more openly than what the admin user set. In other words, it looks as though if an admin changes a user’s calendar sharing setting, the user can make the sharing more restrictive, but not more open than the setting made by the admin.

Ripping DRM DVDs on MacOS with libdvdcss and Handbrake

Many educational materials producers use DVDs (12cm flat disks with a mirror-like surface on one side, a digital storage media popular in the 1990s) to distribute materials to teachers. To assist our modern staff update their media resources, we secured some drives to access content on DVDs . Unfortunately, media producers, in a misguided attempt to be pains in the neck, used a tool called DRM to increase the effort required to convert the media content to a useable format. The following is a tutorial on how we convert outdated DRM media into a useable format. The key is to install the libdvdcss library. To get there, takes a little work, but the easiest way is to install xcode tools and  Homebrew (helpful for installing lots of different tools) which makes installing libdvdcss and Hombrew easy.

  1. Install xcode tools (this may take a while):
    sudo xcode-select --install
    sudo xcodebuild -license accept
  2. Install Homebrew:
    /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  3. Install libdvdcss:
    brew install libdvdcss
  4. Install Handbrake:
    /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  5. Install libdvdcss:
    brew install handbrake

Now, you should be able to fire up Handbrake and rip your content to your computer. Handbrake tutorials are plentiful on the Interwebs if you need more support with ripping DVDs.

Bulk Editing Google Docs with a Script

We used Google Docs for elementary progress reports. A spreadsheet and Autocrat let me create all the files and even drop them into folders by homeroom class. But that’s not what this is about.

After teachers started entering grades, the principal noticed that the grading key was missing some information. The easy fix would have been to recreate the docs and have the teachers start over. But this would have created extra work for teachers on one of their least enjoyable tasks.

A quick Google search led to a script that would allow me to edit the documents en masse. Not surprisingly, the starter script came to me via Amit at https://labnol.org. It takes the folder path containing the docs to be edited, the “search” text and the “replace” text. Then it goes through all the docs in the folder, makes a backup and then does the search/replace in each doc.

Amit’s script is effective but limited to a basic find/replace in the body text of Google Docs in one folder.  I expanded it to allow formatting text in addition to find/replace in Google Doc headers, bodies, and footers across multiple folders. You can find my script here.

Just as I expanded Amit’s script, when you’re ready to expand mine, visit the Class Text section of Google Apps Script tutorials for more options.

Downgrade iTunes from 12.7 to 12.6

UPDATE:
This proves to be a roundabout way of downgrading iTunes. Please see this post on installing an older version of iMovie which is a much faster, more reliable method. Just change “iMovie” to “iTunes” and it works the same.

We use iTunes to manage several iPads on our campus. We log in from our iMacs and purchase apps that then automatically download to our devices. Unfortunately, iTunes lost support for iOS app purchases in version 12.7 in the October of 2017. Any time we update MacOS, I’m anticipating that we’ll need to downgrade iTunes to 12.6.2 to regain this functionality.

Apple doesn’t make this easy. One needs to first delete the current iTunes app, swap out the iTunes Library.itl file and then install 12.6.2.

If your Mac doesn’t allow you to delete iTunes, you’ll need to turn off  System Integrity Protection to do so:

  1. Restart your Mac, holding down Command-R until you see the Apple logo
  2. Once the computer boots, under the Utilities menu, open Terminal.
  3. Turn off SIP by entering the command csrutil disable.
  4. Enter reboot to restart your Mac

Once restarted, you should be able to remove iTunes. You should be able to do so in Finder or in Terminal with . sudo rm -rf /Applications/iTunes.app.

Now, in Finder, visit ~/Music/iTunes/ folder and locate the file named “iTunes Library.itl” and move it somewhere safe as a backup.

Then open the “Previous iTunes Libraries” folder and find the most recent dated iTunes Library file (these are labeled by the last iTunes install date). Copy this file and paste it into the iTunes/ folder and rename it “iTunes Library.itl”. I ran into issues doing it this way once and just deleted the iTunes Library file altogether. iTunes just made a new one in the next step.

Now, download iTunes 12.6.2 here and install it.

You should now be able to run iTunes 12.6.2 with access to the iOS App Store.

Finally, go back and turn SIP back on:

  1. Restart your Mac, holding down Command-R until you see the Apple logo
  2. Once the computer boots, under the Utilities menu, open Terminal.
  3. Turn off SIP by entering the command csrutil enable.
  4. Enter reboot to restart your Mac

If this fails, check out this solution from here:

1.turn off SIP as noted above
2.Mac restart
3.Enter this Terminal code (OK to copy all/paste into Terminal)

sudo rm -rf /Library/Documentation/Applications/iTunes/Acknowledgements.rtf /Library/Documentation/iPod/Acknowledgements.rtf /Library/Frameworks/iTunesLibrary.framework/ /Applications/iTunes.app/ /System/Library/PrivateFrameworks/iTunesAccess.framework/ /System/Library/LaunchDaemons/com.apple.fpsd.plist /System/Library/PrivateFrameworks/CoreFP.framework/ /System/Library/PrivateFrameworks/CoreADI.framework/ /System/Library/LaunchDaemons/com.apple.adid.plist /System/Library/CoreServices/UAUPlugins/ADIUserAccountUpdater.bundle/ /System/Library/CoreServices/CoreTypes.bundle/Contents/Library/MobileDevices.bundle/ /System/Library/LaunchDaemons/com.apple.usbmuxd.plist /System/Library/PrivateFrameworks/AirTrafficHost.framework/ /System/Library/PrivateFrameworks/DeviceLink.framework/ /System/Library/PrivateFrameworks/MobileDevice.framework/ /System/Library/Extensions/AppleMobileDevice.kext/ /System/Library/Extensions/AppleUsbEthernetHost

4.install iTunes 12.6.2 & restore Your backup file 「 iTunes Library.itl 」
5.turn on 「 MAC SIP 」
6.Disable iTunes update – terminal code:
sudo softwareupdate --ignore iTunesXPatch

Thanks to OSXDaily and Apple Discussion guy Niel for tips.

Tracking Down Student Records after Permanently Storing Grades Improperly (PowerSchool)

In June, 2017, we stored grades for our secondary students, neglecting to exclude enrollments that were not active at the time. This means that if any student dropped a course for any reason and had received a grade in the grade book, that course would show up on a transcript with the grade that was current as of the drop date. We didn’t catch the error until the following October. So, we had to track down every high school enrollment that had been unenrolled, pretty much from the first week of second semester. Then we needed to check to see if there was a permanent grade stored for that enrollment and, if so, delete it from the database.

The hardest part was figuring out how to find the students in DDE. This is how we did it:

  1. In the CC table, select all records.
  2. SchoolID = 300 (Our High School)
  3. DateLeft < 06/01/2017  (The end of the semester was 06/07/2017)
  4. DateLeft > 01/10/2017   (The end of the first week of the semester)
  5. Course_Number < 898 (We have dozens of “Club” courses numbered 898-995)
    1. This whole process needs to be repeated to also select course Numbers > 999 to catch the rest of the non-club courses.
  6. *** Switch to the Students table ***
  7. Grade Level >= 9 (Get current HS Freshmen and above)
  8. Grade Level <=12 (Restrict to Seniors and below – exclude Graduates)
  9. Enroll_Status = 0 (Current students only)
  10. Match selection with CC table

Once we had this info, we ran transcript reports for the 35 or so students and checked to see if grades were showing up for dropped courses. Luckily, there were only a few for underclassmen that needed correcting and none of any significant consequence.

Raspberry Pi in Hotspot Mode

My last project was setting up a wireless, battery-operated Raspberry Pi time lapse video shooting rig. This works very well when it is able to connect to a WiFi network that it is familiar with. When at home, I can easily get the Pi to connect to my home WiFi and remote into it with VNC Viewer from my iPad or Macbook. However, if I’m out of my WiFi network’s range, I can’t connect to preview my camera’s view or to verify that it’s working.

So, instead of having the Pi connect to WiFi, I turned the built-in WiFi card into an access point. This was all made possible by an excellent tutorial by Phillip Martin. Now I can connect my iPad or Macbook directly to the Pi to preview the images captured by the camera, tweak the script that takes the pictures or to transfer folders of images from the device to my computer.

When the picture-taking has finished, I can connect to the same access point with my Macbook and copy files and folders from the Pi to my computer for processing. Since I know I’ll forget the specifics and come back here to find them. I need to first connect to the AP (ssid: RPi4VNC, password hint:Luther Long) and then open a terminal window and use secure copy (scp):

scp -r pi@172.24.1.1:/home/pi/09-23_21-26-02 ~/Desktop/09-23_21-26-02

-r Means recursively
pi@ Means logging in as user “pi”
172.24.1.1 is the static ip address set up in Phrillip’s blog post
/home/pi/09-23_21-26-02 is the folder I’m copying
~/Desktop/09-23_21-26-02 is the destination folder on my Macbook

Raspberry Pi Automated Time Lapse (Updated Sept. 18, 2017)

Update: If you want a Time Lapse Raspberry Pi image you can burn to an SD card? Click here to download the zipped image. Just extract and burn to a 16GB SD card, pop it into a Pi with a camera module and you'll be on your way.
Update #2: Following Phillip Martin's blog post, I set up the Pi's WiFi adapter as an access point so I can connect my iPad and Macbook directly to it without needing to rely on another WiFi network. Now I can remote into it with VNC Viewer in any location I'm recording. See this post for details.

We’re working on some cool video pieces to showcase the awesomeness happening on our campus. As part of that effort, we built an automated time lapse video recorder using a Raspberry Pi 3, case, camera and an Anker PowerCore battery pack. Set this puppy down, point it in the right direction and let it sit for an hour (or 12). Then, stop the script and combine your hundreds (or thousands) of photos into a cool time lapse video.

Here’s a quick example of what’s possible.

Some pictures, with an explanation to follow.

 Front of Raspberry Pi time lapse camera 

Physical build, challenges and prototyping

During the early iterations, the camera module was external to the case and basically taped it to the outside making it vulnerable to damage. Cutting a small hole in the front cover to allow the camera lens to see through and taping the camera module down to hold it in place resolved the issue. There were some small plastic tabs on the inside that needed to be removed in order to get the camera to sit flush. Depending on your case, you’ll likely need to make similar modifications. Be careful to avoid damaging the ribbon cable as it can be kinked, pinched or come loose.

One early frustration was the need to tote around a keyboard, mouse, monitor and power adapter to each filming location. To get around this, a little script runs on startup so that the Raspberry Pi will just start taking pictures as soon as it boots up. Adding the Anker battery pack (perfectly sized to work with the Pi’s case), attached with 3M Command Strip hook and loop fasteners resolved the power issue. Now, it can be set up anywhere. Just attach the power cable and let it run. As soon as it boots, the camera starts taking pictures – one each second, until the power is disconnected or the device is shut down. While we haven’t timed it exactly, the 10000 mAh battery looks like it might be able to run the Pi for  24 hours or longer.

Another challenge was not being able to see how the pictures looked to frame the shot without a monitor. So a VNC server was installed on the Pi. Now an iPad can be used to remote into the Pi to see the pics as they are being taken. Looking at the first few pictures allows adjustments to be made to get the best shot.

How it works [updated 09/03/2017]

This line is added to /home/pi/.config/lxsession/LXDE-pi/autostart file:

@/home/pi/lapsescript

This runs a one-line script named lapsescript stored in the home directory. To create the lapsescript file:

  1. Open the Terminal app on the Pi
  2. Type “cd ~” and hit enter to be sure you’re in the home folder
  3. Type “sudo nano lapsescript” and press enter to create the lapsescript file in the nano text editor
  4. Type lxterminal -e sudo /usr/bin/python2 /home/pi/lapse.py in the nano editor
  5. Press “ctrl-x” to exit nano
  6. Press “y” to save the file
  7. Press enter to confirm saving the file
  8. Now that you’re back in the Terminal window, type “sudo chmod a+x lapsescript” and press enter. This makes the script executable.

So, when the Pi boots up, the line at the top of this section runs lapsescript. If you read the lapsescript line from left to right, lxterminal is executed (opened), the Python interpreter starts, and runs the lapse.py Python script. This script creates a new folder with the current date and time in the home directory and stores pictures (taken one per second – customizable in the script), storing each with a sequential filename of image0000.jpg, image0001.jpg, image0002.jpg, etc. Each time the script runs, a new folder is created so that different shots don’t need to be separated by hand – each has its own folder. Note that this all happens automagically when the Pi boots. No need to type anything. Just set it down where you want to shoot, plug in the external battery and let it sit for as long as you’d like. The Python script will continue to run until you shut it down (Ctrl-c, disconnect the power or otherwise shut down the Pi) or your sd card gets filled.

These pics can then be converted to a movie on the Pi with avconv or transfer them to your favorite video editor. Navigate to the pictures folder in Terminal and use the following command to create a 24 frames/sec mp4 video named timelapse.mp4 scaled to 1280×720:

avconv -r 24 -i image%04d.jpg -r 24 -vcodec libx264 -vf scale=1280:720 timelapse.mp4

How to put it together:

These instructions assume you want to set up your Raspbian installation from scratch. If you just want to download an image that’s all ready to go, just download the image linked at the top of this post, write it to your SD card, pop it in your Pi, point your camera somewhere interesting and turn on the power.

  1. First, connect and enable a camera module. Once connected, open the Pi’s configuration (Preferences > Raspberry Pi Configuration) and select the Interfaces tab. Ensure that the camera is enabled. Also enable VNC and ssh if you want to access your Pi remotely.
  2. Python script creates a directory in the Pi home directory using the current date and time to keep each time lapse sequence separated. The linked .txt file would need to be renamed timelapse.py and in order to work with this automated setup and saved to the home (/home/pi/) directory. To change the length of time between pictures, change the number in the sleep(1) line. The number in parenthesis is the number of seconds to pause between pictures. You can also change the resolution to suit your particular camera module.
  3. To run the script at startup, add the line
    @/home/pi/lapsescript
    to /home/pi/.config/lxsession/LXDE-pi/autostart file. To do this, open a terminal window and type:
    sudo nano /home/pi/.config/lxsession/LXDE-pi/autostart
    This opens an editor with the autostart file. At the bottom of the file, add the line “@/home/pi/lapsescript/” at the bottom. Press control-x, then ‘y’ then enter to save the file.

Future upgrades

A dynamic DNS service would help make the VNC server accessible regardless of the current network or ip address (future upgrade). Ideally, it would have some buttons in order to shut down the Pi properly rather than just disconnecting the power and to change the time between shots. The newer 8MP camera module and a touchscreen are being shipped with hopes that the higher resolution will look awesomer on our new 4k displays. The touchscreen may just help with setup and preclude the need for a VNC/iPad monitor setup. Alternatively, I’d like to add some buttons that could pause or stop the script, change the image resolution and/or the length of time between pictures. I’ll update the post as those get implemented.

Links used in researching this project.

Some links to resources.

  1. Setting up VNC server on the Raspberry Pi
  2. Running Python script on startup. This was particularly helpful. In earlier setups, the script would run, but there was no way of shutting it off. This method opens a Terminal window so that Ctrl-c will interrupt the script.
  3. Python code inspiration came from the second page of this post.
  4. Other Raspberry Pi time lapse posts:
    1. Trevor Appleton
    2. Jeff Geerling – Headless Pi Zero

PowerSchool Custom Reports Notes

This is just a notepad for me to record tips for PowerSchool Custom Reports.

  1. Enter a custom field from any table
    • ^([table number]custom field name)
  2. Get fields from StudentCoreFields into a report
    • ~([Students.StudentCoreFields]PSCORE_LEGAL_FIRST_NAME)
  3. Customizing the “generalDemographics” page to use new legal names
    • <input type=”text” name=”[Students.StudentCoreFields]PSCORE_LEGAL_FIRST_NAME” value=”” size=”25″ maxlength=”50″ id=”firstName”