Just found this in some old code at work
szMaskedReferenceField[ strlen( szMaskedReferenceField ) + 1 ] = 0;
One way to ensure that it's null-terminated at the null terminator, I suppose.
Just found this in some old code at work
szMaskedReferenceField[ strlen( szMaskedReferenceField ) + 1 ] = 0;
One way to ensure that it's null-terminated at the null terminator, I suppose.
@ShadowWolf said:
@RayS said:@GeneWitch said:No, if you follow that logic, you'd be saying 2007, September 11th.You sort of just proved a point up there at the top, dude.. no, we don't say 25:3PM. Why? Cause hours are bigger than minutes. (longer)
So, by that logic, saying "september 11th, 2007" makes more sense than "11th of september, 2007"
@GeneWitch said:
someone saying "12th of august" to me... i'd sneer at them for being a snob.So because someone is from a different culture to you, they're a snob? riiiiight...
Shadowwolf - no functional difference at all. Either way. Both work just as well if you're used to them, as would "2007 13th June", or "May 2005 3rd" or any other plan you can think of. Purely from an academic/logical structural POV, it's nonstandard. Three units - small, medium large. No other commonly used system does anything other than SML or LMS.
I don't see why so many people see it as a personal attack when you point out the obvious..
Then that demonstrates that no, there is no good reason. Just cultural differences.
Academically/Logically speaking nothing - you're clearly attempting to assert your way is superior, which it is not as you stated yourself. Your "obvious" statement is just the prototypical euro-centric elitism. Yes other people are being subjective and centric too, but I'm just making a point here that the entire argument is subjective. You can't say one way is better than another.
I live in the USA, I prefer HH:MM:PM & dd/mm/yy - so what? It's just preference :) Refering to a specific way of recording Time or Date as "Proper" is annoying.
The problem with these cultural differences is that 01/06/2007 is ambiguous. You don't know if I'm English or American, so you don't know if you've missed my birthday this year or if you still have a chance of some birthday cake in a few months. There's no problem if the context is clear but it would be good to agree on international standards.
Surely a job for a drop-down list with the option to select multiple responses, to allow the users to roll their own Maybe & Don't Know from combinations of responses.
@joe.edwards@imaginuity.com said:
If you want a goldmine of language based WTFs try some esoteric languages like INTERCAL, brainfuck, or Malbolge. Actually, I'd be impressed with someone who could write anything useful in these languages.
" N E W S hit"
I misread this first time around. I thought it said NEWS hit, then I realised the truth.
Like the BRAKING, too. Let's slow things down here.
@Angstrom said:
Variable-length encodings are your friend. For the specific case assufield described (which is extremely contrived, but we'll work with it) it's possible to compress every file containing a string of 0x00 bytes [b]to no larger than itself[/b].
Ooh! I can do this one. I think the function is called cp.
My vote for representative line is this bit
line_13640:
'back to the logic after 12120 line
GoTo line_12120
1) It's got gotos.
2) Redundant comment (I suppose we should be thankful there were comments at all).
3) A label which leads to a goto. Why not just replace GoTo line_13640 with GoTo line_12120.
OK, I admit I only read the first dozen lines & the last dozen so there may be better bits in the middle but there's only so much I can take. Is it time for a comment about inefficacy of eyewear yet?
@tster said:
If the array size is hard coded then why would you use sizeof(array)?!?!?! not only is it worthless, but it's wrong. you would have to use sizeof(array)/sizeof(type) first of all. Second of all, just tell him to declare a constant
#define ARRAY_LEN 256
not only that but you suggested clearing only the items that were set. This sounds like a lot of extra bookkeeping keeping track of which items have been set. Why not use memset? Before you start putting quotation marks around the word developer as an insult to your co-workers, perhaps you should examine your own answers to their problems.
sizeof(array) will cause even more problems if the cleanup is done in a separate function from the original declaration of the array. Then array is just pointer-to-int and you get the size of the pointer instead.
I'll add my vote for being able to sort by first post date.
[quote user="president_ch0ice"]
I've been asked to debug a stored procedure used in a POS application. The POS programmer complained that the procedure would work for new transactions, but not for existing transactions.
Here is the code...
---8<---
CREATE PROCEDURE dbo.proc_transaction_result @iTransactionNumber int, @bAccepted, @bRefused AS
SET @iTransactionNumber = dbo.generateNewTransactionNumber(GETDATE())
IF (SELECT COUNT(*) FROM tb_transaction WHERE iTransactionNumber = @iTransactionNumber) = 0
INSERT tb_transaction (iTransactionNumber, bAccepted, bRefused) VALUES (@iTransactionNumber,@bAccepted, @bRefused)
ELSE
UPDATE tb_transaction SET iTransactionNumber = @iTransactionNumber, bAccepted = @bAccepted, bRefused = @bRefused
RETURN 100
--->8---
The bAccepted and bRefused fields (both booleans) puzzled me, especially since the table included some records with both fields having the same value. In regard to this situation, the programmer told me that those fields were linked to checkboxes and that sometimes "the stupid users" would either select both Accepted and Refused, or select none. (Duh!)
The new transaction number generation was obviously misplaced. A funny thing is that this mistake was protecting the system from a bigger bug (the UPDATE statement).
[/quote]
The best WTFs have all been taken, but no-one has yet pointed out that the procedure returns 100, which is the common SQL return value for record not found.
The guard & the driver were within arms length of each other to be able to pass the papers. Just how hard does it rain there that the papers get sufficiently wet to cause any problems? Also, if they were attached to a clipboard then the solution would just be to turn the clipboard over.
At the risk of spoiling an entertaining story, could the problem be that the guard was complaining about the rain blowing in on her while the papers were being passed? In that case, the awning solution is the most practical. Shame the company didn't think about prevailing wind direction when building the guard post, though.
[quote user="ammoQ"][quote user="Alchymist"]
Hang on, I've got it now.
I have no sense of direction but it's embarassing to say that I'm lost. Because of my sense of direction, I'll never find my way back to the roads I know. Therefore I'm going to define a new place called nullity. Instead of getting lost, I'll just say that I've gone to nullity. I could define all the places I visit as different nullities, but what's the point. I don't recognise them anyway. I'll just define nullity to be the same place, wherever I am. That way, if someone case to come to find me, they only have one place to look.
That's so much better than my previous idea of defining being lost as NaN. Then every place that I got lost in was different, so it took ages for someone to find me.
[/quote]
Since this place is the black hole, you are easy to find but impossible to retrieve. That's the funny thing in transreal:
[/quote]
Much better analogy. I was wondering how to add the concept of 'once you are here you aren't getting out again'.
Note to those who have suggested that transreal arithmetic is just as useful as complex arithmetic. There's your difference. Give me any complex number & I can get back to the real line, so my auto-pilot (or electrical circuit) can still give a sensible answer.
Hang on, I've got it now.
I have no sense of direction but it's embarassing to say that I'm lost. Because of my sense of direction, I'll never find my way back to the roads I know. Therefore I'm going to define a new place called nullity. Instead of getting lost, I'll just say that I've gone to nullity. I could define all the places I visit as different nullities, but what's the point. I don't recognise them anyway. I'll just define nullity to be the same place, wherever I am. That way, if someone case to come to find me, they only have one place to look.
That's so much better than my previous idea of defining being lost as NaN. Then every place that I got lost in was different, so it took ages for someone to find me.
<font face="Helv" size="2">
My favourite line so far
"That is, whilst the real logarithm of a negative number is undefined, transreal logarithm of a negative number is defined to be nullity. In both cases the logarithm can be extended to give complex solutions, though we do not describe the transcomplex numbers here."
So he's saying that transcomplex algebra gives a different solution from transreal algebra! Nice consistency!
</font>Fascinating. Right up front in his paper he states "<font face="TimesNewRomanPSMT" size="2">We note that the axioms have been shown to be consistent by machine proof." and "<font face="TimesNewRomanPSMT" size="2">Transreal arithmetic is a total arithmetic that contains real arithmetic", which I interpret as containing natural numbers as well. He also states that 'total' arithmetic contains no exceptions, so presumably every theorem which can be stated in transreal arithmetic is either true or false (nothing undefined).</font></font>
I wonder what Godel would say (http://en.wikipedia.org/wiki/G%C3%B6del's_incompleteness_theorem)?
<font face="TimesNewRomanPSMT" size="2"><font face="TimesNewRomanPSMT" size="2"></font></font>
[quote user="daob"]
"A smart search engine powered by human intelligence." Dare I say... INTELLIGENT DESIGN?
Status: Looking for a guide ...
Status: Connected to guide: MicheleG
MicheleG: Welcome to ChaCha!
You: thanks
MicheleG: Hi there. I will be helping with your search.
You: that's great I could sure do with some help
MicheleG: you are looking for information on the meaning of life?
[/quote]
Surely this should continue ...
You: Yes
MicheleG: Hmm ... Tricky.
You: but can you do it.
MicheleG Yes. But it will take some time.
Searching ...
Searching ...
.
.
.
7.5 million years later, the search returns.
(got 1 result called "42")
[quote user="vr602"]
You are absolutely right; there is no point in discussing the poetic merits of poetry that has been translated. You can enjoy the ideas, narrative, characters etc, but its poetic content is certainly lost, or at least different in the second language. There is no second way to say EXACTLY the same thing, so something must be changed. For example, you can translate "The cat sat on the mat" to "The feline pet was seated on the rug", which pretty well means the same, but is utterly different in many ways, particularly poetically ( ahem! ).
With translations you CAN usefully discuss the possible intentions of the translator, and how 'well' something is translated ( very subjective ). But it's a poor cousin to the original. I would suggest your teachers are wasting your time.
My qualifications? Masters in French and German literature from Oxford University.
"Wann kommen wir uns drei entgegen, in Donner, Blitzen oder Regen?"
[/quote]
I vote for that being a good translation, even if the words are slightly changed!. My qualifications - O level German & a twisted mind, so don't be too harsh on any errors below.
"Es brillig war, die schlicte Toeven
Wirten und wimmelten im Waben
Und alle muemsige Burgoven
Die Momenrath ausgraben"
[quote user="Isuwen"] America is switching over, just very slowly.
[/quote]
Just ask NASA!
[quote user="Bert"]If the bits fall off the edgeof the disk, should one put a container under the disk to catch them. If so can we call it the bit bucket? Will we have to empty said bit bucket?[/quote]
No need. Just let it all pile up and you can store information on the heap. If you're really tidy, you can end up with a stack instead.
[quote user="biter"]
More goodies: The setup routine has a checklist you can print out before you begin. This is nice, except that setting up a printer is one of the last steps in the checklist. Who thought that one out?
[/quote]
Was it the same person who used to put up the error that went something like "Keyboard error. Press F2 to continue" when you tried booting your computer (to DOS - I feel ancient!) without the keyboard attached.
Beware the naive solution. Going back to C code, I once saw this
char *foo(int param1)
{
/* Avoid the problem of returning a local variable which is
destroyed when it goes out of scope by making it static */
static char fred[200];
/* set fred to some value based on param1*/
return fred;
}
Then somewhere in the code, there was the line
printf("%s, %s", foo(1), foo(2));
And the coder wondered why both strings came out the same!
This is very old (well, early 90s) but I felt like reporting a WTF I was involved in back then. Before I start, I would like to point out that I was an actuarial student back then & had no formal IT training.
We were working on a system to provide illustrated benefits for some obscure scenario that the main illustration system couldn't handle. I was involved with specifying the mathematical formulae and testing the numbers that came out.
Someone else created a Fortran program which read a text file for inputs, calculated the illustrations, and wrote the results out to another text file. No Fortran wasn't the WTF - a perfectly reasonable language to do mathematical caculations.
I created a spreadsheet (Lotus 123 back then) front end which could write the input file, run the program and read the output file. OK, getting a bit messy but it's still not the WTF. This is before I'd even heard of VB. It worked and the calcualations were far faster than doing everything in the spreadsheet.
"The Real WTF" came after the test program had been tested by yours truly. The powers that be decided it was going to be too expensive to build this as a mainframe solution for such a small product. Since they already had a program that worked ...you can see where this is going, can't you?
That wasn't the end of the story. There are strict rules about the layout and wording of illustrations, far beyond the printing capabilities of Lotus 123. Thus, I was called on again. My brillant solution was to to create a Word Perfect merge document, using the fields from the output text file.
Let's recap. A user inputs data to a Lotus 123 spreadsheet & runs a macro. This writes a text file and runs a fortran program, which produces another text file, read by the spreadsheet to review the results. If the user wants to print out the results, they have to open a Word Perfect merge document and pick up the data from the file. Does this count as an early use of n-tier architecture?
select 'Insert into fred (col1, col2, ...) values (' + convert(varchar, col1) + ', ' + convert(varchar, col2) + ', ' + ... + ')'
from fred
Add (escaped) quotes as required for character based column types.
I suppose if you really want to go over the top, you could go to the system catalogs & generate the above statement by looking at all columns and their types on the table.
Not so elegant, but you can use
insert into TableA (FieldA, FieldB, ...)
select x,y, ... from SomeTable
union
select x0, y0, ... from SomeTable
union ...
where you just select the fixed values that you want and SomeTable is any table you like.
[quote user="AssimilatedByBorg"]
So what do I do? I had to help the support guys out somehow. Then my warped mind went "click"! Unary arithmetic!!! "1" == 1, "11" == 2, "111" == 3, etc. The limited language had string manipulation -- concatenation, substring, and length functions. So I went off and wrote a little how-to on doing unary arithmetic solely with these string functions. I've rarely been more proud and embarrassed at the same time....
[/quote]
I love it! If you can change individual characters from 1 to 0 in the strings as well, you've got youself the basis of a Turing machine.