Tag Archives: Shits and Giggles

Time Waster – Why not orange?

So I had an interesting conversation with a friend about how and why Apple selected “Apple” for its name. There are a variety of theories on the Internet, including that it was the favorite fruit of founder Steve Jobs, or that it was an allegory to “Eve eating the forbidden fruit” or something. As a random spur of the moment thing, I decided to run a random survey with the assistance of one of those “talk to strangers” type sites. I’d never used them before, only heard about them, so I did a bit of shopping around first. I ended up choosing Omegle because it allowed for text-only chat. I didn’t want to have to use video, for reasons that probably don’t need explaining.

The “survey”, if it can even be called that, took the form of starting each conversation with “Apples or Oranges?” Most of the time this got one of three answers: Apples, Oranges, or “partner has disconnected.” The results from this were:

However the real reason for this little time waster was, of course, the atypical and often humorous replies. Highlights included:

Some people enjoyed explaining the rationale behind their choice…

And lastly:

Some of the other “fruits” that were chosen: ‘mango’, ‘pumpkinz’, ‘ur mom’, ‘super-glue’, ‘butterflies’, ‘cashews’, ‘cinnamons’, ‘grapes’, and ‘jesus’.

That was a somewhat entertaining waste of time. 🙂

T

Advertisements

Coke + Rust = Results!

The results of this little experiment were actually not bad. Upon opening the container of Coke today I saw two small patches of gunk floating on the surface. These turned out to be directly above the screws, as expected. The bubble plumes mentioned in the previous post were also still present, though they were much smaller.

Once the coke was drained, I realized one mistake I’d made during the experiment. Both of the screws had been placed with the flat side of the head facing downwards, against the bottom of the container. I think this the reason for why the heads are still very rusty, as seen in the photos that follow. In both images the one on the right was the untreated screw.

The things coming out of the Coke weren’t brand new and shiny, but there was a bit of improvement. It’s also possible that leaving them in longer would clean off more rust.

T


Coke + Rust = ??

This is a bit of a deviation from what I normally blog about, but we have a ton of extra Coke cans at home and I nobody drinks it. I’ve heard a few times that Coke (well, the chemicals in Coke) are excellent at doing things like dissolving calcium, removing rust, etc. I figured I’d give the rust a try.

The hardest part by far was finding enough identical rusty objects. I wanted at least 2; one control and one to actually soak in the Coke. I ended up having to use these:

The container was just an empty yogurt container, which happened to be the perfect size:

I ended up tossing 2 of the rusty screws into the Coke, keeping the third out for comparisons. As soon as the screws hit the liquid sizable plumes of bubbles started forming around them, and continue even as they settled on the bottom of the container. I’m not sure if this was just CO2 escaping due to nucleation or some sort of reaction between the rust and the Coke. I also put the lid on the container, which had some interesting implications. Within the first minute or two the lid was bulging and pressure was seeping out from the rim of the lid. Again, I’m not sure if this is entirely regular Coke behavior or not. Either way, I added air holes in the lid.

I’m going to check back in a couple of hours to see what’s happened, and then again tomorrow morning and afternoon. I’ll post the results then.

T


JMorse Part 1 – A Crack at the Rules

As mentioned in my previous post, I decided to actually try going down the route of mixing Morse Code and programming. The first step in doing this was coming up with a few rules to write programs in Morse code. The easiest way to get started was to use standard Morse letter sequences, and then fill in any characters that were missing, e.g. ( ) [ ] { } ; ” “. This gave me:

Morse Code

To make parsing easier/possible, I came up with a few spacing rules as well. A single space, ” “, is used between characters in the same “word”. A double space, ”  “, is used to represent the access operator, in Java’s case this would be the period. Finally, a triple space, ”   “, is used to indicate the gap between two words. If any of that is confusing it’ll make sense in a minute with the code snippet.

To start with, I wrote a very simple and cliche “Hello World” in Java, and then encoded it into Morse. The original program looked like this:

Java Hello World

And encoded in Morse I ended up with this abomination:

Java Morse Code

Two things became clear pretty quickly while writing the above program. The first was that as more non-alphanumeric symbols are needed, the more complex the morse equivalents are going to become. I still need =,+,-,/,*,%, the logical and bitwise operators…To fit them all into the Morse code set I’d probably have to extend out to a length of 6 dot/dashes for some cases. This would become very yucky very fast.

The second problem is Morse doesn’t allow for capital and lower case letters. You more or less have to pick one and stick with it. This is a pretty big problem as I’m a strict follower of camelCase-style naming conventions and Java’s standard libraries are loaded with mixes of upper and lower case. The only solution to this that doesn’t require an additional 26 Morse codes adding a “shift” character that has to be prefixed to any character that needs to be in upper case. That would be a bitch.

So where does this leave us? I can’t help but feel that there’s got to be a better way to go about doing this. I know the original intent was to use strict Morse Code compliant characters to write programs, but retrofitting the necessary characters into the existing codeset is brutal. As I see, there are two options left:

1. Use morse of the letters only, and retain existing “punctuation” using Java’s traditional symbols ()[]{}””,;. etc.

or

2. Start from scratch and design a new variant of Morse Code that’s optimized for programming. Rather than having “e” as “.”, maybe “.” could be the period symbol that it appears to be. And curly braces could be “-.” and “.-“, and so on.

I’ll have to think about this some more, but I think number 1 is looking a bit more appealing. The problem with number 2 is that it feels like I’m just rewriting ASCII, albeit a more reduced version of ASCII. Number 1 retains the Morse Code feel and will require far fewer additions to the original codeset.

That’s all for now though.

T


Sudoku Solver

Earlier this week, I decided to try my hand at writing a solver for classic Sudoku puzzles. It was sort of a spur-of-the-moment sort of project, inspired by a friend that had to write something similar for an assignment. One of the Project Euler questions involves solving a set of 50 some Sudoku puzzles, so I figured I’d use the final code for my Euler solutions.

Initially, I wrote a very basic system designed to perform the classic process of elimination approach used by most human solvers. Of course, for the Euler question a good number of the puzzles were beyond such a solver and required a more powerful solution. My second iteration of the Sudoku solver used a basic brute-force approach by recursing through the vacant square and testing numbers. It was fairly efficient; it could solve easier puzzles in a few milliseconds, taking 20 or so for hard questions. I unfortunately have not gotten around to writing a logic-based “smart” solver yet, however this is definitely a topic I’d like to explore again in the future.

Just for anyone that’s curious, I plotted a few graphs that charted the active cell vs. the call number for the recursion function. The first graph shows a very basic puzzle, which only took around 280 recursive calls to reach a solution. The second shows a more tricky puzzle, which took a little less than 4,500 calls. The worst case puzzle, pulled from a Wikipedia article, took some 300,000 calls and had such a large dataset that Excel decided it didn’t want to function properly (read: it crashed).

Easy Sudoku graph:
Easy Sudoku

Hard Sudoku graph:
Hard Sudoku

That’s all for now!

T


%d bloggers like this: