111 faq


  1. What if I missed my week 1 lab? If possible, go to another week 1 lab; tell the GTF that you're not in the lab, and you can watch from the sidelines if it's full.

    Also, two help sessions are scheduled to cover the same material of the week 1 lab. The times/places of these help sessions are on the Announcements page in Blackboard.

  2. How do I get the lab I want?

    We are handling this informally. You do not have to use the DuckCall "exchange section" command (XS, 97) after it starts costing you $$ to do so. Here's what to do:

    Go to the lab you want and ask the GTF if there's room for you. If your GTF says Yes, make sure that s/he has your name removed from your original lab and added to the new one. If the GTF says No, you will have to attend a different lab.

    For labs that are full, two names may be added beyond the max, on the condition that the added students may have to watch over someone's shoulder when everyone registered attends the lab. Note that the originally registered students up to the max are guaranteed a seat. If you are one of the extra students added over the max and you have a notebook computer, bring it to the lab which is a wireless hotspot (and there are also Ethernet connections in the walls of B26 Kla if your notebook is not wireless enabled.)

  3. Can I take CIS 111 P/N? Yes. 111 does not have to be taken for a grade to satisfy the B. Sci. math and computing requirement.

  4. Working with long strings in a JavaScript. If you type in a loooooong string using TextPad, the Word-Wrap button on the main toolbar can be used to wrap the long string to the start of the next line. However, when you save this file, a hard line break will be saved at the end of each wrapped line, and this breaks the string literal into two, which causes an error in JavaScript. To even see the error, you will have to open the JavaScript console.

    The easiest solution: break up a long string into shorter strings and use the concatenation operator (+) to join them.

    A TextPad solution: configure TextPad to save long lines without hard line breaks: Choose Configure Preferences.. for document class HTML to save a file with no line breaks in word-wrapped long lines. By default, TextPad will save the file with hard breaks (i.e., a carriage return) in word-wrapped long lines.

    A third alternative is to manually "escape" your own carriage returns in long strings. Here's a clear example of the concept, from Indispensable JavaScript Tutorials, www.jennifermadden.com:

    Escaping Carriage Returns. When working with long strings in your source code, you may be tempted to break the string up into multiple lines to make it more readable. While this sounds good, placing a carriage return in the middle of quoted text string will cause a script error - which for IE browsers is "Unterminated string constant". This is because the JavaScript interpreter sees carriage returns as the end of a statement - you may as well have placed a semi colon there.

    Although the next lesson covers much more efficient ways to break up a long string, I'll quickly explain how the escape character can be used to do the same thing. Place a single string on multiple lines using only one set of quotes for the entire string. Anywhere you want to break the string, place the escape character ( \ ) at the end of the line, then a carriage return.

    'hello world.\
    my name is Jenn\
    ifer.'

    This carriage-retun-escaping technique which simply breaks up a string in source code is not often used because it does not provide a way to concatenate a string variable into the mix. But hey, somebody out there just might like to use it!

    JavaScript Strings: Nesting Quotes And The Escape Character

    Many times you will work with strings which contain quotes. Since the JavaScript interpreter reads the first quote it encounters as the beginning of the string, and reads the very next quote it encounters as the end of the string, we need a way to signify that a quote is part of a string and not the end of it.

    There are two ways to accomplish this goal: nesting opposite quotes and using a special character called the escape character.

    "Quote Swapping"

    String values can be surrounded by either single quotes or double quotes. Except in the case of event handlers which always surround their values in double quotes, which type of quote you use is entirely up to you.

    Which type of quote you use to surround your nested string is determined by the type of quote surrounding its containing string. A nested string is surrounded by the oppisite kind of quote which surrounds its containing string. I call this "quote swapping". In other words, if my outer string is contained by double quotes, my inner string must be contained by single quotes, and vice versa.

    Nest single and double quotes as follows:

    var beasty = "He said 'howdy', I said 'hi'." // nesting single quotes within double quotes

    var boys = 'He said "howdy", I said "hi".' // nesting double quotes within single quotes

    <a href="javascript:alert(boys)">Show me the string</a>

    The Escape Character

    It is legal to surround a nested string with the same type of quote as is surrounding its containing string as long as the escape character ( \ ) precedes the nested quote. The escape character tells the JavaScript interpreter that the quote is part of the string, not the end of the string.

    var beasty = "He said \"howdy\", I said \"hi\"." // nesting double quotes within double quotes

    var boys = 'He said \'howdy\', I said \'hi\'.' // nesting single quotes within single quotes

    <a href="javascript:alert(beasty)">Show me the string</a>

    Some scripters prefer to use the escape character rather than quote swapping to avoid mistakes so easily made when nesting both kinds of quotes. Others always use single quotes (except in the case of event handlers) to contain their nested quotes. The reason is that very often your JavaScript strings are HTML - which requires its attributes to be quoted. This allows the printing of the HTML to be "natural" - as it would be written in a static document, with double quotes surrounding attribute values.

            document.write('onclick="alert(\"Hello, World\")"')
        
  5. SSH sometime uses the Delete key to erase characters, but I prefer to use the Backspace key. How do I set it up?

    You have several options, as follows:
    1. Windows: Start SSH, select Edit > Settings > keyboard, then select Backspace sends Delete (or whichever key you want to use), then click OK.
    2. OS X: Start Applications > Utilities > Terminal, the select Terminal > Window Settings..., then select Keyboardin the drop-down list, then check Delete key sends backspace.
    3. Set your Unix shell's Erase key--

      Use Pico or Emacs to edit your login shell's startup file, .bash_profile: $emacs .bash_profile
      Add this line to the .bash_profile: stty erase '^h'
      save the file and exit emacs

  6. How can I get the path for the current directory displayed in my Unix prompt?

    Read Generic UNIX Interactive Prompts

  7. How can I define useful aliases in Unix? Use Emacs to add some of these aliases .bash_profile

    alias j jobs
    alias c clear # clear the display
    alias cw 'chmod 664' # make an .html file web accessible
    alias cx 'chmod 755' # set the standard mode for a directory
    alias cp cp -i # Ask before overwriting a file
    alias ed emacs
    alias h history
    alias k logout # kill
    alias ls ls -F # Marks dirs w/, links w/@, executables w/*
    alias ll ls -l # long listing
    alias ld ls -dl # show status of directory not contents
    alias lsx "ls -CR | more" # shows all files in all directories
    alias q fg # resume most recently suspended job
    alias rme "rm *~;rm #*#; ls" # remove all emacs backup files
    alias rmb "rm *.bak; ls" # remove all textpad backup files
    alias 1 %1 #resume job id = 1
    alias 2 %2 #resume job id = 2
    alias 3 %3 #resume job id = 3