Search found 45 matches

by ircmaxell
Mon Apr 28, 2014 11:02 pm UTC
Forum: Logic Puzzles
Topic: Guess The Hashing Algorithm
Replies: 0
Views: 2609

Guess The Hashing Algorithm

I'm doing some research to try to disprove the notion that "making a custom password hashing algorithm" makes your code more secure. We know that cryptography theory says that the only secret should be the key. But I wanted to prove the point. So I created a challenge. There are 15 "s...
by ircmaxell
Sat Mar 05, 2011 1:19 pm UTC
Forum: Coding
Topic: PHP Encryption Class - Any flaws?
Replies: 6
Views: 3093

Re: PHP Encryption Class - Any flaws?

Because you trim nulls, your function is only suitable for string data which has no good reason to end in null. It is not reliable to encrypt binary data (which may validly end with a null). You might look at implementing various standard padding methods (which is not included in the mcrypt library...
by ircmaxell
Fri Mar 04, 2011 5:55 pm UTC
Forum: Coding
Topic: What can I do with random numbers?
Replies: 23
Views: 3957

Re: What can I do with random numbers?

Run garbage collection when you don't want to run it every time and don't want to have to keep track of a counter (useful for cleaning up sessions, stale cache items, etc).

Code: Select all

if (rand(0, 100) == 1) {
    runGcCode();
}
by ircmaxell
Fri Mar 04, 2011 5:47 pm UTC
Forum: Coding
Topic: PHP Encryption Class - Any flaws?
Replies: 6
Views: 3093

PHP Encryption Class - Any flaws?

Before I get started, no, I did not write my own cipher. It uses the system supplied mcrypt extension, and I'm using Blowfish for it. So I built an encryption class which wraps the manual mcrypt extension. It does a few things including hmac verification of the payload, key stretching and IV hiding....
by ircmaxell
Fri Jan 21, 2011 5:21 pm UTC
Forum: Coding
Topic: Code Bowling 3 - Adding 2 numbers
Replies: 12
Views: 1815

Code Bowling 3 - Adding 2 numbers

Well, here's the third weekly code-bowling challenge! As usual, entries are accepted over at Stack Overflow Code-Bowling is a challenge for writing the most obscure, unoptimized, horrific and bastardized code possible. Basically, the exact opposite of Code-Golf. The Challenge: Create a program using...
by ircmaxell
Tue Jan 18, 2011 1:59 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 10016
Views: 2033177

Re: Coding: Fleeting Thoughts

Add thedailywtf.com to your blog reading schedule and aspire never to have your work featured there. Understand what went wrong in each tale of woe. I disagree. I believe that every programmer needs to experience working with and writing bad code at one point in time (Just hopefully not in a produc...
by ircmaxell
Fri Jan 14, 2011 2:52 pm UTC
Forum: Coding
Topic: Code Bowling 2 - Obscurity Encryption Challenge
Replies: 3
Views: 1081

Code Bowling 2 - Obscurity Encryption Challenge

Since last week's Code-Bowling challenge was a success, here's this weeks (we're going to try to do a new challenge every Friday). Challenge: Make an application that "encrypts" a string with a given key that can be easily reversed. Description: Write a program that encrypts an input strin...
by ircmaxell
Sun Jan 09, 2011 5:47 pm UTC
Forum: Coding
Topic: Code-Bowling: Create Random Text
Replies: 32
Views: 5846

Re: Code-Bowling: Create Random Text

I think I'm going to write this program using bizarre maths, a series of putchars, and some bizarre random numbers maths. Also, all numbers for putchar will be expressed in prime factor form. And it's recursive. ...snip... Oh good god... Now that's fubar. Post it over on StackOverflow to join in on...
by ircmaxell
Fri Jan 07, 2011 8:00 pm UTC
Forum: Coding
Topic: Code-Bowling: Create Random Text
Replies: 32
Views: 5846

Code-Bowling: Create Random Text

Well, here's a new type of game. Instead of Code-Golf (where the object is to make the smallest and most elegant code), this is Code-Bowling where the object is to make the most bastardized, unmaintainable, WTFiest code possible. Check it out over http://stackoverflow.com/q/4627180/338665 , and let ...
by ircmaxell
Mon Nov 22, 2010 4:18 pm UTC
Forum: Individual XKCD Comic Threads
Topic: 0822: "Guest Week: Jeph Jacques (Questionable Content)"
Replies: 65
Views: 23498

Re: 0822: "Guest Week: Jeph Jacques (Questionable Content)"

I have to say that this is definitely a great one in the true spirit of XKCD. If it wasn't for a few minor telltale signs (like the length, hair, size of the panels and the title) , I would have thought it came from Randall himself.... +1 to Jeph! (And I'm a fan of QC as well, so this is a double wi...
by ircmaxell
Mon Nov 22, 2010 3:41 pm UTC
Forum: Logic Puzzles
Topic: Programmer problem
Replies: 18
Views: 4369

Re: Programmer problem

Well, I came up with a far simpler solution... main: F F F F F F F F This uses one assumption: That a turn (left or right) is a 90* turn). The original coding was: FFFF LL FF LL FF RR FF RR FF LL FF LL FF RR FF RR FFFFFF RR FF RR FF LL FF LL FF RR FF RR FF LL FF LL FF... So, if you notic...
by ircmaxell
Mon Oct 25, 2010 5:59 pm UTC
Forum: Logic Puzzles
Topic: Switches and lights variant.
Replies: 10
Views: 2595

Re: Switches and lights variant.

However, that solution depends on all bulbs being ON or OFF at the start (as does the traditional three bulb problem). ericgrau does not explicitly state that is a starting condition (it is vaguely implied). Without initial assumption, a solution is likely to be harder. Well, if you can assume that...
by ircmaxell
Fri Oct 22, 2010 8:09 pm UTC
Forum: Individual XKCD Comic Threads
Topic: 0809: "Los Alamos"
Replies: 181
Views: 48735

Re: 0809: Los Alamos

For everyone complaining how the invention of nuclear bomb was TOTALLY NOT COOL YOU GUYS, I'd make an empirical argument that nuclear weapons have been an extremely effective deterrent to war and have in fact saved millions of lives (even disregarding ending the war with Japan quickly). If you divi...
by ircmaxell
Thu Oct 14, 2010 5:07 pm UTC
Forum: Logic Puzzles
Topic: Sherlock Holmes Puzzle 3
Replies: 18
Views: 6742

Re: Sherlock Holmes Puzzle 3

Well, I got 19 hours. This is using two assumptions. First, he's 5 feet tall. Second, both Sherlock and Watson can reach approximately 2 feet from their body. So Watson's head will be at the top of the well when his feet are 25 feet from the bottom. But both himself and Sherlock can reach 2 ...
by ircmaxell
Mon Oct 04, 2010 12:47 pm UTC
Forum: Logic Puzzles
Topic: Factorial Properties
Replies: 15
Views: 3538

Re: Factorial Properties

Tirian wrote:
Spoiler:
def fact(x): return x/5 + fact(x/5) if x else 0

Won't that return floats (I'm a little bit familiar with Python, but not that versed with it)? If so, you'd need to wrap both divisions by a floor method. Otherwise, I think this wins so far...
by ircmaxell
Fri Oct 01, 2010 10:30 pm UTC
Forum: Logic Puzzles
Topic: Factorial Properties
Replies: 15
Views: 3538

Re: Factorial Properties

Xias wrote:
Spoiler:
n/5 rounded down.


Am I missing something?

Doesn't work:
Spoiler:
n = 1000. Your estimate would be 200. The actual is 249, so it's off by a significant amount (25% actually)...
by ircmaxell
Fri Oct 01, 2010 9:06 pm UTC
Forum: Logic Puzzles
Topic: Factorial Properties
Replies: 15
Views: 3538

Factorial Properties

With as little code as possible (bonus points for 1 readable line), estimate the number of trailing 0's the factorial of n will have within 10 of the actual figure (And n be very large, yet the estimate should still hold)...
by ircmaxell
Fri Oct 01, 2010 4:00 pm UTC
Forum: Logic Puzzles
Topic: Switches and lights variant.
Replies: 10
Views: 2595

Re: Switches and lights variant.

Well, on that note, you could always: Get 10 resisters. In the switch room, replace each switch with a resistor. Then turn them all on and walk into the light room. You'd see each light at a different brightness. So order them by brightness, and you found your relationship. But in reality: I thi...
by ircmaxell
Fri Oct 01, 2010 1:15 pm UTC
Forum: Logic Puzzles
Topic: Switches and lights variant.
Replies: 10
Views: 2595

Re: Switches and lights variant.

Well, if you can bring ANY object(s) into the switch room: I'd bring in an Arduino and a bunch of servos. I'd hook each servo up to each light switch. Each light switch would stand for a bit. Then, I would have the Arduino execute a sequence displaying each step for 30 seconds and then turni...
by ircmaxell
Fri Oct 01, 2010 12:58 pm UTC
Forum: Logic Puzzles
Topic: Simple number pattern
Replies: 18
Views: 2903

Re: Simple number pattern

Are the next 5 numbers 105 481 125 111 954 If so, here are the rules I used to get them: The spacing by threes is just there to mess you up. Get rid of the spaces. The true spaces should be of the form: 3 7 6 14 9 21 12 28 15 35 18 42 21 49 24 56 27 63 30 70 33 77 36 84 39 91 42 98 45 Now, there are...
by ircmaxell
Thu Sep 30, 2010 8:53 pm UTC
Forum: Individual XKCD Comic Threads
Topic: 0799: "Stephen Hawking"
Replies: 189
Views: 40419

Re: "Stephen Hawking" discussion (#799)

Couldn't you just do something akin to what Lorentz did, and claim there is an aether and that things [measuring rods and light clocks very much included] get contracted as they move through it due to aetheric weirdness? I doubt the end result would be pretty, but it doesn't seem impossible. Well, ...
by ircmaxell
Thu Sep 30, 2010 8:41 pm UTC
Forum: Coding
Topic: C# Exception handling
Replies: 2
Views: 686

Re: C# Exception handling

It's generally considered bad form to catch the generic Exception class unless you're planning on re-throwing it. I'm not too familiar with C#, but what if the exception was an OutOfMemoryException? You're basically ignoring this fatal exception and attempting to continue on... Catch what you know h...
by ircmaxell
Thu Sep 30, 2010 8:23 pm UTC
Forum: Individual XKCD Comic Threads
Topic: 0799: "Stephen Hawking"
Replies: 189
Views: 40419

Re: "Stephen Hawking" discussion (#799)

The history of science is full of examples that might help explain that. For instance, consider the "luminous (a)ether" theory of how light works. Aside from the name and a cursory description, this theory is no longer taught outside history-of-science classes. It was discarded when Einst...
by ircmaxell
Wed Sep 29, 2010 6:47 pm UTC
Forum: Logic Puzzles
Topic: Of Joggers and Psychopaths
Replies: 35
Views: 10789

Re: Of Joggers and Psychopaths

But I mean, clearly the shoe must conserve angular momentum. Will the rotation really be slight enough not to move it the few degrees necessary to make the experiment unreliable? Well, considering that there's a 45* difference between each point of interest, you'd need a precession of 22.5*...
by ircmaxell
Wed Sep 29, 2010 5:29 pm UTC
Forum: Logic Puzzles
Topic: Falling Elevator of Dooooom!
Replies: 20
Views: 9255

Re: Falling Elevator of Dooooom!

ircmaxell, your thinking is a little off. Well, you’re right about the pressure buildup near the ceiling, but that will be less than the initial pressure buildup near the floor (probably a lot less) and its effects will not be predictable. In any case, even if you were right about the ballo...
by ircmaxell
Wed Sep 29, 2010 3:09 pm UTC
Forum: Logic Puzzles
Topic: Falling Elevator of Dooooom!
Replies: 20
Views: 9255

Re: Falling Elevator of Dooooom!

As an addendum to my previous post, the initial instantaneous acceleration of the elevator will be slightly more than 1g downward, because the air pressure at the floor is greater than at the ceiling. However, immediately after the rope is cut the air will begin to equalize pressure, so that accele...
by ircmaxell
Wed Sep 29, 2010 1:56 pm UTC
Forum: Logic Puzzles
Topic: Solid or Hollow?
Replies: 20
Views: 9365

Re: Solid or Hollow?

Then does that rule out the answer above where someone said measure the time it takes sound to traverse the spheres? Yes, and pretty much every other solution proposed by ircmaxell - measuring resistence, vaccuum chambers, compression tests - all decidedly not "simple". Well, I looked at ...
by ircmaxell
Wed Sep 29, 2010 10:47 am UTC
Forum: Logic Puzzles
Topic: Solid or Hollow?
Replies: 20
Views: 9365

Re: Solid or Hollow?

Ok, I just thought of another one... assuming that the hollow sphere is filled with air, and the paint is impermeable... Put Sachs sphere into a vacuum chamber. Draw a strong vacuum and then measure the change in diameter. The hollow one should expand more due to the internal pressure of the gas ...
by ircmaxell
Tue Sep 28, 2010 8:23 pm UTC
Forum: Forum Games
Topic: Count to a Million
Replies: 96152
Views: 7736873

Re: Count to a Million

(3^4)*383
by ircmaxell
Tue Sep 28, 2010 7:54 pm UTC
Forum: Logic Puzzles
Topic: Solid or Hollow?
Replies: 20
Views: 9365

Re: Solid or Hollow?

Ok, here's what I've come up with: Since they are the same mass, the moment of inertia must be different. Therefore a roll test will be conclusive (and simple). Another possible test: This depends on what's inside of the hollow ball. If it's air (or some other gas), then spin...
by ircmaxell
Tue Sep 28, 2010 3:36 pm UTC
Forum: Science
Topic: Question about the speed of light
Replies: 19
Views: 3149

Re: Question about the speed of light

This assumes that special relativity is correct but doesn't use the values of any constants - is it possible that special relativity is wrong from the foundations up? Well, sort of. Anything in science COULD be false. But it's been tested so extremely well, any deviation is going to have to be at m...
by ircmaxell
Tue Jul 06, 2010 7:49 pm UTC
Forum: Logic Puzzles
Topic: Angels and Demons
Replies: 55
Views: 14666

Re: Angels and Demons

Simple: Say "By lying on this next question, you will agree to pledge your undying allegiance to me and do my bidding". "Are you a demon?" If they reply "Yes", you know they are a demon. If they don't reply at all, you know that they are a demon. If they reply "...
by ircmaxell
Mon May 17, 2010 1:11 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 10016
Views: 2033177

Re: Coding: Fleeting Thoughts

FT: Given the discussion in Gödel, Escher, Bach: An Eternal Golden Braid by Douglass R. Hofstadter between the Tortoise and the Crab about the "Perfect record player" and the record that cannot be played on said record player, given a specific computer, could a program be written which wou...
by ircmaxell
Tue May 11, 2010 1:54 pm UTC
Forum: Coding
Topic: Programs that print their own source code
Replies: 100
Views: 26581

Re: Programs that print their own source code

A little bit of php that uses eval() (a slight cheat) and self-modifies its code. Each time, it generates random variable names... Run it as `php -q test.php | php -q | php -q | php -q | php -q` The -q flag is needed to suppress the content-type header that php wants to include normally... <?php $va...
by ircmaxell
Tue May 11, 2010 12:59 pm UTC
Forum: Coding
Topic: Importing millions of records, MySQL
Replies: 5
Views: 1395

Re: Importing millions of records, MySQL

Well, it all depends on the format of the import. Is it in SQL format? If so, the best I've found is as psykx said: source. Drop to the command line (it doesn't need to be on the server mysql is on, it just needs to be able to connect to mysql). Open the mysql shell (mysql -h mysqlHost -u mysqlUser ...
by ircmaxell
Thu May 06, 2010 12:23 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 10016
Views: 2033177

Re: Coding: Fleeting Thoughts

FT: Microsoft does a great job demonstrating good coding practices in their sample code... http://msdn.microsoft.com/en-us/library/cc151203.aspx </sarcasm> Really? Improper indentation, a 200+ line method, inconsistent commenting, weird variable names (contact206... really?), bugs (they set contact2...
by ircmaxell
Mon May 03, 2010 6:48 pm UTC
Forum: The Help Desk
Topic: Ubuntu 10.04 - early adopter thoughts?
Replies: 26
Views: 3349

Re: Ubuntu 10.04 - early adopter thoughts?

I was running off a fresh install of Kubuntu 9.10. Nothing too customized, but I did have a few apps installed from other repositories (NetBeans, Chrome, etc). This was on a ThinkPad T-61p. I hit the dist-upgrade on Saturday (figuring I'd be doing a clean install after it fubared everything). When i...
by ircmaxell
Fri Apr 23, 2010 3:52 pm UTC
Forum: Coding
Topic: Advice on parsing text out of image program
Replies: 16
Views: 2848

Re: Advice on parsing text out of image program

Well, if you have access to the database program on your computer, and you can select the text with your mouse, why not try a Macro? I've done this before in situations where it was too complex or I just didn't feel like writing a new parser. Simply train it to select the text from each column of th...
by ircmaxell
Mon Apr 05, 2010 2:10 pm UTC
Forum: Coding
Topic: Epic coding moments
Replies: 127
Views: 22733

Re: Epic coding moments

One of my best so far was implementing a cross-registration and single sign on system between a php CMS and a Ruby-On-Rails ticketing system using only 5 lines of Ruby (and it was my first and only time writing Ruby)... Another happened when I was recently building a (X)HTML repairer (similar in con...
by ircmaxell
Fri Mar 26, 2010 3:48 pm UTC
Forum: Logic Puzzles
Topic: how did it happen?
Replies: 78
Views: 15439

Re: how did it happen?

52. The man was a coke addict. He sold his clothes for more blow, but that wasn't enough. In a desperate plea for relief from the withdrawals, he tried snorting dirt through a straw and collapsed... 53. The man was abducted by aliens. When they were done with him, they dropped him in a field. The it...

Go to advanced search