Second video in the Flask series. This one goes over installing Flask in a virtualenv and running a simple Flask application.
Nothing much to say about this other then check out the video:
Second video in the Flask series. This one goes over installing Flask in a virtualenv and running a simple Flask application.
Nothing much to say about this other then check out the video:
Those laptops that my Hunter students were supposed to get have finally arrived. We're distributing them on Monday. Each student will have a Dell laptop running Ubuntu 16.04 for as long as they're in the program.
This means we can finally start using the web as a way of displaying and sharing our projects.
For this type of web development, I'm a big fan of using Flask. Flask is a Python microframework. The easiest analogy is saying it's like Ruby on rails but in Python. That's close enough for our purposes.
I much prefer Python to Ruby as a teaching tool because it leads to roads going in all sorts of directions so it was merely a matter of figuring out which framework or platform to use. I found Django to be far too big, cumbersome, and all encompasing while on the other hand, Werkzeug, which Flask is based on is a little too low level.
Flask hit the sweet spot. Easy routing, session and form handling, templates, pretty much everything I was looking for but very unopinionated and open ended. Perfect for teaching and learning and perfect for lightweight projects. The sourecode is also straightforward enough for a student to explore.
Below is a video going over setting up Linux from right after an install to use the python virtualenv package. The next video will go over installing Flask and setting up a simple application. Later, I'll post a video on deployment to a Digital Ocean Droplet.
Here are some notes relating to the video.
First, go to your "software sources" or "software updates" application from the menu and select all the sources (as described n the video)
To update a new system:
sudo apt-get update sudo apt-get upgrade sudo apt-get dist-upgade
To install the most recent emacs snapshot
sudo apt-add repository -y ppa:ubuntu-lisp sudo apt-get update sudo apt-get install emacs-snapshot
To install python pip (used to install other python packages)
sudo apt-get install python-pip
and then to install the virtualenv packages
sudo pip install virtualenv
To create a python3 virtual environment
pip install -p python3 venv-folder
your home directory):
And to deactivate it, from the activated terminal
Here's the video. Next time, we'll install Flask into an virtual environment.
Basic emacs has undo, bound to C-/ or C-_ but that's about it. Undo tree, which you can set up with:
(use-package undo-tree :ensure t :init (global-undo-tree-mode))
adds two key features. First is redo, which you get by adding the shift key to the undo keychords.
The other, is the visual undo tree. You can bring that up wit C-x u
Once you bring up the undo tree, you can use the up and down arrows or C-n and C-p to move between undo and redos. When you get to what you want, just quit the undo tree visualizer with q.
The cool part is that once you undo a few things and add new stuff, you get a tree that you can navigate through using the arrows.
It's much easier to get the flavor of this by watching the video (which also has a lame example of using artist-mode which I'll come back t at some point).
In the comments, I was asked my thoughts on chromebooks vs Linux on low end hardware so, here they are.
Chromebooks are cheap, near instant on, and, if you're using Google Apps for education, little to no administration necessary.
This is a HUGE win for schools.
There are some issues. School WiFi, for example, is frequently insufficient which can be a problem for a device that's meant to be connected to the cloud. People might think that schools are well connected but I know multiple schools that keep kids off the WiFi to keep it from being overloaded. This is a problem and I don't know if it's really being addressed.
It's also worth noting that DOE pricing is also a far cry from "lowest bidder." We keep seeing sub $200 chromebooks on the market but buying through the DOE approved vendor looks to cost about $300 per unit or more. Of course this is better than the equally inflated PC/Mac prices.
Still, the price and easy of deployment and administration seem to make chromebooks the way to go.
As to other issues, first, you have to buy in to the Google platform – email, docs, classroom, etc. This isn't necessarily a problem. I personally like most of Google's offerings. My big concern is giving away student data. I have mixed feelings on the whole privacy thing but it's more clear cut when it comes to minors in public schools - schools shouldn't be sharing their data and schools shouldn't be forcing them to share their data. Google Suite for Education is FERPA compliant but what about all the other Google services the kids might be using? I haven't looked at this carefully but we've already given too much power to private interests over education (see the College Board or Pearsons) so, at least to me, this is a concern.
My only other issue is a selfish one. As a CS educator, I look to coding tools and environments. While there are online platforms like cloud9 or repl.it, they don't have the same power and flexibility of using local installs. I've been using repl.it and it's a great tool but I think it's best used as a stepping stone to a local install and then afterwards for some of it's specific value added features. I'm also a big believer in teaching operating system as tool box, something you can't currently do with a chromebook.
Willy Karam commented over at AVC about using cheap hardware running Linux. This is something I've done for years and it's been a lifesaver. CSTUY's entire laptop collection consists of really old laptops running Linux.
For a CS class, this works well. Even for a non CS class it can work well. Modern Linux distributions run pretty much the same as Windows and MacOS. Use the mouse to click on menus and icons. It doesn't give you the power of the command line but it means it's a suitable alternative for the masses that use the operating system as a program loader..
The downside of Linux for the general population is the administration and maintenance. At Stuy, we set up NIS and NFS. Both horrible but probably easier and better than most alternatives. I was never able to come up with a better way to do authentication and file sharing and the NFS stuff would have killed our wifi (we only used it in wired labs). Customizing software installs is also a real problem. We made it work but it took far too much time and effort.
If you're in a situation where you can do a stock install and then give the machine to the student for the semester, then Linux can work really well. If you're talking about shared machines with custom installs, it's harder to justify over chromebooks.
A final note on chromebooks is that last year, I played with putting Linux on a chromebook. It worked pretty well. Almost the best of both worlds. Low end hardware with good battery life and a full operating system. This is something I have to play with on the current generation of chromebooks.
So, where do I stand on this? The cloud isn't there yet in terms of teaching computer science. It's fine for a gentle introduction but eventually, you'll need the power of a full blown OS and local installs. We may very well get to where a cloud OS is just as expressive, we're just not there yet. On the other hand, for general computing in schools, chromebooks are a big win.
It would be wonderful if schools had sufficient infrastructure, support staff and training so that technology was just there and just worked and we didn't have to make these sort of decisions and compromises. Somehow I don't thing that will be happening any time soon.
I'm way behind on my Communications of the ACM. I generally only read them when I use my trainer in the mornings and with summer running and outside riding, I'm still on the December 2015 issue.
This morning, I read a viewpoint by Jeremy Scott and Alan Bundy on a program in Scotland. If you're an ACM member, and if you're a CS practitioner, student, academic, or teacher you should be, you can read the piece for details.
Me? I noticed a number of similarities between what Bundy and Scott described and efforts here in the USA including some of the red flags.
I'm not here to talk about the program described in detail or their successes and failures. I don't have enough information to fairly comment on that. I'm here in my usual role of curmudgeon to highlight common red flags that if unheeded could cost all of us the opportunity to get really great CS Ed to all of our students.
One red flag right away were a number of references to the program being curriculum and materials driven, not teacher driven. The viewpoint states that materials "were designed to be used by even non-specialist teachers." We see the same thing here in the USA and not just in CS Ed. Teaching overall is being devalued with the elite pushing programs that handcuff good teachers to a script (which leads students towards "success" in passing a nonsense standardized exam) all the while sending their own kids to elite private schools with knowledgeable teachers.
I know i didn't want my kids to be taught chemistry history or any other subject by a teacher that hasn't studied the content yet here we go saying it's okay for CS.
The counter argument is that we have to do something now and we'll do better later. We all go in with the best of intentions but more often than not, once a politician has their sound bite and once a cheap apparent solution is in place, it's good enough and we're done. I ranted about that a while back both here and here. To their credit, Bundy and Scott talk a bit about this concern in the piece.
The piece also said "It is also necessary to employ a pedagogy that is informed by the latest research into the most effective ways to teach computing." This sounds good but the truth is, education research doesn't have the best reputation among educators. Last month, I asked one of the best math teachers around what was being bandied about as best practices in math education according to "the research?" He basically said "the research says do fad du jour but that doesn't work for me so I just do actually good technique."
Over the years, I've spoken to many teachers and by and large the best ones discredit "the research." Of course, my comment will be discredited by ed researchers saying that "you're just giving anecdotes" but then, if I did the same thing while employed as a researcher, did a couple of surveys and submitted it for publication, then it would be "research." So much of teaching is a craft and the truth is, practitioners know best.
Related to this is authentication by citing authority. Particularly dangerous in our field because many people with little to no real background in teaching CS are anointed as experts and thought leaders (see this post: here). In this case, the viewpoint cites Cameron Fadjo. I've only met Cameron once or twice and he seems like a sharp guy but when he was given the post of Director of Software Engineering for NYC, according to his linked in profile, he had neither taught k12 nor had any real CS background. This is of course the profile of many CS Education thought leaders.
My overall take. It sounds like just like here, Scotland has people trying to make a difference and trying to do good. It also sounds like they're falling into the same traps and pitfalls as we are on this side of the Atlantic.
This called to mind those countless discussions about tools being user friendly. I'm frequently on the unpopular side of these discussions. Linux vs Windows vs Mac, Shell vs GUI, Emacs vs fill-in-the-blank-editor-or-IDE and on and on.
Don't use Emacs, it isn't user friendly. Don't use Linux, it isn't user friendly.
The thing is, I don't think that word means what they think it does.
I tell my kids that Linux and the shell is amazingly user friendly and Windows and Macs aren't user friendly at all. Windows, rather, is "Learner Friendly." For years, it's been easy to learn what you can do on Windows or Mac (as used via the GUI, not dropping to a shell) but the truth is you can't do that much. They're designed as program loaders not tool kits.
You can learn how to get around and load programs and files very quickly - much more quickly at first than using a command line interface. The problem is, at that point, you hit a wall. No doubt those operating systems are more learner friendly than Linux and the shell but once you learn the command line, it can be leveraged for all sorts of things and pretty easily at that - user friendly (see these posts for some examples: Shell posts).
This is important because we have our students use all sorts of tools and we should be thinking about things like usability but we really should be thinking about them a little differently.
First, is it learner friendly. Part of this is cost of entry. Linux has a high cost of entry. On the other hand, while Emacs might look uglier than other modern editors, the cost of entry is pretty much the same as any other editor - click or type a command and then you can use the mouse and drop down menus to get started. Vim, in my opinion, on the other hand has a higher cost of entry due to its modal nature.
So, there's no reason not to use Emacs (vs another editor) but you might pause before using Linux. My approach is to start as if it were Windows - use the gui, icons and menus, and then slowly introduce the command line.
Once your past the cost of entry, the we can think about being learner friendly. As I mentioned, Linux, not so much. Emacs, sure - just like any other editor with drop downs that then give you keyboard equivalents.
The keyboard equivalents lead us to another part of learner friendly – discoverability - can you easily discover new things about the tool. Here Emacs shines. Linux, maybe not so much.
Once past learner friendly we get to user friendly. The core question is "can I do what I need to and want to do easily." For most people, it comes down to - the tool I know is user friendly and the one I don't know and don't want to take the time to know isn't. There are some things that are cumbersome no matter what, but really, when we say user friendly, most people mean "what I like." To me, it's a little more - is the tool expressive and powerful as well.
So, why is this important? First, we shouldn't allow our biases to color the way we expose our kids to tools but at the same time, we should pay attention to learnability, cost of entry, discoverability, and indeed, true user friendliness.
|Low Power||High Power|
|Low Learnability||CP/M||Linux Shell, Mac Terminal|
|High Learnability||Windows / Mac OS GUI||Most editors, including Emacs|
So, let's stop with this "your tool isn't easy to use" nonsense. Any tool we don't know isn't easy to use until we learn it. Let's focus on the path to learning the useful ones.
I only learned about NYCIST last spring. They're the "New York Consortium for Independent School Technologists." They had something of an open house that I attended. I heard about them from friend and fellow CS educator Saber Khan.
Last Thursday I spent an afternoon and evening with NYCIST members for a discussion of the state of K12 Computer Science Education in the City.
Most of my work has been with public schools and most of the teachers I know, public school teachers so it was great to make new friends in the Independent school community.
One thing I realized during the evening was that NYCIST has a real opportunity to do something special.
In some ways, the public schools are leading the way in computer science education as a result of this administrations CS4All initiative but at the same time, public schools face some real challenges. While some "early adopters" have developed their own take on computer science education, by and large, CS4All is being defined and driven by few for all and, at least right now, the model seems to be the "a little PD and you're a CS teacher" model.
At the same time, standardized testing and teacher evaluations are pressuring schools, particularly schools of our most vulnerable students to push resources towards test prep in tested subjects rather than real education, including CS.
In this particular instance, NYCIST and independent schools can be what charter schools were supposed to be before they were corrupted.
Laboratories of innovation.
NYCIST has already gathered together interested parties and the independent schools aren't burdened by the weight of politically driven testing and teacher evaluation. At the same time, small class sizes and flexible models allow for innovation.
If they wanted to, they could probably create curricular and instructional frameworks for CS education and. dare I say it, share it back to the public schools.
I know I'm ignoring independent school politics and other issues that would prevent this from happening, but I just feel that if there's a desire to do so from a group like NYCIST, it could happen.
I'm looking forward to continuing to work with my new friends and if any of you are interested in finding out more about NYCIST, just tweet to Saber.
I don't know if my idea here will take root but if it does, I'd love to work with NYCIST to make something happen.
I've been meaning to comment on these tweets for a while:
I went to high school with some scary smart people. Never made math team. Didn't get into honors math. Thought I wasn't good at it.— Stanislav Nikolov (@snikolov) June 30, 2016
Stan, of course, is one of the most talented people I know.
It reminded me of a conversation I had with my colleague and friend Jim last year. I had just recieved an email from a former student turned friend. We were trying to find some time to catch up. I told Jim I had just heard from this young lady and Jim replied "I remember her, she's awesome. Really smart." I mention this because the individual we were talking about, while to us, extremely talented in addition to being just a terrific person spent much of her career living in self doubt.
Meantime, I was having a conversation with another friend and the topic turned to impostor syndrome and the desire to make it a thing of the past.
Problem is, I don't know if that will ever be the case. I'm approaching 50 and have a career of good work behind me but I still find myself questioning my credentials, work, and ability. Then I realized I wasn't alone when I read Robert Talbert's recent blog post about his going through the tenure process for a second time and "learning through this process that I have not outrun impostor syndrome and probably never will."
Stan's tweets tell part of the story. When we surround ourselves with smart, accomplished people, we sometimes feel we don't measure up. I've found that for the most part, the extremely accomplished people I've worked with are very unassuming and low key. They seem to operate assuming that everyone else is at least as capable and quick as they. I recall Paul Graham talking about this in an essay but I don't remember which one. The problem is, if you don't understand their sincerity, you end up feeling even more inadequate.
It gets worse when we start comparing ourselves to some unreal composite. I remember feeling pretty stupid back when I was younger comparing myself with others. The problem was that I clearly didn't measure up to the best math kid, or the best computer kid, the best fencer, the best violinist, etc. Now, the best math kid might have been a lousy athlete and the best fencer, a so so mathematician, but to me, I was comparing myself with this composite super human. No wonder I never measured up. Eventually, though, I realized three things. First, there's always someone better at something and always someone worse. Second, that's not the true value of ones worth as a person, and three, I bring some good stuff to the table and I should be (and am) content with that
So, I still struggle with impostor syndrome but at the end of the day, it just serves as a reminder to look back on what I've done and what I've learned in the process. I start out in question but in the end, leave confident. Maybe the trick isn't to eliminate impostor syndrome but rather to understand and contain it. We don't want to live in fear and anxiety but both are useful emotions when we control them and not the reverse.
It's probably good when we question ourselves and re-evaluate our positions - we just have to make sure as we're bringing new people into the tech fold that we foster acceptance and confidence and when impostor syndrome sets in that it can be channeled into a positive and not scare people away.
The day after Labor Day. The day NYC teachers traditionally return to work. For the first time in a quarter century, I'm not one of them.
Instead, I'm in the second week of Hunter College's fall semester. So far so good on that front. I'm getting to know my students, planning activities and overall having a good time.
But, I do have to reflect on some of the things I'm not going to get to do this week:
I'm not going to have the opportunity to be blindsided by a CS schedule made without consulting me or any other CS teacher and having to work frantically to fix it so that the CS teachers have the programs and rooms they want.
I'm not going to be able to have that panic attack when the NFS/NIS server isn't working and no one can log in.
I'm not going to sit through a mindless faculty meeting where nothing is really ever accomplished.
More seriously, I am going to miss seing my friends and colleagues after the summer and Thursday - the day the kids get back is always a thrill and I'm going to miss that.
In a way, I'm experiencing a version of what retired teachers go through. Many teachers retire in June but it's not until after Labor Day when the change really sinks in.
Soon, I'll start posting CS teaching content again but for today, I want to tip my cap to all the public school teachers in NY that are going back to work today and who will shortly be teaching their five classes of thirty four kids each 1.
also tipping my cap to my favorite TJ teacher who's students are back today. I got called to task for failing to mention her on my facebook shoutout.
I originally planned on do some videos on C++ development but I'm just not feeling it. Probably because I'm excited to be working with my new class and we're working in Python. We're not going to be using C+++ for a few months so I'll get to those videos a little later.
Today, I want to cover what I consider a leatherman or multi-tool for Emacs. Something that isn't perfect for any particular job but can get almost any job done: Macros.
In their simplest form, macros let you record and play back keystrokes.
The video goes over the specifics.
Here are the main functions / keystrokes.
This covers most of my use of macros but there's more. You can adjust or set the counter, edit old macros and there's even a way to have a macro pause for input in the middle.
Here are some links with more information: