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 Person { | |
private String name, surname, address; | |
public Person(Builder builder) { | |
this.name = builder.name; | |
this.surname = builder.surname; | |
this.address = builder.address; | |
} |
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 Person { | |
private String name, surname, address; | |
public Person(String name, String surname, String address) { | |
this.name = name; | |
this.surname = surname; | |
this.address = address; | |
} | |
// Getter & setter metodları |
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 BinarySearch { | |
int binarySearch(int arr[], int x) { | |
int l = 0, r = arr.length - 1; | |
while (l <= r) { | |
int m = l + (r - l) / 2; | |
//x değeri ortanca değer mi kontrol et | |
if (arr[m] == x) | |
return m; |
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 LinearSearch { | |
public static int search(int arr[], int x) { | |
int n = arr.length; | |
for(int i = 0; i < n; i++) { | |
if(arr[i] == x) | |
return i; | |
} | |
return -1; | |
} | |
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 SingleObject { | |
//SingleObject sınıfından bir nesne oluştur | |
private static SingleObject instance = new SingleObject(); | |
/*constructorın access modifierını private olarak tanımlayalım ki bu sınıftan nesne oluşturulamasın*/ | |
private SingleObject(){} | |
//Oluşturduğumuz nesneye erişim için getter | |
public static SingleObject getInstance(){ |
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
import java.util.Hashtable; | |
public abstract class Shape implements Cloneable { | |
private String id; | |
protected String type; | |
abstract void draw(); | |
public String getType(){ | |
return type; |
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
const jwt = require('jsonwebtoken'); | |
module.exports = (req, res, next) => { | |
try { | |
/*JWT is send with request header! | |
Format of it: Authorization : Bearer <token> | |
*/ | |
const token = req.headers.authorization.split(" ")[1]; | |
const decodedToken = jwt.verify(token, 'secret_key'); | |
req.userData = decodedToken; |
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
login(req, res) { | |
if (!req.body.memail || !req.body.mpassword) { | |
return res.status(404).send({ | |
message: 'Email and password can not be empty!', | |
}); | |
} else { | |
const email = req.body.memail; | |
const password = crypto.createHash('md5').update(req.body.mpassword).digest("hex"); | |
const potentialUser = { | |
where: { |
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
package com.hibernateyazilari.hibernate_2; | |
import org.hibernate.Session; | |
import org.hibernate.SessionFactory; | |
import org.hibernate.cfg.Configuration; | |
import org.hibernate.service.internal.SessionFactoryServiceRegistryBuilderImpl; | |
public class App { | |
public static void main( String[] args ) { | |
SessionFactory factory = new Configuration() |
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
package com.hibernateyazilari.hibernate_2; | |
import javax.persistence.Column; | |
import javax.persistence.Entity; | |
import javax.persistence.Id; | |
import javax.persistence.Table; | |
@Entity | |
@Table(name = "Students") | |
public class Student { |
NewerOlder