Canvas API

2024-Mar-17, Sunday 05:05 pm
mellowtigger: (penguin coder)

I've mentioned before that I can feel my brain starting to think again, thanks to an extended reprieve from the very busy months before now. As further evidence of this improvement, I spent my spare time between tickets today actually learning something!

Many places use Canvas as their educational platform. Both Penn State and the University of Minnesota do, for example. Today, I learned how to use PowerShell to pull information from the Canvas platform. It was surprisingly easy, after I figured out that they provided very easy access to the text token you use to interact with their servers. They provide API access to all students, for example.

After I manually generated my token, it was easy to insert "api/v1/" into the url that I would normally use at the webpage for their gui platform, then use my script instead. The Course ID is just the part of the url that shows whenever you access that class through the webpage (and not the SIS ID as I first assumed). Here's a sample of the short code, with a few key text strings redacted for security safety.

$headers = @{ Authorization='Bearer [redacted]}
$idCourse1 = '[redacted]'
$uri=”https://[redacted].instructure.com/api/v1/courses/$idCourse1/discussion_topics"
$response = Invoke-RestMethod -Method 'Get' -URI $uri -Headers $headers -ContentType application/json
$response | Select-Object posted_at, title, message | Out-GridView

And that brief code showed me a list of all the Discussions in my course sandbox.

It's nice to be able to think again.

mellowtigger: (money)

Over the years, I've been the online leader for 2 different groups at Meetup.com. It's a great place to organize calendars of activity, and it's free to use for attendees. They charge meeting organizers for the service, but it's way too expensive for what it costs Meetup to provide that service. They charged US$150/year for each group, the last I knew a year ago. That's too rich for my blood, so I eventually stopped paying both of them.

Twin Cities Powershell Automation User Group is looking for a new leader, but it may not get one. It'd be a shame to lose it. I created that group back in 2014 October 14. (I got the date from the earliest copy at the wayback machine.) The powershell group had previously used EventBrite for RSVPs, but it wasn't reaching a large audience. Attendance definitely improved after switching to Meetup. I paid for that group for several years, before handing off the finances of it to Tim Curwick, the group president at the time. I hope it finds a new leader, but it seems unlikely. This group focuses on in-person meetings (with pizza!) rather than online meetings, which are available everywhere. There are probably more people like me who simply don't attend group events any more due to health risks.

Star Citizens of Minnesota found someone else to take over, which is good. I paid the bills for a few years, which is too much money gone. But I still haven't attended any of their indoor events since the pandemic started. This group is based on the Star Citizen game which has been in development since 2012, and still isn't in release yet, although some functions are playable (if you're on Windows).

I received the notice today that Twin Cities EcoClub is also looking for a new leader. I attended only one of their events. We listened to the person organizing the hydroponics container at the North Market grocery. (Aside: I know I edited photos of that event. Did I really never post it? I certainly can't find it now in Dreamwidth searches.) I remember that one was post-pandemic, because we stayed in a large spaced-apart circle outdoors to listen.

I know I've seen notices of other groups losing their leadership. Meetup will eventually delete the groups if nobody else steps up to pay the bills. It's sad to see the groups disappear, but maybe Meetup will finally stop "printing money" and reduce their rates (by a lot) to something more reasonable.

mellowtigger: (penguin coder)
I didn't find anything online that completely addressed how to install the latest scripting toys on my Linux Mint system. Microsoft (to their credit) did provide lots of useful material that made it relatively painless. I just wanted to record those details here for posterity's sake, in case somebody else on the internet gives it a whirl later and could use some proverbial bread crumbs.

PowerShell version 7 is based on the new open-source .NET library. Yes, Microsoft is using open source for one of their most valuable intellectual properties.
  1. Figure out what version of Ubuntu you're using, which will affect which installer package you need.
    1. more /etc/os-release
      It shows you info about the current distribution, which in my case is Linux Mint 20.1.
    2. more /etc/upstream-release/lsb-release
      It shows you info about the "parent" distribution, which in my case is Ubuntu 20.04.
  2. Based on that Ubuntu version, choose the appropriate instructions on this Microsoft page:
    https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell-core-on-linux?view=powershell-7.1
  3. That's good enough for a basic shell interface, but let's go fancy with the full Visual Studio Code experience. Follow their instructions again:
    https://code.visualstudio.com/docs/setup/linux
  4. Launch "code", then change it to the old fashioned powershell ISE experience.  I also approve of using text editors like Notepad on Windows, but I feel the urge tonight to modernize.
    1. Call up the Palette within Visual Studio Code by pressing CTL-ALT-P.
    2. Click on the listing for "PowerShell: Enable ISE Mode"
  5. In preparation for installing Desired State Configuration on Linux, you will probably need to update some packages like I did that depend on your version of OpenSSL. I didn't know about it, and I had to follow a nested dependency to solve it. To find out your system's version, use this straightforward command:
    1. openssl version
  6. Choose the correct package of Open Management Infrastructure (their version of the free cross-platform standard of CIM) to install, based on that OpenSSL version:
    https://github.com/Microsoft/omi
  7. Choose the correct package of Desired State Configuration to install, based on that OpenSSL version:
    https://github.com/Microsoft/PowerShell-DSC-for-Linux/releases/tag/v1.2.1-0

I'm pretty sure those are all of the tools that the cool kids are using, although DSC seems to go by other names in an Azure environment.  That part still confuses me greatly.  Anyway, someday after I've used it to do something interesting on my computer, I'll be sure to post some code samples.

Windows 10

2014-Oct-19, Sunday 09:13 pm
mellowtigger: (Daria)
For the last few weeks, I've been using the Windows 10 beta on my home pc. The short review:

It's not as awful as Windows 8, so I guess I could use it.

Yes, they skipped Windows 9. The most plausible explanation is that many programs may make the mistake of looking for earlier versions of windows with a search string similar to "Windows 9*", which would find instances of Windows 95 and Windows 98. Skipping ahead to Windows 10 will avoid that problem scenario where a program thinks it's running on an old system instead of a new one.

I upgraded my existing Windows 7 to Windows 10, so the process took a long time with a lot of reboots. Afterwards, performance was awful. It was really, really slow. I started disabling services that were hogging disk access. It was automatically defragging, it was monitoring usage to "optimize" disk access... and I turned it all off if I noticed an active service that I didn't immediately need. Finally, performance was back up to Windows 7 speeds.

I started up powershell. I checked, and, it's running at version 5 now.  Yay!  I tried out the new command that linux people will recognize from Debian's "apt-get". It allows a 1-line command that will install a software program onto your computer from a centralized host. It makes software management much easier on linux, and now Microsoft has caught up. There weren't any packages available yet that I was interested in using... but the available libraries will grow with time. This feature is very nice!

powershell
Import-Module OneGet
Find-Package

grey slider on grey scrollbarThe interface is still a little goofy, and I still like Windows 7 better. I can tolerate this new one, at least. The only interface issue that gave me trouble was my difficulty in detecting where the slider is located on a scrollbar. The whole thing is soft grey, and one grey is not sufficiently distinct from another grey. Click the picture on the right to see for yourself. It's a screenshot from my desktop.  I have to look for a moment before my eyes finally detect the slider in the scrollbar.

I decided to provide feedback to Microsoft about the scrollbar. Bad move! Doing so somehow tied my profile (which was previously a standalone account) to my Microsoft online account (which I never wanted). It also activated OneDrive and started syncing files on my pc to Microsoft's servers (which I definitely never wanted). I disabled it immediately:

mmc.exe, then add/remove snapin: Local Computer Policy (or run gpedit.msc)
Computer Configuration\Administrative Templates\Windows Components\OneDrive
edit "Prevent the usage of OneDrive for file storage"
set state to Enabled

I also took back control of my profile by disconnecting the Microsoft online account:

PC Settings / Users and accounts / Your profile
Disconnect

I've decided that Windows 10 is passable. There's no compelling reason to upgrade to Windows 10... except the eventual shutdown of support for Windows 7 by Microsoft. Welcome to the future. Hurrah?

resurrecting Clippy

2013-Feb-18, Monday 09:04 pm
mellowtigger: (penguin coder)
None of those annoying animations were ever supposed to exist on Windows 7. There was such an outcry, though, that Microsoft created a hotfix that allowed support of their deprecated animation protocol known as Microsoft Agents. Doing a little more digging, I found sources for all of their original agents.

Read the comments prior to each section to find the urls you need to visit to download all of the relevant files. Each of them should produce a file of .ACS extension in the C:\WINDOWS\MSAGENT\CHARS\ directory.  This Powershell script will demonstrate all of them.



# Demonstration of Microsoft Agent controls.
# NOTE: These agents are deprecated.  They were never supposed to be on Win7.
# http://www.microsoft.com/products/msagent/main.aspx

# The primary Agent control can be downloaded for Windows 7 as a hotfix.
# It will install c:\windows\msagent\chars\merlin.acs, plus other supporting files.
# Download the hotfix from this url:
# http://support.microsoft.com/kb/969168

$MI6 = new-object -com agent.control.2
$MI6.connected = $true

$MI6.characters.load('Merlin','Merlin.acs')
$agent = $MI6.characters.character('Merlin')
$agent.Show()
$agent.think('Hello!  I''m over here!')
$agent.play('Wave')
$agent.moveto(800,600)
$agent.think('I and the other Microsoft Agents are here.')
$agent.Play('Pleased')
$agent.think('I am Merlin.')
$agent.think('Only 1 agent can be loaded at a time.')
$agent.hide()
while ($agent.visible) { sleep -Milliseconds 100 }
$MI6.characters.unload('Merlin')

# You can download the other official agents at these urls.
# Genie  @ http://www.microsoft.com/en-us/download/details.aspx?id=4957
# Robby  @ http://www.microsoft.com/en-us/download/details.aspx?id=12327
# Peedy  @ http://www.microsoft.com/en-us/download/details.aspx?id=17076
# Clippy @ http://www.microsoft.com/en-us/download/details.aspx?id=11215
# list of their animations @ http://msdn.microsoft.com/en-us/library/ms695821.aspx

$agentlist = @(('Genie','Genie.acs'),('Robby','Robby.acs'),('Peedy','Peedy.acs'),('Clippy','Clippit.acs'))
foreach($name in $agentlist.GetEnumerator()) {
    $MI6.Characters.load($name[0], $name[1])
    $agent = $MI6.characters.character($name[0])
    $agent.moveto(800,600)
    $agent.show()
    $agent.think('Hi, I''m '+$name[0]+'.')
    $agent.play('Wave')
    $agent.hide()
    while ($agent.visible) { sleep -Milliseconds 100 }
    $MI6.characters.unload($name[0])
}

# A Microsoft Office agent no longer downloadable from Microsoft (that I could find).
# Not all animations from above are available on this character.
# Rover @ http://www.tinmith.net/wayne/rover/index.htm

$MI6.Characters.load('Rover','rover.acs')
$agent = $MI6.characters.character('Rover')
$agent.moveto(800,600)
$agent.show()
$agent.think('Hi, I''m Rover.')
sleep -seconds 6
$agent.hide()
$MI6.characters.unload('Rover')

# Non-Microsoft agents that people have developed:
# http://www.msagentring.org/chars.aspx
# http://www.zero2000.com/microsoft-agent-characters.html



I call this script Clippy.ps1.  I loathed Clippy passionately.  Now, finally, he's my puppet.  Come to the dark side; feel the power(shell)!

Profile

mellowtigger: (Default)
mellowtigger

About

August 2025

S M T W T F S
      12
3456789
10111213141516
17181920212223
24252627282930
31      

Most Popular Tags

Syndicate

RSS Atom
Powered by Dreamwidth Studios
Page generated 2025-Aug-06, Wednesday 09:18 pm