Have you seen these yet? They're awesome.
RiX0R
@RiX0R
Best posts made by RiX0R
Latest posts made by RiX0R
-
RE: To all who Think Themselves a Programmer
@PeriSoft said:
Personally, I'd favor curve-fitting a polynomial to a sequence of the ASCII values of 'HELLO WORLD',...now THAT'S ninja.
That's awesome!
I had Mathematica do it but it ain't pretty...:
[img]http://rix0r.nl/~rix0r/share/shot-20090710.105724.gif[/img]
-
RE: Honest Adobe Reader
@Mole said:
That doesn't help when you have an extension that gives the ability to spawn a command shell from anywhere, then when you need it, it tells you that you can't do it!
You're referring to a right-click-on-folder, "Command Window Here" extension right? Maybe the one from PowerToys? Because you can just change it to use PUSHD.
Go to HKEY_CLASSES_ROOT\Directory\shell\cmd\command
Change
cmd.exe /k "cd %L"
Into
cmd.exe /k "pushd %L"
It will still complain, but it will also work!
-
RE: I think they meant "you'll always be ready for a shot".
@Spectre said:
@amischiefr said:
Marketed to guys who post on ratemypoop.com.
But it redirects to ratemyfart.com. 8=/
Try [url=http://www.ratemypoo.com/]ratemypoo.com/[/url]
-
RE: An interesting error...
They should change the error message for code 0 to:
"The error code was cleared before it was retrieved by the application"
It's way more descriptive and would cut down stupid screenshots in error'd by half.
-
RE: Translation WTF
In Dutch, the document type "Cascading Style Sheet" is translated as "Document met trapsgewijs opmaakmodel"(*). Which kinda fits(**), but just leaves you confused when you encounter it for the first time.
(*) Which, translated literally, translates back to something like "document with staircased formatting model".
(**) It doesn't fit entirely because the style sheet is not a document by itself, but rather specifies the formatting model for another document.
Bottom line: they shouldn't have translated it.
-
RE: Delphi and Indy sockets?
I'm not sure you're doing this right.
First of all (nitpick):
<FONT face="Courier New">Memo1.Lines.Add('Connected.');
IndyClient.Connect;</FONT><FONT face="Courier New">Should be</FONT>
<FONT face="Courier New">IndyClient.Connect;
</FONT><FONT face="Courier New">Memo1.Lines.Add('Connected.');</FONT><FONT face="Courier New">Otherwise the message is misleading.</FONT>
<FONT face="Courier New">On to more serious stuff: the message you are getting (Connection closed gracefully), is probably because in some instances you are calling Disconnect on an already disconnected socket. Your code goes like this:</FONT>
<FONT face="Courier New">try
while Connected do stuff;
{ Not connected here }
finally
Disconnect;</FONT><FONT face="Courier New">You can see the "finally Disconnect" part is superfluous. Better would be to use 'except': close the connection in case of an error, not in case of normal operation.</FONT>
<FONT face="Courier New">And why is your application "laggy"? Because Indy sockets are normally blocking. The code as you're writing it right now is suitable if you need to receive or send a short burst of information, but it looks as if you're trying to write an interactive prompt. The reason this won't work (or if it works at all, won't work well), is because the program will be stuck in Button1's event handler until the connection is closed. Look at the code: it will not return before that. So until the connection is closed, Edit1's event handler (to write to the socket) will never be triggered. Interactive prompt will not work.</FONT>
<FONT face="Courier New">The right (but hard) way to work around this, is to use the blocking socket in a thread, but that gets complicated awful fast, especially if you have no experience with it.</FONT>
<FONT face="Courier New">The slightly less right (but acceptable in most cases) way is to separate the code into multiple event handlers. Let the button connect, but nothing else. Add a timer that checks periodically (every 10ms) for input on the socket, let it read that and add it to the memo. Let another button disconnect. You can leave the Edit1 event handler like it is, but it should check if the socket is connected before writing.</FONT>
<FONT face="Courier New">The lazy (and hackish) way to make it work is to just add a call to Application.ProcessMessages in your inner loop. This will make sure that other event handlers are called (such as Edit1's keypress event, and memo1's paint event) while you're technically still in Button1's event handler. However, be advised that this will only work each time a line is read from the socket (since the socket is blocking, the call to ReadLn will not return before a line is read or the connection is lost)... so this might still freeze your application if no line is received for a long time (which may very well be the case in an interactive prompt-type of application).</FONT>
I'd recommend solution 2 for now, since it is most correct for the amount of effort you'd have to put in. You don't need to switch to asynchronous sockets. You can, but they're much less nice to code against. Good luck.
-
RE: Splitting folders without compression
You can try [url=http://unxutils.sourceforge.net/]tar[/url]. Don't know about the speed though...
-
RE: Trick Interview Questions
@bonzombiekitty said:
Never got a trick interview question, but a few years ago when I was interviewing for a co-op position in the System Test department at the company I currently work at, I got this sorta odd question:
<My company> has a satellite in space. This satellite is made up of three nodes. Each node is connected to two other nodes such that it forms a triangle (at this point I think he's being serious). Every ten minutes we send a signal to this satellite. (still thinking he's serious). This signal causes three radioactive spiders, which are each in they're own node to move to an adjacent node (my mind shifts without a clutch...). Each node can only hold one spider at a time; if the spiders try to occupy the same node at the same time or run into eachother when trying to move nodes, they explode. Is this satellite a good idea? What are the chances of it blowing up?
Once I recovered from the absurdity of the question, I answered the question quickly. Apparently I answered the question faster than anyone before and anyone since then. The guy interviewing me had to come up with some other random questions on the spot to fill the fifteen minutes it was supposed to take me to answer. Supposedly the question is designed to just see how your thought process goes. I just gave the answer in like 10 seconds.
Assuming the spiders choose the direction to move randomly with 50/50 chance, the answer is there's a 3/4th chance the satellite will blow up, right?
Still took me a minute or so to get my mind in order... and my first guess was 7/8th :(
-
RE: Rational agrument against Hungarian notation?
@asuffield said:
prepBut nI vrbLike adjHungarian! qWhat's artThe adjBig nProblem?
You win this thread.