Posts

Showing posts from 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?

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 thi...

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 pat...