├── pert3 ├── test.py ├── tes ├── tes.cpp ├── Readme.md ├── test.ipynb └── tipedata.ipynb ├── pert9 ├── postgres.ipynb ├── rangkuman.md └── mariadb.ipynb ├── pert11 ├── .gitignore ├── README.md ├── .env ├── order_service │ ├── .env │ ├── app │ │ ├── api │ │ │ ├── db.py │ │ │ ├── model_order.py │ │ │ ├── schema_order.py │ │ │ └── route_order.py │ │ └── main.py │ ├── Dockerfile │ └── requirements.txt ├── user_service │ ├── .env │ ├── app │ │ ├── api │ │ │ ├── db.py │ │ │ ├── model_user.py │ │ │ ├── schema_user.py │ │ │ └── route_user.py │ │ └── main.py │ ├── Dockerfile │ └── requirements.txt ├── product_service │ ├── .env │ ├── app │ │ ├── api │ │ │ ├── db.py │ │ │ ├── model_product.py │ │ │ ├── schema_product.py │ │ │ └── route_product.py │ │ └── main.py │ ├── Dockerfile │ └── requirements.txt └── docker-compose.yml ├── pert4 ├── for ├── sample ├── tugas ├── while ├── for.cpp ├── controlstatement.puml ├── while.cpp ├── sample.py ├── sample.cpp ├── tugaswithclass.cpp └── tugas.cpp ├── tugas ├── test ├── latihan1 ├── latihan2 ├── tugas_pert7 │ ├── program │ │ ├── tugas │ │ ├── build │ │ │ └── Debug │ │ │ │ ├── tugas.o │ │ │ │ └── outDebug │ │ └── tugas.cpp │ └── diagram │ │ └── tugas.puml ├── test.cpp ├── latihan1.cpp └── latihan2.cpp ├── uts ├── soal3 ├── soal4 ├── soal5 ├── soal6 ├── soal4.cpp ├── soal7.puml ├── soal3.cpp ├── soal5.cpp └── soal6.cpp ├── latihan ├── lat1 ├── lat2 ├── bab │ ├── 5 │ │ ├── 5-1 │ │ ├── 5-2 │ │ ├── 5-3 │ │ ├── 5-4 │ │ ├── 5-1.cpp │ │ ├── 5-2.cpp │ │ ├── 5-4.cpp │ │ └── 5-3.cpp │ └── 6 │ │ ├── 6-time │ │ └── 6-time.cpp ├── perbintangan │ ├── 1 │ ├── 2 │ ├── 2.cpp │ └── 1.cpp ├── build │ └── Debug │ │ ├── lat2.o │ │ └── outDebug ├── lat1.cpp └── lat2.cpp ├── pert8 ├── tugas3 ├── db │ ├── .env │ ├── conf.d │ │ └── my.cnf │ └── docker-compose.yml ├── tugas2.puml ├── readme.md └── tugas3.cpp ├── pert10 ├── .env ├── php │ ├── local.ini │ ├── www.conf │ ├── docker-entrypoint.sh │ └── Dockerfile ├── nginx │ ├── Dockerfile │ └── default.conf ├── db │ └── conf.d │ │ └── my.cnf └── docker-compose.yml ├── pert12 ├── .env ├── php │ ├── local.ini │ ├── www.conf │ ├── docker-entrypoint.sh │ └── Dockerfile ├── nginx │ ├── Dockerfile │ └── default.conf ├── db │ └── conf.d │ │ └── my.cnf └── docker-compose.yml ├── pert2 ├── index.py ├── index3.py ├── index2.py ├── index5.py ├── index4.py └── Readme.md ├── uas ├── jawaban_soal_5 │ └── source_code │ │ ├── .env │ │ ├── php │ │ ├── local.ini │ │ ├── www.conf │ │ ├── docker-entrypoint.sh │ │ └── Dockerfile │ │ ├── nginx │ │ ├── Dockerfile │ │ └── default.conf │ │ ├── db │ │ └── conf.d │ │ │ └── my.cnf │ │ └── docker-compose.yml ├── jawaban_soal_3 │ ├── capture_jawaban │ │ └── source_code 7_23_2024 9_54_48 AM.png │ ├── source_code │ │ ├── jawaban_python.py │ │ └── jawaban_jupiter_notebook.ipynb │ └── analisa │ │ └── jawaban_analisa.md ├── jawaban_soal_2 │ ├── capture_jawaban │ │ └── jawaban_soal_2 7_23_2024 9_21_09 AM.png │ ├── source_code │ │ ├── jawaban_python.py │ │ └── jawaban_jupiter_notebook.ipynb │ └── analisa │ │ └── jawaban_analisa.md ├── jawaban_soal_1 │ ├── capture_jawaban │ │ └── jawaban_python.py - uas [WSL_ Ubuntu] - Visual Studio Code 7_23_2024 8_59_50 AM.png │ ├── source_code │ │ ├── jawaban_python.py │ │ └── jawaban_jupiter_notebook.ipynb │ └── analisa │ │ └── jawaban_analisa.md └── jawaban_soal_4 │ ├── source_code │ ├── docker-compose.yml │ └── jawaban_python.py │ └── analisa │ └── jawaban_analisa.md ├── pert5 ├── trial.puml ├── source1.puml ├── pert5usecase.puml ├── source.puml ├── pert5.puml ├── kurang.puml └── source.cpp ├── .gitignore ├── pert7 ├── test2.puml ├── test.puml ├── untitled.ipynb └── examplecasedashboard.py ├── .vscode ├── c_cpp_properties.json ├── launch.json ├── tasks.json └── settings.json ├── pert6 ├── test.puml └── array.ipynb ├── HowToFix.md ├── pert1 └── Readme.md └── Readme.md /pert3/test.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pert9/postgres.ipynb: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pert11/.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | -------------------------------------------------------------------------------- /pert11/README.md: -------------------------------------------------------------------------------- 1 | # rnd 2 | 3 | Just Try Out 4 | -------------------------------------------------------------------------------- /pert3/tes: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Anraaa/bhs_pemrograman/HEAD/pert3/tes -------------------------------------------------------------------------------- /pert4/for: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Anraaa/bhs_pemrograman/HEAD/pert4/for -------------------------------------------------------------------------------- /tugas/test: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Anraaa/bhs_pemrograman/HEAD/tugas/test -------------------------------------------------------------------------------- /uts/soal3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Anraaa/bhs_pemrograman/HEAD/uts/soal3 -------------------------------------------------------------------------------- /uts/soal4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Anraaa/bhs_pemrograman/HEAD/uts/soal4 -------------------------------------------------------------------------------- /uts/soal5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Anraaa/bhs_pemrograman/HEAD/uts/soal5 -------------------------------------------------------------------------------- /uts/soal6: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Anraaa/bhs_pemrograman/HEAD/uts/soal6 -------------------------------------------------------------------------------- /latihan/lat1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Anraaa/bhs_pemrograman/HEAD/latihan/lat1 -------------------------------------------------------------------------------- /latihan/lat2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Anraaa/bhs_pemrograman/HEAD/latihan/lat2 -------------------------------------------------------------------------------- /pert4/sample: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Anraaa/bhs_pemrograman/HEAD/pert4/sample -------------------------------------------------------------------------------- /pert4/tugas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Anraaa/bhs_pemrograman/HEAD/pert4/tugas -------------------------------------------------------------------------------- /pert4/while: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Anraaa/bhs_pemrograman/HEAD/pert4/while -------------------------------------------------------------------------------- /pert8/tugas3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Anraaa/bhs_pemrograman/HEAD/pert8/tugas3 -------------------------------------------------------------------------------- /pert10/.env: -------------------------------------------------------------------------------- 1 | COMPOSE_PROJECT_NAME=djambred 2 | REPOSITORY_NAME=pemweb 3 | IMAGE_TAG=latest -------------------------------------------------------------------------------- /pert12/.env: -------------------------------------------------------------------------------- 1 | COMPOSE_PROJECT_NAME=djambred 2 | REPOSITORY_NAME=pemweb 3 | IMAGE_TAG=latest -------------------------------------------------------------------------------- /tugas/latihan1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Anraaa/bhs_pemrograman/HEAD/tugas/latihan1 -------------------------------------------------------------------------------- /tugas/latihan2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Anraaa/bhs_pemrograman/HEAD/tugas/latihan2 -------------------------------------------------------------------------------- /latihan/bab/5/5-1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Anraaa/bhs_pemrograman/HEAD/latihan/bab/5/5-1 -------------------------------------------------------------------------------- /latihan/bab/5/5-2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Anraaa/bhs_pemrograman/HEAD/latihan/bab/5/5-2 -------------------------------------------------------------------------------- /latihan/bab/5/5-3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Anraaa/bhs_pemrograman/HEAD/latihan/bab/5/5-3 -------------------------------------------------------------------------------- /latihan/bab/5/5-4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Anraaa/bhs_pemrograman/HEAD/latihan/bab/5/5-4 -------------------------------------------------------------------------------- /pert2/index.py: -------------------------------------------------------------------------------- 1 | # contoh Variabel 2 | 3 | a = 5 4 | b = 4 5 | c = a + b 6 | 7 | print(c) 8 | -------------------------------------------------------------------------------- /pert8/db/.env: -------------------------------------------------------------------------------- 1 | COMPOSE_PROJECT_NAME=anraaa 2 | REPOSITORY_NAME=database 3 | IMAGE_TAG=latest -------------------------------------------------------------------------------- /latihan/bab/6/6-time: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Anraaa/bhs_pemrograman/HEAD/latihan/bab/6/6-time -------------------------------------------------------------------------------- /pert11/.env: -------------------------------------------------------------------------------- 1 | COMPOSE_PROJECT_NAME=djambred 2 | REPOSITORY_NAME=fastapi 3 | IMAGE_TAG=latest 4 | -------------------------------------------------------------------------------- /latihan/perbintangan/1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Anraaa/bhs_pemrograman/HEAD/latihan/perbintangan/1 -------------------------------------------------------------------------------- /latihan/perbintangan/2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Anraaa/bhs_pemrograman/HEAD/latihan/perbintangan/2 -------------------------------------------------------------------------------- /pert11/order_service/.env: -------------------------------------------------------------------------------- 1 | COMPOSE_PROJECT_NAME=djambred 2 | REPOSITORY_NAME=fastapi 3 | IMAGE_TAG=latest 4 | -------------------------------------------------------------------------------- /pert11/user_service/.env: -------------------------------------------------------------------------------- 1 | COMPOSE_PROJECT_NAME=djambred 2 | REPOSITORY_NAME=fastapi 3 | IMAGE_TAG=latest 4 | -------------------------------------------------------------------------------- /pert2/index3.py: -------------------------------------------------------------------------------- 1 | # Contoh Logika 2 | 3 | a = 14 4 | t = 3 5 | 6 | rumus = a * t / 2 7 | 8 | print(rumus) -------------------------------------------------------------------------------- /latihan/build/Debug/lat2.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Anraaa/bhs_pemrograman/HEAD/latihan/build/Debug/lat2.o -------------------------------------------------------------------------------- /pert11/product_service/.env: -------------------------------------------------------------------------------- 1 | COMPOSE_PROJECT_NAME=djambred 2 | REPOSITORY_NAME=fastapi 3 | IMAGE_TAG=latest 4 | -------------------------------------------------------------------------------- /pert3/tes.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main(){ 5 | cout << "Hello"; 6 | } 7 | -------------------------------------------------------------------------------- /uas/jawaban_soal_5/source_code/.env: -------------------------------------------------------------------------------- 1 | COMPOSE_PROJECT_NAME=djambred 2 | REPOSITORY_NAME=pemweb 3 | IMAGE_TAG=latest -------------------------------------------------------------------------------- /latihan/build/Debug/outDebug: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Anraaa/bhs_pemrograman/HEAD/latihan/build/Debug/outDebug -------------------------------------------------------------------------------- /tugas/tugas_pert7/program/tugas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Anraaa/bhs_pemrograman/HEAD/tugas/tugas_pert7/program/tugas -------------------------------------------------------------------------------- /pert2/index2.py: -------------------------------------------------------------------------------- 1 | # Contoh Operasi 2 | 3 | a = 'mahasiswa' 4 | 5 | def test(): 6 | print('Aqlaa adalah ' + a) 7 | 8 | test() -------------------------------------------------------------------------------- /tugas/tugas_pert7/program/build/Debug/tugas.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Anraaa/bhs_pemrograman/HEAD/tugas/tugas_pert7/program/build/Debug/tugas.o -------------------------------------------------------------------------------- /tugas/tugas_pert7/program/build/Debug/outDebug: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Anraaa/bhs_pemrograman/HEAD/tugas/tugas_pert7/program/build/Debug/outDebug -------------------------------------------------------------------------------- /pert10/php/local.ini: -------------------------------------------------------------------------------- 1 | date.timezone = "Asia/Jakarta" 2 | upload_max_filesize=128M 3 | post_max_size=128M 4 | max_execution_time = 0 5 | memory_limit = 3000M -------------------------------------------------------------------------------- /pert12/php/local.ini: -------------------------------------------------------------------------------- 1 | date.timezone = "Asia/Jakarta" 2 | upload_max_filesize=128M 3 | post_max_size=128M 4 | max_execution_time = 0 5 | memory_limit = 3000M -------------------------------------------------------------------------------- /pert11/user_service/app/api/db.py: -------------------------------------------------------------------------------- 1 | from pymongo import MongoClient 2 | conn = MongoClient('mongodb://root:p455w0rd@192.168.100.3:27017/users?authSource=admin') 3 | -------------------------------------------------------------------------------- /pert11/user_service/app/api/model_user.py: -------------------------------------------------------------------------------- 1 | from pydantic import BaseModel 2 | 3 | class User(BaseModel): 4 | name: str 5 | email: str 6 | password: str -------------------------------------------------------------------------------- /pert2/index5.py: -------------------------------------------------------------------------------- 1 | # Contoh Sorting Sederhana 2 | 3 | mhs =['jarseg', 'batak', 'sodongmp', 'rajeg'] 4 | 5 | sorted(mhs, key=len, reverse=True) 6 | 7 | print(mhs) -------------------------------------------------------------------------------- /pert11/order_service/app/api/db.py: -------------------------------------------------------------------------------- 1 | from pymongo import MongoClient 2 | conn = MongoClient('mongodb://root:p455w0rd@192.168.100.3:27017/orders?authSource=admin') 3 | -------------------------------------------------------------------------------- /pert11/product_service/app/api/db.py: -------------------------------------------------------------------------------- 1 | from pymongo import MongoClient 2 | conn = MongoClient('mongodb://root:p455w0rd@192.168.100.3:27017/products?authSource=admin') 3 | -------------------------------------------------------------------------------- /tugas/test.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main(){ 6 | int angka [10] = {1, 2, 3, 4}; 7 | 8 | cout << angka[0] << endl; 9 | } -------------------------------------------------------------------------------- /pert10/nginx/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM nginx:stable-alpine 2 | 3 | ENV TZ="Asia/Jakarta" 4 | ENV PS1="\u@\h:\w\\$ " 5 | 6 | RUN apk add --no-cache bash 7 | RUN apk add --no-cache tzdata -------------------------------------------------------------------------------- /pert12/nginx/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM nginx:stable-alpine 2 | 3 | ENV TZ="Asia/Jakarta" 4 | ENV PS1="\u@\h:\w\\$ " 5 | 6 | RUN apk add --no-cache bash 7 | RUN apk add --no-cache tzdata -------------------------------------------------------------------------------- /uas/jawaban_soal_5/source_code/php/local.ini: -------------------------------------------------------------------------------- 1 | date.timezone = "Asia/Jakarta" 2 | upload_max_filesize=128M 3 | post_max_size=128M 4 | max_execution_time = 0 5 | memory_limit = 3000M -------------------------------------------------------------------------------- /pert11/product_service/app/api/model_product.py: -------------------------------------------------------------------------------- 1 | from pydantic import BaseModel 2 | 3 | class Product(BaseModel): 4 | name_product: str 5 | quantity: str 6 | harga: str -------------------------------------------------------------------------------- /pert2/index4.py: -------------------------------------------------------------------------------- 1 | # Contoh tipe data 2 | 3 | a = "jarseg" 4 | 5 | print (a) 6 | print (type(a)) 7 | 8 | # Casting Tipe Data 9 | b = bool(a) 10 | print(b) 11 | print(type(b)) -------------------------------------------------------------------------------- /pert5/trial.puml: -------------------------------------------------------------------------------- 1 | @startuml Trial 2 | start 3 | while (input angka1, angka2) 4 | :read angka1; 5 | :read angka2; 6 | :return angka1 + angka2; 7 | endwhile 8 | stop 9 | @enduml -------------------------------------------------------------------------------- /pert11/order_service/app/api/model_order.py: -------------------------------------------------------------------------------- 1 | from pydantic import BaseModel 2 | 3 | class Order(BaseModel): 4 | user: str 5 | product: str 6 | total: str 7 | status: str -------------------------------------------------------------------------------- /tugas/latihan1.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main(){ 6 | for (int a; a <= 10; a++){ 7 | cout << a << endl; 8 | } 9 | 10 | return 0; 11 | } -------------------------------------------------------------------------------- /pert11/user_service/app/main.py: -------------------------------------------------------------------------------- 1 | from fastapi import FastAPI 2 | from app.api.route_user import user 3 | app = FastAPI() 4 | app.include_router(user, prefix="/users", tags=["User Docs"]) 5 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | pert8/db/mariadb/* 2 | pert8/db/postgres/* 3 | pert8/db/mongo/* 4 | pert8/db/redis/* 5 | 6 | pert10/db/data/* 7 | pert10/src/* 8 | 9 | pert12/db/data/* 10 | pert12/src/* 11 | -------------------------------------------------------------------------------- /pert11/order_service/app/main.py: -------------------------------------------------------------------------------- 1 | from fastapi import FastAPI 2 | from app.api.route_order import order 3 | app = FastAPI() 4 | app.include_router(order, prefix="/orders", tags=["Order Docs"]) 5 | -------------------------------------------------------------------------------- /uas/jawaban_soal_3/capture_jawaban/source_code 7_23_2024 9_54_48 AM.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Anraaa/bhs_pemrograman/HEAD/uas/jawaban_soal_3/capture_jawaban/source_code 7_23_2024 9_54_48 AM.png -------------------------------------------------------------------------------- /uas/jawaban_soal_5/source_code/nginx/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM nginx:stable-alpine 2 | 3 | ENV TZ="Asia/Jakarta" 4 | ENV PS1="\u@\h:\w\\$ " 5 | 6 | RUN apk add --no-cache bash 7 | RUN apk add --no-cache tzdata -------------------------------------------------------------------------------- /pert11/product_service/app/main.py: -------------------------------------------------------------------------------- 1 | from fastapi import FastAPI 2 | from app.api.route_product import product 3 | app = FastAPI() 4 | app.include_router(product, prefix="/products", tags=["Products Docs"]) 5 | -------------------------------------------------------------------------------- /uas/jawaban_soal_2/capture_jawaban/jawaban_soal_2 7_23_2024 9_21_09 AM.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Anraaa/bhs_pemrograman/HEAD/uas/jawaban_soal_2/capture_jawaban/jawaban_soal_2 7_23_2024 9_21_09 AM.png -------------------------------------------------------------------------------- /uts/soal4.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() 6 | { 7 | int n = 21; 8 | 9 | cout << "Berarti Usia Kalian sekarang adalah " << n << " Tahun" << endl; 10 | } -------------------------------------------------------------------------------- /pert3/Readme.md: -------------------------------------------------------------------------------- 1 | a = "Hello" 2 | print(a) 3 | 4 | value = 75 5 | if value >=90: 6 | grade = "A" 7 | elif value >=80: 8 | grade = "B" 9 | else : 10 | grade = "E" 11 | 12 | print("Grade : %s" % grade) 13 | 14 | -------------------------------------------------------------------------------- /latihan/perbintangan/2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() 6 | { 7 | int i, j, k; 8 | for (int i = 0; i < 5; i++){ 9 | for (int j = 0; j <= i; j++){ 10 | cout << "* "; 11 | } cout << endl; 12 | } 13 | } -------------------------------------------------------------------------------- /uas/jawaban_soal_1/capture_jawaban/jawaban_python.py - uas [WSL_ Ubuntu] - Visual Studio Code 7_23_2024 8_59_50 AM.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Anraaa/bhs_pemrograman/HEAD/uas/jawaban_soal_1/capture_jawaban/jawaban_python.py - uas [WSL_ Ubuntu] - Visual Studio Code 7_23_2024 8_59_50 AM.png -------------------------------------------------------------------------------- /pert10/php/www.conf: -------------------------------------------------------------------------------- 1 | [www] 2 | 3 | user = www-data 4 | group = www-data 5 | 6 | listen = nginx_pemrog:9000 7 | 8 | pm = dynamic 9 | pm.max_children = 40 10 | pm.start_servers = 2 11 | pm.min_spare_servers = 2 12 | pm.max_spare_servers = 4 13 | pm.max_requests = 800 14 | request_terminate_timeout = 0 -------------------------------------------------------------------------------- /pert12/php/www.conf: -------------------------------------------------------------------------------- 1 | [www] 2 | 3 | user = www-data 4 | group = www-data 5 | 6 | listen = nginx_pemrog:9000 7 | 8 | pm = dynamic 9 | pm.max_children = 40 10 | pm.start_servers = 2 11 | pm.min_spare_servers = 2 12 | pm.max_spare_servers = 4 13 | pm.max_requests = 800 14 | request_terminate_timeout = 0 -------------------------------------------------------------------------------- /pert7/test2.puml: -------------------------------------------------------------------------------- 1 | @startuml test2 2 | 3 | [*] --> MENU 4 | MENU : 1. Aku 5 | MENU : 2. Dia 6 | MENU --> PILIHAN 7 | PILIHAN : Masukkan Pilihan Anda 8 | PILIHAN --> MENU : Pilihan Anda Salah 9 | PILIHAN --> AKU: Oke 10 | PILIHAN --> DIA: Oke 11 | AKU --> [*] : Selesai 12 | DIA --> [*] : Selesai 13 | 14 | @enduml -------------------------------------------------------------------------------- /tugas/latihan2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | using namespace std; 5 | 6 | int main(){ 7 | 8 | char huruf; 9 | 10 | for (huruf = 'a'; huruf <= 'z'; huruf++){ 11 | cout << huruf << endl; 12 | cout << (char)toupper(huruf) << endl; 13 | } 14 | 15 | return 0; 16 | } -------------------------------------------------------------------------------- /uas/jawaban_soal_5/source_code/php/www.conf: -------------------------------------------------------------------------------- 1 | [www] 2 | 3 | user = www-data 4 | group = www-data 5 | 6 | listen = nginx_pemrog:9000 7 | 8 | pm = dynamic 9 | pm.max_children = 40 10 | pm.start_servers = 2 11 | pm.min_spare_servers = 2 12 | pm.max_spare_servers = 4 13 | pm.max_requests = 800 14 | request_terminate_timeout = 0 -------------------------------------------------------------------------------- /uts/soal7.puml: -------------------------------------------------------------------------------- 1 | @startuml soal7 2 | left to right direction 3 | actor User 4 | 5 | User --> (Run Program) 6 | User --> (Input First Number) 7 | User --> (Input Second Number) 8 | User --> (View Sum Result) 9 | User --> (View Difference Result) 10 | User --> (View Product Result) 11 | User --> (View Quotient Result) 12 | @enduml -------------------------------------------------------------------------------- /latihan/perbintangan/1.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() 6 | { 7 | for (int i = 1; i <= 5; i++){ 8 | for (int j = 0; j <= i; j++){ 9 | cout << " "; 10 | } cout << endl; 11 | for (int k = 1; k <= i; k++){ 12 | cout << "* "; 13 | } 14 | } 15 | return 0; 16 | } -------------------------------------------------------------------------------- /pert11/order_service/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:3.8-slim 2 | 3 | WORKDIR /app 4 | 5 | COPY ./requirements.txt /app/requirements.txt 6 | 7 | RUN apt-get update \ 8 | && apt-get install gcc -y \ 9 | && apt-get clean 10 | 11 | RUN pip install -r /app/requirements.txt \ 12 | && rm -rf /root/.cache/pip 13 | 14 | COPY . /app 15 | -------------------------------------------------------------------------------- /pert11/user_service/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:3.8-slim 2 | 3 | WORKDIR /app 4 | 5 | COPY ./requirements.txt /app/requirements.txt 6 | 7 | RUN apt-get update \ 8 | && apt-get install gcc -y \ 9 | && apt-get clean 10 | 11 | RUN pip install -r /app/requirements.txt \ 12 | && rm -rf /root/.cache/pip 13 | 14 | COPY . /app 15 | -------------------------------------------------------------------------------- /pert11/product_service/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:3.8-slim 2 | 3 | WORKDIR /app 4 | 5 | COPY ./requirements.txt /app/requirements.txt 6 | 7 | RUN apt-get update \ 8 | && apt-get install gcc -y \ 9 | && apt-get clean 10 | 11 | RUN pip install -r /app/requirements.txt \ 12 | && rm -rf /root/.cache/pip 13 | 14 | COPY . /app 15 | -------------------------------------------------------------------------------- /uas/jawaban_soal_1/source_code/jawaban_python.py: -------------------------------------------------------------------------------- 1 | def factorial(n): 2 | """Menghitung faktorial dari n secara rekursif""" 3 | if n == 0 or n == 1: 4 | return 1 5 | else: 6 | return n * factorial(n - 1) 7 | 8 | # Menghitung faktorial dari 5 9 | print("hasil faktorial 5 adalah: ") 10 | print(factorial(5)) # Output: 120 11 | -------------------------------------------------------------------------------- /latihan/bab/5/5-1.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main(){ 6 | int p, l, luas; 7 | 8 | cout << "Hello World!" << endl; 9 | 10 | cout << "Panjang : "; 11 | cin >> p; 12 | 13 | cout << "Lebar : " ; 14 | cin >> l; 15 | 16 | luas = p * l; 17 | cout << luas << endl; 18 | 19 | return 0; 20 | } -------------------------------------------------------------------------------- /pert4/for.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main(){ 6 | 7 | cout << "Iteration Statement" << endl; 8 | cout << "Penggunaan FOR" << endl; 9 | 10 | //int a = 1; 11 | // apa bedanya int di luar for dengan int didala for? 12 | 13 | for (int a = 1; a <= 5; a++){ 14 | cout << a << endl; 15 | } 16 | 17 | return 0; 18 | } -------------------------------------------------------------------------------- /uts/soal3.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() 6 | { 7 | int n; 8 | cout << "Masukkan nilai n: "; 9 | cin >> n; 10 | for (int i = 1; i<=n; i++ ){ 11 | for (int s = 1; s 2 | 3 | using namespace std; 4 | 5 | int main() 6 | { 7 | string name; 8 | string city; 9 | 10 | cout << "What is your name? " << endl; 11 | cin >> name; 12 | 13 | cout << endl; 14 | 15 | cout << "Where do u live? " << endl; 16 | cin >> city; 17 | 18 | cout << endl; 19 | 20 | cout << "Nice to Meet u " << name << " from " << city << endl; 21 | 22 | return 0; 23 | } -------------------------------------------------------------------------------- /pert5/source1.puml: -------------------------------------------------------------------------------- 1 | @startuml source1 2 | 3 | start 4 | :Display MENU; 5 | repeat 6 | :Input pilihan; 7 | if (pilihan == 1) then (true) 8 | :Masukkan Nama Depan; 9 | :Masukkan Nama Tengah; 10 | :Masukkan Nama Akhir; 11 | :Tampilkan Full Name; 12 | else (false) 13 | if (pilihan == 2) then (true) 14 | :Exit; 15 | else (false) 16 | :Pilihan Salah; 17 | endif 18 | endif 19 | repeat while (pilihan != 2) 20 | :Exit; 21 | stop 22 | 23 | @enduml -------------------------------------------------------------------------------- /pert5/pert5usecase.puml: -------------------------------------------------------------------------------- 1 | @startuml Pert5 2 | 3 | left to right direction 4 | 5 | actor User as "User" 6 | 7 | rectangle "Source Code Pert4" { 8 | usecase "Input Angka" as input 9 | usecase "Choice Menu" as menu 10 | usecase "Call void tambah" as tambah 11 | usecase "Input Angka2" as input2 12 | usecase "Output" as output 13 | usecase "Exit" as exit 14 | } 15 | 16 | User --> menu 17 | menu --> tambah 18 | tambah --> input 19 | tambah --> 20 | input --> exit 21 | 22 | @enduml -------------------------------------------------------------------------------- /pert6/test.puml: -------------------------------------------------------------------------------- 1 | @startuml sample 2 | 3 | left to right direction 4 | 5 | actor user 6 | rectangle program{ 7 | user -- (menu) 8 | (menu) .> (choice 1) : include 9 | (menu) .> (choice 2) : extend 10 | (choice 2) .> (exit) : extend 11 | (choice 1) .> (input nama depan) : include 12 | (input nama depan) ._> (input nama tengah) : include 13 | (input nama tengah) ._> (input nama belakang) : include 14 | (input nama belakang) ._> (show full name) : include 15 | 16 | } 17 | @enduml -------------------------------------------------------------------------------- /uas/jawaban_soal_2/source_code/jawaban_python.py: -------------------------------------------------------------------------------- 1 | def divide(a, b): 2 | """Membagi dua angka dan menangani pembagian dengan nol""" 3 | try: 4 | result = a / b 5 | except ZeroDivisionError: 6 | print("Error: Tidak bisa membagi dengan nol!") 7 | return None 8 | else: 9 | return result 10 | finally: 11 | print("Operasi pembagian selesai.") 12 | 13 | # Contoh penggunaan 14 | print(divide(10, 2)) # Output: 5.0 15 | print(divide(10, 0)) # Output: Error: Tidak bisa membagi dengan nol! 16 | -------------------------------------------------------------------------------- /uas/jawaban_soal_3/source_code/jawaban_python.py: -------------------------------------------------------------------------------- 1 | import tkinter as tk 2 | from tkinter import messagebox 3 | 4 | def show_message(): 5 | messagebox.showinfo("Info", "Hello, Tkinter!") 6 | 7 | # Membuat instance utama dari Tkinter 8 | root = tk.Tk() 9 | root.title("Contoh Aplikasi GUI") 10 | 11 | # Menentukan ukuran jendela 12 | root.geometry("300x200") 13 | 14 | # Membuat tombol 15 | button = tk.Button(root, text="Klik Saya", command=show_message) 16 | button.pack(pady=20) 17 | 18 | # Menjalankan loop utama Tkinter 19 | root.mainloop() 20 | -------------------------------------------------------------------------------- /latihan/bab/6/6-time.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | typedef struct { 6 | int hh; 7 | int mm; 8 | int ss; 9 | } Time; 10 | Time t; 11 | long int seconds; 12 | 13 | int main() 14 | { 15 | cout << "Masukkan jam : "; 16 | cin >> t.hh; 17 | 18 | cout << "Masukkan menit : "; 19 | cin >> t.mm; 20 | 21 | cout << "Masukkan detik : "; 22 | cin >> t.ss; 23 | 24 | seconds = t.hh * 3600 + t.mm * 60 + t.ss; 25 | 26 | cout << "Total detik : " << seconds << endl; 27 | 28 | return 0; 29 | } -------------------------------------------------------------------------------- /pert11/user_service/app/api/schema_user.py: -------------------------------------------------------------------------------- 1 | def userEntity(item) -> dict: 2 | return { 3 | "id":str(item["_id"]), 4 | "name":item["name"], 5 | "email":item["email"], 6 | "password":item["password"] 7 | } 8 | 9 | def usersEntity(entity) -> list: 10 | return [userEntity(item) for item in entity] 11 | 12 | 13 | def serializeDict(a) -> dict: 14 | return {**{i:str(a[i]) for i in a if i=='_id'},**{i:a[i] for i in a if i!='_id'}} 15 | 16 | def serializeList(entity) -> list: 17 | return [serializeDict(a) for a in entity] 18 | 19 | -------------------------------------------------------------------------------- /pert5/source.puml: -------------------------------------------------------------------------------- 1 | @startuml Source.cpp 2 | 3 | title Alur Program 4 | (*) --> "Eksekusi Program" 5 | --> "Menampilkan Menu" 6 | --> "Memilih Menu" 7 | if "Menu Pilihan 1" then 8 | --> "Input Nama" 9 | ->[true] "Masukkan First Name" 10 | ->[true] "Masukkan Middle Name" 11 | ->[true] "Masukkan Last Name" 12 | --> "Tampilkan Full Name" 13 | if "Ulangi" then 14 | -->[yes] "Input Nama" 15 | else 16 | -->[no] "Exit" 17 | endif 18 | else 19 | --> "Menu Pilihan 2" 20 | --> "Exit" 21 | endif 22 | --> "Selesai" 23 | --> (*) 24 | @enduml -------------------------------------------------------------------------------- /uts/soal5.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() 6 | { 7 | int n1, n2, hasil; 8 | 9 | cout << "Masukkan Angka Pertama : "; 10 | cin >> n1; 11 | 12 | cout << "Masukkan Angka Kedua : "; 13 | cin >> n2; 14 | 15 | hasil = n1 + n2; 16 | cout << "Penjumlahan : " << hasil << endl; 17 | 18 | hasil = n1 - n2; 19 | cout << "Pengurangan : " << hasil << endl; 20 | 21 | hasil = n1 * n2; 22 | cout << "Perkalian : " << hasil << endl; 23 | 24 | hasil = n1 / n2; 25 | cout << "Pembagian : " << hasil << endl; 26 | } -------------------------------------------------------------------------------- /pert11/product_service/app/api/schema_product.py: -------------------------------------------------------------------------------- 1 | def productEntity(item) -> dict: 2 | return { 3 | "id":str(item["_id"]), 4 | "name_product":item["name_product"], 5 | "quantity":item["quantity"], 6 | "harga":item["harga"] 7 | } 8 | 9 | def productEntity(entity) -> list: 10 | return [productEntity(item) for item in entity] 11 | 12 | 13 | def serializeDict(a) -> dict: 14 | return {**{i:str(a[i]) for i in a if i=='_id'},**{i:a[i] for i in a if i!='_id'}} 15 | 16 | def serializeList(entity) -> list: 17 | return [serializeDict(a) for a in entity] 18 | 19 | -------------------------------------------------------------------------------- /pert11/order_service/app/api/schema_order.py: -------------------------------------------------------------------------------- 1 | def orderEntity(item) -> dict: 2 | return { 3 | "id":str(item["_id"]), 4 | "user":item["user"], 5 | "product":item["produt"], 6 | "total":item["total"], 7 | "status":item["status"] 8 | } 9 | 10 | def orderEntity(entity) -> list: 11 | return [orderEntity(item) for item in entity] 12 | 13 | 14 | def serializeDict(a) -> dict: 15 | return {**{i:str(a[i]) for i in a if i=='_id'},**{i:a[i] for i in a if i!='_id'}} 16 | 17 | def serializeList(entity) -> list: 18 | return [serializeDict(a) for a in entity] 19 | 20 | -------------------------------------------------------------------------------- /pert4/controlstatement.puml: -------------------------------------------------------------------------------- 1 | @startmindmap controlstatement 2 | *[#Orange] Control Statements 3 | **[#LightGreen] Selection Statements 4 | ***[#LightSeaGreen] if else 5 | ***[#LightSeaGreen] switch Case 6 | **[#LightBlue] Iteration Statements 7 | ***[#LightCyan] while 8 | ***[#LightCyan] do while 9 | ***[#LightCyan] for 10 | **[#OrangeRed] Jump Statements 11 | ***[#LightSalmon] break 12 | ***[#LightSalmon] goto 13 | ***[#LightSalmon] continue 14 | 15 | header 16 | Pertemuan 3 17 | endheader 18 | title Control Statement 19 | caption copyright@esaunggul.ac.id 20 | legend left 21 | CTI211-Pemograman Berorientasi Objek 22 | endlegend 23 | 24 | @endmindmap -------------------------------------------------------------------------------- /latihan/bab/5/5-4.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() 6 | { 7 | cout << "Menghitung Gaji PNS" << endl; 8 | cout << "Gaji Pokok Anda : Rp. 5.000.000" << endl; 9 | int gaji = 5000000; 10 | cin >> gaji; 11 | 12 | cout << "Tunjangan 1 Anak / bulan : Rp. 1.000.000" << endl; 13 | int tunjangan1 = 1000000; 14 | cin >> tunjangan1; 15 | 16 | cout << "Tunjangan Istri / bulan : Rp. 2.5000.000" << endl; 17 | int tunjangan2 = 2500000; 18 | cin >> tunjangan2; 19 | 20 | int total = gaji + tunjangan1 + tunjangan2; 21 | cout << "Total Gaji Bersih Anda : " << total << endl; 22 | 23 | return 0; 24 | } -------------------------------------------------------------------------------- /uas/jawaban_soal_4/source_code/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3.8' 2 | 3 | services: 4 | db: 5 | image: mariadb:10.5 6 | container_name: mariadb 7 | environment: 8 | MYSQL_ROOT_PASSWORD: root_password 9 | MYSQL_DATABASE: test_db 10 | MYSQL_USER: user 11 | MYSQL_PASSWORD: user_password 12 | ports: 13 | - "3306:3306" 14 | volumes: 15 | - db_data:/var/lib/mysql 16 | 17 | app: 18 | image: python:3.9 19 | container_name: python_app 20 | working_dir: /app 21 | volumes: 22 | - ./app:/app 23 | depends_on: 24 | - db 25 | command: ["python", "app.py"] 26 | 27 | volumes: 28 | db_data: 29 | -------------------------------------------------------------------------------- /pert11/order_service/requirements.txt: -------------------------------------------------------------------------------- 1 | amqp==5.0.1 2 | attrs==20.2.0 3 | billiard==3.6.3.0 4 | celery==5.0.1 5 | certifi==2020.6.20 6 | chardet==3.0.4 7 | click==7.1.2 8 | click-didyoumean==0.0.3 9 | click-repl==0.1.6 10 | fastapi==0.61.1 11 | h11==0.11.0 12 | idna==2.10 13 | iniconfig==1.1.1 14 | kombu==5.0.2 15 | mongoengine==0.20.0 16 | mongomock==3.20.0 17 | packaging==20.4 18 | pluggy==0.13.1 19 | prompt-toolkit==3.0.8 20 | py==1.9.0 21 | pydantic==1.6.1 22 | pymongo==3.11.0 23 | pyparsing==2.4.7 24 | pytest==6.1.1 25 | pytz==2020.1 26 | redis==3.5.3 27 | requests==2.24.0 28 | sentinels==1.0.0 29 | six==1.15.0 30 | starlette==0.13.6 31 | toml==0.10.1 32 | urllib3==1.25.10 33 | uvicorn==0.12.1 34 | vine==5.0.0 35 | wcwidth==0.2.5 36 | -------------------------------------------------------------------------------- /pert11/product_service/requirements.txt: -------------------------------------------------------------------------------- 1 | amqp==5.0.1 2 | attrs==20.2.0 3 | billiard==3.6.3.0 4 | celery==5.0.1 5 | certifi==2020.6.20 6 | chardet==3.0.4 7 | click==7.1.2 8 | click-didyoumean==0.0.3 9 | click-repl==0.1.6 10 | fastapi==0.61.1 11 | h11==0.11.0 12 | idna==2.10 13 | iniconfig==1.1.1 14 | kombu==5.0.2 15 | mongoengine==0.20.0 16 | mongomock==3.20.0 17 | packaging==20.4 18 | pluggy==0.13.1 19 | prompt-toolkit==3.0.8 20 | py==1.9.0 21 | pydantic==1.6.1 22 | pymongo==3.11.0 23 | pyparsing==2.4.7 24 | pytest==6.1.1 25 | pytz==2020.1 26 | redis==3.5.3 27 | requests==2.24.0 28 | sentinels==1.0.0 29 | six==1.15.0 30 | starlette==0.13.6 31 | toml==0.10.1 32 | urllib3==1.25.10 33 | uvicorn==0.12.1 34 | vine==5.0.0 35 | wcwidth==0.2.5 36 | -------------------------------------------------------------------------------- /pert11/user_service/requirements.txt: -------------------------------------------------------------------------------- 1 | amqp==5.0.1 2 | attrs==20.2.0 3 | billiard==3.6.3.0 4 | celery==5.0.1 5 | certifi==2020.6.20 6 | chardet==3.0.4 7 | click==7.1.2 8 | click-didyoumean==0.0.3 9 | click-repl==0.1.6 10 | fastapi==0.61.1 11 | h11==0.11.0 12 | idna==2.10 13 | iniconfig==1.1.1 14 | kombu==5.0.2 15 | mongoengine==0.20.0 16 | mongomock==3.20.0 17 | packaging==20.4 18 | pluggy==0.13.1 19 | prompt-toolkit==3.0.8 20 | py==1.9.0 21 | pydantic==1.6.1 22 | pymongo==3.11.0 23 | pyparsing==2.4.7 24 | pytest==6.1.1 25 | pytz==2020.1 26 | redis==3.5.3 27 | requests==2.24.0 28 | sentinels==1.0.0 29 | six==1.15.0 30 | starlette==0.13.6 31 | toml==0.10.1 32 | urllib3==1.25.10 33 | uvicorn==0.12.1 34 | vine==5.0.0 35 | wcwidth==0.2.5 36 | -------------------------------------------------------------------------------- /pert7/test.puml: -------------------------------------------------------------------------------- 1 | @startuml Test 2 | autonumber "." 3 | actor user 4 | participant "Menu" as M 5 | participant "Pilih Menu" as pil 6 | participant "Aku" as A 7 | participant "Dia" as D 8 | participant "Total" as tot 9 | participant "Quantity" as qty 10 | 11 | user --> M: Tampilkan Menu Utama 12 | M --> pil: Pilih Menu 1 atau 2, Pilih AKU atau DIA 13 | pil --> A: Menampilkan Profile Aku 14 | A --> qty: Masukan Jumlah Quantity 15 | qty --> tot: Print 16 | M <-- tot: Kembali ke Menu 17 | opt Exit 18 | tot --> user: Exit 19 | end 20 | 21 | pil --> D: Menampilkan Profile Aku 22 | D --> qty: Masukkan Jumlah Quantity 23 | qty --> tot: Print 24 | M <-- tot: Kembali ke Menu 25 | opt Exit 26 | tot --> user: Exit 27 | end 28 | 29 | @enduml -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "C/C++ Runner: Debug Session", 6 | "type": "cppdbg", 7 | "request": "launch", 8 | "args": [], 9 | "stopAtEntry": false, 10 | "externalConsole": false, 11 | "cwd": "/root/Perkuliahan/Smt2/bhs_pemrograman/uts", 12 | "program": "/root/Perkuliahan/Smt2/bhs_pemrograman/uts/build/Debug/outDebug", 13 | "MIMode": "gdb", 14 | "miDebuggerPath": "gdb", 15 | "setupCommands": [ 16 | { 17 | "description": "Enable pretty-printing for gdb", 18 | "text": "-enable-pretty-printing", 19 | "ignoreFailures": true 20 | } 21 | ] 22 | } 23 | ] 24 | } -------------------------------------------------------------------------------- /pert5/pert5.puml: -------------------------------------------------------------------------------- 1 | @startuml pert5 2 | start 3 | :initialize Variables; 4 | while (pilih !='5') is (control statement) 5 | :show menu; 6 | :Get User Input(pilih); 7 | if (pilih == '1') then (case 1) 8 | :Get Input (a,b); 9 | :Call tambah(a,b); 10 | else if (pilih == '2') then (case 2) 11 | :Get Input (a,b); 12 | :Call kurang(a,b); 13 | else if (pilih == '3') then (case 3) 14 | :Get Input (a,b); 15 | :Call kali(a,b); 16 | else if (pilih == '4') then (case 4) 17 | :Get Input (a,b); 18 | :Call bagi(a,b); 19 | else 20 | :Display "Pilihan Salah!"; 21 | endif 22 | 23 | endwhile (control statement) 24 | :Display "Terima Kasih"; 25 | stop 26 | @enduml -------------------------------------------------------------------------------- /pert5/kurang.puml: -------------------------------------------------------------------------------- 1 | @startuml Pert5 2 | title Diagram untuk Source Code Pertemuan 4 3 | start 4 | :Initialize Variables; 5 | while (pilih != '5') is (control statement) 6 | :Display menu; 7 | :Get user input (pilih); 8 | if (pilih == '1') then (case 1) 9 | :Get input (a, b); 10 | :Call tambah(a, b); 11 | else if (pilih == '2') then (case 2) 12 | :Get input (a, b); 13 | :Call kurang(a, b); 14 | else if (pilih == '3') then (case 3) 15 | :Get input (a, b); 16 | :Call kali(a, b); 17 | else if (pilih == '4') then (case 4) 18 | :Get input (a, b); 19 | :Call bagi(a, b); 20 | else 21 | :Display "Pilihan Salah!"; 22 | endif 23 | endwhile (controll statement) 24 | :Display "EXIT"; 25 | stop 26 | 27 | @enduml -------------------------------------------------------------------------------- /pert11/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3' 2 | 3 | services: 4 | user_service: 5 | build: ./user_service 6 | container_name: user 7 | command: uvicorn app.main:app --reload --host 0.0.0.0 --port 8000 8 | volumes: 9 | - ./user_service:/app 10 | ports: 11 | - 8000:8000 12 | 13 | product_service: 14 | build: ./product_service 15 | container_name: product 16 | command: uvicorn app.main:app --reload --host 0.0.0.0 --port 8000 17 | volumes: 18 | - ./product_service:/app 19 | ports: 20 | - 8001:8000 21 | 22 | order_service: 23 | build: ./order_service 24 | container_name: order 25 | command: uvicorn app.main:app --reload --host 0.0.0.0 --port 8000 26 | volumes: 27 | - ./order_service:/app 28 | ports: 29 | - 8002:8000 30 | -------------------------------------------------------------------------------- /pert8/tugas2.puml: -------------------------------------------------------------------------------- 1 | @startuml MedicalScheduler 2 | start 3 | :Initialize MedicalScheduler; 4 | while (choice != 4) is (yes) 5 | :Show menu; 6 | :Get User Input(choice); 7 | if (choice == '1') then (yes) 8 | :Show Doctors; 9 | else if (choice == '2') then (yes) 10 | :Get Input (patientName, doctorName, time); 11 | if (Doctor exists) then (yes) 12 | :Schedule Appointment; 13 | :Display "Appointment scheduled successfully."; 14 | else (no) 15 | :Display "Doctor not found. Please try again."; 16 | endif 17 | else if (choice == '3') then (yes) 18 | :Show Appointments; 19 | else (no) 20 | :Display "Invalid choice, please try again."; 21 | endif 22 | endwhile (no) 23 | :Display "Exiting..."; 24 | stop 25 | @enduml -------------------------------------------------------------------------------- /pert10/nginx/default.conf: -------------------------------------------------------------------------------- 1 | server { 2 | listen 80; 3 | index index.php index.html; 4 | server_name pemrog.my.id; 5 | error_log /var/log/nginx/pemweb.error.log; 6 | access_log /var/log/nginx/pemweb.access.log; 7 | root /var/www/html/public; 8 | autoindex_localtime on; 9 | autoindex on; 10 | location / { 11 | try_files $uri $uri/ /index.php?$query_string; 12 | add_header 'Access-Control-Allow-Origin' * always; 13 | } 14 | 15 | location ~\.php$ { 16 | try_files $uri =404; 17 | fastcgi_split_path_info ^(.+\.php)(/.+)$; 18 | fastcgi_pass pemrog:9000; 19 | fastcgi_index index.php; 20 | include fastcgi_params; 21 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 22 | fastcgi_pass_request_headers on; 23 | } 24 | } -------------------------------------------------------------------------------- /pert12/nginx/default.conf: -------------------------------------------------------------------------------- 1 | server { 2 | listen 80; 3 | index index.php index.html; 4 | server_name pemrog.my.id; 5 | error_log /var/log/nginx/pemweb.error.log; 6 | access_log /var/log/nginx/pemweb.access.log; 7 | root /var/www/html/public; 8 | autoindex_localtime on; 9 | autoindex on; 10 | location / { 11 | try_files $uri $uri/ /index.php?$query_string; 12 | add_header 'Access-Control-Allow-Origin' * always; 13 | } 14 | 15 | location ~\.php$ { 16 | try_files $uri =404; 17 | fastcgi_split_path_info ^(.+\.php)(/.+)$; 18 | fastcgi_pass pemrog:9000; 19 | fastcgi_index index.php; 20 | include fastcgi_params; 21 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 22 | fastcgi_pass_request_headers on; 23 | } 24 | } -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "tasks": [ 3 | { 4 | "type": "cppbuild", 5 | "label": "C/C++: g++ build active file", 6 | "command": "/usr/bin/g++", 7 | "args": [ 8 | "-fdiagnostics-color=always", 9 | "-g", 10 | "${file}", 11 | "-o", 12 | "${fileDirname}/${fileBasenameNoExtension}" 13 | ], 14 | "options": { 15 | "cwd": "${fileDirname}" 16 | }, 17 | "problemMatcher": [ 18 | "$gcc" 19 | ], 20 | "group": { 21 | "kind": "build", 22 | "isDefault": true 23 | }, 24 | "detail": "Task generated by Debugger." 25 | } 26 | ], 27 | "version": "2.0.0" 28 | } -------------------------------------------------------------------------------- /uas/jawaban_soal_5/source_code/nginx/default.conf: -------------------------------------------------------------------------------- 1 | server { 2 | listen 80; 3 | index index.php index.html; 4 | server_name pemrog.my.id; 5 | error_log /var/log/nginx/pemweb.error.log; 6 | access_log /var/log/nginx/pemweb.access.log; 7 | root /var/www/html/public; 8 | autoindex_localtime on; 9 | autoindex on; 10 | location / { 11 | try_files $uri $uri/ /index.php?$query_string; 12 | add_header 'Access-Control-Allow-Origin' * always; 13 | } 14 | 15 | location ~\.php$ { 16 | try_files $uri =404; 17 | fastcgi_split_path_info ^(.+\.php)(/.+)$; 18 | fastcgi_pass pemrog:9000; 19 | fastcgi_index index.php; 20 | include fastcgi_params; 21 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 22 | fastcgi_pass_request_headers on; 23 | } 24 | } -------------------------------------------------------------------------------- /pert10/db/conf.d/my.cnf: -------------------------------------------------------------------------------- 1 | [client] 2 | port=3306 3 | default-character-set = utf8mb4 4 | 5 | [mysqld] 6 | port=3306 7 | character-set-server = utf8mb4 8 | skip-character-set-client-handshake 9 | skip-name-resolve 10 | lower_case_table_names = 1 11 | default-storage-engine = InnoDB 12 | innodb_file_format = Barracuda 13 | innodb_file_per_table = 1 14 | innodb_log_file_size = 512M 15 | innodb_strict_mode = 0 16 | 17 | log_error = /var/log/mysql/error.log 18 | general_log_file = /var/log/mysql/general.log 19 | general_log = 0 20 | slow_query_log = 1 21 | slow_query_log_file = /var/log/mysql/slow-query.log 22 | long_query_time = 1 23 | log_queries_not_using_indexes = 1 24 | # network 25 | connect_timeout = 61 26 | wait_timeout = 86400 27 | max_connections = 500 28 | max_allowed_packet = 256M 29 | max_connect_errors = 100 30 | # limits 31 | tmp_table_size = 1024M 32 | max_heap_table_size = 1024M 33 | table_cache = 1024 -------------------------------------------------------------------------------- /pert12/db/conf.d/my.cnf: -------------------------------------------------------------------------------- 1 | [client] 2 | port=3306 3 | default-character-set = utf8mb4 4 | 5 | [mysqld] 6 | port=3306 7 | character-set-server = utf8mb4 8 | skip-character-set-client-handshake 9 | skip-name-resolve 10 | lower_case_table_names = 1 11 | default-storage-engine = InnoDB 12 | innodb_file_format = Barracuda 13 | innodb_file_per_table = 1 14 | innodb_log_file_size = 512M 15 | innodb_strict_mode = 0 16 | 17 | log_error = /var/log/mysql/error.log 18 | general_log_file = /var/log/mysql/general.log 19 | general_log = 0 20 | slow_query_log = 1 21 | slow_query_log_file = /var/log/mysql/slow-query.log 22 | long_query_time = 1 23 | log_queries_not_using_indexes = 1 24 | # network 25 | connect_timeout = 61 26 | wait_timeout = 86400 27 | max_connections = 500 28 | max_allowed_packet = 256M 29 | max_connect_errors = 100 30 | # limits 31 | tmp_table_size = 1024M 32 | max_heap_table_size = 1024M 33 | table_cache = 1024 -------------------------------------------------------------------------------- /pert8/db/conf.d/my.cnf: -------------------------------------------------------------------------------- 1 | [client] 2 | port=3306 3 | default-character-set = utf8mb4 4 | 5 | [mysqld] 6 | port=3306 7 | character-set-server = utf8mb4 8 | skip-character-set-client-handshake 9 | skip-name-resolve 10 | lower_case_table_names = 1 11 | default-storage-engine = InnoDB 12 | innodb_file_format = Barracuda 13 | innodb_file_per_table = 1 14 | innodb_log_file_size = 512M 15 | innodb_strict_mode = 0 16 | 17 | log_error = /var/log/mysql/error.log 18 | general_log_file = /var/log/mysql/general.log 19 | general_log = 0 20 | slow_query_log = 1 21 | slow_query_log_file = /var/log/mysql/slow-query.log 22 | long_query_time = 1 23 | log_queries_not_using_indexes = 1 24 | # network 25 | connect_timeout = 61 26 | wait_timeout = 86400 27 | max_connections = 500 28 | max_allowed_packet = 256M 29 | max_connect_errors = 100 30 | # limits 31 | tmp_table_size = 1024M 32 | max_heap_table_size = 1024M 33 | table_cache = 1024 -------------------------------------------------------------------------------- /uas/jawaban_soal_5/source_code/db/conf.d/my.cnf: -------------------------------------------------------------------------------- 1 | [client] 2 | port=3306 3 | default-character-set = utf8mb4 4 | 5 | [mysqld] 6 | port=3306 7 | character-set-server = utf8mb4 8 | skip-character-set-client-handshake 9 | skip-name-resolve 10 | lower_case_table_names = 1 11 | default-storage-engine = InnoDB 12 | innodb_file_format = Barracuda 13 | innodb_file_per_table = 1 14 | innodb_log_file_size = 512M 15 | innodb_strict_mode = 0 16 | 17 | log_error = /var/log/mysql/error.log 18 | general_log_file = /var/log/mysql/general.log 19 | general_log = 0 20 | slow_query_log = 1 21 | slow_query_log_file = /var/log/mysql/slow-query.log 22 | long_query_time = 1 23 | log_queries_not_using_indexes = 1 24 | # network 25 | connect_timeout = 61 26 | wait_timeout = 86400 27 | max_connections = 500 28 | max_allowed_packet = 256M 29 | max_connect_errors = 100 30 | # limits 31 | tmp_table_size = 1024M 32 | max_heap_table_size = 1024M 33 | table_cache = 1024 -------------------------------------------------------------------------------- /pert4/while.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | void penggunaandowhile(){ 6 | cout << "Penggunaan DO WHILE" << endl; 7 | int a = 1; 8 | int b = 2; 9 | 10 | do{ 11 | cout << a << endl; 12 | a = a+1; 13 | }while (a<=b); 14 | } 15 | 16 | void penggunaanwhilebreak(){ 17 | cout << "Penggunaan WHILE BREAK" << endl; 18 | int a = 0; 19 | 20 | while (a<=5){ 21 | a = a+1; 22 | if (a == 7) 23 | { 24 | cout << a << endl; 25 | break; 26 | } 27 | cout << "looping while berhenti" << endl; 28 | } 29 | cout << "looping di luar while berhenti" << endl; 30 | } 31 | 32 | int main(){ 33 | 34 | cout << "Penggunaan WHILE" << endl; 35 | 36 | int a = 1; 37 | int b = 2; 38 | 39 | while(a<=b){ 40 | cout << a << endl; 41 | a = a+1; 42 | } 43 | 44 | penggunaandowhile(); 45 | penggunaanwhilebreak(); 46 | 47 | return 0; 48 | 49 | } -------------------------------------------------------------------------------- /pert4/sample.py: -------------------------------------------------------------------------------- 1 | class Nama: 2 | def full(self, first_name, middle_name, last_name): 3 | print("FULL NAME :", first_name, middle_name, last_name) 4 | 5 | def main(): 6 | n = Nama() 7 | 8 | while True: 9 | print("MENU SOAL 4: ") 10 | print("1. Input ") 11 | print("2. Keluar\n") 12 | 13 | pilih = input("Pilihan anda: ") 14 | 15 | if pilih == '1': 16 | first_name = input("Masukan Nama Depan : ") 17 | middle_name = input("Masukan Nama Tengah : ") 18 | last_name = input("Masukan Nama Belakang : ") 19 | n.full(first_name, middle_name, last_name) 20 | elif pilih == '2': 21 | print("\nTERIMA KASIH") 22 | break 23 | else: 24 | print("Pilihan Invalid ") 25 | 26 | pil = input("Ingin kembali ke menu? (Y/N) : ") 27 | if pil.lower() != 'y': 28 | print("\nTERIMA KASIH") 29 | break 30 | 31 | if __name__ == "__main__": 32 | main() -------------------------------------------------------------------------------- /pert11/product_service/app/api/route_product.py: -------------------------------------------------------------------------------- 1 | from fastapi import APIRouter 2 | from app.api.model_product import Product 3 | from app.api.db import conn 4 | from app.api.schema_product import serializeDict, serializeList 5 | from bson import ObjectId 6 | product = APIRouter() 7 | 8 | @product.get('/') 9 | async def find_all_products(): 10 | return serializeList(conn.products.product.find()) 11 | 12 | @product.post('/') 13 | async def create_product(product: Product): 14 | conn.products.product.insert_one(dict(product)) 15 | return serializeList(conn.products.product.find()) 16 | 17 | @product.put('/{id}') 18 | async def update_product(id,product: Product): 19 | conn.products.product.find_one_and_update({"_id":ObjectId(id)},{ 20 | "$set":dict(product) 21 | }) 22 | return serializeDict(conn.products.product.find_one({"_id":ObjectId(id)})) 23 | 24 | @product.delete('/{id}') 25 | async def delete_product(id,product: Product): 26 | return serializeDict(conn.products.Product.find_one_and_delete({"_id":ObjectId(id)})) 27 | -------------------------------------------------------------------------------- /uts/soal6.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | void menu (int &n1, int &n2) { 6 | cout << "Masukkan Angka Pertama : "; 7 | cin >> n1; 8 | 9 | cout << "Masukkan Angka Kedua : "; 10 | cin >> n2; 11 | } 12 | 13 | void tambah(int n1, int n2) { 14 | int hasil = n1 + n2; 15 | cout << "Penjumlahan : " << hasil << endl; 16 | } 17 | 18 | void kurang(int n1, int n2) { 19 | int hasil = n1 - n2; 20 | cout << "Pengurangan : " << hasil << endl; 21 | } 22 | 23 | void kali(int n1, int n2) { 24 | int hasil = n1 * n2; 25 | cout << "Perkalian : " << hasil << endl; 26 | } 27 | 28 | void bagi(int n1, int n2) { 29 | if(n2 != 0) { 30 | int hasil = n1 / n2; 31 | cout << "Pembagian : " << hasil << endl; 32 | } else { 33 | cout << "Error: Pembagi tidak boleh nol" << endl; 34 | } 35 | } 36 | 37 | int main() 38 | { 39 | int n1, n2; 40 | 41 | menu(n1, n2); 42 | tambah(n1, n2); 43 | kurang(n1, n2); 44 | kali(n1, n2); 45 | bagi(n1, n2); 46 | 47 | return 0; 48 | } -------------------------------------------------------------------------------- /pert11/user_service/app/api/route_user.py: -------------------------------------------------------------------------------- 1 | from fastapi import APIRouter 2 | from app.api.model_user import User 3 | from app.api.db import conn 4 | from app.api.schema_user import serializeDict, serializeList 5 | from bson import ObjectId 6 | user = APIRouter() 7 | 8 | @user.get('/') 9 | async def find_all_users(): 10 | return serializeList(conn.users.user.find()) 11 | 12 | # @user.get('/{id}') 13 | # async def find_one_user(id): 14 | # return serializeDict(conn.local.user.find_one({"_id":ObjectId(id)})) 15 | 16 | @user.post('/') 17 | async def create_user(user: User): 18 | conn.users.user.insert_one(dict(user)) 19 | return serializeList(conn.users.user.find()) 20 | 21 | @user.put('/{id}') 22 | async def update_user(id,user: User): 23 | conn.users.user.find_one_and_update({"_id":ObjectId(id)},{ 24 | "$set":dict(user) 25 | }) 26 | return serializeDict(conn.users.user.find_one({"_id":ObjectId(id)})) 27 | 28 | @user.delete('/{id}') 29 | async def delete_user(id,user: User): 30 | return serializeDict(conn.users.user.find_one_and_delete({"_id":ObjectId(id)})) 31 | -------------------------------------------------------------------------------- /pert11/order_service/app/api/route_order.py: -------------------------------------------------------------------------------- 1 | from fastapi import APIRouter 2 | from app.api.model_order import Order 3 | from app.api.db import conn 4 | from app.api.schema_order import serializeDict, serializeList 5 | from bson import ObjectId 6 | order = APIRouter() 7 | 8 | @order.get('/') 9 | async def find_all_orders(): 10 | return serializeList(conn.orders.order.find()) 11 | 12 | # @order.get('/{id}') 13 | # async def find_one_order(id): 14 | # return serializeDict(conn.local.order.find_one({"_id":ObjectId(id)})) 15 | 16 | @order.post('/') 17 | async def create_order(order: Order): 18 | conn.orders.order.insert_one(dict(order)) 19 | return serializeList(conn.orders.order.find()) 20 | 21 | @order.put('/{id}') 22 | async def update_order(id,order: Order): 23 | conn.orders.order.find_one_and_update({"_id":ObjectId(id)},{ 24 | "$set":dict(order) 25 | }) 26 | return serializeDict(conn.orders.order.find_one({"_id":ObjectId(id)})) 27 | 28 | @order.delete('/{id}') 29 | async def delete_order(id,order: Order): 30 | return serializeDict(conn.orders.order.find_one_and_delete({"_id":ObjectId(id)})) 31 | -------------------------------------------------------------------------------- /pert10/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version : '3' 2 | services: 3 | pemrog: 4 | build: ./php 5 | image: pemrog_php:latest 6 | container_name: pemrog 7 | hostname: "pemrog" 8 | volumes: 9 | - ./src:/var/www/html 10 | - ./php/www.conf:/usr/local/etc/php-fpm.d/www.conf 11 | working_dir: /var/www/html 12 | depends_on: 13 | - db 14 | db: 15 | image: mariadb:10.2 16 | container_name: db 17 | restart: unless-stopped 18 | tty: true 19 | ports: 20 | - "13306:3306" 21 | volumes: 22 | - ./db/data:/var/lib/mysql 23 | - ./db/conf.d:/etc/mysql/conf.d:ro 24 | environment: 25 | MYSQL_USER: djambred 26 | MYSQL_PASSWORD: p455w0rd1!. 27 | MYSQL_ROOT_PASSWORD: p455w0rd 28 | TZ: Asia/Jakarta 29 | SERVICE_TAGS: dev 30 | SERVICE_NAME: mysql 31 | nginx_pemrog: 32 | build: ./nginx 33 | image: nginx_pemrog:latest 34 | container_name: nginx_pemrog 35 | hostname: "nginx_pemrog" 36 | ports: 37 | - "80:80" 38 | volumes: 39 | - ./src:/var/www/html 40 | - ./nginx/default.conf:/etc/nginx/conf.d/default.conf 41 | depends_on: 42 | - pemrog 43 | -------------------------------------------------------------------------------- /pert12/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version : '3' 2 | services: 3 | pemrog: 4 | build: ./php 5 | image: pemrog_php:latest 6 | container_name: pemrog 7 | hostname: "pemrog" 8 | volumes: 9 | - ./src:/var/www/html 10 | - ./php/www.conf:/usr/local/etc/php-fpm.d/www.conf 11 | working_dir: /var/www/html 12 | depends_on: 13 | - db 14 | db: 15 | image: mariadb:10.2 16 | container_name: db 17 | restart: unless-stopped 18 | tty: true 19 | ports: 20 | - "13306:3306" 21 | volumes: 22 | - ./db/data:/var/lib/mysql 23 | - ./db/conf.d:/etc/mysql/conf.d:ro 24 | environment: 25 | MYSQL_USER: djambred 26 | MYSQL_PASSWORD: p455w0rd1!. 27 | MYSQL_ROOT_PASSWORD: p455w0rd 28 | TZ: Asia/Jakarta 29 | SERVICE_TAGS: dev 30 | SERVICE_NAME: mysql 31 | nginx_pemrog: 32 | build: ./nginx 33 | image: nginx_pemrog:latest 34 | container_name: nginx_pemrog 35 | hostname: "nginx_pemrog" 36 | ports: 37 | - "80:80" 38 | volumes: 39 | - ./src:/var/www/html 40 | - ./nginx/default.conf:/etc/nginx/conf.d/default.conf 41 | depends_on: 42 | - pemrog 43 | -------------------------------------------------------------------------------- /uas/jawaban_soal_3/source_code/jawaban_jupiter_notebook.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": null, 6 | "metadata": {}, 7 | "outputs": [], 8 | "source": [ 9 | "import tkinter as tk\n", 10 | "from tkinter import messagebox" 11 | ] 12 | }, 13 | { 14 | "cell_type": "code", 15 | "execution_count": null, 16 | "metadata": {}, 17 | "outputs": [], 18 | "source": [ 19 | "def show_message():\n", 20 | " messagebox.showinfo(\"Info\", \"Hello, Tkinter!\")\n", 21 | " \n", 22 | "# Membuat instance utama dari Tkinter\n", 23 | "root = tk.Tk()\n", 24 | "root.title(\"Contoh Aplikasi GUI\")\n", 25 | "\n", 26 | "# Menentukan ukuran jendela\n", 27 | "root.geometry(\"300x200\")\n", 28 | "\n", 29 | "# Membuat tombol\n", 30 | "button = tk.Button(root, text=\"Klik Saya\", command=show_message)\n", 31 | "button.pack(pady=20)\n", 32 | "\n", 33 | "# Menjalankan loop utama Tkinter\n", 34 | "root.mainloop()" 35 | ] 36 | } 37 | ], 38 | "metadata": { 39 | "language_info": { 40 | "name": "python" 41 | } 42 | }, 43 | "nbformat": 4, 44 | "nbformat_minor": 2 45 | } 46 | -------------------------------------------------------------------------------- /uas/jawaban_soal_5/source_code/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version : '3' 2 | services: 3 | pemrog: 4 | build: ./php 5 | image: pemrog_php:latest 6 | container_name: pemrog 7 | hostname: "pemrog" 8 | volumes: 9 | - ./src:/var/www/html 10 | - ./php/www.conf:/usr/local/etc/php-fpm.d/www.conf 11 | working_dir: /var/www/html 12 | depends_on: 13 | - db 14 | db: 15 | image: mariadb:10.2 16 | container_name: db 17 | restart: unless-stopped 18 | tty: true 19 | ports: 20 | - "13306:3306" 21 | volumes: 22 | - ./db/data:/var/lib/mysql 23 | - ./db/conf.d:/etc/mysql/conf.d:ro 24 | environment: 25 | MYSQL_USER: djambred 26 | MYSQL_PASSWORD: p455w0rd1!. 27 | MYSQL_ROOT_PASSWORD: p455w0rd 28 | TZ: Asia/Jakarta 29 | SERVICE_TAGS: dev 30 | SERVICE_NAME: mysql 31 | nginx_pemrog: 32 | build: ./nginx 33 | image: nginx_pemrog:latest 34 | container_name: nginx_pemrog 35 | hostname: "nginx_pemrog" 36 | ports: 37 | - "80:80" 38 | volumes: 39 | - ./src:/var/www/html 40 | - ./nginx/default.conf:/etc/nginx/conf.d/default.conf 41 | depends_on: 42 | - pemrog 43 | -------------------------------------------------------------------------------- /uas/jawaban_soal_1/analisa/jawaban_analisa.md: -------------------------------------------------------------------------------- 1 | ### Fungsi (Function) di Python 2 | 3 | Fungsi adalah blok kode yang dirancang untuk melakukan tugas tertentu. Fungsi membantu membuat kode lebih modular dan mudah dibaca, serta memudahkan untuk melakukan tugas yang berulang tanpa menulis ulang kode 4 | 5 | ```py 6 | def greet(name): 7 | """Mencetak salam kepada pengguna""" 8 | print(f"Hello, {name}!") 9 | 10 | # Memanggil fungsi 11 | greet("Alice") 12 | ``` 13 | 14 | Pada contoh di atas, greet adalah nama fungsi, name adalah parameter, dan fungsi tersebut mencetak pesan salam kepada nama yang diberikan. 15 | 16 | ___ 17 | 18 | ### Rekursif di Python 19 | Rekursif adalah teknik di mana sebuah fungsi memanggil dirinya sendiri untuk menyelesaikan tugas. Fungsi rekursif biasanya digunakan untuk menyelesaikan masalah yang dapat dipecah menjadi sub-masalah yang lebih kecil dengan struktur yang sama. 20 | 21 | Contoh Fungsi Rekursif: Faktorial 22 | ```py 23 | def factorial(n): 24 | """Menghitung faktorial dari n secara rekursif""" 25 | if n == 0 or n == 1: 26 | return 1 27 | else: 28 | return n * factorial(n - 1) 29 | 30 | # Menghitung faktorial dari 5 31 | print(factorial(5)) # Output: 120 32 | 33 | ``` -------------------------------------------------------------------------------- /latihan/lat1.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | using namespace std; 5 | 6 | void clearScreen() 7 | { 8 | cout << "\033[2J\033[1;1H"; 9 | } 10 | 11 | int main() 12 | { 13 | string a; 14 | char pil; 15 | 16 | do { 17 | clearScreen(); 18 | cout << "Masukkan Angka : " ; 19 | cin >> a; 20 | 21 | bool valid = true; 22 | for (int ch : a){ 23 | if (!isdigit(ch)){ // kalau huruf isalpha 24 | getchar(); 25 | cout << endl; 26 | cout << "Inputan harus angka" << endl; 27 | cout << "Tap To Continue..."; 28 | valid = false; 29 | } 30 | } 31 | 32 | if (!valid){ 33 | getchar(); 34 | continue; 35 | } 36 | 37 | int angka = stoi(a); 38 | 39 | if (angka < 0){ 40 | cout << "Angka " << angka << " adalah bilangan negatif" ; 41 | } 42 | else if (angka == 0){ 43 | cout << "Angka " << angka << " adalah bilangan nol"; 44 | } 45 | else { 46 | cout << "Angka " << angka << " adalah bilangan positif"; 47 | } 48 | 49 | cout << endl; 50 | 51 | cout << "Ingin Mengulangi? (y/Y) : "; 52 | cin >> pil; 53 | } while (pil != 'n' && pil != 'N'); 54 | 55 | return 0; 56 | } 57 | -------------------------------------------------------------------------------- /pert3/test.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "PERT #" 8 | ] 9 | }, 10 | { 11 | "cell_type": "code", 12 | "execution_count": null, 13 | "metadata": {}, 14 | "outputs": [], 15 | "source": [ 16 | "a = \"Hello\"\n", 17 | "print(a)" 18 | ] 19 | }, 20 | { 21 | "cell_type": "code", 22 | "execution_count": 2, 23 | "metadata": {}, 24 | "outputs": [ 25 | { 26 | "name": "stdout", 27 | "output_type": "stream", 28 | "text": [ 29 | "Grade : E\n" 30 | ] 31 | } 32 | ], 33 | "source": [ 34 | "value = 75\n", 35 | "if value >=90:\n", 36 | " grade = \"A\"\n", 37 | "elif value >=80:\n", 38 | " grade = \"B\"\n", 39 | "else :\n", 40 | " grade = \"E\"\n", 41 | "\n", 42 | "print(\"Grade : %s\" % grade)" 43 | ] 44 | } 45 | ], 46 | "metadata": { 47 | "kernelspec": { 48 | "display_name": "Python 3", 49 | "language": "python", 50 | "name": "python3" 51 | }, 52 | "language_info": { 53 | "codemirror_mode": { 54 | "name": "ipython", 55 | "version": 3 56 | }, 57 | "file_extension": ".py", 58 | "mimetype": "text/x-python", 59 | "name": "python", 60 | "nbconvert_exporter": "python", 61 | "pygments_lexer": "ipython3", 62 | "version": "3.10.12" 63 | } 64 | }, 65 | "nbformat": 4, 66 | "nbformat_minor": 2 67 | } 68 | -------------------------------------------------------------------------------- /pert8/db/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version : '3' 2 | 3 | services: 4 | 5 | mysqlpython: 6 | image: mariadb:10.2 7 | container_name: mysqlpython 8 | restart: unless-stopped 9 | tty: true 10 | ports: 11 | - "23306:3306" 12 | volumes: 13 | - ./mariadb:/var/lib/mysql 14 | - ./conf.d:/etc/mysql/conf.d:ro 15 | environment: 16 | MYSQL_USER: djambred 17 | MYSQL_PASSWORD: p455w0rd1!. 18 | MYSQL_ROOT_PASSWORD: p455w0rd 19 | TZ: Asia/Jakarta 20 | SERVICE_TAGS: dev 21 | SERVICE_NAME: mysql 22 | 23 | 24 | postgres: 25 | image: postgres:14-alpine 26 | ports: 27 | - 5432:5432 28 | volumes: 29 | - ./postgres:/var/lib/postgresql/data 30 | environment: 31 | - POSTGRES_PASSWORD=p455w0rd 32 | - POSTGRES_USER=djambred 33 | - POSTGRES_DB=bhs_pemrograman 34 | - SERVICE_NAME=postgres 35 | - SERVICE_TAGS=dev 36 | - TZ=Asia/Jakarta 37 | 38 | mongo: 39 | image: mongo:latest 40 | container_name: mongo 41 | ports: 42 | - "27017:27017" 43 | environment: 44 | MONGO_INITDB_ROOT_USERNAME: root 45 | MONGO_INITDB_ROOT_PASSWORD: p455w0rd 46 | volumes: 47 | - ./mongo:/mongo/db 48 | 49 | redis: 50 | image: 'bitnami/redis:latest' 51 | container_name: redis 52 | environment: 53 | - ALLOW_EMPTY_PASSWORD=yes 54 | volumes: 55 | - ./redis:/bitnami 56 | ports: 57 | - "6379:6379" -------------------------------------------------------------------------------- /uas/jawaban_soal_1/source_code/jawaban_jupiter_notebook.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": 1, 6 | "metadata": {}, 7 | "outputs": [], 8 | "source": [ 9 | "def factorial(n):\n", 10 | " \"\"\"Menghitung faktorial dari n secara rekursif\"\"\"\n", 11 | " if n == 0 or n == 1:\n", 12 | " return 1\n", 13 | " else:\n", 14 | " return n * factorial(n - 1)" 15 | ] 16 | }, 17 | { 18 | "cell_type": "code", 19 | "execution_count": 2, 20 | "metadata": {}, 21 | "outputs": [ 22 | { 23 | "name": "stdout", 24 | "output_type": "stream", 25 | "text": [ 26 | "hasil faktorial 5 adalah: \n", 27 | "120\n" 28 | ] 29 | } 30 | ], 31 | "source": [ 32 | "# Menghitung faktorial dari 5\n", 33 | "print(\"hasil faktorial 5 adalah: \")\n", 34 | "print(factorial(5)) # Output: 120" 35 | ] 36 | } 37 | ], 38 | "metadata": { 39 | "kernelspec": { 40 | "display_name": "Python 3", 41 | "language": "python", 42 | "name": "python3" 43 | }, 44 | "language_info": { 45 | "codemirror_mode": { 46 | "name": "ipython", 47 | "version": 3 48 | }, 49 | "file_extension": ".py", 50 | "mimetype": "text/x-python", 51 | "name": "python", 52 | "nbconvert_exporter": "python", 53 | "pygments_lexer": "ipython3", 54 | "version": "3.10.12" 55 | } 56 | }, 57 | "nbformat": 4, 58 | "nbformat_minor": 2 59 | } 60 | -------------------------------------------------------------------------------- /pert5/source.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | class Nama { 6 | public : 7 | string fName, mName, lName; 8 | 9 | void full(string fName, string mName, string lName){ 10 | cout << "FULL NAME" << fName + " " << mName << " " << lName << endl; 11 | } 12 | }; 13 | 14 | int main(){ 15 | Nama n; 16 | int pilih; 17 | char pil; 18 | 19 | menu: 20 | cout << "MENU" << endl; 21 | cout << "1. Input" << endl; 22 | cout << "2. Exit" <> pilih; 25 | 26 | switch(pilih){ 27 | case 1: 28 | cout << "Masukkan Nama Depan : " ; 29 | cin >> n.fName; 30 | cout << "Masukkan Nama Tengah : " ; 31 | cin >> n.mName; 32 | cout << "Masukkan Nama Akhir : " ; 33 | cin >> n.lName; 34 | n.full(n.fName, n.mName, n.lName); 35 | break; 36 | case 2: 37 | goto keluar; 38 | break; 39 | 40 | default: 41 | cout << "Pilihan Salah" << endl; 42 | break; 43 | } 44 | 45 | cout << "Ingin Mengulangi ? (Y/N) : " ; 46 | cin >> pil; 47 | if ((pil == 'Y' || pil == 'y')) 48 | {goto menu;} 49 | else if (pil == 'N' || pil == 'n') 50 | {goto keluar;} 51 | 52 | keluar: 53 | cout << "\n TERIMA KASIH" << endl; 54 | 55 | return 0; 56 | } -------------------------------------------------------------------------------- /uas/jawaban_soal_3/analisa/jawaban_analisa.md: -------------------------------------------------------------------------------- 1 | ### Penjelasan tentang GUI 2 | GUI (Graphical User Interface) adalah antarmuka pengguna yang memungkinkan interaksi dengan perangkat lunak melalui elemen grafis seperti jendela, tombol, menu, dan ikon, alih-alih menggunakan perintah teks berbasis command-line. GUI memudahkan pengguna untuk berinteraksi dengan aplikasi secara visual dan intuitif. 3 | 4 | ### Komponen Utama GUI 5 | - Jendela: Area utama aplikasi tempat konten ditampilkan. 6 | - Tombol: Elemen yang bisa diklik untuk melakukan aksi tertentu. 7 | - Menu: Daftar opsi atau perintah yang dapat dipilih oleh pengguna. 8 | - Formulir: Area di mana pengguna dapat memasukkan data. 9 | - Label: Teks statis yang memberikan informasi kepada pengguna. 10 | - Kotak Teks: Area di mana pengguna dapat mengetik input. 11 | 12 | ___ 13 | 14 | ### Install Tkinter 15 | ``` 16 | apt-get install python3-tk 17 | ``` 18 | 19 | ### Contoh Kode GUI dengan Tkinter di Python 20 | ``` 21 | import tkinter as tk 22 | from tkinter import messagebox 23 | 24 | def show_message(): 25 | messagebox.showinfo("Info", "Hello, Tkinter!") 26 | 27 | # Membuat instance utama dari Tkinter 28 | root = tk.Tk() 29 | root.title("Contoh Aplikasi GUI") 30 | 31 | # Menentukan ukuran jendela 32 | root.geometry("300x200") 33 | 34 | # Membuat tombol 35 | button = tk.Button(root, text="Klik Saya", command=show_message) 36 | button.pack(pady=20) 37 | 38 | # Menjalankan loop utama Tkinter 39 | root.mainloop() 40 | 41 | ``` -------------------------------------------------------------------------------- /pert4/sample.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | 5 | class Nama { 6 | public : 7 | string fName, mName, lName; 8 | void full(string fName, string mName, string lName) 9 | { 10 | cout << "FULL NAME : " << fName + " " << mName << " " << lName << endl; 11 | 12 | } 13 | }; 14 | 15 | int main() { 16 | Nama n; 17 | int pilih; 18 | char pil; 19 | menu: 20 | cout << "MENU" << endl; 21 | cout << "1. Input" << endl; 22 | cout << "2. Exit" <> pilih; 25 | 26 | switch(pilih){ 27 | case 1: 28 | cout << "Masukkan Nama Depan : " ; 29 | cin >> n.fName; 30 | cout << "Masukkan Nama Tengah : " ; 31 | cin >> n.mName; 32 | cout << "Masukkan Nama Akhir : " ; 33 | cin >> n.lName; 34 | n.full(n.fName, n.mName, n.lName); 35 | break; 36 | case 2: 37 | goto keluar; 38 | break; 39 | 40 | default: 41 | cout << "Pilihan Salah" << endl; 42 | break; 43 | } 44 | 45 | cout << "Ingin Mengulangi ? (Y/N) : " ; 46 | cin >> pil; 47 | if ((pil == 'Y' || pil == 'y')) 48 | {goto menu;} 49 | else if (pil == 'N' || pil == 'n') 50 | {goto keluar;} 51 | 52 | keluar: 53 | cout << "\n TERIMA KASIH" << endl; 54 | return 0; 55 | } -------------------------------------------------------------------------------- /pert4/tugaswithclass.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | class Calculator { 6 | double angka1, angka2; 7 | 8 | public: 9 | void input() { 10 | cout << "masukkan angka pertama : "; 11 | cin >> angka1; 12 | 13 | cout << "masukkan angka kedua : "; 14 | cin >> angka2; 15 | } 16 | 17 | void calculate(int pilihan) { 18 | switch(pilihan){ 19 | case 1 : 20 | cout << "Hasil : " << angka1 + angka2 << endl; 21 | break; 22 | case 2 : 23 | cout << "Hasil : " << angka1 - angka2 << endl; 24 | break; 25 | case 3 : 26 | cout << "Hasil : " << angka1 * angka2 << endl; 27 | break; 28 | case 4 : 29 | if(angka2 != 0) { 30 | cout << "Hasil : " << angka1 / angka2 << endl; 31 | } else { 32 | cout << "Error: Division by zero is not allowed." << endl; 33 | } 34 | break; 35 | default: 36 | cout << "Invalid option selected." << endl; 37 | break; 38 | } 39 | } 40 | }; 41 | 42 | int main(){ 43 | int pilihan; 44 | Calculator calc; 45 | 46 | calc.input(); 47 | 48 | cout << endl; 49 | cout << "MENU" << endl; 50 | cout << "1. Pertambah " << endl; 51 | cout << "2. Kurang " << endl; 52 | cout << "3. Kali " << endl; 53 | cout << "4. bagi " << endl; 54 | cout << "Masukkan Pilihan "; 55 | cin >> pilihan; 56 | 57 | calc.calculate(pilihan); 58 | 59 | return 0; 60 | } -------------------------------------------------------------------------------- /tugas/tugas_pert7/diagram/tugas.puml: -------------------------------------------------------------------------------- 1 | @startuml 2 | !define RECTANGLE class 3 | RECTANGLE Main { 4 | - int menu 5 | - int menu1 6 | - int menu2 7 | - int menu3 8 | - int menu4 9 | - int pesan 10 | - int harga 11 | -- Methods -- 12 | + clearScreen() 13 | + main() 14 | } 15 | 16 | RECTANGLE Main::clearScreen { 17 | + clearScreen() 18 | } 19 | 20 | RECTANGLE Main::main { 21 | + main() 22 | - clearScreen() 23 | - displayMainMenu() 24 | - handleMenuSelection(int menu) 25 | - handleFoodSelection() 26 | - handleFoodDetails(int foodChoice) 27 | - handleDrinkSelection() 28 | - handleDrinkDetails(int drinkChoice) 29 | } 30 | 31 | RECTANGLE Main::displayMainMenu { 32 | + displayMainMenu() 33 | } 34 | 35 | RECTANGLE Main::handleMenuSelection { 36 | + handleMenuSelection(int menu) 37 | } 38 | 39 | RECTANGLE Main::handleFoodSelection { 40 | + handleFoodSelection() 41 | } 42 | 43 | RECTANGLE Main::handleFoodDetails { 44 | + handleFoodDetails(int foodChoice) 45 | } 46 | 47 | RECTANGLE Main::handleDrinkSelection { 48 | + handleDrinkSelection() 49 | } 50 | 51 | RECTANGLE Main::handleDrinkDetails { 52 | + handleDrinkDetails(int drinkChoice) 53 | } 54 | 55 | Main --> Main::clearScreen : uses 56 | Main --> Main::main : contains 57 | Main::main --> Main::displayMainMenu : calls 58 | Main::main --> Main::handleMenuSelection : calls 59 | Main::handleMenuSelection --> Main::handleFoodSelection : calls 60 | Main::handleMenuSelection --> Main::handleDrinkSelection : calls 61 | Main::handleFoodSelection --> Main::handleFoodDetails : calls 62 | Main::handleDrinkSelection --> Main::handleDrinkDetails : calls 63 | 64 | @enduml 65 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "C_Cpp_Runner.cCompilerPath": "gcc", 3 | "C_Cpp_Runner.cppCompilerPath": "g++", 4 | "C_Cpp_Runner.debuggerPath": "gdb", 5 | "C_Cpp_Runner.cStandard": "", 6 | "C_Cpp_Runner.cppStandard": "", 7 | "C_Cpp_Runner.msvcBatchPath": "", 8 | "C_Cpp_Runner.useMsvc": false, 9 | "C_Cpp_Runner.warnings": [ 10 | "-Wall", 11 | "-Wextra", 12 | "-Wpedantic", 13 | "-Wshadow", 14 | "-Wformat=2", 15 | "-Wcast-align", 16 | "-Wconversion", 17 | "-Wsign-conversion", 18 | "-Wnull-dereference" 19 | ], 20 | "C_Cpp_Runner.msvcWarnings": [ 21 | "/W4", 22 | "/permissive-", 23 | "/w14242", 24 | "/w14287", 25 | "/w14296", 26 | "/w14311", 27 | "/w14826", 28 | "/w44062", 29 | "/w44242", 30 | "/w14905", 31 | "/w14906", 32 | "/w14263", 33 | "/w44265", 34 | "/w14928" 35 | ], 36 | "C_Cpp_Runner.enableWarnings": true, 37 | "C_Cpp_Runner.warningsAsError": false, 38 | "C_Cpp_Runner.compilerArgs": [], 39 | "C_Cpp_Runner.linkerArgs": [], 40 | "C_Cpp_Runner.includePaths": [], 41 | "C_Cpp_Runner.includeSearch": [ 42 | "*", 43 | "**/*" 44 | ], 45 | "C_Cpp_Runner.excludeSearch": [ 46 | "**/build", 47 | "**/build/**", 48 | "**/.*", 49 | "**/.*/**", 50 | "**/.vscode", 51 | "**/.vscode/**" 52 | ], 53 | "C_Cpp_Runner.useAddressSanitizer": false, 54 | "C_Cpp_Runner.useUndefinedSanitizer": false, 55 | "C_Cpp_Runner.useLeakSanitizer": false, 56 | "C_Cpp_Runner.showCompilationTime": false, 57 | "C_Cpp_Runner.useLinkTimeOptimization": false, 58 | "C_Cpp_Runner.msvcSecureNoWarnings": false, 59 | "files.associations": { 60 | "iostream": "cpp", 61 | "ostream": "cpp" 62 | } 63 | } -------------------------------------------------------------------------------- /pert2/Readme.md: -------------------------------------------------------------------------------- 1 | ## Praktikum 2 | 3 | *Pada praktikum pertemuan kedua, saya memulai dengan pembelajaran cara membuat repository di platform GitHub, yang merupakan langkah awal dalam berkolaborasi dan menyimpan proyek secara online. Setelah membuat repository, langkah selanjutnya adalah menambahkan folder dan berkas proyek ke dalam repository tersebut menggunakan perintah* `git add` *untuk mempersiapkan perubahan untuk dimasukkan dalam commit berikutnya.* 4 | 5 | *saya juga mempelajari berbagai perintah dasar Git melalui antarmuka baris perintah (command line), yang mencakup:* 6 | 7 | 1. `git init`: Menginisialisasi repository Git lokal di direktori kerja saat ini. 8 | 2. `git add `: Menambahkan berkas tertentu ke dalam area persiapan (staging area) untuk dimasukkan dalam commit berikutnya. 9 | 3. `git commit -m "pesan"`: Membuat commit dengan pesan tertentu yang menjelaskan perubahan yang telah dilakukan. 10 | 4. `git push`: Mengirimkan (push) perubahan yang telah dicommit dalam repository lokal ke repository di GitHub. 11 | 12 | *Melalui pembelajaran ini, saya memahami alur kerja dasar Git, mulai dari membuat perubahan dalam proyek lokal hingga menyinkronkannya dengan repositori yang berada di GitHub untuk berkolaborasi dengan rekan tim atau menyimpan proyek secara terpusat. Dengan menguasai perintah-perintah dasar ini, saya dapat memulai perjalanan saya dalam mengelola proyek perangkat lunak dengan lebih efisien menggunakan Git.* 13 | 14 | ## Teori 15 | 16 | ### Pengenalan Bahasa Python 17 | 18 | #### Hello World dalam Python 19 | 20 | ```python 21 | print ("Hello World) 22 | ``` 23 | 24 | #### Integer dalam Python 25 | 26 | ```python 27 | a = 3 28 | b = 2 29 | print (a+b) 30 | ``` 31 | 32 | #### String dalam Python 33 | 34 | ```python 35 | nama = "Aqla" 36 | print (nama) -------------------------------------------------------------------------------- /HowToFix.md: -------------------------------------------------------------------------------- 1 | ## How To FIX `error: failed to push some ref to [remote repo]` 2 | 3 | *Untuk mengatasi masalah ini, jalankan perintah git pull pada repositori lokal Anda. Hal ini seharusnya memungkinkan Anda untuk melakukan push ke origin lagi.* 4 | 5 | ```git 6 | git pull origin [branch] 7 | git push origin [branch] 8 | ``` 9 | ___ 10 | *Jika Anda mendapatkan kesalahan master (non-fast-forward) dengan pesan error "failed to push some refs to", ini berarti pointer ref telah dipindahkan maju dalam commit history. Namun, jika kode Anda bercabang sebelum mencapai commit terbaru, hal ini dapat menyebabkan masalah non-fast-forward dan menyebabkan kesalahan "failed to push some refs to".* 11 | 12 | *Untuk mengatasi masalah ini, Anda dapat melakukan pull dengan menggunakan opsi `--rebase`. `--rebase` akan memungkinkan Anda untuk memindahkan file yang dimaksud ke commit terbaru dari kode yang Anda tarik.* 13 | 14 | ``` 15 | git pull --rebase origin [branch] 16 | git push -u origin [branch] 17 | ``` 18 | ___ 19 | 20 | > :warning: **Warning:** Menggunakan `--force` untuk mencoba memperbaiki kesalahan "failed to push some refs to" hanya akan menghasilkan lebih banyak kesalahan dalam jangka panjang. Ini terjadi karena `--force` menggunakan metode kekerasan yang menjadikan kode Anda saat ini dan ref head-nya sebagai sumber kebenaran. 21 | 22 |
23 | 24 | > :memo: **Note:** Akibatnya, perubahan di remote dapat ditimpa oleh apa yang telah Anda dorong, menghapus fitur atau pembaruan yang mungkin telah dikomit oleh pengembang lain. 25 | 26 |
27 | 28 | > :bulb: **Tip:** Hanya gunakan `--force` jika Anda nyaman dengan fitur yang tidak ada di lokal Anda akan ditimpa dengan apa yang Anda miliki saat ini. Gunakan opsi `--force` jika Anda yakin bahwa repositori lokal Anda dalam keadaan yang benar saat ini. -------------------------------------------------------------------------------- /pert8/readme.md: -------------------------------------------------------------------------------- 1 | ## SOAL 2 | 3 | ### 1. BUATLAH BISNIS UNDERSTANDING TERHADAP RENCANA/IDE YANG ANDA INGINKAN 4 | jawaban : 5 | 6 | Sistem Penjadwalan Janji Temu Medis 7 | 8 | Deskripsi: 9 | Membangun sistem penjadwalan janji temu medis yang memungkinkan pasien untuk membuat janji dengan dokter secara online. 10 | 11 | Definisi: Sistem Penjadwalan Janji Temu Medis adalah aplikasi berbasis web yang dirancang untuk memfasilitasi proses penjadwalan janji temu antara pasien dan dokter. Sistem ini memungkinkan pasien untuk melihat jadwal dokter, memilih dokter berdasarkan spesialisasi, dan membuat janji temu secara online. Informasi tentang dokter, pasien, dan janji temu disimpan dalam database. 12 | 13 | Tujuan : 14 | 1. Meningkatkan efisiensi dan kenyamanan dalam proses penjadwalan janji temu medis bagi pasien dan dokter. 15 | 2. Mengurangi waktu tunggu dan penundaan dalam penjadwalan janji temu dengan memanfaatkan teknologi digital. 16 | 17 | Pemahaman Bisnis: 18 | 19 | Target Pasar: Klinik dan rumah sakit, serta pasien yang memerlukan janji temu medis. 20 | Kebutuhan Teknologi: Pengembangan aplikasi dengan database untuk menyimpan informasi dokter, pasien, dan janji temu. 21 | Model Pendapatan: Biaya layanan per janji temu atau langganan bulanan dari klinik dan rumah sakit. 22 | Analisis Kompetitor: Meneliti sistem penjadwalan janji temu medis seperti Zocdoc dan Practo. 23 | Keunikan Produk: Antarmuka pengguna yang ramah, notifikasi janji temu, dan pemilihan dokter berdasarkan spesialisasi. 24 | Promosi dan Pemasaran: Iklan online, kemitraan dengan klinik dan rumah sakit, serta promosi diskon. 25 | 26 | ___ 27 | 28 | 2. DARI BISNIS UNDERSTANDING, BUATLAH ALUR DIAGRAMNYA 29 | jawaban : tugas2.puml 30 | 31 | ___ 32 | 33 | 3. SETELAH ITU BUATLAH PROGRAMNYA 34 | jawaban : tugas3.cpp 35 | 36 | ___ -------------------------------------------------------------------------------- /uas/jawaban_soal_2/source_code/jawaban_jupiter_notebook.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": 1, 6 | "metadata": {}, 7 | "outputs": [], 8 | "source": [ 9 | "def divide(a, b):\n", 10 | " \"\"\"Membagi dua angka dan menangani pembagian dengan nol\"\"\"\n", 11 | " try:\n", 12 | " result = a / b\n", 13 | " except ZeroDivisionError:\n", 14 | " print(\"Error: Tidak bisa membagi dengan nol!\")\n", 15 | " return None\n", 16 | " else:\n", 17 | " return result\n", 18 | " finally:\n", 19 | " print(\"Operasi pembagian selesai.\")" 20 | ] 21 | }, 22 | { 23 | "cell_type": "code", 24 | "execution_count": 2, 25 | "metadata": {}, 26 | "outputs": [ 27 | { 28 | "name": "stdout", 29 | "output_type": "stream", 30 | "text": [ 31 | "Operasi pembagian selesai.\n", 32 | "5.0\n", 33 | "Error: Tidak bisa membagi dengan nol!\n", 34 | "Operasi pembagian selesai.\n", 35 | "None\n" 36 | ] 37 | } 38 | ], 39 | "source": [ 40 | "# Contoh penggunaan\n", 41 | "print(divide(10, 2)) # Output: 5.0\n", 42 | "print(divide(10, 0)) # Output: Error: Tidak bisa membagi dengan nol!" 43 | ] 44 | } 45 | ], 46 | "metadata": { 47 | "kernelspec": { 48 | "display_name": "Python 3", 49 | "language": "python", 50 | "name": "python3" 51 | }, 52 | "language_info": { 53 | "codemirror_mode": { 54 | "name": "ipython", 55 | "version": 3 56 | }, 57 | "file_extension": ".py", 58 | "mimetype": "text/x-python", 59 | "name": "python", 60 | "nbconvert_exporter": "python", 61 | "pygments_lexer": "ipython3", 62 | "version": "3.10.12" 63 | } 64 | }, 65 | "nbformat": 4, 66 | "nbformat_minor": 2 67 | } 68 | -------------------------------------------------------------------------------- /uas/jawaban_soal_2/analisa/jawaban_analisa.md: -------------------------------------------------------------------------------- 1 | ### Fungsi (Function) di Python 2 | 3 | Fungsi adalah blok kode yang dirancang untuk melakukan tugas tertentu. Fungsi membantu membuat kode lebih modular dan mudah dibaca, serta memudahkan untuk melakukan tugas yang berulang tanpa menulis ulang kode 4 | 5 | ```py 6 | def greet(name): 7 | """Mencetak salam kepada pengguna""" 8 | print(f"Hello, {name}!") 9 | 10 | # Memanggil fungsi 11 | greet("Alice") 12 | ``` 13 | 14 | Pada contoh di atas, greet adalah nama fungsi, name adalah parameter, dan fungsi tersebut mencetak pesan salam kepada nama yang diberikan. 15 | 16 | ___ 17 | 18 | ### Exception Handling 19 | Exception handling adalah mekanisme untuk menangani error atau exception yang terjadi saat program dijalankan. Python menggunakan blok try, except, else, dan finally untuk menangani exception. 20 | 21 | - try: Menentukan blok kode yang mungkin menghasilkan exception. 22 | - except: Menangkap dan menangani exception. 23 | - else: Menjalankan kode jika tidak ada exception yang terjadi. 24 | - finally: Menjalankan kode terlepas dari apakah exception terjadi atau tidak. 25 | 26 | Contoh Contoh Exception Handling 27 | ```py 28 | def divide(a, b): 29 | """Membagi dua angka dan menangani pembagian dengan nol""" 30 | try: 31 | result = a / b 32 | except ZeroDivisionError: 33 | print("Error: Tidak bisa membagi dengan nol!") 34 | return None 35 | else: 36 | return result 37 | finally: 38 | print("Operasi pembagian selesai.") 39 | 40 | # Contoh penggunaan 41 | print(divide(10, 2)) # Output: 5.0 42 | print(divide(10, 0)) # Output: Error: Tidak bisa membagi dengan nol! 43 | ``` 44 | 45 | Pada contoh di atas: 46 | 47 | - Blok try mencoba membagi dua angka. 48 | - Jika terjadi ZeroDivisionError (pembagian dengan nol), blok - except menangani error tersebut dan mencetak pesan error. 49 | - Blok else berjalan jika tidak ada exception. 50 | - Blok finally berjalan terlepas dari apakah ada exception atau tidak. -------------------------------------------------------------------------------- /latihan/bab/5/5-3.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | void clearScreen() 6 | { 7 | cout << "\033[2J\033[1;1H"; 8 | } 9 | 10 | int main() 11 | { 12 | int pesanan, jumlah; 13 | 14 | clearScreen(); 15 | cout << "Welcome To My Warteg Gaming" << endl; 16 | cout << "Menu Pilihan" << endl; 17 | cout << "1. Nasi Bakar Pro (Rp 7.000)" << endl; 18 | cout << "2. Ayam Goreng Ultra (Rp. 8.000)" << endl; 19 | cout << "3. Hot Cooler Tea (Rp 5.000)" << endl; 20 | 21 | cout << "Masukkan Pesanan mu : "; 22 | cin >> pesanan; 23 | 24 | cout << "Masukkan Jumlah Pesanan mu : "; 25 | cin >> jumlah; 26 | 27 | if(pesanan == 1) 28 | { 29 | cout << endl; 30 | cout << "Pesanan anda adalah Nasi Bakar Pro sebanyak " << jumlah << " porsi" << endl; 31 | cout << "Harga yang harus dibayar adalah Rp " << jumlah * 7000 << endl; 32 | cout << "Pajak 10% : Rp " << jumlah * 7000 * 0.1 << endl; 33 | cout << "Total yang harus dibayar adalah Rp " << jumlah * 7000 * 1.1 << endl; 34 | } 35 | else if(pesanan == 2) 36 | { 37 | cout << endl; 38 | cout << "Pesanan anda adalah Ayam Goreng Ultra sebanyak " << jumlah << " porsi" << endl; 39 | cout << "Harga yang harus dibayar adalah Rp " << jumlah * 8000 << endl; 40 | cout << "Pajak 10% : Rp " << jumlah * 8000 * 0.1 << endl; 41 | cout << "Total yang harus dibayar adalah Rp " << jumlah * 8000 * 1.1 << endl; 42 | } 43 | else if(pesanan == 3) 44 | { 45 | cout << endl; 46 | cout << "Pesanan anda adalah Hot Cooler Tea sebanyak " << jumlah << " porsi" << endl; 47 | cout << "Harga yang harus dibayar adalah Rp " << jumlah * 5000 << endl; 48 | cout << "Pajak 10% : Rp " << jumlah * 5000 * 0.1 << endl; 49 | cout << "Total yang harus dibayar adalah Rp " << jumlah * 5000 * 1.1 << endl; 50 | } 51 | else 52 | { 53 | cout << "Pesanan tidak tersedia" << endl; 54 | } 55 | 56 | return 0; 57 | } -------------------------------------------------------------------------------- /pert4/tugas.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | void tambah(int a, int b){ 6 | cout << "TAMBAH : " << a + b <> pilih; 32 | 33 | switch (pilih){ 34 | case '1': 35 | cout << "Masukkan Angka 1 : "; 36 | cin >> a; 37 | cout << "Masukkan Angka 2 : "; 38 | cin >> b; 39 | tambah(a, b); 40 | break; 41 | case '2': 42 | cout << "Masukkan Angka 1 : "; 43 | cin >> a; 44 | cout << "Masukkan Angka 2 : "; 45 | cin >> b; 46 | kurang(a, b); 47 | break; 48 | case '3': 49 | cout << "Masukkan Angka 1 : "; 50 | cin >> a; 51 | cout << "Masukkan Angka 2 : "; 52 | cin >> b; 53 | kali(a, b); 54 | break; 55 | case '4': 56 | cout << "Masukkan Angka 1 : "; 57 | cin >> a; 58 | cout << "Masukkan Angka 2 : "; 59 | cin >> b; 60 | bagi(a, b); 61 | break; 62 | case '5': 63 | cout << "EXIT" << endl; 64 | break; 65 | default: 66 | cout << "Pilihan Salah!" << endl; 67 | } 68 | }while(pilih != '5'); 69 | return 0; 70 | } -------------------------------------------------------------------------------- /pert9/rangkuman.md: -------------------------------------------------------------------------------- 1 | ## RANGKUMAN 2 | 3 | ### 1. Definisi 4 | Array (dalam sebuah python) merupakan struktur yang dapat menyimpan dan mengatur set data. Struktur data membicarakan tentang penyimpanan, mengatur, pengelompokan, dan mempresentasikan 5 | 6 | ___ 7 | 8 | ### 2. Set 9 | Set adalah tipe data kolektif yang digunakan untuk menyimpan beberapa nilai unik satu variabel. nilai unik set antara lain : 10 | - set hanya menyimpan nilai unik (bukan duplikat) 11 | - setelah nilai di masukkan ke dalam set, nilai tidak dapat dirubah 12 | - set tidak memiliki urutan, sehingga tidak dapat diakses berdasarkan indeks 13 | 14 | contoh dalam set 15 | 16 | ``` 17 | student_set = {'Huda', 'Lendis', 'wahid'} 18 | print (student_set) 19 | 20 | fruit_set = {['manggo', 'apple']} 21 | print (fruit_set) 22 | ``` 23 | 24 | Outputnya 25 | 26 | ~~~ 27 | {'Huda', 'Lendis', 'wahid'} 28 | {'manggo', 'apple'} 29 | ~~~ 30 | 31 | --- 32 | 33 | #### a. unrordered (set) 34 | Tipe Data set tidak berurut. Bahkan jika kita paksa, kit hanya mendapat pesan error: 35 | ``` 36 | my_set = {'a'} 37 | print(my_set[0]) 38 | ``` 39 | 40 | pesan errornya: 41 | ``` 42 | Traceback (most recent call last) 43 | File "", line 1, in 44 | TypeError: 'set' object is note subscriptable 45 | ``` 46 | 47 | kita bisa juga melihat kode program yang kita bikin awal 48 | ``` 49 | student_set = {'Huda', 'Lendis', 'wahid'} 50 | print (student_set) 51 | ``` 52 | outputnya 53 | ``` 54 | {'Huda', 'Lendis', 'wahid'} 55 | ``` 56 | --- 57 | #### b. Unchangeable (set) 58 | Tipe data set tidak bisa diganti, yang dimana nilai yang telat kita masukkan kedalam set tidak bisa diganti lagi 59 | 60 | perhatikan contoh berikut 61 | ``` 62 | set_fruit = {'manggo', 'apple', True, 1, 2, 3} 63 | 64 | keyboard_= { 65 | (1, 2, 3), 66 | (4, 5, 6), 67 | (7, 8, 9), 68 | (0) 69 | } 70 | ``` 71 | 72 | namun kita tidak dapat menyertakan list sebagai anggota karena list tidak dapat dirubah. perhatikan contoh berikut 73 | ``` 74 | x = set{ 35, 100, ['a', 'b']} 75 | ``` 76 | 77 | pesan error: 78 | ``` 79 | Traceback (most recent call last) 80 | File "", line 1, in 81 | TypeError: unhashable type: 'list' 82 | ``` 83 | --- 84 | #### c. No Duplicate Values (set) 85 | Di python juga tidak bisa menduplikasi suatu nilai. Jika kita memasukkan nilai yang sudah ada di dalam sebuah set, lalu nilai itu akan hanya akan muncul pada nilai yang kita masukkan pertama kali. contoh 86 | ``` 87 | unique_word = { 88 | 'morning', 'this', 'is', 'morning', 'which', 'very', 'bright' 89 | } 90 | 91 | print(unique_word) 92 | ``` -------------------------------------------------------------------------------- /uas/jawaban_soal_4/source_code/jawaban_python.py: -------------------------------------------------------------------------------- 1 | import mysql.connector 2 | from mysql.connector import Error 3 | 4 | def create_connection(): 5 | """Membuat koneksi ke database MariaDB""" 6 | connection = None 7 | try: 8 | connection = mysql.connector.connect( 9 | host='db', # Nama service MariaDB di Docker Compose 10 | database='test_db', 11 | user='user', 12 | password='user_password' 13 | ) 14 | 15 | if connection.is_connected(): 16 | print("Koneksi ke database MariaDB berhasil") 17 | except Error as e: 18 | print(f"Error: '{e}'") 19 | return connection 20 | 21 | def create_table(connection): 22 | """Membuat tabel users""" 23 | create_users_table_query = ''' 24 | CREATE TABLE IF NOT EXISTS users ( 25 | id INT AUTO_INCREMENT PRIMARY KEY, 26 | name VARCHAR(255) NOT NULL, 27 | age INT NOT NULL 28 | ) 29 | ''' 30 | cursor = connection.cursor() 31 | try: 32 | cursor.execute(create_users_table_query) 33 | print("Tabel users berhasil dibuat") 34 | except Error as e: 35 | print(f"Error: '{e}'") 36 | 37 | def insert_user(connection, name, age): 38 | """Menyisipkan data ke tabel users""" 39 | insert_user_query = ''' 40 | INSERT INTO users (name, age) VALUES (%s, %s) 41 | ''' 42 | cursor = connection.cursor() 43 | try: 44 | cursor.execute(insert_user_query, (name, age)) 45 | connection.commit() 46 | print("User berhasil disisipkan") 47 | except Error as e: 48 | print(f"Error: '{e}'") 49 | 50 | def fetch_users(connection): 51 | """Mengambil data dari tabel users""" 52 | fetch_users_query = ''' 53 | SELECT * FROM users 54 | ''' 55 | cursor = connection.cursor() 56 | try: 57 | cursor.execute(fetch_users_query) 58 | rows = cursor.fetchall() 59 | for row in rows: 60 | print(row) 61 | except Error as e: 62 | print(f"Error: '{e}'") 63 | 64 | def main(): 65 | # Membuat koneksi ke database 66 | connection = create_connection() 67 | 68 | if connection.is_connected(): 69 | # Membuat tabel users 70 | create_table(connection) 71 | 72 | # Menyisipkan data ke tabel users 73 | insert_user(connection, 'Alice', 30) 74 | insert_user(connection, 'Bob', 25) 75 | 76 | # Mengambil data dari tabel users 77 | fetch_users(connection) 78 | 79 | # Menutup koneksi 80 | connection.close() 81 | print("Koneksi ke database MariaDB ditutup") 82 | 83 | if __name__ == "__main__": 84 | main() 85 | -------------------------------------------------------------------------------- /pert10/php/docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Destination of env file inside container 4 | ENV_FILE="/var/www/.env" 5 | 6 | # Loop through XDEBUG, PHP_IDE_CONFIG and REMOTE_HOST variables and check if they are set. 7 | # If they are not set then check if we have values for them in the env file, if the env file exists. If we have values 8 | # in the env file then add exports for these in in the ~./bashrc file. 9 | for VAR in XDEBUG PHP_IDE_CONFIG REMOTE_HOST 10 | do 11 | if [ -z "${!VAR}" ] && [ -f "${ENV_FILE}" ]; then 12 | VALUE=$(grep $VAR $ENV_FILE | cut -d '=' -f 2-) 13 | if [ ! -z "${VALUE}" ]; then 14 | # Before adding the export we clear the value, if set, to prevent duplication. 15 | sed -i "/$VAR/d" ~/.bashrc 16 | echo "export $VAR=$VALUE" >> ~/.bashrc; 17 | fi 18 | fi 19 | done 20 | 21 | # Source the .bashrc file so that the exported variables are available. 22 | . ~/.bashrc 23 | 24 | # If there is still no value for the REMOTE_HOST variable then we set it to the default of host.docker.internal. This 25 | # value will be sufficient for windows and mac environments. 26 | if [ -z "${REMOTE_HOST}" ]; then 27 | REMOTE_HOST="host.docker.internal" 28 | sed -i "/REMOTE_HOST/d" ~/.bashrc 29 | echo "export REMOTE_HOST=\"$REMOTE_HOST\"" >> ~/.bashrc; 30 | . ~/.bashrc 31 | fi 32 | 33 | # Start the cron service. 34 | service cron start 35 | 36 | # Toggle xdebug 37 | if [ "true" == "$XDEBUG" ] && [ ! -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini ]; then 38 | # Remove PHP_IDE_CONFIG from cron file so we do not duplicate it when adding below 39 | sed -i '/PHP_IDE_CONFIG/d' /etc/cron.d/laravel-scheduler 40 | if [ ! -z "${PHP_IDE_CONFIG}" ]; then 41 | # Add PHP_IDE_CONFIG to cron file. Cron by default does not load enviromental variables. The server name, set here, is 42 | # used by PHPSTORM for path mappings 43 | echo -e "PHP_IDE_CONFIG=\"$PHP_IDE_CONFIG\"\n$(cat /etc/cron.d/laravel-scheduler)" > /etc/cron.d/laravel-scheduler 44 | fi 45 | # Enable xdebug estension and set up the docker-php-ext-xdebug.ini file with the required xdebug settings 46 | docker-php-ext-enable xdebug && \ 47 | echo "xdebug.remote_enable=1" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini; \ 48 | echo "xdebug.remote_autostart=1" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini; \ 49 | echo "xdebug.remote_connect_back=0" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini; \ 50 | echo "xdebug.remote_host=$REMOTE_HOST" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini; 51 | 52 | elif [ -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini ]; then 53 | # Remove PHP_IDE_CONFIG from cron file if already added 54 | sed -i '/PHP_IDE_CONFIG/d' /etc/cron.d/laravel-scheduler 55 | # Remove Xdebug config file disabling xdebug 56 | rm -rf /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini 57 | fi 58 | 59 | exec "$@" -------------------------------------------------------------------------------- /pert12/php/docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Destination of env file inside container 4 | ENV_FILE="/var/www/.env" 5 | 6 | # Loop through XDEBUG, PHP_IDE_CONFIG and REMOTE_HOST variables and check if they are set. 7 | # If they are not set then check if we have values for them in the env file, if the env file exists. If we have values 8 | # in the env file then add exports for these in in the ~./bashrc file. 9 | for VAR in XDEBUG PHP_IDE_CONFIG REMOTE_HOST 10 | do 11 | if [ -z "${!VAR}" ] && [ -f "${ENV_FILE}" ]; then 12 | VALUE=$(grep $VAR $ENV_FILE | cut -d '=' -f 2-) 13 | if [ ! -z "${VALUE}" ]; then 14 | # Before adding the export we clear the value, if set, to prevent duplication. 15 | sed -i "/$VAR/d" ~/.bashrc 16 | echo "export $VAR=$VALUE" >> ~/.bashrc; 17 | fi 18 | fi 19 | done 20 | 21 | # Source the .bashrc file so that the exported variables are available. 22 | . ~/.bashrc 23 | 24 | # If there is still no value for the REMOTE_HOST variable then we set it to the default of host.docker.internal. This 25 | # value will be sufficient for windows and mac environments. 26 | if [ -z "${REMOTE_HOST}" ]; then 27 | REMOTE_HOST="host.docker.internal" 28 | sed -i "/REMOTE_HOST/d" ~/.bashrc 29 | echo "export REMOTE_HOST=\"$REMOTE_HOST\"" >> ~/.bashrc; 30 | . ~/.bashrc 31 | fi 32 | 33 | # Start the cron service. 34 | service cron start 35 | 36 | # Toggle xdebug 37 | if [ "true" == "$XDEBUG" ] && [ ! -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini ]; then 38 | # Remove PHP_IDE_CONFIG from cron file so we do not duplicate it when adding below 39 | sed -i '/PHP_IDE_CONFIG/d' /etc/cron.d/laravel-scheduler 40 | if [ ! -z "${PHP_IDE_CONFIG}" ]; then 41 | # Add PHP_IDE_CONFIG to cron file. Cron by default does not load enviromental variables. The server name, set here, is 42 | # used by PHPSTORM for path mappings 43 | echo -e "PHP_IDE_CONFIG=\"$PHP_IDE_CONFIG\"\n$(cat /etc/cron.d/laravel-scheduler)" > /etc/cron.d/laravel-scheduler 44 | fi 45 | # Enable xdebug estension and set up the docker-php-ext-xdebug.ini file with the required xdebug settings 46 | docker-php-ext-enable xdebug && \ 47 | echo "xdebug.remote_enable=1" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini; \ 48 | echo "xdebug.remote_autostart=1" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini; \ 49 | echo "xdebug.remote_connect_back=0" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini; \ 50 | echo "xdebug.remote_host=$REMOTE_HOST" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini; 51 | 52 | elif [ -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini ]; then 53 | # Remove PHP_IDE_CONFIG from cron file if already added 54 | sed -i '/PHP_IDE_CONFIG/d' /etc/cron.d/laravel-scheduler 55 | # Remove Xdebug config file disabling xdebug 56 | rm -rf /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini 57 | fi 58 | 59 | exec "$@" -------------------------------------------------------------------------------- /uas/jawaban_soal_5/source_code/php/docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Destination of env file inside container 4 | ENV_FILE="/var/www/.env" 5 | 6 | # Loop through XDEBUG, PHP_IDE_CONFIG and REMOTE_HOST variables and check if they are set. 7 | # If they are not set then check if we have values for them in the env file, if the env file exists. If we have values 8 | # in the env file then add exports for these in in the ~./bashrc file. 9 | for VAR in XDEBUG PHP_IDE_CONFIG REMOTE_HOST 10 | do 11 | if [ -z "${!VAR}" ] && [ -f "${ENV_FILE}" ]; then 12 | VALUE=$(grep $VAR $ENV_FILE | cut -d '=' -f 2-) 13 | if [ ! -z "${VALUE}" ]; then 14 | # Before adding the export we clear the value, if set, to prevent duplication. 15 | sed -i "/$VAR/d" ~/.bashrc 16 | echo "export $VAR=$VALUE" >> ~/.bashrc; 17 | fi 18 | fi 19 | done 20 | 21 | # Source the .bashrc file so that the exported variables are available. 22 | . ~/.bashrc 23 | 24 | # If there is still no value for the REMOTE_HOST variable then we set it to the default of host.docker.internal. This 25 | # value will be sufficient for windows and mac environments. 26 | if [ -z "${REMOTE_HOST}" ]; then 27 | REMOTE_HOST="host.docker.internal" 28 | sed -i "/REMOTE_HOST/d" ~/.bashrc 29 | echo "export REMOTE_HOST=\"$REMOTE_HOST\"" >> ~/.bashrc; 30 | . ~/.bashrc 31 | fi 32 | 33 | # Start the cron service. 34 | service cron start 35 | 36 | # Toggle xdebug 37 | if [ "true" == "$XDEBUG" ] && [ ! -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini ]; then 38 | # Remove PHP_IDE_CONFIG from cron file so we do not duplicate it when adding below 39 | sed -i '/PHP_IDE_CONFIG/d' /etc/cron.d/laravel-scheduler 40 | if [ ! -z "${PHP_IDE_CONFIG}" ]; then 41 | # Add PHP_IDE_CONFIG to cron file. Cron by default does not load enviromental variables. The server name, set here, is 42 | # used by PHPSTORM for path mappings 43 | echo -e "PHP_IDE_CONFIG=\"$PHP_IDE_CONFIG\"\n$(cat /etc/cron.d/laravel-scheduler)" > /etc/cron.d/laravel-scheduler 44 | fi 45 | # Enable xdebug estension and set up the docker-php-ext-xdebug.ini file with the required xdebug settings 46 | docker-php-ext-enable xdebug && \ 47 | echo "xdebug.remote_enable=1" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini; \ 48 | echo "xdebug.remote_autostart=1" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini; \ 49 | echo "xdebug.remote_connect_back=0" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini; \ 50 | echo "xdebug.remote_host=$REMOTE_HOST" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini; 51 | 52 | elif [ -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini ]; then 53 | # Remove PHP_IDE_CONFIG from cron file if already added 54 | sed -i '/PHP_IDE_CONFIG/d' /etc/cron.d/laravel-scheduler 55 | # Remove Xdebug config file disabling xdebug 56 | rm -rf /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini 57 | fi 58 | 59 | exec "$@" -------------------------------------------------------------------------------- /pert7/untitled.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": null, 6 | "metadata": {}, 7 | "outputs": [], 8 | "source": [] 9 | }, 10 | { 11 | "cell_type": "code", 12 | "execution_count": null, 13 | "metadata": {}, 14 | "outputs": [], 15 | "source": [] 16 | }, 17 | { 18 | "cell_type": "code", 19 | "execution_count": null, 20 | "metadata": {}, 21 | "outputs": [], 22 | "source": [] 23 | }, 24 | { 25 | "cell_type": "code", 26 | "execution_count": 1, 27 | "metadata": {}, 28 | "outputs": [], 29 | "source": [ 30 | "from dash import Dash, dcc, html, Input, Output" 31 | ] 32 | }, 33 | { 34 | "cell_type": "code", 35 | "execution_count": 2, 36 | "metadata": {}, 37 | "outputs": [], 38 | "source": [ 39 | "import plotly.express as px\n", 40 | "import numpy as np" 41 | ] 42 | }, 43 | { 44 | "cell_type": "code", 45 | "execution_count": 3, 46 | "metadata": {}, 47 | "outputs": [], 48 | "source": [ 49 | "fig = px.line (\n", 50 | " x = np.array([0,6]),\n", 51 | " y = np.array([0,250]),\n", 52 | " title = \"sample\", height=325\n", 53 | ")" 54 | ] 55 | }, 56 | { 57 | "cell_type": "code", 58 | "execution_count": 4, 59 | "metadata": {}, 60 | "outputs": [], 61 | "source": [ 62 | "app = Dash()" 63 | ] 64 | }, 65 | { 66 | "cell_type": "code", 67 | "execution_count": 5, 68 | "metadata": {}, 69 | "outputs": [], 70 | "source": [ 71 | "app.layout = html.Div([\n", 72 | " dcc.Graph(figure=fig)\n", 73 | "])" 74 | ] 75 | }, 76 | { 77 | "cell_type": "code", 78 | "execution_count": 6, 79 | "metadata": {}, 80 | "outputs": [ 81 | { 82 | "data": { 83 | "text/html": [ 84 | "\n", 85 | " \n", 93 | " " 94 | ], 95 | "text/plain": [ 96 | "" 97 | ] 98 | }, 99 | "metadata": {}, 100 | "output_type": "display_data" 101 | } 102 | ], 103 | "source": [ 104 | "\n", 105 | "app.run_server(debug=True, use_reloader=False)" 106 | ] 107 | } 108 | ], 109 | "metadata": { 110 | "kernelspec": { 111 | "display_name": "Python 3", 112 | "language": "python", 113 | "name": "python3" 114 | }, 115 | "language_info": { 116 | "codemirror_mode": { 117 | "name": "ipython", 118 | "version": 3 119 | }, 120 | "file_extension": ".py", 121 | "mimetype": "text/x-python", 122 | "name": "python", 123 | "nbconvert_exporter": "python", 124 | "pygments_lexer": "ipython3", 125 | "version": "3.10.12" 126 | } 127 | }, 128 | "nbformat": 4, 129 | "nbformat_minor": 2 130 | } 131 | -------------------------------------------------------------------------------- /pert6/array.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "## Pertemuan 6\n", 8 | "\n", 9 | "## Array Basic" 10 | ] 11 | }, 12 | { 13 | "cell_type": "markdown", 14 | "metadata": {}, 15 | "source": [ 16 | "### Array merupakan struktur yang dapat menyimpan dan mengatur data" 17 | ] 18 | }, 19 | { 20 | "cell_type": "code", 21 | "execution_count": 6, 22 | "metadata": {}, 23 | "outputs": [ 24 | { 25 | "name": "stdout", 26 | "output_type": "stream", 27 | "text": [ 28 | "[1, 2, 3]\n", 29 | "1\n", 30 | "2\n", 31 | "3\n" 32 | ] 33 | } 34 | ], 35 | "source": [ 36 | "# list int\n", 37 | "my_list = [1,2,3]\n", 38 | "print(my_list)\n", 39 | "print(my_list[0])\n", 40 | "print(my_list[1])\n", 41 | "print(my_list[2])" 42 | ] 43 | }, 44 | { 45 | "cell_type": "code", 46 | "execution_count": 2, 47 | "metadata": {}, 48 | "outputs": [ 49 | { 50 | "name": "stdout", 51 | "output_type": "stream", 52 | "text": [ 53 | "[]\n" 54 | ] 55 | } 56 | ], 57 | "source": [ 58 | "# empty list\n", 59 | "my_list = []\n", 60 | "print(my_list)" 61 | ] 62 | }, 63 | { 64 | "cell_type": "code", 65 | "execution_count": 7, 66 | "metadata": {}, 67 | "outputs": [ 68 | { 69 | "name": "stdout", 70 | "output_type": "stream", 71 | "text": [ 72 | "[1, 'Hello', 3, 4]\n", 73 | "1\n", 74 | "Hello\n", 75 | "3\n", 76 | "4\n" 77 | ] 78 | } 79 | ], 80 | "source": [ 81 | "# list mixd type data\n", 82 | "my_list = [1, \"Hello\", 3, 4]\n", 83 | "print(my_list)\n", 84 | "print(my_list[0])\n", 85 | "print(my_list[1])\n", 86 | "print(my_list[2])\n", 87 | "print(my_list[3])" 88 | ] 89 | }, 90 | { 91 | "cell_type": "code", 92 | "execution_count": 21, 93 | "metadata": {}, 94 | "outputs": [ 95 | { 96 | "name": "stdout", 97 | "output_type": "stream", 98 | "text": [ 99 | "['mouse', [1, 2, 3, ['ijas', 'bayu', [4, 5, 6]]], ['a']]\n", 100 | "mouse\n", 101 | "5\n", 102 | "a\n" 103 | ] 104 | } 105 | ], 106 | "source": [ 107 | "# nested list\n", 108 | "my_list = [\"mouse\", [1,2,3, [\"ijas\", \"bayu\", [4,5,6]]], ['a']]\n", 109 | "print(my_list)\n", 110 | "print(my_list[0])\n", 111 | "print(my_list[1][3][2][1])\n", 112 | "print(my_list[2][0])" 113 | ] 114 | } 115 | ], 116 | "metadata": { 117 | "kernelspec": { 118 | "display_name": "Python 3", 119 | "language": "python", 120 | "name": "python3" 121 | }, 122 | "language_info": { 123 | "codemirror_mode": { 124 | "name": "ipython", 125 | "version": 3 126 | }, 127 | "file_extension": ".py", 128 | "mimetype": "text/x-python", 129 | "name": "python", 130 | "nbconvert_exporter": "python", 131 | "pygments_lexer": "ipython3", 132 | "version": "3.10.12" 133 | } 134 | }, 135 | "nbformat": 4, 136 | "nbformat_minor": 2 137 | } 138 | -------------------------------------------------------------------------------- /latihan/lat2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | using namespace std; 7 | 8 | void clearScreen() 9 | { 10 | cout << "\033[2J\033[1;1H"; 11 | } 12 | 13 | int main() 14 | { 15 | char pil; 16 | 17 | do { 18 | do { 19 | clearScreen(); 20 | cout << "Selamat Datang di Toko Komik" << endl; 21 | cout << "Daftar Komik Yang Tersedia : " << endl; 22 | cout << endl; 23 | 24 | cout << "No " << setw(25) << left << "Judul Buku" << setw(30) << "Penerbit" << endl; 25 | cout << "1 " << setw(25) << left << "Naruto" << setw(30) << "Shonen Jump" << endl; 26 | cout << "2 " << setw(25) << left << "One Piece" << setw(30) << "Shonen Jump" << endl; 27 | cout << "3 " << setw(25) << left << "Detective Conan" << setw(30) << "Shonen Sunday" << endl; 28 | cout << "4 " << setw(25) << left << "Doraemon" << setw(30) << "Shogakukan" << endl; 29 | cout << "5 " << setw(25) << left << "Dragon Ball" << setw(30) << "Shonen Jump" << endl; 30 | 31 | cout << "Masukkan No Komik : "; 32 | string no; 33 | cin >> no; 34 | 35 | // Membersihkan buffer setelah membaca input 36 | bool valid = true; 37 | for (char ch : no){ 38 | if (!isdigit(ch)){ // kalau huruf isalpha 39 | getchar(); 40 | cout << endl; 41 | cout << "Inputan harus angka" << endl; 42 | cout << "Tap To Continue..."; 43 | valid = false; 44 | break; 45 | } 46 | } 47 | 48 | if (!valid){ 49 | getchar(); 50 | continue; 51 | } 52 | 53 | int noKomik = stoi(no); 54 | 55 | switch (noKomik){ 56 | case 1: 57 | cout << "Anda memilih komik Naruto" << endl; 58 | break; 59 | case 2: 60 | cout << "Anda memilih komik One Piece" << endl; 61 | break; 62 | case 3: 63 | cout << "Anda memilih komik Detective Conan" << endl; 64 | break; 65 | case 4: 66 | cout << "Anda memilih komik Doraemon" << endl; 67 | break; 68 | case 5: 69 | cout << "Anda memilih komik Dragon Ball" << endl; 70 | break; 71 | default: 72 | cout << "No komik tidak ditemukan" << endl; 73 | break; 74 | } 75 | } while (false); 76 | 77 | // Meminta pengguna untuk mengulangi proses atau tidak 78 | do { 79 | cout << "Ingin Mengulangi? (y/Y) : "; 80 | cin >> pil; 81 | 82 | if (!isalpha(pil) || (pil != 'y' && pil != 'Y' && pil != 'n' && pil != 'N')) { 83 | cout << "Input tidak valid. Silakan masukkan Y/y atau N/n." << endl; 84 | } 85 | } while (pil != 'y' && pil != 'Y' && pil != 'n' && pil != 'N'); 86 | 87 | } while (pil == 'y' || pil == 'Y'); 88 | 89 | return 0; 90 | } -------------------------------------------------------------------------------- /uas/jawaban_soal_4/analisa/jawaban_analisa.md: -------------------------------------------------------------------------------- 1 | ### 2 | Untuk berkomunikasi dengan database MariaDB menggunakan bahasa pemrograman Python, dapat menggunakan library mysql-connector-python. Library ini memungkinkan Anda untuk melakukan operasi CRUD (Create, Read, Update, Delete) pada database MariaDB dari aplikasi Python. 3 | 4 | ___ 5 | 6 | ### Langkah-langkah 7 | #### Instalasi library 8 | 9 | ``` 10 | pip install mysql-connector-python 11 | ``` 12 | 13 | #### Docker Compose 14 | buatlah file dengan nama docker-compose.yml lalu pastekan code dibawah 15 | ``` 16 | version: '3.8' 17 | 18 | services: 19 | db: 20 | image: mariadb:10.5 21 | container_name: mariadb 22 | environment: 23 | MYSQL_ROOT_PASSWORD: root_password 24 | MYSQL_DATABASE: test_db 25 | MYSQL_USER: user 26 | MYSQL_PASSWORD: user_password 27 | ports: 28 | - "3306:3306" 29 | volumes: 30 | - db_data:/var/lib/mysql 31 | 32 | app: 33 | image: python:3.9 34 | container_name: python_app 35 | working_dir: /app 36 | volumes: 37 | - ./app:/app 38 | depends_on: 39 | - db 40 | command: ["python", "app.py"] 41 | 42 | volumes: 43 | db_data: 44 | 45 | ``` 46 | 47 | #### Jalankan Docker 48 | Kemudian build dockernya 49 | ``` 50 | docker-compose up -d --build 51 | ``` 52 | 53 | #### Contoh Kode Menggunakan mysql-connector-python 54 | ```py 55 | import mysql.connector 56 | from mysql.connector import Error 57 | 58 | def create_connection(): 59 | """Membuat koneksi ke database MariaDB""" 60 | connection = None 61 | try: 62 | connection = mysql.connector.connect( 63 | host='localhost', 64 | database='test_db', 65 | user='your_username', 66 | password='your_password' 67 | ) 68 | if connection.is_connected(): 69 | print("Koneksi ke database MariaDB berhasil") 70 | except Error as e: 71 | print(f"Error: '{e}'") 72 | return connection 73 | 74 | def create_table(connection): 75 | """Membuat tabel users""" 76 | create_users_table_query = ''' 77 | CREATE TABLE IF NOT EXISTS users ( 78 | id INT AUTO_INCREMENT PRIMARY KEY, 79 | name VARCHAR(255) NOT NULL, 80 | age INT NOT NULL 81 | ) 82 | ''' 83 | cursor = connection.cursor() 84 | try: 85 | cursor.execute(create_users_table_query) 86 | print("Tabel users berhasil dibuat") 87 | except Error as e: 88 | print(f"Error: '{e}'") 89 | 90 | def insert_user(connection, name, age): 91 | """Menyisipkan data ke tabel users""" 92 | insert_user_query = ''' 93 | INSERT INTO users (name, age) VALUES (%s, %s) 94 | ''' 95 | cursor = connection.cursor() 96 | try: 97 | cursor.execute(insert_user_query, (name, age)) 98 | connection.commit() 99 | print("User berhasil disisipkan") 100 | except Error as e: 101 | print(f"Error: '{e}'") 102 | 103 | def fetch_users(connection): 104 | """Mengambil data dari tabel users""" 105 | fetch_users_query = ''' 106 | SELECT * FROM users 107 | ''' 108 | cursor = connection.cursor() 109 | try: 110 | cursor.execute(fetch_users_query) 111 | rows = cursor.fetchall() 112 | for row in rows: 113 | print(row) 114 | except Error as e: 115 | print(f"Error: '{e}'") 116 | 117 | def main(): 118 | # Membuat koneksi ke database 119 | connection = create_connection() 120 | 121 | if connection.is_connected(): 122 | # Membuat tabel users 123 | create_table(connection) 124 | 125 | # Menyisipkan data ke tabel users 126 | insert_user(connection, 'Alice', 30) 127 | insert_user(connection, 'Bob', 25) 128 | 129 | # Mengambil data dari tabel users 130 | fetch_users(connection) 131 | 132 | # Menutup koneksi 133 | connection.close() 134 | print("Koneksi ke database MariaDB ditutup") 135 | 136 | if __name__ == "__main__": 137 | main() 138 | 139 | ``` 140 | 141 | -------------------------------------------------------------------------------- /pert8/tugas3.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | using namespace std; 6 | 7 | class Doctor { 8 | public: 9 | Doctor(string name, string specialty) : name(name), specialty(specialty) {} 10 | 11 | string getName() const { return name; } 12 | string getSpecialty() const { return specialty; } 13 | 14 | private: 15 | string name; 16 | string specialty; 17 | }; 18 | 19 | class Appointment { 20 | public: 21 | Appointment(string patientName, string doctorName, string time) 22 | : patientName(patientName), doctorName(doctorName), time(time) {} 23 | 24 | string getPatientName() const { return patientName; } 25 | string getDoctorName() const { return doctorName; } 26 | string getTime() const { return time; } 27 | 28 | private: 29 | string patientName; 30 | string doctorName; 31 | string time; 32 | }; 33 | 34 | class MedicalScheduler { 35 | public: 36 | void addDoctor(string name, string specialty) { 37 | doctors.push_back(Doctor(name, specialty)); 38 | } 39 | 40 | bool doctorExists(string name) { 41 | for (const auto& doctor : doctors) { 42 | if (doctor.getName() == name) { 43 | return true; 44 | } 45 | } 46 | return false; 47 | } 48 | 49 | void showDoctors() { 50 | cout << "List of Doctors:\n"; 51 | for (const auto& doctor : doctors) { 52 | cout << "Name: " << doctor.getName() << ", Specialty: " << doctor.getSpecialty() << endl; 53 | } 54 | } 55 | 56 | void scheduleAppointment(string patientName, string doctorName, string time) { 57 | if (!doctorExists(doctorName)) { 58 | cout << "Doctor not found.\n"; 59 | return; 60 | } 61 | appointments.push_back(Appointment(patientName, doctorName, time)); 62 | } 63 | 64 | void showAppointments() { 65 | cout << "Scheduled Appointments:\n"; 66 | for (const auto& appointment : appointments) { 67 | cout << "Patient: " << appointment.getPatientName() << ", Doctor: " << appointment.getDoctorName() 68 | << ", Time: " << appointment.getTime() << endl; 69 | } 70 | } 71 | 72 | private: 73 | vector doctors; 74 | vector appointments; 75 | }; 76 | 77 | int main() { 78 | MedicalScheduler scheduler; 79 | scheduler.addDoctor("Dr. Jinsu", "Umum"); 80 | scheduler.addDoctor("Dr. Qaiaa", "Gigi"); 81 | scheduler.addDoctor("Dr. Kimuji", "Mata"); 82 | scheduler.addDoctor("Dr. Sanuri", "Bedah"); 83 | 84 | int choice; 85 | do { 86 | cout << "\n1. Show Doctors\n"; 87 | cout << "2. Schedule an appointment\n"; 88 | cout << "3. Show appointments\n"; 89 | cout << "4. Exit\n"; 90 | cout << "Enter your choice: "; 91 | cin >> choice; 92 | 93 | switch (choice) { 94 | case 1: 95 | scheduler.showDoctors(); 96 | break; 97 | case 2: { 98 | string patientName, doctorName, time; 99 | cout << "Enter patient name: "; 100 | cin.ignore(); 101 | getline(cin, patientName); 102 | cout << "Enter doctor name: "; 103 | getline(cin, doctorName); 104 | if (!scheduler.doctorExists(doctorName)) { 105 | cout << "Doctor not found. Please try again.\n"; 106 | break; 107 | } 108 | cout << "Enter appointment time (am/pm): "; 109 | getline(cin, time); 110 | scheduler.scheduleAppointment(patientName, doctorName, time); 111 | cout << "Appointment scheduled successfully.\n"; 112 | break; 113 | } 114 | case 3: 115 | scheduler.showAppointments(); 116 | break; 117 | case 4: 118 | cout << "Exiting...\n"; 119 | break; 120 | default: 121 | cout << "Invalid choice, please try again.\n"; 122 | } 123 | } while (choice != 4); 124 | 125 | return 0; 126 | } 127 | -------------------------------------------------------------------------------- /pert3/tipedata.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": 2, 6 | "metadata": {}, 7 | "outputs": [ 8 | { 9 | "name": "stdout", 10 | "output_type": "stream", 11 | "text": [ 12 | "\n" 13 | ] 14 | } 15 | ], 16 | "source": [ 17 | "a = 1\n", 18 | "\n", 19 | "print(type(a))\n" 20 | ] 21 | }, 22 | { 23 | "cell_type": "markdown", 24 | "metadata": {}, 25 | "source": [ 26 | "- contoh tipe data string (str)" 27 | ] 28 | }, 29 | { 30 | "cell_type": "code", 31 | "execution_count": 3, 32 | "metadata": {}, 33 | "outputs": [ 34 | { 35 | "name": "stdout", 36 | "output_type": "stream", 37 | "text": [ 38 | "\n" 39 | ] 40 | } 41 | ], 42 | "source": [ 43 | "a = 'tes'\n", 44 | "\n", 45 | "print(type(a))" 46 | ] 47 | }, 48 | { 49 | "cell_type": "code", 50 | "execution_count": 5, 51 | "metadata": {}, 52 | "outputs": [ 53 | { 54 | "name": "stdout", 55 | "output_type": "stream", 56 | "text": [ 57 | "\n" 58 | ] 59 | } 60 | ], 61 | "source": [ 62 | "a = \"tes\"\n", 63 | "\n", 64 | "print(type(a))" 65 | ] 66 | }, 67 | { 68 | "cell_type": "markdown", 69 | "metadata": {}, 70 | "source": [ 71 | "- contoh tipe data float" 72 | ] 73 | }, 74 | { 75 | "cell_type": "code", 76 | "execution_count": 6, 77 | "metadata": {}, 78 | "outputs": [ 79 | { 80 | "name": "stdout", 81 | "output_type": "stream", 82 | "text": [ 83 | "\n" 84 | ] 85 | } 86 | ], 87 | "source": [ 88 | "a = 3.14\n", 89 | "print(type(a))" 90 | ] 91 | }, 92 | { 93 | "cell_type": "markdown", 94 | "metadata": {}, 95 | "source": [ 96 | "- contoh tipe data complex" 97 | ] 98 | }, 99 | { 100 | "cell_type": "code", 101 | "execution_count": 7, 102 | "metadata": {}, 103 | "outputs": [ 104 | { 105 | "name": "stdout", 106 | "output_type": "stream", 107 | "text": [ 108 | "\n" 109 | ] 110 | } 111 | ], 112 | "source": [ 113 | "a = 1j\n", 114 | "print(type(a))" 115 | ] 116 | }, 117 | { 118 | "cell_type": "markdown", 119 | "metadata": {}, 120 | "source": [ 121 | "- JELASKAN MAKSUD DARI PENERAPAN VARIBEL TERKAIT TIPE DATA INT DIBAWAH INI" 122 | ] 123 | }, 124 | { 125 | "cell_type": "code", 126 | "execution_count": 8, 127 | "metadata": {}, 128 | "outputs": [ 129 | { 130 | "name": "stdout", 131 | "output_type": "stream", 132 | "text": [ 133 | "2\n", 134 | "2\n" 135 | ] 136 | } 137 | ], 138 | "source": [ 139 | "a = 2 \n", 140 | "b = int(2)\n", 141 | "\n", 142 | "print(a)\n", 143 | "print(b)" 144 | ] 145 | }, 146 | { 147 | "cell_type": "code", 148 | "execution_count": 15, 149 | "metadata": {}, 150 | "outputs": [ 151 | { 152 | "name": "stdout", 153 | "output_type": "stream", 154 | "text": [ 155 | "1 - Hari.senin\n", 156 | "2 - Hari.selasa\n", 157 | "3 - Hari.rabu\n", 158 | "4 - Hari.kamis\n", 159 | "5 - Hari.jumat\n", 160 | "6 - Hari.sabtu\n", 161 | "7 - Hari.minggu\n" 162 | ] 163 | } 164 | ], 165 | "source": [ 166 | "from enum import Enum\n", 167 | "\n", 168 | "class Hari(Enum):\n", 169 | " senin = 1\n", 170 | " selasa = 2\n", 171 | " rabu = 3\n", 172 | " kamis = 4\n", 173 | " jumat = 5\n", 174 | " sabtu = 6\n", 175 | " minggu = 7\n", 176 | " \n", 177 | "for Hari in ((((((((((((((((((((((((((((Hari)))))))))))))))))))))))))))):\n", 178 | " print(Hari.value, \"-\", Hari)\n", 179 | " " 180 | ] 181 | } 182 | ], 183 | "metadata": { 184 | "kernelspec": { 185 | "display_name": "Python 3", 186 | "language": "python", 187 | "name": "python3" 188 | }, 189 | "language_info": { 190 | "codemirror_mode": { 191 | "name": "ipython", 192 | "version": 3 193 | }, 194 | "file_extension": ".py", 195 | "mimetype": "text/x-python", 196 | "name": "python", 197 | "nbconvert_exporter": "python", 198 | "pygments_lexer": "ipython3", 199 | "version": "3.10.12" 200 | } 201 | }, 202 | "nbformat": 4, 203 | "nbformat_minor": 2 204 | } 205 | -------------------------------------------------------------------------------- /pert1/Readme.md: -------------------------------------------------------------------------------- 1 | ## Praktikum 2 | ``` 3 | Pada pertemuan pertama, saya memulai dengan proses instalasi Windows Subsystem for Linux (WSL), Ubuntu, dan Docker. 4 | 5 | Setelah berhasil menginstal WSL Ubuntu, langkah selanjutnya adalah melakukan konfigurasi terminal Ubuntu untuk memastikan kenyamanan penggunaan. 6 | 7 | saya mempelajari beberapa command line dasar Linux untuk membiasakan diri dengan lingkungan terminal, membantu dalam navigasi, manajemen file, dan administrasi sistem. Menjelang akhir pertemuan, saya mempelajari cara menginstal plugin Zsh untuk meningkatkan fungsionalitas dan tampilan terminal, menciptakan pengalaman pengguna yang lebih menyenangkan dan efisien. 8 | 9 | Dengan demikian, dari langkah awal instalasi hingga peningkatan pengalaman pengguna dengan plugin Zsh, pertemuan pertama ini memberikan landasan yang kuat untuk memulai perjalanan saya dalam menguasai lingkungan pengembangan Linux. 10 | ``` 11 | 12 | ## TEORI 13 | 14 | ### Pengenalan Bahasa Pemrograman 15 | 16 | *Bahasa pemrograman adalah aturan atau kumpulan instruksi yang digunakan oleh programmer untuk memberikan komputer arahan tentang cara melakukan tugas tertentu. Ini adalah sarana untuk berkomunikasi dengan komputer, memungkinkan programmer untuk merancang, mengembangkan, dan mengontrol perilaku program komputer. Dengan menggunakan bahasa pemrograman, programmer dapat membuat perangkat lunak, aplikasi web, permainan, dan banyak lagi* 17 | 18 | ___ 19 | 20 | ### Jenis-jenis Bahasa Pemrograman 21 | 22 | 1. **Bahasa Pemrograman Tingkat Tinggi (High-Level Programming Languages)**: Bahasa pemrograman yang lebih mudah dipahami oleh manusia dan lebih independen terhadap arsitektur perangkat keras. Contohnya termasuk Python, Java, dan C++. 23 | 24 | 2. **Bahasa Pemrograman Tingkat Rendah (Low-Level Programming Languages)**: Bahasa pemrograman yang lebih dekat dengan bahasa mesin dan lebih tergantung pada arsitektur perangkat keras. Contoh utamanya adalah Bahasa Rakitan (Assembly Language). 25 | 26 | 3. **Bahasa Pemrograman Interpretatif (Interpreted Programming Languages)**: Bahasa pemrograman di mana instruksi dieksekusi baris per baris oleh interpreter, tanpa perlu mengompilasi menjadi kode mesin terlebih dahulu. Contohnya adalah Python dan JavaScript. 27 | 28 | 4. **Bahasa Pemrograman Kompilatif (Compiled Programming Languages)**: Bahasa pemrograman di mana kode program dikompilasi menjadi kode mesin sebelum dieksekusi. Ini meningkatkan kinerja tetapi memerlukan langkah kompilasi sebelum menjalankan program. Contoh termasuk C, C++, dan Go. 29 | 30 | 5. **Bahasa Pemrograman Fungsional (Functional Programming Languages)**: Bahasa pemrograman yang berfokus pada fungsi sebagai unit utama pemrograman. Mereka mendorong paradigma pemrograman deklaratif dan penggunaan fungsi murni tanpa efek samping. Contoh termasuk Haskell dan Scala. 31 | 32 | 6. **Bahasa Pemrograman Berorientasi Objek (Object-Oriented Programming Languages)**: Bahasa pemrograman yang memungkinkan pemodelan dunia nyata dengan mengorganisasi kode ke dalam objek yang memiliki atribut dan metode. Contoh termasuk Java, C++, dan Python. 33 | 34 | 7. **Bahasa Pemrograman Skrip (Scripting Programming Languages)**: Bahasa pemrograman yang dirancang untuk menulis skrip yang menjalankan tugas-tugas tertentu dalam berbagai konteks, seperti otomatisasi administrasi sistem atau pengembangan web. Contoh termasuk Python, Ruby, dan Perl. 35 | 36 | Setiap jenis bahasa pemrograman memiliki karakteristik dan kegunaannya sendiri, dan pilihan bahasa pemrograman yang tepat tergantung pada kebutuhan dan tujuan proyek yang sedang dihadapi. 37 | 38 | ___ 39 | 40 | ### Paradigma Pemrograman 41 | 42 | *kerangka pemikiran atau pendekatan sistematis untuk memandu proses pemrograman komputer. Ini mencakup seperangkat aturan, prinsip, dan konsep yang membentuk cara pemrogram melakukan perencanaan, pembuatan, dan implementasi perangkat lunak. Paradigma pemrograman memengaruhi cara programmer memandang masalah, merancang solusi, dan mengekspresikan instruksi kepada komputer.* 43 | 44 | ___ 45 | 46 | ### Jenis-jenis Paradigma Pemrograman 47 | 48 | 1. Imperatif: Berfokus pada urutan langkah-langkah yang harus diambil untuk mencapai hasil tertentu. Contoh: bahasa C. 49 | > :memo: **Note:** Imperatif atau biasa dikenal dengan prosedural. 50 | 2. Fungsional: Berfokus pada penggunaan fungsi sebagai unit utama komputasi, dengan penekanan pada penghindaran perubahan keadaan dan efek samping. Contoh: Haskell, Scala. 51 | 3. Berorientasi Objek: Berfokus pada pemodelan dunia nyata dengan mengorganisir kode ke dalam objek yang memiliki atribut dan metode. Contoh: Java, Python. 52 | 4. Deklaratif: Berfokus pada mendeskripsikan apa yang harus dicapai tanpa menentukan langkah-langkah spesifik. Contoh: SQL untuk basis data. 53 | -------------------------------------------------------------------------------- /pert10/php/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM php:8.1-fpm 2 | 3 | ENV PS1="\u@\h:\w\\$ " 4 | ENV TZ="Asia/Jakarta" 5 | 6 | ENV COMPOSER_MEMORY_LIMIT='-1' 7 | 8 | RUN apt-get update && \ 9 | apt-get install -y --force-yes --no-install-recommends \ 10 | libmemcached-dev \ 11 | libmcrypt-dev \ 12 | libreadline-dev \ 13 | libgmp-dev \ 14 | libzip-dev \ 15 | libz-dev \ 16 | libpq-dev \ 17 | libjpeg-dev \ 18 | libpng-dev \ 19 | libfreetype6-dev \ 20 | libssl-dev \ 21 | openssh-server \ 22 | libmagickwand-dev \ 23 | git \ 24 | cron \ 25 | nano \ 26 | libxml2-dev \ 27 | nodejs \ 28 | npm 29 | 30 | # Install soap extention 31 | RUN docker-php-ext-install soap 32 | 33 | # Install for image manipulationdock 34 | RUN docker-php-ext-install exif 35 | 36 | # Install the PHP pcntl extention 37 | RUN docker-php-ext-install pcntl 38 | 39 | # Install the PHP intl extention 40 | RUN docker-php-ext-install intl 41 | 42 | # Install the PHP gmp extention 43 | RUN docker-php-ext-install gmp 44 | 45 | # Install the PHP zip extention 46 | RUN docker-php-ext-install zip 47 | 48 | # Install the PHP pdo_mysql extention 49 | RUN docker-php-ext-install pdo_mysql 50 | 51 | # Install the PHP pdo_pgsql extention 52 | RUN docker-php-ext-install pdo_pgsql 53 | 54 | # Install the PHP bcmath extension 55 | RUN docker-php-ext-install bcmath 56 | 57 | ##################################### 58 | # PHPRedis: 59 | ##################################### 60 | RUN pecl install redis && docker-php-ext-enable redis 61 | RUN pecl install mongodb && docker-php-ext-enable mongodb 62 | ##################################### 63 | # Imagick: 64 | ##################################### 65 | 66 | RUN pecl install imagick && \ 67 | docker-php-ext-enable imagick 68 | 69 | ##################################### 70 | # GD: 71 | ##################################### 72 | 73 | # Install the PHP gd library 74 | RUN docker-php-ext-install gd && \ 75 | # docker-php-ext-configure gd \ 76 | # --with-jpeg-dir 77 | # --with-freetype-dir=/usr/include/freetype2 && \ 78 | docker-php-ext-configure gd --with-freetype --with-jpeg && \ 79 | docker-php-ext-install gd 80 | ##################################### 81 | # xDebug: 82 | ##################################### 83 | 84 | # Install the xdebug extension 85 | RUN pecl install xdebug 86 | 87 | ##################################### 88 | # PHP Memcached: 89 | ##################################### 90 | 91 | # Install the php memcached extension 92 | RUN pecl install memcached && docker-php-ext-enable memcached 93 | 94 | ##################################### 95 | # Composer: 96 | ##################################### 97 | 98 | # Install composer and add its bin to the PATH. 99 | RUN curl -s http://getcomposer.org/installer | php && \ 100 | echo "export PATH=${PATH}:/var/www/vendor/bin" >> ~/.bashrc && \ 101 | mv composer.phar /usr/local/bin/composer 102 | # Source the bash 103 | RUN . ~/.bashrc 104 | 105 | ##################################### 106 | # Laravel Schedule Cron Job: 107 | ##################################### 108 | 109 | RUN echo "* * * * * root /usr/local/bin/php /var/www/artisan schedule:run >> /dev/null 2>&1" >> /etc/cron.d/laravel-scheduler 110 | RUN chmod 0644 /etc/cron.d/laravel-scheduler 111 | 112 | # 113 | #-------------------------------------------------------------------------- 114 | # Final Touch 115 | #-------------------------------------------------------------------------- 116 | # 117 | 118 | ADD ./local.ini /usr/local/etc/php/conf.d 119 | 120 | ##################################### 121 | # Aliases: 122 | ##################################### 123 | # docker-compose exec php-fpm dep --> locally installed Deployer binaries 124 | RUN echo '#!/bin/bash\n/usr/local/bin/php /var/www/vendor/bin/dep "$@"' > /usr/bin/dep 125 | RUN chmod +x /usr/bin/dep 126 | # docker-compose exec php-fpm art --> php artisan 127 | RUN echo '#!/bin/bash\n/usr/local/bin/php /var/www/artisan "$@"' > /usr/bin/art 128 | RUN chmod +x /usr/bin/art 129 | # docker-compose exec php-fpm migrate --> php artisan migrate 130 | RUN echo '#!/bin/bash\n/usr/local/bin/php /var/www/artisan migrate "$@"' > /usr/bin/migrate 131 | RUN chmod +x /usr/bin/migrate 132 | # docker-compose exec php-fpm fresh --> php artisan migrate:fresh --seed 133 | RUN echo '#!/bin/bash\n/usr/local/bin/php /var/www/artisan migrate:fresh --seed' > /usr/bin/fresh 134 | RUN chmod +x /usr/bin/fresh 135 | # docker-compose exec php-fpm t --> run the tests for the project and generate testdox 136 | RUN echo '#!/bin/bash\n/usr/local/bin/php /var/www/artisan config:clear\n/var/www/vendor/bin/phpunit -d memory_limit=2G --stop-on-error --stop-on-failure --testdox-text=tests/report.txt "$@"' > /usr/bin/t 137 | RUN chmod +x /usr/bin/t 138 | # docker-compose exec php-fpm d --> run the Laravel Dusk browser tests for the project 139 | RUN echo '#!/bin/bash\n/usr/local/bin/php /var/www/artisan config:clear\n/bin/bash\n/usr/local/bin/php /var/www/artisan dusk -d memory_limit=2G --stop-on-error --stop-on-failure --testdox-text=tests/report-dusk.txt "$@"' > /usr/bin/d 140 | RUN chmod +x /usr/bin/d 141 | 142 | RUN rm -r /var/lib/apt/lists/* 143 | 144 | WORKDIR /var/www 145 | 146 | COPY ./docker-entrypoint.sh /usr/local/bin/ 147 | RUN chmod +x /usr/local/bin/docker-entrypoint.sh 148 | RUN ln -s /usr/local/bin/docker-entrypoint.sh / 149 | ENTRYPOINT ["docker-entrypoint.sh"] 150 | 151 | EXPOSE 9000 152 | CMD ["php-fpm"] -------------------------------------------------------------------------------- /pert12/php/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM php:8.1-fpm 2 | 3 | ENV PS1="\u@\h:\w\\$ " 4 | ENV TZ="Asia/Jakarta" 5 | 6 | ENV COMPOSER_MEMORY_LIMIT='-1' 7 | 8 | RUN apt-get update && \ 9 | apt-get install -y --force-yes --no-install-recommends \ 10 | libmemcached-dev \ 11 | libmcrypt-dev \ 12 | libreadline-dev \ 13 | libgmp-dev \ 14 | libzip-dev \ 15 | libz-dev \ 16 | libpq-dev \ 17 | libjpeg-dev \ 18 | libpng-dev \ 19 | libfreetype6-dev \ 20 | libssl-dev \ 21 | openssh-server \ 22 | libmagickwand-dev \ 23 | git \ 24 | cron \ 25 | nano \ 26 | libxml2-dev \ 27 | nodejs \ 28 | npm 29 | 30 | # Install soap extention 31 | RUN docker-php-ext-install soap 32 | 33 | # Install for image manipulationdock 34 | RUN docker-php-ext-install exif 35 | 36 | # Install the PHP pcntl extention 37 | RUN docker-php-ext-install pcntl 38 | 39 | # Install the PHP intl extention 40 | RUN docker-php-ext-install intl 41 | 42 | # Install the PHP gmp extention 43 | RUN docker-php-ext-install gmp 44 | 45 | # Install the PHP zip extention 46 | RUN docker-php-ext-install zip 47 | 48 | # Install the PHP pdo_mysql extention 49 | RUN docker-php-ext-install pdo_mysql 50 | 51 | # Install the PHP pdo_pgsql extention 52 | RUN docker-php-ext-install pdo_pgsql 53 | 54 | # Install the PHP bcmath extension 55 | RUN docker-php-ext-install bcmath 56 | 57 | ##################################### 58 | # PHPRedis: 59 | ##################################### 60 | RUN pecl install redis && docker-php-ext-enable redis 61 | RUN pecl install mongodb && docker-php-ext-enable mongodb 62 | ##################################### 63 | # Imagick: 64 | ##################################### 65 | 66 | RUN pecl install imagick && \ 67 | docker-php-ext-enable imagick 68 | 69 | ##################################### 70 | # GD: 71 | ##################################### 72 | 73 | # Install the PHP gd library 74 | RUN docker-php-ext-install gd && \ 75 | # docker-php-ext-configure gd \ 76 | # --with-jpeg-dir 77 | # --with-freetype-dir=/usr/include/freetype2 && \ 78 | docker-php-ext-configure gd --with-freetype --with-jpeg && \ 79 | docker-php-ext-install gd 80 | ##################################### 81 | # xDebug: 82 | ##################################### 83 | 84 | # Install the xdebug extension 85 | RUN pecl install xdebug 86 | 87 | ##################################### 88 | # PHP Memcached: 89 | ##################################### 90 | 91 | # Install the php memcached extension 92 | RUN pecl install memcached && docker-php-ext-enable memcached 93 | 94 | ##################################### 95 | # Composer: 96 | ##################################### 97 | 98 | # Install composer and add its bin to the PATH. 99 | RUN curl -s http://getcomposer.org/installer | php && \ 100 | echo "export PATH=${PATH}:/var/www/vendor/bin" >> ~/.bashrc && \ 101 | mv composer.phar /usr/local/bin/composer 102 | # Source the bash 103 | RUN . ~/.bashrc 104 | 105 | ##################################### 106 | # Laravel Schedule Cron Job: 107 | ##################################### 108 | 109 | RUN echo "* * * * * root /usr/local/bin/php /var/www/artisan schedule:run >> /dev/null 2>&1" >> /etc/cron.d/laravel-scheduler 110 | RUN chmod 0644 /etc/cron.d/laravel-scheduler 111 | 112 | # 113 | #-------------------------------------------------------------------------- 114 | # Final Touch 115 | #-------------------------------------------------------------------------- 116 | # 117 | 118 | ADD ./local.ini /usr/local/etc/php/conf.d 119 | 120 | ##################################### 121 | # Aliases: 122 | ##################################### 123 | # docker-compose exec php-fpm dep --> locally installed Deployer binaries 124 | RUN echo '#!/bin/bash\n/usr/local/bin/php /var/www/vendor/bin/dep "$@"' > /usr/bin/dep 125 | RUN chmod +x /usr/bin/dep 126 | # docker-compose exec php-fpm art --> php artisan 127 | RUN echo '#!/bin/bash\n/usr/local/bin/php /var/www/artisan "$@"' > /usr/bin/art 128 | RUN chmod +x /usr/bin/art 129 | # docker-compose exec php-fpm migrate --> php artisan migrate 130 | RUN echo '#!/bin/bash\n/usr/local/bin/php /var/www/artisan migrate "$@"' > /usr/bin/migrate 131 | RUN chmod +x /usr/bin/migrate 132 | # docker-compose exec php-fpm fresh --> php artisan migrate:fresh --seed 133 | RUN echo '#!/bin/bash\n/usr/local/bin/php /var/www/artisan migrate:fresh --seed' > /usr/bin/fresh 134 | RUN chmod +x /usr/bin/fresh 135 | # docker-compose exec php-fpm t --> run the tests for the project and generate testdox 136 | RUN echo '#!/bin/bash\n/usr/local/bin/php /var/www/artisan config:clear\n/var/www/vendor/bin/phpunit -d memory_limit=2G --stop-on-error --stop-on-failure --testdox-text=tests/report.txt "$@"' > /usr/bin/t 137 | RUN chmod +x /usr/bin/t 138 | # docker-compose exec php-fpm d --> run the Laravel Dusk browser tests for the project 139 | RUN echo '#!/bin/bash\n/usr/local/bin/php /var/www/artisan config:clear\n/bin/bash\n/usr/local/bin/php /var/www/artisan dusk -d memory_limit=2G --stop-on-error --stop-on-failure --testdox-text=tests/report-dusk.txt "$@"' > /usr/bin/d 140 | RUN chmod +x /usr/bin/d 141 | 142 | RUN rm -r /var/lib/apt/lists/* 143 | 144 | WORKDIR /var/www 145 | 146 | COPY ./docker-entrypoint.sh /usr/local/bin/ 147 | RUN chmod +x /usr/local/bin/docker-entrypoint.sh 148 | RUN ln -s /usr/local/bin/docker-entrypoint.sh / 149 | ENTRYPOINT ["docker-entrypoint.sh"] 150 | 151 | EXPOSE 9000 152 | CMD ["php-fpm"] -------------------------------------------------------------------------------- /uas/jawaban_soal_5/source_code/php/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM php:8.1-fpm 2 | 3 | ENV PS1="\u@\h:\w\\$ " 4 | ENV TZ="Asia/Jakarta" 5 | 6 | ENV COMPOSER_MEMORY_LIMIT='-1' 7 | 8 | RUN apt-get update && \ 9 | apt-get install -y --force-yes --no-install-recommends \ 10 | libmemcached-dev \ 11 | libmcrypt-dev \ 12 | libreadline-dev \ 13 | libgmp-dev \ 14 | libzip-dev \ 15 | libz-dev \ 16 | libpq-dev \ 17 | libjpeg-dev \ 18 | libpng-dev \ 19 | libfreetype6-dev \ 20 | libssl-dev \ 21 | openssh-server \ 22 | libmagickwand-dev \ 23 | git \ 24 | cron \ 25 | nano \ 26 | libxml2-dev \ 27 | nodejs \ 28 | npm 29 | 30 | # Install soap extention 31 | RUN docker-php-ext-install soap 32 | 33 | # Install for image manipulationdock 34 | RUN docker-php-ext-install exif 35 | 36 | # Install the PHP pcntl extention 37 | RUN docker-php-ext-install pcntl 38 | 39 | # Install the PHP intl extention 40 | RUN docker-php-ext-install intl 41 | 42 | # Install the PHP gmp extention 43 | RUN docker-php-ext-install gmp 44 | 45 | # Install the PHP zip extention 46 | RUN docker-php-ext-install zip 47 | 48 | # Install the PHP pdo_mysql extention 49 | RUN docker-php-ext-install pdo_mysql 50 | 51 | # Install the PHP pdo_pgsql extention 52 | RUN docker-php-ext-install pdo_pgsql 53 | 54 | # Install the PHP bcmath extension 55 | RUN docker-php-ext-install bcmath 56 | 57 | ##################################### 58 | # PHPRedis: 59 | ##################################### 60 | RUN pecl install redis && docker-php-ext-enable redis 61 | RUN pecl install mongodb && docker-php-ext-enable mongodb 62 | ##################################### 63 | # Imagick: 64 | ##################################### 65 | 66 | RUN pecl install imagick && \ 67 | docker-php-ext-enable imagick 68 | 69 | ##################################### 70 | # GD: 71 | ##################################### 72 | 73 | # Install the PHP gd library 74 | RUN docker-php-ext-install gd && \ 75 | # docker-php-ext-configure gd \ 76 | # --with-jpeg-dir 77 | # --with-freetype-dir=/usr/include/freetype2 && \ 78 | docker-php-ext-configure gd --with-freetype --with-jpeg && \ 79 | docker-php-ext-install gd 80 | ##################################### 81 | # xDebug: 82 | ##################################### 83 | 84 | # Install the xdebug extension 85 | RUN pecl install xdebug 86 | 87 | ##################################### 88 | # PHP Memcached: 89 | ##################################### 90 | 91 | # Install the php memcached extension 92 | RUN pecl install memcached && docker-php-ext-enable memcached 93 | 94 | ##################################### 95 | # Composer: 96 | ##################################### 97 | 98 | # Install composer and add its bin to the PATH. 99 | RUN curl -s http://getcomposer.org/installer | php && \ 100 | echo "export PATH=${PATH}:/var/www/vendor/bin" >> ~/.bashrc && \ 101 | mv composer.phar /usr/local/bin/composer 102 | # Source the bash 103 | RUN . ~/.bashrc 104 | 105 | ##################################### 106 | # Laravel Schedule Cron Job: 107 | ##################################### 108 | 109 | RUN echo "* * * * * root /usr/local/bin/php /var/www/artisan schedule:run >> /dev/null 2>&1" >> /etc/cron.d/laravel-scheduler 110 | RUN chmod 0644 /etc/cron.d/laravel-scheduler 111 | 112 | # 113 | #-------------------------------------------------------------------------- 114 | # Final Touch 115 | #-------------------------------------------------------------------------- 116 | # 117 | 118 | ADD ./local.ini /usr/local/etc/php/conf.d 119 | 120 | ##################################### 121 | # Aliases: 122 | ##################################### 123 | # docker-compose exec php-fpm dep --> locally installed Deployer binaries 124 | RUN echo '#!/bin/bash\n/usr/local/bin/php /var/www/vendor/bin/dep "$@"' > /usr/bin/dep 125 | RUN chmod +x /usr/bin/dep 126 | # docker-compose exec php-fpm art --> php artisan 127 | RUN echo '#!/bin/bash\n/usr/local/bin/php /var/www/artisan "$@"' > /usr/bin/art 128 | RUN chmod +x /usr/bin/art 129 | # docker-compose exec php-fpm migrate --> php artisan migrate 130 | RUN echo '#!/bin/bash\n/usr/local/bin/php /var/www/artisan migrate "$@"' > /usr/bin/migrate 131 | RUN chmod +x /usr/bin/migrate 132 | # docker-compose exec php-fpm fresh --> php artisan migrate:fresh --seed 133 | RUN echo '#!/bin/bash\n/usr/local/bin/php /var/www/artisan migrate:fresh --seed' > /usr/bin/fresh 134 | RUN chmod +x /usr/bin/fresh 135 | # docker-compose exec php-fpm t --> run the tests for the project and generate testdox 136 | RUN echo '#!/bin/bash\n/usr/local/bin/php /var/www/artisan config:clear\n/var/www/vendor/bin/phpunit -d memory_limit=2G --stop-on-error --stop-on-failure --testdox-text=tests/report.txt "$@"' > /usr/bin/t 137 | RUN chmod +x /usr/bin/t 138 | # docker-compose exec php-fpm d --> run the Laravel Dusk browser tests for the project 139 | RUN echo '#!/bin/bash\n/usr/local/bin/php /var/www/artisan config:clear\n/bin/bash\n/usr/local/bin/php /var/www/artisan dusk -d memory_limit=2G --stop-on-error --stop-on-failure --testdox-text=tests/report-dusk.txt "$@"' > /usr/bin/d 140 | RUN chmod +x /usr/bin/d 141 | 142 | RUN rm -r /var/lib/apt/lists/* 143 | 144 | WORKDIR /var/www 145 | 146 | COPY ./docker-entrypoint.sh /usr/local/bin/ 147 | RUN chmod +x /usr/local/bin/docker-entrypoint.sh 148 | RUN ln -s /usr/local/bin/docker-entrypoint.sh / 149 | ENTRYPOINT ["docker-entrypoint.sh"] 150 | 151 | EXPOSE 9000 152 | CMD ["php-fpm"] -------------------------------------------------------------------------------- /Readme.md: -------------------------------------------------------------------------------- 1 |

2 | 3 |

4 |

5 | 6 |

7 |

8 |

9 |

10 | 11 | 12 | 13 |

14 | 15 |
16 | 17 | ___ 18 | 19 |
20 | 21 | ## How To Fix `error: failed to push some refs to [remote repo]` 22 | 23 | Untuk mengatasi masalah tersebut, silahkan [klik disini](HowToFix.md) 24 | 25 | ## GITHUB COMMAND LINE SAAT INISIALISASI PROJECT 26 | 27 | | Command | Description | 28 | | --------| :-----------: | 29 | | `git init` | Digunakan untuk menginisialisasi repository Git baru di direktori kerja saat ini. Saat perintah ini dijalankan, Git akan membuat folder .git yang menyimpan semua metadata dan konfigurasi yang diperlukan untuk mengelola versi dari berkas-berkas yang ada di dalam direktori tersebut. Dengan menjalankan git init, kamu bisa mulai menggunakan Git untuk melacak perubahan-perubahan pada berkas-berkas dalam proyekmu. | 30 | | `git add .` | Adalah cara untuk memberi tahu Git bahwa kamu ingin menambahkan semua perubahan yang ada di dalam direktori kerja saat ini ke dalam staging area. Artinya, titik `.` merupakan singkatan untuk "semua perubahan". Dengan demikian, perintah tersebut memungkinkan Git untuk memantau dan mempersiapkan semua perubahan tersebut untuk dimasukkan dalam commit berikutnya. | 31 | | `git commit -m "pesannya"` | Digunakan untuk membuat commit dengan pesan tertentu. | 32 | | `git branch -M main"` | Digunakan untuk mengganti nama branch saat ini menjadi "main". Ini biasanya digunakan ketika pengguna ingin mengubah nama branch default dari "master" menjadi "main". Dengan menggunakan opsi -M, Git akan memaksa perubahan nama branch tanpa memeriksa apakah terdapat perubahan yang belum di-merge di branch tersebut. | 33 | | `git remote add origin (link kode ssh)` | Digunakan untuk menambahkan remote repository dengan alias "origin". Remote repository ini biasanya merupakan repository di platform seperti GitHub. Dengan menambahkan remote "origin", Git akan mengetahui di mana untuk mengirim perubahan ketika kamu melakukan push ke repository tersebut. | 34 | 35 | ## GITHUB COMMAND LINE SAAT MAINTENANCE/MONITORING PROJECT (TAMBAH KURANG ISI FILE) 36 | 37 | | Command | Description | 38 | | --------| :-----------: | 39 | | `git add .` | Perintah yang digunakan dalam Git untuk menambahkan semua perubahan yang ada dalam direktori kerja saat ini ke dalam staging area. | 40 | | `git commit -m "pesan"` | Digunakan untuk membuat commit dalam Git dengan pesan tertentu. | 41 | | `git push` | Digunakan untuk mengirimkan (atau "push") perubahan yang terkomit dalam repository lokal Anda ke repository yang sesuai di server Git. | 42 | ___ 43 | 44 | ## ALL BASIC GITHUB COMMAND LINE 45 | 46 | ### Getting & Creating Projects 47 | 48 | | Command | Description | 49 | | ------- | ----------- | 50 | | `git init` | Initialize a local Git repository | 51 | | `git clone ssh://git@github.com/[username]/[repository-name].git` | Create a local copy of a remote repository | 52 | 53 | ### Basic Snapshotting 54 | 55 | | Command | Description | 56 | | ------- | ----------- | 57 | | `git status` | Check status | 58 | | `git add [file-name.txt]` | Add a file to the staging area | 59 | | `git add -A` | Add all new and changed files to the staging area | 60 | | `git commit -m "[commit message]"` | Commit changes | 61 | | `git rm -r [file-name.txt]` | Remove a file (or folder) | 62 | 63 | ### Branching & Merging 64 | 65 | | Command | Description | 66 | | ------- | ----------- | 67 | | `git branch` | List branches (the asterisk denotes the current branch) | 68 | | `git branch -a` | List all branches (local and remote) | 69 | | `git branch [branch name]` | Create a new branch | 70 | | `git branch -d [branch name]` | Delete a branch | 71 | | `git push origin --delete [branch name]` | Delete a remote branch | 72 | | `git checkout -b [branch name]` | Create a new branch and switch to it | 73 | | `git checkout -b [branch name] origin/[branch name]` | Clone a remote branch and switch to it | 74 | | `git branch -m [old branch name] [new branch name]` | Rename a local branch | 75 | | `git checkout [branch name]` | Switch to a branch | 76 | | `git checkout -` | Switch to the branch last checked out | 77 | | `git checkout -- [file-name.txt]` | Discard changes to a file | 78 | | `git merge [branch name]` | Merge a branch into the active branch | 79 | | `git merge [source branch] [target branch]` | Merge a branch into a target branch | 80 | | `git stash` | Stash changes in a dirty working directory | 81 | | `git stash clear` | Remove all stashed entries | 82 | 83 | ### Sharing & Updating Projects 84 | 85 | | Command | Description | 86 | | ------- | ----------- | 87 | | `git push origin [branch name]` | Push a branch to your remote repository | 88 | | `git push -u origin [branch name]` | Push changes to remote repository (and remember the branch) | 89 | | `git push` | Push changes to remote repository (remembered branch) | 90 | | `git push origin --delete [branch name]` | Delete a remote branch | 91 | | `git pull` | Update local repository to the newest commit | 92 | | `git pull origin [branch name]` | Pull changes from remote repository | 93 | | `git remote add origin ssh://git@github.com/[username]/[repository-name].git` | Add a remote repository | 94 | | `git remote set-url origin ssh://git@github.com/[username]/[repository-name].git` | Set a repository's origin branch to SSH | 95 | 96 | ### Inspection & Comparison 97 | 98 | | Command | Description | 99 | | ------- | ----------- | 100 | | `git log` | View changes | 101 | | `git log --summary` | View changes (detailed) | 102 | | `git log --oneline` | View changes (briefly) | 103 | | `git diff [source branch] [target branch]` | Preview changes before merging | 104 | 105 | -------------------------------------------------------------------------------- /tugas/tugas_pert7/program/tugas.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | void clearScreen() { 6 | cout << "\033[2J\033[1;1H"; 7 | } 8 | 9 | int main() { 10 | int menu, menu1, menu2, pesan, harga; 11 | 12 | while (true) { 13 | clearScreen(); 14 | cout << "Menu Makanan" << endl; 15 | cout << "1. Makanan" << endl; 16 | cout << "2. Minuman" << endl; 17 | cout << "3. Exit" << endl; 18 | cout << "Masukkan Pilihan: "; 19 | cin >> menu; 20 | 21 | if (menu == 1) { 22 | while (true) { 23 | clearScreen(); 24 | cout << "MAKANAN" << endl; 25 | cout << "1. Pecel Lele Rp. 15.000" << endl; 26 | cout << "2. Nasi Goreng Rp. 18.000" << endl; 27 | cout << "3. Kembali" << endl; 28 | cout << "Masukkan Pilihan: "; 29 | cin >> menu1; 30 | 31 | if (menu1 == 3) break; 32 | 33 | switch (menu1) { 34 | case 1: 35 | while (true) { 36 | clearScreen(); 37 | cout << "Anda memilih Pecel Lele" << endl; 38 | cout << "1. QTY" << endl; 39 | cout << "2. Total" << endl; 40 | cout << "Masukkan Pilihan: "; 41 | cin >> menu2; 42 | 43 | if (menu2 == 1) { 44 | cout << "Masukkan Jumlah yang ingin dipesan (QTY): "; 45 | cin >> pesan; 46 | } else if (menu2 == 2) { 47 | harga = 15000 * pesan; 48 | cout << "Jumlah Harganya adalah " << harga << endl; 49 | cout << "Tekan Enter untuk melanjutkan..."; 50 | cin.ignore().get(); 51 | } else { 52 | cout << "Pilihan Tidak valid" << endl; 53 | } 54 | } 55 | break; 56 | case 2: 57 | while (true) { 58 | clearScreen(); 59 | cout << "Anda memilih Nasi Goreng" << endl; 60 | cout << "1. QTY" << endl; 61 | cout << "2. Total" << endl; 62 | cout << "Masukkan Pilihan: "; 63 | cin >> menu2; 64 | 65 | if (menu2 == 3) break; 66 | 67 | if (menu2 == 1) { 68 | cout << "Masukkan Jumlah yang ingin dipesan (QTY): "; 69 | cin >> pesan; 70 | } else if (menu2 == 2) { 71 | harga = 18000 * pesan; 72 | cout << "Jumlah Harganya adalah " << harga << endl; 73 | cout << "Tekan Enter untuk melanjutkan..."; 74 | cin.ignore().get(); 75 | } else { 76 | cout << "Pilihan Tidak valid" << endl; 77 | } 78 | } 79 | break; 80 | default: 81 | cout << "Pilihan Tidak valid" << endl; 82 | break; 83 | } 84 | } 85 | } else if (menu == 2) { 86 | while (true) { 87 | clearScreen(); 88 | cout << "MINUMAN" << endl; 89 | cout << "1. Teh Pucuk Rp. 5.000" << endl; 90 | cout << "2. Mizone Rp. 8.000" << endl; 91 | cout << "3. Kembali" << endl; 92 | cout << "Masukkan Pilihan: "; 93 | cin >> menu1; 94 | 95 | if (menu1 == 3) break; 96 | 97 | switch (menu1) { 98 | case 1: 99 | while (true) { 100 | clearScreen(); 101 | cout << "Anda memilih Teh Pucuk" << endl; 102 | cout << "1. QTY" << endl; 103 | cout << "2. Total" << endl; 104 | cout << "Masukkan Pilihan: "; 105 | cin >> menu2; 106 | 107 | if (menu2 == 3) break; 108 | 109 | if (menu2 == 1) { 110 | cout << "Masukkan Jumlah yang ingin dipesan (QTY): "; 111 | cin >> pesan; 112 | } else if (menu2 == 2) { 113 | harga = 5000 * pesan; 114 | cout << "Jumlah Harganya adalah " << harga << endl; 115 | cout << "Tekan Enter untuk melanjutkan..."; 116 | cin.ignore().get(); 117 | } else { 118 | cout << "Pilihan Tidak valid" << endl; 119 | } 120 | } 121 | break; 122 | case 2: 123 | while (true) { 124 | clearScreen(); 125 | cout << "Anda memilih Mizone" << endl; 126 | cout << "1. QTY" << endl; 127 | cout << "2. Total" << endl; 128 | cout << "Masukkan Pilihan: "; 129 | cin >> menu2; 130 | 131 | if (menu2 == 1) { 132 | cout << "Masukkan Jumlah yang ingin dipesan (QTY): "; 133 | cin >> pesan; 134 | } else if (menu2 == 2) { 135 | harga = 8000 * pesan; 136 | cout << "Jumlah Harganya adalah " << harga << endl; 137 | cout << "Tekan Enter untuk melanjutkan..."; 138 | cin.ignore().get(); 139 | } else { 140 | cout << "Pilihan Tidak valid" << endl; 141 | } 142 | } 143 | break; 144 | default: 145 | cout << "Pilihan Tidak valid" << endl; 146 | break; 147 | } 148 | } 149 | } else if (menu == 3) { 150 | break; 151 | } else { 152 | cout << "Pilihan Tidak valid" << endl; 153 | } 154 | } 155 | 156 | return 0; 157 | } 158 | -------------------------------------------------------------------------------- /pert9/mariadb.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "## CREATE CONNECTION" 8 | ] 9 | }, 10 | { 11 | "cell_type": "code", 12 | "execution_count": 3, 13 | "metadata": {}, 14 | "outputs": [ 15 | { 16 | "name": "stdout", 17 | "output_type": "stream", 18 | "text": [ 19 | "Requirement already satisfied: mysql-connector-python in /usr/local/lib/python3.10/dist-packages (8.4.0)\n", 20 | "\u001b[33mWARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv\u001b[0m\u001b[33m\n", 21 | "\u001b[0m" 22 | ] 23 | } 24 | ], 25 | "source": [ 26 | "!pip3 install mysql-connector-python" 27 | ] 28 | }, 29 | { 30 | "cell_type": "markdown", 31 | "metadata": {}, 32 | "source": [ 33 | "## CREATE DATABASE" 34 | ] 35 | }, 36 | { 37 | "cell_type": "code", 38 | "execution_count": 9, 39 | "metadata": {}, 40 | "outputs": [], 41 | "source": [ 42 | "import mysql.connector" 43 | ] 44 | }, 45 | { 46 | "cell_type": "markdown", 47 | "metadata": {}, 48 | "source": [ 49 | "## CREATE CONNECTION" 50 | ] 51 | }, 52 | { 53 | "cell_type": "code", 54 | "execution_count": 10, 55 | "metadata": {}, 56 | "outputs": [ 57 | { 58 | "name": "stdout", 59 | "output_type": "stream", 60 | "text": [ 61 | "MariaDB connection successful\n" 62 | ] 63 | } 64 | ], 65 | "source": [ 66 | "db_params = {\n", 67 | " 'host': 'localhost',\n", 68 | " 'user': 'root',\n", 69 | " 'port': 23306,\n", 70 | " 'password': 'p455w0rd'\n", 71 | "}\n", 72 | "\n", 73 | "connection = mysql.connector.connect(**db_params)\n", 74 | "cursor = connection.cursor()\n", 75 | "\n", 76 | "print(\"MariaDB connection successful\")" 77 | ] 78 | }, 79 | { 80 | "cell_type": "markdown", 81 | "metadata": {}, 82 | "source": [ 83 | "## CREATE DATABASE" 84 | ] 85 | }, 86 | { 87 | "cell_type": "code", 88 | "execution_count": 11, 89 | "metadata": {}, 90 | "outputs": [ 91 | { 92 | "name": "stdout", 93 | "output_type": "stream", 94 | "text": [ 95 | "Database created successfully\n" 96 | ] 97 | } 98 | ], 99 | "source": [ 100 | "create_db_query = \"CREATE DATABASE bhs_pemrograman\"\n", 101 | "\n", 102 | "cursor.execute(create_db_query)\n", 103 | "\n", 104 | "print(\"Database created successfully\")" 105 | ] 106 | }, 107 | { 108 | "cell_type": "markdown", 109 | "metadata": {}, 110 | "source": [ 111 | "## CREATE NEW PARAM DB" 112 | ] 113 | }, 114 | { 115 | "cell_type": "code", 116 | "execution_count": 12, 117 | "metadata": {}, 118 | "outputs": [], 119 | "source": [ 120 | "db_params = {\n", 121 | " 'host': 'localhost',\n", 122 | " 'user': 'root',\n", 123 | " 'port': 23306,\n", 124 | " 'password': 'p455w0rd',\n", 125 | " 'database': 'bhs_pemrograman'\n", 126 | "}" 127 | ] 128 | }, 129 | { 130 | "cell_type": "markdown", 131 | "metadata": {}, 132 | "source": [ 133 | "## CREATE TABLE" 134 | ] 135 | }, 136 | { 137 | "cell_type": "code", 138 | "execution_count": 13, 139 | "metadata": {}, 140 | "outputs": [ 141 | { 142 | "name": "stdout", 143 | "output_type": "stream", 144 | "text": [ 145 | "MariaDB connection successful\n", 146 | "Table created successfully\n", 147 | "MariaDB connection is closed\n" 148 | ] 149 | } 150 | ], 151 | "source": [ 152 | "connection = mysql.connector.connect(**db_params)\n", 153 | "cursor = connection.cursor()\n", 154 | "\n", 155 | "print(\"MariaDB connection successful\")\n", 156 | "\n", 157 | "# Create table query\n", 158 | "create_table_query = \"\"\"\n", 159 | "CREATE TABLE pert9 (\n", 160 | " id INT AUTO_INCREMENT PRIMARY KEY,\n", 161 | " name VARCHAR(255),\n", 162 | " age INT\n", 163 | ")\n", 164 | "\"\"\"\n", 165 | "\n", 166 | "# Execute query\n", 167 | "cursor.execute(create_table_query)\n", 168 | "\n", 169 | "print(\"Table created successfully\")\n", 170 | "\n", 171 | "# Close MariaDB connection\n", 172 | "cursor.close()\n", 173 | "connection.close()\n", 174 | "\n", 175 | "print(\"MariaDB connection is closed\")" 176 | ] 177 | }, 178 | { 179 | "cell_type": "markdown", 180 | "metadata": {}, 181 | "source": [ 182 | "## INSERT DATA" 183 | ] 184 | }, 185 | { 186 | "cell_type": "code", 187 | "execution_count": 14, 188 | "metadata": {}, 189 | "outputs": [ 190 | { 191 | "name": "stdout", 192 | "output_type": "stream", 193 | "text": [ 194 | "MariaDB connection successful\n", 195 | "Data inserted successfully\n" 196 | ] 197 | } 198 | ], 199 | "source": [ 200 | "connection = mysql.connector.connect(**db_params)\n", 201 | "cursor = connection.cursor()\n", 202 | "\n", 203 | "print(\"MariaDB connection successful\")\n", 204 | "\n", 205 | "\n", 206 | "insert_query = \"INSERT INTO pert9 (name, age) VALUES (%s, %s)\"\n", 207 | "data_to_insert = [\n", 208 | " ('Ani', 20),\n", 209 | " ('Budi', 21),\n", 210 | " ('Caca', 19)\n", 211 | "]\n", 212 | "\n", 213 | "# Execute query\n", 214 | "cursor.executemany(insert_query, data_to_insert)\n", 215 | "connection.commit()\n", 216 | "\n", 217 | "print(\"Data inserted successfully\")" 218 | ] 219 | }, 220 | { 221 | "cell_type": "markdown", 222 | "metadata": {}, 223 | "source": [ 224 | "## QUERY DATA" 225 | ] 226 | }, 227 | { 228 | "cell_type": "code", 229 | "execution_count": 15, 230 | "metadata": {}, 231 | "outputs": [ 232 | { 233 | "name": "stdout", 234 | "output_type": "stream", 235 | "text": [ 236 | "MariaDB connection successful\n", 237 | "(1, 'Ani', 20)\n", 238 | "(2, 'Budi', 21)\n", 239 | "(3, 'Caca', 19)\n" 240 | ] 241 | } 242 | ], 243 | "source": [ 244 | "connection = mysql.connector.connect(**db_params)\n", 245 | "cursor = connection.cursor()\n", 246 | "\n", 247 | "print(\"MariaDB connection successful\")\n", 248 | "\n", 249 | "# Select data query\n", 250 | "select_query = \"SELECT * FROM pert9\"\n", 251 | "\n", 252 | "# Execute query\n", 253 | "cursor.execute(select_query)\n", 254 | "rows = cursor.fetchall()\n", 255 | "\n", 256 | "# Display data\n", 257 | "for row in rows:\n", 258 | " print(row)" 259 | ] 260 | }, 261 | { 262 | "cell_type": "markdown", 263 | "metadata": {}, 264 | "source": [ 265 | "## CLOSE CONNECTION" 266 | ] 267 | }, 268 | { 269 | "cell_type": "code", 270 | "execution_count": 16, 271 | "metadata": {}, 272 | "outputs": [ 273 | { 274 | "name": "stdout", 275 | "output_type": "stream", 276 | "text": [ 277 | "MariaDB connection is closed\n" 278 | ] 279 | } 280 | ], 281 | "source": [ 282 | "cursor.close()\n", 283 | "connection.close()\n", 284 | "\n", 285 | "print(\"MariaDB connection is closed\")" 286 | ] 287 | } 288 | ], 289 | "metadata": { 290 | "kernelspec": { 291 | "display_name": "Python 3", 292 | "language": "python", 293 | "name": "python3" 294 | }, 295 | "language_info": { 296 | "codemirror_mode": { 297 | "name": "ipython", 298 | "version": 3 299 | }, 300 | "file_extension": ".py", 301 | "mimetype": "text/x-python", 302 | "name": "python", 303 | "nbconvert_exporter": "python", 304 | "pygments_lexer": "ipython3", 305 | "version": "3.10.12" 306 | } 307 | }, 308 | "nbformat": 4, 309 | "nbformat_minor": 2 310 | } 311 | -------------------------------------------------------------------------------- /pert7/examplecasedashboard.py: -------------------------------------------------------------------------------- 1 | from jupyter_dash import JupyterDash 2 | from dash import dcc, html, Input, Output 3 | import dash_bootstrap_components as dbc 4 | import dash_html_components as html 5 | import requests 6 | import pandas as pd 7 | import dash_core_components as dcc 8 | import plotly.express as px 9 | import numpy as np 10 | from dash.dependencies import Input,Output 11 | import dash_table 12 | 13 | app = dash.Dash(external_stylesheets = [ dbc.themes.FLATLY],) 14 | 15 | 16 | #COVID_IMG = "https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Fbigredmarkets.com%2Fwp-content%2Fuploads%2F2020%2F03%2FCovid-19.png&f=1&nofb=1" 17 | 18 | 19 | url = "https://api.covid19api.com/summary" 20 | response_world = requests.request("GET", url) 21 | df_countries=pd.DataFrame(response_world.json()['Countries']) 22 | df_global=pd.DataFrame(response_world.json()['Global'], index=[0]) 23 | df_last_updated=response_world.json()['Date'] 24 | 25 | confirmed = df_global['TotalConfirmed'][0] 26 | newconfirmed = df_global['NewConfirmed'][0] 27 | deaths = df_global['TotalDeaths'][0] 28 | newdeaths = df_global['NewDeaths'][0] 29 | recovered = df_global['TotalRecovered'][0] 30 | newrecovered = df_global['NewRecovered'][0] 31 | 32 | 33 | data = {'alpha-2':["AD", "AE", "AF", "AG", "AI", "AL", "AM", "AN", "AO", "AQ", "AR", "AS", "AT", "AU", "AW", 34 | "AZ", "BA", "BB", "BD", "BE", "BF", "BG", "BH", "BI", "BJ", "BM", "BN", "BO", "BR", 35 | "BS", "BT", "BV", "BW", "BY", "BZ", "CA", "CC", "CD", "CF", "CG", "CH", "CI", "CK", 36 | "CL", "CM", "CN", "CO", "CR", "CU", "CV", "CX", "CY", "CZ", "DE", "DJ", "DK", "DM", 37 | "DO", "DZ", "EC", "EE", "EG", "EH", "ER", "ES", "ET", "FI", "FJ", "FK", "FM", "FO", 38 | "FR", "GA", "GB", "GD", "GE", "GF", "GG", "GH", "GI", "GL", "GM", "GN", "GP", "GQ", 39 | "GR", "GS", "GT", "GU", "GW", "GY", "HK", "HM", "HN", "HR", "HT", "HU", "ID", "IE", 40 | "IL", "IM", "IN", "IO", "IQ", "IR", "IS", "IT", "JE", "JM", "JO", "JP", "KE", "KG", 41 | "KH", "KI", "KM", "KN", "KP", "KR", "KW", "KY", "KZ", "LA", "LB", "LC", "LI", "LK", 42 | "LR", "LS", "LT", "LU", "LV", "LY", "MA", "MC", "MD", "ME", "MG", "MH", "MK", "ML", 43 | "MM", "MN", "MO", "MP", "MQ", "MR", "MS", "MT", "MU", "MV", "MW", "MX", "MY", "MZ", 44 | "NA", "NC", "NE", "NF", "NG", "NI", "NL", "NO", "NP", "NR", "NU", "NZ", "OM", "PA", 45 | "PE", "PF", "PG", "PH", "PK", "PL", "PM", "PN", "PR", "PS", "PT", "PW", "PY", "QA", 46 | "RE", "RO", "RS", "RU", "RW", "SA", "SB", "SC", "SD", "SE", "SG", "SH", "SI", "SJ", 47 | "SK", "SL", "SM", "SN", "SO", "SR", "SS", "ST", "SV", "SY", "SZ", "TC", "TD", "TF", 48 | "TG", "TH", "TJ", "TK", "TL", "TM", "TN", "TO", "TR", "TT", "TV", "TW", "TZ", "UA", 49 | "UG", "UM", "US", "UY", "UZ", "VA", "VC", "VE", "VG", "VI", "VN", "VU", "WF", "WS", 50 | "YE", "YT", "ZA", "ZM", "ZW"], 51 | 52 | 53 | 'iso_alpha':["AND", "ARE", "AFG", "ATG", "AIA", "ALB", "ARM", "ANT", "AGO", "ATA", "ARG", "ASM", "AUT", "AUS", "ABW", 54 | "AZE", "BIH", "BRB", "BGD", "BEL", "BFA", "BGR", "BHR", "BDI", "BEN", "BMU", "BRN", "BOL", "BRA", 55 | "BHS", "BTN", "BVT", "BWA", "BLR", "BLZ", "CAN", "CCK", "COD", "CAF", "COG", "CHE", "CIV", "COK", 56 | "CHL", "CMR", "CHN", "COL", "CRI", "CUB", "CPV", "CXR", "CYP", "CZE", "DEU", "DJI", "DNK", "DMA", 57 | "DOM", "DZA", "ECU", "EST", "EGY", "ESH", "ERI", "ESP", "ETH", "FIN", "FJI", "FLK", "FSM", "FRO", 58 | "FRA", "GAB", "GBR", "GRD", "GEO", "GUF", "GGY", "GHA", "GIB", "GRL", "GMB", "GIN", "GLP", "GNQ", 59 | "GRC", "SGS", "GTM", "GUM", "GNB", "GUY", "HKG", "HMD", "HND", "HRV", "HTI", "HUN", "IDN", "IRL", 60 | "ISR", "IMN", "IND", "IOT", "IRQ", "IRN", "ISL", "ITA", "JEY", "JAM", "JOR", "JPN", "KEN", "KGZ", 61 | "KHM", "KIR", "COM", "KNA", "PRK", "KOR", "KWT", "CYM", "KAZ", "LAO", "LBN", "LCA", "LIE", "LKA", 62 | "LBR", "LSO", "LTU", "LUX", "LVA", "LBY", "MAR", "MCO", "MDA", "MNE", "MDG", "MHL", "MKD", "MLI", 63 | "MMR", "MNG", "MAC", "MNP", "MTQ", "MRT", "MSR", "MLT", "MUS", "MDV", "MWI", "MEX", "MYS", 64 | "MOZ", "NAM", "NCL", "NER", "NFK", "NGA", "NIC", "NLD", "NOR", "NPL", "NRU", "NIU", "NZL", "OMN", 65 | "PAN", "PER", "PYF", "PNG", "PHL", "PAK", "POL", "SPM", "PCN", "PRI", "PSE", "PRT", "PLW", "PRY", 66 | "QAT", "REU", "ROU", "SRB", "RUS", "RWA", "SAU", "SLB", "SYC", "SDN", "SWE", "SGP", "SHN", "SVN", 67 | "SJM", "SVK", "SLE", "SMR", "SEN", "SOM", "SUR", "SSD", "STP", "SLV", "SYR", "SWZ", "TCA", "TCD", 68 | "ATF", "TGO", "THA", "TJK", "TKL", "TLS", "TKM", "TUN", "TON", "TUR", "TTO", "TUV", "TWN", "TZA", 69 | "UKR", "UGA", "UMI", "USA", "URY", "UZB", "VAT", "VCT", "VEN", "VGB", "VIR", "VNM", "VUT", "WLF", 70 | "WSM", "YEM", "MYT", "ZAF", "ZMB", "ZWE"]} 71 | 72 | code_mapping = pd.DataFrame(data) 73 | 74 | df_world_f=pd.merge(df_countries[['Country','TotalConfirmed','TotalDeaths','TotalRecovered','CountryCode']],code_mapping, left_on = 'CountryCode',right_on = 'alpha-2',how = 'inner') 75 | 76 | ################################# Functions for creating Plotly graphs and data card contents ################ 77 | def world_map(df): 78 | fig = px.choropleth(df, locations="iso_alpha", color = "TotalConfirmed", 79 | hover_name= "Country", 80 | hover_data = ['TotalConfirmed','TotalDeaths','TotalRecovered'], 81 | projection="orthographic", 82 | color_continuous_scale=px.colors.sequential.Plasma) 83 | 84 | fig.update_layout(margin = dict(l=4,r=4,t=4,b=4)) 85 | 86 | return fig 87 | 88 | 89 | def data_for_cases(header, total_cases, new_cases): 90 | card_content = [ 91 | dbc.CardHeader(header), 92 | 93 | dbc.CardBody( 94 | [ 95 | dcc.Markdown( dangerously_allow_html = True, 96 | children = ["{0}
+{1}
".format(total_cases,new_cases)]) 97 | 98 | 99 | ] 100 | 101 | ) 102 | ] 103 | 104 | return card_content 105 | 106 | ############################################ body of the dashboard ########################### 107 | 108 | body_app = dbc.Container([ 109 | 110 | dbc.Row( html.Marquee("Kunjungan Kapal Pesiar di Dunia"), style = {'color':'green'}), 111 | 112 | dbc.Row([ 113 | dbc.Col(dbc.Card(data_for_cases("Confirmed",f'{confirmed:,}',f'{newconfirmed:,}' ), color = 'primary',style = {'text-align':'center'}, inverse = True),xs = 12, sm = 12, md = 4, lg = 4, xl = 4, style = {'padding':'12px 12px 12px 12px'}), 114 | dbc.Col(dbc.Card(data_for_cases("Suspend",f'{recovered:,}',f'{newrecovered:,}' ), color = 'success',style = {'text-align':'center'}, inverse = True),xs = 12, sm = 12, md = 4, lg = 4, xl = 4, style = {'padding':'12px 12px 12px 12px'}), 115 | dbc.Col(dbc.Card(data_for_cases("Cancel",f'{deaths:,}',f'{newdeaths:,}' ), color = 'danger',style = {'text-align':'center'}, inverse = True),xs = 12, sm = 12, md = 4, lg = 4, xl = 4, style = {'padding':'12px 12px 12px 12px'}) 116 | 117 | 118 | ]), 119 | 120 | html.Br(), 121 | html.Br(), 122 | 123 | dbc.Row([html.Div(html.H4('List Kunjungan'), 124 | style = {'textAlign':'center','fontWeight':'bold','family':'georgia','width':'100%'})]), 125 | 126 | html.Br(), 127 | html.Br(), 128 | 129 | dbc.Row([dbc.Col(dcc.Graph(id = 'world-graph', figure = world_map(df_world_f)),style = {'height':'450px'},xs = 12, sm = 12, md = 6, lg = 6, xl = 6), 130 | 131 | dbc.Col([html.Div(id = 'dropdown-div', children = 132 | [dcc.Dropdown(id = 'country-dropdown', 133 | options = [{'label':i, 'value':i} for i in np.append(['All'],df_countries['Country'].unique()) ], 134 | value = 'All', 135 | placeholder = 'Select the country' 136 | )], style = {'width':'100%', 'display':'inline-block'}), 137 | 138 | html.Div(id = 'world-table-output') 139 | ],style = {'height':'450px','text-align':'center'},xs = 12, sm = 12, md = 6, lg = 6, xl = 6) 140 | 141 | ]) 142 | 143 | 144 | ],fluid = True) 145 | 146 | ############################## navigation bar ################################ 147 | 148 | navbar = dbc.Navbar( id = 'navbar', children = [ 149 | 150 | 151 | html.A( 152 | dbc.Row([ 153 | #dbc.Col(html.Img(src = COVID_IMG, height = "70px")), 154 | dbc.Col( 155 | dbc.NavbarBrand("BPKS Live Tracker Kunjungan Kapal Pesiar", style = {'color':'black', 'fontSize':'25px','fontFamily':'Times New Roman'} 156 | ) 157 | 158 | ) 159 | 160 | 161 | ],align = "center", 162 | 163 | ), 164 | href = '/' 165 | ), 166 | 167 | dbc.Row( 168 | [ 169 | dbc.Col( 170 | 171 | #dbc.Button(id = 'button', children = "Support Us", color = "primary", className = 'ml-auto', href = '/') 172 | 173 | ) 174 | ], 175 | 176 | className="g-0 ms-auto flex-nowrap mt-3 mt-md-0", 177 | ) 178 | 179 | 180 | 181 | ]) 182 | 183 | 184 | app.layout = html.Div(id = 'parent', children = [navbar,body_app]) 185 | 186 | #################################### Callback for adding interactivity to the dashboard ####################### 187 | 188 | @app.callback(Output(component_id='world-table-output', component_property= 'children'), 189 | [Input(component_id='country-dropdown', component_property='value')]) 190 | 191 | def table_country(country): 192 | if country == 'All': 193 | df_final = df_countries 194 | else: 195 | df_final = df_countries.loc[df_countries['Country'] == '{}'.format(country)] 196 | 197 | return dash_table.DataTable( 198 | data = df_final[['Country','TotalConfirmed','TotalSuspend','TotalCancel']].to_dict('records'), 199 | columns = [{'id':c , 'name':c} for c in df_final[['Country','TotalConfirmed','TotalRecovered','TotalDeaths']].columns], 200 | fixed_rows = {'headers':True}, 201 | 202 | sort_action = 'native', 203 | 204 | style_table = { 205 | 'maxHeight':'450px' 206 | }, 207 | 208 | style_header = {'backgroundColor':'rgb(224,224,224)', 209 | 'fontWeight':'bold', 210 | 'border':'4px solid white', 211 | 'fontSize':'12px' 212 | }, 213 | 214 | style_data_conditional = [ 215 | 216 | { 217 | 'if': {'row_index': 'odd', 218 | }, 219 | 'backgroundColor': 'rgb(240,240,240)', 220 | 'fontSize':'12px', 221 | }, 222 | 223 | { 224 | 'if': {'row_index': 'even'}, 225 | 'backgroundColor': 'rgb(255, 255, 255)', 226 | 'fontSize':'12px', 227 | 228 | } 229 | 230 | ], 231 | 232 | style_cell = { 233 | 'textAlign':'center', 234 | 'fontFamily':'Times New Roman', 235 | 'border':'4px solid white', 236 | 'width' :'20%', 237 | 'textOverflow': 'ellipsis', 238 | 239 | 240 | 241 | } 242 | 243 | 244 | ) 245 | 246 | 247 | 248 | if __name__ == "__main__": 249 | app.run_server() --------------------------------------------------------------------------------