Character-separated-values



  • Continuing the discussion from .csv.xml:

    @Arantor said:

    Onyx said:

    You say CSV... but is it? I see commas, I see colons, I see pipes...
    Is it time to play "How many separators?" now?

    Clearly CSV means character-separated-values.

    We have "CSV" files here that look like

    data1DELIMITERdata2DELIMITERdata3DELIMITERdata4DELIMITERdata5

    processed by

    @row = split(/DELIMITER/);

    The delimiter isn't actually DELIMITER, but it is an all-upper-case string with, as it happens, the same number of letters.

    Even better, the "CSV" files are created by a perl script, which writes the files, throws away the data used to create them, reads them back in, parses the data, deletes the files, and writes the data to an Excel spreadsheet. The entire "CSV" file WTF is a pointless waste of time; the original data could be written directly in Excel format.

    Of course, it used to be even worse; the script used to reopen the file to write each field and each delimiter. No, it didn't close it ("only" at the end of each row); it just pointlessly opened it again.



  • Dare I ask, how does the delimiter get escaped? Or is the data all numbers?



  • @delfinom said:

    Dare I ask, how does the delimiter get escaped? Or is the data all numbers?

    I'm pretty sure there's no case in which the string "DELIMITER" would appear in valid data, and the actual string is even less likely to appear, so escaping is never necessary. I buttume that's why they chose this stupid format, rather than normal CSV, so they wouldn't have to worry about escaping. Because just writing the data directly to the spreadsheet would be too sane.

    EEs who learn enough perl (or python, ruby, bash; the language is not the problem) to script their workflows are dangerous.



  • EEs who learn enough perl (or python, ruby, bash; the language is not the problem) to script their workflows are dangerous.

    Hey, I'm a EE! I take offense to that!



  • @delfinom said:

    Hey, I'm a EE! I take offense to that!

    So am I, so I include myself in that category, too, although I've done enough programming over the last 30 years to (I hope) write reasonably sane code most of the time.



  • @HardwareGeek said:

    EEs who learn enough perl (or python, ruby, bash; the language is not the problem) to script their workflows are dangerous.

    I can assure you that the same is true of programmers given enough electronics theory training to design their own switching power supplies.

    The particular project I have in mind involved me designing a thing. It was an elegant design in many ways, with no wasted parts and creative use of many.

    It conformed better to the spec-as-written than the initial design I was originally called in to audit. However, because it did certain things in unconventional ways, it produced quite different real-world results compared to competing devices from other manufacturers, making its results all but useless to experienced users. It was also very nearly unmanufacturable. And it suffered badly from self-induced noise, which the length of time it had taken me to get it to that point meant that I never did get time to fix before it went into production.

    It was at least as offensive as the boot loader one of our EEs wrote.


  • Grade A Premium Asshole

    @flabdablet said:

    It was at least as offensive as the boot loader one of our EEs wrote.

    He has likely talked about you on an EE WTF forum. But he did it on not-Discourse. So he did it better.



  • @Intercourse said:

    EE WTF

    I wish there was an EE WTF forum, my god the horrors I have dealt with and still deal with. All I've seen is the LinkedIn EE boards which are really epeen boards with everyone trying to look like the best person to hire as consultant.



  • @delfinom said:

    All I've seen is the LinkedIn EE boards which are really epeen boards with everyone trying to look like the best person to hire as consultant.

    I wonder if any potential recruiters are lurking on TDWTF forums.

    If so, I might want to speed up that plan of having a nice retirement running an apiary in a secluded Siberian taiga. About forty years or so.



  • Quick reminder: Excel can't even understand CSV itself. At least not in the Swedish localization. They like to think that the comma separated values are using semi colons as deliminators.


  • BINNED

    @henke37 said:

    They like to think that the comma separated values are using semi colons as deliminators.

    Hence I always set separators to semicolons and double check them when importing.



  • @henke37 said:

    Excel can't even understand CSV itself. At least not in the Swedish localization. They like to think that the comma separated values are using semi colons as deliminators.

    And that brings you a world of pain, especially if you're working with a program retarded in its own right...

    Whoops, some of the columns are misaligned. How's that so? Well, apparently when you export your data to CSV, all columns are separated by commas. You know what else is separated by commas in Visual Profiler?

    Fractions. Yes, "0,5" suddenly ends up as "0" and "5". There's no option to change that in the profiler, there's no option to change the CSV separator in the profiler, and it appears to ignore my system settings when I've set the decimal separator to a period. Fucking morons.



  • @delfinom said:

    LinkedIn EE boards which are really epeen boards with everyone trying to look like the best person to hire as consultant.

    Isn't that all of LinkedIn?

    I don't actually know, I don't use it, but apparently it's essential if I want to change jobs at some point. It sounds like a cult to me.


  • Discourse touched me in a no-no place

    @HardwareGeek said:

    "CSV" files

    Crap Separated Values?



  • @dkf said:

    Crap Separated Values?

    "💩" Separated Values?


  • BINNED

    data1💩data2💩data3💩data4💩data5

    Yup. Much better.



  • Besides, what happened to FS, US, RS, and GS? Did those control characters suddenly stop existing to 99.9999% of the computer world? It sounds like they'd be an improvement over half the steaming piles of WTF that show up when crap-separated-values files are summoned into being, too, which should scare you.



  • @HardwareGeek said:

    The delimiter isn't actually DELIMITER, but it is an all-upper-case string with, as it happens, the same number of letters.

    Gee, I wonder what that would be.

    http://what.thedailywtf.com/t/obfuscation-yo/1150/63?u=maciejasjmj

    @tarunik said:

    suddenly stop existing

    Well, I suppose most of the people who had used them are now either dead or senile...


    Filed under: anonymization, yo!



  • @tarunik said:

    what happened to FS, US, RS, and GS?

    I seem to recall reading somewhere once long ago that Modula used RS to separate lines in text files.

    Whatever happened to Modula?


  • Discourse touched me in a no-no place

    There was a Modula-2 and a Modula-3 (which was really an OO version of Modula 2). They basically died in the face of C++, Java and C# (especially Modula-3, which is a good illustration of How To Not Do OO, syntactically speaking).

    (I had to use Modula-3 in my undergraduate course. Bleah.)



  • @tarunik said:

    Did those control characters suddenly stop existing to 99.9999% of the computer world?

    Yes. No really, when was the last time you saw any ASCII control character being used anywhere, other than \0, \t, \r or \n?



  • @Onyx said:

    Hence I always set separators to semicolons and double check them when importing.

    Well I use \t for my CSV (or I guess TSV) values.
    And am pretty hard core tabs guy when it comes to indenting.
    I like tabs. Tabs should be used everywhere.

    @anonymous234 said:

    Yes. No really, when was the last time you saw any ASCII control character being used anywhere, other than \0, \t, \r or \n?

    I can see why others have fallen out of favor. If you can't easily produce it on keyboard, it's too much a pain in the ass to tinker with. Unlike tab. Sweet sweet tab...


  • ♿ (Parody)

    @cartman82 said:

    I like tabs. Tabs should be used everywhere.

    +�


  • BINNED

    @cartman82 said:

    And am pretty hard core tabs guy when it comes to indenting.I like tabs. Tabs should be used everywhere.

    That could start a holy war, you know?

    And yeah, I agree with tabs, and I can give two actual, real world benefits (as opposed to bracket placement which is mostly "I find this one more readable"):

    1. I like my code indented at 4 characters. Some people prefer two. Some eight. With tabs, you can set the width in your editor and have your preferred style applied without messing with it and without messing it up for other people.
    2. Every freaking editor can use tabs properly. Ever been forced to edit code in something as basic as Notepad? Yeah, have fun adjusting indentation if you remove or add an if statement around a block of code that was already 3 levels deep and uses 8 spaces for indentation...

    Filed under: Hyperbole intended



  • Oh boy! I hope there's a spaces guy around, so we can have the first tabs vs spaces war on Discourse!



  • And you even get to not fuck with the Python guys if you use tabs.


  • BINNED

    @Arantor said:

    Python

    I was saving that one for later in case no one bites...



  • @cartman82 said:

    If you can't easily produce it on keyboard, it's too much a pain in the ass to tinker with.

    What's hard about Ctrl-_ (US), Ctrl-^ (RS), Ctrl-] (GS) or Ctrl-\ (FS)?



  • @flabdablet said:

    What's hard about Ctrl-_ (US), Ctrl-^ (RS), Ctrl-] (GS) or Ctrl-\ (FS)?

    I'd love to see you produce Ctrl-_ on your US keyboard in Discourse without fighting with the otherwise inbred keyboard shortcut for zoom.





  • @anonymous234 said:

    Yes. No really, when was the last time you saw any ASCII control character being used anywhere, other than \0, \t, \r or \n?

    Actually, that was only a few years ago when I worked with the AFTN 10 message format (which dates back to the days of physical teletypes).



  • @Maciejasjmj said:

    Gee, I wonder what that would be.

    You expect me to remember something I posted a month and a half ago? I don't even remember what I posted an hour and a half ago.


  • ♿ (Parody)

    @HardwareGeek said:

    You expect me to remember something I posted a month and a half ago? I don't even remember what I posted an hour and a half ago.

    Your blakeyrat impression needs more caps.



  • I can remember specific phrases of things I posted half the likes topic ago. but they were awesome phrases. Everything else, meh.


  • ♿ (Parody)

    That's why you post only the truth. It's easier to remember.



  • @boomzilla said:

    That's why you post only the truth. It's easier to remember.

    Well, duh, but I remember the specific ways in which I express my truth.


  • BINNED

    There's this stupid saying around here... You know how sometimes you want to say something, but something/someone interrupts you lose the thought?

    Yeah, people usually say that means you were about to lie.

    Motherfucker, if I wanted to lie, I'd have to invent it, construct excuses, and be ready to respond with more bullshit if called on it. I'd hardly forget all that, wouldn't I?


  • ♿ (Parody)

    @Onyx said:

    Yeah, people usually say that means you were about to lie.

    Do they? I haven't noticed that. Maybe it's a cultural thing.


  • BINNED

    It is. I did say "around here". You know, Fuckville, in Shittystan.


  • ♿ (Parody)

    Ah, right.



  • @Onyx said:

    You know how sometimes you want to say something, but something/someone interrupts you lose the thought?

    Yeah, people usually say that means you were about to lie.

    It seems to me to mean that I was about to digress in one direction when somebody else digressed in a different direction.



  • I just happened to be reading this thread before looking into an old application I needed some information from, written in VB6 (uhoh) it has the most absurd way of creating a CSV file I've ever seen.

       'Start a new workbook in Excel
       Set oExcel = CreateObject("Excel.Application")
       Set oBook = oExcel.Workbooks.Add
    
       'Select the first worksheet in the new workbook
       Set oSheet = oBook.Worksheets(1)
    
       'Write out the column headers
       oSheet.Range("A1").Value = "No"
       oSheet.Range("B1").Value = "Model"
       oSheet.Range("C1").Value = "MFG"
       oSheet.Range("D1").Value = "S/N"
    

    ...snip dumping all the fields from the array into excel cell by cell...

       'Save the Workbook and Quit Excel
       oBook.SaveAs App.Path + "\Data\" + gExcelFileSaved
       oExcel.Quit

Log in to reply