Blog Posts


Is not as bad as I always say it is. I complained about it a lot because I wanted it to solve a very specific problem I had with laying out rows and columns of elastic width elements on a page. But it doesn't solve that problem. As far as I can tell.

I had a job for a while where I was restricted from using the latest features of CSS for compatibility reasons. I often thought, "Ugh, FlexBox will solve this." about a particular problem. But I hadn't used it. So when I finally got to, I tried that, first thing. I was a little mad.

Basically, I thought with FlexBox , I wouldn't need media queries anymore. Because I still did, I found FlexBox useless. Now, maybe I was just using it wrong, but regardless, I do use it now, and prefer it to the old inline-block or floats method of laying certain things out. Even if I still need media queries to shuffle things a little for narrow displays.

I used it for the older/newer posts buttons at the bottom to push them to the edges. I think it required a little less work than it might have. Or maybe it just provides a nicer mental model to think about the layout. But either way, I'm over my cynicism.

For FlexBox anyway. CSS could always be better.

Posted 30 Dec 2018 by Brian


Just added pagination to the main blog! Now only 10 posts show up, but you can scroll to the bottom and click "older posts" for more!

That was a lot easier to add than I thought.

Posted 28 Dec 2018 by Brian


Maybe even, "How NOT to optimize your code."

While working on the ability to edit posts, I did some "optimization". I added the ability to edit posts to the page that handles new posts. If you're editing a post, the title and body are pre-filled into the text boxes. This means that some of the code for posting new and editing existing is very similar. So I thought, "how about I crunch that down a little?"

Here is a comparison:

It may even be better/more efficient. But I don't think it's easier to read. In the off chance it saves me time because I can edit the re-used parts in one go, I spent all that time getting it to look like this in the first place.

But more importantly, I intend to move that functionality to an AJAX call on another page. Which means It'll be somewhat different before it's done. And that means my optimization is premature, because I don't yet know what that final version will look like. Maybe this'll be helpful, but I doubt it.

In any case, It was a good exercise, just for the experience of making this mistake on a relatively small scale now, rather than a larger scale later.

Posted 27 Dec 2018 by Brian

Backend now allows editing and deleting

It's so exciting to see it actually live on the site! There's still a few bits of that need cleaning up, but because it's not public facing, it can wait. There's not much to show, also because, 'not public facing', but I am gonna post something about the code that runs it in a minute.

But it's working, so I wanted to say something. Whatever.

Posted 27 Dec 2018 by Brian

Basic PHP

PHP doesn't evaluate escape sequences for strings in double quotes.

'\n' is not a newline, but "\n" is. It gets replaced at assignment, so if you're setting a variable, make sure to use the correct one.


Posted 26 Dec 2018 by Brian

Merry Christmas!

I'm not gonna be posting anything tomorrow, so have a Merry Christmas!

Hmmm.... Maybe I should add the ability to schedule posts...

Posted 24 Dec 2018 by Brian

TODO: intval() vs FILTER_VALIDATE_INT vs ctype_digit()

I'm sending an ID to the server to get a particular blog post. That needs to get sanitized, obviously. The question is, how best to do it?

First, let me get SQL injection out of the way. If I can guarantee that the thing I've got is a number, I don't even need a prepared statement. If I'm wrong about that, hopefully I'll find out sooner than later. If the number is negative, MySQL won't return anything, so that's fine too.

Now, to guarantee it's an int. Intval() will do that, but allow negative numbers. That's fine, although, if I should never get a negative, so it might be nice to be able to know if I've messed up some code, or someone's messing with the site.

FILTER_VALIDATE_INT has the ability to return 0 if the input is invalid for any reason, or if the value is out of some range:
if($user_id = filter_input(INPUT_POST, 'user_id', FILTER_VALIDATE_INT, 1)){
This will verify it is above 1. Handy.

FILTER_SANITIZE_NUMBER_INT doesn't do anything better than intval(), so the same logic applies to that.

ctype_digit() was suggested in one of the stackoverflow responses that I read. It can be used similarly to FILTER_VALIDATE_INT when used on strings.

So, the question is, which is fastest? For my purposes, it totally doesn't matter. I'm only ever doing one int at a time. But I wanna know. So, I think I'm gonna run a test. Never tried that sort of thing before, so it'll be good to try. And then I'll know. So if I ever do need to process thousands of numbers, I'll be set.

Links to research I did before writing this:

Posted 24 Dec 2018 by Brian

Why I'm Not Using a Javascript Framework

I'm currently working on some editing and deleting functionality for the backend of this blog. User interface programming can be a lot of work, trying to anticipate all the unexpected things your users, or even server, can do. I'm not sure if I'm doing the best way. I also know that React.js and Angularjs come highly recommended.

So why don't I use those to help make the process easier?

Because I don't know how they work. That's not a problem, I can use pre-existing tools to make jobs easier/faster/cheaper, but my construction of this blog is a learning experiment. I may be putting myself at a slight disadvantage if a prospective client needs work to be done using such a framework, but it's impractical to try to learn all available tools in advance. I'm confident enough in my ability to pick these things up at runtime, that I don't need to worry.

But for now, I want to learn at a lower level. A level nobody will give me time for when I'm working on an actual project.

Plus OOD is gross. :P

Posted 23 Dec 2018 by Brian

Selecting Direct Descendants

Just a silly thing that caught me off guard. Thought I'd share.

You can't select a direct descendant element like JQuery.

Instead, just select it directly from the document.

I had an odd case where I thought it was better to pass an element to function, instead of just it's ID. Not difficult to fix, but through me for a loop.

Posted 21 Dec 2018 by Brian

10,000 Lousy Things

A friend of mine is working a project. It's something that's stretching his abilities, and he's a little worried about whether it will turn out well.

I told him it wouldn't.

Sounds harsh, but that's not all I said. The fact is, and I've told a few people this, you can't make a great thing until you've made 10,000 lousy things. It's an exaggeration and an overgeneralization, but it makes one fact apparent: You're gonna make stuff that's not great. And that's okay.

In fact it's a good thing. That's how you get better. So don't worry too much about the one thing, just do your best, and put it out there for the world to mock. And then do it again. Besides, most people won't be too mean anyway, because everyone started somewhere.

I don't pretend to be an expert at this. I struggle to tell myself to let the lousy thing go and move on to the next lousy thing almost daily. But each one gets a little better. And maybe one day, I'll finish my 10,000 lousy things and make something great.

I also don't pretend to have come up with this line of thinking on my own. Here are some links to media that influenced my thoughts on the subject:
Nick Campbell - The Creative Gap:
Andrew Price - 9 Artistic Lessons I Learned the Hard Way:

Posted 20 Dec 2018 by Brian


You found me! I'm Brian Bogedin. This is my website and blog. Obviously. Anyway, I'm a full stack web developer and game programmer operating in Southeast Michigan. I do freelance, too, so feel free to contact me with business inquiries. Thanks for stopping by!

Ping me:


This blog!

I'm making this blog from scratch. No CMS, frameworks or libraries! Just MySQL, PHP, JS, HTML and CSS. Is it necessary to create a blog from scratch? No, but it is great for learning, and customization. Does your blog have hashtags?

Website for a youtube channel that creates instructional and entertainment videos about illustration. I built the site and manage giveaways there from time to time. Currently working on a miniature custom CMS so that the site owner can administer the giveaways without my assistance.

SECO Tools

I do some work here and there for a company that sells mill tooling. Most recently built a batch processor for their tool converter. Basically, it takes a bunch of competitor product numbers and returns the information on tools offered by SECO with similar specs. Still needs some user friendliness enhancement, but it's currently only for internal use.


This is a small couch multiplayer game made in gamemaker for a game jam I organized with some friends. Up to 6 players use controllers or the keyboard to fire rockets on the side of their city to rotate a planet and avoid incoming missile. The trouble is, everyone else is trying to rotate the same planet! Download it on!


Mulitimedia engine being developed by my friend, Josh Powlison. Plays audio, video, comics, text, and kinetic novels. Cool stuff. I'm helping out a tiny bit. See the demo here.