|
It is a good thing she did not try to take into account that years ending in hundreds area not, but thousands are. The control code would have been smaller, but the array would have had 12000 entries.
Silver member by constant and unflinching longevity.
|
|
|
|
|
I'm pretty sure that, given thetime, she would have!
And the actual calc is that 'century years' are leap years when divisble by 400 - so 2000 was, but 3000 isn't
Take a chill pill, Daddy-o
.\\axxx
(That's an 'M')
|
|
|
|
|
It does look like she was trying to be very through, so I am not suprised that she accounted for leap years. What this really points out is that it is not enough for a programmer to be able to write code that works; we also have to be able to come up with fast and efficient ways to solve problems.
Bill
|
|
|
|
|
maxxx# wrote: Oh and excuse my code - it's been a long time since I did Cobol and can't really remmeber the syntax
maxxx# wrote: It contained a huge array of constants, called January1984, February1984 etc. etc. etc.
Dont you mean: JAN84, FEB84 ?
|
|
|
|
|
Probably - though I seem to rememebr a 32 character limit on field names in Cobol - so could have been the full month name and year
Take a chill pill, Daddy-o
.\\axxx
(That's an 'M')
|
|
|
|
|
maxxx# wrote: Probably - though I seem to rememebr a 32 character limit on field names in Cobol - so could have been the full month name and year
I was just making a Y2K joke
|
|
|
|
|
Sorry - me being dense (or you just being too bloody clever!)
Take a chill pill, Daddy-o
.\\axxx
(That's an 'M')
|
|
|
|
|
|
Cobol is horrific anyways
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Here's a gem I found in some C++ legacy Windows code I am starting to have to maintain:
if (hWnd ? hWnd == pWndAppts->m_hWnd : pWndAppts)
pWndAppts->DeleteSelected();
else if(hWnd ? hWnd == pWndNotes->m_hWnd : pWndNotes)
pWndNotes->DeleteSelected();
pWndNotes and pWndAppts are class pointers (the exact specifics are unimportant). hWnd is, well, an HWND.
Note how nothing checks to be sure pWndNotes or pWndAppts are not NULL (until it is too late).
Someone obviously thought they were very clever.
|
|
|
|
|
Yuck.
Tom Delany wrote: Someone obviously thought they were very clever.
Maybe they were some intern trying to be a show off?
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Tom Delany wrote: Note how nothing checks to be sure pWndNotes or pWndAppts are not NULL (until it is too late)
Without knowing the code, their could be the situation that pWndNotes or pWndAppts cannot be NULL if hWnd is not NULL. The converse is not true, hence the extra check.
|
|
|
|
|
That might be possible. I still have not gotten familiar enough with the code myself to say for sure, yet. I still think it would not have killed them to use a few more lines of code and written it a bit less obtusely.
WE ARE DYSLEXIC OF BORG. Refutance is systile. Your a$$ will be laminated.
There are 10 kinds of people in the world: People who know binary and people who don't.
|
|
|
|
|
Tom Delany wrote: I still think it would not have killed them to use a few more lines of code and written it a bit less obtusely.
Probably.
|
|
|
|
|
Ok...well I can't post the screenshot...or tell why, but here it is...
While learning an inherited database schema for a suite of apps that we are taking over, I found a database diagram called Unrelated Tables containing sure enough, 22 unrelated tables.
I had to stop there.
|
|
|
|
|
while not the best practice I have several sets of unreleated tables, simply because there is no real way to relate them to anything, and they have over 400 million rows of data between them, and some other groups that are transactional and only related to each other for application performance reasons. I can search the 400 million+ rows in less than a second(on a 10 character compare no less, no or very few int compares), the old db server could do it in under a second and it was 4 or 5 years old.
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
I should have been more specific...in all the tables, there are a few records to a few thousand. They do relate to each other, but have no relationships setup.
|
|
|
|
|
thats better than a product we found...dozens if not hundreds of FK's many circuliar, and several per table(read 2 or 3 FK's to table b, which has several back to table a, along with various others..some are circular and involve 3 to 4 tables in a big loop), all on character keys. doing anything in that DB takes forever. importing 20k rows took 24 or so hours(run time), because of all the extra data that had to be created and integrity checks the server had to make.
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
These tables might have their merit.
For example for storing data that really does not relate to anything else but is still worth storing in the database.
|
|
|
|
|
|
At least better than using strings which are created by adding several different infos as primary keys.
Especially when a certain combination of these infos can appear multiple times and you need to add new rows in tables, not because they contain new data, but only because the primary key of a different table would be the same as it uses the same combination of infos.
Or using columns with non-atomic values as lists separated by commas (I can tell you, getting all entries from that list is a pain)...
|
|
|
|
|
Sometimes using compound string keys is the only way to maintain data between multiple systems / instances where there is no shared system key (and no reason to force such a situation). That said, you would hope the individual elements which were used to generate the keys are available as individual columns also to give good performance for queries...
AJ
|
|
|
|
|
Hi all,
I had found this master piece in one of my junior's coding.Check this duffer act.
We are having a table tblBookings with primary key nBookingID to save bookings with other fields like nProductID, nCategoryID etc.
Now see what he wrote to access perticular booking:
"Select ...... from tblBookings where nBookingID='...' and nProductID='..' and nCategoryID='..'"
I just could not stop laughing after listing of his answer of my question.. "why the hell you want to write two more conditions while u will get unique booking after checking with primary key itself????"
Check his answer.. "For extra perfection sir!!!!"
Anand Desai
Developer
Atharva Infotech
|
|
|
|
|
Anand Desai wrote: I just could not stop laughing after listing of his answer of my question.. "why the hell you want to write two more conditions while u will get unique booking after checking with primary key itself????"
Check his answer.. "For extra perfection sir!!!!"
Neither of you have heard of optimistic concurrency, dont worry, you will get there
|
|
|
|
|
I used to see quite a lot of that in ABAP/4 report programs.
|
|
|
|