Saving newline just in case your keyboard loose them...



  • I am no programmer, but work in a closely related field. Part of my job is handling statistical data analysis - which involves a lot of poorly documented scripting in esoteric languages.

    Everytime I read a script from my predecessor I am asking myself "why did she love newlines so much?!". Basically every line of code is seperated by 5 newlines or so.

    Reading the code is a total pain - you cannot see the beginning and end of an statement at once. Logically related lines of code are seperated by huge walls of no text, whereas meaningful breaks are absent.

    Now I am going through a 10.000 LOC file with 30% newlines without purpose. Cleaning and organizing it is a pain, but afterwards I can actually see what I am doing.



    Some code to show the problem:
    text Q11Multi = "Table 11: Statiscial Analysis

    Some text
    ";

    tabselect text "Base: Use only a subset of the data;


    #t1 table = #Header1 by Variable99 sort position slice 19;
    #t1 table = #Header2 by Variable99 sort position slice 19;
    {#t1 table = #Header3 by Variable99 sort position slice 19;
    #t1 table = #Header4 by Variable99 sort position slice 19;
    #t1 table = #Header5 by Variable99 sort position slice 19;
    #t1 table = #Header6 by Variable99 sort position slice 19;
    #t1 table = #Header7 by Variable99 sort position slice 19;
    #t1 table = #Header8 by Variable99 sort position slice 19;}

































    #ifdef ascout
    spsslongnames = yes;

    asciiout ID1 = 1 13;
    setdecimals systemweight = 4;
    asciiout systemweight = 15 10;

    spss asciiout = "gew.sps";
    asciioutfile = "gew.dat";
    #end





    end;


  •  Somehow I think when she "learned" to use a compute, she pressed the Insert key. Adding text in the middle of the document is a pain in replace mode, ya'know? Must be sure to add blank space to have room for later.

     

    And suddendly the numbering of BASIC lines comes to mind...

     



  • That is a rather good explanation....



    Oh my good, I would really love Basics Line Numbers and gotos in the language I use here..

    All I have is a crappy "IF #DEBUG ELSE" syntax, which just doesn't cut it. But the developers do not understand the need for a logic flow... "Just uncomment or comment when you need a specific element not every time..."



  • I once had an intern who didn't seem to understand the Delete or Backspace keys. If he had to remove any code, he'd highlight the section using the mouse and press Spacebar or Enter. Any codefile he worked on was riddled with odd whitespace and no two indentations were of the same depth.


  • Discourse touched me in a no-no place

    @HerrDerSchatten said:

    Everytime I read a script from my predecessor I am asking myself "why did she love newlines so much?!". Basically every line of code is seperated by 5 newlines or so.
    I did once encounter code that was a little bit like that, with a mysterious wall of blank (and empty) lines. The fun bit was that removing any of the lines (in an otherwise ordinary file) made the code fail under test...


  • Discourse touched me in a no-no place

    @dkf said:

    @HerrDerSchatten said:
    Everytime I read a script from my predecessor I am asking myself "why did she love newlines so much?!". Basically every line of code is seperated by 5 newlines or so.
    I did once encounter code that was a little bit like that, with a mysterious wall of blank (and empty) lines. The fun bit was that removing any of the lines (in an otherwise ordinary file) made the code fail under test...
     

    Maybe it had a Whitespace program embedded in it.

     



  • Since you're using SPSS,  mott555 is closer than he realizes: 

    [quote user="mott555".. had to RUN any code, he'd highlight the section using the mouse and press F9.... Any codefile he worked on was riddled with odd whitespace and no two indentations were of the same depth. /quote]

    The crappy SPSS script editing/execution window (esp. if it gets lag-y) combined with Statistics-people's cargo-cult of black-magic incantations to get results like they did last time... par for the course. I feel your pain.

     



  • Sigh, I don't know what was / is worse:

    The joke of "syntaxeditor" of the older SPSS versions, which was simply notepad with no highlighting whatsoever or the newer one, which can do fancy thinks like text highlighting, but is so slow that you can see how it draws the characters on the screen.

    I have a looong inherited syntax file with 5000 LOC which simply choked my old computer and my new one is barely able to handle it (4 cores, 8gb of ram to display some text...). This is SPSS 19, which is full of enterprisey java. Newer versions are better, but I don't have them.

    Now the file is broken up in smaller parts, but I need a full blown python script the execute the files, because SPSS cannot handle relative file paths...



  • Edit -> Formatting -> Auto-Format. Done.

    Oh wait, let me guess, this shitty language has no IDE. Or the IDE is so shitty it doesn't auto-format.



  • IDE? Bwahaha!

    I use Notepad++ with a custom syntax definition file, so I can use highlighting. Before that, there where Notepad and Textpad...



  • @blakeyrat said:

    Edit -> Formatting -> Auto-Format. Done.
     

    I'm always amazed at how many of my students can't remember that this option exists in the IDE we use.  Even after reminding them several times, I still get programming submissions whose line indentations look like they were set by a random number generator.

    Granted, these are high school students, but it seems like the population of people working with code anywhere contains a significant fraction that don't seem to understand why the rest of us want the whitespace to follow some sort of consistent convention.

     


  • Considered Harmful

    I keep visible whitespace enabled and am kind of OCD about keeping it consistent. What drives me bonkers is that if someone edits a .js file with Visual Studio default settings, as soon as they type a semicolon or bracket, it reformats the ENTIRE FILE. They usually don't notice and it ends up committed. (And no, I can't fix it with another auto-format, it was done by hand.)



  • @joe.edwards said:

    (And no, I can't fix it with another auto-format, it was done by hand.)

    And that is their problem. Not yours. I see.



  • @HerrDerSchatten said:

    This is SPSS 19, which is full of enterprisey java.

     Try to revert to v16... or find a version of SPSS Server, so you can run from the CLI (and... to you detractors out there <you know who you are>,  in this case the editor-savefile-CLI-examineresults-rinse-repeat workflow is preferable to suffering with the IDE.)

    At least, by avoiding the scripting window - you'll be writing scripts that run from beginning-to-end, and you'll be able to reproduce your results - (apparently )unlike your co-workers.



  • @mott555 said:

    I once had an intern who didn't seem to understand the Delete or Backspace keys. If he had to remove any code, he'd highlight the section using the mouse and press Spacebar or Enter. Any codefile he worked on was riddled with odd whitespace and no two indentations were of the same depth.

    Former colleague of mine was always "erasing" the documents he did not need anymore by overwriting the content with spaces. Maybe they are related. Was your intern a black guy with a severe lisp?



  • @inori said:


    ... the population of people working with code anywhere contains a significant fraction that don't seem to understand why the rest of us want the whitespace to follow some sort of consistent convention.

    <FONT color=#810081>http://en.wikipedia.org/wiki/The_Elements_of_Programming_Style</FONT> 

    I have list of required reading/viewing for my children if they want to continue to receive water, food, and shelter.. This is on it. (As is Strunk and White's also useful version).



  • @Ronald said:

    @mott555 said:
    I once had an intern who didn't seem to understand the Delete or Backspace keys. If he had to remove any code, he'd highlight the section using the mouse and press Spacebar or Enter. Any codefile he worked on was riddled with odd whitespace and no two indentations were of the same depth.

    Former colleague of mine was always "erasing" the documents he did not need anymore by overwriting the content with spaces. Maybe they are related. Was your intern a black guy with a severe lisp?

    No, but he did come from a certain high-population Eastern country with a reputation for churning out mass quantities of low-quality developers.



  • @inori said:

    Even after reminding them several times, I still get programming submissions whose line indentations look like they were set by a random number generator.

    Next time you run the course, dock points for style errors. They'll quickly start paying attention.

    (I say this not entirely witihout sadism, but also because I've seen it work with first-year university undergrads.)


  • Considered Harmful

    @blakeyrat said:

    @joe.edwards said:
    (And no, I can't fix it with another auto-format, it was done by hand.)

    And that is their problem. Not yours. I see.


    Do you know of a Javascript editor that can handle long method chains, JSON parameters, and embedded closures in a sane way? Visual Studio is not that editor.



  • Unfortunately, we need some features auf 19, especially the programmabillity.

    The CLI argument is a good one, I think I will try that.



  • @blakeyrat said:

    Edit -> Formatting -> Auto-Format. Done.

    Oh wait, let me guess, this shitty language has no IDE. Or the IDE is so shitty it doesn't auto-format.

    In that case, vim plus a few Go-related scripts is an IDE, since I can just type :Fmt and it autoformats all my code. I also have it set to autoformat before saving.



  • @Ben L. said:

    @blakeyrat said:
    Edit -> Formatting -> Auto-Format. Done.

    Oh wait, let me guess, this shitty language has no IDE. Or the IDE is so shitty it doesn't auto-format.

    In that case, vim plus a few Go-related scripts is an IDE, since I can just type :Fmt and it autoformats all my code. I also have it set to autoformat before saving.

    Are you daft?

    I guess you haven't taken any logic courses since you just got out of high school.  A -> B does not mean B -> A.



  • @joe.edwards said:

    Do you know of a Javascript editor that can handle long method chains, JSON parameters, and embedded closures in a sane way? Visual Studio is not that editor.

    If by "handle" you mean "auto-format", then yes, Visual Studio IS that editor.

    Admittedly, its intellisense chokes on stuff like that usually. But it can *format* the code file. I mean, Microsoft designed the auto-formatter to work with jQuery which uses all of that shit.



  • @Mr. DOS said:

    Next time you run the course, dock points for style errors. They'll quickly start paying attention.

    (I say this not entirely witihout sadism, but also because I've seen it work with first-year university undergrads.)

     

    I do that.  I also take off points for code that doesn't have a minimum level of commenting.

    But then, I've known students to...

    • Send me programs that don't even come remotely close to compiling
    • Send me programs that are just the starter code I gave them, with no changes
    • Send me programs that are exact duplicates of a classmate's code with the name changed (on the apparent assumption that I won't notice if two students submit code that contains the same WTF)
    • Send me programs that I find with a fifteen-second search on Google or Stack Overflow (thankfully, nothing copied from The Daily WTF... yet)
    • Send me programs that solve an entirely different problem from the one described in the assignment
    • Send me programs in the wrong language
    • Send me "program" submission messages that don't actually have any code attached
    All these thrills and more can be yours if you teach an introductory CS course!


  • @Sutherlands said:

    @Ben L. said:
    @blakeyrat said:
    Edit -> Formatting -> Auto-Format. Done.

    Oh wait, let me guess, this shitty language has no IDE. Or the IDE is so shitty it doesn't auto-format.

    In that case, vim plus a few Go-related scripts is an IDE, since I can just type :Fmt and it autoformats all my code. I also have it set to autoformat before saving.

    Are you daft?

    I guess you haven't taken any logic courses since you just got out of high school.  A -> B does not mean B -> A.

    "It has autoformat iff it is a good IDE"



  • @Ben L. said:

    In that case, vim plus a few Go-related scripts is an IDE, since I can just type :Fmt and it autoformats all my code. I also have it set to autoformat before saving.

    ... IMPREGNABLE LOGIC!



  • @HerrDerSchatten said:

    Unfortunately, we need some features auf 19, especially the programmabillity.
    The CLI argument is a good one, I think I will try that.

    The CLI is only available in the ("SPSS"|"Statistics")Server product, and you need access to the server it's running on.

    Which programmability features? Python or Java?  Esp. Are you calling SPSS directly from Java?



  • @Ben L. said:

    @blakeyrat said:
    Edit -> Formatting -> Auto-Format. Done.

    Oh wait, let me guess, this shitty language has no IDE. Or the IDE is so shitty it doesn't auto-format.

    In that case, vim plus a few Go-related scripts is an IDE, since I can just type :Fmt and it autoformats all my code. I also have it set to autoformat before saving.

    Did you skip the Basics? Notepad is top-notch IDE!



  • @Ben L. said:

    @Sutherlands said:
    @Ben L. said:
    @blakeyrat said:
    Edit -> Formatting -> Auto-Format. Done.

    Oh wait, let me guess, this shitty language has no IDE. Or the IDE is so shitty it doesn't auto-format.

    In that case, vim plus a few Go-related scripts is an IDE, since I can just type :Fmt and it autoformats all my code. I also have it set to autoformat before saving.

    Are you daft?

    I guess you haven't taken any logic courses since you just got out of high school.  A -> B does not mean B -> A.

    "It has autoformat iff it is a good IDE"

    I'm not sure who this is a quote of.  It's not blakey.



  • Look like a quote of Ben L. (now, having a script that autoformat the code automatically when you commit it do work well. It have nothing to do with IDE)



  • @flabdablet said:

    Did you skip the Basics? Notepad is top-notch IDE!

    This guy is fucking hilarious, it's like the bastard child of Borat and Angelina Jolie (as Kate in Hackers). You will never know since you ignore my posts but I despise you slightly less for posting that.



  • @flabdablet said:

    Did you skip the Basics? Notepad is top-notch IDE!
    Especially on Windows 98!!  You don't need those Windows Sevens And Eights!!

     



  • @El_Heffe said:

    @flabdablet said:

    Did you skip the Basics? Notepad is top-notch IDE!
    Especially on Windows 98!!  You don't need those Windows Sevens And Eights!!

     

    What happens after Windows 9? Do we skip straight to 200?



  • @Ben L. said:

    @Sutherlands said:
    @Ben L. said:
    @blakeyrat said:
    Edit -> Formatting -> Auto-Format. Done.

    Oh wait, let me guess, this shitty language has no IDE. Or the IDE is so shitty it doesn't auto-format.

    In that case, vim plus a few Go-related scripts is an IDE, since I can just type :Fmt and it autoformats all my code. I also have it set to autoformat before saving.

    Are you daft?

    I guess you haven't taken any logic courses since you just got out of high school.  A -> B does not mean B -> A.

    "It has autoformat iff it is a good IDE"

    Dude, wtf? How are you so unable to comprehend simple logic?


  • Discourse touched me in a no-no place

    @FrostCat said:

    Maybe it had a Whitespace program embedded in it.
    Nice try. No. It had code later on that was critically dependent on being on the right line number…



  • There is in fact an editor out there that will turn CR-LF pairs into CR-LF-CR-LF-LF when code is copy-pasted into another file. The effect is cumulative— i.e., if copy-pasted code is copy-pasted again, that CR-LF-CR-LF-LF nightmare is converted to CR-LF-CR-LF-LF-CR-LF-CR-LF-LF-LF, and so on. This essentially triples (!!!) line spacing every time code is "reused" (and causes Vim and diff to show tons of angry-looking sy^Mbols at the ends of lines). Amusingly, I've actually been able to use this as a metric to track prior code "reuse" in the codebase, which I've inherited from outsourcers (of course), by counting the number of consecutive linefeeds that follow a carriage-return-linefeed pair.

    Since the cargo-cult school of design's philosophy is "copy-paste, blindly, until something happens", a number of these files were hundreds of thousands of lines long, practically all of that whitespace. I want to believe that their editor somehow magically collapsed this mess, and that most of the time they were paid for wasn't spent simply scrolling through countless lines every copy-paste… I don't even want to know what kind of logic would inspire someone to keep using such an editor regardless. I am curious, though, what the editor they used actually was (or even what platform it ran on).



  • @Ben L. said:

    What happens after Windows 9? Do we skip straight to 200?
    Windows 7, Windows 8, Windows 9, Windows 9a, Windows 9b, Windows 9c, Windows 9c with cheese....



  • Ok, than it is out of the window - our server is an old Windows 2003 server with ~250Gb hard disk, which is totally clogged. At the moment, I am spending my time compressing SPSS files so there is some room to breathe.



    I use Python for some Operations within the SPSS environment, but .NET interop for some advanced stuff which is beyond the scope of spss. Mainly, I am generating syntax for another program which works with SPSS data.



    And just now I am realsiing that I am putting myself out of work - at the beginning, I was fighting with a workflow which lasted for about 16 work hours per project. Now I am down to 8 and, by end of the month, down to 5 or les...



  • @El_Heffe said:

    Especially on Windows 98!!  You don't need those Windows Sevens And Eights!!
    Of course not, 98 is more than 7 or 8 after all!



  •  I'm just waiting for Windows9000


  • Discourse touched me in a no-no place

    @dhromed said:

    I'm just waiting for Windows9000
    You need to wait for the one after that.



  • I'm waiting for the successor to Windows 9.11. I want to live in the post-9.11 IT world where terrorism is the hot new IT buzzword.



  • I couldn't help but read SPSS as SSDS. 



  • @j6cubic said:

    I'm waiting for the successor to Windows 9.11. I want to live in the post-9.11 IT world where terrorism is the hot new IT buzzword.
     

    When you click shut down, Microsoft flies a plane into your tower.



  • @j6cubic said:

    Filed under: IEDFactoryFactory, Enterprise Jihad Planning

    I want to commit stoneable acts with you.



  • @Ben L. said:

    What happens after Windows 9? Do we skip straight to 200?

    Windows A, obviously



  • @electronerd said:

    @Ben L. said:
    What happens after Windows 9? Do we skip straight to 200?

    Windows A, obviously

    What comes after Windows F?

  • Considered Harmful

    @Ben L. said:

    @electronerd said:
    @Ben L. said:
    What happens after Windows 9? Do we skip straight to 200?

    Windows A, obviously

    What comes after Windows F?
    Windows G. (Base-64)


  • @inori said:

    @Mr. DOS said:

    Next time you run the course, dock points for style errors. They'll quickly start paying attention.

    (I say this not entirely witihout sadism, but also because I've seen it work with first-year university undergrads.)

     

    I do that.  I also take off points for code that doesn't have a minimum level of commenting.

    But then, I've known students to...

    • Send me programs that don't even come remotely close to compiling
    • Send me programs that are just the starter code I gave them, with no changes
    • Send me programs that are exact duplicates of a classmate's code with the name changed (on the apparent assumption that I won't notice if two students submit code that contains the same WTF)
    • Send me programs that I find with a fifteen-second search on Google or Stack Overflow (thankfully, nothing copied from The Daily WTF... yet)
    • Send me programs that solve an entirely different problem from the one described in the assignment
    • Send me programs in the wrong language
    • Send me "program" submission messages that don't actually have any code attached

    All these thrills and more can be yours if you teach an introductory CS course!

     

    But there's already a solution for this! An ages old recipe that was in use in the university I went to: All students submit their code from an SSH shell on a server, via an utility that style-checks, compiles and tests the programs before accepting them.

    Let me go into details, so that this recipe may be appreciated to its full beauty:

    - All students get access to a server cluster that houses their school-given network drives and programming utilities.

    - This cluster runs Linux and has SSH server and GCC tools installed.

    - Students may develop their CS assignments on the cluster. They don't have to, since they can transfer files in or out via e.g. SSH, Apache (from magic folder in their home folder). or network drive from school's public workstations.

    - When turning in an assignment, the students log in via SSH shell, and simply point their folder to a submission utility (named BOSS at my old school). This utility would then:

    1. Check the style (with an utility called "style", heh) against the school standard, and reject if there were too many stylistic errors.

    2. Check that certain unallowed (system) libraries were not referenced. Again, rejection to rule-breakers.

    3. Compile the code from makefile. Code must be compilable or it is rejected.

    4. Run the resulting program with some predetermined input and compare the output, line by line, to the correct result. Rejection if there were more than 3 erroneous lines. Of course, the TAs kept a very sensitive ear to complaints of erroneous rejections, since one can't fail the whole class if the spec was wrong.

     

    But I guess that U.S. schools are too poor these days to afford Linux servers, so you might be out of luck.

     

     



  • @OldCrow said:

    @inori said:

    @Mr. DOS said:

    Next time you run the course, dock points for style errors. They'll quickly start paying attention.

    (I say this not entirely witihout sadism, but also because I've seen it work with first-year university undergrads.)

     

    I do that.  I also take off points for code that doesn't have a minimum level of commenting.

    But then, I've known students to...

    • Send me programs that don't even come remotely close to compiling
    • Send me programs that are just the starter code I gave them, with no changes
    • Send me programs that are exact duplicates of a classmate's code with the name changed (on the apparent assumption that I won't notice if two students submit code that contains the same WTF)
    • Send me programs that I find with a fifteen-second search on Google or Stack Overflow (thankfully, nothing copied from The Daily WTF... yet)
    • Send me programs that solve an entirely different problem from the one described in the assignment
    • Send me programs in the wrong language
    • Send me "program" submission messages that don't actually have any code attached

    All these thrills and more can be yours if you teach an introductory CS course!

     

    But there's already a solution for this! An ages old recipe that was in use in the university I went to: All students submit their code from an SSH shell on a server, via an utility that style-checks, compiles and tests the programs before accepting them.

    Let me go into details, so that this recipe may be appreciated to its full beauty:

    - All students get access to a server cluster that houses their school-given network drives and programming utilities.

    - This cluster runs Linux and has SSH server and GCC tools installed.

    - Students may develop their CS assignments on the cluster. They don't have to, since they can transfer files in or out via e.g. SSH, Apache (from magic folder in their home folder). or network drive from school's public workstations.

    - When turning in an assignment, the students log in via SSH shell, and simply point their folder to a submission utility (named BOSS at my old school). This utility would then:

    1. Check the style (with an utility called "style", heh) against the school standard, and reject if there were too many stylistic errors.

    2. Check that certain unallowed (system) libraries were not referenced. Again, rejection to rule-breakers.

    3. Compile the code from makefile. Code must be compilable or it is rejected.

    4. Run the resulting program with some predetermined input and compare the output, line by line, to the correct result. Rejection if there were more than 3 erroneous lines. Of course, the TAs kept a very sensitive ear to complaints of erroneous rejections, since one can't fail the whole class if the spec was wrong.

     

    But I guess that U.S. schools are too poor these days to afford Linux servers, so you might be out of luck.

    Why not just have a script which tells them if the program will give them an A before they submit? Things like style or non-compiling code are what is being evaluated. But giving them an easy button which just tells them to fix their shit, you just guarantee they never learn to do that stuff on their own.


Log in to reply