Restrict access to your Apache Virtual Host

In some case you need to restrict your virtual host site by IP address. Usually the type of site that handle important information such as Administrator site or web-based database administration site (eg : phpMyAdmin) or else. For example the admin site of your website can be accessed only in Office network. This Apache configuration below may helps you.

<VirtualHost *:80>
    DocumentRoot /path/to/website/admin

    <Location />
          Order Deny,Allow
          Deny from all
          Allow from


The IP address above is your public IP address of your office. Beside <Location>, you also can use the other Apache directive <Directory>.

You can see the complete documentation of configuration sections containers in Apache, that may be suits your need. Here is the link

Yup. That’s all.

Nice to meet you

This is a #latepost. This post has been on the draft for almost a week. It was late not because of I am busy with work, publishing this post late will  make me look busy.

Okay, I will tell you what happened last week. I met a Japanese blogger. Her name is Hiroko Yokota. She visited my office last week. What makes last week meeting was special are, she can speak Bahasa Indonesia and now she is living in my hometown, Palembang. Even more special she wrote about Pricebook in her blog.

Thank you so much Hiroko-san :)



She is interested in Indonesia, she is living here to study Bahasa Indonesia. Go check her blog out, she writes a lot of interesting things. Mostly in Japanese, but also in English and Indonesia! Well, you might need to use google translate to read it :P

Hiroko-san, oai dekite ureshikattadesu.

It was glad to meet you.

Note :

Headline image on her blog is a picture of Musi River (Sungai Musi), the largest river on South Sumatra.

How to export your MongoDB collections to CSV files

For some reasons, we might want to export our data in our mongodb collections into csv files. Is it possible? Yes, it is. Mongodb provide a tools called mongoexport which can used to export your data to JSON or CSV files.

Here is the usage example.

mongoexport –db pricebook –collection product_specification –csv –fields “product_id,category_id,specs” -o specs.csv

This operation written above is exporting product_specification collection in pricebook database into specs.csv file with specified fields. If you want to export your data into CSV file you have to specify what fields that you want to exports. If you want to export into JSON file you don’t have to specifiy the fields.

Check the complete mongodb documentation of mongoexport on the link below. All you need to know about mongoexport are there, usage overview and its complete options.

Now, you know how to export your mongodb collections into csv files. What if you have 99 collections? What if in every collections you have more than 100 fields? Exporting it one by one and specifying fields for each collections is bothersome. Sometimes you might want to export all of your collections without specifying field name.

Thanks to drzon and his little bash script. Here is the script.

Hope that helps. Cheers.


How to license your application

Choose a license

“How to license my application?”

That question never popped out in my mind, not even once, until today. Someone emailed me this morning, saying that suggesting me to put OSS license to my “monode-crud” application that i uploaded on my github. This is his email says.

Would you consider putting an open source license on your monode-crud application so I may modify it to my needs and give you credit for the original app? I suggest any open source software license such as the MIT License. See
Many thanks in advance,

Well, okay, putting a license to my application maybe a good idea. Umm.. how do i license my application? and what license should i choose for my application?

We, software developers mostly just love to code, try new things, upload and share it on our github account. I assume many software developers still not familiar with this licensing things, well, at least myself. Don’t worry bros, i will show you how to do it. Thanks to good guy pk.

  • Open
  • Read carefully and pick whichever that suits your application the most. In my case, i pick MIT license, the most permissive one, the shortest and straight to the point.
  • Go to detail page of the license that you chose. There will be “how to apply this license” on the top right sidebar.
  • Copy and paste the license, create a file named LICENSE or LICENSE.txt in your application directory.
  • Edit the placeholder that marked with brackets { }. eg : {year}, {fullname}
  • Done.

That’s all about it. You have your application licensed.

This blog was hacked (again)






PS : thanks to @budiwijaya for the help, as always.

How to convert foreign chars on Code Igniter

Working with foreign chars on Code Igniter is super simple. I’ve been working on website with vietnamese language for quite some time. Yes, vietnamese character with their curly accessories on alphabets.

For example if you use slug on your vietnamese language on url you will get “Disallowed Character” error. Another case if you are working with payment gateway, unfortunately they don’t accept charset except UTF-8, eg : The famous PayPal and others.

Enough talks, here i show you how.

First, load the Text Helper, or you can put it on autoload config.


After the helper is loaded then here is how you use it. Simply just call this method to convert it.

$string = convert_accented_characters($string);

You can add the character mapping on foreign_chars.php under config directory. Here is the example.

Yes. It is done. Hope this helps. This post is more like bookmark so i know where to look when i need it :P

Google’s April Fools Day 2013

Seperti tahun tahun sebelumnya raksasa internet ini melakukan “keisengan” april fools. Tapi kali ini google lebih niat, april fools di banyak produknya. Di google maps, google menambahkan satu box menu disamping filter layer, tombol “Treasure”. Google map treasure hunt ini memungkinkan user untuk melihat peta dengan mode peta tua atau peta lama. Begini kira-kira tampilannya.

Google Map April Fools 2013

Google Map April Fools 2013

Yang lebih parah april fools yang dipasang di google analytics, google memanipulasi data yang ada pada fitur real timenya. Ketika fitur real time di klik tiba-tiba visitor jadi tinggi dan jika dilihat data geografis visitor tersebut semua berasal dari International Space Station – Control Room, yang terletak di antah berantah, di tengah lautan. LOL. That’s funny. No picture, hoax. Ini gambarnya.

Google Analytics April Fools 2013

Google Analytics April Fools 2013

Google maps april foolsnya sih lucu, bisa liat peta dengan background lain, yang biasanya hanya tampilan map biasa dan satelit. Untuk google analytics ini yang berhasil bikin kaget bukan kepalang.

Anyway, Selamat Hari 1 April :D

Note : Ini kisah nyata. Sungguh. Suer.

Daihatsu e-Tollcard Gratis

Hari ini hari kamis, hari kerja seperti biasa. Berangkat seperti biasa, beli kopi di tempat biasa, lewat jalan yang biasa dilewatin setiap hari, mood biasa, semuanya biasa. Tapi semua yang biasa itu berubah jadi luar biasa aja (bukan luar biasa banget) setelah antri mau bayar tol di pintu tol cililitan. Tiba-tiba disamperin sama cewek cantik aja (bukan cewek cantik banget) yang ketok ketok jendela nawarin Daihatsu e-Tollcard gratis dituker sama kartu nama. Gratis? Iya, GRATIS. Begini penampakannya…

Daihatsu e-Tollcard

Daihatsu e-Tollcard

Usut punya usut, googling sana googling sini, Daihatsu lagi bagi-bagi 105 e-Tollcard gratis buat para penggunanya, dalam rangka perayaan ulang tahun Daihatsu ke 105. Kartu ini dibagi setiap hari kamis dan setiap minggunya dibagikan 105 gratis. Jadi saya adalah salah satu yang beruntung mendapatkan e-Tollcard ini gratis. Iyeeey. Bagi yang kebetulan belum dapet silahkan coba antri di pintu tol cililitan yang Non-GTO tanggal 5 April 2013 mulai dari jam 7.30 pagi.

Baca juga:

Terima kasih Daihatsu yang sudah membuat hari kamis saya menjadi tidak biasa dan keren luar biasa, cetar membahana badai sekalian halilintar!

Ohya? mau liat yang juga tidak biasa dan keren luar biasa, cetar membahana badai sekalian halilintar!

Klik, your pitstop travel treasures ;)

Happy thursday!

First MeetUp (Hello Mongo)

Be There! Free, Open to Public, All ages all welcome.

Check this website for more info.

See you there friends!

Simple CRUD web using Nodejs and MongoDB

a simple CRUD web using nodejs (expressjs f/w, hbs templating) and mongodb

a simple CRUD web using nodejs (expressjs f/w, hbs templating) and mongodb

In this article, i just want to share my one day experiment with node.js and mongodb. I build a simple web that does CRUD in node.js and save the records to MongoDB. I stupidly built this although this post says that build CRUD in node.js is a bad use case :p

Skip the talks, lets go to the points. I built this on Windows. I need (of course) node.js and mongodb, go to their websites, download and install them to your computer. Once you got them installed then you are ready to code.

Next step is get a HTML template for user interface, if you are LAZY like me just use Bootstrap, from twitter. I need their awesome HTML CSS tables and forms, icons right away. Download and use one of their examples, i am using the fluid layout. User interface? Done.

This is the hardest part (for me), code in node.js. Step one, to make this easier i have to install expressjs. In your app directory type this…

npm install -g express

express “D:/monode-crud” (this is depend on you app directory)

Line one will install expressjs as node modules on your app, and line two will create a directories that expressjs needed. Go to for complete guide.

I don’t like the jade that expressjs used as their default template engine. Instead of using jade, i am installing another node modules called hbs. What is hbs? Hbs is a view engine for express.js. Here is hbs website Hbs is basically a handler for Handlebars.js, a Mustache.js-like template engine. Both of them are logic less templates.

npm install hbs

After you are finished installing hbs, then modify your node.js app configurations.

var hbs = require('hbs');

app.engine('html', require('hbs').__express);
app.set('views', __dirname + '/views/html');
app.set('view engine', 'html');

And then copy all the assets (image, javascript, css files) from bootstrap to “public” directory. Put your .html template under “views” directory.

In order to connect to Mongodb to store the records, i am using node-mongodb-native. There are many other libraries to do this, but IMHO, this is the easiest way to connect node.js and mongodb. Install this via npm as usual.

npm install mongodb

Okay. All done. :)

Check out the complete node.js app and codes at my github page. Here is the repo.

Please drop your comments or questions through this blog or follow me @hadiariawan at twitter. Thanks.

© 2014 Ariawan's Blog

Theme by Anders NorenUp ↑