.
Tampilkan postingan dengan label JQuery. Tampilkan semua postingan
Tampilkan postingan dengan label JQuery. Tampilkan semua postingan

Kamis, 09 Januari 2014

Creating a File Encryption App with JavaScript

 
Security and privacy are hot topics at the moment. This is an opportunity for us to take an introspective look into the way we approach security. It is all a matter of compromise – convenience versus total lock down. Today’s tutorial is an attempt to mix a bit of both.
The app we are going to build today is an experiment that will allow people to choose files from their computers and encrypt them client-side with a pass phrase. No server-side code will be necessary, and no information will be transferred between client and server. To make this possible we will use the HTML5 FileReader API, and a JavaScript encryption library - CryptoJS.
Note that the app doesn’t encrypt the actual file, but a copy of it, so you won’t lose the original. But before we start, here are a few issues and limitations:

Issues and limitations

The 1MB limit
If you play with the demo, you will notice that it doesn’t allow you to encrypt files larger than 1mb. I placed the limit, because the HTML5 download attribute, which I use to offer the encrypted file for download, doesn’t play well with large amounts of data. Otherwise it would cause the tab to crash in Chrome, and the entire browser to crash when using Firefox. The way around this would be to use the File System API and to write the actual binary data there, but it is supported only in Chrome for now. This is not an issue with the encryption speed (which is quite fast), but with offering the file for download.

What about HTTPS?
When it comes to encrypting data and securing information, people naturally expect the page to be loaded through HTTPS. In this case I believe it is not necessary, as apart from the initial download of the HTML and assets, no data is transferred between you and the server – everything is done client-side with JavaScript.  If this bothers you, you can just download the demo and open it directly from your computer.

How secure is it?
The library that I use - CryptoJS - is open source, so I believe it to be trustworthy. I use the AES algorithm from the collection, which is known to be secure. For best results, use a long pass phrase that is difficult to guess.

JavaScript File Encryption App
JavaScript File Encryption App

The HTML

The markup of the app consists of a regular HTML5 document and a few divs that separate the app into several individual screens. You will see how these interact in the JavaScript and CSS sections of the tutorial.

index.html

<!DOCTYPE html>
<html>

    <head>
        <meta charset="utf-8"/>
        <title>JavaScript File Encryption App</title>
        <meta name="viewport" content="width=device-width, initial-scale=1" />
        <link href="http://fonts.googleapis.com/css?family=Raleway:400,700" rel="stylesheet" />
        <link href="assets/css/style.css" rel="stylesheet" />
    </head>

    <body>

        <a class="back"></a>

        <div id="stage">

            <div id="step1">
                <div class="content">
                    <h1>What do you want to do?</h1>
                    <a class="button encrypt green">Encrypt a file</a>
                    <a class="button decrypt magenta">Decrypt a file</a>
                </div>
            </div>

            <div id="step2">

                <div class="content if-encrypt">
                    <h1>Choose which file to encrypt</h1>
                    <h2>An encrypted copy of the file will be generated. No data is sent to our server.</h2>
                    <a class="button browse blue">Browse</a>

                    <input type="file" id="encrypt-input" />
                </div>

                <div class="content if-decrypt">
                    <h1>Choose which file to decrypt</h1>
                    <h2>Only files encrypted by this tool are accepted.</h2>
                    <a class="button browse blue">Browse</a>

                    <input type="file" id="decrypt-input" />
                </div>

            </div>

            <div id="step3">

                <div class="content if-encrypt">
                    <h1>Enter a pass phrase</h1>
                    <h2>This phrase will be used as an encryption key. Write it down or remember it; you won't be able to restore the file without it. </h2>

                    <input type="password" />
                    <a class="button process red">Encrypt!</a>
                </div>

                <div class="content if-decrypt">
                    <h1>Enter the pass phrase</h1>
                    <h2>Enter the pass phrase that was used to encrypt this file. It is not possible to decrypt it without it.</h2>

                    <input type="password" />
                    <a class="button process red">Decrypt!</a>
                </div>

            </div>

            <div id="step4">

                <div class="content">
                    <h1>Your file is ready!</h1>
                    <a class="button download green">Download</a>
                </div>

            </div>
        </div>

    </body>

    <script src="assets/js/aes.js"></script>
    <script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
    <script src="assets/js/script.js"></script>

</html>

Only one of the step divs is visible at a time. Depending on the choice of the user – to encrypt or decrypt – a class name is set on the body element. With CSS, this class name hides the elements with either the if-encrypt or if-decrypt classes. This simple gating allows us to write cleaner JavaScript that is minimally involved with the UI.

Choose File To Encrypt
Choose File To Encrypt

The JavaScript Code

As I mentioned in the intro, we are going to use the HTML5 FileReader API (support) and the CryptoJS library together. The FileReader object lets us read the contents of local files using JavaScript, but only of files that have been selected explicitly by the user through the file input’s browse dialog. You can see how this is done in the code below. Notice that most of the code handles the transitions between the different screens of the app, and the actual reading of the file happens from line 85.

assets/js/script.js

$(function(){

    var body = $('body'),
        stage = $('#stage'),
        back = $('a.back');

    /* Step 1 */

    $('#step1 .encrypt').click(function(){
        body.attr('class', 'encrypt');

        // Go to step 2
        step(2);
    });

    $('#step1 .decrypt').click(function(){
        body.attr('class', 'decrypt');
        step(2);
    });

    /* Step 2 */

    $('#step2 .button').click(function(){
        // Trigger the file browser dialog
        $(this).parent().find('input').click();
    });

    // Set up events for the file inputs

    var file = null;

    $('#step2').on('change', '#encrypt-input', function(e){

        // Has a file been selected?

        if(e.target.files.length!=1){
            alert('Please select a file to encrypt!');
            return false;
        }

        file = e.target.files[0];

        if(file.size > 1024*1024){
            alert('Please choose files smaller than 1mb, otherwise you may crash your browser. \nThis is a known issue. See the tutorial.');
            return;
        }

        step(3);
    });

    $('#step2').on('change', '#decrypt-input', function(e){

        if(e.target.files.length!=1){
            alert('Please select a file to decrypt!');
            return false;
        }

        file = e.target.files[0];
        step(3);
    });

    /* Step 3 */

    $('a.button.process').click(function(){

        var input = $(this).parent().find('input[type=password]'),
            a = $('#step4 a.download'),
            password = input.val();

        input.val('');

        if(password.length<5){
            alert('Please choose a longer password!');
            return;
        }

        // The HTML5 FileReader object will allow us to read the 
        // contents of the	selected file.

        var reader = new FileReader();

        if(body.hasClass('encrypt')){

            // Encrypt the file!

            reader.onload = function(e){

                // Use the CryptoJS library and the AES cypher to encrypt the 
                // contents of the file, held in e.target.result, with the password

                var encrypted = CryptoJS.AES.encrypt(e.target.result, password);

                // The download attribute will cause the contents of the href
                // attribute to be downloaded when clicked. The download attribute
                // also holds the name of the file that is offered for download.

                a.attr('href', 'data:application/octet-stream,' + encrypted);
                a.attr('download', file.name + '.encrypted');

                step(4);
            };

            // This will encode the contents of the file into a data-uri.
            // It will trigger the onload handler above, with the result

            reader.readAsDataURL(file);
        }
        else {

            // Decrypt it!

            reader.onload = function(e){

                var decrypted = CryptoJS.AES.decrypt(e.target.result, password)
                                        .toString(CryptoJS.enc.Latin1);

                if(!/^data:/.test(decrypted)){
                    alert("Invalid pass phrase or file! Please try again.");
                    return false;
                }

                a.attr('href', decrypted);
                a.attr('download', file.name.replace('.encrypted',''));

                step(4);
            };

            reader.readAsText(file);
        }
    });

    /* The back button */

    back.click(function(){

        // Reinitialize the hidden file inputs,
        // so that they don't hold the selection 
        // from last time

        $('#step2 input[type=file]').replaceWith(function(){
            return $(this).clone();
        });

        step(1);
    });

    // Helper function that moves the viewport to the correct step div

    function step(i){

        if(i == 1){
            back.fadeOut();
        }
        else{
            back.fadeIn();
        }

        // Move the #stage div. Changing the top property will trigger
        // a css transition on the element. i-1 because we want the
        // steps to start from 1:

        stage.css('top',(-(i-1)*100)+'%');
    }

});

I obtain the contents of the files as a data uri string (support). Browsers allow you to use these URIs everywhere a regular URL would go. The benefit is that they let you store the content of the resource directly in the URI, so we can, for example, place the contents of the file as the href of a link, and add the download attribute (read more) to it, to force it to download as a file when clicked.
I use the AES algorithm to encrypt the data uri with the chosen password, and to offer it as a download. The reverse happens when decrypting it. No data ever reaches the server. You don’t even need a server for that matter, you can open the HTML directly from a folder on your computer, and use it as is.

Enter a Pass Phrase
Enter a Pass Phrase

The CSS

I will present only the more interesting parts of the CSS here, you can see the rest in the stylesheet from the downloadable zip. The first thing to present, are the styles that create the layout and its ability to scroll smoothly between screens by changing the top property of the #stage element.

assets/css/styles.css

body{
    font:15px/1.3 'Raleway', sans-serif;
    color: #fff;
    width:100%;
    height:100%;
    position:absolute;
    overflow:hidden;
}

#stage{
    width:100%;
    height:100%;
    position:absolute;
    top:0;
    left:0;

    transition:top 0.4s;
}

#stage > div{  /* The step divs */
    height:100%;
    position:relative;
}

#stage h1{
    font-weight:normal;
    font-size:48px;
    text-align:center;
    color:#fff;
    margin-bottom:60px;
}

#stage h2{
    font-weight: normal;
    font-size: 14px;
    font-family: Arial, Helvetica, sans-serif;
    margin: -40px 0 45px;
    font-style: italic;
}

.content{
    position:absolute;
    text-align:center;
    left:0;
    top:50%;
    width:100%;
}
Because the step divs are set to a 100% width and height, they automatically take the full dimensions of the browser window without having to be resized.
Another interesting piece of code, are the conditional classes that greatly simplify our JavaScript:
[class*="if-"]{
    display:none;
}

body.encrypt .if-encrypt{
    display:block;
}

body.decrypt .if-decrypt{
    display:block;
}

This way, the encrypt and decrypt classes of the body control the visibility of the elements that have the respective if-* class.

We’re done!

With this our JavaScript encryption app is ready! You can use it to share pictures and documents with friends by sending them the version encrypted with a pre-agreed pass phrase. Or you can put the HTML of the app on a flash drive, along with your encrypted files, and open the index.html directly to decrypt them.

Jumat, 15 November 2013

Cara Mudah Membuat Aplikasi Dengan PHP

Membuat Aplikasi Dengan PHP. Masa bisa ??,, banyak mungkin diantara kita yang belum mengetahuinya, ya aplikasi yang tentunya adalah aplikasi dengan basis web. Baru-baru ini atau bahkan sudah banyak yang tau, bahwa membuat aplikasi php yang berbasis web, ternyata juga bisa dibuat versi dot “exe” yang mana fungsinya adalah agar bisa diinstall di komputer tanpa jaringan internet atau online, namun untuk membuat aplikasi tersebut juga menggunakan aplikasi lainya.
membuat aplikasi dengan php
membuat aplikasi dengan php
Dalam kaitanya dengan membuat aplikasi dengan php, banyak hal bisa kita buat dengan php. Untuk lebih lengkapnya baca terus artikel ini sampai habis.
Yang perlu diingat adalah bagaimana ide kita atau kreativitas kita dalam mengembangkan aplikasi bisa terus berinovasi, masalah bahasa pemrogramannya php atau yang lainya itu adalah sebenarnya cuman masalah implementasi dari sebuah ide yang kita miliki.

 Contoh aplikasi dengan PHP

Berikut adalah contoh aplikasi yang dibuat dengan php,
1. Google
Google adalah mesin penyacari yang sangat berkembang pesat. Aplikasi yang di kembangkannya pun sangat mempuni di bidang internet. Pokoknya Teman semua sudah tahu lah hebatnya google itu seperti apa,, yakan ????
2. Blogger
Sudah tahu blogger kan ??, atau masih belum kenal ??, kalau belum coba tanya mbah saya “google”, pasti dikasih tahu. Blogger merupakan contoh aplikasi yang dikembangkan oleh google. Blogger adalah aplikasi web yang memungkinkan kita dapat menjadi seorang pengguna yang sehingga bisa melakukan aktivitas blogging yang disediakan oleh blogger, seperti, posting, mengedit desain blog,  yang lainya.
3. WordPress
WordPress juga merupakan aplikasi web sejenis blog, namun disini ada yang dikembangkang dengan dua pilihan. Ada wordpress yang bersifat untuk domain sendiri atau selft domain atau juga wordpress yang domainya boleh ditentutkan oleh peraturan wordpress dengan beberapa keterbatasan.
4. Facebook
Saya jamin yang baca artikel ini sudah punya facebook, kalau belum saya gak posting lagi deh,, beneran :d. Facebook juga bisa kita golongkan sebagai aplikasi web. Fitur facebook juga mengintegrasi beberapa aplikasi menjadi satu, seperti misalnya aplikasi web yang dipadukan dengan aplikasi berbasis multimedia, dan juga aplikasi komputer.

Masih bayak lagi aplikasi web, yang mungkin tidak kita sadari. Tapi cepat atau lambat aplikasi akan berkembang menuju aplikasi  berbasis internet yang menggunkan jaringan sebagai media integrasinya.

Ide aplikasi dengan php


1. Membuat peta online
Ini adalah salah satu contoh berkembangkannya teknologi dan aplikasi. Yang kita tahu bahwa dulu peta berada sebuat kertas, namun kini bisa kita lihat secara realtime menggunakan komputer, atau bahkan hanya lewat handphone saja. Wowww,,, keren kan..
2. Kuis online
Juga,, bisa kita contohkan. Biasanya orang main kuis, secara tatap muka, Dengan adanya palikasi web yang memungkinkan untuk berinteraksi secara langsung, bermain kuis pun bisa dimana saja, tentunya dengan perkembangan teknologi seperti sekarang ini. Seperti gadget atau yang lainya.
3. Robot chating
Saya pernah mengetahui, salah satu contoh ini adalah seperti apa yang telah dibuat oleh salah satu senior saya dibangku kuliah. Ia membuat sebuat robot chatting yang terbuat dari koding php. Mantap kan..
4. Toko pulsa online
Beli pulsa tahun depan jangan ke counter pulsa lagi, cukup beli dirumah juga bisa. hehehe tahunn kapan ya,,,

opps,, hampir ketinggalan lalu bagaiman membuat aplikasi php itu bisa dikatakan mudah, Mungkin beberapa langkah ini adalah sebagai contoh mengapa bisa dikatakan mudah..
1. Sediakan komputer/Laptop , Ia donk mau ngoding kalau g ada komputer ya gak bisa buat aplikasi.
2. Pasang Notepad++, bisa juga menggunakan teks editor yang lainya.
3. Pasang Server, Server yang bisa kita gunakah contohnya xampp, wampp, upserve dan lain-lain
4. Pasang browser, browser adalah alat untuk merunning aplikasi web yang sudah kita buat. Contoh browser yang bisa kita pakai, opera, google chrome, mozila, netscpae dan lain-lain
5. Mulai ngoding Php, happy ngoding,,,,,

Mungkin itulah sedikit sharing saya tentang membuat aplikasi dengan php. Semoga bermanfaat.

Sabtu, 24 November 2012

Source Code SocialEngine


SocialEngine is a PHP-based social network platform that lets you create a social network on your website. Right out of the box, your social network will offer nearly all of the features found on today’s wildly popular social networks. Instead of hosting your social network on our servers, we give you complete control over your project by allowing you to download the source code and install it on your own server.
We don’t want you to create “turnkey” cookie-cutter social networks. We want your new social network to offer something unique. We call SocialEngine a “platform” because it instantly gives you a simple, unbranded network. This lets you get right to deploying your unique theme, social structure, or concept using our source code as a foundation.
What makes SocialEngine different?
SocialEngine is the only self-hosted social network platform that can truly give you the opportunity for explosive, viral growth. Other social network apps create social networks that look and work the same. SocialEngine’s simple design lets you highlight your unique theme. We’ve gone to great lengths to make customizations easier, with detailed comments placed throughout the completely unencrypted source code. SocialEngine also includes advanced social features not found in other apps, like subnetworks, multiple possible friendship structures, and very comprehensive privacy settings.
Features & Capabilities
Like most white-label social networking apps, SocialEngine is feature-rich. Unlike other products, however, SocialEngine is uniquely designed to support almost any social networking concept you might have. This means that you won’t end up with cookie-cutter results. Instead of throwing in as many end-user features as we could, we focused on building a stable, customizable platform upon which you can implement your own unique features and ideas. Of course, we’ve included all of the staples that end-users have come to expect: Blogs, albums, groups, messages, and everything else you see listed below. To avoid bombarding your users with an overkill of information, we’ve kept these as simple as possible and made them easy for you to modify (with fully commented code and HTML templates).

Senin, 19 November 2012

Template Aplikasi ExtJS (CodeIgniter 2.X + ExtJS 4.X)


Tampilannya Gan





Maaf gan newbie mau share Template Aplikasi (Buat Admin) pake CodeIgniter + ExtJS gan 

Ane baru belajar gan jadi kalo codingannya masih berantakan mohon dimaafkan 

Source Code (Full Comment Gan)
Code:
http://www.4shared.com/zip/uifj84U2...ExtJadwal.html



Tabel Usernya
Code:
Uname Varchar(16),

Upass Text,

Ugroup Varchar(16)



Kelebihan
Quote:
1. Ga perlu ngetik HTML
2. Ga perlu tau design (walo kalo tau dikit-dikit bisa explore lebih dalam)
3. Include Comment
4. Integrasi Ke Framework CodeIgniter
5. Event Listener Ready


Kekurangan
Quote:
1. Codingan berantakan (maklum baru belajar)
2. Belum Include Login Form (bikin ndiri aje ye gan )
3. Source code kagak include database tapi udah ane jelasin bentuk tabel usernya yang punya ane 
4. Bentuk masih monoton  sekali lagi maklumin ye coz newbie





Sabtu, 17 November 2012

Membuat/Mendesain Website di Linux


Bagaimana caranya mendesain dan mengembangkan aplikasi berbasis web di Linux.

Saya memulai belajar HTML ketika saya masih duduk di bangku SMK. Dokument HTML pertama kali yang saya buat menggunakan text editor di Windows, Notepad. Yeah, mungkin waktu itu sistem operasi yang saya kenal hanya Windows saja. Dan tentunya hanya itu text editor yang saya pakai pada saat itu. Pengetahuan saya masih minim, saya tidak mengenal IDE seperti Dreamwaver dan teman-temannya. Ketika saya mengenal Dreamwaver, saya merasa membuat sebuah dokumen HTML sangatlah mudah. IDE ajaib ini telah mengubah pandangan saya mengenai cara membuat dokumen HTML. Sudah ada Dreamwaver mengapa harus menggunakan notepad?

Jika menggunakan notepad, aktifitas mencet keyboard adalah 100%, hasil pencetan tadi harus kita cek dengan menggunakan web browser.  Dan jika menggunakan Dreamwaver tinggal klik sana, klik sini, ketik dikit jadi deh. Dan yang lebih canggih, kita tidak perlu mengecek layout yang kita buat lewat browser. Sangat gampang dan cepat. Namun itu tidak bertahan lama, ketika saya sudah mulai belajar pemrograman berbasis web seperti PHP, dan Javascript. Pada saat itu dominan desain yang saya buat masih Tables atau sebagian besar menggunakan tabel, jadi masih ngga masalah jika hanya menggunakan Dreamwaver. Tapi ketika menggunakan CSS, ceritanya lain lagi. Apalagi setiap web browser menampilkan layout yang kita buat dengan cara yang berbeda-beda, terutama Internet Explorer. Yeah, IE memang web browser yang selalu ingin tampil beda. Buat desainer web pasti ngerti maksud saya hehehe :D



Kita tidak bisa mencoba aplikasi yang kita buat menggunakan PHP, Javascript atau bahasa pemrograman yang lainnya via IDE, yang paling bagus buat ngetes ya web browser itu sendiri. Pokoknya web browser ngga bakalan pernah bohongin kita deh. Nah dari sana saya berfikir, ngga ada lagi IDE yang super canggih untuk desain website. Dalam desain atau pemrograman web, yang canggih itu harus logika dan ide kita sendiri. Nah karena pada saat itu spesifikasi komputer yang saya gunakan bisa dibilang "merangkak" dan ketika menjalankan Dreamwaver leletnya minta ampun, saya kembali berfikir untuk menggunakan Notepad saja daripada Dreamwaver. Toh juga nantinya test programnya lewat browser, bener ngga? Dan pada akhirnya ketemulah sama Notepad++, mungkin bisa dibilang Cucunya Notepad yang tampil lebih smart dari moyangnya.

Selanjutnya, dalam mengembangkan aplikasi bebasis web, sebelum mengenal Linux, saya biasanya menggunakan Notepad++ sebagai text editor. Ketika teman-teman saya melihat saya ngoding menggunakan Notepad++ mereka pasti akan menyarankan menggunakan Dreamwaver, dan tentu saja dengan sedikit sombong saya jawab, "Sama saja". He he he, maaf jika pembaca tidak berkenan tapi begitulah menurut saya. Yah, daripada harus menjalankan Dreamwaver dengan resource yang lumayan besar, saya lebih memilih Notepad++ dengan resource yang lebih sedikit namun powerfull. Lagipula Dreamwaver berbayar pula alias ngga ngratis, jika ada versi terbaru kita tentu harus membelinya.

Oke itu pengelaman saya jika mengembangkan aplikasi berbasis web di Windwos, lain ceritanya jika di Linux. Jika di Linux saya punya daftar tersendiri buat aplikasi untuk mengembangkan aplikasi berbasisw web. Kira-kira inilah aplikasi yang sering saya gunakan.

1. Bluefish.
Inilahh editor yang paling saya gemari jika sedang mengembangkan aplikasi berbasis web dengan menggunakan sistem operasi Linux. Sebenarnya Bluefish tidak hanya ada di Linux tapi juga tersedia untuk sistem operasi Windows. Masih saudaraan dengan Notepad++ menurut saya. Namun dia memiliki keahlian khusu yaitu untuk web application. Dilengkapi dengan fitur autocomplete jadi sangat membantu dalam pengembangan aplikasi berbasis web. Selain itu bluefish sangat ringan dan hanya memerlukan sedikit resource. Pokoknya mantep deh, dan menurut banyak developer web yang bekerja menggunakan Linux, Bluefish adalah editor yang sangat disarankan.

Cara Install (Debian, Ubuntu, Linux Mint dan turunannya)
sudo apt-get install bluefish
Atau distro Linux lainnya download di sini

2. Geany
Saya bisa ibaratkan Notepad++ dan Geany itu sebelas duabelas deh. Sangat mirip banget, multifungsi dan ringan. Mendukung banyak bahasa pemrogaman seperti Pascal, Java, PHP, C, C++ dan lain sebagainya.

Cara Install (Debian, Ubuntu, Linux Mint dan turunannya)
sudo apt-get install geany 
Atau distro Linux lainnya download di sini

3. Aptana Studio
Jika pembaca memiliki spesifikasi komputer yang tinggi, saya sarankan menggunakan aptana studio. Full fitur dan lengkap itulah Aptana Studio. Ngga tanggung, dilengkapi dengan code validator, dan masih banyak lagi plugin-plugin lainnya. Anda bisa mendapatkan Aptana Studio dari aptana.comtentunya dengan cuma-cuma

Sebenarnya masih banyak lagi editor-editor yang bagus lainnya, namun menurut pengalaman saya, tiga yang saya sebutkan di atas merupakan yang paling baik. Anda punya banyak pilihan, bahkan gedittext editor standar di Linux juga bisa anda gunakan. Namun untuk masalah web development, saya merekomendasikan tiga aplikasi yang saya sebutkan di atas. Kenapa saya tidak menyebutkan semua? Agar pembaca tidak bingung dan menginstal banyak editor di system pembaca. Untuk aplikasi berbasis web, cukuplah ketiga editor tersebut. Ini sih versi saya, mungkin pembaca masih punya editor yang menurut pembaca lebih baik, jadi kembali ke diri masing-masing saja, jika sudah nyaman dengan pilihan pembaca, mengapa harus beralih ke editor lainnya?

Untuk membuat atau mengedit gambar untuk desain website anda anda bisa menggunakan GIMP dan Inkscape dan kebanyak distro Linux sudah menginstallnya secara default. Mungkin pertama kali menggunakan GIMP ataupun Inkscape akan sedikit kebingungan, namun setelah dipelajari saya yakin anda pasti bisa menggunakannya. Jika GIMP atau Inkscape belum terinstall di system Linux anda berikut adalah cara untuk menginstallnya (Debian, Ubuntu, Linux Mint, dan turunannya).

GIMP
sudo apt-get install gimp
Inkscape
sudo apt-get install inkscape
Jika anda ingin belajar tentang GIMP dan Inkscape anda bisa belajar dari sangguru.com  (tutorial berbahasa Indonesia)

Nah selanjutnya, bagaimana cara menginstall web server di Linux? Saya akan memberitahukan cara yang paling mudah dan tentunya paling cepat. Anda hanya perlu menginstall LAMPP (XAMPP), sehingga anda tidak perlu menginstall PHP, apache dan MySql secara terpisah. Silahkan download terlebih dahulu LAMPP di sini. Jika sudah selesai mendownload, silahkan letakan file file xampp-linux-x.x.x.tar.gz di direktori /home. Buka terminal dengan menekan Ctrl + Alt + T atau dari Accessories > Terminal kemudian ketikan:
sudo tar xvfz xampp-linux-x.x.x.tar.gz -C /opt
Ubah huruf X sesuai dengan kode versi dari XAMPP yang anda download, misalkan XAMPP-1.8.0.tar.gz. Perintah tersebut akan mengekstrak file yang anda download tadi ke direktori /opt.
Untuk menjalankan service, ketikan:
sudo /opt/lampp/lampp start
Nah sekarang, service (apache, PHP, dan MySql)  anda sudah berjalan. Cobalah ketikan 127.0.0.1 atau localhost di web browser anda untuk mengecek apakah XAMPP anda sudah terinstall dengan benar.

Folder htdocs anda berada di /opt/lampp/htdocs/  nah langkah terakhir adalah mengubah hak akses folder tersebut agar anda bisa membaca, menulis, atau menjalankan file, folder, atau aplikasi di folder tersebut lewat Nautilus. Silahkan ketikan perintah berikut di Terminal.
sudo chmod 777 -R /opt/lampp/htdocs
Mungkin sekian dulu tuilisan kali ini, semoga bermanfaat bagi pembaca.

Sabtu, 10 November 2012

Mengenal Selector JQuery Hierachi (Parent > child)

Matches all child elements specified by “child” of elements specified by “parent”. Terjemahan google Cocokkan semua elemen anak ditentukan oleh “anak” dari unsur ditentukan oleh “orang tua”. Bingung yah, nggak usah bingung, kita langsung praktek saja
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                    "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
  <script src="../jquery-latest.js"></script>

  <script>
  $(document).ready(function(){
    $("#main > *").css("border", "3px double red");
  });
  </script>
  <style>
  body { font-size:14px; }
  span#main { display:block; background:yellow; height:110px; }
  button { display:block; float:left; margin:2px;
           font-size:14px; }
  div { width:90px; height:90px; margin:5px; float:left;
        background:#bbf; font-weight:bold; }
  div.mini { width:30px; height:30px; background:green; }
  </style>
</head>
<body>
  <span id="main">
    <div></div>
    <button>Child</button>
    <div class="mini"></div>
    <div>
      <div class="mini"></div>
      <div class="mini"></div>
    </div>
    <div><button>Grand</button></div>
    <div><span>A Span <em>in</em> child</span></div>
    <span>A Span in main</span>
  </span>
</body>
</html>
Perintah
$(“#main > *”).css(“border”, “3px double red”);
digunakan untuk merubah border seluruh element input yang dituliskan berada tepat dibawah element dengan id maindalam artian kalau dalam silsilah keluarga element-element yang merupakan anak dari element dengan id=main yang ada di document HTML, bordernya diset dengan tebal 3 pixel dan warnanya merah dengan corak dotted.

Mengenal Selector JQuery Hierachi (prev + next)


erintah
$(“label + input”).css(“color”, “blue”).val(“Labeled!”)
digunakan untuk menset value seluruh element input yang dituliskan berada disamping element label yang ada di document HTML, valuenya diset = Labeled!

Prev + next

Matches all next elements specified by “next” that are next to elements specified by “prev”. Terjemahan googlenya Cocokkan semua elemen berikutnya ditentukan oleh “di samping” yang di samping elemen ditentukan oleh “prev”
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                    "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
  <script src="../jquery-latest.js"></script>

  <script>
  $(document).ready(function(){
    $("label + input").css("color", "blue").val("Labeled!")
  });
  </script>

</head>
<body>
  <form>
    <label>Name:</label>
    <input name="name" />
    <fieldset>
      <label>Newsletter:</label>
      <input name="newsletter" />
    </fieldset>
  </form>
  <input name="none" />
</body>
</html>
Perintah
$(“label + input”).css(“color”, “blue”).val(“Labeled!”)
digunakan untuk menset value seluruh element input yang dituliskan berada disamping element label yang ada di document HTML, valuenya diset = Labeled!

Mengenal Selector JQuery Hierachi (prev ~ sibling)


Prev ~ Sibling

Matches all sibling elements after the “prev” element that match the filtering “siblings” selector.
Cocokkan semua elemen saudara kandung setelah “prev” elemen yang cocok dengan penyaringan “saudara kandung” pemilih.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                    "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
  <script src="../jquery-latest.js"></script>

  <script>
  $(document).ready(function(){
    $("#prev ~ div").css("border", "3px groove blue");
  });
  </script>
  <style>
  div,span {
    display:block;
    width:80px;
    height:80px;
    margin:5px;
    background:#bbffaa;
    float:left;
    font-size:14px;
  }
  div#small {
    width:60px;
    height:25px;
    font-size:12px;
    background:#fab;
  }
  </style>
</head>
<body>
  <div>div (doesn't match since before #prev)</div>
  <div id="prev">div#prev</div>
  <div>div sibling</div>
  <div>div sibling <div id="small">div neice</div></div>
  <span>span sibling (not div)</span>
  <div>div sibling</div>
</body>
</html>
Perintah
$(“#prev ~ div”).css(“border”, “3px groove blue”);
digunakan untuk merubah border seluruh element div yang dituliskan setelah element dengan id prev dengan id maindalam artian kalau dalam silsilah keluarga element-element yang merupakan anak dari element dengan id=main yang ada di document HTML, bordernya diset dengan tebal 3 pixel dan warnanya merah dengan corak dotted.

Mengenal Selector JQuery Basic Filter (:first)


:first

Match the first selected element.
Pertandingan pertama elemen yang dipilih.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                    "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
  <script src="../jquery-latest.js"></script>

  <script>
  $(document).ready(function(){
    $("tr:first").css("font-style", "italic");
  });
  </script>
  <style>
  td { color:blue; font-weight:bold; }
  </style>
</head>
<body>
  <table>
    <tr><td>Row 1</td></tr>
    <tr><td>Row 2</td></tr>
    <tr><td>Row 3</td></tr>
  </table>
</body>
</html>
Perintah
$(“tr:first”).css(“font-style”, “italic”);
digunakan untuk menset font-style=italic pada tr pertama suatu table yang ada di document HTML. Jadi walaupun banyak tr dalam table hanhya tr pertama yang diset font-stylenya menjadi italic. Sedangkan tr-tr kedua, ketiga dan seterusnya tidak.

Mengenal Selector JQuery Basic Filter (:last)

matches the last selected element.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                    "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
  <script src="../jquery-latest.js"></script>

  <script>
  $(document).ready(function(){
    $("tr:last").css({backgroundColor: 'yellow', fontWeight: 'bolder'});
  });
  </script>

</head>
<body>
  <table>
    <tr><td>First Row</td></tr>
    <tr><td>Middle Row</td></tr>
    <tr><td>Last Row</td></tr>
  </table>
</body>
</html>
Perintah
$(“tr:last”).css({backgroundColor: ‘yellow’, fontWeight: ‘bolder’});
digunakan untuk menset css backgroundColor: ‘yellow’, fontWeight: ‘bolder’ pada tr paling akhir suatu table yang ada di document HTML. Jadi walaupun banyak tr dalam table hanya tr paling akhir yang diset cssnya. Sedangkan tr-tr lainnya tidak.

Mengenal Selector JQuery Basic Filter (:even)

match even elements
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                    "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
  <script src="../jquery-latest.js"></script>

  <script>
  $(document).ready(function(){
    $("tr:even").css("background-color", "#bbbbff");
  });
  </script>
  <style>
  table {
    background:#eeeeee;
  }
  </style>
</head>
<body>
  <table border="1">
    <tr><td>Row with Index #0</td></tr>
    <tr><td>Row with Index #1</td></tr>
    <tr><td>Row with Index #2</td></tr>
    <tr><td>Row with Index #3</td></tr>
  </table>
</body>
</html>
Perintah
$(“tr:even”).css(“background-color”, “#bbbbff”);
tadinya saya bingung juga dengan kata-kata even setelah lihat cara kerjanya ternyata even itu disini diartikan genap.
digunakan untuk menset css “background-color”, “#bbbbff” pada tr yang genap dalam suatu table didocument html.

Mengenal Selector JQuery Basic Filter (:not)

Filters out all elements matching the given selector.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                    "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
  <script src="../jquery-latest.js"></script>

  <script>
  $(document).ready(function(){

    $("input:not(:checked) + span").css("background-color", "yellow");
    $("input").attr("disabled", "disabled");

  });
  </script>

</head>
<body>
  <div>
    <input type="checkbox" name="a" />
    <span>Mary</span>
  </div>
  <div>
    <input type="checkbox" name="b" />
    <span>Paul</span>
  </div>
  <div>
    <input type="checkbox" name="c" checked="checked" />
    <span>Peter</span>
  </div>
</body>
</html>
Perintah
$(“input:not(:checked) + span”).css(“background-color”, “yellow”);
digunakan untuk menset css backgroundColor: ‘yellow’ pada input checkbox yang tidak tercheck yang ada di document HTML.

Tips Belajar Jquery Mengenal Selector JQuery Basic Filter (:odd)


Mengenal Selector JQuery Basic Filter (:odd)
match odd elements
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                    "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
  <script src="../jquery-latest.js"></script>

  <script>
  $(document).ready(function(){
    $("tr:odd").css("background-color", "#bbbbff");
  });
  </script>
  <style>
  table {
    background:#f3f7f5;
  }
  </style>
</head>
<body>
  <table border="1">
    <tr><td>Row with Index #0</td></tr>
    <tr><td>Row with Index #1</td></tr>
    <tr><td>Row with Index #2</td></tr>
    <tr><td>Row with Index #3</td></tr>
  </table>
</body>
</html>
Perintah
$(“tr:odd”).css(“background-color”, “#bbbbff”);
tadinya saya bingung juga dengan kata-kata odd setelah lihat cara kerjanya ternyata odd itu disini diartikan ganjil.
digunakan untuk menset css “background-color”, “#bbbbff” pada tr yang ganjil dalam suatu table didocument html.

Selasa, 05 Juli 2011

Membuat Animasi Image Rotator Dengan JQuery

Artikel kali ini akan membahas tentang animasi image yang sering di gunakan pada setiap sisi halaman website, yaitu image rotator. Image rotator adalah cara menampilkan daftar image yang diganti satu per satu dalam suatu periode. Animasi ini biasanya di pasang pada space banner di dalam halaman website, agar pengunjung dapat melihat satu per satu secara bergantian produk yang di tawarkan pada banner tersebut.
Untuk membuat efek image rotator dengan JavaScript biasa tentu akan sulit, namun dengan bantuan jQuery anda tidak perlu menulis banyak kode, karena efek animasi seperti fadeIn (menampilkan perlahan-lahan) dan fadeOut (menyembunyikan perlahan-lahan) sudah disediakan oleh library jQuery standar.

Berikut adalah source code untuk melakukan image rotator dengan jQuery (masukan kode di bawah diantara tag HEAD).
 
<script type="text/javascript" src="../jquery.js"></script>
  <script type="text/javascript">
    // tentukan lokasi atau directory gambar-gambar yang akan di load
    var imageDirectory = './'; 
    /* tentukan gambar-gambar yang ingin di load dalam lokasi yang sudah di tentukan sebelumnya
    tidak ada batasan berapa banyak anda memasukan gambar */
    var imageList = ['slide1.jpg','slide2.jpg','slide3.jpg','slide4.jpg'];
 
    // flag yang digunakan untuk mendeteksi berapa banyak gambar yang sudah di load
    var imageHasLoad = 0;
 
    // flag yang digunakan untuk melakukan rotator berdasar urutan gambar
    var imagePosition = 0;
 
    /* pre-load image, agar gambar-gambar yang ingin ditampilkan sudah di load 
       sebelum halaman web di load secara keseluruhan */ 
    $(imageList).each( // looping isi array gambar
        function(){
            var Img = new Image(); // buat object gambar di javascript
            Img.src = imageDirectory+this // lokasi gambar di tentukan dari masing-masing nilai array yang sudah ditentukan sebelumnya
            $(Img).load( // membuat fungsi ketika gambar selesai di load
              function(){
                  imageHasLoad++; // setup flag berapa banyak gambar yang sudah di load
                  if(imageHasLoad == imageList.length) // jika semua gambar selesai di load
                      insertImages(); 
              }
            );      
        }
    ); 
    // fungsi untuk memasukan HTML TAG gambar di dalam sebuah elemen DIV 
    function insertImages(){
        var imgStr = '';
        $(imageList).each( // looping isi array gambar
           function(){
           // gambar secara default di sembunyikan terlebih dahulu 
              imgStr += '<img src="'+imageDirectory+this+'" border="0" style="display:none" />'; 
           }
        );
        $('#divSlideShow').html(imgStr); // masukkan semua HTML TAG gambar ke dalam element dengan ID #divSlideShow
        rotateImages(); // lakukan animasi rotator
    }  
    // fungsi untuk melakukan rotator 
    function rotateImages(){
        /* logika pada fungsi ini adalah sembuyikan image yang sudah tampil sebelumnya, lalu setelah selesai di sembunyikan
     maka tampilkan image selanjutnya. Menyembunyikan dan menampilkan image dengan fungsi fadeOut dan fadeIn dari jQuery */
     $($('#divSlideShow').find('img')[imagePosition > 0 ? imagePosition - 1 : imageList.length - 1]).fadeOut(
         'slow',
   function(){ // fungsi yang akan dijalankan setelah gambar sebelumnya selesai disembuyikan
    $($('#divSlideShow').find('img')[imagePosition]).fadeIn();
   }
     );
     // jika posisi rotator sudah sama dengan jumlah image yang di load sebelumnya, maka kembalikan ke posisi awal atau nol
  if(imagePosition == imageList.length - 1) 
   imagePosition = 0; 
     else 
   imagePosition++; 
     setTimeout('rotateImages()',2000); // lama rotasi per image adalah 2000 miliseconds atau 2 detik
    }
  </script>

Coba perhatikan pada source code diatas ada metoda untuk memanggil gambar secara pre-loading, tujuannya adalah agar gambar-gambar yang akan di load secara diam-diam di load satu per satu sebelum seluruh halaman web selesai di load, jadi pengunjung tidak perlu menunggu lama-lama untuk melihat image rotator anda.
Selama pengunjung menunggu tampilkan saja text “loading image…” atau gambar GIF yang menarik. Masukan kode di bawah diantara tag BODY.

<!-- tampilkan text "loading images" selama pengunjung menunggu hasil pre-load image -->
<div id="divSlideShow">loading images...</div>

Contoh :





Animasi ini dapat anda tempatkan di setiap sisi halaman website sesuai keinginan anda.
Semoga bisa bermanfaat… ^_^