Jul
28

Broken Pagination 2017

I was supposed to be doing smallish posts for this blog and so setting pagination to 40 posts per page seemed like a good number.

Except it didn't turn out that way; the posts are tending towards pretty large and so 40 posts was way too much. Far too much vertical text.

So I changed it to 20.

And then sorting broke.

When I originally started this blog rewrite, I couldn't get the posts returned in exactly the correct order due to the way collections et al work in Laravel, and I finally ended up doing a reverse() within the actual Blade template that displays all of the posts.

I then made changes to the Controller to reverse the results and in combination with the pagination, it went a bit... weird. Some more tarting around later yielded nothing helpful.

I remembered the stupid reverse(), ripped it out and - tada!

Now pagination is set to 10 posts per page.

Aug
02

Just a Test Post 2017

This is more of a test than anything.

Due to an explosive productivity growth on my part (oi - steady on), I'm finding myself typing these blog posts in advance. I'd rather have one large post per day than multiple in one go, possibly resulting in a couple of days without any new content. I'll still add smaller posts if I can actually think of anything.

This test is to ensure I haven't done anything stupid like assuming all posts are in a sequential date ordering; extremely unlikely, but always test. Test everything just to be sure.

There are two posts waiting to be made live as I write this very entry. It's going against the whole recap-of-the-day purpose of this blog, and I can see myself falling even further behind (or should that be ahead?); that is, I'm going to end up queuing posts for publishing days ahead. Not sure what to do about that.

I just can't stop raving typing!


Timed Publishing

I could do with setting a Publish Date on unpublished posts and have them go live at specified times. Except of course such functionality isn't present on this blog.

I'm on shared hosting, so I never really got into messing with Cron jobs.

I think Laravel has support for some time-based thing, but I'm not entirely sure how it can trigger itself. Must be based on visitor access - that's the only thing I can think of. If the site doesn't have visitors then the job would be missed... too unreliable in my opinion, so gawd knows.

Aug
05

Timed Publishing? In! 2017

Woke up yesterday morning and had a thought while I was on my way to the bathroom: timed publishing doesn't need to be Cron-based. Just set a date on the post and display that post if the current date/time is past it.

It seems I got somewhat fixated on the whole Cron job method of allowing posts to go live based on a set date and time that the obvious non-scheduled way of doing things just passed me by.

I spent yesterday getting the feature in and made it live. Posts are now displayed based in their (newly added) published_at column rather than created_at. Of course I had huge amounts of fun with timezones. sigh

I gave the site a quick test on mobile after someone mentioned it doesn't work. Seems it's just a minor formatting issue, at least on Android Chrome, involving the quote in the header at the top of the page. I'll probably just not display it on mobile browsers; presumably there's a mobile substring in the User-Agent header.

Didn't quite get around to sorting out the categories display (click on a category at the top of this post) and so viewing a category right now doesn't work quite how you'd expect. I probably should've gone with keywords rather than rigid main and sub categories.

Finally, I added a set of badges to posts so I can see at-a-glance if any specific flags are set rather than having to rely on remembering what their background colours denote.

Post Flags

Aug
07

Formatting Fix for Mobiles 2017

I was just about to go to bed and then thought it would be a great idea to jump right into PHP and sort out the mobile-issue with the quote above. D'oh.

Alright, the blue quote at the top of this page seems to be a bit too long for mobile browsers and overflows out of its header bar. The solution? Don't show it on mobile browsers - sorted!

Did a quick search to see if I could just detect mobile within the User-Agent and sort it that way. Instead, I found some library that kept getting referenced and decided to just go ahead and make use of it: the Agent library, with Laravel support - hurrah.

This somewhat goes against my own lightweight way of doing things, but presumably it's not quite as easy as detecting a mobile sub-string as otherwise why would there be a dedicated library for it? In fact, don't answer that.

Integrated it and all that and then the site stopped working due to an exception. Deleted the vendors folder from the server - which took minutes - and then re-uploaded my local version as no doubt something was missing. A few minutes later - it all works. Phew. Oh; as a bonus, a load of libraries also got updated with a quick composer update, so that's nice.

A quick addition of

if (!Agent::isMobile()) {

along with a change to remove the appropriate <span> and such, and it was all done.

Does it work? No idea. Haven't actually tried it on a mobile device yet (although inversing the logic works so I'm hopeful it's all fiiine) as my phone is elsewhere in the house. But, there are no errors and so worst case is that it makes no difference.

Aug
09

In the works: Voting 2017

A new feature is coming and that is...

Voting!

Each post will have a thumbs up and down buttons. This'll allow posts to be voted on and will give me an idea of the types of posts to make more of in future - or fewer of.

It would've gone live today but I'm having a bit of a pisser of a time when it comes to actually displaying the voting results to myself. For some reason, a value of 1 is being returned for each and every post, regardless of the number of actual votes cast. Although I did receive a value of 2 at some point but that was lost when I re-seeded the database.

I can only imagine it is something to do with the count being returned for each actual post rather than the number of votes made for the posts. This reminds me, I'm going to need to do more than just return a number as I'd rather have the sum of the positive and negative posts and display that; displaying positive and negative posts separately is just a waste of space, I think.

Once this is fixed, then I'll upload the changes.

Aug
12

No, I Haven't Binned This Off 2017

Still here.

I haven't posted in a couple of days because I didn't have anything to write about. While I begin working on a new program yesterday and got a bulk of it done today, I'm not going to write anything on it until it's near being released. It's more of a "tool" than a fully-feature application, but it's still useful for those wanting, er, it.

Aug
14

Server Going Offline 2017

Well, I'm not surprised in all honesty.

The server this and my other sites are hosted on has started to go offline for 10 - 240 minutes per day, at (seemingly?) random times.

About 15 years ago (christ, really!?) UK2 moved me from my original server when I upgraded my hosting and since then it's been going to utter crap. I - finally - got them to move me about within the last year to another server after constant down times, except within the last week it's all gone to crap again.

The difference is that before this server change, the sites were going offline for (typically) a few minutes a time numerous times per day around two days out of the week, but on this new server the sites are going offline for extended periods of time once or twice a day every other day.

Compared to other hosting providers, UK2 isn't actually that cheap; I haven't switched providers because there's two decades worth of infrastructure I've built-up with UK2 that I really can't be arsed sorting out.

Sep
03

A Bit Quiet... 2017

I haven't gotten lazy in writing new blog posts, it's just I honestly don't know what to write about.

I've done a lot of work on XBox Device Status, but not really anything I'd consider interesting. Hmm, actually - it could be interesting to a few people as I'm doing work with XInput and getting battery and state information. Someone might be interested in doing that from within C# / VB .NET?

I'm also considering doing a one-week fast that I could write about.

Who knows. Maybe I should resume work on that Assembler thing I started a while back? It's just the tedious parsing that's doing my head in and putting me off.

Oct
31

AllWebsiteAccount
Accounts Site Revisit 2017

No updates for nearly two months? Like I mentioned before, that's mainly because I can't really think of anything to post. But, today, I am posting.

Accounts!

If you're a registered user of my software, then expect to see an update of the Accounts site in the near future. I've just upgraded all of the backend libraries and such, and the (local development) site is completely broken. It appears things changed in Laravel, Apache, and PHP - so that shizz got busted.

I had to struggle with working out why Apache kept giving me 404 errors in regards to virtual hosts. Here's what I finally came up with that seems to work in Apache 2.4.x.

<VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot "P:\website_path"
    ServerName mysite.l
    ErrorLog "logs/mysite.l-error.log"
    CustomLog "logs/mysite.l-access.log" combined
	<Directory P:\website_path>
		AllowOverride All
		Require all granted
		Satisfy Any
	</Directory>
</VirtualHost>

Just that took a few hours (as I followed numerous false trails), but it's done now and I can just apply it to all of my other virtual hosts.

Next-up is fixing the Laravel errors, which in all honesty, don't really make much sense. Thankfully the Whoops! error-handler is back so I'm not just scrabbling around in the dark.

Still no idea what the problem is, though.