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
trex eaterofcadrs
Jun 17, 2005
My lack of understanding is only exceeded by my lack of concern.

tripwire posted:

There is no god

I think it's more proof that the designers of RFC 822 were not very forward-thinking when they came up with it.

Adbot
ADBOT LOVES YOU

Avenging Dentist
Oct 1, 2005

oh my god is that a circular saw that does not go in my mouth aaaaagh

TRex EaterofCars posted:

I think it's more proof that the designers of RFC 822 were not very forward-thinking when they came up with it.

Or that they expected you to write a simple parser instead of using a regex.

ehnus
Apr 16, 2003

Now you're thinking with portals!

Erasmus Darwin posted:


Worst of all is the use of "if (x) { return true; } else { return false; }". What an awful idiom to be teaching to people.

A coworker stumbled across this and forwarded it to me:

code:
BOOL SomeWin32Function(DWORD param);

bool Function( uint32_t param )
{
    bool mybool = SomeWin32Function(param);
    int myint = (int) mybool;
    
    switch(myint)
    {
        case 0:
            {
                return (bool) 0;
            }     
            break;
        case 1:
            {
                return (bool) 1;
            }
            break;
    }
}
*sigh*

Filburt Shellbach
Nov 6, 2007

Apni tackat say tujay aaj mitta juu gaa!

Avenging Dentist posted:

Or that they expected you to write a simple parser instead of using a regex.

Considering that email addresses can contain nested comments, the authors were simply masochistic.

But really, use something like "does the string contain a @" as basic validation to make sure the user didn't mess up, then validate by actually sending mail.

1337JiveTurkey
Feb 17, 2005

A copy of that regex takes about 2MB of RAM and 2 ms to compile into an internal FSM representation on my computer. :psyduck:

Goat Bastard
Oct 20, 2004

ehnus posted:

A coworker stumbled across this and forwarded it to me:

code:
BOOL SomeWin32Function(DWORD param);

bool Function( uint32_t param )
{
    bool mybool = SomeWin32Function(param);
    int myint = (int) mybool;
    
    switch(myint)
    {
        case 0:
            {
                return (bool) 0;
            }     
            break;
        case 1:
            {
                return (bool) 1;
            }
            break;
    }
}
*sigh*

But a switch statement won't work with booleans, so how else would you be able to select the value to return :confused:

Zombywuf
Mar 29, 2008

Janin posted:

.+@.+

amivalid@123.23.3

TSDK
Nov 24, 2003

I got a wooden uploading this one

ehnus posted:

A coworker stumbled across this and forwarded it to me:
At first I thought it would be a really retarded way of getting round a:
code:
warning C4800: 'BOOL' : forcing value to bool 'true' or 'false' (performance warning)
warning message. But the first line in the function causes that warning to be spat out anyway.

Marmaduke
Feb 17, 2005

Zombywuf posted:

Janin posted:

.+@.+
amivalid@123.23.3

Honestly, given the number of email validators I've come across that incorrectly tell me that my email is invalid because it's got a '+' in it, I'd much rather they stuck to something simple like that. This at least won't reject valid email addresses.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

Zombywuf posted:

amivalid@123.23.3

Who cares? There's no guarantee that a well-formed email address is actually a working email address, so what do you actually gain from checking if it's well-formed?

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



tripwire posted:

There is no god but PERL and regular expressions are his prophets.

Can't figure out whay that popped into my head - I certianly don't like PERL that much.

Triple Tech
Jul 28, 2006

So what, are you quitting to join Homo Explosion?

Munkeymon posted:

Can't figure out whay that popped into my head - I certianly don't like PERL that much.

Perl. Perl. Do you go around saying poo poo like JAVA or RUBY? <:mad:>

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



Triple Tech posted:

Perl. Perl. Do you go around saying poo poo like JAVA or RUBY? <:mad:>

Do Java or Ruby stand for something? 'Cuz I'll start doing that if they do.

Ciaphas
Nov 20, 2005

> BEWARE, COWARD :ovr:


ryanmfw posted:

I was thinking more along these lines:
http://www.ex-parrot.com/~pdw/Mail-RFC822-Address.html :v:

Good god, if there is anything that exemplified the title of this thread, this is it. :(

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

Munkeymon posted:

Do Java or Ruby stand for something? 'Cuz I'll start doing that if they do.

Perl doesn't either.

spiritual bypass
Feb 19, 2008

Grimey Drawer

Plorkyeran posted:

Perl doesn't either.

Practical extrapolation and report language.

Unfortunately, that explanation was created long after Larry had been using the language.

6174
Dec 4, 2004

royallthefourth posted:

Practical extrapolation and report language.

Unfortunately, that explanation was created long after Larry had been using the language.

If you're going to go for the false etymology, you might as well go for Pathologically Eclectic Rubbish Lister.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

royallthefourth posted:

Practical extrapolation and report language.

Unfortunately, that explanation was created long after Larry had been using the language.

Considering you can make up backronyms for any word, I guess every proper noun should be written in all caps.

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



6174 posted:

If you're going to go for the false etymology, you might as well go for Pathologically Eclectic Rubbish Lister.

Yeah, that's really a lot more accurate.

Edit: Why the hell did he call it Perl if that didn't stand for something? Or did he just invent a language and then call it something?

Munkeymon fucked around with this message at 18:55 on Feb 12, 2009

ShoulderDaemon
Oct 9, 2003
support goon fund
Taco Defender

Zombywuf posted:

amivalid@123.23.3

I see what you were trying to do, but for what it's worth, that is a valid email address. Direct delivery to IP addresses is acceptable, and that is a valid (although not normalized) IP address. No-one ever does IP address validation correctly.

Zombywuf
Mar 29, 2008

ShoulderDaemon posted:

I see what you were trying to do, but for what it's worth, that is a valid email address. Direct delivery to IP addresses is acceptable, and that is a valid (although not normalized) IP address. No-one ever does IP address validation correctly.

That was my point (badly expressed). .+@.+ is about the only regex you can use that won't generate false negatives. Another example of this fun is myname@1234567890. Of course root is a valid email address, so even the above creates false negatives, for given values of false.

Also can 1.2.3.4 be a valid domain name?

Filburt Shellbach
Nov 6, 2007

Apni tackat say tujay aaj mitta juu gaa!

Munkeymon posted:

Edit: Why the hell did he call it Perl if that didn't stand for something? Or did he just invent a language and then call it something?

It was originally Pearl, some biblical reference (pearl of great price?) but he saw some other thing called Pearl so he dropped the a.

Lonely Wolf
Jan 20, 2003

Will hawk false idols for heaps and heaps of dough.

Plorkyeran posted:

Considering you can make up backronyms for any word, I guess every proper noun should be written in all caps.

It works for Gary Busey v:)v

LISP: Life Incidentially Supplies Powers

ShoulderDaemon
Oct 9, 2003
support goon fund
Taco Defender

Zombywuf posted:

Also can 1.2.3.4 be a valid domain name?

Strictly speaking I think it can be a valid domain name, but none of the toplevels start with numerals, and I don't expect ICANN to ever change that.

Zombywuf
Mar 29, 2008

ShoulderDaemon posted:

Strictly speaking I think it can be a valid domain name, but none of the toplevels start with numerals, and I don't expect ICANN to ever change that.

rfc1035 posted:

Although labels can contain any 8 bit values in octets that make up a
label, it is strongly recommended that labels follow the preferred
syntax described elsewhere in this memo, which is compatible with
existing host naming conventions. Name servers and resolvers must
compare labels in a case-insensitive manner (i.e., A=a), assuming ASCII
with zero parity. Non-alphabetic codes must match exactly.

0x07 (visual bell) is a valid domain name component. I wonder if any registrar will accept it...

Erasmus Darwin
Mar 6, 2001

ShoulderDaemon posted:

I see what you were trying to do, but for what it's worth, that is a valid email address. Direct delivery to IP addresses is acceptable, and that is a valid (although not normalized) IP address. No-one ever does IP address validation correctly.

I don't think amivalid@123.23.3 is direct delivery to an IP address. It's been a while since I read RFC822, but I seem to recall that you need to stick brackets around the IP address.

Checking with the local installation of Postfix:

code:
$ telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 ext.example.com  NO UCE  ESMTP
HELO localhost
250 ext.example.com
VRFY root@[127.0.0.1]
252 root@[127.0.0.1]
VRFY root@127.0.0.1
501 Bad address syntax
QUIT
221 Bye
Connection closed by foreign host.
$

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

Munkeymon posted:

Yeah, that's really a lot more accurate.

Edit: Why the hell did he call it Perl if that didn't stand for something? Or did he just invent a language and then call it something?

Yay for wikipedia!

quote:

Perl was originally named "Pearl," after the Parable of the Pearl from the Gospel of Matthew. Larry Wall wanted to give the language a short name with positive connotations; he claims that he considered (and rejected) every three- and four-letter word in the dictionary. He also considered naming it after his wife Gloria. Wall discovered the existing PEARL programming language before Perl's official release and changed the spelling of the name.

When referring to the language, the name is normally capitalized (Perl). When referring to the interpreter program itself, the name is often uncapitalized (perl) because Unix-like file systems are case-sensitive. Before the release of the first edition of Programming Perl, it was common to refer to the language as perl; Randal L. Schwartz, however, capitalised the language's name in the book to make it stand out better when typeset. This case distinction was subsequently documented as canonical.[10]

There is contention about the all-caps spelling "PERL," which the documentation declares incorrect[10] and which some core community members even consider a sign of outsiders.[11] Although the name is occasionally taken as an acronym for Practical Extraction and Report Language (which appears at the top of the documentation[12]), this expansion actually came after the name; several others have been suggested as equally canonical, including Wall's own humorous Pathologically Eclectic Rubbish Lister.[13] Indeed, Wall claims that the name was intended to inspire many different expansions.[14]

ShoulderDaemon
Oct 9, 2003
support goon fund
Taco Defender

Erasmus Darwin posted:

I don't think amivalid@123.23.3 is direct delivery to an IP address. It's been a while since I read RFC822, but I seem to recall that you need to stick brackets around the IP address.

Yeah, I think you're right. Silly me.

spiritual bypass
Feb 19, 2008

Grimey Drawer
I guess this talk of acronyms just brings us back to the way we program in Perl: Perl is whatever the programmer wants it to be.

Zombywuf
Mar 29, 2008

Erasmus Darwin posted:

I don't think amivalid@123.23.3 is direct delivery to an IP address. It's been a while since I read RFC822, but I seem to recall that you need to stick brackets around the IP address.

Checking with the local installation of Postfix:

code:
$ telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 ext.example.com  NO UCE  ESMTP
HELO localhost
250 ext.example.com
VRFY root@[127.0.0.1]
252 root@[127.0.0.1]
VRFY root@127.0.0.1
501 Bad address syntax
QUIT
221 Bye
Connection closed by foreign host.
$

Wow, I've also thought this works. Learn something new everyday.

Edit: Having said that, <zombywuf@[2130706433]>: bad address syntax. Anyone fancy reading the rfc for me because I can't be arsed finding out if postfix is getting it wrong.

Zombywuf fucked around with this message at 20:21 on Feb 12, 2009

Trammel
Dec 31, 2007
.
The 'not-invented-here' syndrome strikes again!

code:
   MyCompanyDate date = new MyCompanyDate('1950-01-01');
   System.out.println(date.toString());

.....
1970-01-01

It's awesome. We have our own "official" date object, that doesn't store date's before 1/1/1970.

Suppliers send us dates earlier than this all the time, and it just gets stripped from the XML.

TSDK
Nov 24, 2003

I got a wooden uploading this one

Trammel posted:

The 'not-invented-here' syndrome strikes again!
A friend of mine has been asked to replace the calls to functions in System.Security.Cryptography in a C# app he's working on with calls to encryption functions written in-house in order to 'increase' security. Needless to say that the in-house encryption functions amount to nothing more than a polyalphabetic cipher with a fixed key.

Mmm, I love me some security.

TSDK
Nov 24, 2003

I got a wooden uploading this one
quote != edit

raminasi
Jan 25, 2005

a last drink with no ice
check out this sweet container (DynamicArray is a homegrown resizable array that's basically std::vector without bounds checking and the added bonus of being completely inscrutable to the visual c++ debugger)

code:
class WallContainer {
private:
	DynamicArray <Wall> walls;

public:
	void AddWall (Wall wall) {
		walls.AddToEnd (wall);
	}

	int Size () {
		return walls.Size ();
	}

	Wall GetWall (int index) {
		return walls [index];
	}

	void SortWalls () {
		for (int i = 0; i < walls.Size () - 1; i++) {
			for (int j = i + 1; j < walls.Size (); j++) {
				Wall w1 = walls [i];
				Wall w2 = walls [j];
				if (w1.instNum > w2.instNum) {  
					Wall tmp;
					tmp = walls [j];			
					walls [j] = walls [i];
					walls [i] = tmp;
				}
			}
		}
	}

	double GetWallThicknessByInstNum (long instNum) {
		int max = walls.Size () - 1;
		int min = 0;

		for (int pos = (max + min) / 2; max >= min; pos = (max + min) / 2) {
			Wall w;
			w = walls [pos];
			if (w.instNum == instNum) {
				return w.wallThickness;
			}

			if (w.instNum < instNum) {
				min = pos + 1;
			} else {
				max = pos - 1;
			}
		}

		return 0.0;
	}
};
use: populate the container, call SortWalls, and then don't add any more walls. I'm not really sure what GetWall is supposed to be useful for.

raminasi fucked around with this message at 23:07 on Feb 12, 2009

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
I'm curious if there's a difference between DynamicArray::Size() and DynamicArray::GetNumb().

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



Plorkyeran posted:

Indeed, Wall claims that the name was intended to inspire many different expansions.[14]

I swear that guy would be most happy living in the programmer's district of Toonland or whatever it was from Roger Rabbit.

quote:

What's your language today, Larry?

Oh, I thought I'd mash together MUMPS and Ruby and then make people end lines with the visual bell character. This will be a module for Perl 6 but I want to get it out of the way now.

raminasi
Jan 25, 2005

a last drink with no ice

rjmccall posted:



There isn't, actually - I just changed the method name to make it a little more clear to people reading but forgot that one. Whoops!

Zakalwe
May 12, 2002

Wanted For:
  • Terrorism
  • Kidnapping
  • Poor Taste
  • Unlawful Carnal Gopher Knowledge

GrumpyDoctor posted:

check out this sweet container (DynamicArray is a homegrown resizable array that's basically std::vector without bounds checking and the added bonus of being completely inscrutable to the visual c++ debugger)


home-grown wheel reinvention, difficult to debug, the lack of reference parameters/returns and an always O(n^2) bubble sort.

Beautiful

necrobobsledder
Mar 21, 2005
Lay down your soul to the gods rock 'n roll
Nap Ghost

Avenging Dentist posted:

Or that they expected you to write a simple parser instead of using a regex.
I think they expected you to submit the e-mail address to a web service that validates the address for you. Because I'd almost rather write a new TCP stack than try to write that regex.

Also, I think that regex should be treated like a magiceye picture and perhaps it's all a cruel joke and you get goatse'd.

Adbot
ADBOT LOVES YOU

Filburt Shellbach
Nov 6, 2007

Apni tackat say tujay aaj mitta juu gaa!
RFC 822 predates the web by a decade.. and web services by two.

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