I’ve been doing a lot of research on LINQ for episode 6 of the Coding Blocks podcast and I was a bit surprised by what I came up with.
I had originally thought of LINQ as a feature. I had heard the parable of the guy at the white board, writing what they thought code should look like and then worked backwards on how to get there. This makes sense, but what surprised me was just how much of the building blocks were already there.
I wrote a blog post about it over at codingblocks.net, so go check it out: What’s So Special About LINQ?.
I’ve been not-so-secretly working on a podcast over at CodingBlocks.net. I’ve been doing a lot of research to try and nail down exactly what I want in a podcast.
As part of that research I’ve been exposed to a lot of new listening.
Here are a few of my favorites:
I put together a collection of audiobooks that get mentioned whenever the discussion turns to “reading”.
Unfortunately there aren’t many books about code, but there are some for the infosec crowd and even more for those with an entrepreneurial bent.
Many applications require customers (don’t call them users!) to sign up with a username or email address to use the service.
If a user mistypes their credentials, security best practices dictate that an error message be displayed which informs the customer that there was a problem WITHOUT revealing whether or not the username was found.
The Dark Side of Unit Testing
There are a lot of opinions around unit testing coverage tools, and I get the debate. However, if I’m working on a fun, no-deadline, side project then I don’t have a lot of excuses for ignoring it. Especially when dependencies are basically null, like ColorMine.
I’m still putting together my 2013 goals, but I do know that one of them is to launch more sites.
I’ve been doing this whole internet thing for a long time now, I really aught to have more to show for it.
Knowing that perfect is the enemy of good enough I’ve opted to take a release early and release often approach to launching sites.
First up is colormine.org. It’s a simple site that wraps a small color library I wrote.
These types of posts have been done ad nauseam, but I’m putting together my own short list for a presentation so I thought I’d share.
They’re not such a big deal in the grand scope of life, the universe and everything, in fact, these are far from the worst missteps you can take in programming.
However, seeing these same problems year after year drives me crazy. It’s like fingernails on a chalkboard.
It makes my soul hurt.
I had an easy time with this one, which makes me feel a lot better about all the ones I had problems with!
No fancy-pants recursion or math short-cuts here, just a straight forward logic problem. The only “trick” here is to realize that since a <e; b < c, we only need to check values of a and b up to 499.
I’m sure you could whittle that number down by crunching the numbers, but it’s good enough for me!
I listen to a lot of music at work. All day, every day.
It helps smooth frustrations, keeps me awake, and provides “color” for my day. I want my office to feel like a 1960’s Sci-Fi movie!
40 problems down, 10 more till level 2!
The real trick here is to cut down on the numbers you check. Since the problem gives you 918273645 as an example we know the answer must be greater than or equal to it…meaning we only need to check digits that start with 9!
I don’t actually do it because I couldn’t figure out an elegant way to do, but it runs in just a few milliseconds so it’s fast enough in my book.
Another important factor to note is that you only need to check numbers up to 9_876 since this is the first ‘half’ of the largest pandigital possible.
Those two tricks will cut down the calculations you need to run to just a few thousand.
What is the largest 1 to 9 pandigital 9-digit number that can be formed as the concatenated product of an integer with (1,2, … , n) where n 1?
def get_pandigital? n
nums = 
(1..9).each do |digit|
nums += (n * digit).to_s.split ''
return 0 if nums.size != nums.uniq.size || nums.include?('0')
return nums.join('').to_i if nums.size == 9
solution = 0
(9..9_876).each do |n|
# could do better by only looking at 9's!
result = get_pandigital? n
if result > solution
solution = result
Check out all of my solutions on bitbucket!