Posts

Adding SVG icons next to buttons

Image
 Putting SVG's of animals near buttons draws the eye to the buttons. The SVG's also look nice and are fun which is OK as my main page is a game. But some SVG's do not look clear at the small size needed to sit next to a button. The idea came from GIMP where the walrus mascot appears in the icons.  Also my old KDE desktop has a green dragon sitting above the letters 'KDE'.

Minifying SVG's myself

Image
 I remove unused 'id' attributes from SVG's I get from 'openclipart.org'. I say: '%s:id="[^"]*"::gc' in 'vim'. I leave in the id's for gradients and filters used within the SVG. I add a unique prefix to these id's so they do not clash with other inline SVG's.  I also remove 'label' attributes. I also remove 'inkscape' and 'sodipodi' attributes, and 'metadata' which is usually about the 'author' and license. I remove nearly all namespaces from the 'svg' tag. It seems these are not needed for my inline SVG's. But sometimes the 'xmlns' and 'xlink' namescapes are needed by the 'svgomg' online minifier if an 'xlink:href' is used later in the SVG, maybe to reference a color gradient. I also remove the version as apparently browsers do not use it. My 'svg' tag now usually only has the 'id' and 'viewBox'. I tried removing the...

Facebook login to hosting provider not work

Image
 I could not login into my hosting provider, Hostinger, with my Facebook login. Facebook gave the message: 'Facebook Login is currently unavailable for this app'. It seems this is because Facebook needs to verify Hostinger as a business. Codepen.io and Pinterest also stopped offering Facebook logins. When I created my acoount on Hostinger, I used a Facebook login because I had previously created an account with Hostinger using just my email address. I got around this problem by resetting the password for my email address on Hostinger. When I logged in, I could manage the website I had created with the Facebook login. Unfortunately, now when I login, Hostinger says this is a suspicious login and wants a verification code sent to my email address.   Instead I set up a login using my Google account.I used Hostinger's settings to set this up.

Payment declined for web hosting provider

Image
 My debit card company declined to pay a renewal of my hosting plan with Hostinger. The text message with the code did not come at all to start with. When the code came, Hostinger seemed to think the transaction had not succeeded. Then I got a text message from my bank saying they thought the transaction was a scam and asked me to reply 'Y' to confirm the transaction. But this was several minutes after the transaction seemed to fail with Hostinger. My bank said to first check my bank account to see if the money had been debited before trying to pay again. Hostinger automatically renews all its hosting plans. I found this out in the detailed terms and conditions. Maybe I had forgotten this or never knew. Hostinger had been asking me to update my payment details for a while and sent a email saying the auto-renewal would happen in a week or two, about two weeks before the end of my hosting plan. The terms and conditions said there was an option in the settings to stop the auto-ren...

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'