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
Clavius
Oct 21, 2007

Howdy!
Sigh. After all my hard work educating and pestering and pesuasive arguments.

code:
<!-- main layout table -->
<table cellpadding="0" cellspacing="0" width="100%">
  <tr>
    <td align="center">

      <!-- header table -->
      <table cellpadding="0" cellspacing="0" width="800">
        <tr>
         <td width="600">

           <table cellpadding="0" cellspacing="0">
             <tr>
               <td>    
I turn my back for five minutes and come back to

DONT LEECH IMAGES

Somebody fucked around with this message at 20:00 on Oct 7, 2011

Adbot
ADBOT LOVES YOU

willemw
Sep 30, 2006
very much so
I'm a freelance developer. I sometimes get to play with other people's code and most of the time that's not a problem at all. But sometimes …

I had to make a mobile (as in html) version of a website in flash. There's a backend (also in flash) and some php files to communicate to the database. Ok sounds good so far, should be easy. But :

- the code is good old spaghetti php. There is a directory called /classes which contains some files with functions in it (not classes, just functions).
- the database is horrible. Field names are CamelCased most of the time, but not all of the time.
- One table has a field called 'DateCreated', in another table the field is called 'CreationDate'. By this point i'm pleasantly surprised they used a datetime for these fields. O wait no it's not really a datetime, it's a varchar(32).
- Boolean's are not stored as tinyint(1)'s, but as a varchar(8). Possible values seem to be 'Yes', 'No' or 'no'. Some of the functions also return FALSE or (string) 'Ok'
- Password stored as plaintext: check.
- Use $_GET directly in mysql_queries: check
- 5 lines of php to try and emulate html_entity_decode(): you bet

zokie
Feb 13, 2006

Out of many, Sweden

NotShadowStar posted:

Thats the most horrible thing ever. Etsy posted some long treatise on they segmented client site from app side from database side and everybody was in their own fence. Client people received stuff from app people, app people never touched the database but requested procedures from the database people. It sounds loving horrible. SQL style databases are looking like a really bad first choice these days anyway, way to much overhead for really simple stuff.

So.. Uhm, I'm taking a course in "Databases" right now at the University and they are forcing us to do basically everything using procedures in Transact-SQL, the application should only be a graphic interface. It feels horrible but can someone give me a quick answer to why exactly?

Zombywuf
Mar 29, 2008

zokie posted:

So.. Uhm, I'm taking a course in "Databases" right now at the University and they are forcing us to do basically everything using procedures in Transact-SQL, the application should only be a graphic interface. It feels horrible but can someone give me a quick answer to why exactly?

NotShadowStar is wrong. SQL is a terrible language (this is why it feels horrible), but it is well worth learning how to use an RDBMS. When your couch instance gets overloaded you have one option: buy bigger hardware. With an RDBMS you have masses of options, the best part is that the cleanest model is usually the fastest. Stored Procedures are just an abstraction layer, you should write them as you would write any other function, effectively turning domain specific queries into data model queries.

tef
May 30, 2004

-> some l-system crap ->

NotShadowStar posted:

Thats the most horrible thing ever. Etsy posted some long treatise on they segmented client site from app side from database side and everybody was in their own fence. Client people received stuff from app people, app people never touched the database but requested procedures from the database people. It sounds loving horrible. SQL style databases are looking like a really bad first choice these days anyway, way to much overhead for really simple stuff.

:toot: I like it. It is an api, not an org-chart. It doesn't dictate who can change what

tef
May 30, 2004

-> some l-system crap ->
P.s I'm not in web-dev :toot:

Zombywuf
Mar 29, 2008

code:
>>> import Cookie
>>> c = Cookie.SimpleCookie()
>>> c["my_cookie"] = "my value"
>>> c["my_cookie"]["expires"] = 3600
>>> c["my_cookie"].OutputString()
'my_cookie="my value"; expires=Fri, 07-Oct-2011 12:53:01 GMT'
>>> d = Cookie.SimpleCookie()
>>> d.load(c["my_cookie"].OutputString())
>>> print d
Set-Cookie: my_cookie="my value"; expires=Fri,
Why is it the terrible code I'm changing works, but the "good" code that comes with python is broken?

I don't know if it's worse that the Cookie library uses old Netscape style cookies or that it fails to parse its own output.

Edit: oh man, the timestamp on the source code says 2000

Edit2: Marvel at the responsiveness of the Python community http://bugs.python.org/issue3073

Edit3: Oh look, there's a cookielib module as well. It handles cookies. Does it expose a way of parsing individual cookie headers? Of course not.

Edit4: I am now writing a cookie parser and am experiencing the joy once again of constructing python datetime objects with timezones.

Zombywuf fucked around with this message at 13:29 on Oct 7, 2011

NotShadowStar
Sep 20, 2000

Zombywuf posted:

NotShadowStar is wrong. SQL is a terrible language (this is why it feels horrible), but it is well worth learning how to use an RDBMS. When your couch instance gets overloaded you have one option: buy bigger hardware. With an RDBMS you have masses of options, the best part is that the cleanest model is usually the fastest. Stored Procedures are just an abstraction layer, you should write them as you would write any other function, effectively turning domain specific queries into data model queries.

Aww look at this post. If you're going to try and be an rear end in a top hat at least get your facts straight.

https://github.com/cloudant/bigcouch
http://www.mongodb.org/display/DOCS/Sharding+Introduction

Zombywuf
Mar 29, 2008

NotShadowStar posted:

Aww look at this post. If you're going to try and be an rear end in a top hat at least get your facts straight.

https://github.com/cloudant/bigcouch
http://www.mongodb.org/display/DOCS/Sharding+Introduction

Awww how cute, CouchDB is all grown up. Now the question is why should I use bigcouch over one of the many other clustering solutions such as CouchBase. What's my migration plan? Can I transition online or do I have to take the service down? And most importantly, why didn't I just use a Postgres DB with a normalised schema in the first place?

Brecht
Nov 7, 2009
Relational data model => relational database management system

Non-relational ("key-value" or "document-based") data model => potentially NoSQL database system

Shoehorning one into the other => coding horror

NotShadowStar
Sep 20, 2000

Zombywuf posted:

Awww how cute, CouchDB is all grown up. Now the question is why should I use bigcouch over one of the many other clustering solutions such as CouchBase. What's my migration plan? Can I transition online or do I have to take the service down? And most importantly, why didn't I just use a Postgres DB with a normalised schema in the first place?

I too just always fall back to what I know instead of investigating solutions that fit the problem.

Zombywuf
Mar 29, 2008

NotShadowStar posted:

I too just always fall back to what I know instead of investigating solutions that fit the problem.

I too assume a person who disagrees with me hasn't spent many months investigating multiple databases with their various tradeoffs. There are valid reasons to use NoSQL databases, but for the most part start with a relational DB unless you have a drat good reason.

Malloc Voidstar
May 7, 2007

Fuck the cowboys. Unf. Fuck em hard.
Why would you want to use a nosquirrel db

Cocoa Crispies
Jul 20, 2001

Vehicular Manslaughter!

Pillbug
DISCLAIMER: I WORK FOR A NOSQL COMPANY IN THE ADVOCACY DEPARTMENT AND ALL MY EXPERIENCE IS WITH WEB APPS

I recommend people start with Postgres because it's a known quantity and most sites never get big enough to where "scalability" matters. If your poo poo is too slow because it's popular you've already loving won. If you want something that has a fancier model than "some columns," MongoDB is good to start with because it's easy to use on Heroku.

If you know you're going to start big (i.e. you're developing software for a business that's already big), you might want to look into the more scalable NoSQL databases like Cassandra (if you can model your data to fit) or Riak (which actually has secondary indices and full-text search now).

Stored procedures are big now, but we call them "HTTP APIs that are Rails/Sinatra/whatever apps with no UI that only exist to serve internal clients." Twitter is one of these now.

Zombywuf
Mar 29, 2008

BonzoESC posted:

If you know you're going to start big (i.e. you're developing software for a business that's already big), you might want to look into the more scalable NoSQL databases like Cassandra (if you can model your data to fit) or Riak (which actually has secondary indices and full-text search now).

Now Riak I approve of, sadly I've never had a chance to use it in anger. I'd really stay away from Cassandra though, it just screams abandonware. Also schema changes can't be done online IIRC.

Also if you're doing large scale (like at least a terrabyte, preferably petabyte) data warehousing Vertica is well worth a look.

Most NoSQL DB's are specialisations of single aspects of relational databases. Vertica for example is a specialisation of normalisation for data size reduction, if this is your problem then it will do it better than the general system. Riak is a specialisation of sharding, and does it better than the general solution. CouchDB as far as I can tell is a specialisation of "I know javascript so I will use that."

Captain Capacitor
Jan 21, 2008

The code you say?
Cassandra is great if you use it for its intended purpose: Many, many writes. However, it is an absolute hog when it comes to resources, and is incredibly vague at times. You'll often find yourself wondering if anything is happening at all, simply because the command-line tool hasn't been updated yet, or there's no corresponding JMX Bean for what you want to know about.

the talent deficit
Dec 20, 2003

self-deprecation is a very british trait, and problems can arise when the british attempt to do so with a foreign culture





Zombywuf posted:

CouchDB as far as I can tell is a specialisation of "I know javascript so I will use that."

CouchDB is a fantastic storage/distribution engine that, regrettably, has been seized by developers and community hell bent on turning it into an end to end application platform.

That said, you could do worse if you are writing micro applications that need to be portable in the data availability sense

Sagacity
May 2, 2003
Hopefully my epitaph will be funnier than my custom title.

Zombywuf posted:

Vertica is well worth a look
Is there any code somewhere to look at, or some kind of "getting started" guide? The site is full of buzzwords but there's no way to actually look at anything short of requesting an evaluation.

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope
So we use ESP, which, I guess is kind or like php or asp, except the programming language is Javascript. I don't think that the platform exposes anything of the underlying system, you have to make all your access functions in C and expose them to ESP.

Well, I'm supposed to list a bunch of files on the page. There is no read_dir() or list_files()" function, bummer. But someone has made a "system()" function that runs commands in the shell and returns the output. Oh well, I guess I'll just run system("ls -l /some/directory/somewhere"). I get only one result.

I find the system() function.

After it gets the output from the command, it iterates through it and does
code:
if(buf[i] == '\n'){
    buf[i]=0;
}
What? Why?

There are also getFile() and readFile(), one reads a file into a variable, the other just dumps it into the browser as is. Except both do the same thing as above.

I suggested that I'll just implement a "listFiles()" that returns a list of files.

Instead I was told to make a script that returns the file list from ls on one line :negative:

I'm so used to terrible Javascript and html, but somehow I expected the C backend to be maybe buggy, but not insane.

Zombywuf
Mar 29, 2008

Sagacity posted:

Is there any code somewhere to look at, or some kind of "getting started" guide? The site is full of buzzwords but there's no way to actually look at anything short of requesting an evaluation.

Oh yeah, you have to pay for it. The licensing is pretty reasonable (much cheaper than the hardware you'll be running it on), I remember their sales guys stifling a laugh that we only needed a couple of TB license. The thing about its use of buzzwords is that Vertica started out before "column store" was a buzzword.

If you think you might need it (the use case is data warehousing queries that take hours) then you should be able to get an evaluation copy and lots of docs pretty easily.

Sagacity
May 2, 2003
Hopefully my epitaph will be funnier than my custom title.

Zombywuf posted:

If you think you might need it (the use case is data warehousing queries that take hours) then you should be able to get an evaluation copy and lots of docs pretty easily.
Ah, fair enough. We're doing OLAP stuff on a fairly small dataset by Big Data standards (about half a terabyte) that needs to be 'live' (i.e. not aggressively cached) and we're just trying to explore a few options. I'm sure they'll have to stifle a few more laughs in our office as well, then :)

Zombywuf
Mar 29, 2008

Sagacity posted:

Ah, fair enough. We're doing OLAP stuff on a fairly small dataset by Big Data standards (about half a terabyte) that needs to be 'live' (i.e. not aggressively cached) and we're just trying to explore a few options. I'm sure they'll have to stifle a few more laughs in our office as well, then :)

Heh, been there. Aggressive normalisation is possible solution, as is buying a lot of disks. Riak may be the way to go depending on workload and consistency requirements.

Scaevolus
Apr 16, 2007

I hate my classmates.


INFINITY = 40000 #circumference of the earth

tripwire
Nov 19, 2004

        ghost flow

Scaevolus posted:

I hate my classmates.


INFINITY = 40000 #circumference of the earth

Hahahaha

Zombywuf
Mar 29, 2008

Scaevolus posted:

I hate my classmates.


INFINITY = 40000 #circumference of the earth


If they're working with diffeomorphisms of the Riemann Sphere this could be considered sort of correct :eng101:

Sort of...

By which I mean, not really.

pseudorandom name
May 6, 2007

Hey, what's 75 (or 8) kilometers between friends?

Jonnty
Aug 2, 2007

The enemy has become a flaming star!

pseudorandom name posted:

Hey, what's 75 (or 8) kilometers between friends?

actually, what he forgot to tell you is it's in centimetres

Scaevolus
Apr 16, 2007

Sometimes people really want to write Java.
code:
        choice = (str)(raw_input("Select a menu item: "))     
...  
        name = (str)(raw_input("Enter a file name : "))
...
        min_connections = (int)(raw_input('Minimum number of connections in a hub city :'))
...
        population = (long)(raw_input("Population : "))

baquerd
Jul 2, 2007

by FactsAreUseless

Scaevolus posted:

Sometimes people really want to write Java.
code:
        choice = (str)(raw_input("Select a menu item: "))     
...  
        name = (str)(raw_input("Enter a file name : "))
...
        min_connections = (int)(raw_input('Minimum number of connections in a hub city :'))
...
        population = (long)(raw_input("Population : "))

And what about that says Java to you?

tripwire
Nov 19, 2004

        ghost flow
Ugh it too me a second to realize that was actually a function call rather than a syntax error.

tripwire
Nov 19, 2004

        ghost flow

baquerd posted:

And what about that says Java to you?
That's how you cast in java dumbass

baquerd
Jul 2, 2007

by FactsAreUseless

tripwire posted:

That's how you cast in java dumbass

And about 50 other languages... dumbass.

tripwire
Nov 19, 2004

        ghost flow
You're exactly the kind of person we're making fun of :q:

baquerd
Jul 2, 2007

by FactsAreUseless

tripwire posted:

You're exactly the kind of people we're making fun of :q:

Your powers of deduction are astounding, how did you acquire them? I hope someday I can simultaneously construct generalizations and misrepresentations as well as you do.

Scaevolus
Apr 16, 2007

baquerd posted:

And what about that says Java to you?
It was written using PyDev and the programmer is most familiar with Java.

Opinion Haver
Apr 9, 2007

Have you ever wanted to fit your executable inside the ELF header?

Smugdog Millionaire
Sep 14, 2002

8) Blame Icefrog
There's an IRC channel with an IRC bot to coordinate pick up games of 6v6. The first incarnation of the bot worked well, but when a second guy took over the channel he wrote his own bot from scratch rather than maintain the original code.
Today the original author was defending his code. He believes it's "perfectly fine", or at least "once you understood how it was built then it was fine".

I really hope this guy isn't a professional programmer: https://github.com/550/tf2ib/blob/master/pug.py

Dessert Rose
May 17, 2004

awoken in control of a lucid deep dream...

yaoi prophet posted:

Have you ever wanted to fit your executable inside the ELF header?
I am a horrific nerd, because I started giggling like a loon about halfway through that article. Wow.

Malloc Voidstar
May 7, 2007

Fuck the cowboys. Unf. Fuck em hard.

Smugdog Millionaire posted:

I really hope this guy isn't a professional programmer: https://github.com/550/tf2ib/blob/master/pug.py
make a pull request that just requests the file be deleted

Adbot
ADBOT LOVES YOU

ToxicFrog
Apr 26, 2008


yaoi prophet posted:

Have you ever wanted to fit your executable inside the ELF header?

ELF origami.

I love it.

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