Jumat, 30 Juni 2017

Privacy Policy - Educa Media

Privacy Policy Educa Media

 


Kebijakan Privasi untuk Aplikasi Educa Media

Privasi Anda sebagai Pengguna Aplikasi Educa Media adalah hal yang sangat penting bagi kami.


Di Educa Media kami menganggap bahwa privasi dari informasi pribadi Anda adalah hal yang penting. Dan inilah keterangan mengenai informasi apa saja yang kami terima dan kami kumpulkan pada saat Anda mengunjungi dan menggunakan aplikasi Educa Media dan bagaimana kami menyimpan serta menjaga informasi tersebut. Kami tegaskan bahwa kami tidak akan pernah memberikan informasi tersebut kepada pihak ketiga.


Tentang file log

Seperti kebanyakan situs lain, kami mengumpulkan dan menggunakan data yang terdapat pada file log. Informasi yang terdapat pada file log termasuk alamat IP (Internet Protocol) Anda, ISP (Internet Service Provider), browser yang Anda gunakan, waktu pada saat Anda berkunjung dan halaman mana saja yang Anda buka selama berkunjung di Educa Media.


Tentang cookies

Situs kami menggunakan cookies untuk menaruh informasi, seperti informasi preferensi pribadi Anda pada saat mengunjungi situs kami. Ini juga mungkin termasuk untuk menampilkan jendela pop up untuk kunjungan pertama Anda, atau juga untuk menyimpan informasi login Anda di situs kami.


Educa Media

juga menggunakan iklan dari pihak ketiga untuk mendukung situs dan pengembangan aplikasi kami. Beberapa penayang iklan ini mungkin menggunakan cookies ketika menampilkan iklan di situs kami, yang juga mengirimkan kepada pemasang iklan (seperti Google melalui program Adsense atau Admob) informasi seperti alamat IP (Internet Protocol) Anda, ISP (Internet Servide Provider), browser internet yang Anda gunakan dan sebagainya.

Hal ini biasanya digunakan untuk tujuan penargetan iklan berdasarkan lokasi (seperti menampilkan iklan properti di Jakarta, misalnya) atau menampilkan iklan yang sesuai berdasarkan situs-situs yang telah Anda kunjungi (seperti menampilkan iklan gadget bagi Anda yang kerap mengunjungi situs-situs gadget, misalnya). Iklan bisanya juga datang dengan data cookies dari history mesin pencari di Smartphone anda, misal anda selama 3 hari ini mencari-cari jenis laptop atau komputer, kemungkinan besar iklan yang muncul pada aplikasi kami adalah hal-hal berkaitan dengan elektronik, laptop, dan komputer.


Anda dapat memilih untuk men-disable cookies melalui setelan pada browser Anda, atau melalui setting pada program semacam Norton Internet Security atau yang lainnya. Namun demikian, hal ini dapat mempengaruhi pengalaman Anda dalam berinteraksi dengan situs kami sebagaimana juga dengan situs lainnya. Termasuk Anda tidak bisa masuk ke layanan kami, seperti login ke forum atau ke akun yang Anda miliki.


Aplikasi ini menggunakan izin untuk mengakses hal-hal yang bersifat pribadi seperti (camera, microphone, accounts, contacts, or phone) itu semua kami lakukan untuk mendukung kinerja aplikasi kami, hal tersebut juga akan dikonfirmasi ke pengguna jika Sistem Operasi yang pengguna miliki di atas Android 6.0 (Marshmalow). Untuk versi dibawahnya, tidak ada notifikasi konfirmasi izin tersebut.


Terimakasih


Educa Media

Senin, 15 Agustus 2016

Different Between HashMap and HashTable

Difference between HashMap and Hashtable is one of the most popular java interview questions.
We have already discussed other popular java interview questions like ArrayList vs Vector and Comparator vs Comparable .This question is generally asked in java intereview to check whether candidate understand correct usage of collection classes and has knowledge of alternative solutions. Difference between hashmap and hashtable  includes five point  namely Synchronization,Null keys and values,Iterating values , Fail fast iterator ,Performance,Superclass .


Read Also :  Difference between HashMap and ConcurrentHashMap with Example


Difference between HashMap and HashTable / HashMap vs HashTable  

1. Synchronization or Thread Safe :  This is the most important difference between two . HashMap is non synchronized and not thread safe.On the other hand, HashTable is thread safe and synchronized.
When to use HashMap ?  answer is if your application do not require any multi-threading task, in other words hashmap is better for non-threading applications. HashTable should be used in multithreading applications. 

2. Null keys and null values :  Hashmap allows one null key and any number of null values, while Hashtable do not allow null keys and null values in the HashTable object.



3. Iterating the values:  Hashmap object values are iterated by using iterator .HashTable is the only class other than vector which uses enumerator to iterate the values of HashTable object.


difference between hashmap and hashtable
4.  Fail-fast iterator  : The iterator in Hashmap is fail-fast iterator while the enumerator for Hashtable is not.
According to Oracle Docs,  if the Hashtable is structurally modified at any time after the iterator is created in any way except the iterator's own remove method , then the iterator will throw ConcurrentModification Exception.
Structural modification means adding or removing elements from the Collection object (here hashmap or hashtable) . Thus the enumerations returned by the Hashtable keys and elements methods are not fail fast.We have already explained the difference between iterator and enumeration.


5. Performance :  Hashmap is much faster and uses less memory than Hashtable as former is unsynchronized . Unsynchronized objects are often much better in performance in compare to synchronized  object like Hashtable in single threaded environment.

6. Superclass and Legacy :  Hashtable is a subclass of Dictionary class which is now obsolete in Jdk 1.7 ,so ,it is not used anymore. It is better off externally synchronizing a HashMap or using a ConcurrentMap implementation (e.g ConcurrentHashMap).HashMap is the subclass of the AbstractMap class. Although Hashtable and HashMap has different superclasses but they both are implementations of the "Map"  abstract data type.


Example of HashMap  and HashTable 


import java.util.Hashtable;


public class HashMapHashtableExample {
    
    public static void main(String[] args) { 
 
           
  
        Hashtable<String,String> hashtableobj = new Hashtable<String, String>();
        hashtableobj.put("Alive is ", "awesome");
        hashtableobj.put("Love", "yourself");
        System.out.println("Hashtable object output :"+ hashtableobj);
 
         
 
        HashMap hashmapobj = new HashMap();
        hashmapobj.put("Alive is ", "awesome");  
        hashmapobj.put("Love", "yourself"); 
        System.out.println("HashMap object output :"+hashmapobj);   
 
 }
}




Output :  Hashtable object output :{Love=yourself, Alive is =awesome}
                 HashMap object output :{Alive is =awesome, Love=yourself}
    

Similarities Between HashMap and Hashtable

1. Insertion Order :   Both HashMap and Hashtable  does not guarantee that  the order of the map will remain constant over time. Instead use LinkedHashMap, as the order remains constant over time.

2. Map interface :   Both HashMap and Hashtable implements Map interface .

3. Put and get method :  Both HashMap and Hashtable provides constant time performance for put and get methods assuming that the objects are distributed uniformly across the bucket.

4. Internal working :  Both HashMap and Hashtable works on the Principle of Hashing . We have already discussed how hashmap works in java .


When to use HashMap and Hashtable?

1. Single Threaded Application

HashMap should be preferred over Hashtable for the non-threaded applications. In simple words , use HashMap in unsynchronized or single threaded applications .

2. Multi Threaded Application

We should avoid using Hashtable, as the class is now obsolete in latest Jdk 1.8 . Oracle has provided a better replacement of Hashtable named ConcurrentHashMap. For multithreaded  application prefer ConcurrentHashMap instead of Hashtable.


Recap  : Difference between HashMap and Hashtable in Java  




HashMapHashtable
SynchronizedNoYes
Thread-SafeNoYes
Null Keys and Null valuesOne null key ,Any null valuesNot permit null keys and values
Iterator typeFail fast iteratorFail safe iterator
PerformanceFastSlow in comparison
Superclass and LegacyAbstractMap , NoDictionary , Yes 


In case you have any other query please mention in the comments .

Selasa, 02 Agustus 2016

Android Code - Marshmallow Asking Permission

Pada onCreate
cek versi android

int currentapiVersion = android.os.Build.VERSION.SDK_INT;


if (currentapiVersion >= 23) {
    // Do something for 14 and above versions    cek();

} else {

    // do something for phones running an SDK before 14
}



Tambahkan function berikut

private static final int PERMISSION_REQUEST_CODE = 1;
public void cek(){
        if (checkPermission()) {

//            Snackbar.make(getCurrentFocus(),"Permission already granted.",Snackbar.LENGTH_LONG).show();
        } else {

//            Snackbar.make(getCurrentFocus(),"Please request permission.",Snackbar.LENGTH_LONG).show();        }

        if (!checkPermission()) {

            requestPermission();

        } else {

            Snackbar.make(getCurrentFocus(),"Permission already granted.",Snackbar.LENGTH_LONG).show();

        }

    }

    private boolean checkPermission(){
        int result = ContextCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.WRITE_EXTERNAL_STORAGE);
        if (result == PackageManager.PERMISSION_GRANTED){

            return true;

        } else {

            return false;

        }
    }

    private void requestPermission(){

        if (ActivityCompat.shouldShowRequestPermissionRationale(this,Manifest.permission.WRITE_EXTERNAL_STORAGE)){

            Toast.makeText(getApplicationContext(),"GPS permission allows us to access location data. Please allow in App Settings for additional functionality.",Toast.LENGTH_LONG).show();

        } else {

            ActivityCompat.requestPermissions(this,new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},PERMISSION_REQUEST_CODE);
        }
    }

    @Override    public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) {
        switch (requestCode) {
            case PERMISSION_REQUEST_CODE:
                if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {

//                    Snackbar.make(getCurrentFocus(),"Permission Granted, Now you can access location data.",Snackbar.LENGTH_LONG).show();
                } else {

//                    Snackbar.make(getCurrentFocus(),"Permission Denied, You cannot access location data.", Snackbar.LENGTH_LONG).show();
                }
                break;
        }
    }