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
floWenoL
Oct 23, 2002

HFX posted:

Just that many languages such as C / Java are utterly terrible about making you constantly declare a rather low level when it would be better off to give you something high level and then have a low level if you need it.

maybe you don't 'get' languages that are meant for performance.

Adbot
ADBOT LOVES YOU

Mikey-San
Nov 3, 2005

I'm Edith Head!

floWenoL posted:

maybe you don't 'get' languages that are meant for performance.

Java is meant for performance?

ho ho :downsrim:

HFX
Nov 29, 2004

floWenoL posted:

maybe you don't 'get' languages that are meant for performance.

Yeah you are probably right. Wouldn't know anything about performance at all or when and where to use it.

Zombywuf
Mar 29, 2008

HFX posted:

I write for my needs. Often times, this does mean using C, C++, Java. However, I've also realized how much time I waste coding for them. This is especially true when you realize that static type inferring functional languages are often more then fast enough without making you think about the small details when they aren't necessary.

Function Programmers posted:

Yeah it's easy to implement this, I just declare a simple monoidal transform using arrow notaion using the fixed point combinator. Glad I don't have to do anything complicated like declare an int.

RussianManiac
Dec 27, 2005

by Ozmaugh

Mikey-San posted:

Java is meant for performance?

ho ho :downsrim:

I would say Java nowadays has a very good trade-off between being semi-interpreted, virtual machine language and being fast.

Doing OOP is a lot easier and friendlier in Java, but if you are really worried about speed, then you can always write parts of your project in native code and still use it from Java. I guess that is true of most language, however.

Munkeymon
Aug 14, 2003

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



Lonely Wolf posted:

Well I hope this thread has taught you that it's far cheaper and far more effective to simply hire worse programmers.

We did have a guy overloading different Collections classes so he could rename the access methods, so there's that. CollectionSubtype.count_mine() is clearly superior :v: I think the real moral of the story is that you should buy your IL obfuscater from the same place you get your prebuilt UI widgets because saving a few hundred bucks is totally worth days of programmer time per release and you know those guys know their IL obfuscation because that ribbon widget is totally shiny as gently caress.

Inverse Icarus
Dec 4, 2003

I run SyncRPG, and produce original, digital content for the Pathfinder RPG, designed from the ground up to be played online.

RussianManiac posted:

I would say Java nowadays has a very good trade-off between being semi-interpreted, virtual machine language and being fast.

Doing OOP is a lot easier and friendlier in Java, but if you are really worried about speed, then you can always write parts of your project in native code and still use it from Java. I guess that is true of most language, however.

http://www.ibm.com/developerworks/java/library/j-jtp09275.html

http://www.theregister.co.uk/2008/05/22/java_performance_myths/

etc, etc

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

Today I learned the concept of defensive copying. In hindsight it's totally obvious, and I've even thought that doing stuff like Point getPoint(){ return this.point; } is kind of dangerous, but it never occurred to me that I could do a return new Point(this.Point);. Also, I never thought that I should also make a copy of the object passed to my constructor for the same reason.

I'm a coding horror :(

Bizarro Buddha
Feb 11, 2007

Wheany posted:

Today I learned the concept of defensive copying. In hindsight it's totally obvious, and I've even thought that doing stuff like Point getPoint(){ return this.point; } is kind of dangerous, but it never occurred to me that I could do a return new Point(this.Point);. Also, I never thought that I should also make a copy of the object passed to my constructor for the same reason.

I'm a coding horror :(

I would say that this is why a language needs user-defined value types.

Vexed Morgan
Dec 22, 2008

Janin posted:

It doesn't even exist in the real Jargon File, just the bizarro ESR version.

Hey, you might call the Jargon File bogus, but ESR made it accessible to Aunt Tillie.

mr_jim
Oct 30, 2006

OUT OF THE DARK

Vexed Morgan posted:

Hey, you might call the Jargon File bogus, but ESR made it accessible to Aunt Tillie.

Thanks to the appendices, I learned that I'm likely to be politically moderate to neo-conservative, and my love of "exotic beers" like Guinness is influenced by Linus Torvalds.

Also, "anti-idiotarianism" is a very common term. Thanks ESR! :allears:

tef
May 30, 2004

-> some l-system crap ->
http://www.inwap.com/pdp10/hbaker/hakmem/hakmem.html

hakmen is the real hackers' file.

esr's dictionary is best left to rot somewhere.

wrok
Mar 24, 2006

by angerbotSD
code:
    foreach (string item in _ptAttributeDic.Keys)
    {
        string val = _ptAttributeDic[item];
        switch (item.ToLower())
        {
            case "mail":
                if (string.IsNullOrEmpty(base._email))
                    base._email = val;
                break;
            
            case "facsimiletelephonenumber":
                base._faxNum = val;
                break;
            
            case "telephonenumber":
                base._phoneNumber = val;
                break;
        }
    }

Vexed Morgan
Dec 22, 2008

tef posted:

http://www.inwap.com/pdp10/hbaker/hakmem/hakmem.html

hakmen is the real hackers' file.

esr's dictionary is best left to rot somewhere.

hey, Oderint, dum metuant

tef
May 30, 2004

-> some l-system crap ->

Vexed Morgan posted:

hey, Oderint, dum metuant

I'm not scared of 'bullets slathered in pork fat'.

chocojosh
Jun 9, 2007

D00D.

wrok posted:

code:
    foreach (string item in _ptAttributeDic.Keys)
    {
        string val = _ptAttributeDic[item];
        switch (item.ToLower())
        {
            case "mail":
                if (string.IsNullOrEmpty(base._email))
                    base._email = val;
                break;
            
            case "facsimiletelephonenumber":
                base._faxNum = val;
                break;
            
            case "telephonenumber":
                base._phoneNumber = val;
                break;
        }
    }

So this is such a bad varation of the for-switch that once it matches either "mail", "facsimiletelephonenumber", or "telephonenumber" it's going to exit the loop.

Unless the author meant to only initialize one of them, but then it would just be much easier to use

if(_ptAttributeDic.Contains("X"))
base._X = _ptAttributeDic["X"];
...

wrok
Mar 24, 2006

by angerbotSD
code:
if(_ptAttributeDic.Contains("X"))
   base._X = _ptAttributeDic["X"];
...
That's what it should do and how I rewrote it. Love my coworkers! :suicide:

Jethro
Jun 1, 2000

I was raised on the dairy, Bitch!

chocojosh posted:

wrok posted:

code:
    foreach (string item in _ptAttributeDic.Keys)
    {
        string val = _ptAttributeDic[item];
        switch (item.ToLower())
        {
            case "mail":
                if (string.IsNullOrEmpty(base._email))
                    base._email = val;
                break;
            
            case "facsimiletelephonenumber":
                base._faxNum = val;
                break;
            
            case "telephonenumber":
                base._phoneNumber = val;
                break;
        }
    }
So this is such a bad varation of the for-switch that once it matches either "mail", "facsimiletelephonenumber", or "telephonenumber" it's going to exit the loop.

Unless the author meant to only initialize one of them, but then it would just be much easier to use

if(_ptAttributeDic.Contains("X"))
base._X = _ptAttributeDic["X"];
...
The break; in this example only exits the switch statement; it doesn't exit the loop. The one "benefit" to this particular foreach-case is that it replaces checking for the existence of each key, but then of course it does so at the cost of looping through each key of the dictionary. I suppose if the dictionary in question was only going to contain at most the three keys used here it might even count as a clever trick, but other than that it's a pretty standard example of the for-case paradigm.

Marmaduke
Feb 17, 2005

Jethro posted:

The break; in this example only exits the switch statement; it doesn't exit the loop. The one "benefit" to this particular foreach-case is that it replaces checking for the existence of each key, but then of course it does so at the cost of looping through each key of the dictionary. I suppose if the dictionary in question was only going to contain at most the three keys used here it might even count as a clever trick, but other than that it's a pretty standard example of the for-case paradigm.

I think the reason for the whole for-switch business is so they can search the keys in a case-insensitive fashion.

floWenoL
Oct 23, 2002

chocojosh posted:

So this is such a bad varation of the for-switch that once it matches either "mail", "facsimiletelephonenumber", or "telephonenumber" it's going to exit the loop.

I love it when coding horrors spawn even more coding horrors, like this sentence.

Avenging Dentist
Oct 1, 2005

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

Marmaduke posted:

I think the reason for the whole for-switch business is so they can search the keys in a case-insensitive fashion.

A sane person would write a different comparator for the map.

blorpy
Jan 5, 2005

Oh chocojosh, never stop posting. :shobon:

Scaevolus
Apr 16, 2007

chocojosh posted:

So this is such a bad varation of the for-switch that once it matches either "mail", "facsimiletelephonenumber", or "telephonenumber" it's going to exit the loop.

Serious question, have you ever used C, C++, C#, or Java?

Shavnir
Apr 5, 2005

A MAN'S DREAM CAN NEVER DIE

Scaevolus posted:

Serious question, have you ever used C, C++, C#, or Java?

Can't switch on strings in Java (unless it gets added to Project Coin and by extension Java7) so it wasn't Java :v:

Opinion Haver
Apr 9, 2007

So I was dicking around on Wikipedia when I noticed that the source code of the article on Abraham Lincoln had the following line in its source:
code:
{{convert|5500|acres|km2|0|abbr=on}}
Apparently, this produces the text "5,500 acres (22 km²)". So I decided to look at the {{convert}} template itself, see how this magic works exactly.

code:
<includeonly>{{#ifeq:{{{sortable|}}}|on|<span style="display:none">{{padleft:{{{1}}}|16|0}}</span>}}{{convert/{{{2}}}|{{{1}}}|{{#ifeq:{{#expr:{{{3|0}}}*0}}|0|0}}
|{{{3|}}}|{{{4|}}}|{{{5|}}}|{{{6|}}}|r={{#ifeq:{{{sp}}}|us|er|re}}|d=L{{{lk|off}}}A{{{abbr|off}}}D{{{disp|b}}}S{{{
adj|{{{sing|off}}}}}}|s={{{sigfig|}}}}}</includeonly><noinclude>{{Documentation}}</noinclude>
oh god my eyes

edited to not break tables, the original has no linebreaks

vvvv is that the regex for matching all valid e-mail addresses?

Opinion Haver fucked around with this message at 04:39 on Oct 7, 2009

Zakalwe
May 12, 2002

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

yaoi prophet posted:

oh god my eyes

edited to not break tables, the original has no linebreaks

(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])

Zakalwe
May 12, 2002

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

yaoi prophet posted:

vvvv is that the regex for matching all valid e-mail addresses?


Ding ding ding.

TOO SCSI FOR MY CAT
Oct 12, 2008

this is what happens when you take UI design away from engineers and give it to a bunch of hipster art student "designers"

Zakalwe posted:

Ding ding ding.

Why is it so much shorter than Mail::RFC822::Address?

Scaevolus
Apr 16, 2007

Janin posted:

Why is it so much shorter than Mail::RFC822::Address?
Because normal people don't care about adhering to RFC822.

Zakalwe
May 12, 2002

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

Janin posted:

Why is it so much shorter than Mail::RFC822::Address?

Different RFC. I posted RFC2822

TOO SCSI FOR MY CAT
Oct 12, 2008

this is what happens when you take UI design away from engineers and give it to a bunch of hipster art student "designers"

Scaevolus posted:

Because normal people don't care about adhering to RFC822.

Well if you don't care about adhering to the standard, here's an even shorter regex:

.*@.*

Scaevolus
Apr 16, 2007

Janin posted:

Well if you don't care about adhering to the standard, here's an even shorter regex:

.*@.*
Yes, there are sites that do that for basic form validation. The point isn't to make sure that the input is perfect, it's just to check that users enter something vaguely like an email in the field.

RussianManiac
Dec 27, 2005

by Ozmaugh
how exactly do comments inside email addresses work?

chocojosh
Jun 9, 2007

D00D.

Scaevolus posted:

Serious question, have you ever used C, C++, C#, or Java?

I'm a .NET developer working on WPF, WCF, and Windows Mobile.

I had a brain fart about how break works. Other stuff was on my mind.

TOO SCSI FOR MY CAT
Oct 12, 2008

this is what happens when you take UI design away from engineers and give it to a bunch of hipster art student "designers"

RussianManiac posted:

how exactly do comments inside email addresses work?

They're used to add additional human-readable text to an email address. For example, you might have the following addresses:

John Smith <jsmith@work.com> (Work)
John Smith <shscgoon420@aol.com> (Home)

In which the "(Work)" and "(Home)" segments are comments.

floWenoL
Oct 23, 2002

chocojosh posted:

I had a brain fart about how break works. Other stuff was on my mind.

Sorry about your girlfriend, mang.

TheSleeper
Feb 20, 2003

Shavnir posted:

Can't switch on strings in Java (unless it gets added to Project Coin and by extension Java7) so it wasn't Java :v:

Hint: he wasn't talking about chocojosh familiarity with switch statements.

enki42
Jun 11, 2001
#ATMLIVESMATTER

Put this Nazi-lover on ignore immediately!
RFC 822 compliance is pointless anyway since there's a sizeable amount of e-mail servers that can't deal with perfect compliance anyways. Being technically correct in this case leads to more problems than it solves. The best check of e-mail correctness (beyond checking if it looks vaguely like an e-mail address) is to see if it bounces the first time you actually have to send an e-mail to that person.

Zombywuf
Mar 29, 2008

enki42 posted:

RFC 822 compliance is pointless anyway since there's a sizeable amount of e-mail servers that can't deal with perfect compliance anyways. Being technically correct in this case leads to more problems than it solves. The best check of e-mail correctness (beyond checking if it looks vaguely like an e-mail address) is to see if it bounces the first time you actually have to send an e-mail to that person.

*sets up accidental spam relay*

Adbot
ADBOT LOVES YOU

biznatchio
Mar 31, 2001


Buglord

Zombywuf posted:

*sets up accidental spam relay*

Yeah maaaan if you're going to be helping spammers out, the least you could do is validate their email address list for RFC compliance for them first.

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