Difference between revisions of "FAQ - Mod 4"

From CSE330 Wiki
Jump to navigationJump to search
(Created page with "Welcome to the frequently asked questions page for Module 4. As many common questions can come up on Piazza, some of those questions are consolidated here. == Regular Express...")
 
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
Welcome to the frequently asked questions page for Module 4. As many common questions can come up on Piazza, some of those questions are consolidated here.
 
Welcome to the frequently asked questions page for Module 4. As many common questions can come up on Piazza, some of those questions are consolidated here.
  
−
== Regular Expressions Cases ==
+
== File Structure/Languages ==
  
−
=== When parsing for a string, should I look for that string exclusively or that string concatenated with other characters? ===
+
=== Can I redirect users to another page after login/for any other reason? ===
−
If you are looking for a string, you should be looking for any exact occurrences of that string. This is the case regardless of what characters are appended to the beginning or the end of said string.
+
For this module, you can '''not''' redirect a user to another page for login or refresh the page on logout. You should have '''one''' single html file , and any on-screen changes should be done through DOM manipulation in Javascript.
  
−
'''Example:''' Parsing for "hello world"
+
=== Can/should I use PHP in this module? ===
 +
PHP should be used to access the MySQL database for this module, but you should use Javascript for most other functionality. The focus of this module is for you to learn more about Javascript and the DOM, so do not use PHP to redirect to other pages or refresh the current one.
  
−
'''What Should Work'''
+
== CSRF Tokens ==
  
−
hello world, hi hello world, hello worldwide, hhhello worlddd
+
=== How do I pass CSRF tokens between PHP and Javascript? ===
 +
At the end of your PHP script execution, you can send values back to where you initially called the script from. Think about how you can use this to then store the token in Javascript.
  
−
'''What Shouldn't Work'''
 
  
−
hello weorld, hello to the world
+
== HTML Validator ==
  
−
=== In RegEx exercise 2, should I accept strings that have more than three consecutive vowels? ===
+
=== I'm getting a validation warning about missing an src attribute for my weather widget, what should I do about this? ===
−
In this exercise, strings with three ''or more'' vowels should be accepted.
+
Before you fetch the data in the weather widget, you may not have a src attribute for your img tags. Your warning will likely look like this:
  
−
'''What Should Work'''
+
<source lang=bash>
 +
Element img is missing required attribute src
 +
</source>
  
−
beautiful, queue, coooool!
+
An easy way to avoid this warning is to simply put a temporary image on the screen before you load in the weather data.
  
−
=== In RegEx exercise 3, is each line a separate input? ===
+
[[Category: Module 4]]
−
Yes. Each line with a potential flight code is a separate input. Your expression does not need to account for separating each potential code.
 
−
 
 
−
=== If a batting average ends in a 0, can I round to two decimal places? ===
 
−
A batting average must always be rounded to 3 decimal places, regardless of if it ends in one (or more) zero(s).
 
−
 
 
−
'''Expected Batting Average Outputs'''
 
−
 
 
−
.270, .300, .050
 
−
 
 
−
'''Unacceptable Batting Average Outputs'''
 
−
 
 
−
.27, .3, .05
 
−
 
 
−
== Logistics ==
 
−
 
 
−
=== Should I complete this module on my local machine or on my instance? ===
 
−
Unlike other modules, this one can be completed on your local machine!
 
−
 
 
−
=== Do I have to save the output of our python script to a .txt file or can I just print it out? ===
 
−
You can just print the output of your script. No need to save it to a .txt file
 

Latest revision as of 17:09, 10 January 2026

Welcome to the frequently asked questions page for Module 4. As many common questions can come up on Piazza, some of those questions are consolidated here.

File Structure/Languages

Can I redirect users to another page after login/for any other reason?

For this module, you can not redirect a user to another page for login or refresh the page on logout. You should have one single html file , and any on-screen changes should be done through DOM manipulation in Javascript.

Can/should I use PHP in this module?

PHP should be used to access the MySQL database for this module, but you should use Javascript for most other functionality. The focus of this module is for you to learn more about Javascript and the DOM, so do not use PHP to redirect to other pages or refresh the current one.

CSRF Tokens

How do I pass CSRF tokens between PHP and Javascript?

At the end of your PHP script execution, you can send values back to where you initially called the script from. Think about how you can use this to then store the token in Javascript.


HTML Validator

I'm getting a validation warning about missing an src attribute for my weather widget, what should I do about this?

Before you fetch the data in the weather widget, you may not have a src attribute for your img tags. Your warning will likely look like this:

Element img is missing required attribute src

An easy way to avoid this warning is to simply put a temporary image on the screen before you load in the weather data.