Cloud IDE
Kata suhu suhu dikaskus lumayan lho bisa buat belajar ngoding di environment cloud dan VPS, untuk yang gratisan kekurangan nya VPS bisa aktif ketika kita sedang online saja đ
JPA Object Relations
- http://blog.jbaysolutions.com/2012/12/17/jpa-2-relationships-many-to-many/
- http://viralpatel.net/blogs/hibernate-self-join-annotations-one-to-many-mapping/
- https://hellokoding.com/jpa-many-to-many-relationship-mapping-example-with-spring-boot-maven-and-mysql/
- https://hellokoding.com/jpa-many-to-many-extra-columns-relationship-mapping-example-with-spring-boot-maven-and-mysql/
[Oracle] ORA-02292 : Mencari Table Constraints dengan Constraints Name
mencoba mengupdate salah satu column pada row, tetapi terkena error seperti ini :
update auth_users set username = ‘user1@test.co.id’ where name = ‘user@test.co.id’
Error report –
SQL Error: ORA-02292: integrity constraint (ADMIN.FK_2TUB76GCBJC6VCSO1FBE15L3P) violated – child record found
02292. 00000 – “integrity constraint (%s.%s) violated – child record found”
*Cause: attempted to delete a parent key value that had a foreign
dependency.
*Action: delete dependencies first then parent or disable constraint.
maka kita dapat mencari tahu, constraints name itu milik table siapa (FK_2TUB76GCBJC6VCSO1FBE15L3P). gunakan syntax berikut :
select table_name from user_constraints where constraint_name=’FK_2TUB76GCBJC6VCSO1FBE15L3P’;
Immutability and Mutability
Immutable
+ No thread locks
+ Fast read and lookup
– Bad for objects that highly mutable (increase memory usage every time it mutates)
Mutable
+ Fast for highly mutable objects
+ Low memory footprint
– Thread locks
Where you use immutable/mutable depending on the objects and pattern utilized. Functional and Math programming requires immutability on all objects to ensure consistency with parallel execution. Object Oriented apps rarely needs immutability since object is reused over and over with high mutability.
1 very clear example of mutability : Try playing games and imagine if all the objects is immutable, including interaction between objects (player on terrain, player vs player, gravity simulation, etc) and if this immutable, how do you deal with the number of objects generated every time it mutates.
1 example for immutability : Math calculation that can be break down and spread across multiple parallel threads (calculating/simulating)
http://www.kaskus.co.id/show_post/56611221dc06bd54638b4568/4041/-
Back To Basic : SOLID, DRY and KISS
S.O.L.I.D Principles
Single ResponsibilityÂ
- One class should have one and only one responsibility.
- This concept will give you the flexibility to make changes in the future without worrying the impact to another class.
Open Closed Principle
- A class should be open for extension but closed for modification.
- The âclosedâ part mean the module/class should only adjusted to correct bugs.
- The âopenâ part mean fellow developer should be able to extend existing code in order to introduce new functionality.
- Fellow developer should be able to override the options by software in un-harmful way permitted by software.
Liskov Substitution Principle
- Liskovs Substitution Principle states that any method that takes class X as a parameter must be able to work with any subclasses of X.
- Subtypes must be substitutable for their base types.
- A subclass should override the parent class’ methods in a way that does not break functionality from a client’s point of view
Interface Segregation PrincipleÂ
- A Client should never be forced to implement an interface that doesnât user or clients shouldnât be forced to depend on methods they do not use.
- ISP states that interfaces that have become âfatâ (like god classes) should be split into several interfaces. A large interface makes it harder to extend smaller parts of the system.
Dependency Inversion Principle
- Entities must depend on abstraction not on concretion.
- It states that the high level module must not depend on the low level module, but they should depend on abstraction.
D.R.Y (Donât Repeat Yourself) Principles
- Donât write duplicate code.
- Use abstraction to abstract common things in one place.
- If you have block of code in more than two place consider making it separate method.
- If you think fellow developer will need the same method in the future (depend in the context of business flow which you implement), consider making it as component or utility class.
- If you use a hard-code value more than one time make them public final constant.
- Duplication not for code, but functionality.
K.I.S.S (Keep It Stupid Simple or Keep It Simple, Stupid)
- Meaningful and clear name (adjusted in functionality and business context).
- Break down your problem into many small problems.
Keep your method small. - Each method should only solve one little problem, not many use case.
Donât afraid refactor your code, over and over again (ps. If you still have time). - Donât afraid to throw away code.
Sometimes you will find the principle collide each other and you also must considering the impact of your code in the system performance, you can do a mistakes but donât break things.
Instalasi SonarQube & Analisa dengan sonar runner
Instalasi SonarQubeÂ
download sonarqube pada link berikut, http://www.sonarqube.org/downloads/ (pada tutorial berikut saya menggunakan sonarqube versi 4.5.6)
extract, dan ubah atau tambahkan konfigurasi pada file : \sonarqube-4.5.6\conf\sonar.properties
konfigurasi standar sebenarnya sudah ada templatenya pada file sonar.properties, hanya tinggal disesuaikan dengan environment yang kita pakai.
konfigurasi user dan password database :
sonar.jdbc.username=root
sonar.jdbc.password=password
konfigurasi koneksi database, saya memakai MySQL :
sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true
dengan konfigurasi seperti diatas, sudah cukup untuk menjalankan sonarqube :
\sonar-runner-2.4\bin\sonar-runner.bat
Saya memakai windowz, maka saya gunakan file *.bat
jika instalasi sukses, maka dashboard dari sonarQube bisa diakses melalui localhost:9000, dan untuk user/password adalah admin/admin.
Langkah selanjutnya adalah melakukan instalasi plugin, plugin plugin ini nantinya dibutuhkan untuk analisa source code dengan sonar runner.
Login sebagai administrator, klik setting->update center (menu sebelah kiri) -> available plugin (tab kedua pada tab plugins).
Pada contoh saya hanya akan meng-install plugin java saja, kamu membutuhkan restart pada sonarQube, ctrl + c  kemudian jalan-kan ulang startSonar.bat
 Instalasi Sonar runner
Project saya sebenarnya menggunakan maven, karena ada pemisahan module pada project java saya, saya kesulitan melakukan konfigurasi pada maven, yang terjadi adalah sonar pada maven/pom.xml gagal melakukan indexing, analisa tidak akan terjadi.
Maka agar lebih mudah saya menggunakan sonar runner, kelebihan nya adalah kita tidak akan bergantung pada build tools dari suatu project, sonar runner akan melakukan crawling  pada project kita, dan mengsinkronkan dengan data pada sonarQube sehingga hasil analisa dapat kita lihat pada dashboard.
Konfigurasi
sama seperti konfigurasi sonar yang sudah ada template nya, sonar runner pun sama, tetapi dengan beberapa tambahan konfigurasi project path yang akan dianalisa.
konfigurasi standar
#—– Default SonarQube server
sonar.host.url=http://localhost:9000#—– MySQL
sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8#—– Global database settings
sonar.jdbc.username=root
sonar.jdbc.password=password
konfigurasi project path
# required metadata
sonar.projectKey=sample-project
sonar.projectName=sample-project
sonar.projectVersion=1.0# project path
sonar.sources=F:/asn/workspace/apps/src/main/java/
sonar.projectBaseDir=F:/asn/workspace/apps/src/main/java/#The value of the property must be the key of the language.
sonar.language=java
Jalankan file sonar-runner.bat untuk menjalankan analisa, pastikan sonarQube sudah dalam keadaan UP atau aktif.
\sonar-runner-2.4\bin\sonar-runner.bat
Keyword dari selesai proses analysis adalah ANALYSIS SUCCESSFUL, jika proses telah selesai kamu dapat melihat hasil nya pada dashboard.
referensi :
- http://docs.sonarqube.org/display/SONAR/Documentation/
- http://qualilogy.com/en/install-sonarqube-first-analysis-with-sonarqube-runner/
- http://qualilogy.com/en/install-sonarqube-sonarqube-runner/
Java Material : Conference, Seminar and Java Enthusiast you must stalk !
- JAVA ZONE 2015 : Videos from 155 talks â free for all for ever!Â
- This Week in Spring (JavaOne 2015 Edition) – October 27, 2015
- Java One Live StreamingÂ
Sebagai catatan, Java di indonesia di “musim trend Startup” indonesia seperti tidak terdeteksi atau seperti gerakan underground, sedangkan di US/Eropa mereka masih saja aktif dan teknologi java pun berjalan bersama sama dengan teknologi lain dan metode/konsep baru di bidang programming yang sedang trend.
Sebagai informasi kita bisa mengikuti web dan event dari pivotal, java zone, java one dan evangelist atau penggiat pengiat java di luar indonesia, mereka cukup aktif di twitter.
My GitHub Cheat Sheet
- Clone repository without history /Â shallow clone
git clone –depth 1 git://github.com/example-user/example-repo.git
note :
- –depth <depth>,. create a shallow clone with a history truncated to the specified number of revisions.
- The process will copy only the latest revision of everything in the repository
- The above command clones only the current HEAD
- Clone only one branchÂ
git clone -b mybranch --single-branch git://sub.domain.com/repo.git
- Combine shallow clone and clone only one branch
 git clone –depth 1 -b test-branch –single-branch https://github.com/xxx/Test.git
tutorial how to rewrite github history using “rebase“
ref :
- http://git-scm.com/docs/git-clone
- https://rtyley.github.io/bfg-repo-cleaner/
- https://help.github.com/articles/remove-sensitive-data/
- https://git-scm.com/book/en/v2/Git-Branching-Basic-Branching-and-Merging
- https://git-scm.com/book/en/v2/Git-Branching-Branches-in-a-Nutshell
- https://www.atlassian.com/git/tutorials/comparing-workflows/feature-branch-workflow