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.

$("#languageSelector").change(function(){
 // 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 + "'/>" +
  "</form>");
$('body').append(form);
form.submit();


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:

#imports
import urllib2

# variable declaration
url = "http://techno-ob.blogspot.com"

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

# print source
print data


That's it. ;)



Other helpful links:



Read more ...

Bootstrap: Modal Dialog Box

Sep 12, 2014
I had a post before about how to create a modal dialog box using native CSS and Javascript (no libraries).

This time, I will make one using Bootstrap.

Required:

You may download the files or just place the following code inside your <head> tag.

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet">
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>

Next, we create our modal dialog box.

<div class="modal fade" id="modalDialog" role="dialog">
  <div class="modal-dialog">
 <div class="modal-content">
   <div class="modal-header">
  <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
  <h4 class="modal-title">[Modal title]</h4>
   </div>
   <div class="modal-body">
  <h1>[Modal Body]</h1>
  <p>Lorem ipsum dolor</p>
  <a href="">Lorem ipsum dolor</a>
  <ul>
   <li>Lorem ipsum dolor</li>
   <li>Lorem ipsum dolor</li>
  </ul>
  <ol>
   <li>Lorem ipsum dolor</li>
   <li>Lorem ipsum dolor</li>
  </ol>
   </div>
   <div class="modal-footer">
  <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
  <button type="button" class="btn btn-primary">Save</button>
   </div>
 </div>
  </div>
</div>

We then create the button that would allow the modal to appear.

<button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#modalDialog">
 Show Modal
</button>

FIDDLE

Did this work for you?
Any better solutions?

Please feel free to drop a message on the comments section.
Read more ...

Next Line in Instagram Bio (iOS)

Sep 4, 2014
I've been an Instagram user for more than two (2) years now and I've just recently learned how to skip lines on the Bio field.

I have maintained a few un-official accounts in Instagram such as insta_colorsplash and ol.shopper. However, it has always been a problem for me on how to make the bio so presentable and readable.

Whenever I tap on the next key, it will always move me on the next input field.
So I just had to cope up with seeing the words on my bio field placed next to each other. *sucks*

But hey!
I finally knew how to skip lines in Instagram! *yeah, finally!*
The steps are actually very simple and it makes me feel stupid now of why I haven't tried or thought of it before.
  1. Type your bio on the Notes app of your device.
  2. Copy.
  3. Paste it to the bio field of your Instagram profile.
And voila!

Any alternate solutions?
Feel free to leave a message on the comments section.

Note: This is only applicable for iOS devices.
Read more ...