CUTCODEDOWN
Minimalist Semantic Markup

Welcome Guest
Please Login or Register

If you have registered but not recieved your activation e-mail in a reasonable amount of time, please use our Contact Form for assistance. Include both your username and the e-mail you tried to register with.

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - Jason Knight

Pages: [1] 2 3
1
I just reconfigured the hosting for http2/spdy with push. Apologies if all the "Apache2 restart" and occasional 500 error interfered with anyone.

Site should be loading faster now.

2
General Discussion / MOVED: Coronavirus: CONVID-19 - 2020
« on: 18 Mar 2020, 01:06:03 am »
Due to the political and societal nature of the topic, this subject was moved to  The Zoo.

https://forums.cutcodedown.com/index.php?topic=198.0

3
https://hacklang.org/

As PHP forks go I kind of like it.

Not allowing any direct code/output in includes/libraries is a WAY overdue change that should be in mainstream PHP, as is making a main() function an essential part of the code. This way you can't just blindly run things directly.

The typecasting seems to actually be well thought out, instead of feeling shoehorned into the language, so props for that.

These changes allow namespaces to serve a legitimate purpose, instead of how useless/crippled they are in mainstream PHP.

I'd still like to see everything except single quoted strings kicked to the curb for their derpitude, but you can't always have it all.

Overall I'm liking what I'm seeing, and that's rare for a "new" language much less a fork of an existing one.

4
I often badmouth HTML 5 for its new tags, most of which are pointless redundancies, but there are a handful that really kick some names.

One of these is the TIME tag in that it allows a full and proper datetime in ISO format to be attached as an attribute around the localized text. Why is this useful?

Because you can basically send your times from the server as server time, and without the user having to create an account to adjust for local time, you can just let a tiny TINY script handle it.

for example, let's say you had:

Code: [Select]
<time datetime="2020-03-27T15:44:00.000Z">
27 March 2020 07:44 PST
</time>

Pacific standard does you no good if you're not in pacific, nor is the zulu/GMT time... well, remember JavaScripts Date.toLocalString?

Code: [Select]
var times = document.getElementsByTagName('time');
for (var i = 0, time; time = times[i]; i++) {
time.textContent = new Date(
time.getAttribute('datetime')
).toLocaleString();
}

Just run that right before </body> (or better in whatever script your calling at that point) and it will sift through all the time elements and replace their contents with a localization of the ISO time stored in the DATETIME attribute.

Live demo here:
https://cutcodedown.com/demos/localtime/

Tossed a txt in there for those who don't know how to "view source".

Easy-peasy lemon squeezy.

5
PC Hardware / Ryzen 5 3600 vs. 3600x, my conclusions
« on: 21 Feb 2020, 10:28:48 pm »
Yesterday I got to have the "joy" of building two Ryzen systems side by side, one each of the 3600 and 3600x. Because I had both on hand I decided to play with them to ... how to put this politely... confirm some suspicions I had.

I tested both at the 3600's voltages and timings, and at the 3600x's voltages and timings, with the coolers. Prime95 set for maximum heat. This was all gone on a Gigabyte X570 Gaming X motherboard, and Thermal Grizzly Kryonaut paste. Boost was set to all cores capable.

The tested coolers are the Wraith Stealth that comes with the 3600, the Wraith Spire which comes with the 3600x, and my spanky new Noctua DH-N15 Chromax that's going into my new media center upgrade next month. I tested underclocks and overclocks on the Noctua only.

Side note, it's really strange looking at a Noctua sink and fans that are black instead of manure brown and beige.

My results, temperatures are a reported high AFTER throttling stabilized. (earlier values discarded)

Code: [Select]
Wraith Stealth
3600 timings/voltages
3600 -- 94C, throttled to 4150
3600x -- 96C, throttled to 3867
3600x timings/voltages
3600 -- 95C, throttled to 4150
3600x -- 96C, throttled to 4100

Wraith Spire
3600 timings/voltages
3600 -- 94C, 4200 no throttling
3600x -- 96C, throttled to 4050
3600x timings/voltages
3600 -- 94C, throttled to 4200
3600x -- 95C, throttled to 3950 ???

Noctua DH-N15 Chromax
3600 timings/voltages
3600 -- 65C, 4200 no throttling
3600x -- 68C, 4200 no throttling
3600x timings/voltages
3600 -- 72C, 4400 no throttling
3600x -- 76C, 4400 no throttling
3600x timings at 3600 voltages
3600 -- 68C, 4400 no throttling
3600x -- unstable, unable to run test
4.6ghz max boost at 1.5v
3600 -- 78C, 4600 no throttling
3600x -- 94C, throttled to 4233

Conclusions? Well, it's clear to me that they're really at the core the same part, and the "real" difference between them is the cooler it comes with. 50mhz performance is within the acceptable limits of most binning processes, and of course ALL the Ryzen 2 chips use the same chiplets...

But the higher speeds and voltages bring about an interesting possibility. You know how when overclocking to get stability you often just strap more cooling to it and up the voltage? This is because lower binned parts can often stabilize with more voltage...

LOWER binned parts... Given that in terms of TDP the 3600x is a 95 watt part, and the 3600 is a 65 watt part, is it possible that the 3600x is in fact the LOWER binning?

From the day they were released I thought it was ridiculous that the 3600x was $50 more for a 200mhz boost limit increase and sucking nearly a third more juice / making a third more heat. That felt like it was just a really crappy and inept overclock. I mean seriously a 25% price increase for a less than 5% clock speed increase whilst having a 45% increase in TDP? Something is WRONG there.

Well, what if the "x" is just a crappy overclock of a lower binned part than its 3600 cousin. That I got the 3600 to 4.6 with no throttling whilst the 3600x crapped out and started spewing heat like crazy could be an indication of this. They may have found a way to sell the inferior part for more money! Just put a bigger sink on it and throw more electricity in there.

Though my sample pool is too small to say for sure. I could have just "gotten lucky" on which chiplets I had in front of me.  This is NOT proof by any measure and is all just conjecture, but it makes sense.

I can see why most of the trustworthy Youtubers (Jayz2Cents, Linus, Stephen from Gamers Nexus) are saying don't waste the extra money on the 3600x.

Side note, it's also comedy when I trust people on Youtube more than I do "real" writers from "real" publishers. When it comes to 'tech? Damned straight skippy!

6
Snippet Sharing / PHP - pagination
« on: 10 Feb 2020, 09:37:16 am »
Just thought I'd share my pagination routine as on several forums I've seen people struggling with this.

Code: [Select]
function template_pagination($urlRoot, $current, $perPage, $totalArticles) {

if ($totalArticles > $perPage) { // don't bother if only one page

echo '
<div class="pagination">
Pages:
<ul>';

if (($currentPage = floor($current / $perPage)) > 0) echo '
<li><a href="', $urlRoot, '0">First</a></li>
<li><a href="', $urlRoot, $currentPage - 1, '" title="previous" rel="previous">&laquo;</a></li>';

if (($lastPage = floor(($totalArticles - 1) / $perPage)) > 9) {
$counter = ($currentPage < 6) ? 0 : $currentPage - 5;
if (($endPage = $counter + 10) > $lastPage) {
$endPage = $lastPage;
$counter = $endPage - 10;
}
} else {
$counter = 0;
$endPage = $lastPage;
}

while ($counter <= $endPage) {
echo '
<li>', (
($noAnchor = ($counter == $currentPage)) ?
'<span>' :
'<a href="' . $urlRoot . $counter . '">'
), ++$counter, (
$noAnchor ?
'</span>' :
'</a>'
), '</li>';
}

if ($currentPage < $lastPage) echo '
<li><a href="', $urlRoot, ++$currentPage, '" title="next" rel="next">&raquo;</a></li>
<li><a href="', $urlRoot, $lastPage, '">Last</a></li>';

echo '
</ul>
<!-- .pagination --></div>';

}

} // template_pagination

It shows a first link, previous link, 5 before the current page, 5 after the current page, next link, and last link. The first/previous links are omitted if on the first page, the next and last links are similarly omitted if on the last page. If within the last 5 links the number before the current page is increased, and vice versa if within the first five pages.

... and more than enough hooks are present to style it however you like. I suggest setting the LI to display:inline, the anchors and span to inline block so you can pad the top and bottom of them, as then alignment is a simple matter of text-align.

Example use:

Code: [Select]
template_pagination('blogs/list?page=', 3, 10, 63);
Where you want the href to read something like "blogs/list?page=4" for the next page, you're currently on page 3, you want ten articles/sections per page, and there are 63 articles in total on the site. It handles all the rest of the math for you.

7
The Zoo / Iowa caucuses "mobile app failure"
« on: 4 Feb 2020, 03:29:37 am »
Just which incompetent halfwitted derp thought that using MOBILE CRAPPLETS to report voting results was a good idea? Security? Reliability? Who caress about that, so long as some little dipshit (probably the 15 year old nephew of someone in authority with the IOWA democratic party) unqualified to write "hello world" in C can sleaze out something in Buildfire or Appery?

Seriously, all that bitching about frameworks, WYSIWYG's, and "App Builders" I'm always on about?

Well here you go. Perfect example of why mobile crapplets are dipshit bullshit that should NEVER be used for any serious task.

Lands sake, putting voting results out over MOBILE as the reporting method? Whiskey Tango Foxtrot!

Sad part is, I've got this nagging feeling in the back of my head that the entire "delay" is the result of Bernie winning and the party trying to come up with excuses to discount certain votes so they can hand it over to creepy Joe.

8
JavaScript / To extend system objects or not?
« on: 2 Feb 2020, 10:29:17 am »
Years ago I heard that extending system objects like "Element" or "Math" was "bad".  Whilst I knew that legacy IE (of which I'm out of ***'s to give, my ***'s have run all dry) didn't do proper inheritance to live DOM Elements, in modern browsers what reasons are there for extending Array, String, Element, Object, Node, etc, etc being a "bad thing" you "shouldn't do".

The only one I know of is namespace collisions, and even in that case you could simply use uniform prefixes -- like a double underscore -- to mark them as "proprietary".

For example, what's wrong with:

Code: [Select]
Node.prototype.__flush = function() {
while (this.firstChild) this.removeChild(this.firstChild);
};

That would make it a "forbidden" technique just because it is being applied to Node?

Or...

Code: [Select]
Object.defineProperty(
String.prototype,
'__htmlSpecialChars',
{
get : function() {
return this.replace(/[&<>"']/g, function(m) {
return '&#38;#38;#' + m.charCodeAt() + ';';
});
}
}
);

The reason I'm asking is my original version of elementals was going to work this way, and I'm thinking on dragging Elementals 4 back to this, since IMHO:

Code: [Select]
var myString = 'This is a <test>';
console.log(myString.__htmlSpecialChars);

Would be vastly superior to:

Code: [Select]
var myString = 'This is a <test>';
console.log(_.htmlSpecialChars(myString));
// where _ is my elementals core object

Probably faster executing too. I know I was told legitimate reasons not to use this approach a decade ago, but damned if I can remember what they were. Was it literally just "IE7/earlier can't do that" and that's it?!?

Trying to challenge my own assumptions here; assumptions that may have been based on misinformation, misunderstanding, or that flat out simply no longer apply years later.

9
Whilst for the most part one should always try to make downloads be a server-handled thing, sometimes it's faster/easier to generate data in JavaScript... but how do you take a JavaScript variable and make a download out of it without spitting it back to the server?

Well, here's how:

Code: [Select]
function fileDownload(filename, content, mimeType) {
var a = document.createElement('a');
a.download = filename;
a.href = 'data:' + (
mimeType || 'text/plain'
) + ';charset=utf-8,' + encodeURIComponent(content);
a.style.display = 'none';
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
} // _.fileDownload

We make an anchor element, we set the download attribute to our desired filename, then in the href we set data:text/plain (or whatever mime-type you want) with the charset followed by a comma, then a URI encoded version of our data. This anchor when clicked on will magically turn that data: into a download with the DL attribute as the filename.

From there we just make sure it's display:none, append it to the body, trigger its click even, then remove/delete it.

so:

Code: [Select]
fileDownload('test.txt', 'This is a test');

Will trigger a browser download "test.txt" which contains "this is a test". Easy-peasy lemon squeezy.


10
General Discussion / ... and the crApple stupidity continues
« on: 11 Dec 2019, 01:17:43 pm »
https://www.youtube.com/watch?v=tpVNkglXc84

Audio was one of the few places I ever defended Apple, because of the out of box ASIO support and quality audio chips... the latter went away about a decade ago as they derped their way into cutting EVERY possible technical corner; which is why in terms of "support" components" those multi-thousand dollar Mac's are no better than a $300 black friday Walmart special...

But screwing over all those reasons for professional audio workers choose apple just wasn't enough for them. No, they had to implement their derpy broken "security chip" BS that breaks external USB audio devices -- devices some professionals wouldn't even have resorted to if the built-in audio wasn't cheap-ass crystal or realtek now... aka no better than your average $30 bargain basement no-name Chinese motherboard.

Congratulations crApple, you've just made hackintoshes have better professional audio than your own machines on the SAME external USB devices.

Hence, the only thing "professional grade" about Macs anymore are the halfwits, morons, and fools who still cling to the notion there's ANYTHING superior about these steaming piles of overpriced junk.

WHY are people dumb enough to continue buying from this damned company of two-faced sleazy dishonest dirtbags with their anti-consumer predatory practices?!?

11
Site Support / Apple mobile stupidity MAYBE fixed?
« on: 9 Dec 2019, 03:42:39 pm »
For some reason Apple -- and ONLY Apple products -- have been choking on the 301 redirects to force http to https, which is annoying since if you just type in the domain name they assume it's http and don't even try the alternative.

Made worse by the fact their error message says it might have permanently moved -- what the 301 is trying to flipping tell it.

They seem to send a mangled request of some sort I'm still trying to sort out the how/why of -- it's like mangled HTTP 2 headers under a 1.1 declaration -- but for now I THINK I may have thrown enough changes at how they work for them to stop being so stupid about it.

It works in the emulation under xCode, can anyone with a real device that was having problems confirm?

12
General Discussion / Favorite OS "nobody" uses?
« on: 7 Dec 2019, 10:52:07 pm »
I've been a bit of an OS whore over the years -- be it every flavor of linux distro (where they all suck equally as desktop OS), attempts at cloning windows like ReactOS, or other flavors of Unix and *nix likes such as Darwin, FreeBSD, QNX, etc.

But I'm more interested in the real "fringe" OS that few people have heard of and fewer still ever used.

In my case the favorite is BeOS, and by extension Haiku. If Haiku was more mature, had a  better choice of browsers, and had a better selection of applications, it would be my go to. It feels so snappy, responsive... even the original BeOS was ridiculuosly well performing, back 20 years ago it could make a K6-2/450 feel like a bleeding edge hardware machine of today in how the UI performed and responded to input, or how well its pervasive multi-threading forced "give the user something" to the foreground. It was ridiculous how it could take 1990's hardware and handle things like multiple DVD quality video stream playbacks side-by-side on hardware where just one video would bring the machine to its knees in Windows and Linux... much less the realtime audio capabilities that make a BeBox as iconic a part of many recording studios as the Atari ST.

Sadly, I think said "pervasiveness" of multithreading, where EVERY program requires at LEAST two threads (input and display) is what makes there be so little software written for it. It takes an entirely different mindset and architectural design approach to write even a "hello world" for it, in a way that's so radically different from nearly every other GUI based OS.

But anyone have anything they love that's even more obscure?

13
General Discussion / Yay, first forum DDOS
« on: 5 Dec 2019, 12:12:03 am »
That was fun. Thankfully it was all from two different data centers spamming joins and then spamming the re-send e-mail.

Since there's no reason for data centers to be sending user connections, IPTables is your friend.

Sorry for the brief downtime, they struck whilst grandpa here was napping.

14
I'm once again working on doing 360 degree projections in a 6:1 aspect across the top of the screen. The best way seems to be arctangent, but that means I can't use any of the native perspective calculations.

This means all my vector calculations can't seem to be done on the GPU in an efficient manner, making the game in question be painfully tied to the CPU. I mean I could try leveraging shaders, but sending the math to the GPU and then back to the CPU to send to the CPU again seems... bad.

Is there any way anyone's aware of to simply tell either OpenGL or Vulkan to widen the FOV to a 360x60 perspective, or is the Z divide simply so ingrained in the perspective map that it just can't do it.

Side note, I hate matrix math. How anyone can think that 64 multiplies of 32 values can be more efficient than two multiply, two divide, and two add/subtracts of six values utterly escapes me.... much less everyone feeling it was so much better a way they ended up throwing silicon at it.

But again, I do my 3d math using atan2 so...

15
JavaScript / What do you think's missing from JS' library?
« on: 9 Nov 2019, 08:05:39 am »
Elementals.js 4.0 is about ready for launch -- what's really holding it up from hitting RC status is that the documentation needs a complete rewrite as 4.0 is radically different from 3.x, if anything it is closer to how 1.0 was supposed to work as I've dialed back the clock a bit, whilst also dropping IE9/earlier support.

But before I write off on it as feature-complete, is there anything people use in JavaScript for wrapping functions or other helpers that you would consider essential?

elementals.js is more about polyfills, a make helper, views, and an ajax wrapper... but I'm looking for small useful bits of functionality that just plain feel missing from JavaScript.

Any ideas? Mind you, I'm using defineProperty a lot so actual DEFINE as well as calculated properties are possible.

Just looking for anything I don't normally do that might be useful. I know that's a bit vague, but I'm looking for suggestions no matter how wild or mundane.

Pages: [1] 2 3

Advertisement