If you are using python packages like xmltodict or yaml, here is something to be aware of

If you are using python packages like xmltodict or yaml to write and read your own XML and yaml files, you probably don’t need to know this. But if you are reading someone else’s files, here is something to be aware of.

This week I had to process an XML files in python. No problem, I thought, I’ll use a python package like xmltodict to translate the XML into a dictionary variable. Then I could edit it and print out a new file with the changes. Sounds easy!

Well, first off, it wasn’t too easy: the nesting was horrendous. However, with some help from VS Code, I was able to power through and get the value I want.

Here’s where I got burned. I wanted to change the text in the XML file, so I had a statement like this to read it


mytext = python_dict["graphml"]["graph"]["node"][nodecount]["graph"]["node"][i]["data"]["y:ShapeNode"]["y:NodeLabel"]["#text"]

and then a simple statement like this to change it to lower text:


python_dict["graphml"]["graph"]["node"][nodecount]["graph"]["node"][i]["data"]["y:ShapeNode"]["y:NodeLabel"]["#text"] = mytext.lower()

Very basic.

Now this particular file is an XML file that has a graphml extension, which allows an editor like YED to read it. YED can read the original file, but it turns out xmltodict writes the file in such a way that the YED editor can no longer see the text. I don’t know why.

I spent hours working on it until I finally gave up. I wrote a much dumber program that read through the graphml file a line at a time and changed it the way I wanted to. No fancy packages involved. Dumb but it worked.

This is the second time this year a package has given me problems. In late January I wrote some code to parse yaml files for a client to extract information for them and to produce a report. Again, there is a package to do that: yaml. Which is….good…except when the yaml it is processing it is poorly written. Which this yaml was.

Again, I spent hours linting the yaml and in some cases having to forgo certain files because they were poorly constructed. What should have been easy — read the yaml file, transform it, write a new yaml file — was instead very difficult.

And that’s often the problem with yaml files and XML and JSON files: they are often handcrafted and inconsistent. They MAY be good enough for whatever tool is ingesting them, but not good enough for the packages you want to use to process them.

I think those packages are great if you are making the input files. But if you are processing someone elses, caveat emptor (caveat programmer?).

Things better on the iPad than my iPhone

Apple released it’s latest iPad (Pro) recently and whenever this happens people debate the value of the iPad in general and ask questions like: is the iPad worth it? 

I used to ask myself that question too. After all, between my iPhone and my Macbook, I thought I had all the computing technology I needed. But in the last year I got a new iPad — not even the latest and greatest — and I have to say that the iPad just does certain things better than either one. It’s especially better than my iPhone for:

  • Streaming video: Disney, Netflix, YouTube and more are all much better than my iPhone.
  • The library app Libby is much better, especially with the magazine section
  • The news sites like the New York Times and Washington Post are great on the iPad
  • Instacart: I can see more options when I order from it
  • Shopping sites like Zara and Uniqlo are better too for the same reason
  • X and other social media sites look great on my iPad, but not threads or Instagram because of some design ideas Meta has that are wrong.

And what I like about the iPad over my Macbook is a) there is no work apps on it so I don’t get distracted by work b) I can recline with the iPad (I don’t like doing that with the Macbook…it’s just no comfortable).

That’s just a start of my list.  I’ll keep updating this list for anyone debating getting an iPad. 

Restaurants loved and living: Okonomi House

I’ve been going to Okonomi House since the 1980s. And what has changed over the years is…nothing. It was great then and it’s great now. They still serve pretty much the same food now that they served then, with the crown jewel being the okonomi style pancakes like the one below.

They serve other things too, but for me that’s what I go for when I go in. It’s sweet, it’s savory, it’s delicious. Just spread that mayo dollop all over the pancake and dig in!

There have been changes, but they are very minor. Young people seem to run the restaurant now, and they have tweaked the menu and added new things. Gone is the cup of soup that I loved even though it was literally Cup of Soup! In its place is a classier miso soup option. They have a nicer bathroom also: no longer are boxes piled up in it. Otherwise, the place is timeless. I hope it never leaves.

For more on it, BlogTo has a review, here. Read that, then go. I went a few Fridays ago and it was packed at around 7:30 pm. The good news is table turnover is fast (and service is great), so if you can’t get a seat right away, just wait for a few minutes and you’ll be soon eating okonomi in no time. 

 

 

A haunting question

I came across this question when I was in a restaurant this week. I have thought about it often since I first read it.

By opening a door to anywhere, I also assume any time. Maybe you would walk through a door that would let you see a loved one again. You might choose to go through a door you skipped by when you were younger.

Or maybe you would stick to the present. You might want to cross a threshold to some place you always wanted to go. Or maybe you just want to use the door to exit where you are.

There’s also the future to consider. Do you want to go through a stage door of a famous theatre you might eventually perform in? Do you want to enter the Oval Office as president of the United States?  Maybe it’s simply a cottage you want to retire to when you get older.  All those doors await you.

With so many doors you could go through, which one do you choose? And why? 

As Monty Hall would say: pick a door. Choose wisely.

What we can learn from snack packs

These snack packs are amazing. Not because of the content, but because of the packaging the content is in. 

The content itself consists of 5 or 6 small crackers and associated morsels of cheese and meat that goes on top of them. If you are a food producer,  you could take slices of meat and cheese that are too irregular for your typical sliced meat/chese packaging, trim them, then put them in these things. Not only have you reduced your waste, but you have created a new product from it that cost the price of an entire package of sliced meat or of sliced cheese. Profit!

Whats sells the product is the package.  The outside emphasizes their convenience: Grab (and) Snack. Who has time to make and eat a sandwich? Not you! Plus if you aren’t going to eat it right away, your sandwich or your own cheese and cracker snack-pack could get soggy. Not these guys: each bit of food is in its own section, so everything stays tastier, longer. Even better, it’s not just ham and cheese and crackers: it’s dry cured genoa salami (exotic), part skim mozzarella cheese (lean), Bear Paws cheddar crackers (tasty). And it’s been inspected by the department of agriculture, no less, so you know it isn’t sketchy.

Let’s not forget the protein. Besides the emphasis of convenience, there is also the highlighting of how much grams of protein in them. 10g of protein is a good amount, and it is something I see online fitness promoting. (“It’s garbage if it has less than 10g of protein!”, some exclaim.)

I suspect these are meant to appeal to young adults who may have grown up and loved Lunchables and other lunch snacks. Hey, this product whispers, you can still have your convenient snacks despite being a big person. You can even have your bear paws crackers for the kid in you, while having dry cured genoa salami like you just picked it off a charcuterie board at a fancy restaurant.

Are these environmentally sound? Are they good value? Heck no. But capitalism is often about taking raw materials — in this case bibs and bobs of meat and cheese — and packaging it into something much more appealing. This product is capitalism at its finest, or worst, depending on your point of view.  

 

 

Scenius, or communal genius (with my own examples)

Scenius, that greater genius that comes from a particular community, is something I have thought about alot. If you haven’t heard of it before, I can recommend the following on it:

Here’s what I think are some great examples of it in the 20th century:

I am sure you can think of many more.

Each are great examples of very smart, very talented people coming together for an extended period of time. When they did, what they produced was special and associated with that community they were associated with. As the cliche goes, the sum was more than the parts.

This doesn’t mean you can only have genius appear communally. You can. If anything, that’s more of the norm. But when you have geniuses associating and working together, you have something really special.

Is there still a glass ceiling for Asian cuisine restarants in North America?

For a time in Toronto there were discussions I was following in various forums about the low cost of food in Asian restaurants. For example, people were asking: Why are Chinese restaurants so cheap in Toronto?  There were various reasons given, from “people don’t value the cuisine” to “it’s a form of fast food” to “racist attitudes and beliefs”. And this wasn’t just Toronto: you could see similar patterns in other major North American cities, from Montreal to New York.

It concerned me that this might be true. I knew Chinese and other Asian cuisine was just as sophisticated and varied as cuisines of Europe, and I felt North America needed more restaurants that reflected that.

Based on the latest list of the top 100 restaurants in New York (produced by Pete Wells of the NY Times), I think we have those restaurants. I went through this review by Eater of the list of the New York Times best restaurants list (2024) and I extracted the following info on Asian cuisine restaurants. Of the top 100 places, I made this short list:

  • Chinese: 5. #15 CheLi, #36 Szechuan Mountain House, #59 Great NY Noodletown, #68 Chonging Lao Zao, #84 Hakka Cuisine
  • Japanese: 4. #9 Yoshino, #22 Kono, #32 Shion 69 Leonard, #45 Raku
  • Indian: 4. #7 Semma, #54 Dhamaka, #80 Temple Canteen, #95 Hyderabadi Zaiqa
  • Korean: 7. #4 Atomix, #16 Jeju Noodle Bar, #30 Atoboy, #40 Okdongsik, #52 Yoon Haeundae Galbi, #77 Oiji Mi, #91 Mapo Korean BBQ
  • Vietnamese: 1. #20 Mam
  • Thai: 1. #29 Zaab Zaab

(The number after the cuisine is the number of restaurants (e.g. 7 places serve Korean cuisine). The ones in bold-italic are in the $$$$ price range, bold is the $$$ price range, and italic is $$.)

It’s not just one or two places, like Yoshino or Atoboy: there are numerous high end restaurants in NYC serving Asian cuisine from all parts of the continent.  There are everyday places like Temple Canteen and Great NY Noodletown, too, and I am positive there are tons of places serving great Asian food that is not listed in the top 100 that are still great. But Asian cuisine is no longer limited to restaurants in the $ to $$ range.

That is not just New York. In Toronto we have high quality and higher end Asian places like Sushi Masaki Saito, Aburi Hana, Kaiseki Yu-zen Hashimoto, Shoushin, 156 Cumberland, Indian Street Food Company, Sunnys Chinese, PAI, and more, according to experts like Michelin. I suspect it is the same in other North American cities too. It’s good to see and a good sign.

Here’s to more people gaining a greater appreciation for cuisines of all kinds, and here’s to more opportunities to experience that, be it in a small place in a food court or a grand establishment in a beautiful building. Cheers!

P.S. To see the entire New York Times list, go here.

 

 

A new form of hostile architecture: the chairless cafe / restaurant

According to wikipedia, “hostile architecture is an urban-design strategy that uses elements of the built environment to purposefully guide behavior. It often targets people who use or rely on public space more than others, such as youth, poor people, and homeless people, by restricting the physical behaviours they can engage in”.  Examples of this are ledges in cities with spikes or bumps on them so people cannot sit on them, or benches with extra dividers so people can’t sleep on them.

There’s a new form of hostile architecture that is subtler. I’ve noticed it has occurred after the pandemic. It comes in the form of fast food restaurants and cafes that make it impossible to sit and stay. As I noted in the photo taken above, Starbucks has returned to my area after closing up during the pandemic, but they have set up so it is next to impossible to sit and stay. They used to have similar places nearby that did have seating, but they’re all gone.

And it not just limited to Starbucks. A nearby McDonald’s had a place with seating and they stripped it all out and limited it to just a few stools. Likewise with the new Popeyes in the area.

What all these places want is take your money and move you along. While this may be good for them, the result is less places to get out and take a break in the neighborhood. Cities need more of these places, not less. Just like cities need benches to sit down on, cities need cafes and low cost restaurants that people can use to get out and see people and get a change in their environment.

I would advise you to patronize places that provide that experience and avoid places that do not. We need less hostile architecture in our cities, not more.

 

How often to check your cell phone plan (and other plans too)


We are often reminded to change our smoke detector batteries twice a year by basing it on some calendar event, like the equinox or at the start of certain seasons (e.g. Fall and Spring).

I recommend you do that for your cell phone plans and other plans from service providers you have. Especially with cell phones, you will find that new plans will come out that are better than your current plan, and a call to your provider can save you money and get you better service.

Go through your financial statements and look at all the service fees you are paying. Then pick some times on the calendar and at that time either cancel the service or ask them for better or cheaper service. Over time you’ll save money.

Homelessness and poverty in Nova Scotia and elsewhere


Nova Scotia: like many places in the world, Nova Scotia is struggling to deal with homelessness and poverty. There were a number of homeless encampments in Halifax, and the government took steps to deal with this, although not always successfully. The stories I have been following were around building new places to live and getting rid of the encampments, like these:


The rest of the world: while I was focused on what was being done in Nova Scotia, I also have been following stories on poverty and homelessness in the rest of the world

Finally: VOX had a good piece on how you can help others suffering  homelessness. And the New York Times has a section called Headway which is Exploring the world’s challenges through the lens of progress and touches on homelessness and other social issues.

P.S. Remember, the problems of poverty are simple and solvable. Also, homelessness is a concurrent disorder.

Joan Didion, and why you should write

In the 1970s Joan Didion wrote:

I write entirely to find out what I’m thinking, what I’m looking at, what I see and what it means. What I want and what I fear. – Why I Write (essay originally published in the New York Times Book Review in 1976, here)

I think it is a good reason for all of us to write, regardless of our level of skill. I think I am going to be adopting that more, here and offline. I would hope the same for you, even if it is a matter of making notes in a composition notebook or a scribbler.

Writing as thinking. Not only deep thoughts, or correct thoughts, but thoughts in general.

A great collection of Joan Didion in her own words from the Guardian, here.

To stay focused, set 5 min timers and log

If you’re like me, you find all the screens and tasks you have to deal with make it hard to stay focused. I don’t know how many times in the day I find myself forgetting what I was working on until I look at a particular screen or a piece of paper and think: oh yeah, I was doing that! (Its bad.)

I have recently came across a trick to help me focus. It’s a simple trick: I set a short 5 minute timer. When the timer goes off, I write down what I was just working on. I find this helps me from getting too distracted. Then I go back to my master todo list I refer to in order to make sure the things I am writing down are aligned with what I want to be doing. Finally I set another timer and try and focus on the next task I should be working on.