Practical Web Programming

Friday, November 30, 2007

Find of the Day: An Extraordinary Blog

While digging through the internet this morning, I came across with this blog, The XO Directory. True to it's description, "A directory of eXtraOrdinary things", I did find and read in this blog offbeat/odd news, world records, and many extraordinary things. The owner of this blog may have comb the entire internet everyday to find this extraordinary things.

The blog is fairly new, having been started just last month. But I'd probably come back here often to find extraordinary things. It pays to have extraordinary knowledge on extraordinary things.

Search Engines Infected by Hackers

It appear that the saying that "Christmas is a season of Love and Crime" is also true in the internet. Just recently, Google Yahoo and MSN search engines have been infected by hackers.

Users who uses this search engines is fooled into visiting malicious websites crammed with malware.

The websites, which came up in results for innocuous terms such as "Christmas gifts", "infinity" and "hospice", contained software that exploited vulnerabilities in Internet Explorer.

Visitors to the booby-trapped sites faced having their computer taken over and personal data stolen.


Hackers have exploited the coming Christmas season by targeting and exploiting the keyphrases "Christmas gift shopping", "Christmas holiday sale" and "holiday shopping fun".

Google have removed the websites from the search results after they had been appearing in searches, but it is believed the websites are still cropping up in Yahoo and MSN Live searches.

Thursday, November 29, 2007

My Third Adsense Payout

Yesterday morning when I signed-in to my Adsense account, I learned that my third Adsense payout has already been sent via Western Union. That day after office I went to Victoria Plaza mall to get it.

Good thing that Goggle decided to team up with Wester Union. The payout that takes almost a month before, now takes just one day for you to get it. My payout was sent on the 26th of this month but I didn't check my payment tab in my Adsense account so I just got it yesterday.

This third payout, which amounted to $104.61 (4,455.33 in Peso), is enough for me to buy a new wristwatch this Christmas. Maybe I'll wait until middle of December. There's a lot of sale by then. I might get a Casio watch for a lesser amount.


It was the last week of October when I passed my third 100 dollars mark. After this payout, I still have 40 dollars in my Adsense earnings. It will be carried to my next payout. I hope it will be on January next year. (^_^)

Recharged Camera

It's really hard to have a camera without a rechargeable battery. So yesterday, after my office, I finally bought a nimh batteries for my sony digital camera. My camera has long been idle because I have no new batteries cells.

Before buying this rechargeable batteries, I used up eight ordinary batteries (I seldom use my camera lately, only in especial occasions) since I bought this last June. Counting the battery cost, I decided to buy a rechargeable one instead.

At one thousand pesos, the four batteries including the charger, I think it's a bargain. Good thing that I finally received my third Adsense payment from Google via Western Union.

Wednesday, November 28, 2007

Goodbye PageRank

Now I know why my pagerank went from two to a flat-faced zero. It was on Now 14 that Google made their infamous update to their pagerank algorithm. After that day, millions of bloggers see great decrease in their pagerank, especially those who are selling links and doing sponsored post in their blogs - such as this blog. Some said it was a good step to rid the blogsphere of link spammers and sponsored posters. Some criticized Google for monopolizing the web. I choose to say nothing, and just keep on blogging.

Seeing my pagerank like a yoyo in just a month, I don't care much about it now as much as before. As long as I enjoy and make money blogging, I'm going to keep on blogging. After all, RealRank is coming.

Tuesday, November 27, 2007

Family Safe Blogging

If you can't decide what topic is for adult and what is not, this latest post from the Adsense blog might help you.

Many of our publishers regularly ask what is exactly considered adult or mature content by AdSense policies. It's a lot easier to understand when we speak about family-safe content. As you may already know, only ads classified as family-safe will be displayed on AdSense publisher websites.

Our policy regarding adult or mature content may include any material that is not appropriate for all audiences. While this obviously includes full nudity or sexual activity, it may also include textually explicit sexual content, image or video content containing lewd or provocative poses, strategically covered nudity, see-through or sheer clothing, and close-ups of anatomy that would be inappropriate if shown nude. Additionally, topics such as sexual health and sex tips may be held to a higher standard of professionalism than content that isn't bordering on mature.

While it's not a sure test, we sometimes suggest that publishers ask themselves the following questions to determine if content is family-safe: Would I be comfortable viewing this content with my parents or children in the same room? Would I feel comfortable viewing this content if my boss walked up behind me while I had this content on my screen? If the answer to either of these questions is no, then it is likely that some advertisers would not be comfortable showing their ads on such content and we might consider it mature.

Posted by Guillermo Bracciaforte - AdSense Publisher Support

Monday, November 26, 2007

Achy Monday

This morning I woke up with a headache. Blogging to the max really is not good for your health. Last Saturday and Sunday I didn't had a good night sleep because of fiddling with my blogs and websites. My headache was so bad that even the ceiling lighting of our office irritates me. Because of the headache, I took the afternoon today off. I planned to do it in the morning but I realize we have this Christmas every Monday morning so I was forced to go to work so as not to be busted with my nickname.

Aside from lack of sleep, I think it was the junk foods I gobbled last weekend that triggers my headache. I heard from the TV before that MSG can trigger migraine (some junk food has it). Well, to much blogging and too much MSG certainly can cause severe headache. Maybe I'll bring the remaining junk foods to the office and share with my officemates.

Sunday, November 25, 2007

Sunday Boxing

Yesterday, after doing my weekly cleaning of the house, I watched the boxing match between Mayorga and Vargas. I have seen Mayorga fought before but not Vargas. My early impression is Mayorga will going to win the fight, and he did.

I didn't see Mayorga won because I got tired because the TV's signal was not good yesterday. But if it was on an LCD TV, I'd probably finish watching the fight regardless of the signal - but I'm not picky with TV (^_^). I learned of the result just this morning from an officemate of mine.

Saturday, November 24, 2007

Weather Sick

This past few days, the weather is really taking it's tool on me. Last Wednesday I had an "affair" with the flu. Good thing our office has medical supplies always in store for the employees. My flu didn't made me took day-offs but it hinders me from going to my regular gym time (after office hours).

At this time typhoon Mina (international codename Mitag) has slightly moved faster northwest of the country to hit the provinces in Region 2.

In its 5 a.m. bulletin, the Philippine Atmospheric, Geophysical and Astronomical Services Administration (PAGASA) reported that the typhoon has continued to veer toward Northern and Central Luzon.

The weather bureau spotted the center of the typhoon around 4 a.m. 140 kilometers, north northeast of Virac, Catanduances or 290 kilometers Southeast of Casiguran, Aurora, moving with 15 kph northwest.

Friday, November 23, 2007

Google Adsense Ads Redefined

If you haven't noticed it yet, guys at Google made a new update in Adsense ads. They said this new update will lessen the accidental click that some site visitors commit when visiting a website or blog. This latest update caused Adsense publisher's eyebrows to rise (including mine).

Earlier this year we stepped back to examine the value users, advertisers, and publishers derive from clicks on content ads. As you integrate ads with your site's content and navigation, we want to ensure a positive user experience. We identified a few areas for improvement and began implementing changes, starting with our new ad formats in April.


Before this update, Adsense ads are clickable anywhere in the ad unit, but now, only the title of the ad and the url is clickable (see image below). This means that many publishers may see their clickthrough rate drop from this point on.


Read the full article here.

Thursday, November 22, 2007

An Insured Day

Yesterday I found myself buying a whole life insurance over the phone. It was the third time that the telemarketer of my HSBC credit card called in the past two months or so. The coverage started immediately after we finished talking on the phone.

The insurance policy program I bought called iProtect, a partnership of HSBC and PhilamLife, cost Php300+ per month (I can't really remember the exact amount). They said that it will be automatically charge in my credit card and appear in my monthly billing. The total policy amount is 4 million for me and my wife and will cover death, permanent disability and body part dismemberment.

I have yet to see and read the whole policy which will arrive two weeks from now. If I'm not impressed, I maybe cancel it and look for another one.

Wednesday, November 21, 2007

How To Make Custom Messages in VB6

If you are a Visual Basic (VB6) programmer who finds displaying messages using the MsgBox function so tedious. The functions below will make your life easier.

I wrote this functions to answer my demands in displaying messages to the users of my programs. This function is very handy. In fact, almost all of my Visual Basic projects uses this functions.

This functions re-uses the Visual Basic's MsgBox function to create custom message functions that are more flexible and easy to use.

'-->enum for the return of the confirmation from the user
Public Enum enum_prompt_return_value
pr0mpt_yes = vbYes
pr0mpt_no = vbNo
End Enum

'-->system name variable desclaration
'-->ex: gsystem_title = "payroll system"
Public gsystem_title As String

'-->this sub will display the critical error
'-->using the error object passed to it
'-->usage : call criticalerrormsg(err, ["error"])
Public Sub criticalerrormsg(err As ErrObject, _
Optional strtitle As String = "critical error")
MsgBox err.Number & ": " & err.Description, vbCritical, _
gsystem_title & " - [" & strtitle & "]"
End Sub

'-->this sub will display the error using the
'-->error object passed to it
'-->usage : call errormsg(err, ["error"])
Public Sub errormsg(err As ErrObject, _
Optional strtitle As String = "error")
MsgBox err.Number & ": " & err.Description, vbExclamation, _
gsystem_title & " - [" & strtitle & "]"
End Sub

'-->this sub will display an information message
'-->using the text passed to it
'-->usage : call infomsg(err, ["info"])
Public Sub infomsg(strmessage As String, _
Optional strtitle As String = "info")
MsgBox strmessage, vbInformation, _
gsystem_title & " - [" & strtitle & "]"
End Sub

'-->this sub will display an information
'-->message using the text passed to it
'-->usage : call infomsg(err, ["info"])
Public Sub alertmsg(strmessage As String, _
Optional strtitle As String = "alert")
MsgBox strmessage, vbExclamation, _
gsystem_title & " - [" & strtitle & "]"
End Sub

'-->this sub will ask a confirmation from
'-->the user using the text passed to it
'-->usage : retval = confirmmsg("delete record?", ["confirm"])
Public Function confirmmsg(strmessage As String, _
Optional strtitle As String = "confirm") As _
enum_prompt_return_value
confirmmsg = MsgBox(strmessage, vbQuestion + vbYesNo, _
gsystem_title & " - [" & strtitle & "]")
End Function

Sunday, November 18, 2007

My PageRank is Back to Zero

It was last week of October when I noticed the my pagerank increased to two. And now, just after three weeks, about two days already, my pagerank is back to zero again. Maybe it's true that Google's latest pagerank update is meant to penalize sites with excessive paid links. If this is true, maybe that is the reason because I ran PayPerPost in this blog. But this will not stop me from doing post sponsored by PayPerPost because even those are sponsored, I can say that I honestly give my opinion in every post, sponsored or not.

Friday, November 16, 2007

How To Limit The Cursor Movement in VB6

Limiting the cursor movement in a certain area (Ex: a form) can be restrictive to your users, but sometime certain application requires it. This codes show how to limit the cursor movement within a form or any control in Visual Basic 6.

To test it, just open a Visual Basic project with a form in it. Copy the sourcecodes and paste to the declaration section of the form. Then put two command buttons in the form.

You can limit the cursor movement within any control in Visual Basic. Just change the 'Me.hwnd' with the control's hwnd property. Ex: Command1.hWnd

'-->API Declaration
Private Declare Sub ClientToScreen Lib "user32" _
(ByVal hwnd As Long, lpPoint As POINT)
Private Declare Sub ClipCursor Lib "user32" (lpRect As Any)
Private Declare Sub OffsetRect Lib "user32" _
(lpRect As RECT, ByVal X As Long, ByVal Y As Long)
Private Declare Sub GetClientRect Lib "user32" _
(ByVal hwnd As Long, lpRect As RECT)

Private Type RECT
Left As Integer
Top As Integer
Right As Integer
Bottom As Integer
End Type

Private Type POINT
X As Long
Y As Long
End Type

Private Sub Command1_Click()
Dim Client As RECT
Dim Up As POINT

ClientToScreen Me.hwnd, Up
GetClientRect Me.hwnd, Client
OffsetRect Client, Up.X, Up.Y
Up.X = Client.Left
Up.Y = Client.Top
ClipCursor Client
End Sub

Private Sub Command2_Click()
ClipCursor ByVal 0&
End Sub

Private Sub Form_Load()
Command1.Caption = "&Limit Cursor"
Command2.Caption = "&Remove Cursor Limit"
End Sub

Thursday, November 15, 2007

How To Handle Null Values in Database in VB6

Null value is just so frustrating. If you don't anticipate and handle it, it will create unpredictable results in your program. With null values unhandled, runtime error are very likely to occur.

If you are a business application programmer, you need to take null values seriously, especially when accessing and referencing data from a database. In my experience as a programmer, this is one of most causes of runtime error in programs written by newbie (even experienced) programmers.

This function help you in handling null values from a database. It will checks a value for null and returns a non-null value or a default value.

'Language: Visual Basic 6 (VB6)
'Parameter: varValue = the value that needs to be handle
' varNullValue = the optional value to return in
' case the varValue is Null
'Usage: MsgBox IfNull(rst!name, "kabalweg")


Public Function IfNull(varValue As Variant, Optional varNullValue As Variant = "") As Variant
If IsNull(varValue) Or varValue = "" Then
IfNull = varNullValue
Else
IfNull = varValue
End If
End Function

In The Formatting Table

It's been three days now that my office PC is in the formatting table of our company's computer technician. The problem was I can't load maps and the development suite that I use for development won't re-install. So I decided to have it formatted.

At first I thought it was a problem in the operating system that caused errors when loading maps during development and running programs. It was only yesterday that I found out that it was my Zenworks account, that may have been changed by guys at out network department, that was the culprit.

All went well yesterday but when my sourcesafe started to annoy me, I decided to re-installed the Visual Studio 6 that I use for development. But then again the installation kept giving me errors so have it re-formatted again. This afternoon I got it back but the Oracle client is missing. Maybe I have to spend again the whole morning tomorrow fixing it. This is a wrong timing because I have to fix a program for COLIGHT which need to be finish before end of next week.

Tuesday, November 13, 2007

Apple Roadshow Featuring Mac OS X Leopard

Last night, me and two of my officemates attended the Microwarehouse sponsored Apple Roadshow which features Apple's newest sensation, the Loepard OS. It was a two-birds-in-one-stone event for me. It was the first time I attended presentation like it, and the first time I entered Davao's premiere hotel, the Marco Polo. Yes, living in Davao for almost nine years, it was surprising I haven't in that hotel before last night. It's something I'm not proud of. (^_^)

The venue was nice, the food was superb (it was free), and the software presented was great, but the presenter was somewhat the opposite. I think he was not so familiar with the Loepard operating system. In fairness to him, the Loepard OS was launch in the Philippines just days ago, so he may be on the process of familiarizing the software.

Some Pictures

How To Import Text File To Excel in VB6

This visual basic source code shows how to import a text file into a Microsoft Excel file.

To test this source code, add a blank Excel file named Phones.xls and a text file named 'Phones.txt' with the following text:

"Ali Ezzahir","Winnipeg","Canada","Programmer","204-1234567"
"Adam Smith","Winnipeg","Canada","Carpenter","204-8970965"
"John Smith","Winnipeg","Canada","Engineer","204-6578765"

This text is what we will import to the Phones.xls. Now open a Visual Basic project. In the form, add a commandbutton control and paste the source codes below, then run the program and click the commandbutton.

'Procedure: N/A
'Language: Visual Basic
'Parameter: N/A
'Purpose: Import text file to excel file
'Usage: N/A

'-->API DECLARATION
Private Declare Function ShellExecute Lib "shell32.dll" Alias _
"ShellExecuteA" (ByVal hwnd As Long, _
ByVal lpOperation As String, ByVal lpFile As String, _
ByVal lpParameters As String, ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long

Private Sub Command1_Click()
Dim xlApp As Excel.Application
Dim xlsWorkBook As Excel.Workbook
Dim xlsWorkSheet As Excel.Worksheet
Dim J As Integer
Dim delim As Variant
Dim LineText(8) As String
Dim NewLine As String
Dim CC As String
Dim DD As String
Dim AA
Dim I As Integer
Dim W As Integer
Dim Z As Integer
Dim ReturnCode As Integer

Me.MousePointer = 11
DD = """"
On Local Error Resume Next
Set xlApp = New Excel.Application
Set xlsWorkBook = xlApp.Workbooks.Add
Set xlsWorkSheet = xlsWorkBook.Worksheets.Add

delim = vbTab

xlsWorkSheet.Cells(1, 1).Value = "Name"
xlsWorkSheet.Cells(1, 2).Value = "City"
xlsWorkSheet.Cells(1, 3).Value = "Country"
xlsWorkSheet.Cells(1, 4).Value = "Profession"
xlsWorkSheet.Cells(1, 5).Value = "Phone"
xlsWorkSheet.Cells(1, 1).Font.Bold = True
xlsWorkSheet.Cells(1, 2).Font.Bold = True
xlsWorkSheet.Cells(1, 3).Font.Bold = True
xlsWorkSheet.Cells(1, 4).Font.Bold = True
xlsWorkSheet.Cells(1, 5).Font.Bold = True
I = 1
Open App.Path & "\Phones.txt" For Input As #1
Do While Not EOF(1)
Line Input #1, NewLine
I = I + 1
AA = Split(NewLine, delim)
For Z = LBound(AA) To UBound(AA)
xlsWorkSheet.Cells(I, Z + 1).Value = Replace(AA(Z), DD, "")
Next Z
Loop
Close #1
xlsWorkSheet.Columns.AutoFit
xlsWorkSheet.Cells(1, 1).Interior.ColorIndex = 20
xlsWorkSheet.Cells(1, 2).Interior.ColorIndex = 20
xlsWorkSheet.Cells(1, 3).Interior.ColorIndex = 20
xlsWorkSheet.Cells(1, 4).Interior.ColorIndex = 20
xlsWorkSheet.Cells(1, 5).Interior.ColorIndex = 20
xlsWorkSheet.Name = "Phones"
xlsWorkSheet.SaveAs App.Path & "\Phones.xls"
xlApp.Quit
Set xlsWorkSheet = Nothing
Set xlsWorkBook = Nothing
Set xlApp = Nothing
Me.MousePointer = 0
ReturnCode = ShellExecute(hwnd, "Open", App.Path & _
"\Phones.xls", "", App.Path, 1)
End Sub

Private Sub Form_Load()
Command1.Caption = "Import To Excel"
End Sub

Sunday, November 11, 2007

Make Money Online with PayPerPost

Have you ever heard of PayPerPost? If you don't, you're "leaving money on the table", as some internet guru says. Read on.

PayPerPost or PPP is a website which helps content creators such as bloggers, videographers, podcasters and photographers find advertisers willing to sponsor specific content. The advertisers create opportunities that describe the content they are looking for (e.g. feedback, reviews, buzz, creative, video). The bloggers, or "Posties" as sometimes called, then choose opportunities in their area of interest.

Once the blogger has written a blog post or posted a video that matches the requirements, PayPerPost then reviews the post against its requirements and their terms of service and handles payment to the blogger once it passed.


Personal Experience
If you are skeptical about this, don't be. My very first PayPerPost post earned me twenty (20) dollars. Since then I earned another thirty (30) dollars. If you're asking why I have low earnings, it's because this blog has low PageRank - 2 as of this writing. If your blog has a high PageRank, you have a higher chance to qualify for more opportunities with higher pay to blog about and you get more earnings.

A Word of Advise
Some of your readers may not be please seeing some sponsored post (post sponsored by PayPerPost) in your blog. So it's wise not to do it everyday. My technique when I write sponsored post, I make it to a point that it is the first post I made on that day and then I post again immediately so that it is not my most recent post. This way, it is not as noticeable as it is when it's on the topmost position in you blog.

Where To Go From Here
If you have a blog, this is another source of income for you, on top of serving ads. If you have been blogging about anything but not getting paid, this is your chance to get paid. Sign-up to PayPerPost, submit your blog for approval and then get paid while blogging.

Friday, November 09, 2007

Website Content Mistakes

When building a website, you definitely have to have good contents for visitor of your site. And it's not just contents, it's got to be 'good information' for them to come back for more. Let's face it, search engines love website with good content, especially if it is updated regularly, and web surfers hungry for information. If your website caters the needs of this two, you got thousand hits a day and a potential gold mine.

Building good contents for your site is not automatic, especially if you're a beginner and a struggling writer. Consider this few pointers on how you can avoid some website content mistakes.

1. Don't have a site built purely from your own content.

Why? Because it will take too long to grow lots of pages. Although unique, quality content is the bees knees if you ignore other sources of content you are, to quote the cheese-gurus, 'leaving money on the table'.

2. Don't have a site built purely from other people's content

Why? Because you'll have little that's unique on your site. Every man and his dog tries to borrow other people's content and use content that already exists elsewhere.
But that doesn't make it right: "If you do what everybody else does, you'll get what everybody else gets."

Search engines can frown on duplicate content so if you use sources of content that are not unique you'll need to do things to make those pages unique. But the best plan is not build a site entirely from other people's content

3. Don't have a site built purely of 'synthesized' content

Why? Because using fancy article-crawling-machines and other 'automatic content machines' will backfire on you eventually. It might make you some revenue in the short-term but it's like trying to build a house with bricks but no mortar. Sure - it's WAY quicker, but I know which house I'd rather live in and which one is still going to be there in a year's time.

Thursday, November 08, 2007

How to Add Links to Your Blog Labels

Labels or tags, as popularly known, are words or phrases that you put in your blog post to group related posts.

Adding labels is a great way to organize your blog posts into categories or topics. It help your readers to navigate easily through your blog (or website) just by clicking on a particular label. Without it, reader will have to go to your archives to read your post from previous months. Such a waste of time if he/she have to scan monthly archives when he/she is only interested in your posts that talk about making money online.

This Blog's Labels


In the new Blogger, adding label is very simple if you use a non-customized template provided by Blogger. But if you choose to customize it, you have to manually add links your post labels. Here's how.

Copy all the your blog label's URL from your browser's address bar. You can display the label's URL by clicking on it. Gather all that URL and then put each in <a> and <li> tag. See a live example below using this blog's labels.

<h2 class="sidebar-title">Categories</h2> 
<ul>
<li><a href="http://joelbadinas.com/search/label/adsense">Adsense</a></li>
<li><a href="http://joelbadinas.com/search/label/bloggers%20corner">Blogger's Corner</a></li>
<li><a href="http://joelbadinas.com/search/label/blogging">Blogging Tips</a></li>
<li><a href="http://joelbadinas.com/search/label/everyday%20life">Everyday Life</a></li>
<li><a href="http://joelbadinas.com/search/label/java">Java</a></li>
<li><a href="http://joelbadinas.com/search/label/make%20money%20online">Make Money Online</a></li>
<li><a href="http://joelbadinas.com/search/label/oracle">Oracle</a></li>
<li><a href="http://joelbadinas.com/search/label/php">PHP</a></li>
<li><a href="http://joelbadinas.com/search/label/programming">Programming</a></li>
<li><a href="http://joelbadinas.com/search/label/ramblings">Ramblings</a></li>
<li><a href="http://joelbadinas.com/search/label/seo">SEO</a></li>
<li><a href="http://joelbadinas.com/search/label/traffic%20generation">Traffic Generation</a></li>
<li><a href="http://joelbadinas.com/search/label/vb6">Visual Basic</a></li>
<li><a href="http://joelbadinas.com/search/label/web%20hosting">Web Hosting</a></li>
</ul>


Now, open your template and paste it in the sidebar (or anywhere you want), preferably just under the About Me section.

Tuesday, November 06, 2007

How to Write to an INI File in Visual Basic

INI files are useful when you want to store the latest state of your program.

In my own experience, I use INI files to read and write any information such as the last user who logs in the system and some initialization of my programs that is not possible through databases.

One thing I like about INI files is that you can change the state or behavior of your program without recompiling it. Since INI files are just text file, you edit it using notepad or any word processing softwares.

If you want to know how to read from an INI file, see my how to read from an Ini file post.

This sourcecodes is also written in Visual Basic 6.

'Procedure: WriteSettingToIni
'Language: Visual Basic
'Parameter: Filename As String = the filename and path of the ini file
' Section As String = a section in an ini file
' Key As String = a key in an ini file that contains the value to read
' Value = the value to write
'Purpose: Writes a value to an INI File
'Usage: WriteSettingToIni("c:\test.ini", "User", "Latest", "kabalweg")


'-->API DECLARATION
Public Declare Function WritePrivateProfileString Lib _
"kernel32" Alias "WritePrivateProfileStringA" _
(ByVal lpApplicationName As String, ByVal lpKeyName As Any, _
ByVal lpString As Any, ByVal lpFileName As String) As Long


'-->WRITE TO AN INI FILE
Public Sub WriteSettingToIni(ByVal Filename As String, _
ByVal Section As String, _
ByVal Key As String, _
ByVal Value As String)
Call WritePrivateProfileString(Section, Key, Value, Filename)
End Sub

Monday, November 05, 2007

How Edit Your Template in the New Blogger

Are you having trouble where to go to edit your template in the new Blogger? Don't be upset, you're not the only one. I was in the same situation you're in until I discovered it's just two clicks away.

Just days after I was first introduced into blogging, I started editing templates. But when the new version of Blogger was introduced, I was lost. I always "Revert to Classic Template", when editing my blog's template, when in fact I don't have to. Here's how to.

In your new Blogger blog Dashboard, click the "Layout" link to display the "Template" tab. Now click the "Edit HTML" link. (See picture below)



After you click the "Edit HTML" link, under the "Edit Template" section, click the "Expand Widget Templates" checkbox to expand you template. (See picture below). By now you can see the complete sourcecodes of your templates. You can now edit it.



If "Expand Widget Templates" checkbox is uncheck, you will only see your blog template's wrappers. If checked, Blogger will show the complete template's sourcecodes.

Of course, you don't have to get your hands dirty with sourcecodes, you can use the "Page Element" section, under "Template" tab, to add page elements to you blog. But if you're like me who wants to have complete control in my template, this could help. (^_^)

Remember to backup your template before you attempt to edit it. It pays to be sure.

Sunday, November 04, 2007

How to Read from an INI File in Visual Basic

INI files are useful when you want to store the latest state of your program.

In my own experience, I use INI files to read and write any information such as the last user who logs in the system and some initialization of my programs that is not possible through databases.

One thing I like about INI files is that you can change the state or behavior of your program without recompiling it. Since INI files are just text file, you edit it using notepad or any word processing softwares.

Below is a read to use function that you can use to read from an INI files. It is written in Visual Basic 6.

Procedure: ReadSettingFromIni
Language: Visual Basic 6
Parameter: Filename = the filename and path of the ini file
Section = a section in an ini file
Key = a key in an ini file that contains the value to read
Purpose: Read a value from an ini file through an API
Usage: MsgBox ReadSettingFromIni("c:\test.ini", "User", "Latest")


'-->API Declaration
Public Declare Function GetPrivateProfileString Lib _
"kernel32" Alias "GetPrivateProfileStringA" _
(ByVal lpApplicationName As String, ByVal lpKeyName As Any, _
ByVal lpDefault As String, ByVal lpReturnedString As String, _
ByVal nSize As Long, ByVal lpFileName As String) As Long


Public Function ReadSettingFromIni(ByVal Filename As String, _
ByVal Section As String, _
ByVal Key As String) As String
Dim ret As String * 255
Dim NC As Long

NC = GetPrivateProfileString(Section, Key, "", ret, 255, Filename)
If NC <> 0 Then ReadSettingFromIni = Left$(ret, NC)
End Function

Enjoy...

Saturday, November 03, 2007

My Gadget in the iGoogle Gadget Directory

My Free Online Recipe gadget is now listed in the iGoogle Gadget Directory. I've been waiting for this gadget to be listed since I submitted it on 26th of October. Now that it's listed, iGoogle users can now see it when searching using the following search phrases, 'free online recipes', 'free recipes' and 'recipes' in the gadget directory. Although it's not in the top results of those phrases, I expect to move it slowly if it gain more users.

How To Add Social Bookmark Links In Blogger

If you want some needed traffic, social bookmark sites can give you that. It can give your blogs sudden rush of traffic specially if the topic you submitted is informative. In my own experience, whenever I submit a good topic to just even one social bookmarking site, it gives me 100 to 300 more visitors to my website. Submit a topic to many social bookmarking sites and you can do the math.

But take note that this traffic is not permanent. And if visitors notice that your content is rubbish, they may feel they have been tricked and will leave at once and may never come back. So make sure that you only submit your good contents.

Social Bookmark Links

In this blog, I'm using http://technorati.com, https://secure.del.icio.us, http://digg.com, http://www.propeller.com, and http://www.stumbleupon.com bookmarking sites.

Social Bookmark Sourcecodes

See the social bookmark sourcecodes below:

<div class="post-body">
Bookmark via
<a href="http://technorati.com/faves?add=<$BlogItemPermalinkURL$>&title=<$BlogItemTitle$>">Technorati</a> |
<a href="http://del.icio.us/post?url=<$BlogItemPermalinkURL$>&title=<$BlogItemTitle$>">del.icio.us</a> |
<a href="http://digg.com/submit?phase=2&url=<$BlogItemPermalinkURL$>&title=<$BlogItemTitle$>">Digg it</a> |
<a href="http://www.propeller.com/submit/?U=<$BlogItemPermalinkURL$>&T=<$BlogItemTitle$>">Netscape</a> |
<a href="http://www.stumbleupon.com/submit?url=<$BlogItemPermalinkURL$>&title=<$BlogItemTitle$>">StumbleUpon</a>
</div>

Open you Blogger blog's template. Copy the the sourcecodes above and paste it in your template right after the the <div> tag that contents the <$BlogItemBody$> tag.

<div class="post-body">
<p>
<$BlogItemBody$>
</p>
</div>

(PASTE SOCIAL BOOKMARK SOURCECODES HERE)

There you have it, add the social bookmark links, submit your good content to social bookmark sites by clicking on the links and expect a sudden rush of traffic. A word of caution, do not overuse it or else you might get banned from this sites.

Thursday, November 01, 2007

How To Get the Address Bar URL in PHP

If you want to get the full URL in your browser's address bar, this PHP function can help you. One practical use is when you want to add a social bookmark section in you site so that you can automatically submit the current webpage.

In Blogger who don't have the same problem because you have the
<$BlogItemPermalinkURL$> tag that returns the post's URL.

Here's the PHP sourcecodes:

function getOwnURL() 
{
$s = empty($_SERVER["HTTPS"]) ? '' : ($_SERVER["HTTPS"] == "on") ? "s" : "";
$protocol = strleft(strtolower($_SERVER["SERVER_PROTOCOL"]), "/").$s;
$port = ($_SERVER["SERVER_PORT"] == "80") ? "" : (":".$_SERVER["SERVER_PORT"]);
return $protocol."://".$_SERVER['SERVER_NAME'].$port.$_SERVER['REQUEST_URI'];
}

function strleft($s1, $s2)
{
return substr($s1, 0, strpos($s1, $s2));
}

To use, just invoke the function within the PHP print method like this:

print(getOwnURL()); 

Recent Post