Giter VIP home page Giter VIP logo

e2-fall21's People

Contributors

susanbuck avatar

Stargazers

 avatar

Watchers

 avatar  avatar

e2-fall21's Issues

How do you do your screencasts?

I am a math teacher, and I have to make screencasts for lots of topics. I noticed that you paused the video, and had some text and an image pointing toward the screen. I am just wondering about your setup. I have used quicktime player, loom, and zoom. All of them seem to have their limitations and advantages. I am just curious about what software you use. Can you share?

I don't usually edit the videos because I often have very quick turnaround times, and I need to just be okay with mistakes.

Screen Shot 2021-10-09 at 6 33 54 AM

Project 1 share thread

Hi everyone,

In this thread, I'd like you all to check out each other Project 1s as an opportunity to explore outside code.

To kick things off, below are two excellent projects to dig into, both tackling the "War" card game.

Version 1:

Version 2

Check out the app and then look through the code and make notes on any of the following:

  • Are there any parts of the code that you found interesting or taught you something new?
  • Do you have any notes for improvement?
  • Are there any parts of the code that you don't understand?
  • Are there any built in PHP methods that were used that you hadn't yet encountered? Explain what the method is and what it does.
  • Anything else that sticks out to you...

Reply to this thread with your notes, and also include a link to your project on your server and in Github.

When coming to this thread, pick a project that has not already been responded to, pulling from the replies that come in.

Used up too much memory?

I wrote the code for my game of war using a short deck. I finished the implementation successfully. Before I turned it in, I add the missing cards to the deck. My game stopped working and I got the following error.
"Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 33554440 bytes) in /var/www/e2/p1/index.php on line 357"

I know that I could be more efficient, and allocate less memory. This is one of the issues that I anticipated in my previous post P1-War: Should I store the results of each round in an array? Or, immediately display the results?

I am interested in finding out if the error is about the way in which I created the deck of cards, or if it was with the way in which I stored the data for each round of the game. Do you have any insight that could help.

I pushed the most recent version of my code onto github. I assume that you could access it. Link to my project

Output with line break using var_dump

I notice that your output looks like this:
Screen Shot 2021-09-26 at 7 50 44 AM
My output looks like this:
Screen Shot 2021-09-26 at 7 51 07 AM

The line breaks make it more readable. (My apologies if I missed this concept in a previous post.) Is there a way to include the line breaks in the var_dump output?

Issues with VSCode remote connection to Digital Ocean server? Read this...

Hi everyone,

There have been a few reports of students having issues when working on their servers via VSCode remote dev (ref: #36, #33, #20). I want to figure out why this is and so I'm starting this thread to try and streamline all the information we have on the matter.

Summary of the symptoms students have reported

  • Slow connectivity
  • Keeps showing dialog "Reconnecting to SSH: [host name]"
  • Stuck on "Setting up SSH Host [host name]: Initializing VS Code..."

Misc notes

  • All issues have either resolved themselves with time, or by restarting VSCode
  • Each time there's been an issue reported, I've checked DigitalOcean's status page (https://status.digitalocean.com/) and have not seen any outtages reported. Because of this I don't think it's an issue with the server itself, but just the connection/remote development setup between the server and VSCode.

Things to do/try If you face a connectivity issue

  1. Open the command palette and run Remote-SSH: Show log. This will open a log in the Output tab of the Terminal window. Share the log info in a reply to this thread.
  2. Also within the command palette, run Remote-SSH: kill VS Code Server on Host... and see if that resolves the problem. Report back in your reply to this thread as to whether it does/does not.
  3. Also in your reply, let us know the following:
    • What operating system are you using?
    • What are your download and upload speeds according to Speedtest?

Conditionals; Rock, Paper, Scissors

I was wondering as I'm re-watching conditionals: would it be possible to create variables or functions of rock and paper and scissors and compare them against each other? like $rock > $scissors, $scissors > $paper; etc.

typing.io: Typing Practice for Programmers

Hi everyone -

A past student shared this neat web app with me, and I wanted to pass it on: https://typing.io

It allows you to practice typing all the awkward characters that are a part of code. I like to share this in my intro course because it's something I see new programmers struggle with - code is so particular and involves so many characters we don't use in regular "every day" language. This trips beginners up for two reasons:

  1. They make little mistakes with the characters and it prevents their code from working as expected
  2. The characters slow down how fast they can type, and then coding feels awkward, and as a result, frustrating

The above two points all smooth out with experience, but spending a little bit of time each day with typing.io can help expedite that process.

If you want to try it out, here's there PHP example you can work with: https://typing.io/lesson/php/symfony/PhpEngine.php/1

Coin Flip - sample code location

Hi Susan,

Could you please share the location for 'coin flip' code base, I am trying to include the images for my project2 and having some issues with them. If it is an issue, I may skip if it is too complex.

Thanks,

Murthy

Lecture 1 - Mac - bash $ vs zsh % prompt

Comment about command line

Hello all! I wanted to comment, most likely superfluously, that Mac Terminal uses zsh (Z shell) by default, rather than Bash. While there are differences, I've not come across any Bash command that won't run in zsh.

That being said, a potentially confusing visual difference is that Bash uses $ before each command and zsh uses %.

When macOS switched from Bash to zsh as the default, I was even more inexperienced with CL than I am now, and I was very confused. I'm guessing you all are probably not as inexperienced as I was, but hopefully this can help somebody. :)

PS @susanBuck, thank you for the primer. It cleared a lot of questions up for me about how CL works.

php 7.x vs php 8

It seems like we're using php 7.x on our servers. Would there be any harm in upgrading to 8? Would there be any benefit?

Project 2 roadblocks: working with Boolean values

I am having an issue working with Boolean values for Project 2. Here is a link to my game: http://e2p2.nicolaphp.me/

The game appears to function okay for when the user wins the round and when the player loses to the computer, but it does not operate correctly when there is a tie, incorrectly rendering the html for the tie and lost scenarios. I think this is because I am incorrectly utilizing Boolean values, and I appreciate guidance on how to mitigate this issue.

process.php

Here is what I was trying to do in my code. I am setting $tie to true if the player's and computer's moves are the same, and setting $winner to true if the player's move beats the computer's move. This would result in the scenario that when $tie is false and $winner is false, the player and the computer do not tie, and the player does not win, so the computer wins. Here is the code in my 'process.php':

<?php

session_start();

$playerMove = $_POST['choice'];

$computerMove = ['rock', 'paper', 'scissors'][rand(0, 2)];

$tie = $playerMove == $computerMove;

if (! $tie) {
    $winner = determineWinner($playerMove, $computerMove);
}

$_SESSION['results'] = [
    'winner' => $winner,
    'tie' => $tie,
    'playerMove' => $playerMove,
    'computerMove' => $computerMove,
];

header('Location: index.php');

function determineWinner($playerMove, $computerMove)
{
    if ($playerMove == 'rock' and $computerMove == 'scissors' or $playerMove == 'scissors' and $computerMove == 'paper' or $playerMove == 'paper' and $computerMove == 'rock') {
        $playerWon = true;
    } else {
        $playerWon = false;
    }
    return $playerWon;
}

index.php

<?php

session_start();

if(isset($_SESSION['results'])){
    $results = $_SESSION['results'];
    $winner = $results['winner'];
    $tie = $results['tie'];
    $playerMove = $results['playerMove'];
    $computerMove = $results['computerMove'];

    $_SESSION['results'] = null;
}

require 'index-view.php';

index-view.php

In the view, I am using php so that: if $tie is true, it renders the tie result; if $winner is true, it renders the result of the player's win; if both $tie and $winner are false, it renders the result of the computer's win.

I tried writing the html a few different ways, including utilizing 'else' at first, but I thought I needed to be more specific with the parameters of the Boolean values to mitigate the errors.

<?php if(isset($results)) { ?>

        <h2>Results</h2>

        <ul>

            <li>You threw <strong><?php echo $playerMove ?></strong>.</li>
            <li>The other person threw <strong><?php echo $computerMove ?></strong>.</li>  

            <?php if($tie) { ?>

            <li>Your move is the same the other player's move. You tied!</li>

            <?php } if($winner) { ?>

            <li><strong><?php echo ucwords($playerMove) ?></strong> beats <strong><?php echo $computerMove ?></strong>. You won!</li>

            <?php } if((! $winner) and (! $tie)) { ?>

            <li><strong><?php echo ucwords($playerMove) ?></strong> is beaten by <strong><?php echo $computerMove ?></strong>. You lost, please try again!</li>

            <?php } ?>

        </ul>

<?php } ?>

Some thoughts

Account for the other possible scenario: I am wondering if I need to account for the other possible (but unlikely scenario, unless there is some client-side alteration to the form submission) in my code:
$tie is true and $winner is true

determineWinner(): In refactoring, I tried to remove 'tie' out of the determineWinner function, but this might be where the issue is coming into play.

setting $winner == $tie: I also tried setting the $winner variable to tie after the code: $tie = $playerMove == $computerMove;

Other issues with determineWinner():

ternary operator: I have tried to utilize the ternary operator to shorten the winner-checking logic ((boolean expression) ? optionIfTrue : optionIfFalse, but I am not sure how to handle the 'false' scenario. Do I need to utilize the ! operator?

($playerMove == 'rock' and $computerMove == 'scissors' or $playerMove == 'scissors' and $computerMove == 'paper' or $playerMove == 'paper' and $computerMove == 'rock') ? $playerWon : (! $playerWon);

Some pseudocode to make this more efficient:
I think I could turn the moves into an array where the key is playerMove and the value is computerMove, then searching for instances of the key value pair. I am not sure how much more efficient this would make my code.

Thank you for your support!

Q - Week4 For loop example

I think the examples for 'for' loop results in more than 10 due to <= condition (0 - 10, i.e. 11), is it good to have '<' condition as shown in the recording to limit only 10 ?

Confusing terminology in the VPS hosting article?

I am going through this reading about VPS Hosting

and per article " VPS hosting relies on a hypervisor to take resources from the physical server and provide each website with access to an emulated server (the VM). These physical servers are often held in a data centre and divided equally between several virtual compartments (known as server virtualization). Each compartment is rented out, and server software is setup on them separately so that each unit is capable of functioning as an independent unit. Each individual VPS is called a container, and the server each container is held within is known as a node.",

I think the author is using virtualization and containerization terminology interchangeably? I think it may cause some confusion to some readers who may not know the difference.

Collecting numeric value from each turn and sum those values to decide winner

How do I collect the values from each turn and sum those values for each turn by each player to decide which player finishes first?

In order to get a minimal viable product working I created for loops with rand(1, 25)for each turn and a conditional statement. This works well with a conditional statement for one round.

I added another conditional statement for summing totals but with array to string errors and no viable sums to determine a $winner.

Reviewing the Accumulating/displaying results for a multi-round game video helped but only with display.

Link to Page
Link to Repository

Screenshot Current Code

Page appearance with single round conditional working

Project 1 - Question about index-view.php

Hi Susan,

I'm just wondering if we do need to add "index-view.php" for our project 1? My game is a bit complicated and I need to display HTML text within loop and conditional statements. I am not sure how we can separate the html lines and php code into 2 files.

For example,
" if($playerA %2==0) {

Player A is correct. Player A wins.

} else ...."

How can we display

Player A is correct. Player A wins.

in "index-view.php"?...Should we keep it within "index.php" instead?

Thank you

P1-War: Should I store the results of each round in an array? Or, immediately display the results?

Background
I have completed the logic of my war game, and I am working on displaying the results. I notice in the example that you give, your html table has a row for each round. Since each game has a variable number of rounds, the display table will have a variable number of rows. I was thinking about two solutions, and wondering if one would be better.

I have a while loop that plays a hand until one player has zero cards. The while loop is essentially equivalent to one round of the game. Within the while loop, I keep track of p1card, and p2card, determine the winner of the round, and then take the appropriate action with the cards. At the end of that while loop, I count cards for each player and iterate the round#. It is here that I need to display results. At that point, I could:

Solution 1:
add a new row to the html table. I could display cards played, the result of the round, and the number of cards remaining for each player. The values of my variables would change once the next round takes place.
Solution 2:
store each of the variables in an array. The array would have a scope outside of the while loop. The array could store all appropriate variables. Essentially, the array would be like a database of round results. After the game is completed, I would use elements from this array to display the results of each round in an html table. This would require a loop from within the index-view.php file.

My thoughts:
Solution 1 would not take up storage space. If I display the results of each round, I don't really need to access them again. No need to store them. No need to create the array. The difficulty comes from the separation of concerns. I think I could easily include the code which adds a new round to the table.

<tr>
            <td><?php echo $roundsPlayed; ?></td>
            <td><?php echo $p1Card['name']; ?> of <?php echo $p1Card['suit']; ?></td>
            <td><?php echo $p2Card['name']; ?> of <?php echo $p2Card['suit']; ?></td>
            <td><?php echo $roundWinner; ?></td>
            <td><?php echo $cardsRemainingP1; ?></td>
            <td><?php echo $cardsRemainingP2; ?></td>
 </tr>

The problem with this solution is how would I end my table. I would need to add this row for each round played.
Is there a way to send this row to the view, and then continue with my while loop in the control?

Solution 2 would let me run a for loop in the html part of my code. I would just do the above code for each element in the array. It seems a bit more simple, but it comes at the cost of storing all of those pieces.

Alternate solution for Week 4 dealer example - using a for loop

As a solution to the dealer example from Week 4, I implemented a for loop instead of a foreach loop. My logic was that since I knew how many cards there were, I could loop through them, pop one out each time, and add to the player and computer arrays.

My code

<?php

$cards = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
shuffle($cards);

$playerCards = [];
$computerCards = [];

for($i = 0; $i < 9; $i++) {
    $playerCards[] = array_pop($cards);
    $computerCards[] = array_pop($cards);
    $i++;
}

var_dump($playerCards);
var_dump($computerCards);

Example of output

`array(5) { 
[0]=> int(10) 
[1]=> int(6) 
[2]=> int(4) 
[3]=> int(5) 
[4]=> int(1) 
} 
array(5) { 
[0]=> int(7) 
[1]=> int(2) 
[2]=> int(9) 
[3]=> int(8) 
[4]=> int(3) 
}`

What are your thoughts on this solution?

While I think my code works, let me know if you see any bugs or potential issues! I'd love to hear your thoughts.

FYI: Week 1 Assignment grades released; questionnaire data

Hi everyone,

Just a quick announcement that I've released the Week 1 Assignment grades. You should be able to view the assignment in Canvas and see your score, the correct answers, and any comments I left for you.

As noted in a previous lecture, assignment grades are always released the day after their final submission cut-off, so this means that moving forward you'll be seeing grades/feedback every Wednesday by midnight.

I won't typically make an announcement like this when grades are released, but you should get a notification from Canvas.

If you have any questions/concerns about your grades, don't hesitate to drop me an email at [email protected].

Questionnaire data

For those that are curious, here's some of the data collected from the start of semester questionnaire.

image
image
image

image
1 - It's new to me
2 - I'm familiar with it, but don't have a lot of experience with it
3 - I'm comfortable with it

image
1 - It's new to me
2 - I'm familiar with it, but don't have a lot of experience with it
3 - I'm comfortable with it

image
1 - It's new to me, so I learned about it in preparation of this course
2 - I'm familiar with it, but don't have a lot of experience with it
3 - I'm comfortable with it

Issue creating new subdirectory within E2 repository

I keep getting an error when trying to create a new subdirectory within E2. It happened when I tried to create a new p1-refactored subdirectory by copying the directory using the cp command, and also when I just tried to create a new folder for p2. Here is what I see, even though I copied my p1 files so was expecting the same output in the browser (http://e2p2.hesclyons.me/)
Screen Shot 2021-10-18 at 1 19 54 PM

Has anybody had this issue? The only way I could get it to work was to create a new folder within my existing subdirectories (e.g. p1 or practice).

Thank you!
Courtney

Root access, increasing server security

Hi everyone,

In this week's videos we set up servers and log into them as a default root user. In one of the videos I explain how this is fine for this course/learning purposes, but in a ”real world” context, for security reasons it'd be wise to create a separate user you primarily operate as.

To elaborate on that, I've published a supplemental set of notes: Appendix > Increasing server security.

These notes are optional and it's not required you implement the steps outlined. In fact, if you're new to working with servers, it might be best to explore these steps after the course is over, just to keep things simpler.

If you do decide to implement what is in these notes and run into any problems, don't hesitate to ask any questions here in the forum.

Week7 - Assignment access issue

Hello Susan,

I don't know if it is for me or everyone is facing the issue - I am not able to access the Week7 Assignment, I am able to access the preview, but not the actual assignment. I am getting the 'Access Denied' issue -

Thanks

Murthy

Hello There!

I would like to introduce my self as a new student in the E2-Fall21.

My name is Murthy Garimella, I live in Colorado. If you would like to know more about Colorado, please check out the tourism site for Colorado...

As a part of this course, I would like to share a small snippet of html code -

<h1>
Hello World!
</h1>

My favorite technologies include:

  • php
  • python
  • linux

Cross platform development with Windows & Mac

Hi Susan,

Is it ok if I do my class work across multiple OSes since sometimes I may use my Mac or WIndows depending on my nature of regular work.

In this case, I am assuming since I have all the pre-requisites on my laptops and working on remote development server, it should not matter, just want to make sure.

Thanks,

Digital Ocean Servers down

As I was trying to submit and commit changes to Github

The Digital Ocean servers went down at the last minute and the sites were loading with lag.
I have attached screenshot with my VS attempting to reconnect.

image

VSCode snippets

In the Week 6 videos published yesterday, I made reference to a feature in VSCode called snippets where you can define shortcuts for frequently used code blocks. Specifically, I used snippets to fill out the basic HTML structure of a view file.

If you've never worked with snippets before, here's some general info: https://code.visualstudio.com/docs/editor/userdefinedsnippets

And below is what my html.json snippets file looks like (setting this file up is covered in the above guide under "Create your own snippets").

{
	// Place your snippets for html here. Each snippet is defined under a snippet name and has a prefix, body and 
	// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
	// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the 
	// same ids are connected.
	// Example:
	// "Print to console": {
	// 	"prefix": "log",
	// 	"body": [
	// 		"console.log('$1');",
	// 		"$2"
	// 	],
	// 	"description": "Log output to console"
	// }
	"HTML Template": {
		"prefix": "html",
		"body": [
			"<!doctype html>",
			"<html lang='en'>",
			"<head>",
			"    <title></title>",
			"    <meta charset='utf-8'>",
			"    <link href=data: , rel=icon>",
			"</head>",
			"<body>",
			"$0",
			"</body>",
			"</html>"
		],
		"description": "HTML Template"
	}
}

If you dig into snippets and have any questions, let me know.

Project 2 - Multiple forms best practice and restart button

Hi Susan,

I have two questions:

1- Should we have a "process.php" file for each form of the page? Is there any possible way to include them all in one single php file? I've read a discussion on Stackoverflow but I don't know how we can handle $_SESSION[ ] parts. I find it easier to manage forms with multiple php files but what if an actual project has many forms, how can they control them well?

2 - I'm planning to add a button for the player to restart the game. I actually do not need to store any input as there is only one submit button and I made it work by simply adding 1 line header('Location: index.php) in the process_playAgain.php handling the Restart button. I think it makes sense but I do not know if there is any better approach to do that. Do you have any suggestions?

Many thanks

forms-c : Small bug fix

Hi everyone,

I just discovered a bug in the code I showed in lecture for "form design flow C" (Week 6, Part 6).

Here's the relevant code from index.php

if (!is_null($_SESSION['results'])) {
    $results = $_SESSION['results'];

    $haveAnswer = $results['haveAnswer'];
    $correct = $results['correct'];

    $_SESSION['results'] = null;
}

This code assumes that $_SESSION['results'] always exists. But it will only exist if we've played the game (it will either have result data, or be null if we refresh the page after playing).

But if we visit the site for the first time (or if we clear our browser cookie) we'll have no session data so$_SESSION['results'] will not exist and this will cause an error when the code tries to access it:

Notice: Undefined index: results in /var/www/e2/practice/forms-c/index.php on line 5

To witness this bug you can clear your browser cookies (which is how session data is looked up). This simulates a "fresh" user coming to the site.

To address this bug, we can switch from using the is_null function to the isset function, because isset will check that that a variable has been declared and it's not null.

Here's the corrected code:

if (isset($_SESSION['results'])) {
    $results = $_SESSION['results'];

    $haveAnswer = $results['haveAnswer'];
    $correct = $results['correct'];

    $_SESSION['results'] = null;
}

Let me know if you have any questions about this.

Composer / e2framework - missing extensions

Hi all,

There are a few extensions you'll need to install on your servers when working with Composer and the e2framework. Without them, you'll run into some errors when invoking Composer, including some of the following:

  • Failed to download susanbuck/e2framework
  • zip extension and unzip/7z commands are both missing
  • Your requirements could not be resolved to an installable set of packages
  • require ext-mbstring missing

Getting the needed extensions installed is easy - just takes 3 commands - instructions here: https://hesweb.dev/e2/notes/php/composer#composer-pre-install-extensions

Apologies for not mentioning these steps earlier! It was part of the instructions in previous semesters, but I took them out this semester when I mistakenly thought LEMP droplets were now coming with these extensions installed by default. (I realize now I only had them on my demo server because of some other, unrelated steps I had taken).

Related posts: #56 #52

Rubrik for Project1

Hello Susan,

Will there be any Rubric for grading on Project1 . I think you have mentioned something in those lines in week4 recordings. But I would like to double check and make sure to cover those in the Project1.

Thanks a lot,

Introduce yourself...

Hi everyone -

I thought I'd kick off a post where everyone can reply with an introduction to themselves so we can get to know each other.

Tell us what brought you to this course and any other details you care to share.

A little bit about myself - I'm a web programmer and educator, living in Arlington, MA.

In addition to this course, I also teach DGMD E-28 and CSCI E-15. I've also worked with students completing their capstones in the DGMD program.

In the past, I've taught at Wellesley, UPenn, and UMiami. When working in industry I was the head developer for an online e-commerce store.

More about my background here: susanbuck.net

All in all, I love creating things with code and teaching others how to do the same.

Looking forward to getting to know you all!

index / index-view

I have a strange thing happening with my php files. When I run bank.php and bank-view.php, everything works fine. bank.php seems to reference bank-view.php in what Susan describes in the lecture and the notes as the controller / view files.

But then when I try to set up index.php and index-view.php (still with the require statement), when I go to the url that I'm pretty sure is right (I've tried a few to see if anything changes), it downloads the file instead. index.php does seem to be referencing index-view.php, because when it downloads the file, it only contains the contents of index-view, despite being named as index.php.

Any clues?

Frequent but irregular HTTP ERROR 404 when working along with lecture...

I often have trouble seeing my pages when I am following along with the lectures. Sometimes the pages do not display, and then they do. I have tried clearing the cache, and opening up the link in an incognito window. Sometimes that seems to help, but sometimes it does not.
I am wondering if there is something that I am missing. Does anyone have a solution?

I expect to see this:
Screen Shot 2021-09-24 at 4 16 07 PM
But I often see this:
Screen Shot 2021-09-24 at 4 29 25 PM
I am attaching a link to a video in which I demonstrate the problem.
2 Minute Video Explanation of issue and attempts to solve it

Separation of concerns: Accumulating/displaying results for a multi-round game

I had a student inquire via email the best way to display results for a multi-round game. Because this is a question others might have as well, I wanted to share the answer here in the forum.

In summary:
For a game with multiple rounds, you want to accumulate the results in an array in the controller. Then, in the view, you use a loop to iterate through and display those results.

As an example of this, check out this video where I expand on the Coin Flip example to work with multiple rounds...

Project2 - Template clarification about 'Instructions'

Hello Susan,

I would like to know if the instructions section is required or not - since the project2 template does not have this section,
whereas on the Project-2 specification says "The page should have an Instructions section that explains the rules of the game to the player."

Thanks,

Digital Ocean remote server connection issue

Hi all - When attempting to set up SSH Host today I am experiencing slowness and ultimately a failed attempt to connect. Anyone else having similar connectivity issues?

The setup + reconnection has been spinning for about 20 minutes before throwing up a fail message.

image

Q - Is there any know issue with DigitalOcean server, facing very slow connection

Hello Friends,

I am not sure if it is on my end or something impacting some of you as well?

I am facing a slow connectivity to DigitalOcean server today and it is very slow from VS Code to make a remote dev server connection and looks like it is keep 'reconnecting to SSH: hes-on-DigitalOcean'.

Thanks for any pointers,

Murthy

Command line syntax and configuring SSH - questions

I am seeking support with configuring SSH. The syntax for running command line arguments in my terminal (I am using MAC) is different than what's shown in lectures, which might be adding to my confusion. In this post, I:

  1. Show examples of the different syntax in my terminal and resulting output
  2. Outline questions about the syntax
  3. Share challenges with SSH configuration

Examples of different syntax

Below are four examples of command line arguments to change directories: from desktop to a folder on the desktop called programming where I store class materials. The arguments have two placeholders to conceal personal information: computer and user. I have included the result or error as an indented line beneath the code.

  1. computer:desktop user$ cd ~./programming

Outputs error: file does not exist

  1. computer:desktop user$ cd ~./desktop/programming

Outputs error: file does not exist

  1. computer:desktop user$ cd programming

Works: changes to the programming directory

  1. computer:desktop user$ cd ./programming

Works: changes to the programming directory

Questions about the syntax

After doing research about my examples, here are questions I have regarding functionality.

  1. Missing syntax in examples 3-4: I am confused by why examples 3 and 4 work, since they are missing the ~ syntax that has been shown in lectures. Similarly, I am not sure why examples 3 and 4 have the same result, since one contains the ./ syntax.
  2. Examples 1-4: changing the way the terminal displays information? My current directory name is located in between computer and user. Can I alter the settings of my terminal to hide certain information, for example computer?

Implication for SSH configuration

I hope that support with the above questions will help with SSH configuration. Below, I have copied the command line arguments I have executed (and resulting errors) to try to configure my SSH, similar to what was presented in lecture.

Location of the SSH directory: desktop > programming > PHP > ssh

computer:desktop user$ cd programming
computer:programming user$ cd php
computer:php user$ cd ssh
computer:ssh user$ ~/.ssh/config
-bash: /Users/user/.ssh/config: No such file or directory
computer:ssh user$ ~/.desktop/programming/php/ssh/config
-bash: /Users/user/.desktop/programming/php/ssh/config: No such file or directory

Since I am new to working in the command line, I am hesitant about taking the next step to configure. All support and guidance is greatly appreciated!

Week 9 - Unknown errors (Everything works, but curious to know the error reasons)

Hi Susan,

I have followed your lecture video and have installed the 'Composer', but ran into a couple of errors (everything works, but not sure about these errors) and I don't know if you or someone have seen these -

(1) While downloading the repo from Susan Buck repo

image

(2) Composer Issue while updating the version from 0.1.5 to 0.1.6 in the composer.json file -

image

Thanks,

Murthy

Trouble accessing properties and methods from Game

Hi, I'm really struggling through this week's materials. I have a lot of questions, but one specific one is how to access the results from the Game class.

In class we saw how var_dump($game->play('scissors')) outputs an array of results; but I don't understand how to access those specific results. For example, I want to create a variable to display the $outcome, but I am getting an undefined error when I use

var_dump($game->$outcome);

I also tried to access the getResults() method, but I keep getting NULL.

var_dump($game->getResults());

Any guidance would be appreciated. Thank you!

Project 2 - Notice: Undefined Index

Hi Susan,

There is one issue that I have not found a solution yet. I tried to use the isset() functions to fix the "Notice: Undefined Index", but it keeps showing when the page is loaded for the first time.

I followed some online tutorials but their methods do not work for me.
(https://www.stechies.com/undefined-index-error-php/).

Can you please give me a hint for this?

Thank you very much!

Parse error in vowelCount exercise

I am getting a parse error related to the foreach loop in my vowelCount function, (foreach($letters as index => $letter){, that I am having trouble mitigating. I am trying to circle through each letter in letters.

vowelCount

function vowelCount(string $word)
{
    $letters = str_split($word);
    $countVowels = 0;

    foreach($letters as index => $letter) {
        if($letter == ['a', 'e', 'i', 'o', 'u']){
            $countVowels ++;
        }
    }

    return $countVowels;
}

Parse error

Parse error: syntax error, unexpected '=>' (T_DOUBLE_ARROW), expecting '[' in /var/www/e2/practice/week7-exercises/vowel-count.php on line 11

Understanding working with arrays

The error might be a result of my confusion working with arrays. I do not full understand how to utilize a foreach loop on an array when the array only appears to have values. For my understanding, is the 'place' of where the value is located the key? For example in array['cat', 'dog', 'bird'], the key for the value 'cat' would be '0' since it is in the 0 position.

Late request for support

I am a bit behind working on this exercise, so I understand that there isn't a lot of time for feedback/support before Week 7's assignment is due. Looking forward to feedback and seeing a solution in the upcoming lecture!

Issue connecting to rps subdomain

I configured the rps subdomain following the steps outlined in class, and it was working a few days ago when I set it up, but now I get the following message when I try to access it in the browser (https://e2rps.hesclyons.me/):

This site can’t be reachede2rps.hesclyons.me refused to connect.
Try:

Checking the connection
Checking the proxy and the firewall
ERR_CONNECTION_REFUSED

My other subdomains are working. I tried going through the subdomain configuration steps again, and I also checked my proxy settings as it advises to see if any are checked. Do you have any other suggestions on how to resolve this?

Thank you for your help!
Courtney

Mitigating 404 Not Found error for bank.php

I am getting a 404 Not Found error when I try to load my bank.php file on my server, and I am having trouble finding a solution.

Mitigating the problem

Here are the steps I have taken to try to solve the problem and some things I have noticed.

1. URL: I think I've written the subdomain, domain, and file name correctly: http://e2practice.nicolaphp.me/bank.php
2. Folder structure: The folder structure seems to be okay: e2/practice
3. Syntax: Copied/pasted from the notes - I haven't gotten to the stage of editing it yet, so there shouldn't be an error there.
4. Saving my file: I've saved my file, however, I have not synchronized my changes with GitHub.
5. Another file isn't updating: I noticed that my index.php file is showing a previous version of the file (page that reads, "Hello from my DigitalOcean server!") instead of what is currently in the file, which is a heading that reads "Practice App" and the HES logo.

Screenshot of my VS Code and browser

VS Code on the left shows the folder structure, bank.php file, and that I am connected to the Digital Oceans server. The browser on the right shows the URL and the 404 Not Found error.

Screen Shot 2021-09-20 at 8 16 03 PM

Appreciative of the support with this!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.