CS4ProgrammingWeek8

From GIS CS4
Jump to: navigation, search

Continue Khan Academy programming using Java Script https://www.khanacademy.org/cs

Monday

Tuesday

Thursday (Lab)

  • Khan Academy: Intro to Arrays

https://www.khanacademy.org/cs/programming/arrays/p/intro-to-arrays

  • Implementing decryption algorithms in JavaScript:

Caesar Cipher Decryption

This will be an assignment that should be submitted by 5pm Thurs 6th March and will be included in this quarter grade.

  • If time continue with Function exercises:

Practice Functions Exercises

Testing Functions Exercises

This assignment should be submitted by 5pm Monday 3rd March and will be included in this quarter grade.

Technology Friday

Tech News

Apple's Programming Failure

Spot the error...

static OSStatus SSLVerifySignedServerKeyExchange(SSLContext *ctx, 
                                                 bool isRsa, 
                                                 SSLBuffersignedParams, 
                                                 uint8_t *signature, 
                                                 UInt16 signatureLen)
{
    OSStatus err;
    ...
    if ((err = SSLHashSHA1.update(&hashCtx, &serverRandom)) != 0)
        goto fail;
    if ((err = SSLHashSHA1.update(&hashCtx, &signedParams)) != 0)
        goto fail;
        goto fail;
    if ((err = SSLHashSHA1.final(&hashCtx, &hashOut)) != 0)
        goto fail; 
    ...

    fail:
    SSLFreeBuffer(&signedHashes); SSLFreeBuffer(&hashCtx); 
    return err;
}

If they had beautified their code, then the error would have been more obvious...

static OSStatus SSLVerifySignedServerKeyExchange(SSLContext *ctx, 
                                                 bool isRsa, 
                                                 SSLBuffersignedParams, 
                                                 uint8_t *signature, 
                                                 UInt16 signatureLen)
{
    OSStatus err;
    ...
    if ((err = SSLHashSHA1.update(&hashCtx, &serverRandom)) != 0)        goto fail;
    if ((err = SSLHashSHA1.update(&hashCtx, &signedParams)) != 0)        goto fail;
    goto fail;
    if ((err = SSLHashSHA1.final(&hashCtx, &hashOut))       != 0)        goto fail; 
    ...

    fail:
    SSLFreeBuffer(&signedHashes); SSLFreeBuffer(&hashCtx); 
    return err;
}

Question - where did the extra 'goto fail;' come from? Don't on purpose?

Apple obvious did NOT have any automatic regression testing!

Make sure you upgrade ALL your iPhone, iPad, iPod Touch, and OSX Macs!

Check your computer using this GotoFail.com website.

Getting a job at Google

Lazlo Bock talks about hiring at Google, and why the GPA is irrelevant

Introduction into HTML

Hyper Text Markup Language is the main markup language for creating web pages and other information that can be displayed in a web browser.

Simple example:

<!DOCTYPE html>
<html>
  <head>
    <title>This is a title</title>
  </head>
  <body>
    <p>Hello world!</p>
  </body>
</html>

Some examples:

Want to learn more about HTML? Visit W3Schools.com. Also HTML5 Canvas Tutorial website.