|
Back in the days when a PC was 2 floppy disks we used an app called askSam that sounds similar to ISAM. We used it for media research. I was so intrigued I ended up becoming a programmer and eventually leaving the media research industry.
There is an elegance to those KISS solutions that programming today doesn't normally appreciate.
"You get that on the big jobs."
|
|
|
|
|
2 floppy disks?! You were lucky!
ISAM is Indexed Sequential Access Method - essentially a way to specify fields on sequential files as indexes, and methods to retrieve those records based on those indexes.
I never heard of AskSam before - but that sounds like a specific tool, rather than a methodology.
It's interesting, though, how something like that can steer your entire career!
|
|
|
|
|
_Maxxx_ wrote: < $50,000
50K? Just how old are you max?
|
|
|
|
|
My first house was bought in the UK and cost me 17,000 sterling as I recall.
and no, it wasn't wattle and daub, or a dug-out cave. it was a pleasant terraced house close to the sea front in sunny Worthing *
* anyone who knows worthing will try to tell you it is not only not sunny, but also inhabited generally by the elderly, smells of seaweed, has some of the most stoney beaches on the English coast, and is generally the place people go to to live out their remaining years. This is true, and goes a long way toward explaining the cost of housing there.
|
|
|
|
|
We manage an application that searches an internal database. It's slow... takes about 3+ seconds to search. The reason is that there are tons of records and our search query is basically this:
SELECT * FROM SomeTable WHERE Field LIKE '%Something%'
That "LIKE" (with the initial "%") prevents SQL from using indexes for that field (which leads to a full table scan, meaning hundreds of thousands of records must be loaded). To fix that, I have the brilliant idea to create a new table and split the field across 72 columns (the current max length of the field). Each column would store the field with one less leading character than the previous column. The new query would look something like this:
SELECT * FROM SomeNewTable WHERE Field1 LIKE 'Something%' OR Field2 LIKE 'Something%' ... OR Field72 LIKE 'Something%'
That's a lot of data, but SQL Server 2005 has a limit of 200+ indexes on any table, so I figure fair trade. However, after showing this to my boss, he comes up with the idea to instead store a new column per word in the search string rather than per character. So we might only have 8 columns instead of 72:
SELECT * FROM SomeNewTable WHERE Field1 LIKE 'Something%' OR Field2 LIKE 'Something%' ... OR Field8 LIKE 'Something%'
I thought that sounded pretty good, except I thought then auto-complete wouldn't work until a full word was typed. However, thinking about it some more, auto-complete will work, considering people typically type words starting with the first letter (e.g., people will generally type "something" starting with "some" rather than starting with "thing").
My boss just prevented me from creating a horrific table. He's a genius.
Now I just need to consider a few niggling options: different tables for clustered indexes, a single column with each word rather than split-up columns, combinations of sequential words, and SQL Server full text indexing (not even sure if that would apply to this situation, but I'll soon see). Seems I have some design and experimenting ahead of me.
|
|
|
|
|
Thinking about this some more, I think I'm going to choose a combination of the above ideas. So the search query will be:
SELECT * FROM SomeNewTable WHERE Field LIKE 'Something%'
However, instead of containing 1 record for "ABC", it will contain 3 records ("ABC", "BC", and "C"). That's potentially a lot of data. However, since the max length is known to be 72 characters, it's not really a big deal. Fast and simple.
|
|
|
|
|
Assuming you're talking real words in that field, rather than some codification, then I would think looking at full text indexing might be worth a shot.
|
|
|
|
|
It was a bit of a simplification. Some are real words, some are codes (without spaces), and often people will type "word1 word2" expecting a result that contains those words in that order. And there are some special characters that they may or may not type in, so I'll probably also have alternate versions without those characters they can search too. I'll probably take the custom approach rather than the full text indexing, as I'm not sure it would be able to handle the fringe scenarios we want to support.
But yeah. Sure am glad I didn't resort to a table with 72 columns (or worse, 72 tables).
|
|
|
|
|
well I'm reasonably new in my current role, 8 or so months, but have been working with c# since version 1.0 of the .net framework. It still amazes me what you see in code written by the lowest bidder, and the inexperienced, but why oh why would you do this?...
public enum YesNo
{
N = 0,
Y = 1
}
...yes, this is live, production code, and just one of many, many examples of how not to do a job properly.
Rhys
"Technological progress is like an axe in the hands of a pathological criminal"
"Two things are infinite: the universe and human stupidity; and I'm not sure about the the universe"
|
|
|
|
|
Change it to this:
public enum YesNoMaybeBuzzOff
{
M = -1,
N = 0,
Y = 1,
BO = 42
}
At least artificial intelligence already is superior to natural stupidity
|
|
|
|
|
Yes, a forward-thinker. Good future planning.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Change it to
enum YesNo
{
N=0,
Y=1,
FileNotFound=-1
}
Bill Gates is a very rich man today... and do you want to know why? The answer is one word: versions.
Dave Barry
Read more at BrainyQuote[ ^]
|
|
|
|
|
game, set, match <chuckle>
|
|
|
|
|
Without more context that seems OK to me. I might use something like that when parsing a stream of input into a database.
|
|
|
|
|
I agree; this could be useful, depending on the context.
Another context I can think of that would be useful is a web service that returns what a user chose (e.g., they may select "yes" they'd like to subscribe to a service or "no" that they don't want an email newsletter).
|
|
|
|
|
Obviously the c# boolean type just isn't good enough in some places then...
...any further justification and you guys should hide your heads in shame...
Rhys
"Technological progress is like an axe in the hands of a pathological criminal"
"Two things are infinite: the universe and human stupidity; and I'm not sure about the the universe"
|
|
|
|
|
Agreed. But they should be shamed at any justification. You have my sympathy. 'probly came from an Access programmer [in case you don't know: Access has a data type YesNo].
|
|
|
|
|
Rhys Gravell wrote: Obviously the c# boolean type just isn't good enough in some places then
Correct, it's very limited. 
|
|
|
|
|
You lucky youngster! You cannot remeber the "Good" Old Days when Booleans had to be transformed to numbers. Well, "no" or "false" was generally 0, but "yes" or "true" had many definitions: 1, -1, 255 - these are just the most important ones I still remember.
And now imagine you have to write a new front end which communicates with a MUMPS server...
|
|
|
|
|
MUMPS server, now I feel a little ill
Rhys
"Technological progress is like an axe in the hands of a pathological criminal"
"Two things are infinite: the universe and human stupidity; and I'm not sure about the the universe"
|
|
|
|
|
I am busy removing empty catch blocks from a project I have inherited (Yes, the same one as before, made by the same criminal. You can tell by those great 'Denglish' variable names). Now I have found a catch block that's not empty. Finally. And what is done to handle the error?
This:
try
{
MessageBox.Show(String.Format(tt.Readwert("t3"), Konstanten.Ftpprogdir), tt.Readwert("t2"),
MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
}
catch
{
MessageBox.Show("Programmverzeichnis fehlt", tt.Readwert("t2"),
MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
}
Edit: "Programmverzeichnis fehlt" means 'the program directory is missing'. How can that be when the program is obviously running when it hits those code lines? And how does he conclude that by having failed to open a MessageBox? This tt.Readwert-nonsense does not check any directories. It's just his own shot at localizing strings.
Edit^´2: And let's not forget that the error message in case of an exception will obviously not be localized
At least artificial intelligence already is superior to natural stupidity
modified 2-Jul-12 5:05am.
|
|
|
|
|
looks like some copy/paste error to me. Wouldn't surprise me if you do a quick search on "Programmverzeichnis fehlt", you will find that more often.
But yea, this looks like some bad error handling.
|
|
|
|
|
I think it actually makes sense (even if it is not the correct way to do it).
I bet that the programmer expected that something in the
Konstanten.Ftpprogdir property could throw an exception.
|
|
|
|
|
Hey, you can read his twisted mind! Would you please come over and help me with making sense of the rest of this mess?
You are right. He tries to tell us that the application directory is not there. The program runs on a mobile device and tries to get the latest version of itself when the device is docked. My friend here just could not figure out how a program that is currently running can update itself. Now, how can it possibly happen that the application directory is not there when the application itself is obviously running at that moment? He is trying to prevent an impossible error.
He is like the coyote when he builds another roadrunner trap. Everybody but him can see how it is going to end. And when it explodes in his face, he can't figure out why. Instead he simply wraps the problematic code in a 'try' and leaves the catch block empty. Nothing has happened, let's just go on with it. This time he at least tried to show some error message, but of course not without making a mess out of that simple task.
I have written it before: Tar him, feather him, throw him out of the guild and then chase him out of town.
At least artificial intelligence already is superior to natural stupidity
|
|
|
|
|