After The First Step

2020-10-01 投稿: Michael

The hardest step is the next one.

In that, I suppose the hardest step is getting yourself to take another step.

I often wonder why that is, what about me or about humans in general makes that the case. What makes it hard to do the right thing? Why is it so hard for us to believe that taking care of what we have to do immediately, instead of putting it off, really would feel better in the long run? Why is it hard for us to invest? What makes us believe so stubbornly that the feeling we get from instant gratification could be better than the feeling that will come after making wise, weathered decisions?

I’ll leave that discussion for another time, because wondering about all that is probably just another mechanism of my brain to distract me from what I really need to be doing, which is, continuing along the path I started on.


After HTML & CSS

Before heading out on a journey, it’s good to have a map.

Perhaps along the way you’ll make a different turn, but at least you’ll know what’s out there.

I’ve been tasked with learning about programming. Specifically, how to make websites.

I went through the basics of HTTP and CSS, but what comes next…

PHP Basics: PHP Grammar, HTTP Domain Types, Transferring Values Between Clients.

Other HTTP Basics: HTTP, WebAPI, REST API, GraphAPI

Database Basics: Creation and Deletion of Tables, Databases, Columns, and Records, Table Relations.

So, the only thing to do when there’s work ahead of you, is to do the work.

So let’s move ahead with:

PHP

I’ve found w3schools to be one of the best references – a more educational dictionary perhaps – for learning programming so far. However, there is no one stop shop for learning, and the more resources, the better.

For reference, I’ll try to describe what HTML and CSS are as I understand them, and then look them up to see how I match up.

HTML (HyperText Markup Language): The standard programming language for turning a document into a web page. When Googled: “standard markup language for documents designed to be displayed in a web browser.”
CSS (Cascading Style Sheets): Pretty simple – the style sheets that do all the aesthetics for the contents designated in the HTML. Positioning, colors, order, etc.  When Googled: “style sheet language used for describing the presentation [of a HTML/other document].”

So what is PHP? A “general-purpose scripting language especially suited to web development.” or:

PHP is a server scripting language and a powerful tool for making dynamic and interactive Web pages. PHP is a widely-used, free, and efficient alternative to competitors such as Microsoft’s ASP.

Server scripting language. Dynamic web pages. Microsoft’s ASP.

To understand these, let’s Google. Why the word server, before scripting language?

Server-side scripting is a technique used in web development which involves employing scripts on a web server which produce a response customized for each user’s request to the website.

Oh boy. Getting down the rabbit hole. In layman’s terms? I found this very helpful:

Today, a variety of services use server-side scripting to deliver results back to a client as a paid or free service. An example would be WolframAlpha, which is a computational knowledge engine that computes results outside the clients environment and returns the computed result back. A more commonly used service is Google’s proprietary search engine, which searches millions of cached results related to the user specified keyword and returns an ordered list of links back to the client. Apple’s Siri application also employs server-side scripting outside of a web application. The application takes an input, computes a result, and returns the result back to the client.

Now this makes sense. Send something, result gets computed, and comes back. So the ‘work’ of the operation is done server side. Makes sense.

A dynamic web page? “a web page whose construction is controlled by an application server processing server-side scripts.” Or by a more artful definition, a site that “displays different content each time it’s viewed.” Sure.

As a side note, looking up Microsoft’s ASP, apparently it’s a paid alternative to PHP, based on Microsoft’s visuals rather than being done in the C++ coding language, thus fitting larger groups and PHP fitting individuals or start-ups.


PHP Grammar

All right now we get into the good stuff. What I love in language is grammar. It’s the magic that lets us convey meaning, and create poetry, and all the good stuff. It’s the theory behind the music of language. And I found the same to be true so far with programming, though in the programming sphere, grammar and vocabulary seem to be coalesced.

Off the top of my mind, from a month and a half of bootstrap, html, css, here are the core bits of grammar:

div. col/row. I mean these are the building blocks for building blocks.

Jumbotron, textblock, img, a, href, ul, li, etc.

All these start from the most basic functions.

div is just a section of content, col/row organizes that content in a vertical or horizontal space.

For each specific thing you might want to do, for example, put a picture or media file in, there is a corresponding piece of grammar. When you want to do more complex and specific things, you often have to combine. There are rules for each piece of grammar to make sure they work right.

So let’s lay out what I’ll need to learn in PHP, and then dive into it for next week:

Sample PHP:

<?php
$txt = “PHP”;
echo “I love $txt!”;
?>

So $ creates a variable like in python. Very interesting.

A PHP script can be placed anywhere in the document. PHP Script being the <?php ___________ ?> bit. Like html the statements end with “;”. Functions etc. are not case-sensitive.  However, variables are.

// or # for commenting single lines, /* ___ */ for multiple. Cute robot.

If, else, while, echo, print.

Echo and print are almost the same, both output data to the screen, but print’s return value is 1 so it can be used in… expressions… hmm. Echo can take multiple parameters, print can take one. echo is faster.

I want to get familiar with all the syntax and placements in this:

<?php
$txt1 = “Learn PHP”;
$txt2 = “W3Schools.com”;
$x = 5;
$y = 4;

echo “<h2>” . $txt1 . “</h2>”;
echo “Study PHP at “ . $txt2 . “<br>”;
echo $x + $y;
?>

So I’m going to work on replicating that.

Until next time! For now, a picture from a couple months ago.

stakの最新情報を受け取ろう

stakはブログやSNSを通じて、製品やイベント情報など随時配信しています。
メールアドレスだけで簡単に登録できます。