Saturday, 6 December 2014

Elite Dangerous bulletin board message

Carrier signal decrypting... Message retrieved:
The Pilot's Federation are aware of secret messages being stored within the 3D vertices of ship model blueprints. However, the actual information hasn't been uncovered, as of yet. Can you isolate the encodings and decrypt the message?

Wednesday, 3 December 2014

Some kind of theistic viewpoint

Why does the universe exist? For what reason did it come into being. What caused the big bang? Could it have arisen from the collapse of a previous universe? So where did that universe come from? Maybe a collapse even previous to that... So how far back does this go? How many previous universes were there? It's easier to think of time continuing into the future forever, because it's weirder to think that one day time will come to an end. So shouldn't this be true of the past? But for some reason it's weirder to think that maybe time goes backwards into the past forever too. Or maybe the opposite is true, it could be weirder to think that time had a beginning, because what came before? What could have existed before time, what could have been the catalyst for the creation of time?

Let's suppose that the universe never existed. That time and space never existed. That there has only ever been nothing. Nothing at all. Isn't that a more natural state of being. I think that the fabric of the universe must have a will power, in order for it to decide to create space and time. Even if our version of space and time is just one of an infinite number of possible configurations. Of course, ours is one of the winning configurations, most would have destroyed themselves instantly. But whether there has only ever been one universe, or whether there are infinite universes, one thing is for certain: there is definitely not zero universes. If the fabric of the universe did not have a will power then the natural consequence would be for there to be zero universes. Therefore it would seem that there is a will power, which you may as well call God.

It seems impossible to believe that consciousness can arise from the relativistic cause and effect of atoms and forces, particles and waves. If all that existed was movement and reaction then everything would be determinant, predictable, and therefore there wouldn't be any choices or decisions. So maybe we are deluded into thinking we do have conscious thought, but really we are just awareness carried over a single strand of the multiverse. That all decisions are chosen simultaneously, but that our current consciousness is only aware of this one path. So how did the universe come up with that? I think therefore I am. Descartes said it all. The only thing anyone can be truly certain of is that they themselves exist and are aware. Even if you can't be certain that your body is real or that your thoughts are everything about you (maybe your current awareness is just a subset of your whole awareness)... but you can be definitely sure that you are sentient... and that at least one universe exists... and both points lead to the conclusion that the fabric of the universe has a will power.

Monday, 1 December 2014

Order strings by name, handling numbers naturally

Here's how to sort a collection of strings, such as file names, with numbers being handled naturally. The example is in C#.NET, but the concept is portable.

private static readonly int INT_MAX_DIGITS = Int32.MaxValue.ToString().Length;
public static string ConvertForNaturalOrdering(string path)
{
 var sb = new StringBuilder();
 var digitCache = new StringBuilder();
 foreach (char ch in path)
 {
  if (Char.IsDigit(ch))
  {
   digitCache.Append(ch);
   continue;
  }
  if (digitCache.Length > 0)
  {
   sb.Append(digitCache.ToString().PadLeft(INT_MAX_DIGITS, '0'));
   digitCache.Length = 0;
  }
  sb.Append(ch);
 }
 if (digitCache.Length > 0)
  sb.Append(digitCache.ToString().PadLeft(INT_MAX_DIGITS, '0'));
 return sb.ToString();
}

Here is how the method can be used.

var sorted =
 from path in new[] { "aab2", "aaa10", "aaa2", "aaa1 1" }
 orderby ConvertForNaturalOrdering(path)
 select path;

The 'sorted' enumeration will be in this order:
 "aaa1 1", "aaa2", "aaa10", "aab2"