Posts

Falling asleep while coding

Image
 I try to move around if I am falling asleep in the evenings while coding. At first, I wrongly tried having a nap. I drink lots of decaffeinated tea when coding.  Normal tea makes my anxiety worse. I tried hot milk for a while. I like Yorkshire tea.

Setting the 'class' of an SVG element

Image
 I could not set the 'class' of an SVG element using the 'className' property in JavaScript. For example:     var bfyvSVG =              document.createElementNS('http://www.w3.org/2000/svg', 'svg');     bfyvSVG.id = 'bfyvSVG';     bfyvSVG.className = 'bfyvSvg-defs'; One answer is to use 'setAttribute':     bfyvSVG.setAttribute("class","bfyvSvg-defs"); I found the answer on 'stackoverflow.com':     stackoverflow.com/questions/37943006/unable-to-change-class-name-of-svg-element For an SVG, 'className' means something a little different. I could have used 'className.baseVal'

Draw ellipses with 'border-radius'

Image
 You can draw ellipses and other curved shapes by giving two values to 'border-radius' in CSS. For example:      border-radius: 50% 49% 40% 40% /                     45% 45% 45% 45%; The first set of values are horizontal radii and the second are vertical radii. This is used in a Github icon that I adapted. See:       https://codepen.io/Bert-Beckwith/pen/yyNYeZm The border-radius value above is used for the head which has an 'aqua' color.

Old copies of Progressive Web Apps

Image
 If a webpage is a 'Progressive Web App' (PWA) then someone may have an installed copy of the webpage that is old. I copied some images into a sub-directory to try to speed up the access time. But I cannot remove the original images from the top directory because an old PWA might use the original images. So it is just a little bit slower accessing the new copies of the images in the sub-directory. I tell Chrome the webpage is a PWA by registerng a 'do-nothing' service-worker.  Chrome warns about having a 'do-nothing' service-worker as it needs to be loaded which takes time. 

One-person projects

Image
 I have been developing my game for fifteen years. I only spend a few hours a day on it, at most.  I mostly add animations which are fun and where you can soon see the results. In the early days I had a clear objective: to learn the language and have something to show for it. Now, I do it because I find it calming. The editor of 'osnews.com' said that most people working on one-person operating-system projects lose interest after a few years.

Document relations in HTML

Image
I have added 'next', 'previous', 'author' and 'license' document relations to the 'head' of my web pages. For example, I say:     <link rel="next" href="https://bbingo.xyz/credits/"> My very old browser shows these 'document relations' in the browser's main menu.. I do not see any modern browsers showing these 'document relations'.  Google search does not seem to use these 'document relations' either

Mistaking accessibility styles for an error

Image
 One day, my browser showed pages with little color and thick outlines. I thought maybe my computer had finally stopped working, or that I had deleted a shared library the browser uses. In fact, I had accidently turned on an accessibility stylesheet option!