Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
dustgun
Jun 20, 2004

And then the doorbell would ring and the next santa would come
Back to crummy code.
code:
int Parser::Find()
{
    int found = -1;
    int i;
	for(i = 0 ; i < BUFFER_SIZE ; i++)
	{
		if (STOPWORD == m[i])
		{
                    found = 1;
		    break;
		} 
	}

	if (found != 1)
	{
		 i = -1;
        } 
	return (i);
}// end function
:sigh:

Adbot
ADBOT LOVES YOU

dustgun
Jun 20, 2004

And then the doorbell would ring and the next santa would come

Victor posted:

Clearly, return is a function. :psyduck:

I should mention, just for the sake of mentioning, that this was written by a coworker of a friend of mine. I changed the method and variable names, but, it's real live code somewhere.

dustgun
Jun 20, 2004

And then the doorbell would ring and the next santa would come

brae posted:

Just a note, blank? is an extension provided by one of the Active* libraries that rails uses. There isn't a blank? in vanilla ruby. For strings and standard containers you can use nil? and empty? in conjunction. I think this is what blank? does behind the scenes, anyway.

http://dev.rubyonrails.org/browser/trunk/activesupport/lib/active_support/core_ext/blank.rb
It's simple enough to just toss into whatever project you need to use it in.

dustgun
Jun 20, 2004

And then the doorbell would ring and the next santa would come

Victor posted:

Gotta protect against FILE_NOT_FOUND!
Bool.FileNotFound :colbert:

dustgun
Jun 20, 2004

And then the doorbell would ring and the next santa would come
I'm not sure what you can do to make that code a lot better. I mean, putting all the JButtons into a hashtable to cut down on variables and allowing you to loop over them to do the repetitive stuff, but if this is a lower level class I'd have second thoughts about even that.

It's sort of crummy code, but it's not a horror or anything.

dustgun
Jun 20, 2004

And then the doorbell would ring and the next santa would come
Decimals are for Chris Busch's CALCULATOR 2.0!!!!!!!!, obviously.

dustgun
Jun 20, 2004

And then the doorbell would ring and the next santa would come
The !false looks like it comes from debugging the loop (or maybe code right after it). Like, instead of commenting out the loop, he initially just put the false in there to short-circuit it, and then at the end he !ed it? I don't know - !false is just too weird to not have a little backstory that does make some modicum of sense.

dustgun
Jun 20, 2004

And then the doorbell would ring and the next santa would come

ZorbaTHut posted:

I'm having a hard time coming up with any design that involves 1000 columns, unless you're doing something retarded like altering the table to add more columns whenever you need a new relation.

I will admit I did this once, before I really understood databases :(

quote:

My database stores the behaviors of visitors to develop predicative modeling applications for a mid-sized online retailer. The data collection process is automated, and responses can fill up the tables very fast. I've found that takes a lot of data to accurately run a regression, as the behaviors of Internet users is pretty much random. In my system, each participant is a row, and each response is a column. Many people tend to revisit the site on a regular basis, and it is not uncommon at all for the click-throughs of certain users to exceed the 1000 column limit over a period of time.

I don't mind having to break the data up into chunks when it comes time to import the data into SPSS for analysis, however, I do get annoyed by having to store the data in chunks.

I think there is a high demand for scalability on disgusting proportions, I for one, would benefit from this.
Is his reply when someone asks what the hell he's doing with 1000 columns.

I tend not to get angry at people over the internet, but, man I really want to yell at this guy.

Adbot
ADBOT LOVES YOU

dustgun
Jun 20, 2004

And then the doorbell would ring and the next santa would come
index.length() should be value.length() ?

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply