A collection of mongodb tutorials

mongodb

MongoDB  adalah sistem basis data berorentasi dokumen lintas platform. Diklasifikasikan sebagai basis data “NoSQL“, MongoDB menghindari struktur basis data relasional tabel berbasis tradisional yang mendukung JSON seperti dokumen dengan skema dinamis (MongoDB menyebutnya sebagai format BSON), membuat integrasi data dalam beberapa jenis aplikasi lebih mudah dan lebih cepat. Dirilis di bawah kombinasi dari GNU Affero General Public License dan Lisensi Apache (wikipedia)

di bawah ini beberapa link tutorial untuk belajar mongodb

Tuorial Point

merupakan situs berbagi tutotial yang bisa jadi tujuan utama belajar mongodb. tutorial point menyajikan tutorial dasar mongodb dengan sangat baik sehingga sangat pas untuk yang mau belajar mongodb

linkhttps://www.tutorialspoint.com/mongodb/index.htm

 

W3resource

selain tutorial point, w3resource juga membagi pengetahuan tentang database mongodb secara gratis.

link : http://www.w3resource.com/mongodb/nosql.php

 

Docs Mongodb

merupakan hal yang paling di referensikan bagi kamu yang mau mempelajari mongodb dan mengupas habis tentang apa itu mongodb

link : https://docs.mongodb.com/manual/

 

Python Mongodb

di sini kamu akan di kenalkan dengan python, dari proses instalasi sampai cara mengintegrasikan mongodb dan python

linkhttp://api.mongodb.com/python/current/tutorial.html

 

good luck …….!

Changing Remote Url Repository Github

Changing Remote Url Repository Github

The git remote set-url command takes two arguments:

  • An existing remote name. For example, origin or upstream are two common choices.
  • A new URL for the remote. For example:
    • If you’re updating to use HTTPS, your URL might look like:
      https://github.com/USERNAME/REPOSITORY.git
      
    • If you’re updating to use SSH, your URL might look like:
      git@github.com:USERNAME/REPOSITORY.git
      

Switching remote URLs from SSH to HTTPS

  1. Open Git Bash.
  2. Change the current working directory to your local project.
  3. List your existing remotes in order to get the name of the remote you want to change.
    git remote -v
    origin  git@github.com:USERNAME/REPOSITORY.git (fetch)
    origin  git@github.com:USERNAME/REPOSITORY.git (push)
    
  4. Change your remote’s URL from SSH to HTTPS with the git remote set-url command.
    git remote set-url origin https://github.com/USERNAME/REPOSITORY.git
    
  5. Verify that the remote URL has changed.
    git remote -v
    # Verify new remote URL
    origin  https://github.com/USERNAME/REPOSITORY.git (fetch)
    origin  https://github.com/USERNAME/REPOSITORY.git (push)
    

The next time you git fetch, git pull, or git push to the remote repository, you’ll be asked for your GitHub username and password.

Switching remote URLs from HTTPS to SSH

  1. Open Git Bash.
  2. Change the current working directory to your local project.
  3. List your existing remotes in order to get the name of the remote you want to change.
    git remote -v
    origin  https://github.com/USERNAME/REPOSITORY.git (fetch)
    origin  https://github.com/USERNAME/REPOSITORY.git (push)
    
  4. Change your remote’s URL from HTTPS to SSH with the git remote set-url command.
    git remote set-url origin git@github.com:USERNAME/REPOSITORY.git
    
  5. Verify that the remote URL has changed.
    git remote -v
    # Verify new remote URL
    origin  git@github.com:USERNAME/REPOSITORY.git (fetch)
    origin  git@github.com:USERNAME/REPOSITORY.git (push)
    

Troubleshooting

You may encounter these errors when trying to changing a remote.

No such remote ‘[name]’

This error means that the remote you tried to change doesn’t exist:

git remote set-url sofake https://github.com/octocat/Spoon-Knife
fatal: No such remote 'sofake'

Check that you’ve correctly typed the remote name.

Further reading

 

docs : https://help.github.com/

Dictionary Raw SQL Queries Django

Python Django

Bagaimana cara membuat dictionary pada raw SQL query django ?

pertama import library django connection

from django.db import connections
cursor = connections['default'].cursor()

 

kedua buat function untuk merubah index menjadi dictionary

def dictfetchall(cursor):
    "Return all rows from a cursor as a dict"
    columns = [col[0] for col in cursor.description]
    return [
        dict(zip(columns, row))
        for row in cursor.fetchall()
        ]

 

ketiga buat function untuk memanggil data dari database

def p_mapping_list(request):
    try:
        cursor.execute("""SELECT id, parent_id FROM test LIMIT 2""")
        all_list = dictfetchall(cursor)
        for p in all_list: 
            print(p.parent_id)
    except:
        cursor.close()
        connections['default'].cursor()

 

link dokumentasihttps://docs.djangoproject.com/en/1.11/topics/db/sql/

good luck …!

 

Php cUrl Http Request

PHP cURL HTTP Request

Apa itu cURL ?, Curl adalah sebuah program yang memungkinan kita memindai data dari atau ke sebuah server tanpa interaksi dari masing-masing user.

Script awal yang akan kita coba adalah me-load sebuah halaman web, memindai kontennya, dan mencetak kembali. dalam SOAP request ada 3 hal yang perlu di pahami

  1. Action
  2. Header
  3. Body

Langsung aja ya :

<?php
$url = “https://xxx.com/index.php?wsdl”;
$header = array(
  ‘Accept: */*’,
  ‘Accept-Language: en-us’,
  ‘Content-Type: text/xml; charset=utf-8’,
  “Cache-Control: no-cache”,
  “Pragma: no-cache”,
  “SOAPAction: ‘urn:WsSearchFlight'”,
);
 
$soap_request = ‘<soapenv:Envelope 	xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”
xmlns:xsd=”http://www.w3.org/2001/XMLSchema”
xmlns:soapenv=”http://schemas.xmlsoap.org/soap/envelope/” xmlns:urn=”urn:sj_service”>
  <soapenv:Header/>
  <soapenv:Body>
  	<urn:WsSearchFlight
soapenv:encodingStyle=”http://schemas.xmlsoap.org/soap/encoding/”>
  		<param xsi:type=”urn:reqWsSearchFlight” xmlns:urn=”urn:webservice”>
 
  		</param>
  	</urn:WsSearchFlight>
  </soapenv:Body>
</soapenv:Envelope>’;
 
$soap_do = curl_init();
curl_setopt($soap_do, CURLOPT_URL, $url );
curl_setopt($soap_do, CURLOPT_CONNECTTIMEOUT, 1000);
curl_setopt($soap_do, CURLOPT_TIMEOUT, 1000);
curl_setopt($soap_do, CURLOPT_RETURNTRANSFER, true );
curl_setopt($soap_do, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($soap_do, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($soap_do, CURLOPT_POST, true );
curl_setopt($soap_do, CURLOPT_POSTFIELDS, $soap_request);
curl_setopt($soap_do, CURLOPT_HTTPHEADER, $header);
 
if(curl_exec($soap_do) === false) {
  $err = ‘Curl error: ‘ . curl_error($soap_do);
  curl_close($soap_do);
  print $err;
} else {
  $info = curl_exec($soap_do);
  curl_close($soap_do);
  print ‘Operation completed without any errors<br>’;
  print_r($info);
}
 
 
?>

good luck …!

Auto Complete Django

Auto Complete Django

Bagaimana membuat form auto complete pada django ?

Buat sebuah form

<div>
    Hotel Name: <input type="text" id="ean_hotel" name="hotel_name" />
   ID_Ean : <input type="text" id="id_ean" name="id_ean" />
</div>

 

Buat scrip auto complete dengan jquery

<script type="text/javascript">
$(document).ready(function(){
    var ac_config = {
        source:'http://localhost:8002/properties/p-auto',
        headers: {'X-CSRFToken': '{{ csrf_token }}'},
    select: function(event, ui) {
        $('#id_ean').val(ui.item.property_id);
        event.preventDefault();
        $("#ean_hotel").val(ui.item.properties_name); },
        minLength:1
    };
    $("#ean_hotel").autocomplete(ac_config);
});
</script>

 

buat function untuk mengolah data json 

def get_auto_properties(request):
    propertyGet = request.GET.get('term')
    getProperties = Propertiesmodel.objects.filter(name__contains=propertyGet)
 
    lst = []
    for x in getProperties:
        d = {}
        d['ean_hotel_id'] = x.ean_hotel_id
        d['property_id'] = x.property_id
        d['properties_name'] = x.name
        lst.append(d)
 
    response = json.dumps(lst, default=myconverter)
    return HttpResponse(response)
 
def myconverter(o):
    if isinstance(o, datetime):
        return o.__str__()

 

good luck …!