This file contains 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
# cd /var/lib/mysql | |
# mkdir bak | |
# mv ibdata1 bak/. | |
# mv ib_logfile* bak/. | |
# cp -a bak/ibdata1 ibdata1 | |
# cp -a bak/ib_logfile* . | |
# service mysql restart |
This file contains 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 HaversineFormula { | |
static double lat1, lat2, deg; | |
public HaversineFormula() {} | |
public static double calculate(double initialLat, double initialLong, double finalLat, double finalLong){ | |
int R = 6371; // km | |
double dLat = toRadians(finalLat - initialLat); |
This file contains 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 CacheManager { | |
private static final String TAG = "CacheManager"; | |
private static SharedPreferences getPref() { | |
return PreferenceManager.getDefaultSharedPreferences(RangerApplication.getContext()); | |
} | |
public static void save(String key, String value) { | |
Log.d(TAG, "saveCache: " + value); |
This file contains 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
Pre Mojave (from Sierra or High Sierra) | |
====================================================== | |
1. boot into recovery mode | |
2. take your logical volume ID | |
$ diskutil cs list | |
3. change CoreStorage logical volume into normal disk partition | |
# diskutil cs revert <<LOGICAL_VOLUME_ID>> | |
4. restart! and welcome to mojave installer. | |
Post Mojave |
This file contains 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 app.isfaaghyth.location.utils; | |
import android.Manifest; | |
import android.content.Context; | |
import android.content.Intent; | |
import android.content.pm.PackageManager; | |
import android.location.Location; | |
import android.location.LocationManager; | |
import android.os.Bundle; | |
import android.support.annotation.NonNull; |
This file contains 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 android.content.SharedPreferences; | |
import android.preference.PreferenceManager; | |
import android.util.Log; | |
import app.rangers.ranger.RangerApplication; | |
public class CacheManager { | |
private static final String TAG = "CacheManager"; |
This file contains 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
1. buat layout untuk notif error (contoh: error.xml): | |
<LinearLayout | |
android:id="@+id/layoutError" | |
...> | |
<TextView | |
... | |
android:id="@+id/txtErr" | |
android:text="error!"/> |
This file contains 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
<?php | |
function sendFirebaseNotification($threat, $id) { | |
$url = 'https://fcm.googleapis.com/fcm/send'; | |
$fields = [ | |
'to' => $id, | |
'data' => [ | |
"caption" => $threat->caption, | |
"browser" => $threat->browser, |
This file contains 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
CREATE OR REPLACE FUNCTION test(uuidin text) | |
RETURNS TABLE(uuid integer, name text, business_account_id integer, upline_id integer, user_username text, grade_name text, grade_background_image text) AS $BODY$ | |
BEGIN | |
RETURN QUERY | |
WITH RECURSIVE subordinates AS (SELECT b.uuid , b.name, b.business_account_id, b.upline_id, | |
b.user_username, g.name AS grade_name, g.background_image AS grade_background_image, (SELECT SUM(amount) FROM user_pin_transactions WHERE business_account_uuid = b.uuid) AS omzet FROM business_accounts b | |
INNER JOIN grades g ON id = b.grade_id | |
WHERE b.uuid = uuidin | |
UNION SELECT db.uuid, db.name, db.business_account_id, db.upline_id, db.user_username, dg.name AS grade_name, dg.background_image AS grade_background_image, | |
(SELECT SUM(amount) FROM user_pin_transactions WHERE business_account_uuid = db.uuid) AS omzet |
This file contains 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
#include<iostream> | |
using namespace std; | |
struct Node { | |
int data; | |
Node *next; | |
Node *prev; | |
}; | |
Node *node, *head, *tail; |