Java Spring: Display Chinese Characters in Email

May 26, 2015
My current task is to implement localization for a website.

There is no issue with displaying the Chinese characters in the website.

However, I just have one problem: Chinese characters appear as question mark in emails.
Already set the encoding to UTF-8 but it still won't work.

I did some research and come up with these links:

Fortunately, my team leader eventually got the solution.

In the config file, we just had to add this property for the JavaMail bean.

<property name="defaultEncoding" value="UTF-8"/>

And tadaan! Works like magic :D

Read more ...

Localize jQuery Validate

May 20, 2015
Here is a code snippet on how to localize the custom error messages for the jQuery Validation Plugin, assuming I have already imported the proper libraries.

I have created a separate function in my script to set the proper error messages.

function addCustomMessages(){
    $("#inputName").rules("add", {
        messages: {
            required: errorRequired,
            minlength: errorMinLength

where errorRequired and errorMinLength are global variables that holds the localized messages.

The function will be called every time the language is changed.

 // code here to get the translations
 addCustomMessages(); // code that will load the messages for the jQuery validation plugin

Works like magic. :)

I'll try to add a fiddle next time to further clarify.

Other helpful links:

Read more ...

Remove Member From Skype Group (Windows)

Mar 5, 2015
If ever you are someone - like me - who used to think that in order for a member to be removed from a Skype group, he needs to voluntarily leave the group, well, TANAAAN!

We are wrong!

Haha. Below are the very simple steps on how to remove a member from the group if you are an administrator.

1. Get the names of the members shown below the Group Name.

 You can get this when you click on the arrow at the left side of the text that indicates how many members there are in the group. In this case, "2 people".

2. Right-click on the member's name, choose Remove.

Do you find this tip helpful?

Read more ...

JQuery: Send Post Data and Redirect

Mar 2, 2015
Basically, what I wanted to do is to send data from one page to another page.
Apparently, I don't have any form to submit and I don't want it to appear on the URL, either.

Here's one simple solution:

var form = $("<form action='" + url + '' method='post'>" +
  "       <input type='hidden' name='id' id='id' value='" + id + "'/>" +
  "       <input type='hidden' name='username' id='username' value='" + username + "'/>" +

where id and username are variables holding the data you want to send to another page, and url is the page you want to pass the data to.

Any other alternate solution?

Please feel free to leave your message on the comments section.

Read more ...

Python: Crawling Static Pages

Feb 24, 2015
As a software developer assigned to test and create crawler scripts for a few months... or years.. I would like to share to you how to scrape the page source from a static webpage.

Here's what we need:

The code is simple as:

import urllib2

# variable declaration
url = ""

# get page source
data = urllib2.urlopen(url).read()

# print source
print data

That's it. ;)

Other helpful links:

Read more ...