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
Hiowf
Jun 28, 2013

We don't do .DOC in my cave.

Hammerite posted:

makes no reference of what RDBMS it is talking about anywhere in the header or footer material of the page, nor in the URL

The "5.1" part in the URL is actually a dead giveaway.

Adbot
ADBOT LOVES YOU

The Laplace Demon
Jul 23, 2009

"Oh dear! Oh dear! Heisenberg is a douche!"

ErIog posted:

You posting that made me wonder if any of these modern languages allow variable names written in Unicode characters.

Does C++ count?

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

JS has allowed it since...1998?

Kallikrates
Jul 7, 2002
Pro Lurker
Swift allows unicode. https://github.com/mattt/Euler/blob/master/Euler.swift

SupSuper
Apr 8, 2009

At the Heart of the city is an Alien horror, so vile and so powerful that not even death can claim it.
Java and C# too. Just because you can have weird-rear end confusing Unicode identifiers, doesn't mean you should, just like ASCII identifiers.

canis minor
May 4, 2011

PHP allows it!

code:
$���ð = 5;
var_dump($���ð);

int(5)
(of course being PHP, it leads to hilarious side-effects: https://bugs.php.net/bug.php?id=18556, if specifying locales)

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe

Skuto posted:

The "5.1" part in the URL is actually a dead giveaway.

All right, smarty pants, but we shouldn't need to rely on being able to spot something so obscure (or searching the page for "MySQL", or any other workaround)

KernelSlanders
May 27, 2013

Rogue operating systems on occasion spread lies and rumors about me.
Scala has a control structure that uses => as a separator. Of course ⇒ is also a legal replacement and intellij has a setting to automatically replace it for you.

HappyHippo
Nov 19, 2003
Do you have an Air Miles Card?
I once made a chess program in C#, and for kicks I was planning on having the names of the Pieces enumeration be the actual Unicode chess piece characters. Unfortunately that was not allowed.

Coffee Mugshot
Jun 26, 2010

by Lowtax

shodanjr_gr posted:

Access control semantics derived by (and imposing) capitalization...How isn't this a horror?

It works in practice extremely well and it works everywhere, i.e. comments are unexported to doc tools if they start with a lowercase letter. I don't really see a problem with using capitalization rather than strange keywords that barely enforce access control (private/public/etc). It's also nice because you can choose parts of object to export. Having a unexported struct with certain fields/methods exported is common and easy to read.

Xenoveritas
May 9, 2010
Dinosaur Gum

SupSuper posted:

Java and C# too. Just because you can have weird-rear end confusing Unicode identifiers, doesn't mean you should, just like ASCII identifiers.

Which reminds me of one of my favorite Java-isms, Unicode escapes. Unicode escapes, sounds simple enough, right? Instead of writing "Σ" you could write "\u03A3". Nothing weird about that, right?

As it turns out, Unicode escapes are parsed first, prior to any tokenization. Meaning that:

int \u03A3 = 1;
System.out.println(Σ);


Is valid java and prints 1.

Steve French
Sep 8, 2003

Voted Worst Mom posted:

It works in practice extremely well and it works everywhere, i.e. comments are unexported to doc tools if they start with a lowercase letter. I don't really see a problem with using capitalization rather than strange keywords that barely enforce access control (private/public/etc). It's also nice because you can choose parts of object to export. Having a unexported struct with certain fields/methods exported is common and easy to read.

Seems ever so slightly inconvenient to have to update references to an unexported thing when changing it to exported?

fritz
Jul 26, 2003

HappyHippo posted:

I once made a chess program in C#, and for kicks I was planning on having the names of the Pieces enumeration be the actual Unicode chess piece characters. Unfortunately that was not allowed.


All sorts of fun with pawn promotions.

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

Xenoveritas posted:

Which reminds me of one of my favorite Java-isms, Unicode escapes. Unicode escapes, sounds simple enough, right? Instead of writing "Σ" you could write "\u03A3". Nothing weird about that, right?

As it turns out, Unicode escapes are parsed first, prior to any tokenization. Meaning that:

int \u03A3 = 1;
System.out.println(Σ);


Is valid java and prints 1.

I think that's pretty cool and good.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

KernelSlanders posted:

Now I must resist the temptation to name a function ねこです.

It's very easy to resist: stop watching anime, you nerd.

Karate Bastard
Jul 31, 2007
Probation
Can't post for 28 minutes!
Soiled Meat
I think the underhanded code dev people should be having a field day with this. I'm getting a sudden urge to complement the functionality of the base class method HttpClient.Authenticate(user, pass) with some special sauce in the secure derived class method HttpsClient.Authenticate(user, pass), and yes of course that's a complementary utility method and not an override you dolt, didn't you notice the uppercase greek alpha character in the method name?

it is
Aug 19, 2011

by Smythe
I just started a new job as a QA automation engineer and the other guy on my team is something.
public void thing()
{
declaration
declaration
declaration
declaration
assert
declaration
mutation
declaration
assert
assert
declaration
assert
assert
}

why

Xenoveritas
May 9, 2010
Dinosaur Gum

Wheany posted:

I think that's pretty cool and good.

The problem is that it's only really useful in two circumstances: when you're accessing a third-party library that has symbols that use characters you can't encode as proper text for whatever reason, or when you want to write obfuscated code.

Java code:
\u002F\u002A It helps that just about nothing that highlights Java
code bothers dealing with Unicode escapes.

So all this is a Java comment and not code.
*/

int\u0020foo\u0020\u003d\u0034\u0032\u003b\u000aSystem.out.println(foo);

/\u002f That prints 42, of course.

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."
Reminds me of this from Java Puzzlers:
Java code:
public class LinePrinter {
    public static void main(String[] args) {
        // Note: \u000A is Unicode representation of linefeed (LF)
        char c = 0x000A;
        System.out.println(c);
    }
}
(If you don't already get it, try compiling that program and running it.)

Coffee Mugshot
Jun 26, 2010

by Lowtax

Steve French posted:

Seems ever so slightly inconvenient to have to update references to an unexported thing when changing it to exported?

It is, which is why there's https://golang.org/cmd/fix/ and other similar things. Go has good tooling despite everything else.

raminasi
Jan 25, 2005

a last drink with no ice

it is posted:

I just started a new job as a QA automation engineer and the other guy on my team is something.
public void thing()
{
declaration
declaration
declaration
declaration
assert
declaration
mutation
declaration
assert
assert
declaration
assert
assert
}

why

It is hard to tell exactly what you're complaining about.

it is
Aug 19, 2011

by Smythe
Let's say this test fails on the first assert. The developer makes a fix and the test fails in a new place for an entirely unrelated reason. This should probably have been split into at least 3 different tests; by the time you're asserting stuff you're done writing the logic for the test.

b0lt
Apr 29, 2005

it is posted:

Let's say this test fails on the first assert. The developer makes a fix and the test fails in a new place for an entirely unrelated reason.

who cares

Polio Vax Scene
Apr 5, 2009



Internet Janitor posted:

Reminds me of this from Java Puzzlers:

(If you don't already get it, try compiling that program and running it.)

Reproduced it in c#, is the joke that it prints two lines?

HappyHippo
Nov 19, 2003
Do you have an Air Miles Card?

Manslaughter posted:

Reproduced it in c#, is the joke that it prints two lines?

I haven't compiled it, but I think it's that the "\u000A" in the comment is interpreted as a LF by the compiler, splitting the comment onto two lines, and only the first line will start with // so you get a syntax error.

Munkeymon
Aug 14, 2003

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



b0lt posted:

who cares

Anyone who cares about following testing best practices.

Xenoveritas
May 9, 2010
Dinosaur Gum

HappyHippo posted:

I haven't compiled it, but I think it's that the "\u000A" in the comment is interpreted as a LF by the compiler, splitting the comment onto two lines, and only the first line will start with // so you get a syntax error.

Correct. If you read section 3.2 in the Java spec, Unicode escapes are handled in step 1, and comments are discarded in step 3.

baquerd
Jul 2, 2007

by FactsAreUseless

Munkeymon posted:

Anyone who cares about following testing best practices.

For integration or systems tests, OK. But for unit tests, if a developer breaks a long test like this, using best practices they'll find out immediately before anything is even committed and will also perform the second fix then. I like these style of tests more than fifty tests called DoXButWithModificationOfYandZbutNotQ.

it is
Aug 19, 2011

by Smythe

baquerd posted:

For integration or systems tests, OK. But for unit tests, if a developer breaks a long test like this, using best practices they'll find out immediately before anything is even committed and will also perform the second fix then. I like these style of tests more than fifty tests called DoXButWithModificationOfYandZbutNotQ.

I won't take advice from you, because you're an idiot.

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Xenoveritas posted:

Which reminds me of one of my favorite Java-isms, Unicode escapes. Unicode escapes, sounds simple enough, right? Instead of writing "Σ" you could write "\u03A3". Nothing weird about that, right?

As it turns out, Unicode escapes are parsed first, prior to any tokenization. Meaning that:

int \u03A3 = 1;
System.out.println(Σ);


Is valid java and prints 1.

http://en.m.wikipedia.org/wiki/Digraphs_and_trigraphs

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

Xenoveritas posted:

[code=java]\u002F\u002A It helps that just about nothing that highlights Java
code bothers dealing with Unicode escapes.

So all this is a Java comment and not code.
*/

a) Is this actually a widespread thing?
b) If it is a problem, use an interpreter that follows the spec.

That "\u002F\u002A" is an interesting quirk, but not something anyone would actually do anywhere except when showing off (in for example a "Coding horrors" thread).

baquerd
Jul 2, 2007

by FactsAreUseless

it is posted:

I won't take advice from you, because you're an idiot.

That's OK, they pay me way more than the testers anyway.

Coffee Mugshot
Jun 26, 2010

by Lowtax

it is posted:

Let's say this test fails on the first assert. The developer makes a fix and the test fails in a new place for an entirely unrelated reason. This should probably have been split into at least 3 different tests; by the time you're asserting stuff you're done writing the logic for the test.

Are you always done writing the logic for a test once your start asserting? What if you want to assert the invariants hold true before, during, and after execution of some process? It's hard to tell what you're complaining about with your example. If it is three different tests then it should be three different tests; assertion doesn't imply the end of test.

sarehu
Apr 20, 2007

(call/cc call/cc)

it is posted:

I won't take advice from you, because you're an idiot.

, says the 2011 regdate.

Enjoy your arbitrary rules not based on a sensible theory of harm.

NiceAaron
Oct 19, 2003

Devote your hearts to the cause~

Voted Worst Mom posted:

Are you always done writing the logic for a test once your start asserting? What if you want to assert the invariants hold true before, during, and after execution of some process? It's hard to tell what you're complaining about with your example. If it is three different tests then it should be three different tests; assertion doesn't imply the end of test.

Leaving aside the "during", testing whether an invariant holds true before some process seems like a clearly different test than testing whether an invariant holds true after some process - you're not really testing said process at all in the first case, you're testing whatever you were doing before that process.

Xenoveritas
May 9, 2010
Dinosaur Gum

I'll note that none of the examples in that article look exactly like string escape sequences and are designed to solve a problem that essentially did not exist at the time Java was being developed. (To the point where C++ is planning on removing support for them entirely in C++17.)

Wheany posted:

a) Is this actually a widespread thing?

People using Unicode escapes to write unreadable code? Only when purposely trying to write unreadable Java. It's just a weird quirk of Java that I doubt anyone would expect. However, things like that Java puzzler Internet Janitor posted? Those are things I could see people running into and not understanding why the following is not valid Java and will not compile:

Java code:
char apostrophe = '\u0027';
String quote = "\u0022";
Edit: Oh, and one last thing, the following change to Internet Janitor's puzzler will work:

Java code:
public class LinePrinter {
    public static void main(String[] args) {
        // Note: \\u000A is Unicode representation of linefeed (LF)
        char c = 0x000A;
        System.out.println(c);
    }
}

Xenoveritas fucked around with this message at 02:07 on Feb 4, 2015

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

hosed up if true.

Hiowf
Jun 28, 2013

We don't do .DOC in my cave.
Meanwhile, in embedded (really, Android) land, we discovered a vendor has been shipping drivers that try to load firmware...using a relative path...while being loaded in the application context.

Took about a week of debugging to see why our software just wouldn't work on a peculiar set of devices.

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...

Skuto posted:

Meanwhile, in embedded (really, Android) land, we discovered a vendor has been shipping drivers that try to load firmware...using a relative path...while being loaded in the application context.

Took about a week of debugging to see why our software just wouldn't work on a peculiar set of devices.

I would probably just cry a little bit at that point.

Adbot
ADBOT LOVES YOU

Storysmith
Dec 31, 2006

Skuto posted:

Meanwhile, in embedded (really, Android) land, we discovered a vendor has been shipping drivers that try to load firmware...using a relative path...while being loaded in the application context.

Took about a week of debugging to see why our software just wouldn't work on a peculiar set of devices.

Well on the plus side, depending on the specific path and whether they've shipped anything to anyone yet, you might have a CVE soon?

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