Monday, March 14, 2022

Happy Pi Day!

It's time to be irrational again! 

Happy Pi Day 2022, everyone!

Back in August 2021, researchers in Switzerland calculated Pi out to 62.8 TRILLION digits, smashing the previous record of 50 trillion.

https://newatlas.com/science/pi-world-record-62-8-trillion-digits/

Pi





Sunday, December 26, 2021

Advent of Code Is Done For The Year

We've come to the end of another year of Advent of Code. Apparently this year AoC saw the 10 millionth star issued since it began in 2015! Pretty impressive. Not sure of any final numbers yet, but I've heard there was again more participation this year than the previous year. The stats show that on Day 1, 190,118 people completed both parts and 22,274 additional people completed Part 1. And on Day 25, 7227 completed both parts with 4701 completing Part 1. Last year, more people stuck around to the end (quarantine-related?), but this year had far more participants. 

Pretty cool. 

I started the season with the framework I had begun building to quickly parse the inputs into a usable format, but I quickly realized that the inputs this year were a bit more complex than I was previously working on. I bailed on my framework and just resorted to simple day-by-day processing. I'll go back and refactor my earlier framework to include this year's processing needs. 

I'm not one of the Competitive Programmers who always top the AoC Leaderboard, but I did participate this year with a few other programmers from the Working Code Podcast's Discord server. Some used Python, and a couple of us used CFML. I created a Private Leaderboard for us so that we could at least see how we were doing against some of our peers. Considering that most of the Top 100 Public Leaderboard spots were filled within just a few minutes of puzzle release, I'm glad I did it. 

I didn't finish as many days as I wished I had. I only made it through Part 1 of Day 9 before time ran out. I ran into a huge stumbling block on Day 4 that really hung me up and killed my motivation. I gave it a few tries a couple of times, but kept getting wrong answers. I watched myself getting further and further behind, and just kinda set the whole thing aside for a few days. I finally went back to it and solved it, much easier than I thought I would, and realized I had been way over-thinking it. I tried to blast through as many as I could before time ran out, but stumbled again on Day 8. I managed to get the solution and knocked out Part 1 of Day 9, but struggled with Part 2 until I ran out of time. The biggest lesson I learned was to not try to do these late in the evening. And also, Off-By-One errors suck. 

Oh, and Python (which has been on my Things I Want To Learn list for way too long) is much more capable of handling these types of problems. ColdFusion can do it, but some of the processing seemed to be much more straightforward in some of the other language answers. 

I took notes on the days I did, and I need to finish writing them all up. 

A big thank you to Eric Wastl for creating this, and another big thank you to all who participated. I look forward to doing this again next year. 👍


Working Code Podcast Group 2021 Private Leader Board


Tuesday, December 7, 2021

Today I (re)Learned

Mark this up as a TI(re)L:

I've been working on the Advent of Code daily puzzles with some of the people on the Working Code Podcast Discord channel, and I said that one of the challenges I've had with some of these puzzles was simply parsing the Inputs into the format I planned to work with in CFML. Tim Cunningham (t) mentioned some code that would parse a CSV file:


private function setParseSettings(
    required string localFilePath,
    required string lineSeperator=CRLF,
    required string quoteEscape="\",
    required boolean parseUnescapedQuotes=true,
    required boolean keepFirstRow=false
) { ..... }

I looked at the code and thought "Why would you have a default value if the parameter is required?", so I asked. A long time ago I learned that a required parameter couldn't have a default value; that's what optional parameters are for. At least that's what I thought. I guess I haven't ever really thought about the way it works. 

In SQL Server, functions don't really have a concept of optional parameters. Stored Procedures do, but there isn't an explicit required attribute in either one. You simply define an optional parameter by giving it an "= something". There are a few gotchas with parameters in SQL functions and sprocs, but those are beyond the scope of my thoughts here. And since most of my current work is in SQL and not CFML, I never really came across it enough to think about it.

Back to what I didn't realize I had forgotten.... 

You CAN have both required and a default value in your parameter definitions, in CFML and in many, if not most, other languages.

I knew that, conceptually, if a parameter was required, then it didn't matter if it had a default value. You had to pass the parameter, and if you did, then the default value was replaced anyway. But that's where my thinking was backwards. When the function is evaluated, if an optional value is defined, the required definition is ignored. So even though an argument is labeled as required, it doesn't have to be passed if there is a default value.

I didn't think that made any sense, so I verified it.

<cfscript>
function testme( required String param1, required Boolean param2 = false ) {
    return {"param1":param1,"param2":param2}
}

writedump( testme("Bill") )
writedump( testme("Ted",true) )
writedump( testme(param2=true, param1="Rufus") )
writedump( testme() )
</cfscript>

Which gave me: 

Huh... I stand corrected. This was something that I used to know, but had completely forgotten, or at least overwrote my original memory with my later assumption of how it all went together. 

Apparently it's perfectly fine to not pass a "required" parameter as long as it has a default value. If no parameter is passed, the default is evaluated and the required is ignored. Which is probably why I got backwards in the first place. Why label a parameter as required if it isn't really?

I'm sure the old gods of programming had a legitimate reason for doing it that way, but it escapes me. 

Oh well.



Monday, November 1, 2021

Thursday, October 28, 2021

Hire This Person!


I don't want to condone anyone hacking anyone else, but this was an extremely awesome, non-destructive Senior Prank. 


And this young hacker did the responsible thing and did a full write-up and disclosure to the school district's IT personnel and helped them fix it. 

Bravo.





Press F12 and Become a Hacker Today! (aka: Why We Need More Cybersecurity Awareness Month)

Earlier this month, we had this...


And a .... what is it when you double-down a dozen times and keep doing it?

And even...

I have thoughts.... 

Starting with WTF???

I don't normally jump into political topics, but I don't really see this as political. I see this as a Governor who either refuses to listen to the people he hired to know about basic technology stuff, or he's hired a bunch of complete idiots. Though reading through some of the other articles, it appears to be a case of the former. 

Not only did auditors previously mention these issues, but the reporter did the responsible thing and privately disclosed this information before his report. Then, this extremely clueless Governor kept going with his statement, despite his ignorance being pointed out again and again and again on social media. 

So the reporter, Shaji Khan, absolutely deserves that apology, Gov. Parson.

And for those of you out there who are interested in this so-called "multi-step process" that was used, I'll give you the details. I'm completely opposed to discussing hacking "how-to"s in a public forum, but I'm fairly certain I used this "hack" to teach myself HTML about 20 years ago. 

Disclaimer: Browsers will vary slightly, and there are many more ways to accomplish this "hack".

Here goes...

If you're using Chrome, Right Click on a page ...

And click "View page source". (Or just click Ctrl-U)

You'll get a page with some funny-looking words on it, but don't worry. That's the "hacked" details of the page. 

There's also the super-secret, only-for-developers-and-hackers way to do this. Just press F12 and you can get that info and even more.

I can forgive any politician making a mistake, but to continue to go on and on about this "hack".

The words I had earlier seem insufficient. Although this does make a good story for Cybersecurity Awareness Month. 






Friday, October 22, 2021

Into The Box 2021 - Write Up - Post Day +1 - Saturday, September 25, 2021

 


I got invited to speak at the Into The Box 2021 Conference in Houston, TX. These are my thoughts.

-----------------------------------------------------------------------------

Good god it's early. Quick shower then downstairs to meet my Uber.

......

Waited for a few minutes and my Uber driver stopped around the corner, but he got me squared away and to the airport with plenty of time before my flight. Not one single issue going back through screening. I've got about 40 minutes before boarding starts. There are a surprising amount of people in the airport this early. The stupid sun isn't even up yet.

.... 

On the plane, and it's a fairly empty flight again. Message sent that I'm on my way home, and now to decide if I want to try to watch a movie or just chill. 

.....

Chill it was. Made it safely back to Nashville. The landing was probably one of the best landings I've ever seen. Not sure which pilot was flying this morning, but whichever it was squeeked it on at BNA. Very nice job. 

Got my bags picked up and now just waiting on the wife to pick me up and take me home.

...

And I am back home! And very tired.

........................................................

All in all, I had a _GREAT_ time at Into the Box. I got to see some people that I haven't been able to see in a while. There were a few people that I would have liked to have seen, too, but they couldn't make it. Things are still a little iffy with COVID, but it was kinda nice to be able to attend an in-person event again. I very much liked the hybrid nature of this conference, and I hope other conferences do the same. There are a lot that I haven't been able to attend in-person, and an online option would have been great. Granted, an extremely large part of any conference I've ever been to has been the "Hallway Track". So I don't think they should all go all-virtual. 

I want to offer a huge _Thank You_ to Ortus Solutions for having me speak again. They are now the group that has given me my first speaking opportunity (ITB 2019 Virtual) and my first in-person opportunity (ITB 2020 Hybrid).


I hope to see everyone again next year!


Shawn Oden 

September 30, 2021 

(written Sept 22 - 25)

(procrastination time - September 25 - October 22!)