I just wasted my evening

The most annoying thing while writing a script with JavaScript was to find out that I could not do what I wanted to do. I wanted to open 3 random HTML files within iframes. These files were in another directory and not in the same directory as the script was in.

I searched with Google, but got pretty frustrated with the results I got. I kept getting solutions for server-side scripts and using node.js. To top it all was the kind of comments people received for their seemingly stupid questions and answers not reading the rest of the question after the first line.

Asking a fellow human if it were possible to do what I had wanted to do, gave me hope. When I researched/ran his suggestions, they went sour. Once I found out that you cannot list files in a folder using javascript locally, I knew what was next. Filling a short script with over 900 lines of iFrames.

My next best solution was to list the files seperately in an array instead of populating the array with the list of files within the directory.

I thought of how easy it would be if I had Linux and make use of ls, awk and vim.
I quickly installed a VirtualBox and installed Ubuntu which happened to be downloaded in 2016. Started it up, downloaded the directory via FTP cause Windows sucks at the whole file sharing between our computers. Yes, I have a FileZilla FTP server installed on my Windows machine.
I proceeded to ls the files into a file, awk a column into another file and then use vim and a macro run till the end of the file to create the line in the format I needed for my script. I then brought the file back into windows to paste the lines into my script and run the random.html in my browser to see 3 random posts from the posts directory.

For reference, these were the commands that I used:

ls -xl | awk '{ print $9 }' > ../html-list.txt
sudo apt-get -y install vim
vim ../html-list.txt

Then I remembered a DOS command and how to send the result to a file as well as NotePad++ which supports macros!

Again for reference, these were the commands that I used:

F:
cd 3Nov2016\Downloads\c...1119b\posts
dir /B > html-list.txt

In the end I could have saved 30 minutes of download time, 2 minutes of command line and 2 minutes using FTP.

Here’s to pasting 938 lines into my HTML file’s JavaScript: Weeeee!

I cannot believe that I did all this because I was avoiding having to write about my piano career and restore a few instruments. It is amusing to note that I have not slept well since I stopped avoiding my computer after nine at night. My brain wants to finish what I started when I’m doing something like what I did this evening. Oh wait. I did this last night.

I am also thinking about whether I should go out to celebrate the New Year or just go to bed early. I have never had the confidence to go somewhere new before I had been in the Piano industry for a few years, going to clients and interacting with them.

Early this year I went to a loud techno-trance music concert, armed with earplugs. That was a daunting experience, but I did it alone. I had no other person going with me. Would it be a good idea or a bad idea to go again to a party of some sort alone? I do not have a boyfriend or a girlfriend to come with me. The perks of being single I guess?

To end off this awkward early morning post, I think I will mention that I need to play with the clay and microphone I bought. I also desperately need to find the motivation to start exercising so I can lose my layer of fat on my tummy. I also need to complete the cleaning task I started and finish my writing before the end of this year.

Quick fact, I can not be pinched cause there’s something about my skin that prevents this from happening. Now friends, please do not try this on me. I might hurt you. For me it is worse than being kissed. I love hugs, but kisses are not my thing. Hug me instead because hugging is like pinching a person whole. You would be pinching the person with both arms or just one of them.

Quick question:
Does anybody else get annoyed with the new block editor?

I’m really annoyed at how you cannot get away from…paragraphs, the cursor jumping back to the start of the block at random while typing or navigating text, no chance to underline text and block quotes are really awkward!
I don’t like quotes compared to verse

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.