Last time, I've tried to customize my Blogger template so when I posted some code, it can display code more clear. Asked Google and found that it was so easy to highlight code in Blogger using Syntax Highlighter.
All you need to do is:
1. Go to your Blogger setting where you can edit your Blogger template.
2. Use your browser to find </head> tag.
Showing posts with label Programming. Show all posts
Showing posts with label Programming. Show all posts
Tuesday, December 6, 2011
Sunday, July 10, 2011
Connect to database with XML HTTP Connection (POST)
Ok, last time I've show you how to use XML HTTP Connection with GET method. Now I'll show you the other method, using POST method. Ok, first, using the same HTML file, but we need to edit the Javascript.. Here is the HTML file for post method
<div id="test2" onClick="getIt('test2')"> 2 </div> <div id="test1" onClick="getIt('test1')"> 1 </div>Using the same database like before, and the same PHP file, but we need to change some code on it. This is for the PHP file.
<?php $username="mysqlusername"; $password="mysqlpassword"; $database="xml"; $field1=$_POST['field1']; $con= mysql_connect("localhost","root",""); mysql_select_db($database) or die("unable to select the database.."); if($con) { echo "Result of".$field1." \n"; $query="select * from dummydata where id=$field1"; $res=mysql_query($query); $done=mysql_fetch_array($res); if($done['content']!=null) { echo $done['content']; } else { echo "error"; } } else { echo "Invalid login information!"; } mysql_close($con); ?>Ok, that's all, test it and you'll get the same result like before ;)
Wednesday, July 6, 2011
Connect to database with XML HTTP Connection
This time, I want to share about XMLHttpConnection. I learn this thing because I need it to develop my (first) BlackBerry application. What is the purpose of XMLHttpConnection? With XMLHttpConnection, I can request a connection in background without reloading the page (something like that). Nah, I tried it and it was successful. Now, it's time to share. I'll show you step by step.
note: this XMLHttpConnection example using GET method. For POST method, I'll post it later.
First, let's create a simple HTML file. This is my HTML file with some JavaScript code:
<script type="text/javascript"> function getIt(xx){ var get= parent.document.getElementById(xx); if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.open("GET","http://localhost/xmlcon/connect.php?field1="+get.innerHTML,false); xmlhttp.send(); alert(xmlhttp.responseText); xmlhttp.close(); } </script> <html> Simple XML HTTP Request <body style="font-size: 3em"> <div id="test2" onClick="getIt('test2')">2</div> <div id="test1" onClick="getIt('test1')">1</div> </body> </html>Save as main.html and test it in my localhost and the result is like this:
Monday, June 27, 2011
Create button, Input field and tooltip using BlackBerry WebWorks!
Last time I showed how to say "Hello World" from BlackBerry. Now I want to show you how to create simple alert button, input field and tooltip :). All you need to do is create a simple HTML, configuration file for your WebWorks application (config.xml), a CSS file to customize the interface and add some image for your application icon. Put it in one folder and compile it with bbpw.exe which you can found in the directory where you installed BlackBerry WebWorks SDK.
Thursday, June 23, 2011
Build a simple BlackBerry Application using BlackBerry WebWorks!
This week, I learn how to develop a BlackBerry application using BlackBerry WebWorks. Why using BlackBerry WebWorks?
BlackBerry® WebWorks™ applications are stand-alone web applications that use HTML, CSS and JavaScript®. They look, behave and have the same security mechanisms as a native BlackBerry smartphone application. BlackBerry WebWorks applications can be installed on a BlackBerry smartphone like any native BlackBerry smartphone app and extended to use device-specific information and data with BlackBerry WebWorks APIs.
I'm not an expert Java programmer, so I spent a lot of my time to learn and build BlackBerry application using Java code. Now with BlackBerry WebWorks, I can develop BlackBerry application using HTML, CSS and JavaScript.
Thursday, June 9, 2011
RGB Image Processing using Matlab
This is what I've learned in this semester. In Digital Image Processing class, my lecturer gave me a very strange image. Let me show you the image..
Real Image |
Ok, now what to do with this image? My lecturer said that maybe he'll use this image in the final examination. I've heard that last semester, the same lecturer gave this picture too in the final examination. The main goal is to remove the noise from the image, and then manipulate the object in the image so that the rubber band will have a red color and the other solid objects will have a green color, using Matlab. I've trying to do it several hours ago using Matlab, and the result is.... Yes, I can! Here is my Matlab script to manipulate the image above:
Subscribe to:
Posts (Atom)