Saturday, May 21, 2011

Tips & Tricks: Changing the site address using HTML FRAMES

To change the site address or do redirection using your own URL, you can use HTML FRAMES.

All you need to do is to supply the site address on source attribute of the FRAME and set the columns and rows to 100%.


<html>
<frameset cols="100%">
<frameset rows="100%">
<frame src="http://www.google.com/">
</frameset>
</frameset>
</html>


Hope this post helps you!

Sunday, May 15, 2011

How to make your background image as carousel using CSS and jQuery

This post will teach you how to set your background as carousel of images using CSS and jQuery.

To do this, just follow the 3 simple steps below.

1. First, you should have the list of images for your site's background.

2. Set an id for your <body> tag, let say id="body" as stated below.

<html>
<head>
</head>
<body id="body">
</body>
</html>

3. Create a javascript that changes the background-image property of the body tag using jquery and set it in a loop using setTimeout().

<script type="text/javascript">
        function carousel_bg(id) {
                var bgimgs = [ '1920x625_Sonata_homepage_image.jpg', '1920x625_Equus_homepage_image.jpg', '5_home_hero_1920x625_CF_background.jpg' ]; // add images here..
                var img = bgimgs[id];
                var cnt = 3; // change this number when adding images..

                $('#body').css("background-image", "url(http://www.pitstopmotors.com.ph/images/"+img+")");

                id = id + 1;
                if (id==cnt) id = 0;

                setTimeout("carousel_bg("+id+")", 10000);
        }

        $(document).ready(function() {
                carousel_bg(0);     
        });
</script>

You can still add images by adding the image filename on the array "bgimgs" and change the variable "cnt" to add images as part of the loop.. and that's it.

To get the complete code, please see below.

<html>
<head>
<title>Hotshots Carousel Background</title>

<script type="text/javascript" src="http://www.pitstopmotors.com.ph/js/jquery-1.4.2.js"></script>
<script type="text/javascript">
        function carousel_bg(id) {
                var bgimgs = [ '1920x625_Sonata_homepage_image.jpg', '1920x625_Equus_homepage_image.jpg', '5_home_hero_1920x625_CF_background.jpg' ]; // add images here..
                var img = bgimgs[id];
                var cnt = 3; // change this number when adding images..

                $('#body').css("background-image", "url(http://www.pitstopmotors.com.ph/images/"+img+")");

                id = id + 1;
                if (id==cnt) id = 0;

                setTimeout("carousel_bg("+id+")", 10000);
        }

        $(document).ready(function() {
                carousel_bg(0);     
        });
</script>
</head>
<body id="body">
</body>
</html>

Resolution to NuSOAP XML Parsing Error: XML or text declaration not at start of entity..

As I was doing a web service using NuSOAP in PHP, I encountered an XML Parsing Error saying "XML or text declaration not at start of entity.."

I re-checked my code multiple times but can't find any syntax problem.

I tried searching in google to find answers, but most of the forums are saying about the trailing spaces in the XML format which I believe I don't have.

Given that, I have NO CHOICE but to find it by myself..

After a long trial and error, doing some changes in the script.., removing some extra spaces.., replacing special characters.., removing some extra lines.., etc...

I was able to reach the end of the script and saw the new line after the PHP end tag "?>"..

Still in doubt, but I tried removing it.. and guess what?? it works!! That is a proof that patience and perseverance really works.. hehehe!!

Anyway, I can't believe that NuSOAP missed this.. Hope that their next version was able to resolve this..

Sunday, May 8, 2011

How to set your facebook page and apps username

First, not all pages and apps are eligible to have a username in facebook, you need at least 25 facebook users to like your page and apps.

To set your username, just follow the steps below.

1. Login to your facebook account.

2. Go to this link - http://www.facebook.com/username/

3. Choose a page or apps you want to set a username.

4. Facebook will check if it is eligible to have it.

5. If eligible, you will be prompt to set the username.

And that's it!! very simple hahh..

Saturday, May 7, 2011

How to sort playlist on youtube custom player

I see a lot of people having problems in sorting video playlist of their youtube custom player.

By default, without doing anything, youtube custom player will sort videos from oldest to latest but most of us wanted to sort videos from the latest to oldest.

Here is what I found to resolve this, and to do this is NOT through youtube custom player but on the video playlist.

Please see steps below.

1. Login to your youtube account.

2. Go to your video playlist - http://www.youtube.com/my_playlists

3. Change the order by changing the number of your videos by clicking the number of each videos and change it.

4. This should be done each time you added a new video, unless google was able to have this on custom player.

5. Changing the playlist order will changed custom player accordingly.

Monday, May 2, 2011

Handling HTML checkbox in AJAX

This post will teach you how to check and uncheck all the checkbox in a table using a toggle checkbox.

I have created 3 functions below.
  • check_toggle - this will toggle checkbox whether check all or uncheck all.
  • check_all - this will check all the checkbox in the form.
  • uncheck_all - this will uncheck all the checkbox in the form.
Please see implementation below.

<script type="text/javascript">

function check_toggle() {
        var obj = document.frmdata.checkbox_toggle;
        if (obj.checked==true) {
                check_all();
        } else {
                uncheck_all();
        }
}

function check_all() {
        var obj = document.frmdata.checkbox
        if (!obj.length) {
                obj.checked = true
        } else {
                var x = 0;
                for (x = 0; x <= obj.length; x++) {
                        obj[x].checked = true
                }
        }
}

function uncheck_all() {
        var obj = document.frmdata.checkbox
        if (!obj.length) {
                obj.checked = false
        } else {
                var x = 0;
                for (x = 0; x <= obj.length; x++) {
                        obj[x].checked = false
                }
        }
}

</script>

<form id="frmdata" name="frmdata">
<table>
        <tr>
                <td><input type="checkbox" name="checkbox_toggle" id="checkbox_toggle" onclick="check_toggle();"></input></td>
                <td>Description</td>
        </tr>
        <tr>
                <td><input type="checkbox" name="checkbox" id="checkbox"></input></td>
                <td>Row 1</td>
        </tr>
        <tr>
                <td><input type="checkbox" name="checkbox" id="checkbox"></input></td>
                <td>Row 2</td>
        </tr>
         <tr>
                <td><input type="checkbox" name="checkbox" id="checkbox"></input></td>
                <td>Row 3</td>
        </tr>
</form>

Leadership 101


  • Leadership demands sacrifices for the near-term to receive lasting benefits. the longer we wait to make sacrifices, the harder they become. Successful people make important decisions early in their life, then manage those decisions the rest of their lives.
  • Growth does not happen by chance. If you want to be sure to grow, you need a plan something strategic, specific, and scheduled. it's a discipline that would need incredible determination from us.
  • Success comes by going the extra mile, working the extra hours, and investing the extra time. The same is true for us. If we want to get to excel in any segment of life, a little extra effort can help. Our efforts can go a long way if we only work a little smarter, listen a little better, push a little harder, and persevere a little longer.
  • Making a difference in your work is not about productivity; it's about people. When you focus on others and connect with them, you can work together to accomplish great things.
  • Envision a goal you'd like to reach. Make it big enough to scare you a little. Now write down a plan for moving toward it. Create mini-goals within the big goal, to set yourself up for continual progress. And include some risks, too. Set yourself up for success.
  • Leaders build margins, not image. A leader may be forced to take unpopular stands for the good of the company. Popularity isn't bad, but decisions made solely on the basis of popular opinion can be devastating. So take courage and make the right though sometimes painful choices.