Tuesday, March 20, 2018

Static Cling

While spending time generating the basics of my recipe site (which will likely move soon - I'll update the address once the move is complete), I've been on the hunt for software engineering tools that will make its maintenance much easier.  As the site stands now, it's fashioned in a 1997 type of HTML and CSS only site that requires a lot of duplication.  For every recipe I create, I need to copy an old page, make the necessary updates to the page for the new recipe, proofread it to ensure I don't have any typos on the page, deploy it and view it to ensure it renders correctly to the user.

This is really error prone, especially with 52 recipes.  It also makes updates to the site extremely difficult, because if I want to, for example, switch the ingredients section with the instructions section, I have to make changes to 52 pages.

As any competent software engineer knows, we don't want to do this.  We want to follow the DRY principle (Don't Repeat Yourself).  The layout for the recipe pages is exactly the same.  The only thing that differs is the content.  So, if I can create a template for the page and render the content, I give myself a lot of flexibility and freedom from maintenance nightmares.  Turns out it's 2018, and this has been the core of web programming for the better part of a decade and a half. 

My preferred requirement is to keep the site static.  That means that once a user makes an initial call to the website, there are essentially no further updates required.  There's no data storage on the backend that the user needs to interact with, no middleware to call, no philosophies for caching data for speed, since the content has already been generated and isn't going to change.  By and large, a static website is not what the vast majority of the websites in the world are.  If you're running a travel website, for example, you'll need to call back to other systems to log users in, search flights and hotels, remember their preferences, and process their payments.

However, with a recipe website, where the content changes infrequently, we don't need to log users in (unless I begin offering premium content or sensitive content), and we don't need to process payments, a static website is preferable.  It's less maintenance, and, since it has fewer moving parts, more secure, both from my perspective and the user's.

So, then - a static website with some seemingly dynamic content.  Sounds like a job for Javascript!  I won't go into the details of how I selected a framework, but I eventually selected Vue.js for the job.  It's got a clean interface and would be able to help me follow the DRY principle.  Except that it also adds a lot of overhead to the site.  I'd need to install something called vue-router to make sure that I could create recipe content on the fly.  In order to use vue-router in a manner that makes it easy to read and write, I'd need to install a Javascript bundler called webpack. In order to use webpack, I need npm.  In order to make sure the Node version associated with npm was up-to-date, I'd need nvm.

So, then - a static website with some seemingly dynamic content.  Well, there's a much cleaner alternative that I'd only heard in passing - a static site generator.  The industry standard seems to be Jekyll.  It took me a little while to get into the groove, but the documentation is pretty solid and there's a ton of additional help online, which is great.  Unlike Javascript, which injects content into a template when a user requests a particular recipe, the site generator uses the template before I even post the content to create a bunch of seemingly duplicate pages.  From the user's standpoint, it looks like I am just creating tedious HTML and CSS pages, but from my standpoint, it's all done with a little code and is as easy, if not easier to maintain, than a Javascript based solution.

Wednesday, March 7, 2018

Random Meta Ramblings on Writing

As we're just wrapping up awards season with the Oscars, and it always seems that there's some movie (or TV series) that scores big in peeling back the layer of the entertainment industry and giving an insider's view to the masses, I thought I'd take the opportunity to write about the act of writing.

Of all my hobbies, writing in one fashion or another, is probably the one I've practiced the most.  When I was younger I wrote a few stories, but abandoned the practice due to a lack of self-confidence and the realization that I was going to have write some real crap and subject myself to honest criticism if I wanted to grow in that area.

Instead, I've channeled a lot of my writing desires into other areas of my life - emails, status reports, documentation, and - off and on - blogging.

Blogging, or consistently creating anything on a fixed schedule, has proven to be difficult.  Some days, the words flow easily, even when I think the topic is sparse.  My series of posts on beginning guitar is a great example.  I thought it was going to be one post with some general musings, and I realized that could actually be a series of about 10 posts (which I haven't completed, but that's a different discussion). 

Other days, I feel like I've got a really meaty topic, like the discoveries I made while starting my recipe site, and realize I'm struggling to compose my thoughts.

Still, other days, I have no topics nor any words to describe my non-topics and am left simply staring at a blank screen trying to come up with something.

But that's why I precisely like having a deadline of 1 blog post per week.  It forces me to write.  I know professional writers are much more intense.  I've read they often write 1,000 or 3,000 or some other arbitrarily high number of words per day, even if it's complete nonsense, in order to stave off writer's block.  This is my own version of that.  Of course I'm doing it on a 'public' stage.  My navel gazing is out there for everyone to see if they stop by, but it's a blog, so quality is expected to be a range anyway.

However, the fact that this is a blog leads to some interesting dilemmas.  If I never told anyone about this blog, chances of anyone finding it and reading it are low, even if it's public facing.  In that case, this is essentially just a diary.  I could write about all of my potential doubts, shortcomings, hopes, dreams, and character flaws and no one would really be none the wiser.  Of course, if someone does stumble across it, then my vulnerabilities are immediately on display and open for comment. 

Luckily, all commentary on the internet is thoughtful and sensitive, so I don't need to worry about some troll excoriating me for indicating that I have liberal leanings or bashing me as a know-it-all libtard for using the word 'excoriating.'

But all internet sensitivity aside, that's actually one of the beauties of the medium.  I've read articles indicating that we're becoming a lot more desensitized to others' points of view because we now have a gigantic universe where we can be anonymous assholes.  From my vantage point, I think people have always been this type of asshole - genocide isn't a new phenomenon, and many people are complete jerks when they're alone in their cars because they're provided with a pseudo-anonymity.  The internet has just unmasked these tendencies in us.

And, as stressful as it can be, it also provides a certain liberation - any random passerby can scribble "UR Blog Sux" in the comments section here, and regardless of how flawless my writing or my logic will continue to double down on offending me.  Because I know there's somebody out there willing to hate me simply because I exist, and I can do nothing to change their mind, I also have the freedom to write random, rambling posts and not have to worry about what the internet is going to think of me. 

Sunday, February 25, 2018

Building a recipe for a recipe site.

I started my latest incarnation of a recipe site today by finding free css to create recipe cards.  My first version of a test recipe is here.  I've still got some work to do, but I'm happy with the format of my page.  I've got some further ideas about how to take the existing idea and make it something that's more personal; that's more my own invention. 

I've given my recipe site a fair amount of thought for some time.  In one form or another I've been thinking about creating a website for as long as I've been trying to compile a list of canonical recipes for myself.  I could've simply added recipes to an existing blogging site like Blogger or Wordpress, but my intention was also to keep my programming skills sharp.

As it stands now, there's not really a lot of programming involved.  I'm just expecting to use html and css with a little bit of javascript (probably something like vue), but, as someone who's always been a backend programmer, it's a refreshing change.  The recipe card css I copied today helped me understand the subtle art of positioning items on a web page for maximum effect as well as help me with figuring out how to create background shadows that add some richness to the page.

As for the actual content of the site, it's a given that I'll post my 52 recipes here.  I've always assumed that I'd just take pictures of the dishes I make and post them alongside the recipes, but recently I've hit on a different idea.  Since I'm trying to bootstrap my drawing abilities again, I realized it'd be fun to draw the dishes I make, even if they're simplistic representations, rather than follow the common path of trying to capture the perfect food photo.

This also led me to another way to expand the content on the site.  In addition to creating a site where I have easy reference to my recipes, it's my intention to provide instruction to people who are interested in learning to cook with shortcuts that have worked for me over the years.  When I first started cooking in earnest, I encountered a lot of well meaning authors who provided a lot of complexity to the recipes I made without adding flavor, or in some cases, because I tried to follow the expert route before I understood the technique, ruined the dish or became too frustrated to follow through.  My hope is, in addition to creating illustrations for the food I'm cooking, I'll be able to do a passable job of creating some instructional material that may assist someone else in learning to cook.

Sunday, February 18, 2018

Cooking to Suit My Tastes

I've been in the process for, well, years, of compiling a list of staple recipes that I'm happy with making over and over again.  There have certainly been some go to recipes that I've revisited with high frequency, but I've never been able to compose a reusable set list that I can use with the consistency I desire.

There are a few reasons for that - first, I want to make sure I have a pretty wide list to choose from.  When I think about compiling a list, I think about it in terms of recipes I can make over the course of the year without getting bored.  When I first got out of school, I had a pretty set schedule.  Monday was fettucine with parmesan, dried basil, and canned tomatoes along with a baguette.  Tuesdays and Thursdays were some rotation of pastaroni.  I don't remember what the other nights were.  While I liked the predictability of the meal planning, the routine did get a bit tedious and the ingredients weren't the best I could obtain.  Luckily, at 21, my taste was pretty simple, so I wasn't lost in some sort of culinary Sisyphean experiment.  Now, assuming that I cook 4 times a week, which isn't unreasonable, 52 recipes seems like a nice round number.  That means I'd rotate through meals on a 13 week basis.  I also know that I'd likely eat certain staples - like cheeseburgers, pizza, and fried chicken sandwiches - more often than 4 times a year, so that leaves room for special dishes that may require more care or pair with special occasions. 

Second, I like preparing food in 30 minutes - 1 hour.  I don't mind if I'm active the entire time, but I don't really like doing a lot of prep work with a million ingredients simply to have a dish (especially if it's one I'm trying for the first time) turn out flat.  There are certain things I don't mind letting sit a bit - bread, for one, or chicken in brine - as the effort is minimal, and I simply need to remember to prep one small thing ahead of time.  In addition, though my taste buds have matured since 21, I don't think they have anywhere near the complexity that the taste buds of the writers for something like epicurious.com do.  I'm certainly not as simple in my philosophy as "I eat to live," but I'm not going to be able to tell if you swap out parmeggiano-reggiano with domestic parmesan.   I'm fine with this.

Finally, it has to be a recipe I like.  As mentioned above, I hate long, complex recipes that don't yield a good payout.  But I also don't want to slap mayonnaise on a bagel and call it eggs benedict.  Canned tomatoes are still a big staple of my diet, but I now make my own cheese sauce for macaroni instead of relying on powdered sauce from a box.  This, more than two previous points, has delayed me from compiling my desired set list.  It's literally taken me 15 years to find a blue cheese pasta that reminds me of one I had at a restaurant in Wisconsin when I was in my mid-twenties.  I'm sure that pasta wasn't what I remembered it, but I've finally found something that comes close to matching that memory, which makes me extremely happy.

I'm excited to say, as of this writing, I'm close to having my cherished 52.  I think I have about 42 recipes that I'm willing to make consistently and have quite a few leads on rounding out the list.  The benefit of cooking for the past 20 some odd years is I can pick out bad recipes or know how to modify them to suit my tastes without having to go through the hassle of having to make mediocre food several times over.  I'm not sure what I'll do once I settle on 52 recipes.  I'm pretty sure I'll try and expand the list to 104 for more variety, but I'll be able to feel a sense of accomplishment that I've met a goal I've been dreaming about since I added my first basil flakes to my first can of tomatoes.

Tuesday, February 6, 2018

A Defense of Philosophy in Under 500 Words

I was going to comment a bit on my experience with The Philosophy Book: Big Ideas Simply Explained in my last post, but got a bit carried away with my rant on expertise and the worship of it in our society instead.  So, this post I actually will talk about the book.

I'm not really going to talk about the book - which is a great, concise summary of several philosophers' major works, and as a result allows me to write this post - but rather my newfound exposure to philosophy in general.

As I'd suspect is also the case with most people, I've had some formal exposure to philosophy in my education and a lot of informal exposure to it throughout life.  We're still inundated with names like Socrates, Kant, Nietzsche, Sartre, and so on, often without knowing what specific contributions they made to the field.  I'd also suspect that most people have made (and continue to make) jokes about the employment prospects of philosophy majors.  While I'm not here to defend those prospects, I am willing to summarize my new appreciation and nascent understanding of the field of philosophy.

As someone who's historically believed heavily in the scientific method, I've been at least mildly dismissive of some of the work of philosophers when it relates to topics to why we exist and what our role is in the universe.  It seemed about as useful as polling people on whether or not they believe in gravity.  Even if the overwhelming number of respondents state that they're not in favor of gravity, it doesn't have any effect on the fact that gravity exists.

But, it turns out that the contributions of philosophers is much stronger than I originally allowed myself to believe.  Sure, there's still some navel gazing on the nature of our existence (or existentialism), but that scientific method I believe in - Francis Bacon created a first draft of it as part of his own philosophical theories.  The method of continuing to ask questions related to the outcome of an experiment? The Socratic method.  In fact philosophy, rather than disconnecting itself from the questions usually associated with science, has often been a precursor for strengthening the tools we use for making scientific discoveries today.

Even if you're not into science, philosophy still has a major impact on our world.  Love them or hate them, Adam Smith and Karl Marx are political/economic philosophers.  It's hard to argue that capitalism and communism have had no impact on everyone in the world.

And, still, if you're so inclined to believe that all philosophy is some sort of psycho-babble, enough other people are captured by philosophers' ideas - good, bad, or misappropriated - and incorporate them in their own lives (and sometimes as global policy) to argue that philosophy as a study is either irrelevant or losing its relevance.

Saturday, February 3, 2018

Expertise for Dummies

I'm about halfway through The Philosophy Book: Big Ideas Simply Explained.  When I started, I didn't realize it was a series of books, which includes topics on Science, Criminology, Sociology, and others.  I'm glad I didn't realize this, because I typically shy away from those types of titles for fear that content may not be sufficiently broad nor deep.  This is all the more curious, because I also tend to like titles that sum up obscure topics in more bite sized packages - The Annotated Mona Lisa being another summary title I purchased years ago and really enjoyed.

These types of summary pieces introduce me to concepts I don't otherwise take the time to create to delve into, but usually do so in a way that doesn't leave me underwhelmed.  I know by some measures, this plays into the Dunning-Kruger effect, but I guess after a month's worth of posts, that seems to be the main point of more than a few posts - is there a point to being good enough? 

For a while, a lot of people in my circles seemed to be fixated on the 10,000 hours needed for expertise as referenced in Malcolm Gladwell's Outliers.  I always felt a bit skeptical of the claim (or jealous, simply for the fact that I don't think I can spend 10,000 hours on anything).  It also pissed me off a bit because it taps into an American ethos that comes up short under close examination - if you work hard enough, you can achieve anything.  This aphoristic ideal ignores other factors like luck and talent.  In doing so, it hides the pernicious corollary - if you didn't achieve your goal it's simply because you were too lazy.

This has further social ramifications that have been encoded into American society that I don't want to delve into here, but as a simple rebuttal, given my genetic composition and my (at most) 5'10" height, there was absolutely no way that I ever was going to be a pro basketball all-star.  I'm sure someone will respond with the bitingly sharp "How do you know? Did you try?"  But yes, I'm sure. 

The real beauty to rebutting this simple, but flawed, rule lies in the fact that, if you can't devote 10,000 hours to being an expert in something, you can enjoy things that you can actually spend time on.  And rather than feeling guilty for the hard work you didn't put in, you can appreciate your accomplishments and the hard work you did put in for the task at hand.

Monday, January 29, 2018

Metablogging on a Monday Night

Since the reincarnation of my blog this year, I haven't quite decided what I want it to be.  When I first started this blog a few years ago, it was going to be a journal of my passage from software engineering manager back to software engineer.  That path lasted 4 months before I decided I'm a better manager and hired some of my old software engineers.

So, what then?  I know from a click bait point of view, my blog should focus on one topic.  And Lord knows, if I find a topic that I can concentrate on, I may start a sibling blog, but that's not the point.

Since my list of hobbies have expanded, so have the topics I'm likely to write about.  I've considered writing my own management manual to counter the condescending "people as resources" horseshit that's been present since time immemorial.  I want to write about my new musical rediscovery, my love of languages - even though I'm not fluent at all, my desire to still be a software engineer, my desire to draw again after 25 years.  I want to thumb my nose at everyone I've ever met who said "you get more conservative as you get older," as though being conservative is the more intelligent choice instead of simply the safer one.  I want to scoff at everyone who champions supply side economics and claims that "a liberal is just a conservative who hasn't been mugged yet" and attributes that quote to Winston Churchill (funny - between Churchill, Twain, and Wilde, there are apparently no quotes left).

I want to write short stories and serial fiction and essays.  I want to publish recipes that I've made and have people respond that I didn't do a good job in imparting the instructions, so I have I chance to make amends and take revenge on every shitty recipe I ever followed in the past thinking I'd done something wrong.

Most of all, I want to write.  I remember a commercial a few years ago featuring a girl who stuttered, but wrote on screen that she was at home with the written word.  I connected with that commercial, even though it was probably trying to sell me some sort of purchased happiness in the form of gay missiles for confused Nazis, but the message stuck.  I've always felt more comfortable writing than speaking.  The words flow easier.  I don't have to deal with some intellectual wit trying to one up me in a battle of extemporaneous speech.  I can simply collect my thoughts.

So, again, what then?  Well, I'm just going to write.  Sometimes it will be the 1000th post on what I'm going to write, sometimes it will be unabashedly technical, sometimes it will rant against the conventional wisdom society offers me that I'm coming to loathe, and, sometimes, it will be a guitar lesson even though I don't have the experience to give a guitar lesson. 

If you're lucky, you may even get post of mine that I've bothered to edit after writing, but don't count on it.