Skip to content

Commit cbc20e5

Browse files
authored
Merge branch 'source' into ptbr-translation
2 parents 9d6e41a + 30210df commit cbc20e5

File tree

33 files changed

+489
-132
lines changed

33 files changed

+489
-132
lines changed

src/components/CompaniesBanner/CompaniesBanner.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const partners = [
1818
url: 'https://www.helsinki.fi/',
1919
},
2020
{
21-
image: { name: 'houston.svg', alt: 'Houston inc.' },
21+
image: { name: 'houston2.svg', alt: 'Houston inc.' },
2222
url: 'https://www.houston-inc.com/careers',
2323
},
2424
{

src/components/IndexPage/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { SubHeader } from '../SubHeader/SubHeader';
1414
import { TripleBorder } from '../TripleBorder/TripleBorder';
1515
import cc from '../../images/cc.svg';
1616
import content from '../../content/pages/main.json';
17-
import houstonLogo from '../../images/Houston_big.svg';
17+
import houstonLogo from '../../images/Houston_big2.svg';
1818
import landingImage from '../../images/landing.svg';
1919
import licenceIcon from '../../images/cc-logo.png';
2020
import mainSEOdescription from '../../content/seo/mainSEOdescription';

src/components/layout.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ const Layout = props => {
2121
const [visible, setVisible] = useState(false);
2222

2323
useEffect(() => {
24-
const key = localStorage.getItem(BANNER_TO_KEY);
25-
console.log(key);
24+
const key = localStorage.getItem(BANNER_TO_KEY)
2625
if (!key) {
2726
setVisible(true);
2827
}
@@ -39,7 +38,7 @@ const Layout = props => {
3938

4039
<Header lang={siteLanguage} />
4140

42-
<InfoBanner onHide={() => hideNote()} visible={visible} />
41+
<InfoBanner onHide={() => hideNote()} visible={false} />
4342

4443
<main id="main-content">{children}</main>
4544

src/content/1/es/part1b.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ setTimeout(arto.greet.bind(arto), 1000)
482482

483483
Al llamar a <em>arto.greet.bind(arto)</em> se crea una nueva función donde _this_ está obligado a apuntar a Arto, independientemente de dónde y cómo se llame al método.
484484

485-
Usando [funciones de flecha](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions) es posible resolver algunos de los problemas relacionados con _this_. Sin embargo, no deben usarse como métodos para objetos porque entonces _esto_ no funciona en absoluto. Más adelante volveremos al comportamiento de _este_ en relación con las funciones de flecha.
485+
Usando [funciones de flecha](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions) es posible resolver algunos de los problemas relacionados con _this_. Sin embargo, no deben usarse como métodos para objetos porque entonces _this_ no funciona en absoluto. Más adelante volveremos al comportamiento de _este_ en relación con las funciones de flecha.
486486

487487
Si desea obtener una mejor comprensión de cómo _this_ funciona en JavaScript, Internet está lleno de material sobre el tema, por ejemplo, la serie de screencasts [Comprender la palabra clave this de JavaScript en profundidad](https://egghead.io/courses/understand-javascript-s-this-keyword-in-depth) de [egghead.io](https://egghead.io) es muy recomendable.
488488

src/content/11/en/part11c.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,18 @@ Set up the action to your workflow and ensure that every commit that pass all th
372372
```bash
373373
https://dashboard.render.com/web/srv-crandomcharachtershere
374374
```
375+
Alternatively you could just use [Render Deploy Hook](https://render.com/docs/deploy-hooks) which is a private url to trigger the deployment. You can get it from your app settings ![fsorender1](https://user-images.githubusercontent.com/47830671/230722899-1ebb414e-ae1e-4a5e-a7b8-f376c4f1ca4d.png).
376+
DON'T USE the plain url in your pipeline. Instead create github secrets for your key and service id: ![fsorender2](https://user-images.githubusercontent.com/47830671/230723138-77d027be-3162-4697-987e-b654bc710187.png)
377+
Then you can use them like this:
378+
``` bash
379+
main:
380+
name: Deploy to Render
381+
runs-on: ubuntu-latest
382+
steps:
383+
- name: Trigger deployment
384+
run: curl https://api.render.com/deploy/srv-${{ secrets.RENDER_SERVICE_ID }}?key=${{ secrets.RENDER_API_KEY }}
385+
```
386+
375387

376388
The deployment takes some time. See the events tab of the Render dashboard to see when the new deployment is ready:
377389

src/content/12/en/part12a.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ The output contains a few new things for us to learn. <i>Docker daemon</i> is a
188188
### Exercise 12.2
189189

190190
Some of these exercises do not require you to write any code or configurations to a file.
191-
In these exercises you should use [script](https://man7.org/linux/man-pages/man1/script.1.html) command to record the commands you have used; try it yourself with _script_ to start recording, _echo "hello"_ to generate some output, and _exit_ to stop recording. It saves your actions into a file names "typescript" (that has nothing to do with the TypeScript programming language, the name is just a coincidence).
191+
In these exercises you should use [script](https://man7.org/linux/man-pages/man1/script.1.html) command to record the commands you have used; try it yourself with _script_ to start recording, _echo "hello"_ to generate some output, and _exit_ to stop recording. It saves your actions into a file named "typescript" (that has nothing to do with the TypeScript programming language, the name is just a coincidence).
192192

193193
If _script_ does not work, you can just copy-paste all commands you used into a text file.
194194

src/content/13/en/part13a.md

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,14 @@ The reason why the the previous sections of the course used MongoDB is precisely
6767

6868
### Application database
6969

70-
For our application we need a relational database. There are many options, but we will be using the currently most popular Open Source solution [PostgreSQL](https://www.postgresql.org/). You can install Postgres (as the database is often called) on your machine, if you wish to do so. An easier option would be using Postgres as a cloud service, e.g. [ElephantSQL](https://www.elephantsql.com/). You could also take advantage of the course [part 12](/en/part12) lessons and use Postgres locally using Docker.
70+
For our application we need a relational database. There are many options, but we will be using the currently most popular Open Source solution [PostgreSQL](https://www.postgresql.org/). You can install Postgres (as the database is often called) on your machine, if you wish to do so. An easier option would be using Postgres as a cloud service, e.g. [ElephantSQL](https://www.elephantsql.com/).
7171

7272
However, we will be taking advantage of the fact that it is possible to create a Postgres database for the application on the Fly.io and Heroku cloud service platforms, which are familiar from the parts 3 and 4.
7373

7474
In the theory material of this section, we will be building a Postgres-enabled version from the backend of the notes-storage application, which was built in sections 3 and 4.
7575

76+
Since we don't need any database in the cloud in this part (we only use the application locally), there is a possibility to use the lessons of the course [part 12](/en/part12) and use Postgres locally with Docker. After the Postgres instructions for cloud services, we also give a short instruction on how to easily get Postgres up and running with Docker.
77+
7678
#### Fly.io
7779

7880
Let us create a new Fly.io-app by running the command _fly launch_ in a directory where we shall add the code of the app. Let us also create the Postgres database for the app:
@@ -130,6 +132,33 @@ Type "help" for help.
130132
postgres=#
131133
```
132134

135+
#### Docker
136+
137+
This instruction assumes that you master the basic use of Docker to the extent taught by e.g. [part 12](/en/part12).
138+
139+
Start Postgres [Docker image](https://hub.docker.com/_/postgres) with the command
140+
141+
```bash
142+
docker run -e POSTGRES_PASSWORD=mysecretpassword -p 5432:5432 postgres
143+
```
144+
145+
A psql console connection to the database can be opened using the _docker exec_ command. First you need to find out the id of the container:
146+
147+
```bash
148+
$ docker ps
149+
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
150+
ff3f49eadf27 postgres "docker-entrypoint.s…" 31 minutes ago Up 31 minutes 0.0.0.0:5432->5432/tcp great_raman
151+
docker exec -it ff3f49eadf27 psql -U postgres postgres
152+
psql (15.2 (Debian 15.2-1.pgdg110+1))
153+
Type "help" for help.
154+
155+
postgres=#
156+
```
157+
158+
Defined in this way, the data stored in the database is persisted only as long as the container exists. The data can be preserved by defining a
159+
[volume](/en/part12/building_and_configuring_environments#persisting-data-with-volumes) fort the data, see more
160+
[here](https://github.com/docker-library/docs/blob/master/postgres/README.md#pgdata).
161+
133162
#### Using the psql console
134163

135164
Particularly when using a relational database, it is essential to access the database directly as well. There are many ways to do this, there are several different graphical user interfaces, such as [pgAdmin](https://www.pgadmin.org/). However, we will be using Postgres [psql](https://www.postgresql.org/docs/current/app-psql.html) command-line tool.
@@ -291,8 +320,7 @@ $ cat .env
291320
DATABASE_URL=postgres://<username>:<password>@ec2-54-83-137-206.compute-1.amazonaws.com:5432/<databasename>
292321
```
293322

294-
When using Fly.io, the local connection to the database should first be enabled by
295-
[tunneling](https://fly.io/docs/reference/postgres/#connecting-to-postgres-from-outside-fly)
323+
When using Fly.io, the local connection to the database should first be enabled by [tunneling](https://fly.io/docs/reference/postgres/#connecting-to-postgres-from-outside-fly)
296324
the localhost port 5432 to the Fly.io database port using the following command
297325

298326
```bash
@@ -318,6 +346,12 @@ Password was shown when the database was created, so hopefully you have not lost
318346

319347
The last part of the connect string, <i>postgres</i> refers to the database name. The name could be any string but we use here <i>postgres</i> since it is the default database that is automatically created within a Postgres database. If needed, new databases can be created with the command [CREATE DATABASE](https://www.postgresql.org/docs/14/sql-createdatabase.html).
320348

349+
If you use Docker, the connect string is:
350+
351+
```bash
352+
DATABASE_URL=postgres://postgres:mysecretpassword@localhost:5432/postgres
353+
```
354+
321355
Once the connect string has been set up in the file <i>.env</i> we can test for a connection:
322356

323357
```bash

src/content/13/en/part13c.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1514,6 +1514,6 @@ Once you have completed the exercises and want to get the credits, let us know t
15141514
15151515
![Submissions](../../images/11/21.png)
15161516
1517-
**Note** that you need a registration to the corresponding course part for getting the credits registered, see [here](/part0/general_info#parts-and-completion) for more information.
1517+
**Note** that you need a registration to the corresponding course part for getting the credits registered, see [here](/en/part0/general_info#parts-and-completion) for more information.
15181518
15191519
</div>

src/content/13/fi/osa13a.md

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,14 @@ Syy sille miksi kurssin aiemmat osat käyttivät MongoDB:tä liittyvät juuri se
6666

6767
### Sovelluksen tietokanta
6868

69-
Tarvitsemme sovellustamme varten relaatiotietokannan. Vaihtoehtoja on monia, käytämme kurssilla tämän hetken suosituinta Open Source -ratkaisua [PostgreSQL:ää](https://www.postgresql.org/). Voit halutessasi asentaa Postgresin (kuten tietokantaa usein kutsutaan) koneellesi. Helpommalla pääset käyttämällä jotain pilvipalveluna tarjottavaa Postgresia, esim. [ElephantSQL:ää](https://www.elephantsql.com/). Voit myös hyödyntää kurssin [osan 12](/en/part12) oppeja ja käyttää Postgresia paikallisesti Dockerin avulla.
69+
Tarvitsemme sovellustamme varten relaatiotietokannan. Vaihtoehtoja on monia, käytämme kurssilla tämän hetken suosituinta Open Source -ratkaisua [PostgreSQL:ää](https://www.postgresql.org/). Voit halutessasi asentaa Postgresin (kuten tietokantaa usein kutsutaan) koneellesi. Helpommalla pääset käyttämällä jotain pilvipalveluna tarjottavaa Postgresia, esim. [ElephantSQL:ää](https://www.elephantsql.com/).
7070

71-
Käytämme nyt kuitenkin hyväksemme sitä, että osista 3 ja 4 tuttuille pilvipalvelualustoille Fly.io ja Heroku on mahdollista luoda sovellukselle Postgres-tietokanta.
71+
Käytämme nyt hyväksemme sitä, että osista 3 ja 4 tuttuille pilvipalvelualustoille Fly.io ja Heroku on mahdollista luoda sovellukselle Postgres-tietokanta.
7272

7373
Tämän osan teoriamateriaalissa rakennetaan osissa 3 ja 4 rakennetun muistiinpanoja tallettavan sovelluksen backendendistä Postgresia käyttävä versio.
7474

75+
Koska emme tarvitse tässä osassa mihinkään pilvessä olevaa tietokantaa (käytämme sovellusta ainoastaan paikallisesti) on eräs mahdollisuus hyödyntää kurssin [osan 12](/en/part12) oppeja ja käyttää Postgresia paikallisesti Dockerin avulla. Pilvipalveluiden Postgresohjeiden jälkeen annamme myös lyhyen ohjeen miten Postgresin saa helposti pystyn Dockerin avulla.
76+
7577
#### Fly.io
7678

7779
Luodaan nyt sopivan hakemiston sisällä Fly.io-sovellus komennolla _fly launch_ ja luodaan sovellukselle Postgres-tietokanta:
@@ -124,6 +126,33 @@ Type "help" for help.
124126
postgres=#
125127
```
126128

129+
#### Docker
130+
131+
Tämä ohje olettaa, että hallitset Dockerin peruskäytön esim. [osan 12](/en/part12) opettamassa laajuudessa.
132+
133+
Käynnistä Postgresin [Docker image](https://hub.docker.com/_/postgres) komennolla
134+
135+
```bash
136+
docker run -e POSTGRES_PASSWORD=mysecretpassword -p 5432:5432 postgres
137+
```
138+
139+
Tietokantaan saadaan psql-konsoliyhteys komennon _docker exec_ avulla. Ensin tulee selvittää kontainerin id:
140+
141+
```bash
142+
$ docker ps
143+
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
144+
ff3f49eadf27 postgres "docker-entrypoint.s…" 31 minutes ago Up 31 minutes 0.0.0.0:5432->5432/tcp great_raman
145+
docker exec -it ff3f49eadf27 psql -U postgres postgres
146+
psql (15.2 (Debian 15.2-1.pgdg110+1))
147+
Type "help" for help.
148+
149+
postgres=#
150+
```
151+
152+
Näin määriteltynä tietokantaan talletettu data sailyy ainoastaan niin kauan kontti on olemassa. Data saadaan säilymään määrittelemällä datan talletukseen
153+
[volume](/en/part12/building_and_configuring_environments#persisting-data-with-volumes), katso lisää
154+
[täältä](https://github.com/docker-library/docs/blob/master/postgres/README.md#pgdata).
155+
127156
#### psql-konsolin käyttöä
128157

129158
Erityisesti relaatiotietokantaa käytettäessä on oleellista päästä tietokantaan käsiksi myös suoraan. Tapoja tähän on monia, on olemassa mm. useita erilaisia graafisia käyttöliittymiä, kuten [pgAdmin](https://www.pgadmin.org/). Käytetää nnyt kuitenkin Postgresin [psql](https://www.postgresql.org/docs/current/app-psql.html)-komentorivityökalua.
@@ -303,6 +332,12 @@ DATABASE_URL=postgres://postgres:<password>@localhost:5432/postgres
303332
304333
Salasana on se, jonka on otettu talteen tietokantaa luodessa.
305334
335+
Dockeria käytettäessä connect string on:
336+
337+
```bash
338+
DATABASE_URL=postgres://postgres:mysecretpassword@localhost:5432/postgres
339+
```
340+
306341
Connect stringin viimeinen osa <i>postgres</i> viittaa käytettävään tietokannan nimeen. Nyt se on valmiiksi luotava ja oletusarvoisesti käytössä oleva <i>postgres</i>-niminen tietokanta. Komennolla [CREATE DATABASE](https://www.postgresql.org/docs/14/sql-createdatabase.html) on tarvittaessa mahdollista luoda muita tietokantoja Postgres-tietokantainstanssiin.
307342
308343
Kun connect string on määritety tiedostoon <i>.env</i> voidaan kokeilla muodostuuko yhteys:

src/content/2/en/part2a.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ Even though the application seems to be working, there is a nasty warning in the
213213

214214
![unique key prop console error](../../images/2/1a.png)
215215

216-
As the linked [React page](https://reactjs.org/docs/lists-and-keys.html#keys) in the error message suggests; the list items, i.e. the elements generated by the _map_ method, must each have a unique key value: an attribute called <i>key</i>.
216+
As the linked [React page](https://react.dev/learn/rendering-lists#keeping-list-items-in-order-with-key) in the error message suggests; the list items, i.e. the elements generated by the _map_ method, must each have a unique key value: an attribute called <i>key</i>.
217217

218218
Let's add the keys:
219219

@@ -238,7 +238,7 @@ const App = (props) => {
238238

239239
And the error message disappears.
240240

241-
React uses the key attributes of objects in an array to determine how to update the view generated by a component when the component is re-rendered. More about this is in the [React documentation](https://reactjs.org/docs/reconciliation.html#recursing-on-children).
241+
React uses the key attributes of objects in an array to determine how to update the view generated by a component when the component is re-rendered. More about this is in the [React documentation](https://react.dev/learn/preserving-and-resetting-state#option-2-resetting-state-with-a-key).
242242

243243
### Map
244244

@@ -348,7 +348,7 @@ As such, one way to define the row generation without getting errors is:
348348
</ul>
349349
```
350350

351-
This is; however, **not recommended** and can create undesired problems even if it seems to be working just fine.
351+
This is, however, **not recommended** and can create undesired problems even if it seems to be working just fine.
352352

353353
Read more about this in [this article](https://robinpokorny.medium.com/index-as-a-key-is-an-anti-pattern-e0349aece318).
354354

0 commit comments

Comments
 (0)