8:45 PM

AJAX code or widget

AJAX code or widget

An example of the original Kontactr AJAX code for the contact form is given in the scroll box below (Important note: the script below is a script for a contact form which send mail to my email inbox. You will have to go to kontactr.com and generate your own script.:




Note that it is only 2 line of code. You can either copy-paste direct the AJAX code into your Blogger post editor window and publish or you can edit it into a single line of code as explained above before copy-pasting. Both will give excellent result.

Peter Chen's nice graphic signature

8:42 PM

Spell Grammar Check Blogger Word MS

Spell Grammar Check Blogger Word MS

Instead of depending on the Blogger Spell Check, I used to prefer the FireFox Google toolbar spell checker. However, since they introduced FireFox 2.0, that was not working and I resorted to using Microsoft WORD to do the Grammar and Spell Check.

All I need to do is to click inside the Blogger post editor window, press ctrl+A to highlight everything, press ctrl+C to copy everything into clipboard, open MS WORD, paste everything (ctrl+V) into a WORD file, click Tools > Spelling and Grammar Check and WORD will check both spelling plus grammar for you. When done, click inside the checked WORD document, press ctrl+A to highlight everything, press ctrl+C to copy, open NOTEPAD and paste everything (ctrl+V) into a NOTEPAD document, press ctrl+A and ctrl+C to copy everything in the NOTEPAD document to clipboard, go back to the Blogger post editor window where the original post was all highlighted, press the DELETE button to clear the post editor window, press ctrl+V to paste everything from NOTEPAD document into the post editor window. Publish.

Note 1: The purpose of going through NOTEPAD is to strip any formatting that might have been introduced by Microsoft WORD into the file.

Note 2: If WORD did not find any errors and thus no correction, skip the steps of copying into Notepad then into the Blogger post editor. Just publish direct and ignore all that had been done above. WORD Grammar and Spell Check did not make any correction for this post so this will just be publish direct.

Peter Chen's nice graphic signature

8:41 PM

Uploading video direct in Blogger post editor

Uploading video direct in Blogger post editor

Video can be pretty useful in blogs. For example, there is a nice post with some hard to get Angklung Music. You can upload video from your computer direct from Blogger post editor using the video upload icon video upload icon. This is simpler than uploading to Youtube, Google Video or LiveVideo and then resizing them to fit as the script resulting from uploading direct via the Blogger upload icon video upload icon below:



only have 1 attribute for height and width and 1 (320px) for width. Now the width is only 320px which will be less than the width of the main column of most blogs including this one (400px). This mean I (and nearly all bloggers) will not need to edit the script to resize the video to fit the main column.

Compare that with 2 attributes for Youtube which must be edited to reduce the width (425px) to be equal or less than the width of this main column (400px). For ways to do that, refer to How to resize Youtube Video to fit main column or sidebar and How to resize YouTube video to fit any width.

For Google video, refer to embedding Google video and for LiveVideo, refer to refer to resize LiveVideo to fit main column

Peter Chen's nice graphic signature

8:37 PM

Change blog background color

Change blog background color
This blog uses Ramani's 3 column Minima template and the background color of the blog is white. To change the blog background, go to LAYOUT, click Edit HTML, look for the outer-wrapper portion of the stylesheet of the template. Add the line

background: chosen color;

For example, in an extract of the template below, a line (in red) has been added:

background: green;


/* Outer-Wrapper
------------------------------------------------ */
#outer-wrapper {
width: 750px;
margin:0 auto;
padding:10px;
text-align:left;
font: $bodyfont;
background: green;
}

Peter Chen's nice graphic signature

8:36 PM

HTML code displayed in a scroll box

HTML code displayed in a scroll box

A few readers have asked how to put HTML codes inside a scroll box so that readers can copy the codes to paste it into their own blogs (example see 4 column Minima template. First thing you have to know is that if you try to type the HTML as it is (example
), the web browser will interpret that as an instruction to display what follows in a new line (line break) but not display the HTML. What I did to display the above was to type to display HTML" id="BLOGGER_PHOTO_ID_5250577493689879154" title="special character < > to display HTML" border="0">. In other words, replace < onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEio0YiRH4OKWSayV9yK0zbOvvVAvO6iBUCLcUpjQ4ZIDfTOUiZAZXKJJbbG5d7WjQivHAaGIwwkERhR_xDWg7kzFKO7p4HYFr3hBW67ZUsTVf2tYbO7J4DgObRiFUB-kil8W6bihdXAZuE/s1600-h/less+than.jpg"> and replace > with

How to display HTML codes inside scroll box

Now on how to display HTML codes inside a scroll box. First, the script for a scroll box:

width: 395px; height: 400px; background-color: a0ffff; color: 000000; font-family: arial; font-size: 12px; text-align: left; border: 0px solid 00000; overflow: auto; padding: 4px;"></div>


I have the script for the scroll box save in a notepad file to be retrieved whenever I need to use it. Now, to explain how I displayed the HTML codes for the scroll box. I paste whatever HTML codes I want to display into a notepad file. Then I click EDIT in the menu bar and select "Replace..." and then type > into the "Find what:" box followed by < into the "Replace with:" box (see screen shot below:
replace function in Notepad

and then click "Replace all". Notepad will find all the < onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiW9ECr133Kyp7xVSvCrNflQIKVmGVCnpo-EvXgADOmqJPJcmSI2DGG83e1b1iW08Ap2AZqGpVPyjEv2mPFThO5GPbMTDBHYtau-ZNg3hBpoJy-DkmbFoSO1B_y8QVoaJw2I-GuTksCZmA/s1600-h/less+than.jpg"> automatically. I repeat with >, that is, type > into the "Find what:" box and into the "Replace with:" box and click "Replace all".

Thanks to DarkUFO, found a slightly easier way of encoding the HTML codes for display at encode HTML entities. What you have to do is to paste the HTML codes in between and click "encode", then proceed as usual.


Once all the <> had been replaced, I copy the edited file in Notepad and paste the edited HTML codes into the scroll box by pasting it in between >< in the script for the scroll box. I will then edit the width and height (in red) to suit the width of my main column and a suitable height to accommodate the length of the HTML codes I want to display. For example, the width (in red) is already set to 395 which is what I want, so I leave it alone. I edited height="400" to height="39", publish, done.

Peter Chen's nice graphic signature

8:34 PM

World's Shortest Email ID

World's Shortest Email ID

Branding and blogs

Brand is powerful stuff. The CocaColaTM brand is known worldwide. Consultancy Interbrand estimated Coca-Cola's brand to be worth $67.5 billion (£39 billion or 55 billion euros). That sure is a huge amount of money. Google, Yahoo, Blogger are all branded and each have their logo. In addition, all their web pages are distinguished by a distinct favicon like those below:

Yahoo! faviconstatcounter faviconBlogger Tips and Tricks faviconmail faviconGoogle FaviconBlogger favicon

Perhaps Blogger Tips and Tricks should be branded too and have its own logo and favicon?

As per favicon, this blog already has one as you can see from the address bar above. I used my profile photo for the favicon. However, the blog Header is plain, no decoration. Perhaps I should add the profile photo to the blog Header as in Advertising Tips and Tricks.

I am no website designer, graphic artist nor brand management expert so had simply used my profile photo as a quickie logo for Advertising Tips and Tricks as a demonstration. But if I am to be really serious about branding, I should perhaps think of name creation and
domain name and trademark availability testing and use custom domain.

Peter Chen's nice graphic signature

8:10 PM

Saturday, October 11, 2008

Embed Video in sidebar

A blog reader asked how to embed a video into the sidebar. I have embedded a video into the right-most sidebar at the bottom of Dummies Guide to Google Blogger. The method is not much different from the procedure to embed a as explained in embed Youtube video in blog post, but for completeness and simplicity, I will explain the procedure in full here:

The very first step is to find out the width of the sidebar as explained in how to determine the width of the blog Header, main column and sidebars. The blog Dummies Guide to Google Blogger uses a 4 column Minima template and the width of the right-most sidebar is 164 pixels.

The original embed script of the video is pasted into the scroll box below with the width and height attributes highlighted in red:

width="400" height="333">width="400" src="http://www.youtube.com/v/bU4gXHkejMo&rel=1" wmode="transparent" height="333" type="application/x-shockwave-flash">

We have to resize the video to fit into the sidebar. The easiest way is to first create an empty image with a photo editor such as the free Irfanview with the same width and height as the video (400x333). Then, with the option to preserve aspect ratio ticked, the width is changed to 160 and the corresponding height is noted (in this case I found it to be 133). So I changed all the width attributes to 160 and all the height attributes to 133.

I then get into the LAYOUT and clicked "Add a gadget" (previously "Add a Page Element") and then select HTML/Javascript and pasted the edited Youtube embed script into the page element:

width="160" height="133">width="160" src="http://www.youtube.com/v/bU4gXHkejMo&rel=1" wmode="transparent" height="133" type="application/x-shockwave-flash">

Peter Chen's nice graphic signature