Bruteforce http://bruteforce.posterous.com Bruteforce first, then learn... IT makes life simpler... posterous.com Sat, 05 Feb 2011 23:57:10 -0800 CHM Can't Be Opened With Message 'Navigation to the webpage was cancelled' http://bruteforce.posterous.com/chm-cant-be-opened-with-message-navigation-to http://bruteforce.posterous.com/chm-cant-be-opened-with-message-navigation-to Recently, I downloaded an ebook in form of .CHM file (Compiled HTML). Then, I tried to open it but it failed instead showing 'Navigation to the webpage was cancelled' message. I tried to download it over and over until I realized that I should find the solution just by googling it... :D

image5.jpg
source: http://goo.gl/Ua6T0

One of workaround that I used is by right-clicking the file with my mouse and then open the properties, afterward click the unblock. This problem is quite old and due the fact of exploit(s) that maybe come from this typical file.

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/500062/avatar9.bmp http://posterous.com/users/36oRUl91xNpD Oscar Kurniawan Oz Oscar Kurniawan
Mon, 17 Jan 2011 03:49:32 -0800 Setting up MySQL from WAMPServer to be used alongside with Ruby on Rails in Windows Vista http://bruteforce.posterous.com/setting-up-mysql-from-wampserver-to-be-used-a http://bruteforce.posterous.com/setting-up-mysql-from-wampserver-to-be-used-a Dear Readers,

Recently, I got into the project that will be using Ruby on Rails as its platform. Okay, let's get through to the setting up environment process.

My system list:
  • Windows Vista Ultimate SP 1
  • WAMPServer consists of Apache, MySql, PHP stack. (We will only make use of its MySQL)
1. First get the Ruby if you haven't yet here: http://www.ruby-lang.org/en/downloads/
I'm using the latest stable one (Ruby 1.9.2-p136)
2. Find your download and click the installer. For your convenience, don't forget to add the Ruby to the PATH in system's environment variables by clicking 'add to path' section. Otherwise, you have to add the Ruby.exe to the PATH manually.
3. After the ruby installation completed, run the command prompt and check if you can use command ruby by typing it.
4. Ruby 1.9.2 doesn't seem support command gem update --system. It always draws error message. I dunno any workaround on this problem. But, if you use older version such 1.8.6, then it should be fine. 
5. Okay, you have it worked then you should install the required gem (library) for rails by typing gem install rails. If you success, then at this step you have completed setting up the rails environment.

Now, we move to setting up MySQL database used in WAMPServer. Maybe some of you questioning why use WAMPServer's MySQL stack? The motivation behind this is because I'm heavily developing PHP using WAMPServer and it seems redundant to install a new MySQL database so why not to make use the installed MySQL database on WAMPServer. Save space. :)

6. Okay, start the WampServer. Make sure to turn off the Apache server's service and let MySQL service run and make sure it is running. Find the WAMPServer icon on the taskbar > MySQL > My.ini. Open and edit it. Add bind-address = 127.0.0.1 under the socket section. This will tell MySQL server to bind with local apps.
7. Open the MySQL console and login to it. By default, there is no password for root user so you can leave it empty when being prompted for password. Create the database for your rails application by using this sql statement: create database `<database name>`;. Replace <database name> with a name for your application's database. For example: rails_test
8. Install the Ruby gems for MySQL by typing gem install mysql

Now, we will create a new Rails project. With command prompt, browse to your pre-defined rails project folder. For example, My project folder is in my document folder and under programming sub folder (my documents > programming > myrailsproject).
9. Create a new project by typing command: rails new <project_name> -d mysql. -d mysql option is required to specify the DBMS that we used for the project. By default, it will use sqlite.
10. Inspect the project folder (the project's name is the same with the <project_name> you specified when create a project in the step before). Then inspect the config folder. Open and edit database.yml. Please make sure the database name is the same with the database name on MySQL. (You can make database entry for the test and production too in MySQL before and bind each in database.yml configuration)
At this step you have configured the WAMPServer's MySQL to be used with Ruby on Rails Project. :) 

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/500062/avatar9.bmp http://posterous.com/users/36oRUl91xNpD Oscar Kurniawan Oz Oscar Kurniawan
Sun, 19 Dec 2010 07:50:22 -0800 Happy Sharing Codes Using Gist http://bruteforce.posterous.com/happy-sharing-codes-using-gist http://bruteforce.posterous.com/happy-sharing-codes-using-gist It is sooooo late until I discovered http://gist.github.com. This is a Software as a Service (SaaS) provided by Github to be a tool for sharing code snippets or plain texts. As you may be thought that there are several similar service such pastebin. But, Gist offered Github power of versioning system which you can manage your code snippets through change by change without worrying that your code being rewritten completely as Github always handles the backup. It is also mean that you can create your local codes repository on your desktop computer by cloning the git.

Let's take a look on the Gist's UI.

Gist_ui

  1. Pick a name for your source code. Please take a note that if you add the file extension such as .java / .txt. Gist will automatically highlight your snippet text to recognizable keywords of the programming language that you specified.
  2. Otherwise, you can do it manually as you pick your language here.
  3. Make your description about the snippet code. It can be anything you want.
  4. Write your snippet text here. Please take a note that indentation will not be formatted automatically to your snippet. You should specify yourself by adding appropriate space(s).
  5. This enables you to create batch snippets.
  6. You can choose to post the snippet as private Gist
  7. Otherwise, you can make it public

As you post your snippets, it will be given an ID to be noted so you can manage it any time. For extensive snippets management, you should claim the snippet you made using your Github's account.

If you use Posterous to blog as myself you should be happy because Posterous has been friend of Gist for quiet time. You may take a look what Gist would look like on my "updated" previous article: http://bruteforce.posterous.com/hello-world-3016

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/500062/avatar9.bmp http://posterous.com/users/36oRUl91xNpD Oscar Kurniawan Oz Oscar Kurniawan
Wed, 15 Dec 2010 18:13:00 -0800 Scraping Links With PHP http://bruteforce.posterous.com/scraping-links-with-php http://bruteforce.posterous.com/scraping-links-with-php
In this tutorial you will learn how to build a PHP script that scrapes links from any web page.

What You’ll Learn

  1. How to use cURL to get the content from a website (URL).
  2. Call PHP DOM functions to parse the HTML so you can extract links.
  3. Use XPath to grab links from specific parts of a page.
  4. Store the scraped links in a MySQL database.
  5. Put it all together into a link scraper.
  6. What else you could use a scraper for.
  7. Legal issues associated with scraping content.

What You Will Need

  • Basic knowledge of PHP and MySQL.
  • A web server running PHP 5.
  • The cURL extension for PHP.
  • MySQL – if you want to store the links.
Backhoe Digging

Get The Page Content

cURL is a great tool for making requests to remote servers in PHP. It can imitate a browser in pretty much every way. Here’s the code to grab our target site content:

$ch = curl_init(); curl_setopt($ch, CURLOPT_USERAGENT, $userAgent); curl_setopt($ch, CURLOPT_URL,$target_url); curl_setopt($ch, CURLOPT_FAILONERROR, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_AUTOREFERER, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER,true); curl_setopt($ch, CURLOPT_TIMEOUT, 10); $html = curl_exec($ch); if (!$html) {         echo "<br />cURL error number:" .curl_errno($ch);         echo "<br />cURL error:" . curl_error($ch);         exit; }

If the request is successful $html will be filled with the content of $target_url. If the call fails then we’ll see an error message about the failure.

curl_setopt($ch, CURLOPT_URL,$target_url);

This line determines what URL will be requested. For example if you wanted to scrape this site you’d have $target_url = “/makebeta/”. I won’t go into the rest of the options that are set (except for CURLOPT_USERAGENT – see below). You can read an in depth tutorial on PHP and cURL here.

Tip: Fake Your User Agent

Many websites won’t play nice with you if you come knocking with the wrongUser Agent string. What’s a User Agent string? It’s part of every request to a web server that tells it what type of agent (browser, spider, etc) is requesting the content. Some websites will give you different content depending on the user agent, so you might want to experiment. You do this in cURL with a call to curl_setopt() with CURLOPT_USERAGENT as the option:

$userAgent = 'Googlebot/2.1 (http://www.googlebot.com/bot.html)'; curl_setopt($ch, CURLOPT_USERAGENT, $userAgent);

This would set cURL’s user agent to mimic Google’s. You can find a comprehensive list of user agents here: User Agents.

Common User Agents

I’ve done a bit of the leg work for you and gathered the most common user agents:

Search Engine User Agents

Browser User Agents

  • Firefox (WindowsXP) – Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6
  • IE 7 – Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30)
  • IE 6 – Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)
  • Safari – Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en) AppleWebKit/522.11 (KHTML, like Gecko) Safari/3.0.2
  • Opera – Opera/9.00 (Windows NT 5.1; U; en)

Using PHP’s DOM Functions To Parse The HTML

Puzzle Workers

PHP provides with a really cool tool for working with HTML content: DOM Functions. The DOM Functions allow you to parse HTML (or XML) into an object structure (or DOM – Document Object Model). Let’s see how we do it:

$dom = new DOMDocument(); @$dom->loadHTML($html);

Wow is it really that easy? Yes! Now we have a nice DOMDocument object that we can use to access everything within the HTML in a nice clean way. I discovered this over at Russll Beattie’s post on: Using PHP TO Scrape Sites As Feeds, thanks Russell!

Tip: You may have noticed I put @ in front of loadHTML(), this suppresses some annoying warnings that the HTML parser throws on many pages that have non-standard compliant code.

XPath Makes Getting The Links You Want Easy

Now for the real magic of the DOM: XPath! XPath allows you to gather collections of DOM nodes (otherwise known as tags in HTML). Say you want to only get links that are within unordered lists. All you have to do is write a query like “/html/body//ul//li//a” and pass it to XPath->evaluate(). I’m not going to go into all the ways you can use XPath because I’m just learning myself and someone else has already made a great list of examples: XPath Examples. Here’s a code snippet that will just get every link on the page using XPath:

$xpath = new DOMXPath($dom); $hrefs = $xpath->evaluate("/html/body//a");

Iterate And Store Your Links

Next we’ll iterate through all the links we’ve gathered using XPath and store them in a database. First the code to iterate through the links:

for ($i = 0; $i < $hrefs->length; $i++) {         $href = $hrefs->item($i);         $url = $href->getAttribute('href');         storeLink($url,$target_url); }

$hrefs is an object of type DOMNodeList and item() is a function that returns a DOMNode object for the specified index. The index can be between 0 and $hrefs->length. So we’ve got a loop that retrieves each link as a DOMNode object.

$url = $href->getAttribute('href');

DOMNodes inherit the getAttribute() function from the DOMElement class. getAttribute() returns any attribute of the node (in this case an <a> tag with the href attribute). Now we’ve got our URL and we can store it in the database.

We’ll want a database table that looks something like this:

CREATE TABLE `links` ( `url` TEXT NOT NULL , `gathered_from` TEXT NOT NULL , `time_stamp` TIMESTAMP NOT NULL );

We’ll a storeLink() function to put the links in the database. I’ll assume you know the basics of how to connect to a database (If not grab a MySQL & PHP tutorial here).

function storeLink($url,$gathered_from) {         $query = "INSERT INTO links (url, gathered_from) VALUES ('$url', '$gathered_from')";         mysql_query($query) or die('Error, insert query failed'); }

Your Completed Link Scraper

function storeLink($url,$gathered_from) {         $query = "INSERT INTO links (url, gathered_from) VALUES ('$url', '$gathered_from')";         mysql_query($query) or die('Error, insert query failed'); } $target_url = "http://www.merchantos.com/"; $userAgent = 'Googlebot/2.1 (http://www.googlebot.com/bot.html)'; // make the cURL request to $target_url $ch = curl_init(); curl_setopt($ch, CURLOPT_USERAGENT, $userAgent); curl_setopt($ch, CURLOPT_URL,$target_url); curl_setopt($ch, CURLOPT_FAILONERROR, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_AUTOREFERER, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER,true); curl_setopt($ch, CURLOPT_TIMEOUT, 10); $html= curl_exec($ch); if (!$html) {         echo "<br />cURL error number:" .curl_errno($ch);         echo "<br />cURL error:" . curl_error($ch);         exit; } // parse the html into a DOMDocument $dom = new DOMDocument(); @$dom->loadHTML($html); // grab all the on the page $xpath = new DOMXPath($dom); $hrefs = $xpath->evaluate("/html/body//a"); for ($i = 0; $i < $hrefs->length; $i++) {         $href = $hrefs->item($i);         $url = $href->getAttribute('href');         storeLink($url,$target_url);         echo "<br />Link stored: $url"; }

What Else Could I Do With This Thing?

The possibilities are limitless. For starters you might want to store a list of sites that you want scraped in a database and then set up the script so it runs on a regular basis to scrap those sites. You could then compare the link structure over time or maybe republish the links in some sort of directory. Leave a comment below and say what you’re using this script for. Here are a few other things people have done with scrapers in the past:

Law Book and Gavel

Is Scraping Content Legal?

There is no easy answer to this question. Many organizations scrap content from all over the web – Google, Yahoo, Microsoft, and many others. These companies get away with it under fair use and because site owners want to be included in the search results. However, there have been copyright infringement rulings against these companies.

The real answer is that it depends who you scrape and what you do with the content. Basic copyright law gives authors an automaticcopyright on everything they create. But the same law permits fair use of copyrighted material. Fair use includes: criticism, comment, news reporting, teaching (including multiple copies for classroom use), scholarship, or research. But even these uses could be considered copyright infringement in some circumstances. So be careful before you claim “fair use” as your defense!

Here’s a couple sites that have granted you the right to use their content. They do require you to attribute the content to the author or the URL you scraped it from:

  • Wikipedia – GNU Free Documentation License

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/500062/avatar9.bmp http://posterous.com/users/36oRUl91xNpD Oscar Kurniawan Oz Oscar Kurniawan
Fri, 15 Oct 2010 21:02:00 -0700 Information Technology Sector at CNNMoney's Best Jobs in America http://bruteforce.posterous.com/information-technology-sector-at-cnnmoneys-be-0 http://bruteforce.posterous.com/information-technology-sector-at-cnnmoneys-be-0

Recently, CNNMoney.com released a top 100 list for the Best Jobs in America. There are 26 jobs in total competitively to Health Care sector which also has 26 jobs too. It shows us that the Information Technology sector takes important role to the US economics since these best jobs provide a better way to live as American facing hardship to economic situation.

 

Okay, here we are the best jobs in America for Information Technology:

 

 

Information Technology Software Architect 1
  Information Technology Database Administrator 7
  Information Technology Information Systems Security Engineer 17
  Information Technology Software Engineering / Development Director 18
  Information Technology Information Technology Manager 20
  Information Technology Telecommunications Network Engineer 21
  Information Technology Network Operations Project Manager 24
  Information Technology Information Technology Business Analyst 26
  Information Technology Information Technology Consultant 28
  Information Technology Test Software Development Engineer 30
  Information Technology Information Technology Network Engineer 31
  Information Technology Information Technology Program Manager 33
  Information Technology Computer and Information Scientist 35
  Information Technology Programmer Analyst 37
  Information Technology Applications Engineer 38
  Information Technology Systems Engineer 49
  Information Technology Information Technology Specialist 60
  Information Technology Systems Administrator 66
  Information Technology Web Developer 67
  Information Technology Technical Services Manager 70
  Information Technology Information Technology Systems Manager 77
  Information Technology Information Technology Training Specialist 79
  Information Technology Technical Writer 88
  Information Technology Information Technology Project Coordinator 95
  Information Technology Web Project Manager 96
  Information Technology Geographic Information Systems Analyst 97

 

 

Software Architect becomes the first one to be ranked as the best job in USA and that is amazing! With the capability of people educated from IT sector can pursue career to other industries. There are should be more best jobs in America that available to IT people. :)

 

Have you decide one?

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/500062/avatar9.bmp http://posterous.com/users/36oRUl91xNpD Oscar Kurniawan Oz Oscar Kurniawan
Fri, 28 May 2010 04:17:00 -0700 Computer Graphics Assignment Documentation http://bruteforce.posterous.com/computer-graphics-assignment-documentation http://bruteforce.posterous.com/computer-graphics-assignment-documentation

This is video for Computer Graphics Assignment @ Fasilkom UI

The video is in Indonesian. Enjoy.

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/500062/avatar9.bmp http://posterous.com/users/36oRUl91xNpD Oscar Kurniawan Oz Oscar Kurniawan
Sun, 16 May 2010 07:32:30 -0700 Utilizing Windows 7 Virtual Router http://bruteforce.posterous.com/utilizing-windows-7-virtual-router http://bruteforce.posterous.com/utilizing-windows-7-virtual-router It was came to my mind suddenly about how to enable Wi-Fi to be recognized by my Wii. The people at PSE have been told me to not to connect my Wii to internet because of risk of Brick Error Code 003 (your Wii is completely broken, you must change your Wii's motherboard to repair it which equal to buy a new one). FYI, mostly in Indonesia, Wiis are sold in modded version (soft or hard) to enable people played game which sold only Rp.9000,-  (equal to US$ 1) each. I think you what i mean.

Okay, let's get back to the topic. For short, i turn my WiFi on my laptop and then Wii's WiFi. I thought it would be simple to connect since Wii's WiFi recognized my laptop's WiFi but unfortunately it still didn't want to connect. After i googled the problem, i found out that simple ad-hoc WiFi connection won't be able to connect my Wii to my laptop. Wii only accepted connection from WiFi router or using additional USB device called Wii Lan Adapter. Realizing the situation, i started to find out other possibilities such as WiFi virtual router. After several times being googled for the possibilities, then i found one solution regarding my laptop specification which is using Windows 7 Professional Edition. Yup, as long as you are using Windows 7, you can use this solution. Before i write the solution, i'd like to introduce some terms regarding the technology.

Microsoft Virtual WiFi Miniport Adapter
Microsoft Virtual WiFi Miniport Adapter is a technology added to Windows 7 technology layer specification. It is run natively on Windows 7. The technology concept is quite similar to virtualization on common Operating Systems which emulates them and enable them to run side by side. Microsoft Virtual WiFi Miniport Adapter emphasizes the concept of virtualization by emulating WiFi card hardware installed on your laptop/PC then make it available for one or more instances so you can connect other devices to your laptop/PC. The connection which established will be viewed as normal connection from router to client not as client-to-client ad hoc connection. 

Below is the picture regarding the architecture of the technology
Media_httpwwwistarted_neggk

Internet Connection Sharing (ICS)
Being available since Windows 98, the technology makes internet connection sharing in your laptop/PC easier. Let say, you have more than one connection. One is backing up with broadband connection and the other one is a connection between your laptop/PC and your cellphone (connected by bluetooth). But unfortunately, your cellphone doesn't have connection to internet and you want to download an application to your cellphone. ICS will handle situation like this. Just open your Network Connection Setting. Pick your broadband connection and share  its internet connection to your bluetooth connection. If everything goes well, should you have your cellphone connected to Internet too. It makes use of DHCP.

Okay the existing technologies from Windows 7 makes Virtual WiFi possible but unfortunately until the release of Windows 7. Microsoft didn't setup the Virtual WiFi application to make use of the technologies although you can build one on your own using Windows 7 SDK and Visual Studio. Luckily, we don't have to take bloody session for developing the application. This is the solution that i'm looking for to solve my problem above. I found that there is an application being developed exclusively for Windows 7 called Connectify. This application is all that i need and solve my problem. Wii recognize my laptop's WiFi and i can browse the Internet using Opera Browser for Wii.

Here they are step by step using Connectify to build your own virtual WiFi connection.

1. Download the software. The current version is Connectify 1.2
2. Install it on your system. You should have it run too. The preview should be like this.
Connectify_view

3. For first time, you won't have any connection profile as shown above which i already had. You must setup it for your own. Connectify provides tool for setting up the connection using the simple wizard.
Connectify_view_wizard

Please click it.
4.Entering the wizard
Media_httpcianuretofi_cukeq
This the welcome page, click next >>
On Wi-Fi Device section you will be given a choice to pick your WiFi card device. In my wizard this section is skipped, i guess because of i only have one device. This picture taken from another blog.
Connectify_wizardname

Give your network a name. Since, i'm using it for Wii then i give SSID called WiiSpot.
Media_httpcianuretofi_iszfj
Set the password
Connectify_wizardsharedconnect

Pick your current connection to be shared. I shared my connection from an ADSL router LAN connection.
Connectify_wizardcomplete

This is the last step on the wizard. You can opted for starting hotspot immediately after closing the wizard or taking your time sharing to others about this application.
5. Voila... Now, all are set up. You can try connect other device to your virtual hotspot. Below, my Wii alread connected to my laptop. I have tried to with Blackberry device and another laptop. They can make use my ADSL internet connection too.
Connectify_connected

I hope it will broad your knowledge and help you too. Feel free to leave your comment.

--------------------------------------------------------------

Ovi Mail: Making email access easy
http://mail.ovi.com

Permalink | Leave a comment  »

]]>
Thu, 01 Apr 2010 01:30:42 -0700 It's time for Posterous http://bruteforce.posterous.com/its-time-for-posterous http://bruteforce.posterous.com/its-time-for-posterous Hi readers,

Welcome to my blog, i don't know why, maybe because i'm moody. Yes, i must confess that i typical of nomad blog, i write where i want to write. Now, i'm giving chance to Posterous for a place to share my thoughts. Moreover, i like Posterous concept which offere simple blogging platform. Therefore, i'd like to gain my interest in writing again... Keep in touch...

note: i omitted to abandon my blog @ brutefoz.com domain and its domain.. so please say goodbye and join my new blog...

Regards,

Oz

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/500062/avatar9.bmp http://posterous.com/users/36oRUl91xNpD Oscar Kurniawan Oz Oscar Kurniawan
Wed, 26 Aug 2009 17:49:00 -0700 Getting Started: Prolog (SWI-Prolog) http://bruteforce.posterous.com/getting-started-prolog-swi-prolog http://bruteforce.posterous.com/getting-started-prolog-swi-prolog

After wrote part I, i forgot that it should be a tutorial for installing and running (or compiling) prolog source code. In advance, we will use SWI-Prolog, a free software of prolog environment licensed under LGPL, which can be downloaded here. The distribution came into binaries and source for multi-environment operating system. It is your choice to use the pre-compiled one instead of building the source code first.

SWI-Prolog is widely use for education, research, also for comercial purposes. It offers some main features, such as:

  • Kernel licensed under LGPL while libraries are in GPL
  • Fast compilation
  • Small size of application
  • Multi-threading
  • Robust and Scale for large application
  • Portable


If SWI-Prolog has been installed into your system and you ran it. You will see interface like this:

Media_httpphotosfakfb_wfbdn

Okay… you just successfully set up your logic programming environtment and ready to be used. Now, we shall move on next step. Running your first program.

So we have this source as our very first prolog source code program. It is based on these knowledges/facts:

  • budianto is a man
  • denvil is a man
  • felicia is a woman
  • ivon is a woman
man(budianto).
man(denvil).
woman(felicia).
woman(ivon).

By using your favourite text editor you can rewrite the source code above. The next step is save your source code under extension *.pl. Please follow these steps to compile and run your first program:

1. After open SWI-Prolog. Click File > Consult…

Media_httpphotosfakfb_wphhh

The purpose is for linking SWI-Prolog with your pre-written prolog source code.
2. Choose your prolog source code. Please choose the one contains the source above.
Media_httpphotoseakfb_fjmdr

Click Open.
3. As you Open. SWI-Prolog will compile it into its knowledge-based database. Your program is ready to be queried after it has been compiled.
Media_httpphotosbakfb_rwrdl

4. Let’s we try first query to make sure everything is going alright. Yet, we know that felicia is a woman from the facts. We can verify the knowledge in database is valid by querying whether felicia is a woman or not by this syntax.

?- woman(felicia).

as noted in screenshot below

Media_httpphotosaakfb_dzcih

as you can see SWI-Prolog replied yes to the query. It means that it found the knowledge that stated “felicia is a woman” from its knowledge-base database.

Enjoy…

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/500062/avatar9.bmp http://posterous.com/users/36oRUl91xNpD Oscar Kurniawan Oz Oscar Kurniawan
Mon, 24 Aug 2009 22:33:00 -0700 Prolog: representing a clause http://bruteforce.posterous.com/getting-started-prolog-part-i http://bruteforce.posterous.com/getting-started-prolog-part-i

Dear iTech reader,

In next semester, i will take course on Logic Programming using prolog. Logic programming is a family of declarative-type programming. Why declarative? It is because prolog represents problem in declarative statements based on goals. It is also known as the goal-oriented.

So this is my first program taken from Ivan Bratko’s book: Prolog: Programming for Artificial Intelligence. Some have been rewritten also to help myself understanding prolog. 

Representing a clause in Prolog

We have this clause:

“Budi is playing footbal”

We can rewrite it in Prolog as:

play(Budi,footbal).

We should notice something. As declarative-type programming, prolog isn’t suited for numeric computation. Therefore, it is best-suited for solving problem which is involving relation between objects. For example: family tree relation.

Statement:

For all X and Z,

X is a mother of Z if
X is a parent of Z.
X is a female

 

mother(X,Z) :- parent(X,Z),female(X).

At the snipped prolog code above. First, we define relation by facts: X is a parent of Z and X is a female. Second, we define relation mother by rule of first facts. Comma (,) is a sign of conjunction of the conditions which relation should be satisfied if both true.

Exercise (Ivan Bratko,13):
a. Everybody who has a child is happy (introduce a one-argument relation happy).
b. For all X, if X has a child who has a sister then X has two children (introduce new relation hastwochildren).

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/500062/avatar9.bmp http://posterous.com/users/36oRUl91xNpD Oscar Kurniawan Oz Oscar Kurniawan
Tue, 28 Apr 2009 22:47:13 -0700 Ma.gnolia http://bruteforce.posterous.com/magnolia-135 http://bruteforce.posterous.com/magnolia-135

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/500062/avatar9.bmp http://posterous.com/users/36oRUl91xNpD Oscar Kurniawan Oz Oscar Kurniawan
Mon, 27 Apr 2009 14:56:07 -0700 Google: can you read this? http://bruteforce.posterous.com/google-can-you-read-this http://bruteforce.posterous.com/google-can-you-read-this Google frequently used variations for its logo. Especially when there is special day such as Easter, Christmas, Thanksgiving, etc. Even to remember some memorial day such as a birthday of inventor or politician or , national hero day, national day, etc. Today is quite special than other day. Google uses a special logo for its search engine website. Instead of using an alphabet logo,  Google is using something for forcing you to decode the logo into familiar text. Can you read this? Yes, i'm sure you can read this easily. If you guess this code as Google then you get it right. Google is using this logo for commemorating Samuel Morse's birthday which is today. If you had joined boy/girl scout, you should familiar with Morse's code which used for sending decoded message based on how long a tune be sounded or length of signal. If you want to refresh your memory or you have no idea what morse's code is then you might find it interesting to see this picture.

morse code

Happy Morse Day!

note: there is a blog which is collecting all Google customized logo from its homepages all over the country from 1998. Please check this out.

This post is not sponsored by Google neither related to Google. Just a personal opinion.

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/500062/avatar9.bmp http://posterous.com/users/36oRUl91xNpD Oscar Kurniawan Oz Oscar Kurniawan
Wed, 22 Apr 2009 22:19:31 -0700 Yahoo! Shutdowns its Jumpcut http://bruteforce.posterous.com/yahoo-shutdowns-its-jumpcut http://bruteforce.posterous.com/yahoo-shutdowns-its-jumpcut Yahoo! has offered its Video uploading, editing, and sharing service to enhance its Yahoo! Video by acquiring Jumpcut in 2006, a company based in San Fransisco. Being almost three years in beta version under Yahoo, it is confirmed that Jumpcut won't be in a full released version. Since Yahoo's intent to shutdown its service and integrate to a well-known imaging service, Flickr. Whatever it is, sure, though decision which Yahoo has decided to move safe in this tough economic condition. Here is the copy from Jumpcut for the user which i received several days ago:

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/500062/avatar9.bmp http://posterous.com/users/36oRUl91xNpD Oscar Kurniawan Oz Oscar Kurniawan
Tue, 21 Apr 2009 20:44:56 -0700 Test Drive: WP-Syntax for Java http://bruteforce.posterous.com/test-drive-wp-syntax-for-java http://bruteforce.posterous.com/test-drive-wp-syntax-for-java Just wanna to check if syntax highlighter is working:
public class Hello{

   public static void main(String []args){
      System.out.println("Hello World!");
   }
}

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/500062/avatar9.bmp http://posterous.com/users/36oRUl91xNpD Oscar Kurniawan Oz Oscar Kurniawan
Tue, 21 Apr 2009 09:11:00 -0700 Acquisition: SUN and Its Long Friend http://bruteforce.posterous.com/merger-sun-and-its-long-friend http://bruteforce.posterous.com/merger-sun-and-its-long-friend

There was a quite issue in SUN Microsystem acquisition. IBM recently had offered SUN to buy its stocks (NASDAQ: JAVA) and later withdrew from the offer. Surprisingly, Oracle released a press release announced that Oracle has met its best friend talked about acquisition with SUN Microsystem.

Redwood Shores, CA - April 20, 2009

Oracle Corporation (NASDAQ: ORCL) and Sun Microsystems (NASDAQ: JAVA) announced today they have entered into a definitive agreement under which Oracle will acquire Sun common stock for $9.50 per share in cash. The transaction is valued at approximately $7.4 billion, or $5.6 billion net of Sun’s cash and debt. “We expect this acquisition to be accretive to Oracle’s earnings by at least 15 cents on a non-GAAP basis in the first full year after closing. We estimate that the acquired business will contribute over $1.5 billion to Oracle’s non-GAAP operating profit in the first year, increasing to over $2 billion in the second year. This would make the Sun acquisition more profitable in per share contribution in the first year than we had planned for the acquisitions of BEA, PeopleSoft and Siebel combined,” said Oracle President Safra Catz.

“The acquisition of Sun transforms the IT industry, combining best-in-class enterprise software and mission-critical computing systems,” said Oracle CEO Larry Ellison. “Oracle will be the only company that can engineer an integrated system – applications to disk – where all the pieces fit and work together so customers do not have to do it themselves. Our customers benefit as their systems integration costs go down while system performance, reliability and security go up.”

There are substantial long-term strategic customer advantages to Oracle owning two key Sun software assets: Java and Solaris. Java is one of the computer industry’s best-known brands and most widely deployed technologies, and it is the most important software Oracle has ever acquired. Oracle Fusion Middleware, Oracle’s fastest growing business, is built on top of Sun’s Java language and software. Oracle can now ensure continued innovation and investment in Java technology for the benefit of customers and the Java community.

The Sun Solaris operating system is the leading platform for the Oracle database, Oracle’s largest business, and has been for a long time. With the acquisition of Sun, Oracle can optimize the Oracle database for some of the unique, high-end features of Solaris. Oracle is as committed as ever to Linux and other open platforms and will continue to support and enhance our strong industry partnerships.

“Oracle and Sun have been industry pioneers and close partners for more than 20 years,” said Sun Chairman Scott McNealy. “This combination is a natural evolution of our relationship and will be an industry-defining event.”

“This is a fantastic day for Sun’s customers, developers, partners and employees across the globe, joining forces with the global leader in enterprise software to drive innovation and value across every aspect of the technology marketplace,” said Jonathan Schwartz, Sun’s CEO, “From the Java platform touching nearly every business system on earth, powering billions of consumers on mobile handsets and consumer electronics, to the convergence of storage, networking and computing driven by the Solaris operating system and Sun’s SPARC and x64 systems. Together with Oracle, we’ll drive the innovation pipeline to create compelling value to our customer base and the marketplace.”

“Sun is a pioneer in enterprise computing, and this combination recognizes the innovation and customer success the company has achieved. Our largest customers have been asking us to step up to a broader role to reduce complexity, risk and cost by delivering a highly optimized stack based on standards,” said Oracle President Charles Phillips. “This transaction will preserve and enhance investments made by our customers, while we continue to work with our partners to provide customers with choice.”

The Board of Directors of Sun Microsystems has unanimously approved the transaction. It is anticipated to close this summer, subject to Sun stockholder approval, certain regulatory approvals and customary closing conditions.

There will be a conference call today to discuss the transaction at 5:30 a.m. Pacific time. Investors can listen to the conference call by dialing (719) 234-7870, passcode 923645. A replay will be available for 24 hours after the call ends at (719) 884-8882, passcode: 923645. A live audio webcast of the call will be made available at www.oracle.com/investor and a replay will be available for seven days after the call ends. source 

It is really quite surprising because after IBM, and another issues which HP would acquire SUN. Finally, Oracle is making the big step in Information Technology Industry history. Having a well-known and a well-developed platform which are Solaris/OpenSolaris OS, Java Platform, MySql, and VirtualBox virtualization technology, also a big contribution in open source community, SUN definitely will contribute to Oracle to its technology in IT industry. The most curious question is how Oracle will support what SUN has done to MySQL since it already has the leading Database Platform also to SUN's open source community. Well, we just can wait.

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/500062/avatar9.bmp http://posterous.com/users/36oRUl91xNpD Oscar Kurniawan Oz Oscar Kurniawan
Sun, 04 May 2008 04:48:00 -0700 Hello, World! http://bruteforce.posterous.com/hello-world-3016 http://bruteforce.posterous.com/hello-world-3016

Most of Java programming books used the "Hello World" code snippet to code Java for the first time. Here it is the snippet:

1
2
3
4
5
6
public class Hello {
  public static void main(String[] args)
  {
    System.out.println("Hello World!");
  }
}

 

Katanya program seperti ini terlalu prosedural khususnya bagi bahasa pemrograman Java yang menerapkan konsep pemrograman berbasiskan objek. Seharusnya minimal sebuah program Java menerapkan konsep-konsep yang telah dikenal dalam Java seperti interface, abstraction, implements, polymorphism, inheritance. It is said that the code above too procedural especially for Java language which emphasizes the object-oriented programming concept. At least, a Java code should have concepts that are well-known as the pillars of OOP such as interface, abstraction, encapsulation, polymorphism, inheritance. Let's rewrite the code above to become:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
interface Printer {
  void print(Message message);
}

class Message {
  private String message;
  
  public Message(String message) {
   this.message = message;
  }
  
  public void print(Printer printer) {
    printer.print(this);
  }
 
  public String toString() {
   return message;
  }
}

abstract class AbstractPrinterFactory {
  public static AbstractPrinterFactory getFactory(){
   return new SystemOutPrinterFactory();
  }
  
  public abstract Printer getPrinter();
}

class SystemOutPrinterFactory extends AbstractPrinterFactory {
  public Printer getPrinter() {
    return new SystemOutPrinter();
  }
}

class SystemOutPrinter implements Printer {
  public void print(Message message) {
   System.out.println(message);
  }
}

public class HelloWorld {
  public static void main(String[] args) {
   Message message = new Message("Hello, World!");
   AbstractPrinterFactory factory = AbstractPrinterFactory.getFactory();
   Printer printer = factory.getPrinter(); message.print(printer);
  }
}

 

note: aknowledge to kak Kunderemp... :) @ Fasilkom UI

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/500062/avatar9.bmp http://posterous.com/users/36oRUl91xNpD Oscar Kurniawan Oz Oscar Kurniawan