1. Data Compression Notes

    Natural Written Language is redundant by at least a factor of two. But it is not due to bloat; the reason being:

    1. Error-prone - Spelling mistakes are easily spotted and can easily be corrected.
    2. Extensibility - New words and phrases can be created without technical limitations.
    3. Clarity - A person who does not understand a sentence can read the whole paragraph to extract the meaning. (It can also cause misunderstanding)
     


  2. Cons of Fingerprints Security:

    1. Fingerprints cannot be changed once it is leaked.
    2. Copies of fingerprints can easily be obtained for targeted fraud.

    Pros of Fingerprints Security:

    1. It provides a strong secondary layer in multi-factor authentication
    2. Convenience
     


  3. C++ Notes

    • C++: cin, cout, cerr, clog, fstream. C: printf, scanf, fscanf, FILE.
    • From my experience, fopen and fscanf is better than fstream for file IO while cout, cerr, clog is better than printf for console messages.
    • C++: vector. C: array. In C++, do not use array if size is dynamic or pointer is needed or multidimensional (anything other than int arr [2] or int matrix [2][3]). Use vector with built-in memory management.
    • Both C++ and C are sequentially processed. It is recommended to separate utility functions in a separate .cpp but if necessary, add forward declaration and write functions after main().
    • Don’t start from designing classes or structs. Start from “myutil.h” + “myutil.cpp” with disposable enclosed functions. Start object management after first prototype with all functions working independently.
    • Don’t write exception handling in first prototype (except for critical errors). Just put a reminder in comment and write in next version.  
    • Older C compilers forced users to declare all of the variables in a function at the top of the function.

    Template(main.cpp)
    #include <iostream>
    #include "myutil.h"
    using namespace std;
    int main()
    {
        cin.clear();
        cin.ignore(255,'\n');
        cin.get();
        return 0;
    }

    myutil.h
    #ifndef MYUTIL_H
    #def    MYUTIL_H
    int myfunc(int a, int b);
    #endif

    myutil.cpp
    int myfunc(int a, int b)
    {
        return 0;
    }

    File IO and Passing Pointer by Reference (C++)
    void readFile(FILE* &FileStream)
    {
        FileStream = fopen("filename.txt","r");
        char data = 0;
        fread(&data, sizeof(char), 1, FILESTREAM);
       
    fclose(FILESTREAM);
    }
    int main()
    {
        FILE *FileStream;
        readFILE(FileStream);
    }

    File IO and Passing Pointer by Reference (C)
    void readFile(FILE** FileStream)
    {
        (*FileStream) = fopen("filename.txt","r");
        char data = 0;
        fread(&data, sizeof(char), 1, (*FILESTREAM));
       
    fclose((*FILESTREAM));

    }
    int main()
    {
        FILE *FileStream;
        readFILE(&FileStream);
    }

     


  4. There’s no denying that many people have found comfort in Byrne’s ideas. Like religion, they offer an appealing, non-technical solution to life’s biggest problems while demanding nothing more of their adherents than faith
     

  5. This assignment aims to establish understanding of Web client-side programming techniques using JavaScript and Web server-side programming techniques using PHP.

    Aside from native JavaScript and PHP, following libraries are used to enhance the functionality and readability of the application:

    JQuery – JavaScript Library

    Bootstrap – CSS UI Framework

    Please try out the system at http://orderfruit.ap01.aws.af.cm/

    All orders are recorded at http://orderfruit.ap01.aws.af.cm/order.txt