Category: Longform
You are viewing all posts from this category, beginning with the most recent.
Walking the Walls of Dubrovnik
Walking the Walls of Dubrovnik
After a beautiful sailaway in venice we traveled to Croatia where our first stop was Dubrovnik. This is a beautiful small city built into the hills on the coast of the Adriatic. Our goal for seeing Dubrovnik was to walk the walls of the old city. The walls are still intact (although patched in places) and provide some pretty amazing views of the harbor as well as the town.
You will notice that all of the homes in the picture have the same red clay tile roofing. But if you look a bit more closely you will see that some of them are quite new and bright while others are old and moss covered. Sadly the new tiles vastly outnumber the old, and are an indication that the house was bombed in the war in the 90’s.
After walking the wall, which is about 1.2 miles we were a bit thirsty so we found a bar, literally through a hole in the wall. It was shady and we had a wonderful glass of the local white wine and just enjoyed watching the ocean and chilling out. As you can see from the picture, the tables and chairs are scattered over the natural rock formation and so the waitstaff had to be quite agile.
Later that night we had reservations in Prime C, one of the great specialty restaurants aboard the Journey. As we were getting ready for dinner we got to enjoy a spectacular sunset from the comfort of our deck on the back of the ship.
We have had great meals aboard the ship in Aqualina and in Prime C. Last night was even better as we were able to attend the Chef’s table. Where we had an amazing meal with wines that had been paired with each course by the sommelier. The menu consisted of Lobster and Avocado Salad with Honig Sauvignon Blanc, Smoked Tomato Veloute with Conundrum White blend, Surf and Turf Giant Prawn with a Braised Short Rib Croquette) with Schug Pinot Noir, then New Potato Crusted Sea Bass with Lincourt Chardonnay followed by International Cheeses with Toad Hollow.
Lake Como by Lake
Lake Como by Lake
The conversation started like this:
Incoming: Robert, I am not available now, and I have a funeral to go to at 4, but I can meet at 5:15
Me: Sorry, wrong number no robert
Incoming: Oh, Thanks
Incoming: Did you want a boat?
Me: Yes, I had called about a boat, but I talked to Moreno
Incoming: OK, you better give me the time and details because he will forget.
This is was that our reservation to rent a boat to take around the lake on our own was confirmed with Julia.
The next day we picked up our little 16 foot boat with a 40HP Honda engine at 11AM and after confirming that I had driven a boat before I was given very brief instructions, the location of life jackets, and off we went. It was a great way to see part (a very small part in fact) of the lake.
We cruised by the villa used in James Bond’s Casino Royale past the town of Magnerre by many other villas and great lake front property.
rest and relaxation on lake como
After cleaning up the flats and saying our goodbyes to all of the students Jane and I are now comfortably ensconced in Villa Monte right outside the small town of Varenna on Lake Como. We will be here for a couple of days before driving to Venice and boarding the Azamara Journey for an eleven day cruise through the Greek Isles.
By design this part of the post-Malta holiday has been to read and relax, so there’s not a huge amount to write about. But Lake Como is so beautiful that it is worth posting a few pictures from a short hike we did yesterday and some pics of the lake taken from the terrace of our apartment.
We are not in heavy sightseeing mode, just a few hours each day. The rest of the time we are relaxing and eating and trying some Italian wine. Thursday we are renting a boat and taking to the water on our own. It makes me miss my Moomba very bad, but it will be great to get out on the water and view some of the huge villas on the lake from the water side.
saying goodbye to malta
These are my shoes. I bought them for the great adventure of 2015, I started to wear them on January 1 when we left the USA. According to the health app on my iPhone they now have 647 miles on them. Much of that has been accumulated during our time in Malta and our travels around the Mediterranean with Angel, Ben, Emma, Erika, Ethan, Jenna, Katie, Meredith, Meredith, Olivia, Rachel, and Tricia, hereafter known as our kids, or our Malta students. What started out as a funny offhand comment, referring to Jane and I as Mom and Dad has come to feel more true over the few months.
I’m starting this post on our penultimate weekend with our group, I am in Rome with Jane and Josh to take in an AS Roma football game tonight. Some of our students are in Florence for the Nordic choir concert, and some of them are back on Malta (behaving themselves). Its good to have a bit of physical distance to help put things in perspective.
I have also been reading each student’s final journal or blog entries, and I must be turning into an old softie (good thing I have the summer to fix that) but I find myself choking up about something that each student has written. It is true that these past few months of living and traveling together have turned us into an odd sort of family. I’d be happy to adopt them all if I could get that guy in Marrakesh to make good on his offer of 20 camels apiece. I’ve spent a bit of time lately looking back over all the pictures we have taken. I put together this gallery of our group photos. If you look at the first group photo in Malta and in Rome, and compare that to the last group photo this week, can you see the difference? Look at the group in front of the pantheon, this group was just getting to know each other, barely acclimated to the Mediterranean time zone. Now look at the later photos, photographic evidence that we have come together as a family.
So, what have I learned about myself this semester? What are my own conclusions? This heretofore unpublished entry written in Cambodia sheds a bit of light on the recurrent theme of living simply.
Conclusion number one: I can live a more simple lifestyle and live “in the moment”.
As I read over my early posts, and remember back to the end of January when we first arrived on Malta, I am going to admit that the following thought crossed my mind: Leave this flat NOW, and check-in to the Meridien until it is time to fly home (business class). I am very glad that I did not do that. Living in the cold, damp, drafty, loud, and then warm, humid, dusty, loud, almost-but-not-quite-a-place-I-call-home has been an important experience. Now that the end is in sight, I am glad that I had the experience of these last four months.
The elves at Amazon.com must be worried about me, as I haven’t ordered anything from them since December! I have lived with the same ten shirts and six pairs of pants for the same period. Other than going out to eat the material expenditures we have made so far this year are extremely minimal. OK, I am not totally reformed as I have a new Apple Watch waiting for me back home. But it was a good experience for me to not consume for a while. Hopefully this will carry over back home where the temptation of Amazon Prime second day delivery makes the accumulation of stuff all too easy.
What does it mean to “live in the moment?” For me it means accepting life as it happens. It means taking the time to enjoy each moment as it comes along, rather than always thinking about what is coming next. Because I have not had daily class responsibilities, I really have been able to live in the moment for most of the last four months. OK, I am still a worrier; I am always thinking about the worst case scenario, and what to do if said scenario becomes reality. I am a planner, and a goal setter, I am always thinking about next week, next month, When will my next exam be? What do I need to do for class next week? But this semester I haven’t really had any of that to think about. I did worry about some parts of our travel (Morocco, Istanbul…) But, our evening meals were typically planned at about 15:00 when I walked to Meats and Eats to buy whatever we were going to make for dinner.
My time during the day was spent walking back and forth to the University. I have subscribed to several podcasts and am now a regular listener to them. I’ve never had time for podcasts before. I don’t know why. I spent time in class, listening and soaking up lectures on Maltese history and current issues. I spent time in our flat, and in my office at the IT Faculty building sending countless organizational emails and working on projects and hacking.
Conclusion number two: Follow your passion.
While this may not be a discovery of the semester, it was certainly a strong affirmation of this oft espoused philosophy. I like to tell the students in Senior Project that: “If you don’t wake up in the morning thinking about what you want to accomplish during the day, you ought to be thinking about finding a new job.” Now, showers aside, I think that every day in Malta I did wake up and have a great excitement about what I wanted to accomplish during the day. Some days it was the excitement of a field trip, other days it was waking up in Morocco or Istanbul know that a day of discovery was in store, but even on the rainy days of February I had research and thinking to do that was very exciting.
In fact maybe one of the best things about our time on the island was that it gave me time to think. I spend a lot of time doing back home, and it is hard to carve out time to really step back and rethink things. Good things happen when you take the time to think instead of do. I feel like all of the projects I have been working on Skulpt, Runestone Interactive, and the classes I will teach next semester have reaped the benefit of taking time to think.
Conclusion number three: Push yourself outside of your comfort zone, good things will happen.
I have written a lot about pushing myself beyond my comfort zone in the last six months, but it has been very exciting to see the students do likewise. They have all grown this semester, becoming more self confident, more self reliant, and maybe more willing to take a risk. Whether that be jumping off a rock into the Mediterranean, or immersing themselves in other cultures. For me it may have been simply embracing my part-time role as a student of history and current issues of Malta this semester that pushed me to a new appreciation of history and culture. It was also surely the experience of living in a flat that is much less luxurious than back home.
Conclusion number four: Be thankful for the people who support you.
Jane and I joke that we are excited to get back home so that we have more adults to talk to. Not that our students are not adults, but we don’t have the same conversations with twenty two year olds as we do with our fifty year old friends. In some ways this has been a bit of an isolating experience for the two of us. But we have grown used to it. The silences are OK, as we know we simply don’t have anything else to say at the moment.
But, through it all Jane has been a fantastic partner in keeping this program working smoothly. The work she has put in on our travel plans is, extremely detailed, thorough and time consuming. Planning a trip takes patience and hours of research. I know I appreciate it and so do the students. It always amazes me when we arrive somewhere and she knows exactly where to go and which direction to turn, while my head is swirling in confusion. My advice to Ethan and Ben is to follow my lead and “marry above your station.”
I would also like to take this opportunity to publicly thank Corby Preus and Jon Lund in the Center for Global Learning back at Luther for all of their support. Corby does an amazing job of helping with paperwork, and re-answering my questions about pretty much everything she has already explained to me at least once, and sometimes twice.
Here in Malta I would like to thank Dr. Emanuel Buttigieg for coordinating the History of Malta course, I know I have learned a lot this semester, and it takes a lot of coordination to organize all of the lecturers from many different departments on campus. And finally to Rachelle Mifsud for whom there is no request too large or too small for her to help out with. Scheduling transportation at the last minute, or helping with final exam schedules. Thanks!
Conclusion number five: Focus on the good
I think this is a nice one to save for last, and it is a fairly recent conclusion, and clearly one that will take some practice for me. The last Paideia lecture we did an exercise where we had to think about Malta from the perspective of each of our five senses. What stands out:
-
sight – yellow limestone buildings, dog poop on the sidewalk
-
sound – honking horns, the “angry” maltese language
-
smell – Pizza and the salt air
-
taste – Maltese wine, Wild Boar Pasta
-
touch – rough limestone, and cold tile
Many of us commented after class about how negative most of the things we came up with sounded. Even though the native Maltese professor came up with his own similar list. Familiarity breeds contempt as the saying goes?
But I think the important lesson was summed up by a couple of the students in their own final blog posts in which they said. “I do not want to remember Malta for the dog poop on the sidewalks or the horns honking outside my bedroom window” Rather they , and I, will choose to remember Malta for the good stuff: The crystal clear water, the blue waters of the Blue Lagoon, St. Peter’s Pool and Golden Bay, the majestic cliffs of Gozo as viewed from the Ocean or the cliffs of Dingli from the land. The Neolithic temples of Hagar Qim and the mysterious Hypogeum. The beauty of the Auzure Window. The brightly colored Maltese boats in Spinola bay. And, yes, the ever present yellow limestone of Sliema and Valletta. This is the way to remember Malta.
Don’t sweat the small stuff my dad used to tell me. Let the unpleasant annoying pet peeves fade away.
Not Goodbye
Although this will be my final post from Malta, this is not the end of the blog. In less than a week, the students will be on their way either home or to european travel for part of the summer. Meanwhile Jane and I will be finishing up our own Mediterranean experience with a few days in Lake Como and then a Cruise from Venice down the Dalmatian Coast and through the Greek Isles, ending in Istanbul. We planned this as a celebration of the end of our time in Malta, and I’m sure it will be, but right now we are both facing this last part of the journey with mixed emotions. The call of home is very strong, and I know that if we simply boarded a plane to Minneapolis we would be ecstatic. But the comfort zone of home will have to wait another twenty days. Its really not all that much when you consider we have been gone 159 days already, and more adventure awaits us, you can be sure I’ll continue to write about it here.
cooking in malta
The first thing I should say about cooking in Malta is that there are around 600 reasons not to cook within walking distance. Some of our favorites are:
-
Guzé — OK, I love Pappardelle with wild boar sauce. I could eat this once a week.
-
Pepperoncino — The Rosettes (little bowls of pappardelle and proscuitto cooked in cream sauce) are to die for. Plus a totally small town friendly vibe that you just can’t beat.
-
Piccolo Padre – Eat pizza right out over the water. Diavola yum!
-
Wigi’s Kitchen — You can pick your fish or your steak right at the table. The window seats have an awesome view of Balluta bay.
-
Kebabji. – The students introduced us to this one. I think of it as “the chipotle of Sliema.” My favorite is Chicken-shish with Tabbouleh, Hummus, Couscous, Harissa, and Sesame sauce. Actually its the only thing on the menu I’ve ever ordered, but why mess up a good thing.
I’m going to divide the rest of this post into three parts, that roughly describe the three stages of cooking I have gone through here. I call them:
-
Subsistence cooking
-
Getting over it, and getting on with it
-
Grilling season arrives
Subsistence cooking

So, I admit when we first got here, I went through a bit of culture shock. As I’ve mentioned before, it was colder inside our flat than it was outside, and it was rainy, and dreary most of the time. Our kitchen was, and still is, tiny and isolated from the rest of the flat. The cutlery was dull, and the pots and pans old and dented. We must have set aside 50 knives and a dozen pots and pans from the three flats to be disposed of.
We made our first trip to a grocery store called Lidl, a german chain. All of the ingredients were labelled in anything other than language. There was little produce or fresh meat, and it was nowhere near our flat. Next door to us is a small corner market, at the cash register is a young boy who ought to be in school but never is. They have produce outside, but no fresh meat, and a totally random selection of dry goods. There is a large supermarket about 1km away, and it has a lot of things. Going to the Park Towers supermarket for the first time was like an adventure. Taco shells! A butcher, a cheese counter with Parmeggiano Reggiano, hot sauce, spices, asian ingredients.
The first meal we cooked in the flat was a grilled cheese and ham sandwich. Not regular ham but delicious prosciutto ham, and tomato soup. Sound familiar? I’ll bet that is the first thing that many people learn to cook. I’ll bet it was two weeks before we cooked an evening meal in the flat. In part because going out for dinner meant that we had some place warm and heated where we could go for a few hours before coming home and huddling under our covers. The first true good meal I cooked was this pesto with chicken. We quickly discovered that we don’t care too much for pesto in a jar even this close to Italy. We also learned that vegetables and fruits are much more seasonal here in Malta than in America. So we had to wait a few weeks before basil came into season to make a good home made pesto.
Getting over it, Getting on with it
Eventually, the temperature warmed up and we got more comfortable with our surroundings and we reached the point where we could not stand to eat out anymore and so we started cooking in the flat more. One of my goals was to learn at least one new recipe while we were in Malta. I figured it would be so me kind of seafood, but it turns out the Maltese don’t really eat that much seafood despite living on an island. After our trip to Rome I realized that what I really wanted to cook was spaghetti carbonara. For some reason I have missed out on this delicious yet simple dish my entire life. This is one of those simple yet delicious Italian dishes. Eggs, wine, noodles, cheese, and good cured ham or bacon. I have been making steady progress on mastering this dish, but I still have a ways to go before it will live up to that first night in Rome.
The second thing that made a turnaround in our cooking was learning to shop. Now there are four places that are worth highlighting.
-
O’Ryan’s on the corner
-
The college street mini market (the green market)
-
park towers supermarket
-
Meats and Eats on Dingli
-
all the vegetable trucks
Let’s dispatch with Park Towers first. Big, indifferent to rude staff, distant. Shopped there a couple of times and decided not to go back. Jane has been back a couple of times to stock up on cleaning and bathroom supplies, but we don’t shop there anymore for groceries.
The corner store is great for water, limoncello, Pringles, and the occasional need for baguette and salami. It’s about double the size of my living room, but packs in all of the essentials including frozen meats. The owner and his family run it together. Nine times out of ten when you go in there you would think that the mother is on the verge of killing the father or the son. Or it might just be that most Arabic conversations still sound like arguments to my western ears. Much of the time the cash register is “manned” by a boy who clearly should be in school but is not. I suppose he will inherit the store and so is learning the trade and the family does not feel the need to send him to school.
The green market is much larger than the corner store, and has great fresh baked bread every day. They have a reasonable selection of fruits and vegetables out front, along with canned goods and other essentials. Most of the time the cash register is manned by an old man who has never once rung up an entire order correctly, but he is charming and friendly every time we go to the store.
Meats and Eats is probably the single best thing that happened to my cooking during our stay in Malta. The store is bright and clean and staffed by a bunch of friendly Italians. The meat counter is a joy to visit almost every day. It’s the kind of meat counter wher they have several big hunks of ribeye, originating from around the world, and they Will cut you off a hunk of whatever thickness you like. They also have marinated pork and chicken and fresh minced beef and pork. The rest of the store has great gourmet ingredients as well as some nice convince items like prepared curry sauce. The cheese counter has huge chunks of parmigiana reggiano at a ridiculously low price. Next to the checkout counter is a wine selection that is just about as good as anything you can find in Malta.
I knew that I was going to have a great time shopping at Meats and Eats the morning I decided to give carbonara a try. I went to the meat counter to get some bacon and had the following conversation:
Clint: Sorry sir, we only have streaky bacon today.
Me: Uhhhhm streaky bacon? Ahh, the stuff that just looks like regular bacon to my eye. What’s the difference?
Clint: Very thin, not the good cured pork belly.
Me: Oh, well I’m just experimenting with carbonara sauce so I think the streaky bacon will work.
Clint: Oh no sir, you should not do that. If you are doing carbonara you need the good bacon or one of the packages of pancetta in the case over there.
Oh yes, agreed the lady standing next to me at the counter. Now I am left wondering how I will find this wonderful chunky pancetta back home.
Another thing I’m excited about continuing back home is fried spring rolls! Jane and I had lessons on making these in Vietnam, and were excited to try our hand on our own. When I discovered an Asian market on my walk to school I knew this would become a reality in Malta. Shopping in the Asian market is like Christmas, I see all of these cool exotic ingredients and I want to get them and try them out. Fresh lemon grass, six different kinds of fish sauce, Hoisin, Sirachi, you name it. Now the key to good spring rolls in my opinion starts with the wrapper, and I definitely like the frozen wrappers much better than the dried. They are easier to work with and I like the texture of the end product better. With a little more practice I’ll be ready to challenge my friend Nancy to a Spring Roll Throwdown!
A Sunday morning expedition to the Marsaxlokk (Mar-sa-shlock) fish market provided an opportunity to learn how to fillet and cook fresh caught sea bass. There are many other types of fish available at the market as well, but Jane and I had both watched a you-tube video on filleting sea bass, so that was the direction we went. The market also has huge king prawns, but taking the head and legs off the prawns is a lot of work for my lunch. One thing that amazed me about the fish market was that it was not the least bit fishy smelling. In fact other than the fish market in the middle of Gzira I have yet to walk along the sea here in Malta and think, oh fishy, or ocean. I guess it goes with the crystal clear water.
One thing that we have really had to work on is finding variety in our diet. Back home we enjoy the cuisine of many different countries all in the same week. Tex-Mex one night, grilling the next, indian or Thai curry after that, italian, vietnamese, pot roast in the crock pot (an American Tagine), you name it, we like our variety. Making tacos is definitely a comfort food that we miss. The ingredients are just about impossible to find. Sour Cream and creme fresh are not the same, The salsa here on the isaland is just not up to par. Finding taco shells is possible at the Park Towers supermarket, but you have to go there to buy them. Then there is the beef, or what the British and Maltese call mince I suppose that if you look at it objectively mince is no worse of a word than ground but having grown up with ground beef, minced beef sounds a little disgusting to my ears.
The other odd thing is the lack of soups. You simply cannot buy cream of mushroom anywhere! So we have gone six months without one of the staple comfort dishes of my entire life, namely beef stroganhoff. The availability of wonderful Parmiagianno Reggiano makes risotto a good comfort fill in, and here we run into the lack of chicken stock. I suppose I could, and should, make my own stock but that takes advanced planning. I’m used to just grabbing a carton of stock from the coop to make my risotto. Here it appears that boiled water with bullion cubes, or a little container of gelatinous chicken stock substance that you disolve in water takes the place of a good stock. It does the trick, especially with a little extra Reggiano.
And finally a word about wine. Maltese wine is surprisingly good, and incredibly cheap. While many of the students pride themselves on keeping it under 3 euros a bottle, I have found many good wines for under ten. My favorites are:
-
ISIS, a rather unfortunate name for a wine in this day and age, but it really is my favorite
-
Maltese Falcon
-
Marsamena – a delicious chardonnay from Gozo
On the subject of wine I would be totally remiss if I did not mention our local wine shop. Owned and run by a young man from the south of France, Vini Culture is a fun place to stop in on my way home from school, or to just run around the corner and grab a bottle for happy hour. The young guy who runs the store is extremely friendly and pleasant. I never stop in there without having an enjoyable conversation about wine and France and all the new things he has on order for us to try. Its hard to understand how he makes a living in a specialty shop like that in the middle of Sliema but I’m happy I got to know him and shop there.
Grilling season

And suddenly grilling season was upon us. The roof was a much sunnier and less windy place. The sun was starting to stay out until a reasonable cooking hour. Meats and Eats has a wonderful pork steak marinated in mediterranean spices, and we can grill that and serve it with some roasted new potatoes from my Sicilian vegetable man. Some fresh baked bread, and some spinach salad with strawberries and vinaigrette dressing.
The Sicilian vegetable guy, I have no idea what his name is, is another great story. Since meats and eats does not sell vegetables, I just walk another half block to this guys fresh vegetable truck. I know he thinks I’m kind of odd because I usually come in and buy one hot pepper, six small potatoes, or one head of garlic, depending on what I need for the evening meal. Its not usually much, and it almost always under one euro.
One day I was buying a pepper and an onion for a total of 40 cents, I had forgotten to put change in my pocket before I left the flat. As I struggled to find some coins and then started to pull out my wallet for a bill he said “listen, don’t worry, you can pay me tomorrow.”
Grilling season brought with it much more than an opportunity to stand on the roof and cook meat with a drink in my hand. It brought a huge transformation in the weather, and consequently my enjoyment of our time in Malta. No longer did I get out of bed in the morning and wrap myself in multiple layers of clothing, no longer were we huddled in the front room, door closed, heater running in order to feel comfortable.
I miss my Hasty Bake, and its ability to cook and smoke meat slowly, but this little gas powered grill has brought a lot of enjoyment. Meats and Eats sells Kobe beef patties, as well as Ribeye steak from five different countries, including Australia and Ireland. It has been fun to try the variety. They have chicken marinated in three or four different marinades an so that provides us with a great variety of things to try.
It is certainly true that you can learn a lot about a culture by its food. Malta is definitely no different. The Italian influence is obvious in the pizza and pasta restaurants that are everywhere. Their national dish of Pastizzi is not my favorite, but has certainly become a cheap lunchtime staple for many of the students. The traditional Maltese foods include rabbit, which is also quite good – especially the rabbit pie at Guze – and some other stuffed meat dishes. There are turkish kebab and pizza places everywhere. We think its an odd combination, and we wonder about all the kebab joints. I think it must have to do with the influence of the Ottoman empire on the island long ago, but I may be completely wrong. In general, it is a diet high in carbohydrates, which works for me, but drives Jane crazy. Jane and I had one of those funny conversations back in January, where the question was if you had to give up variety, and live with one cuisine, which would it be? Both of us chose Itialian or Vietnamese as our top two. Then I was leaning toward Italian, but now I am looking forward to more of the fresh healthy variety offered by the Vietnamese.
adventures with flask-cors
-
I want people to be able to write and host the static parts of any book on any server. You can think of each page in a book as its own single page application.
-
I want to provide back-end services so that students using any book hosted anywhere can save their programs and answers to quizzes etc.
-
I want to continue to gather research data on how students learn computer science.
-
I want to make the registration and login process as easy as possible.
Since the static parts can be hosted anywhere (including a site like interactivepython.org) The interactive parts are going to involve making cross-domain XMLHttpRequests (xhr). Of course the first thing that happens when you have a page hosted on static-site
that makes an xhr request to ajax-server
is that you get an error. Browsers and sites work together to disallow cross-domain requests to prevent a variety of nasty behaviors. But, there are many times (wlike now) when you have a legitimate reason for doing this. So, the w3c created the Cross Origin Resource Sharing (CORS) standard to help developers get around this. Cory Dolphin has created an excellent plugin for Flask developers called Flask-CORS. The plugin is a great example of the brilliant design behind Flask and in fact the entire WSGI stack.
The Really Simple Approach
The first thing you find when you start googling about this problem is that there is a seemingly simple solution. If you have control over your AJAX response you simply need to add an HTTP header Access-Control-Allow-Origin: *
problem solved. Now everyone in the world can make xhr requests to your server and use the results in their page.
Adding a header is pretty simple in Flask. All you need to do is use response.headers.add("Access-Control-Allow-Origin", "*"
Problem solved, moving right along to the next programming challenge.
Or maybe not. Minutes later you realize that this is not all that great because you have decorated some of your requests to require a login. That wont be a problem if the static page is served from the same domain because you will automatically get the session cookie, and the Flask-Security extension will eat that cooking and validate things for you. BUT if your static page is not served from the same domain you will not even get the session cookie. Oh Bother. But you also have a second problem. You have probably violated the CORS specification without even meaning to. Really, if I had to read the spec for every web standard I wanted to use I would seriously think about changing careers. But, here is the important part you may not return a CORS header unless the request contains an origin header! Chances are you tested you change with a quick curl
call to your endpoint, saw the Access-Control header and were happy. But you sure didn’t give it an origin header on the request when you did that. So to summarize, we have two problems we need to solve:
-
We want to incorporate authentication into our cross origin strategy.
-
We want to be good citizens and follow the spec.
The Smart Approach
The smart approach is to use a nice extension where other people have figured this out, and presumably followed the specification. Enter Flask-CORS. You can enable CORS support with a simple decorator @cross_origin
This will automatically add the Access-Control-Allow-Origin: *
to responses. As long as your test request includes an Origin. If you are like me you will forget that part, and then wonder why the extension must not be working. So this solves problem 2.
To solve problem 1 here is a snippet of code that works just fine.
@ajax.route('/ajax/page')
@login_required
@cross_origin(supports_credentials=True)
def test():
return jsonify({'foo':'bar'})
The above responds to the url /ajax/page
I have all of my API calls in an ajax
blueprint with ajax as part of the url. I’m requiring that the user is logged in before I allow them to access this endpoint. I also want it to be allowed cross origin. This is where the parameter to the @cross_origin
comes into play. Supports credentials sets up the CORS response to return an additional CORS header: Access-Control-Allow-Credentials: "true"
. For one final twist, you need to know that when you have supports_credentials=True
you may NOT set Access-Control-Allow-Origin: *
You need to be specific and set the origin to the origin that comes in the request headers. To Make this work and try it out from the client side, here is a bit of HTML/Javascript.
<button onclick="corsTest();">TestCORS</button>
<script>
function corsTest() {
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.onload = function () {
alert(xhr.responseText);
}
xhr.onerror = function () {
alert("error");
}
xhr.open("GET", "http://example.com/ajax/page", true)
xhr.send()
}
</script>
Note that you need to set xhr.withCredentials
in order for your session cookie to be sent along. By default cookies are NOT sent with cross origin requests.
Now, I may end up adding more to this as I discover the intricacies of so called “Non-Simple” requests. That is requests beyond simple GET and POST, as I work on moving my API toward a RESTful API which uses PUT and others. This will nodoubt enlighten me about preflighted requests. Which I can only assume means something different than sitting around in an airport bar waiting for your flight to be called.
There is a lot more detail and background on using CORS at the following two sites:
unexpected adventures

Morning Climb to Castelmola
Since the students were planning on sleeping in this morning, Jane and I decided to explore on our own a bit. High above Taormina sits the little town of Castelmola. You can’t drive there, you have to climb. And so we did. But when we arrived in the little town we were rewarded with a spectacular view up and down the Ionian coast.
After enjoying the view we decided that a Cannoli and Cafe were in order before we started the hike down. At the end of one small street we found the perfect place. Maria, the proprietor of Gallo Cedro was cutting tomatoes on the terrace. “Prego,” she said by way of invitation to come in and sit down. The Cannoli’s were first rate. She stuffed them fresh for us and added some chocolate chips and pistachios to top off each end. Perfecto. We were about half done with the Cannolis when she unexpectedly appeared with two shot glasses and a bottle of almond wine. Well it was only 10AM, but we figured when in Sicily… So we had a little digestif to help the cannolis go down.
Gole Alcantara
We returned to the Lemon Tree (the name of our apartments) around 11 and everyone was out of bed and getting themselves awake for the day. We had some discussion about what we might do this afternoon. The gorge, known as Gole Alcantara, sounded like an interesting short hike and there was enthusiasm among the group for a stop at a Sicilian winery.
We made our way to Gole Alcantara and after making a donation to the parking attendant we set out on our short walk down to the gorge. It was beautiful. Of course many of our “kids” wanted nothing more than to play in the water which was quite a problem since we had not brought beach towels or anything for them to dry off with.

As we enjoyed the area, we checked our email to see if we would be able to visit any of the wineries. Unfortunately none of them could accommodate us that afternoon. So… We decided that we could do our own wine tasting back at the Lemon Tree.
Red and White
The wine tasting preparation required another stop at the supermarket where we put a strict limit on the price of wine to be purchased for the tasting. Our goal was to keep it under 100 euros while recognizing that with 13 people each of us would just get a taste of each different bottle. It was quite the production to get six of us to agree on what wine to select. I will say that the Italian construction workers who were supposed to be building another set of shelves in the middle of the aisle we fairly amused/distracted by the blonde haired blue eyed wine aficionados.

While we were in the wine aisle another group was in charge of meat and cheese and fruit. As you can see we put out a pretty good spread. We also agreed that we were “in for the night” as there was no way we were going to drive our mini-vans down or up the winding hill to the Lemon Tree after wine tasting activities.

The wine and cheese went remarkably quickly. Even with a seventh inning swimming stretch between the reds and the whites. I guess it was inevitable that after a bit of wine, some of the people were going to end up in the pool fully clothed.
With the reds, gone, people were in the mood for movies or whatever, and then “the munchies” set in. We had been told that there was at least one Pizzeria that would deliver all the way up the hill, and that Paula would take care of calling and ordering for us. After much trying however it was determined that the pizza places were closed on Monday night. The horror and sorrow of a hungry group of students without pizza. We were totally resigned to a pizza free night when Paula knocked on our door to inform me that the pizzas had arrived! We were saved. And for some reason she was convinced that the students needed a nightcap, and so brought them a complementary bottle of home made limoncello!
climbing mount etna
The van arrived right on schedule, 4:45 AM, and we were all in the courtyard in front of the flat on Triq DePiro ready to go. This is our last group trip together with the Malta students, Spring 2015 edition. It is a bonus trip in the sense that because Jane saved us a bunch of money by doing so much planning for our trips to Rome, Morocco, and Istanbul, that we were able to afford the plane tickets and lodging to get everyone to Sicily. Of course with budget travel comes early morning flights, but nobdy seemed to mind very much. We were, after all, heading for Sicily. What nobody guessed was that we have a distinctly non-budget view from our lodgings for the next three nights!
The flight to Catania is ridiculously short is is just over 100 miles and takes less than 30 minutes, we barely got above 11,000 feet before we started our descent. Our departure time was so early that once we arrived in Catania we had a good hour to wait before the rental car agencies opened up. Yes, we are driving in Sicily. Its part of the plan to keep costs low for this trip. Two mini vans for the group. The plan for the day was to meander our way north to Taormina stopping along the way at Bronte to sample some Pistachios and at Randazzo to check out lava as a building material in a Medieval town.
The highlight of the day was to do some hiking on Mount Etna. It is amazing that there is still snow on the volcano in mid-May and even more so when you consider that the volcano is quite active right now.
We started out together as a group and enjoyed the break from the busy urban vibe of our home in Sliema, stopping for a group photo in this cool clump of trees:
Eventually the group splintered with varying degrees of adventurousness, and an unfortunate bruised thigh for Jane due to a loose rock. Some of us persevered up the side of the volcano until the winds became so strong we thought we would blow away. Climbing through the lava is a lot like climbing up a giant sand dune. It is very hard work. It also reminded us of the scenes of Frodo and Sam climbing into Mordor in Return of the King. As we were scrambling our way up, a helicopter flew overhead and hovered over us for a few minutes. I think we all expected to hear a loud voice tell us to turn around and get out of there, but I guess they decided we were harmless and not in harms way as it soon moved on. After we reached our goal we were tired and happy to be there if only for a few minutes to enjoy the view.

If you look close, you can see part of the group on the plateau in the middle right of the picture.
As we began to descend our shoes soon became filled with sharp little pieces of lava. This made the descent quite painful and necessitated a few stops to empty the shoes. At one point I was really glad Emma was standing behind me as she remarked. “I wonder who’s glasses these are?” Of course they were mine having just fallen out of my pocket as I was emptying my shoes. That would have been a loss, and impossible to find one pair of transition lenses hiding in miles of black rock.
enjoying island life on a warm may day
Every day is a good day when you are on a boat, in the beautiful blue Mediterranean. After a bit of a mixup on the bus this morning, we got to spend 4 amazing hours with Captain Franz on a boat trip from St. Paul’s bay to Gozo to Comino. Complete with caves, and cliffs, and swimming. Click on the thumbnail below to see the photo gallery for today.
The bus mixup is amusing now that I look at it a day later… We had arranged for van to pick us up at 9:00 to bring us up to St. Paul’s bay. But after waiting and waiting I finally connected with my contact, Rachelle, at the University who handles all our transportation scheduling for us. It turned out the bus company had screwed up the schedule for the day. The solution was to send a coach. The only other vehicle available and in the area. No, not one with horses, a giant bus. Wait by the corner we were told. Oooops wrong corner. More delay. Imagine the 14 of us on a coach that could easily hold 60 people. So we made it to St. Paul’s in Style and in the end were only about 35 minutes late. Thankfully Frans was a very patient captain, and it was no problem to extend our time in the afternoon to make up for our lateness.
writing a runestone lab the easy way
As part of the grand reorganization of the various tools and software associated with the Runestone Interactive project I am planning to also write a series of tutorials to help people get started. The major aspects of this reorganization are discussed in detail in the Project Roadmap, but for the sake of some context I can summarize the major efforts as follows:
-
Separate the distribution and development of writing tools from the server.
-
Make a pip installable runestone package.
-
Remove the interconnectedness between the components and Sphinx. In other words support the user of runestone tools in environments like Markdown, and even wysiwyg html editors.
-
-
Re-architect the server side focusing on services for the writing tools
-
Create an authentication service that supports CORS for cross domain AJAX use.
-
Create a standard REST API for logging and storing student data
-
-
Create a web application (or integrate with another) for grading
Since I just completed Part 1.1 I thought it was a good time to talk about how easy it is for you to now use the runestone tools for creating a lab for your students, or lecture notes and presentation materials for your class.
Getting Started
The major steps in getting started are
-
Installing Python
-
Installing the runestone tools
-
Building your first lab
Install Python
-
If you are on a Mac you are already done with this step.
-
If you are on Windows you will need to go to Python.org and download Python3.x. The windows installer is a typical installer and you can just click your way through it.
If you are an advanced Python user you may want to may want to create a virtualenvironment
for this project but it is not a requirement.
If you are on Windows you may want to edit your PATH environment variable following the instructions here. Again, mac users can ignore this.
Installing the Runestone Components
You are going to need to use the command line for the rest of this tutorial, so start up a Terminal (/Applications/Utilities on a Mac or run PowerShell or cmd.exe on Windows) I will repeat myself here. These commands need to be run from the command line, not from the Python shell.
Run the pip
command
$ pip install runestone
Or on Windows if you have not modified your PATH try:
C:\\Python34\Scripts\pip.exe install runestone
From now on I’m only going to give the Mac way of running the commands. If you are on windows you will need to add C:\\Python34\Scripts
to the beginning of the command and add .exe
to the end.
You can watch as a lot of text goes scrolling by. But as long as you don’t get any errors you should be good to go. You only need to do these first two steps once. Once you have installed Python and runestone you will not have to do it again.
Starting your first Runestone Project
Here is a session of me on my computer creating a simple project.
$ mkdir mynewproject
$ cd mynewproject
$ runestone init
This will create a new Runestone project in your current directory.
Do you want to proceed? [Y/n]: y
Next we need to gather a few pieces of information to create your configuration files
Project name: (one word, no spaces): myhello
path to build dir [./build]:
require login [false]:
URL for ajax server [http://127.0.0.1:8000]:
Your Name [bmiller]: Brad Miller
Title for this project [Runestone Default]: My Hello World
Log student actions? [True]: False
Done. Type runestone build to build your project
At this point you will have the following files and folders:
mynewproject/
_static/
_sources
_templates
conf.py
pavement.py
-
The
_static
folder is for things like images or javscript files. -
The
_sources
folder is where you will put your own writing. To start with there are a couple of examples files for you. -
The
_templates
folder is for styling. There is a default set of templates that match the runestone interactive look and feel. That is a good thing to start with. Once you become more familiar with the system you may want to customize the templates or even make your own. -
The
conf.py
file is used by Sphinx, and contains information from some of the questions you answered when you initialized your project. -
The
pavement.py
file is used for building and setting build parameters.
All of these files are important, and you should not delete any of them.
Next run runestone build
This command will create a build/mynewproject folder with an index.html file in it. If you want you can now run runestone serve
and then go to your browser and open up the following URL http://localhost:8000/index.html
Yay! You have a webpage. Feel free to explore a bit to get an idea about some of the components you can use in your lab.
Writing your Own Lab
OK, lets edit _sources/index.rst
Initially it looks like this:
=====================
This Is A New Project
=====================
SECTION 1: Introduction
:::::::::::::::::::::::
Congratulations! If you can see this file you have probably successfully run the ``runestone init`` command. If you are looking at this as a source file you should now run ``runestone build`` to generate html files. Once you have run the build command you can run ``runestone serve`` and then view this in your browser at ``http://localhost:8000``
This is just a sample of what you can do. The index.rst file is the table of contents for your entire project. You can put all of your writing in the index, or as you will see in the following section you can include additional rst files. those files may even be in subdirectories that you can reference using a relative path.
The overview section, which follows is an ideal section to look at both online and at the source. It is pretty easy to see how to write using any of the interactive features just by looking at the examples in ``overview.rst``
SECTION 2: An Overview of the extensions
::::::::::::::::::::::::::::::::::::::::
.. toctree::
:maxdepth: 2
overview.rst
SECTION 2: Add more stuff here
::::::::::::::::::::::::::::::
You can add more stuff here.
If you are not familiar with markup languages, this file should still be quite readable to you, and you can probably easily guess what most things do. Runestone uses a markup language called restructuredText. There is a very nice, short tutorial here.
To give you an idea of what you see in the example above, the section that starts with .. toctree::
is called a directive and it creates a table of contents for you. the maxdepth
part sets the table of contents to show sections and subsections. And the line with overview.rst
indicates that it is a file that should be included in the overall web page. More on all of this later. Our first task is simply going to be to wipe everything out, and start over. Using a plain text editor change index.rst to look like this:
=============
My Sample Lab
=============
Part 1: Turtle Graphics
=======================
In this section we will do the following:
* Create a turtle
* Make the turtle draw a box
.. activecode:: turtle1
import turtle
timmy = turtle.Turtle()
for i in range(4):
timmy.forward(100)
timmy.right(90)
Now it is your turn. Can you modify the program to make timmy draw an octagon instead of a square?
Now save the file and rerun the runestone build
command. Everything should build without a problem and you can now run runestone serve
and open up http://localhost:8000
from your browser. Notice that you can change the program and rerun it right from your browser.
It is probably obvious that you can create headings and subheadings. Unordered lists are created using *
and the runnable code examples are created by the .. activecode::
directive. The name turtle1 must be unique on the webpage, other than that it is not used for too much at this point. The rest of the activecode directive contains plain old python code, but it must be indented to line up with the a
in activecode.
All indented lines are included as the body of the activecode directive, regular text processing starts at the first unindented line.
There you have it. You have created a very nice little lesson without a lot of hassle. The Runestone and Sphinx tools take care of all of the formatting for you!
Giving Students Browser Access to the Lab
If you have your own webpage hosted on a school server that you normally use for class you can make your Lab available to the students by simply taking the folder mynewproject
inside the build
folder and putting that on your website. The folder is self contained and can be hosted on any web server.
If you know the IP Address of your own computer and you simply want to give let students bring up the webpage from your computer you can do that too. For example, lets suppose you know that your IP address is 10.0.0.23
Your students can get everything they need from http://10.0.0.23:8000/index.html
Coming Soon
There are many free web hosting solutions out there and you can also choose one of them and upload your project folder for hosting there. I’ll cover at least one of them in another tutorial. In fact I think I see a whole series of tutorials in the future on topics such as:
-
Making an online quiz for class
-
Making a lecture or presentation
-
Hosting your lab or quiz on github pages or another online service
-
Using your lab with runestone services