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
Zorro KingOfEngland
May 7, 2008

MEAT TREAT posted:

:chord::hf::smug:
The cool thing is that they are printed as this weird symbol in the console, so the text doesn't look all run together.

One of my guys was delimiting fields using a colon, guess what happened when we received a url? I told him about those separators and he got all happy and started using them everywhere they made sense. :unsmith:

I am a relatively new developer and this is the first time I've heard about these control characters being used. Do you have anything that explains their usage? Wikipedia doesn't go into too much depth. The only article I've found has said that the characters' meanings have to be defined on a per-application basis, but I'm looking for a best practice type document.

Adbot
ADBOT LOVES YOU

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."
RFC 20 does briefly mention them:

RFC 20 posted:

FS (File Separator), GS (Group Separator), RS (Record Separator),
and US (Unit Separator): These information separators may be used
within data in optional fashion, except that their hierarchical
relationship shall be: FS is the most inclusive, then GS, then RS,
and US is least inclusive. (The content and length of a File, Group,
Record, or Unit are not specified.)

hobbesmaster
Jan 28, 2008

Jonnty posted:

If everyone's using Excel why are you using csvs in the first place?

How do you write excel files using an 8bit uC data logger?

Actually, if someone has done it I don't want to know.

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde

Zorro KingOfEngland posted:

I am a relatively new developer and this is the first time I've heard about these control characters being used. Do you have anything that explains their usage? Wikipedia doesn't go into too much depth. The only article I've found has said that the characters' meanings have to be defined on a per-application basis, but I'm looking for a best practice type document.
Well, they really were application specific. However, defining the hierarchy like that makes it possible to write a library that will seek a magnetic tape to the beginning/end of a unit/record/group/file if you ever happen to fall through a time warp into 60s.

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."
Although really in that case you should focus on teaching them Quicksort and thus becoming a messiah figure.

xf86enodev
Mar 27, 2010

dis catte!
Or be declared a russian spy.

karms
Jan 22, 2006

by Nyc_Tattoo
Yam Slacker

Internet Janitor posted:

Although really in that case you should focus on teaching them Quicksort and thus becoming a messiah figure.

"Hey you guys ever hear of Napoleon"

zokie
Feb 13, 2006

Out of many, Sweden

nielsm posted:

At least OpenOffice asks you what format that CSV is actually in before opening, and gives you a preview. (But otherwise it's more annoying than Excel to use.)

Text to Columns is Excel's most powerful tool :v:

Mogomra
Nov 5, 2005

simply having a wonderful time
I didn't know this was a thing until today.
http://nodephp.org/

REACT IN THE INDUSTRY posted:

It's like, so amazing, man.

I know everyone in this thread loves node.js and PHP, so why not leave the two of them alone in a room together to see what happens?

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
I've been idling in the IRC channel of that for a few days. It's outstanding.

pre:
12:33:30 < igorw> hm, is there no way to create a raw stream socket?
12:33:47 < igorw> raw as in SOCKET_RAW, below the transport layer
12:33:58 < igorw> allowing to write an ICMP/ping client
12:34:24 < igorw> sockets allow this by using
12:34:24 < igorw> $conn = socket_create(AF_INET, SOCK_RAW, 1);
12:34:34 < igorw> but I wasn't able to find this for stream sockets

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde

Mogomra posted:

I know everyone in this thread loves node.js and PHP, so why not leave the two of them alone in a room together to see what happens?
As the internet creates a fetish subculture for everything, so does project hosting create...

Harmony Framework - PHP is now in your browser!

(Inactive since 2009 thankfully, but it's only a matter of time.)

Impotence
Nov 8, 2010
Lipstick Apathy

Gazpacho posted:

As the internet creates a fetish subculture for everything, so does project hosting create...

Harmony Framework - PHP is now in your browser!

(Inactive since 2009 thankfully, but it's only a matter of time.)

php:
<?
$Text4fba9fe079c2a->setText('Hello world');    
$HBox4fba9fe079af5->addChild($Text4fba9fe079c2a);
$input4fba9fe079cca = new Harmony_Toolkit_Element('input');?>
That is some really descriptive code

Zamujasa
Oct 27, 2010



Bread Liar
Oh lordy, so we hired out someone to make something simple; a page that displayed snippets of text from a database, with the ability to embed a picture. Anything over the first paragraph would be hidden via Javascript and a "More" button. Standard stuff.

The page it shows up on is three-column format. Easy, right? Table "entries", with "text", "imageurl", "column", and an auto-incrementing "entryid" (for editing later). Just use a simple explode('\n',2) to break it up if you have a long entry.


Oh, no. That would be too simple. This guy made 3 tables, with the following ingenious layout (actual names):

code:
table "column1" (and column2, and column3...)
* id
* header
* p1 (apparently for one paragraph.)
* p2 (and the second paragraph, and so on...)
* p3
* p4
* p5
* img

(conspicuously missing: any sort of date or other sortable field)
That's bad enough, but he also put the database credentials/headers/everything inside every file (does he not know how to use "include"?) ... and if that wasn't enough there's no escaping whatsoever, so you can put in ' OR 1 -- and all sorts of fun happens. (Oh, and the file uploader doesn't have any sanity check to make sure you're not uploading something you shouldn't be.)

I get the feeling this person was paid much more than I make in a week to crap this out in about 15 minutes. A lot of the code looks like it was cribbed from somewhere else but I couldn't find where in a few minutes of looking.


:sigh: I need a raise. And a vacation.



Edit:
code:
        $record=mysql_fetch_row($recordset);
        if ($record[0]==$username)
            {
            $u_check=1;
            if ($record[1]==$password)
                {
                $p_check=1;
                $status=$record[2];
                $user=$record[0];
I... what. I just... :smithicide:

Zamujasa fucked around with this message at 01:15 on May 22, 2012

Factor Mystic
Mar 20, 2006

Baby's First Post-Apocalyptic Fiction
From reddit

quote:

Javascript thinks that 64.99 * 100 is 6498.999999... Go ahead, try it any way you like. If someone can explain this, I'll be eternally grateful.
submitted 2 hours ago by collin_ph
Ok, javascript post. More laffeaux javascript nonsense?


Nope, just floating point. And this is pointed out:

quote:

I don't think you understand how floats are stored in memory. Click on any of the links posted and read up on it.

But then,

redditor collin_ph posted:

I'm wondering who's bright idea it was to do this. It's funny after programming for nearly 30 years, I run into this TODAY. Makes me feel kind of dumb-- however, I wonder how people avoid this type of thing with MONEY.

...


I'm an Oracle certified DBA, worked for the government for about 16 years, and most recently as an IS manager.

Uhhh...

That Turkey Story
Mar 30, 2003

Factor Mystic posted:

From reddit

Ok, javascript post. More laffeaux javascript nonsense?


Nope, just floating point. And this is pointed out:


But then,


Uhhh...

This post makes me so depressed.

Golbez
Oct 9, 2002

1 2 3!
If you want to take a shot at me get in line, line
1 2 3!
Baby, I've had all my shots and I'm fine
Good grief, he somehow doesn't know what floats are, then assumes it was a design decision? :psyduck:

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
My favorite is the guy who thinks that your memory has the capacity to repeat to infinity.

Opinion Haver
Apr 9, 2007

Suspicious Dish posted:

My favorite is the guy who thinks that your memory has the capacity to repeat to infinity.

It's lazily generating the list of 9s, duh.

That Turkey Story
Mar 30, 2003

Suspicious Dish posted:

My favorite is the guy who thinks that your memory has the capacity to repeat to infinity.

Ummm, his name is base2op. I think he knows what he's talking about....

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
It's trying to lazily generate the list of 9s, but IEEE limits the precision as an optimization so that the implementation can use less memory. Let me unpack that a bit. A real computer has to do arithmetic in fixed chunks of bits, so you have to think of a number as an infinite stream of these chunks of bits. If you've ever done stream programming, you know that it's more efficient to work with streams with buffering on. Since you're constantly finishing with some chunks and needing more, this has to be a circle buffer to keep the GPU up with the memory bus, and you've got a second buffer which is taking the result, which is called double-buffering. It's the size of these buffers that's different when you have a float or a double, got it? So where does this 8 come from? First thing you've got to understand is that, like that dude said on reedit, an integer is really equal to a repeating bunch of nines. Now, in the first version of floating-point numbers, there was this bug when you had a bunch of nines like that, and a couple nines from somewhere else, and you were multiplying them together, and the multiplier would do one multiply and put a chunk into the result buffer, and it would forget that it needed to do a carry on that chunk, so you got 9 * 9 == 81 and it would put down 81 in the buffer and then it would overwrite that 1 with the next 9 which it correctly carried from the next multiplication, see, 99 * 9 == 810 + 81 == 891. If this doesn't make sense, just remember, it's was a bug, right? But they didn't notice right away, because there weren't enough DBAs looking at the problem, so it just stayed in for awhile, and ever since they've had to emulate that bug perfectly because IEEE is a standard and it's supposed to be portable. And the reason the 8's all the way back is because, remember, it's 9s all the way down on the integral side, and you have to multiply them all by the two 9s on the other side, so you've got plenty of places where this bug can show up. Anyway, that's why I do all my currency calculations with regexps, and if you've got a problem with that, just remember, optimization is the way the devil gets ya.

ohgodwhat
Aug 6, 2005

Factor Mystic posted:

From reddit

Ok, javascript post. More laffeaux javascript nonsense?


Nope, just floating point. And this is pointed out:


But then,


Uhhh...

I feel like this has to be a subtle troll since 64.99*100 is equal to 6499 which is equal to 6498.9... arguments around which usually lead to huge amounts of drama anyway.

Golbez
Oct 9, 2002

1 2 3!
If you want to take a shot at me get in line, line
1 2 3!
Baby, I've had all my shots and I'm fine

ohgodwhat posted:

I feel like this has to be a subtle troll since 64.99*100 is equal to 6499 which is equal to 6498.9... arguments around which usually lead to huge amounts of drama anyway.

Does Javascript handle infinite decimals, though? If not it eventually comes to a last digit, which is false precision.

xf86enodev
Mar 27, 2010

dis catte!
Please look at that guy's post history. He's a troll. Although a quite elaborate one.

Also, stop reading reddit.

e:

Golbez posted:

Does Javascript handle infinite decimals, though? If not it eventually comes to a last digit, which is false precision.
Dude! :argh:

Lysidas
Jul 26, 2002

John Diefenbaker is a madman who thinks he's John Diefenbaker.
Pillbug

rjmccall posted:

It's trying to lazily generate the list of 9s, but IEEE limits the precision as an optimization so that the implementation can use less memory. Let me unpack that a bit. A real computer has to do arithmetic in fixed chunks of bits, so you have to think of a number as an infinite stream of these chunks of bits. If you've ever done stream programming, you know that it's more efficient to work with streams with buffering on. Since you're constantly finishing with some chunks and needing more, this has to be a circle buffer to keep the GPU up with the memory bus, and you've got a second buffer which is taking the result, which is called double-buffering. It's the size of these buffers that's different when you have a float or a double, got it? So where does this 8 come from? First thing you've got to understand is that, like that dude said on reedit, an integer is really equal to a repeating bunch of nines. Now, in the first version of floating-point numbers, there was this bug when you had a bunch of nines like that, and a couple nines from somewhere else, and you were multiplying them together, and the multiplier would do one multiply and put a chunk into the result buffer, and it would forget that it needed to do a carry on that chunk, so you got 9 * 9 == 81 and it would put down 81 in the buffer and then it would overwrite that 1 with the next 9 which it correctly carried from the next multiplication, see, 99 * 9 == 810 + 81 == 891. If this doesn't make sense, just remember, it's was a bug, right? But they didn't notice right away, because there weren't enough DBAs looking at the problem, so it just stayed in for awhile, and ever since they've had to emulate that bug perfectly because IEEE is a standard and it's supposed to be portable. And the reason the 8's all the way back is because, remember, it's 9s all the way down on the integral side, and you have to multiply them all by the two 9s on the other side, so you've got plenty of places where this bug can show up. Anyway, that's why I do all my currency calculations with regexps, and if you've got a problem with that, just remember, optimization is the way the devil gets ya.

This reads a lot like TimeCube :stare:

xf86enodev
Mar 27, 2010

dis catte!

rjmccall posted:

It's trying to lazily generate the list of 9s, but IEEE limits the precision as an optimization so that the implementation can use less memory. Let me unpack that a bit. A real computer has to do arithmetic in fixed chunks of bits, so you have to think of a number as an infinite stream of these chunks of bits. If you've ever done stream programming, you know that it's more efficient to work with streams with buffering on. Since you're constantly finishing with some chunks and needing more, this has to be a circle buffer to keep the GPU up with the memory bus, and you've got a second buffer which is taking the result, which is called double-buffering. It's the size of these buffers that's different when you have a float or a double, got it? So where does this 8 come from? First thing you've got to understand is that, like that dude said on reedit, an integer is really equal to a repeating bunch of nines. Now, in the first version of floating-point numbers, there was this bug when you had a bunch of nines like that, and a couple nines from somewhere else, and you were multiplying them together, and the multiplier would do one multiply and put a chunk into the result buffer, and it would forget that it needed to do a carry on that chunk, so you got 9 * 9 == 81 and it would put down 81 in the buffer and then it would overwrite that 1 with the next 9 which it correctly carried from the next multiplication, see, 99 * 9 == 810 + 81 == 891. If this doesn't make sense, just remember, it's was a bug, right? But they didn't notice right away, because there weren't enough DBAs looking at the problem, so it just stayed in for awhile, and ever since they've had to emulate that bug perfectly because IEEE is a standard and it's supposed to be portable. And the reason the 8's all the way back is because, remember, it's 9s all the way down on the integral side, and you have to multiply them all by the two 9s on the other side, so you've got plenty of places where this bug can show up. Anyway, that's why I do all my currency calculations with regexps, and if you've got a problem with that, just remember, optimization is the way the devil gets ya.

How did I miss this post? This is amazing!

dis astranagant
Dec 14, 2006

The line about not enough DBAs looking at the problem cracks me up. I'm not 100% on this but I'm pretty sure IEEE-754 predates DBAs.

McGlockenshire
Dec 16, 2005

GOLLOCKS!

rjmccall posted:

It's trying to lazily generate the list of 9s, but [...]. Anyway, that's why I do all my currency calculations with regexps, and if you've got a problem with that, just remember, optimization is the way the devil gets ya.

For a bit there, I think you channeled the LoseThos guy. Well done.

Golbez
Oct 9, 2002

1 2 3!
If you want to take a shot at me get in line, line
1 2 3!
Baby, I've had all my shots and I'm fine

:( Sorry.

Instead of fighting, let's bask in the insane glory of rjmccall's post.

Simulated
Sep 28, 2001
Lowtax giveth, and Lowtax taketh away.
College Slice
It is truly the best kind of troll. Just enough crazy to keep you guessing. Bravo sir, bravo. :golfclap:

fritz
Jul 26, 2003

KaneTW posted:

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.

The only thing I've ever found maple good for was to pull up the command line version whenever I needed to do some integral I didn't want to integrate by hand.

ToxicFrog posted:

If I had to guess, I'd guess it's just a matter of less to compare it to and fewer people to do the comparison - Python was relatively new, most scientists were using MATLAB or Fortran and the proportion of scientists who were also programmers was smaller. MATLAB was originally meant to be a kinder, gentler interface to Fortran numeric computation libraries; its flaws are a lot less obvious when you're coming to it from Fortran '77 rather than SciPy or R.

It's really hard to overstate just how much better trying to do scientific computing is nowadays compared to 15 years ago. Not only has c++ become a serious option, but you've got the modern fortrans (when I was doing my phd, fortran 90 was out but I didn't know a single person who used anything but f77), numpy/scipy, sage, ATLAS, FFTW, and R. (AND GMP! I forgot GMP)

ETA: I'm not trying to be some sort of grumpy greybeard here, but god drat! things today are great. The next thing on my list to check out is ggplot2....

Gul Banana
Nov 28, 2003

Golbez posted:

Good grief, he somehow doesn't know what floats are, then assumes it was a design decision? :psyduck:

it WAS a design decision. there are instruction set architectures which have supported fixed-point and packed decimal arithmetic for longer than x86 has existed - much financial software on mainframes is still written this way.

ephphatha
Dec 18, 2009




robbob posted:

I use a program called OoberViewer for looking through large email logs at work. It doesn't open the whole file at once so it is pretty quick to view a log. Not too sure where to download it at as it was already on this machine, but I could probably get it to you if you would like to try it.

This is from a while back but I'd like to grab this app. Google turns up seven results for me - one is a link to http://files.redefiningweird.com/files/utilities/ which apparently has the file, does that seem to be the version you have?

The other 6 results are people talking about the app, a link to that post, and three unrelated pages.

ozymandOS
Jun 9, 2004
The application I develop for uses a non-SQL hierarchical DB, upon which we've added the abstraction of records with fields. The indexing capabilities built into the DB don't cover everything we'd want to index--we have to build separate index structures ourselves to handle these cases.

We have standard APIs for setting fields in a record. Do these APIs update the index? Nope! Instead, you have to update the field, then call a separate API to manually update the index. If you forget to do this in any place that happens to be writing to data that could be indexed, you now have a data integrity error.

The reason? "Performance." One guess as to how often reports built on these indexes are mysteriously missing data.

Zamujasa
Oct 27, 2010



Bread Liar
More from the Russian Wonder™.


The articles on our site are a little backwards. New ones we try to add show up at the bottom instead of the top, and the system is pretty Jenga-ish as it is. ("Add a sort column", you say. Sure, that'd be easier if he referred to the columns like an associative array instead of numerically. Oops, suddenly $column1[1] isn't the header any more! better update all the instances of that everywhere)

His solution was to make the id column the one we sort by. Makes sense, except that at some points it would be valuable to be able to insert new items in between others.

So, because we're starting to ORDER BY `id` DESC, we need to basically rotate the numbers in the database.

This is easy, right? :suicide:

php:
<?php

/********** Start Alter column1 **********/
    $request="ALTER TABLE column1 MODIFY id INT";
    
    if(mysql_query($request,$db_connection))   {
        echo "\n" "Column id is INT<br />";
        $a=1;
        while($a<=25){
            $b=30+$a;
            $request="UPDATE column1 SET id='" $b "' WHERE id='" $a "'";
            
            if(mysql_query($request,$db_connection)){
                echo "\n" "id " $a " is " $b "<br />";
            } else{
                echo "\n" "id " $a " is not " $b "<br />";
                echo "\n" "Error " mysql_errno($db_connection) . ": " mysql_error($db_connection) . "<br />";
            }

            $a=$a+1;
        }

        $a=1;
        $c=25;
        while($a<=25){
            $b=30+$a;
            $request="UPDATE column1 SET id='" $c "' WHERE id='" $b "'";
            
            if(mysql_query($request,$db_connection)){
                echo "\n" "id " $b " is " $c "<br />";
            } else{
                echo "\n" "id " $b " is not " $c "<br />";
                echo "\n" "Error " mysql_errno($db_connection) . ": " mysql_error($db_connection) . "<br />";
            }

            $a=$a+1;
            $c=$c-1;
        }

        $request="ALTER TABLE column1 MODIFY id INT NOT NULL AUTO_INCREMENT";
        
        if(mysql_query($request,$db_connection)){
            echo "\n" "Column id is AUTO_INCREMENT<br />";
        } else{
            echo "\n" "Column id is not AUTO_INCREMENT<br />";
            echo "\n" "Error " mysql_errno($db_connection) . ": " mysql_error($db_connection) . "<br />";
        }

    } else{
        echo "\n" "Column id is not INT<br />";
        echo "\n" "Error " mysql_errno($db_connection) . ": " mysql_error($db_connection) . "<br />";
    }

    /********** End Alter column1 **********/

// Snipped: two repeats of the above code but with column1 switched with column2/3 and the hardcoded digits changed //
code:
Connection to the MySQL was established
 Column id is INT
 id 1 is 31
 id 2 is 32
 id 3 is 33
[...]
 id 22 is 52
 id 23 is 53
 id 24 is 54
 id 25 is 55

 id 31 is 25
 id 32 is 24
 id 33 is 23
[...]
 id 53 is 3
 id 54 is 2
 id 55 is 1
 Column id is AUTO_INCREMENT

 Column id is INT
 id 1 is 31
 id 2 is 32
 id 31 is 2
 id 32 is 1
 Column id is AUTO_INCREMENT

 Column id is INT
 id 1 is 31
 id 31 is 1
 Column id is AUTO_INCREMENT
Anybody worth their salt would just UPDATE `column1` SET `id` = 26 - `id`*. (You might get away with using MAX(`id`) - 26, but in this case I would do it before just to save the "what if it doesn't work the way I think" problem)


And we paid this guy money for this code. Actual money. :saddowns:



(*: You'll still have to remove the PRIMARY index from it first, of course.)

Zamujasa fucked around with this message at 16:46 on May 23, 2012

tef
May 30, 2004

-> some l-system crap ->

BP posted:

The application I develop for uses a non-SQL hierarchical DB, upon which we've added the abstraction of records with fields.

Aaaaaaaaaaaaaaa.


aaaaaa.

..btt
Mar 26, 2008

tef posted:

Aaaaaaaaaaaaaaa.


aaaaaa.

Yeah, honestly everything following that sentence was pretty much redundant.

LordKaT
Mar 16, 2011
This isn't code, but it's related, and my face almost imploded when I read this.

http://us.battle.net/d3/en/forum/topic/5152409863?page=1

For those too lazy:

quote:

I am able to log into D3 even if I change the case on some of the letters in my password. This should be fixed.


From Blizzard Quality Assurance:

quote:

This is actually consistent with all of our Blizzard games. Try it in WoW and SC2 :)

:psyduck:

geonetix
Mar 6, 2011


They also (apparently) limit the effective password to only the first 16 characters. But that's okay, because Apache only uses the first 9 when using htpasswd-based authentication.

Who needs internet security, right? :smith:

Zhentar
Sep 28, 2003

Brilliant Master Genius

tef posted:

Aaaaaaaaaaaaaaa.

(I'm guessing BP and I share the same employer, though we have apparently have pretty different perspectives on it)

It's more or less a precursor to the modern "NoSQL" document databases. It's not really that much of a horror. I mean, there are plenty of horrors in there, but that's unavoidable when you've got a 25+ year old codebase.

Adbot
ADBOT LOVES YOU

quiggy
Aug 7, 2010

[in Russian] Oof.


LordKaT posted:

This isn't code, but it's related, and my face almost imploded when I read this.

http://us.battle.net/d3/en/forum/topic/5152409863?page=1

For those too lazy:

From Blizzard Quality Assurance:

:psyduck:

Christ almighty. Check out the post where the mod closes the thread:

quote:

Please leave discussions like this to the General Discussion forums. I'm not going to keep posting on threads if my answer to someone's bug report is a huge discussion about something that isn't a bug.

Argggggggggh you people are so dumb. Yes it is a bug and you should loving fix it!

Edit: Yup, works in SC2. I don't need to capitalize my password :psyboom:

quiggy fucked around with this message at 18:51 on May 23, 2012

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