Tuesday, June 17, 2008 at 1:24:00 AM

AHAH di jQuery

Dityo Nurasto

Under categories of Development | Comments (0)

AHAH, kalau di arab itu artinya ketawa kali yah? bacanya pan dari kanan ke kiri. AHAH adalah singkatan dari Asynchronous HTML And HTTP. Gue baru tahu kalau XMLHTTPObject bisa buat acara lucu seperti itu. Gue pengemar jQuery yang tidak sengaja menemukannya di google, framework ini cukup bagus untuk layer presentasi, sayangnya untuk XML-RPC dan SOAP harus sedikit berkerja keras. Jadi AHAH itu memungkinkan kita meload elemen HTML walaupun itu hanya istilah. Saya suka jargon AHAH karena saya load (X)HTML bukan XML.

Ceritanya gue diminta untuk load halaman kayak GMail, hah? lucu ... ilmu gue yang sejengkal begini disuruh buat begituan. Oke dah, sedaripada gue butuh pemasukan untuk makan keluarga, tak jabanin. Pertam kali gue melakukan akses melalui fungsi $.ajax dan ternyata pada saat mengisi suatu <div> terdapat masalah pada jQuery terutama di IE 6 & 7, gue menggunakan replaceWith(). Duh ... bisa - bisa nggak makan nih.

Mau bikin lagi, waktu proyek sangat mepet akhirnya ketemu juga dan lucunya posisi perintah pada dokumentasi berada di bawah persis dari jQuery.ajax(options). Tertawalah gue, dablek bener nih mas. dan inilah salah satu ujung tombak pelanjut hidup.

 loadPresentation = 'index.html';
 $("#right_side").load("ajax/" + loadPresentation);

Bagaimana kode itu bekerja? simple, semua elemen yang berada di bawah div dengan ID right_side akan ditindih dengan file yang gue panggil. Inget, kudu harus pake server kalau mau coba.

Friday, June 13, 2008 at 7:27:00 PM

Method Overloading in PHP

Dityo Nurasto

Under categories of Development, PHP | Comments (0)

I wrote PHP post more than ASP.NET does isn't it? I am increasing it right now hahahaha ...

Okay, I was said that PHP doesn't support method/function polymorphism or more correct term is overloading, but I was wrong. PHP does support it explicitly which require developer involvement to mimic method overloading like C#, VB.NET or JAVA does.  We could use magic method __call(string $name, array $arguments). I am trying to explain how we could do that in PHP comparing with optional argument like we always do.

More...

Thursday, June 12, 2008 at 2:16:00 AM

Mengakses MySQL dengan PHP - Bagian 2

Dityo Nurasto

Under categories of Development, PHP | Comments (2)

Sekarang, gue masuk ke bagian 2. Ketinggalan bagian 1? silahkan baca Mengakses MySQL dengan PHP - Bagian 1. Sekarang kita akan membahas cara memasukkan data dari table dengan melakukan query ke MySQL. Pada bagian satu kita telah belajar untuk membuka koneksi ke database.

HTML Form

HTML form merupakan element dari HTML yang digunakan untuk mengambil data dari user / pengunjung dengan menggunakan komponen form lainnya seperti <input />, <textarea></textarea>, <select> dan sebagainya. Kasus yang kita hadapi adalah membuat berita, jadi kita perlu membuat HTML Form.

<html>
    <head>
        <title>Belajar PHP</title>
    </head>
    <body>
        <!-- parameter method pada form adalah cara untuk mengirim data -->
        <form name="berita" method="post" action="tambahdata.php">
            <fieldset>
                <label id="labeljudul" for="inputjudul">Judul Berita</label>
                <!-- input untuk judul -->
                <input type="text"  name="judul" id="inputjudul" />
                <label id="labeljudul" for="inputisi">Isi Berita</label>
                <!-- input untuk isi -->
                <textarea name="isi" id="inputisi"></textarea>
                <!-- tombol untuk kirim -->
                <input type="submit" name="submit" value="Kirim Berita" id="submitberita"/>
            </fieldset>
        </form>
    </body>
</html>
    

Mari kita tela'ah form ini. pada <form> kita melihat banyak parameter seperti method dimana memberi tahu browser bagaimana data akan dikirim dan kita tidak ingin input - input kelihatan pada browser seperti google. action merupakan target di mana kita akan memproses input - input tersebut.

Nah pada kita melihat label dimana fungsinya untuk memberi keterangan suatu field. Pada input kita melihat dua parameter, yaitu name dan id. Name digunakan sebagai tampungan data yang akan dikirim, sedangkan id lebih banyak berperan pada tampilan, kita melihat parameter for pada label merujuk pada id setiap input. Simpanlah kode di atas dengan nama tambahform.php.

More...

Wednesday, June 11, 2008 at 3:02:00 PM

Mengakses MySQL dengan PHP - Bagian I

Dityo Nurasto

Under categories of Development, PHP | Comments (2)

Sebenarnya sudah banyak buku menerangkan bagaimana mengakses ke MySQL dengan PHP melalui kode prosedural. Sekarang banyak yang bertanya "bagaimana mengakses MySQL sebagai basis data (Database) dalam PHP?". Pada intinya ada beberapa tahapan yang perlu dilakukan, secara fungsional adalah

  1. Membuka koneksi ke MySQL
  2. Menentukan database yang akan digunakan. MySQL adalah database server dan di dalamnya terdapat banyak database, jangan sampai salah mengartikannya.
  3. Membuat SQL Query
  4. Menampilkan data dengan mengolahnya dengan memanfaatkan spesifikasi HTML atau jenis output lainnya, seperti XML, CSV, dan lain - lain.

Tutorial berseri ini dibuat untuk pembelajar yang mau belajar dasar pemograman PHP. More...

Monday, June 09, 2008 at 1:44:00 PM

SyntaxHighlighter BlogEngine.NET Extension

Dityo Nurasto

Under categories of BlogEngine.NET | Comments (1)

This is my first extension for BlogEngine.NET. It will add HTML javascript syntax code in head section and rendering javascript function after the content place holder to be able to use SyntaxHighlighter. The only weakness of this extension that is I need to tweak the TinyMCE before be able to use this extension. You could see my post about how to setup SyntaxHighlighter in BlogEngine.net.

The features that existed in this extension is add particular syntax js file which tell the extension which js file need to be inserted. So, you may want csharp and xml/html be available on your site but ignoring the rest. The extension also add the core javascript  and CSS file from SyntaxHighlighter directory automatically. BlogEngine Page and Post able to use this extension.

If you're in hurry. This is patch package, so you could patch your blogengine right away, but if you're advanced user and any modification had been held to files in admin file, please just extract the extension. The extension doesn't have any warranty, so be careful, I am not recommended to overwrite your working blog. You could download the file JSSyntaxHighlighter.zip (97.17 kb).

To know how extension work then please read More...

Saturday, June 07, 2008 at 5:30:00 AM

SyntaxHighlighter in BlogEngine.Net

Dityo Nurasto

Under categories of BlogEngine.NET, Development | Comments (1)

My biggest concern on my last blog is how to deliver code in BlogEngine.Net. The CodeFormater extension not working like I want and make me little bit frustrated when using the extension. I am looking around to find any cool replacer of CodeFormater then I found SyntaxHighlighter using JavaScript as the engine. Cool right? and you may use it in any application you want regardless the server side language but it will cost in matter of bandwith.

When I want to implement it into my theme, I am looking around for solution before I starting to code and I found tutorials about how to Adding SyntaxHighlighter to BlogEngine.NET. I decide to follow the instruction and some of step are missing. First, you must add the CSS into your theme. The simplest one is by edit your current site.master template and copying the style into the theme, for example:

<link rel="stylesheet" type="text/css" href="SyntaxHighlighter.css" />

You must add this in head section of HTML document. You may asked why you need to copy into your theme directory? because any CSS reference in <head runat="server"> would be replace by BlogEngine.Net into like this

<link rel="stylesheet" type="text/css" href="/themes/yourtheme/css.axd?name=/css/SyntaxHighlighter.css" />

Now, I need some tuning in our tinyMCE.ascx located on Admin folder. I decide to use the uncompressed TinyMCE to make life easier to this

<script type="text/javascript" src="<%=Utils.RelativeWebRoot%>admin/tiny_mce/tiny_mce_src.js"></script>

Yeah, I know it will cost bandwith but I need the function work right. I would look at the compressed version if I have time. Good Luck.

Saturday, June 07, 2008 at 4:58:00 AM

jQuery in BlogEngine.Net

Dityo Nurasto

Under categories of BlogEngine.NET, Development | Comments (2)

I am trying to implement jQuery in BlogEngine.Net and I found errors while accessing the page which the errors tell me that element has no properties.  Fortunately, I found the solution which makes me surprise because it's work like magic and of course you need to replace the $ sign in all elements. If you want to try what I am doing with jQuery, just press search image in right corner of your screen.

In searching of jQuery integration, I accidentally found a great article to use Intellisense for JQuery in Visual Studio 2008. It helps me a lot to code because the auto completion is working, you may find the complete instruction in that site. Well, it's not the latest jQuery version but it may help you to start learning jQuery.

If you're looking offline help for jQuery you may download the CHM file on this site.

Friday, June 06, 2008 at 3:11:00 PM

Indonesian BlogEngine.NET User Group

Dityo Nurasto

Under categories of ASP.NET, BlogEngine.NET, Development | Comments (6)

BlogEngine.Net is blog engine based on ASP.NET which mainly use C# as the default language. In time to time I aknowledge that BlogEngine.Net Indonesia users is increasing. The reasons may vary according to BlogEngine.Net users, I choose BlogEngine.Net because I want to learn C# deeper. BlogEngine.Net developers are very well coder and have broaden view in establishing relases. Commercially, BlogEngine.Net could be a powerfull simple Content Management System this was said by Ahmad Masykur, the well known coder in Indonesia, in INDC mailing list.

I have small statistic about the Indonesian BlogEngine.Net users, but I want to unified and introduce my fellow friends who use BlogEngine.NET, they're :

If you're Indonesian BlogEngine.Net user please reunite :). I wish the best for you all!. If you want to use BlogEngine.Net you could use ASP.NET Hosting, I host my own site in Erudeye and satisfied with the hosting service.

 

This is me!

Hi. My name is Dityo Nurasto. I am freelance software and web developer.

ShoutBox



Recent comments

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2008