On Whether I Prefer Vanilla JavaScript or Frameworks?
|

On Whether I Prefer Vanilla JavaScript or Frameworks?

Today someone on twitter asked this question, and rather than be reply: 320 of 10,000, I chose to write a blog post about it. The TLDR answer is Vanilla JS because if you learn how it works without the help of a framework you understand the language. This doesn’t mean that I don’t have an interest in learning to take full advantage of frameworks.


As I listen to JavaScript Jabber one thing is clear. Whereas if we listen to courses and twitter discussions we are tricked into thinking that we should either use React or Angular we see, through JavaScript Jabber that frameworks are as diverse as they are flexible. One app will be excellent for one type of task and another will be awesome for something else. If you spend time learning Vanilla JavaScript, and then you learn about the diverse choice of frameworks then you can either write concise and effective code that does what you need with little to no bloat.


I don’t want to just learn a framework and be inflexible. I want to learn how it works, behind the scenes. Before WordPress, I was learning about navigation using Server Side Includes and other such tricks. When I played with PhpBoards, WordPress, Drupal, Joomla, wiki software, and more I managed to use them as a user, and they did want I wanted, but I never looked behind the curtains so I could use WordPress, but I couldn’t create my own themes, etc, and to some degree, I still can’t.


I have spent time trying to make it so that I can share my instagram archive on my website without using Instagram, and I managed with WordPress. Recently I tried using Vanilla Javascript and I found manipulating the DOM to be challenging. This is precisely why learning to code with Vanilla JS is so important. It shows you the complexities, and with time you learn how things work together.


One of the jokes is that if you get stuck you should RTFM and with frameworks that’s often quite easy. With Vanilla JavaScript RTFM doesn’t mean read just one manual. It means read about a variety of concepts until you understand enough to get it to work by yourself.


So far I can show a random post after each reload, or show the ten most recent posts and their caption. The next three challenges are:


  1. Go through the posts at a time
  2. Add crud capability using JavaScript. At first I will try with an empty json file, and then move on. CRUD requires understanding of the fs library (I need to double check the term)
  3. Add the ability to transfer data from the json to an SQL or NoSQL database.
  4. Experiment with Houdini and responsive design with a wall of pictures.


We’ll see what else I can think of. The point of this is to take skills I learn in courses and apply them to a project without having someone else provide me with the list of necessary steps.


That’s it for now.

Learning About Service Workers

Learning About Service Workers

I am currently learning about Working With Service Workers. Service workers allow you to make a website faster, for those who visit a website more often, or offline, in situations where connectivity may be unreliable. Some of the code used can be found on my github page. MDN Web Docs also have useful information about working with service workers.


With service workers you can web first, retrieve from cache and stale while refresh:


  1. With the first option you visit a website and the cache is generated in case the connection is dropped
  2. With the Retrieve from cache it will access the files in the cache, before looking towards the web for content
  3. In the last case the website will load the content it has but will check for new content in the background.


With these three approaches, and with some experimenting you can speed up static websites, and make others available offline if needed.


Aside from helping you to save content locally service workers can also clean up after themselves. If your website is updated or changes you can give a new archive version number and tell it to delete all the others, for your own web page. I have played with static content and will explore more.


I took some time to practice the new skills I learned in this course on my own website, on the local machine. It will take some time to learn the intricacies of how to get this to work correctly. For now I am on a learning curve.


In the process of learning about service workers I also learned about manifest.json and web app manifests. “PWAs can be downloaded in advance and can work offline, as well as use regular Web APIs.”

Smart Watches – Dumb Habits

Smart Watches – Dumb Habits

When I wore Casio digital watches, Suunto Dive computers, Suunto GPS watches and other wrist wathces I was happy. You wore it and it tracked what you wanted it to track, from walks, to dives, to altitude changes, weather and more. With the Apple watch a new age emerged. The age of the Digital Watch as object of addiction. I don’t like the term addiction, but I use it for simplicity.


The Suunto Spartan Wrist HR I have tracks all day activity and I didn’t mind. It tracked it in the background but didn’t nag you to do more, or to get up every hour. You just got along with your life until you ended your workout and wanted to see a GPS track.


With Fitbit and with Apple watches you have the same invasive habit. Walk 250 steps an hour, stand for one minute every hour. They nag you. As if that wasn’t enough they also nag you to wash your hands for 20 seconds, and more. The Apple watch is too invasive to be pleasant.


One of my biggest frustrations is that although we have one phone each device now has an app, and the apps don’t speak to each other so you have to choose whether to wear watch A for App A, Watch B for app B or Watch C for app c. All of that data is centralised on Apple or Android devices but it doesn’t jump between them so you are forced to make a choice.


If you skip wearing one instead of the other you have a gap in daily data and this bugs me. I went from wearing a GPS watch to track workouts on weekends and evenings to wearing watches 24 hours a day, that all want you to be loyal 24 hours a day to have complete data.


For me to be happy every watch should be able to send the data from the watch to the app, and from the app to the phone, and from that phone to every other app. By putting the data in silos they force loyalty, but by forcing loyalty they tempt me to stop tracking steps, heart rate sleep and other things. They tempt me to wear a simple watch except for my daily walks.

A Home Made Valor Hot Chocolate

A Home Made Valor Hot Chocolate

There is a high probability that I will regret putting paprika into the hot chocolate that I prepared for myself. It says to use four squares per 200ml but I used just six for 500ml. I let it warm up and melt the chocolate for the most part before adding some paprika, to make a spicier hot chocolate.



I think I will find it far too spicy. We will see when I taste it. For now it has to cool down before I can drink it.


I like hot chocolate but hot chocolate is a pain to prepare, mainly because it involves heating milk and I’m afraid of letting it boil, and I don’t like the smell of warm milk. It also requires more cleanup than tea, but a different type of clean than coffee. We are in a pandemic, and we need to try new things, while waiting for Covid zero, that impossible dream.


Impossible because of the leadership and anti-facters, rather than because the goal is unreachable.

Become A JavaScript Developer Completed and GeoJSON

Become A JavaScript Developer Completed and GeoJSON

We’re in a pandemic, and it makes sense to invest time in learning. I completed the Become a JavaScript Developer course last night and today I played around with some code to see if it worked for what I wanted. It didn’t. I also listened to a live stream which discussed geojson, smapshot and other projects. I like the idea of geotagged data, and an open API to allow for the data to be shared more easily


I could see this as especially useful for climbing, hiking, archeology and other activities. This reminds me of photosynth, mixed in with photogrammetry and other technologies. When images are taken they are geo-tagged but another layer is added, by detecting the angle the picture was taken at. Whether it was looking down, up or in another direction. In other words in three, rather than two dimensions. This is great for modelling, but also for helping people get a sense of the images that they’re looking at. Climbing pictures, where we can see the upward or downward angle would be interesting.


It would also be fun to write a blog post, find the api information, and include that within a geojson file, to provide location info, angle, and other data. This data could then be ported from a photo app, to a hiking app, to a website and more. With more images 3d models become possible. Imagine gathering Via ferrata images and documenting the route.


Of course they can also use this for mapping glacier progress, or regression, coastal erosion and a multitude of other topics. I found this talk really interesting, and I see plenty of uses for such data.

The Day Switzerland and Denmark Decided to Ignore the Pandemic. This Isn’t Freedom, This is Exposure.

The Day Switzerland and Denmark Decided to Ignore the Pandemic. This Isn’t Freedom, This is Exposure.

Today is the day that Switzerland and Denmark decided to ignore the pandemic. They and other European countries have decided to lift quarantines, remove the need to work remotely and other such safety measures. Health indicators shows that there is a consistent rise in new cases in Switzerland and Denmark. They say it’s over but the graphs and data show that it is not.


https://twitter.com/EckerleIsabella/status/1488876782996631553


Switzerland says that since 90 percent of the population has been exposed to the virus there is no need to worry anymore. Several governments have just decided to wash their hands of the pandemic. This moment is insane. It makes no rational sense to just decide that a pandemic is over like this. I think it will come back to haunt these leaders. I want them to be held responsible for their decisions, several months or years down the line.


This is a frustrating moment because it means that Covid-zero could be years or even decades ago. Going to cinemas, to restaurants, to bars, to indoor events will always carry an inherent risk of danger. This isn’t like the risk of flu or a cold. This is a new disease that the current generation of politicians have decided to live with, rather than eradicate. Remember that the Romans drained the swamps of Rome to get rid of Malaria, so there is no valid reason for 21st century leaders to do the same with Covid-19.


This moment doesn’t make sense. It doesn’t make sense that politicians would choose to let people fall sick, rather than prevent it. It doesn’t make sense that they aren’t losing their jobs. If the 737 Max had its issues today, would anyone bother to investigate it or would planes have been allowed to continue to crash due to that issue with trim that was eventually fixed.


As a media student I have to ask, has the media landscape and the Fourth Estate, become so superficial that politicians, can act or fail to act, in impunity, without consequences for their actions or inactions. England, Denmark, Sweden, Switzerland and one or two other countries seem to have no Fourth Estate, to keep politicians accountable. It feels as if the Fourth Estate is failing in its democratic role, of keeping government transparent.


People are angry with what is happening. They feel that they have been failed by their governments. They feel that the governments could and should have done more during this pandemic to keep people safe.


That’s why I would like for leaders, during this pandemic, to be investigated for Human Rights violations. The right to health is in the UDHR and other documents. The Right to Health for Children is in the Charter for the Rights of Children. The pandemic isn’t over by a long shot, but in the meantime investigations should be mounted to investigate whether leaders behaved immorally, and if so to hold them to account.


We can’t control a pandemic, but we can control how we react to it once we have more information.


I just noticed that the idiots have used freedom day:


Les milieux économiques demandent un retour à la situation ordinaire. “La Suisse doit apprendre à vivre avec le virus, sans que les droits fondamentaux garantis par la Constitution ne soient restreints de manière disproportionnée”, avancent-ils, proposant à nouveau un “Freedom Day” (jour de liberté, où toutes les mesures seront levées).

RTS


The Freedom Day they speak of is not a freedom day. It is a day to ignore the danger posed by the virus, to risk an inordinate amount of people, to fall sick from Covid-19 at once.


From one day to the next the government has decided the pandemic is over. This isn’t a war. This is a pandemic. You don’t just sign a peace treaty with a virus. The virus will continue to pick us off until moral leaders decide to eradicate it.


I will conclude today’s post by saying that I am sad. I am sad that the government has failed us since June 2020 until today, and that as of today it has decided just to ignore the danger, rather than protect the society it is responsible for. I am sad that there is no end in sight for this pandemic, and I am sad that we have little hope of a normal life, unless we choose to ignore the risk. This isn’t freedom. This is exposure.

The Pandemic Groundhog Day – Sisyphean Life

The Pandemic Groundhog Day – Sisyphean Life

This week we have the pandemic Groundhog Day and this is the time when we will see if the Sisyphean life continues. Most of Europe is reopening, and although for those who have not read broadly about the pandemic rejoice, others do not. By deciding to reopen now, it is almost certain that next winter will be a pandemic one.


This is the graph for new cases for today. This is the context in which Switzerland is considering the reopening of society.


During the winter months we need to keep windows closed and we need to meet indoors because it is cold and, possibly, unpleasant outside. Being inside makes it easier for the virus to transmit from person to person so eradication is more of a challenge.


That is why it is a shame that European countries are deciding to reopen. By reopening now, when the virus is so virulent, they are condemning us to another winter of pandemic solitude. This is a deeply unpleasant thought.


There are discussions about doing away with Covid passes, about doing away with crowd number limits. It looks as though Denmark, Switzerland and other countries are deciding to just live as if the pandemic was over. I would rejoice, like others, if not for articles and snippets I have read. I have read that Long Covid affects the brain. I have read that Long Covid damages the lungs. I have read that Covid damages body’s ability to provide an immune response.


If we ignore the risk, then we can have a normal summer, yet again, but if we keep in mind that we are in a pandemic and that we could be disabled for life, from falling sick, is it worth the risk? At the moment I prefer solitude to being careless, but we will see how I feel by April when the summer sports begin.


These blog posts are for future generations, to understand the insanity of the current governments. We could have been out of this pandemic, if moral people had been in charge.

Keir Starmer’s Speech Today

This speech reminds us that English democracy is not gone, that there are moral people still around, and that we need to get the current Tory government out of power and go back to having leadership worthy of respect.


When you are at events you listen to speech after speech, and they meld into each other. Occasionally you hear speeches that stand out and are worth sharing. This is one of them. It reflects values that have recently been lost in several countries. We need to revert to good moral values. Pandemics are a marathon, not a sprint.


https://twitter.com/BBCNews/status/1488180224667832320