This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| interface Hello { | |
| public String getHelloFormal(); | |
| } | |
| class Greeting { | |
| //definisikan anonymous class | |
| Hello helloBahasaIndonesia = new Hello(){ | |
| public String getHelloFormal(){ | |
| return "Selamat pagi"; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| #filename backup | |
| fileName= db_retail_bck_$(date +%Y%m%d).log | |
| path='/home/user/backup' | |
| fullPath=${path}/${fileName} | |
| echo ${fileName} | |
| echo ${path} | |
| echo ${fullPath} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Rectangle: | |
| def __init__(self, length, width): | |
| self._length = length | |
| self._width = width | |
| # Check the invariant after initializing the attributes | |
| self._check_invariant() | |
| def _check_invariant(self): | |
| # Invariant: Both length and width must be positive | |
| if self._length <= 0 or self._width <= 0: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class BankAccount { | |
| private double balance; | |
| // Invariant: balance tidak boleh negatif. | |
| private void checkInvariant() { | |
| if (balance < 0) { | |
| throw new IllegalStateException("Invariant violation: Balance cannot be negative."); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "shell": true, | |
| "cmd": ["fpc", "${file_path}/${file_base_name}", "&&", "start", "cmd", "/c", "$file_base_name.exe", "&", "pause"], | |
| "selector": "source.pascal", | |
| "variants": [ | |
| { | |
| "cmd": ["start", "cmd", "/c", "$file_base_name.exe & pause"], | |
| "name": "Run", | |
| "shell": true | |
| }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from sklearn import datasets | |
| from sklearn.model_selection import StratifiedKFold | |
| from sklearn.svm import LinearSVC | |
| iris = datasets.load_iris() | |
| features = iris.data | |
| labels = iris.target | |
| skf = StratifiedKFold(n_splits=5) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| kode untuk menghitung total produksi | |
| dengan pabrik defisit tiap tahun 0.2 dari sebelumnya | |
| """ | |
| tahun_pertama = 98000 | |
| total_produksi = tahun_pertama | |
| sisa = tahun_pertama | |
| catatan_tahun = {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| cara membaca data dari serial Monitor arduino | |
| """ | |
| # library / package yang dibutuhkan | |
| import serial | |
| # membuat koneksi | |
| con = serial.Serial("COM6", 9600) | |
| print(con) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ini di model User | |
| public function terimaReviews() | |
| { | |
| return $this->hasMany('App/Review', 'id_penerima', 'id'); | |
| } | |
| public function kirimReviews() | |
| { | |
| return $this->hasMany('App/Review', 'id_pengirim', 'id'); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ''' | |
| Cat Faces Detection | |
| Sufyan Saori | |
| ''' | |
| import cv2 | |
| cascade_path = "..." #change to your cascade path | |
| cat_cascade = cv2.CascadeClassifier(cascade_path) |