Monday, February 11, 2013

Google Certificate Error for IBM Websphere Application Server 7: Solved!


SCENARIO:
Upon developing an Add Event to Google Calendar functionality under a certain project, I encountered this error: com.google.gdata.util.AuthenticationException: Error connecting with login URI. I'm using IBM WAS7(Websphere Application Server v7) during that time. After a series of research, an idea came up regarding the certificates that are being handled by server. Implementing the steps gathered worked well in fixing the issue.

SOLUTION: 
Below are the steps on how to configure Google certificates on your IBM Websphere Application Server version 7:


1. Log into the administrative console
    
2. Expand Security and click SSL certificate and key management
    
3. Under Configuration settings, click Manage endpoint security configurations
    
4. Select the appropriate Outbound configuration to get to the (cell): in this example jcNode01Cell:(node):jcNode01 management scope.

5. Under Related Items, click Key stores and certificates

6. Click the NodeDefaultTrustStore key store.

7. Under Additional Properties, click Signer certificates.

8. Click Retrieve From Port
    

9. In the Host field enter www.google.com, enter 443 in the Port field, and          www.google.com_cert in the Alias field. Click Retrieve Signer Information.


10. Verify that the certificate information is for a certificate that you can trust. Click Apply
11. Click Save.
You can know access google services without getting any certificate errors. ^_^

Cheers!!!

The DANGER Behind parseInt function - Javascript


SCENARIO:

Inside a certain if condition, I used parseInt('08')to convert a string to its equivalent numerical value. But unexpectedly, it returned 0 as a result.

I also tried:

parseInt('01')
parseInt('02')
parseInt('03')
parseInt('04')
parseInt('05')
parseInt('06')
parseInt('07')
parseInt('08')
parseInt('09')

but all of which returned the expected result except for 8 and 9 which resulted to 0.


SOLUTION: 
The parseInt()javascript method is an octal base function (i.e. it can only cope up with input from string of 0 to 7). In solving this, we can either include the base or use Number() function as an alternative.


1. Using base of decimal number system:

parseInt('08', 10); 
//wherein 10 signifies the base value of decimal number system


2. Using Number() function.


Tuesday, November 6, 2012

How To Determine If an Element Exists Using jQuery


SCENARIO:
I am new to jQuery and I want to know if a certain DOM element exists in the page. I tried the snippet below but it didn't work.

if($("#myElementID")){
    alert("The element exists!");
}



SOLUTION: 
As a beginner, you might think that wrapping the jQuery selector inside an if statement will fix your problem. Ideally that code must work in ordinary programming aspect/concept.


The jQuery selector returns an object every time you use it. If we will use the above snippet, the selector will always return true - regardless if the element doesn't exists.


Here are the proper ways on how to determine if an element really exists in the page:


1. Use length property. This property returns the size of the object.


if($("#myElementID").length > 0){
    alert("The element exists!");
}


or


if($("#myElementID").length){
    alert("The element exists!");
}


TIP: It would be better to use the first implementation for the purpose of code readability.

2. Use size() function.


if($("#myElementID").size()){
    alert("The element exists!");
}




Hope it helps. Cheers!!!





Thursday, June 14, 2012

How THIS Blog Works? (An Overview)

Basically, this blog is just like a reference for web developers. You might be wandering how does it work? Well, think of a Q&A page - but in this blog call it S&S(Scenario&Solution).

Every post has its own SCENARIO or problem (i.e. based on my actual programming experience) from which you may acquire the solution.

Example:
SCENARIO: I want to blah blah blah...

SOLUTION: To solve this kind of problem, blah blah blah...

You might also encounter TIP, NOTE or REMINDER that might help you to solve your problem.

You may now start seeking! ^_^

Wednesday, June 13, 2012

Why Did I Create THIS?

Whenever I code, I always encounter new challenges and new ideas. Each time I learned something new, I refuse to just keep it on my mind and my own sake. I want to share what I learned that's why I came up with this blog - even though I'm not that good in English grammar :D. Hopefully I can help! Let's start the ball rolling!