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
KaneTW
Dec 2, 2011

Sang- posted:

Matlab could fill this entire thread with how awful it is.

Don't even get me started about MAPLE.

I have no idea how people can write software that terrible. Been using Mathematica for a couple years now and it's oh so much better.

Except this class requires me to use MAPLE.

Adbot
ADBOT LOVES YOU

KaneTW
Dec 2, 2011

Hammerite posted:

I made a couple of posts a while ago itt about Maple, but I don't think many people have used it, so I didn't get a response. Never used Mathematica.

Yeah, I think Maple is more used in Europe than the US. My core complaints about Maple are that it tries to shoehorn 'all those programming trends' into a single thing and requires you to write code like

code:
ugh := x -> Quantity(GetValue(x) * GetUnit(x), GetError(x) * GetUnit(x)):
ME := ugh(Constant(M[Earth]));
MS := ugh(Constant(M[Sun]));
G := ugh(Constant(G));
a := Quantity(simplify(Unit(AU)), 1^(-20) * Unit(m));
T := combine(sqrt(4 * Pi^2 / (G*a^3*(MS+ME))), errors);
Nope, you can't use Constant directly despite the object being supported by Getxxx.

KaneTW
Dec 2, 2011

Because it's unneeded in a data format designed for data interchange.

KaneTW
Dec 2, 2011

This thread has gone meta.

E: ^ post it in the "small programming questions" thread

KaneTW
Dec 2, 2011

Strong Sauce posted:

Well like I said, I'm not exactly handling large blobs of data using JSON right now, so there's no real effect on me. I merely stated that I could see that some people would find use in having JSON support a raw binary blob. MongoDB's already taken that idea and implemented it with BSON so Crockford saying that doesn't mean it'll stop people from implementing variations on his original idea.

Well, you can always base64 it as was said previously in this thread. Anyway, if you're handling large blobs often enough that you'd need specialized support for it, JSON might not be the right choice.

KaneTW
Dec 2, 2011

This thread is becoming a horror in itself, again. There's something amusing about posters in threads like this one or *players.txt becoming just like the people being mocked.

KaneTW
Dec 2, 2011

Zorro KingOfEngland posted:

Why is this a thing? It's all over my codebase too. Including the four (or more) unnecessary colons.

It's a pretty bad practice to catch(Exception e) { /* log and/or do nothing */ }

KaneTW
Dec 2, 2011

Mustach posted:

And then you get things like
code:
blah(*p);

if(!p)
    return;
that inspired their own gcc flag.

What the hell.

Also, what gcc flag did it inspire?

KaneTW
Dec 2, 2011

It's like he's writing such code just to troll you. How can someone code like that?

This reminds me why I went studying physics and not CS, at least physicists have an excuse for writing terrible code.

KaneTW
Dec 2, 2011

bobthecheese posted:

Sure, it's missing a few features that you'd expect in, say, Java or python, or whatever else, but it works and it doesn't force you to write your code in one particular way.

I don't quite think features are the problem in PHP.

Horrors. I used to work on a HL1 based mod and most weapons were created by copy-pasting and changing a few values. Hmm. Let's run simian against the server-side codebase:

code:
Found 22067 duplicate lines in 2005 blocks in 147 files
Processed a total of 105422 significant (206434 raw) lines in 249 files
:stare:

Compare that with regular HL1 MP SDK:
code:
Found 1395 duplicate lines in 181 blocks in 37 files
Processed a total of 25789 significant (51060 raw) lines in 94 files
E: And here the singleplayer SDK:
code:
Found 4779 duplicate lines in 405 blocks in 74 files
Processed a total of 48011 significant (95291 raw) lines in 144 files

KaneTW fucked around with this message at 12:01 on Jun 21, 2012

KaneTW
Dec 2, 2011

If you've got the time, throw a look at Haskell. While I haven't done web development with it personally it's a really exciting language.

I'm using Python/Django for web development and it works like a charm.

\/ Postgres is just so much better than mysql

KaneTW fucked around with this message at 16:15 on Jun 22, 2012

KaneTW
Dec 2, 2011

Sinestro posted:

Do not pick Python for web development. It is a pretty great language, but Django is a enormous piece of poo poo that breaks if you cough on it too hard. Pick Ruby, which is a great language with great support for all sorts of expressive new ways to write code, and gives you Rails, which makes web development so much nicer.

Edit:


http://en.wikipedia.org/wiki/MongoDB#Data_manipulation:_collections_and_documents seems pretty good at explaining things.

I've been using Django and it didn't seem like a piece of poo poo at all.

KaneTW
Dec 2, 2011

I vote for TCC.

KaneTW
Dec 2, 2011

bobthecheese posted:

php:
<?
foreach ( $_POST as $k1 => $v1 )
   $$k1 = $v1;
foreach ( $_GET as $k1 => $v1 )
   $$k1 = $v1;
?>
"Oh," says some developer, "You disabled register_globals because it was a massive security flaw? Ok, well I enabled it again for you! In a way that you can't disable with the php.ini! Aren't I great?"

How do these people even learn to code jeez. "Oh look let's just allow any variable to be controlled by the user! I have no idea how this can go wrong :downs:"

KaneTW
Dec 2, 2011

Suspicious Dish posted:

How is register_globals a massive security flaw? Did someone think that values from $_POST were more secure than those from $_GET?

No, that's not the point (and in fact, GET variables override POST variables). The point is that allowing variables to be set freely by the user is going to gently caress poo poo up.

KaneTW
Dec 2, 2011

code:
while true; do
gcc -pipe -O3 -fexpensive-optimizations -o batterydie stuff.c
done

KaneTW
Dec 2, 2011

Otto Skorzeny posted:

Just spent half an hour combing through routines that write to and read from FRAM and my SD card to figure out why data dumps had the byte order of integers swapped before realizing that ARM chips default to little endian. I am the coding horror :(

Well half an hour isn't that much, I know people who literally spent weeks trying to figure it out until somebody pointed it out to them that big endian exists.

KaneTW
Dec 2, 2011

The real horror is that somewhere, that code is production code.

KaneTW
Dec 2, 2011

I think it's time to look out for a new job :v:

KaneTW
Dec 2, 2011

What are the reasons for using UUID primary keys except for doesn't require auto-increment/making ids not guessable?

KaneTW
Dec 2, 2011

shrughes posted:

Boost is more like what happens when you take a bunch of sperglords who feel the need to make poo poo complicated in order to feel smart about themselves.

Boost is complicated? :confused:

KaneTW
Dec 2, 2011

Ouch. Were there any consequences for BA2 guy?

KaneTW
Dec 2, 2011

leper khan posted:

If you're not writing something performance-critical should you be using C++? I thought that was the only reason anyone still bothered with it (outside legacy).

There are different levels of performance required.

KaneTW
Dec 2, 2011

Amarkov posted:

code:
#define ARGS X, Y, Z

some_function ARGS; // expands correctly
some_function(ARGS); // nope
In other words, do you trust C programmers to use preprocessor macros only where it makes sense to do so?

That doesn't parse

E: nmd, you fixed it.

KaneTW
Dec 2, 2011

Gigantic Slut Man posted:

durr. Brain fart. Whatever, #DEFINE TWOPLUSTWO 2 + 2

a = TWOPLUSTWO * 5

Which by any reasonable logic should result in a = 20, not a = 12. But yeah, putting parenthesis around defines is pretty much your own responsibility.

KaneTW
Dec 2, 2011

E: never mind, this is silly

KaneTW
Dec 2, 2011


I did this:
api.h:
code:
#define FUNC(ret,func,args)  typedef ret (*_##func)args; extern _##func func;
#include "funcs.inc"
funcs.inc:
code:
FUNC(void, Foo,());
 ...
#undef FUNC
init.cpp:
code:
#include "api.h"


#define FUNC(ret,func,args)  _##func func = NULL;

#include "funcs.inc"

#define FUNC(ret,func,args) func = GetModule(pSysModule, #func);

void Init(CSysModule* pSysModule)
{
    #include "funcs.inc"
}
E: moved #undef FUNC into funcs.inc

KaneTW
Dec 2, 2011

not (x is null) is a synonym (at least without going into specifics) for x is not null.

KaneTW
Dec 2, 2011

Yeah, he's a goon (i've been using shootblues a lot back in the day). It isn't really a coding horror imo; it certainly has it's uses.

KaneTW
Dec 2, 2011

The real horror is the 1 == 1 there.

KaneTW
Dec 2, 2011

The composition notation is much more readable, though I prefer Haskell's syntax but whatever.

KaneTW
Dec 2, 2011

The european central bank has one I think.

E: http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml

KaneTW
Dec 2, 2011

Never mind the buffer overflow, awful formatting, no includes, memory leak, oh yeah and did i mention buffer overflow.

KaneTW
Dec 2, 2011

What happens if buf doesn't have a '\0'? strlen will go way over the bounds of buf.

KaneTW
Dec 2, 2011

zergstain posted:

How would you even defend against that? Only thing I can think of would be to set some arbitrary maximum, and decide the string isn't null terminated if it goes over that max, or check characters until you hit a non-ascii one or something. Both really stupid. Besides, it's a read overflow. No memory can be overwritten with shellcode here.

Edit: It's obviously the caller's responsibility to make sure the '\0' is there. Who knows where buf comes from though.

It's still a possible buffer overflow, since buf[strlen(buf) - 1] is set to '\0' which might very well be out of bounds for buf. Just because you can't inject shellcode doesn't mean it's not a buffer overflow.

KaneTW
Dec 2, 2011

It's hard to find any code that doesn't use 'tmp' or 'temp'. Just 'find|xargs grep' through my code folder and cURL, SQLite, LAME, Boost, Sourcemod, HL1 SDK, Metamode:Source all use it and with the exception of HL1 SDK I can't say that these projects have poo poo code.

KaneTW
Dec 2, 2011

XOR swap is dangerous as hell.

KaneTW
Dec 2, 2011

Maple and Matlab both are huge horrors. Probably the only good math software I saw is Mathematica, and even that has some quirks.

KaneTW
Dec 2, 2011

Yeah, Maple was so awful that I bought a Mathematica license despite it being like 6 times the cost of Maple (I think 40 or 50 euro). Definitely worth it, though.

Adbot
ADBOT LOVES YOU

KaneTW
Dec 2, 2011

The horror here is using the functional equivalent of system()

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