Showing posts with label Tutorial. Show all posts
Showing posts with label Tutorial. Show all posts

Install Google Maps dengan Pod di Swift

Buat File Pod dan Isi :
pod 'GoogleMaps'
Jalan perintah pod install di terminal :
pod install


Install Google Maps dengan Pod di Swift
IOS Google Maps

Berikut contoh instalasi Google Maps dengan Pod :

Controller :
import UIKit

class ViewController: UIViewController {

    @IBOutlet weak var mapView: GMSMapView!
    override func viewDidLoad() {
        super.viewDidLoad()
       
        let camera : GMSCameraPosition = GMSCameraPosition.cameraWithLatitude(-7.798657, longitude: 110.365746, zoom: 15.0)
        mapView.camera = camera
        // Do any additional setup after loading the view, typically from a nib.
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

}
Tambahkan pada AppDelegate,swift :
    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
        GMSServices.provideAPIKey("Key")
        // Override point for customization after application launch.
        return true
    }

Selengkapnya bisa dilihat di  https://youtu.be/s8sTx0vsRR8

Restoring Grub openSUSE (13.1)

Mengembalikan GRUB openSUSE


- Jalankan openSUSE dengan Live USB atau Live CD
- Jalankan masing-masing perintah dibawah ini dan contoh partisi openSUSE ada di sda5 :

> sudo -i

# fdisk -l

# mount /dev/sda5 /mnt
# mount --bind /dev /mnt/dev
# mount --bind /proc /mnt/proc 
# mount --bind /sys /mnt/sys
# chroot /mnt
# grub2-install /dev/sda
# exit

# reboot


Fungsi INSTR di MySQL

Fungsi INSTR di MySQL


mysql> select * from aa;

+---------+---------+
|   id    |  angka  |
+---------+---------+
|       1 | 2,3,5,4 |
|       4 | 4       |
|       2 | 2       |
|       3 | 2,6     |
+---------+---------+
4 rows in set (0.00 sec)


mysql> select * from aa where INSTR(CONCAT(',', angka,','), ',2,');
+---------+---------+
|   id    |  angka  |
+---------+---------+
|       1 | 2,3,5,4 |
|       2 | 2       |
|       3 | 2,6     |
+---------+---------+
3 rows in set (0.00 sec)


mysql> select * from aa where INSTR( angka, '4');
+---------+---------+
|   id    |  angka  |
+---------+---------+
|       1 | 2,3,5,4 |
|       4 | 4       |
+---------+---------+
2 rows in set (0.00 sec)

Mengatasi Masalah eth0 tidak terdeteksi di Ubuntu 10.04

Pertama cek dulu

# ifconfig -a

dan ternyata eth0 nya ga ada, saudara Eris sedih dan Galau.. :(

Solusinya :

Gunakan Komputer atau Laptop yang terkoneksi INTERNET, kemudian buka link berikut
http://linuxwireless.org/download/compat-wireless-2.6/
dan download file compat-wireless misal download compat-wireless-2012-12-18

Kemudian lakukan perintah-perintah berikut :

Masuk ke direktori file tersebut contoh di Desktop
# cd Desktop/
# tar-xjvf compat-wireless-2012-12-18.tar.bz2
# cd compat-wireless-2012-12-18/


# scripts/driver-select atl1c


# make


# make install


# make unload

# make wlunload


# make btunload


# sudo modprobe atl1c


Selesai... kemudia restart ..

# reboot

  Hasilnya  :





Sub Query Sederhana untuk membuat Laporan MySQL

mysql> select * from pegawai;
+------+--------+
| nik  | nama   |
+------+--------+
| PEG1 | Pampam |
| PEG2 | Agnes  |
| PEG3 | Catur  |
+------+--------+


mysql> select * from produksi;
+-------------+------+---------+--------+
| id_produksi | nik  | barang  | jumlah |
+-------------+------+---------+--------+
|           1 | PEG1 | barang1 |      4 |
|           2 | PEG1 | barang1 |      7 |
|           3 | PEG1 | barang1 |      1 |
|           4 | PEG2 | barang1 |      3 |
|           5 | PEG2 | barang1 |      1 |
|           6 | PEG3 | barang1 |      9 |
|           7 | PEG3 | barang2 |      9 |
|           8 | PEG2 | barang2 |      1 |
|           9 | PEG1 | barang2 |      5 |
+-------------+------+---------+--------+
9 rows in set (0.00 sec)



Query berdasarkan nik pegawai: 


mysql> select nik as nik_pegawai,nama,(select sum(jumlah)  from produksi where nik=nik_pegawai) as jumlah_produksi from produksi inner join pegawai using (nik) group by nik;
+-------------+--------+-----------------+
| nik_pegawai | nama   | jumlah_produksi |
+-------------+--------+-----------------+
| PEG1        | Pampam |              17 |
| PEG2        | Agnes  |               5 |
| PEG3        | Catur  |              18 |
+-------------+--------+-----------------+
3 rows in set (0.01 sec)




Query berdasarkan nik dan barang: 


mysql> select nik as nik_pegawai,nama,barang as barang_produksi,(select sum(jumlah)  from produksi where nik=nik_pegawai and barang=barang_produksi) as jumlah_produksi from produksi inner join pegawai using (nik) group by nik,barang;
+-------------+--------+-----------------+-----------------+
| nik_pegawai | nama   | barang_produksi | jumlah_produksi |
+-------------+--------+-----------------+-----------------+
| PEG1        | Pampam | barang1         |              12 |
| PEG1        | Pampam | barang2         |               5 |
| PEG2        | Agnes  | barang1         |               4 |
| PEG2        | Agnes  | barang2         |               1 |
| PEG3        | Catur  | barang1         |               9 |
| PEG3        | Catur  | barang2         |               9 |
+-------------+--------+-----------------+-----------------+
6 rows in set (0.00 sec)

Tampilkan dalam bentuk file PHP :



<?php
$con=mysql_connect('localhost','abby','abby');
if(!mysql_select_db('abby',$con))
    {die("database salah");}

$nik='xxx';
echo"<table align='center' border='1'>
<tr>
<th>NIK</th>
<th>Nama Pegawai</th>
<th>Nama Barang</th>
<th>Jumlah Produksi</th>
</tr>";
$q=mysql_query("select nik as nik_pegawai,nama,barang as barang_produksi,(select sum(jumlah)  from produksi where nik=nik_pegawai and barang=barang_produksi) as jumlah_produksi from produksi inner join pegawai using (nik) group by nik,barang");
while($d=mysql_fetch_array($q))
{
if($nik!=$d[nik_pegawai])
{
$nik=$d['nik_pegawai'];
$nama=$d['nama'];
}
else
{
$nik='';
$nama='';
}

echo "<tr>
<td>$nik</td>
<td>$nama</td>
<td>$d[barang_produksi]</td>
<td>$d[jumlah_produksi]</td>
</tr>";

$nik=$d['nik_pegawai'];
$nama=$d['nama'];

}
echo"</table>";
?>

Hasil :



Sub Query Sederhana untuk membuat Laporan MySQL