Skip to content

Instantly share code, notes, and snippets.

View mberberoglu's full-sized avatar

Mustafa Berberoglu mberberoglu

View GitHub Profile
@mberberoglu
mberberoglu / config-server
Created June 15, 2015 14:39
MongoDB Sharding
sudo service mongodb stop
// /etc/init/mongo.conf u açıp --configsvr ekleyin
sudo vim /etc/init/mongodb.conf
"exec start-stop-daemon --start --quiet --chuid mongodb --exec /usr/bin/mongod -- --config /etc/mongodb.conf;"
//Üstteki satır ile değistirin
"exec start-stop-daemon --start --quiet --chuid mongodb --exec /usr/bin/mongod -- --configsvr --config /etc/mongodb.conf;"
-4.8000001907349#0
43.400001525879#1
43.400001525879#2
43.400001525879#3
43.400001525879#4
-7.5999999046326#5
-7.5999999046326#6
-7.8000001907349#7
-7.8000001907349#8
-7.5999999046326#9
<?xml version="1.0" encoding="UTF-8" ?>
<dataConfig>
<dataSource name="DataImporter" type="MongoDataSource" host="host" database="database" port="port" username="username" password="password" />
<document name="Document">
<entity name="Data"
processor="MongoEntityProcessor"
query="{updatedAt: {'$gte' : ${dataimporter.request.time}}}, {}"
collection="Data"
datasource="DataImporter"
transformer="MongoMapperTransformer" >
@mberberoglu
mberberoglu / mongo-replicaset
Created November 30, 2014 13:46
MongoDB Replica Set
mongod -port 27001 -dbpath /var/mongodb/rep1 -replSet replicationName
mongod -port 27002 -dbpath /var/mongodb/rep2 -replSet replicationName
mongod -port 27003 -dbpath /var/mongodb/rep3 -replSet replicationName
@mberberoglu
mberberoglu / TweetListener.java
Created October 14, 2014 21:06
Twitter4j Örnek
package com.mustafab;
import com.mongodb.*;
import twitter4j.*;
import twitter4j.conf.ConfigurationBuilder;
import java.io.*;
import java.net.UnknownHostException;
import java.util.Properties;
<?php
$category = 8;
$data = array(
164, 150, 132, 144, 125, 149, 145, 146,
158, 140, 147, 136, 148, 152, 144, 168,
126, 138, 176, 163, 119, 154, 165, 146,
173, 142, 147, 135, 153, 140, 135, 161,
145, 135, 142, 150, 156, 145, 128, 157
);
$min = min($data);
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
import com.abhi.barcode.frag.libv2.BarcodeFragment;
import com.abhi.barcode.frag.libv2.IScanResultHandler;
import com.abhi.barcode.frag.libv2.ScanResult;
function minimax(node, depth, maximizingPlayer)
if depth = 0 or node is a terminal node
return the heuristic value of node
if maximizingPlayer
bestValue := -∞
for each child of node
val := minimax(child, depth - 1, FALSE))
bestValue := max(bestValue, val);
return bestValue
else
@mberberoglu
mberberoglu / android-swipe-1
Last active September 29, 2018 05:11
Android Swipe Views with Tab
//Main Container
<android.support.v4.view.ViewPager
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent" />
@mberberoglu
mberberoglu / picasso-android-1
Last active August 29, 2015 13:57
Picasso Android
Picasso.with(context).load("http://mustafab.net/images/captain.png").into(imageView);