Author: Felix Tang

  • Dynamic content loading on web pages with Ajax & Express (4)

    It is the fourth example using JQuery AJAX function and Express JS. This example sets up a multi-page site where clicking on the buttons triggers AJAX requests to retrieve and display different content within the <main> element of the page. The content is dynamically loaded without requiring a full page refresh, providing a smoother user experience. To… Read more

  • Dynamic content loading on web pages with Ajax & Express (3)

    It is the third example using JQuery AJAX function and Express JS. Create a static HTML page called “log.html” and place it in the “public” folder of the project. Inside log.html, there are JavaScript code that executes when the “log.html” page is loaded. This code should use AJAX to send a request to the server’s… Read more

  • Dynamic content loading on web pages with Ajax & Express (2)

    It is the second example using JQuery AJAX function and Express JS. The Express server will cycle through the colors ‘red’, ‘yellow’, ‘green’, and ‘blue’ when the route /colorword is accessed by AJAX. The colorword.html file displays a heading (<h1>) that initially has the color red. On page load, an AJAX request is sent to /colorword to retrieve the color, and… Read more

  • Dynamic content loading on web pages with Ajax & Express (1)

    Dynamic content loading involves updating or loading content on a web page without the need for a complete page refresh. JavaScript plays a crucial role in enabling dynamic content loading by facilitating the retrieval and manipulation of data asynchronously. This approach offers several benefits: AJAX (Asynchronous JavaScript And XML) is a well-established method for achieving… Read more

  • Static HTML with express route

    Example 1 To create an Express route in a file named index.js that handles a HTTP GET request for the path /lastvisit and responds with a plain text containing the timestamp of the previous visit. If a previous visit timestamp exists, it will be sent as plain text in the response. Otherwise, it will respond with “First visit”. Content… Read more

  • Install Node.js and Express on Orange Pi Ubuntu

    Node.js is a runtime environment for executing JavaScript code on servers and across different platforms. It is open-source and widely used for developing applications on both the front-end and back-end. Its official package manager, npm, serves as a repository for software packages. Node.js enjoys popularity among developers due to its extensive community of contributors and… Read more

  • Decryption of Caesar Cipher using highest letter frequency Approach

    Research shows that the letter “E” is the alphabet’s most commonly used vowel. “E” is shown to have a frequency of 11.51% in all words analyzed. To decrypt a Caesar cipher using the highest letter frequency approach, you can follow these steps: Detail explanation: cipher.txt Result: ./freq_compare cipher.txtdictionary loadedcipher.txt loadedLetter with the highest count: lCount:… Read more

  • Decryption of Caesar Cipher using Dictionary-Based Approach

    By evaluating all 25 decrypted messages, we can identify the correct one by examining its resemblance to English text rather than mere random gibberish. Unix/Linux systems come with a dictionary file. I am using Ubuntu and the dictionary locates at /usr/share/dict/cracklib-small, which contains an extensive collection (54763 words) of English words. To facilitate the process, a… Read more

  • Caesar cipher by Bash scripts

    The Caesar Cipher, used by Julius Caesar around 58 BC, is a substitution cipher that shifts letters in a message to make it unreadable if intercepted. To decrypt, the receiver reverses the shift. To encrypt or decrypt text using the tr (translate) command in Bash, you can define a mapping of characters to new characters and apply it… Read more

  • Useful Bash Scripts

    Prompt the user to press the Enter key before proceeding with the script execution. Check if a variable is empty Transform any uppercase letters in the input word to their corresponding lowercase letters. # hello world Assign the current date to the variable date in the format “YYYYMMDD”. Find string length Extract substring Detailed explanation: # April Find and… Read more