Monday, October 31, 2016

Susurri - The Secret Message Service



Susurri is a working prototype that I had build for TADHack 2016 Kuala Lumpur. By utilizing the Cisco Tropo service to create a platform to let people leave a message with password protected. Then others can retrieve and listen to the message as long as they have the password.

Tuesday, June 30, 2015

Tool for encode, decode and formatter for common use data

After long 4 years, finally get a technical oriented job again. No more manager but solution architect. In this post I will share a web tool able to below task

  1. Hex - Ascii Converter
  2. Base64 encoder and decoder
  3. BCD encoder and decoder 
  4. ASN.1 Decoder 
  5. XML Formatter 
  6. JSON Formatter 
  7. CSS Formatter 
  8. SQL Formatter 

Hereby is the link J.Dencoder

Wednesday, January 11, 2012

Password-less SSH Authentication Validation

Password-less SSH login is widely use inside a trusted network. System administrator will use this method to remotely execute some task specially in a batch scripting. However, this method sometime may failed in certain circumstances for example host name change, accidentally remove the public key or private key or run the script using different user.

So validation and alerting is very important on Password-less SSH Authentication. Hereby is the script to perform validation, it has been tested on RHEL and CentOS.

Wednesday, December 14, 2011

Project Euler and Me

Thanks to Ailin and Adam that introduce me the Project Euler and now I am totally addicted with it. After 8 years not using C as my primary programming language, is time for me to pick it up and do something with C ideology - small footprint with great performance!

Below is the question from Project Euler and the code I had written to solve it. Feel free to download them then make it better or give comment and suggestion on the solution. Programmer ROCKS!

Friday, December 9, 2011

FORM validation with jquery.ajax

When <FORM> validation meet the JQUERY.AJAX

Below are the basic <FORM> with validation before the form submitted.

1  <script>
2    function validateform() {
3       $.ajax({
4           type: "POST",
5           url: "/country/checkcountry",
6           data: "code="+countrycode+"&name="+countryname,
7           dataType: 'json',
8           success: function (data, status)  {
9               if (data.result != 'OK') {
10                 console.log('check ok'); 
11                 return false
12              } else {  
13                 console.log('check not ok'); 
14                 return true
15              }
16          },
17          error: function (data, status) {
18              console.log('check error') 
19              return false
20          }
21      });         
22      console.log('should never show');
23   
24      return false; //For testing purpose, it should be return true
25   }
26 </script>
27
28 <FORM action="/country/addcountry" method="post" onsubmit="return validateform()">
29     ..........................
30 </FORM>


At the first glance, the java script seem logically fine. Actually, there are TWO major issue in that java script!

Wednesday, December 7, 2011

Document.getElementById return null

The problem
Document.getElementById() - The most useful and common use features while developing in javascript. Some how this function call will failed unexpected without any javascript error. The most common error for this function is returning a NULL even we can 100% confirm the element with correct ID is there!

The catch
Come on, this is not a browser issue nor javascript issue. There are few possible that trigger this issue. Listed below is what I faced before, if you have more please share by replying a comment. TQ.

1.  ID had been used more than once in a HTML page
Check is the ID the element has been used more than once in a HTML. The most easier way to debug is right click on the web browser and click VIEW SOURCE (CTRL U). From there use the find tool to search for the ID that document.getElementById() cannot found.

2. Nested <FORM> 
document.getElementById() return null while trying to get a <FORM> element? Make sure that the <FORM> element you try to get is not under another <FORM> element! This error is usually happen while using PHP framework or template based framework.

Try to move the inner <FORM> element out from the parent form. For Symfony PHP framework, sometime this is hard to archive because we are good programmer that make our code modular enough to screw ourselves up :P . In this case, you can use the SLOT concept in Symfony to solve this problem.

You know something is not listed here, please reply a comment to share. TQ.