Programming · Websites

Tempted by Static Pages Again

I recently started learning how to use emacs, which is a text editor and a Lisp interpreter. During my quest for resources, I came across a number of developers and their blogs. Since I’m always intrigued by what sort of tools developers use to make their blogs, I did a little snooping. A shocking number of people who didn’t use WordPress as their blogging platform opted for flat files instead.

Now I had dabbled a little bit in static pages before with BoltWire but ultimately abandoned it to go back to WordPress. I think where I went wrong with BoltWire was that it simply did not have a big enough community (although they are an extremely dedicated community) to keep me reassured that I had made the right choice.

However, I know flat files in general is a real and upcoming thing. Since I’m planning to use emacs and Markdown files as my main way of documenting things, it would be easy to use it in my blogging as well.

So my main reasons for switching to a flat file system:

  • Better security
    WordPress was giving me so much trouble when it came to security. Yes, Jetpack did help in reducing spam and MySQL doesn’t randomly stop working anymore but you have to admit that using WordPress on a Digital Ocean server makes you a target.
  • Version control
    Yes, WordPress does have versioning for content however it would be much easier to have version control for settings, themes, etc. over the WordPress kind.
  • Less bloat
    I don’t need everything that WordPress offers and honestly sometimes I feel like it might be a bit overkill. Since the server I’m on has limited RAM and disk space, I need to be careful about the amount of resources I use. It helps that I don’t have many visitors to begin with but still!
  • Faster loading times
    While I’m unsure if this is too much of a concern for me but loading times do make me a bit worried. Fetching from a database can be quite slow.
  • I want a more future proof blogging system
    There are options to export your content into XML files in WordPress however it can’t beat readable Markdown, which many static file systems use. The fact that everything is file based is future proof in itself. Migrating from one server to the other wouldn’t be too much hard work.

My concerns:

  • What comment system to use
    I do not like Disqus. I dislike the fact that I have to register for yet another site and people can’t click on my name on a comment and go directly to my website. I also don’t like the fact that the comments don’t stay on my server. I want to be able to have my comments.
  • Learning curve
    This would be a little more technically involved at first to get everything installed, just due to the nature of it not being a one-click install.
  • So many choices!
    There is no shortage of flat file systems out there. Like I’ve said, I’ve dabbled in BoltWire before and wiki systems but it’s so hard to find one that will work for you when there’s a breadth of options.

One of the main frameworks I’ve been looking at is Hugo which is used by Baty.net, Modern Emacs, kieranHealy.org, but she’s a girl…, and more. I am very attracted to this option because it seems like it could work pretty well with an emacs workflow.

Thankfully, I finally recovered my previous website, erzadel.net and now have access to my old blog posts. I’ll be tinkering with that this weekend and try to have a clone of my old blog up and running on my local machine. We’ll see how it goes!

Crochet · Programming

Starting a Nanodegree at Udacity

While I’m still looking for a job this summer (which is almost halfway over already… Blah!) I took a cue from Y who started to work on some side projects and I decided to be a little more productive. Since I have a free month of Udacity from the GitHub Student Pack. Udacity is basically an online learning hub where you can take courses that are related to the tech field.

Since I am an aspiring full stack web developer, I decided to go with the appropriately named, “Full Stack Developer” Nanodegree. I am probably around 20% completed the degree and it’s been pretty much a week since I started.

So far I have done some basic Python programming and responsive web development. I didn’t learn much with the Python programming part because it was all very basic and I’ve done a lot of Python programming. Basically I made a movie trailer website that is composed of static web pages generated with Python. The web pages are composed of movie trailers that are pulled from The Movie DB using their API. You can check out an example here or take a look at it on GitHub.

Right now I’m working on a responsive web design. It’s taking a little bit more time because I’ve been busy the past couple of days. I had my first counselling appointment with a new counsellor, went to some Stampede breakfasts, and hung out with family and Y. But I think I’m pretty much done it all except for making sure everything complies with Udacity’s style guides. I keep tripping up on them wanting being lowercase instead. It’s hard to break old habits.

One thing I really like about their format is that there are a lot of videos. That way I can take my time to weave in ends for my temperature blanket that I’m working on. July is turning out to be a rollercoaster for weather. I had my first solid colour square the other day. It was pretty rainy on that day which explains why it was so much cooler. Now the rain spell has mostly ended and we’re back to low 30s weather. I don’t know which I prefer the most…

A post shared by Edel Altares (@edelgraceme) on

Programming

Udacity Programming Fundamental Lesson 5: Take a Break Mini-Project

Seeing that I am now unemployed and have a lot of time on my hands, I decided to utilize the free month of Udacity I received from Github’s Student Pack.

This mini-project’s goal is to create a simple program using Python to open a web browser at an interval of ten seconds three times in a row.

Here is my answer:

import time
import webbrowser

break_duration = 10
break_num = 3
break_count = 0

print("This program started at: " + time.ctime())

while(break_count < break_num):

    time.sleep(break_duration)

    webbrowser.open("http://edelgrace.me/blog")

    break_count += 1

First I will explain the first two lines. In Python, there are many different modules that you can utilize to achieve specific things. Think of them as apps that you use on your phone. You have apps for calendars, contacts, games, social media, etc. Just like apps, we don't really need to know how exactly modules works, just how to use them to get what we want. In this case, we use modules to get information about the time and to use the web browser on the computer.

import time
import webbrowser

Next, I initialize some variables. Think of this as giving something a name. For example, I am 22 years old as of writing this. This would be my age. In the code, I am declaring that the break_duration (how long to wait to open a web browser) is 10 seconds. The break_num determines how many breaks to take, which is 3. Lastly, the number of breaks taken so far, break_count, is 0.

break_duration = 10
break_num = 3
break_count = 0

This line will print out a message to the console with the print function. Inside print, it uses a function from the time module that we imported earlier. The function we use is ctime(), which grabs the value of the current time.

print("This program started at: " + time.ctime())>

The last chunk of code is a while loop. Think of while loops as a set of instructions to repeat until a condition is met. I will break this down line by line.

while(break_count < break_num):

    time.sleep(break_duration)

    webbrowser.open("http://edelgrace.me/blog")

    break_count += 1

The first line determines the condition. This loop will keep running as long as the number of breaks taken (break_count) is less than the number of breaks that should be taken (break_num, which is 3). When this condition is not met, the code inside the while loop will stop running.

while(break_count < break_num):

Then we use the function time.sleep() to essentially wait for the number of seconds and essentially do nothing. From the official Python documentation, we can see that this function will accept numbers in terms of seconds, which is what we are using in break_duration.

time.sleep(break_duration)

Once the 10 seconds has elapsed, the next line of code will run. This uses the webbrowser.open() function. It essentially does what it says: open a web browser. Here, we indicate which site to open. In my case, we open up my blog for a quick break. 🙂

webbrowser.open("http://edelgrace.me/blog")

After that is all done, we have finished a break. Therefore, we increase the variable break_num by one to indicate that a break has been finished.

break_count += 1

The code then goes back to the start of the while loop and checks the condition. break_count is now 0+1=1 which is still less than break_num (which is 3). This repeats two more times until break_count is 3 and then the condition fails and the while loop is skipped over. Since there is no more code after the while loop, the program ends.

Programming

TIL: How to Add a MySQL User

CREATE USER 'user'@'server' IDENTIFIED BY 'PASSWORD';
GRANT PRIVILEGES ON database.table TO 'user'@'server';

I recently bought a VPS from Ramnode and started tinkering on it. I needed to create a database for my fanlistings. Back when I was on shared hosting, I would use cPanel and phpMyAdmin to do all that. This is admittedly another TIL that I didn’t learn today but, rather, relearned today because the information slipped my mind. Maybe I need to rename this little segment to “TIRL.”