Practical Web Programming

Sunday, September 30, 2007

10 More Stupid Things Smart IT People Still Do

See also: The five biggest worries facing IT pros.

My Agloco Update As of September 30 2007

It was already two months since I last logged in to Agloco. My last login was on July of this year and my last update about my accumulated hours was also on July.

Today I logged in and was excited that it went will even if I am not actively recruiting members for the last two months. My direct and extended referrals are doing the recruiting for me.

As of September 30, 2007, the accumulated hours in my network is more than 413 hours, and it's counting. The total size in my network is 1525. They're the one who are helping me accumulate those hours.

It's time you make money online by just surfing the internet, join Agloco now. To know more about Agloco, go to Agloco Cash blog.

Friday, September 28, 2007

Driving Lesson

Yesterday, I had my first taste of driving a four-wheel vehicle. We first had a lecture in the morning, live demo of four-wheel vehicle parts early in the afternoon and practical driving afterwards.

Before yesterday, I thought driving is relatively easy. I was wrong. I had a hard time finding the neutral of the transmission, especially that the transmission of the vehicle we used was very loose. I also had a hard time doing the reverse. The track at the Davao Light's Maa training ground that normally takes 2 minutes for a driver, took me about ten minutes (^_^). Well, I'm very much new to driving, I have no previous experience before yesterday.

Davao Light's Maa Training Ground

Lecture Proper

Lunch Break
Our viand were canned goods because the eatery ran out of cooked viands. It served it's purpose though. (^_^)

Wednesday, September 26, 2007

How To Do Pagination in Oracle

In MySQL, pagination is very easy because of the Limit keyword in the Select statement. But Oracle don't have the Limit keyword as of this writing. So you have to do a little trick using subquery and the pseudo column rownum. Here's a simple tutorial on how to do it.

1. Pagination Formula

This formula is what you will put in your condition using between in the condition section of your Select statement.

Pagination formula, where:
pg = page numner,
lm = limit per page

(pg - 1) * lm to pg * lm;


2. Creating and Populating the Table
We will create the table that we will be using and populate it using PL/SQL.

--CREATE THE TABLE
create table FOO(
ID NUMBER(5),
NAME VARCHAR2(20)
)

--POPULATE THE TABLE
begin
for i in 1..100 loop
insert into foo(name) values(to_char(i));
end loop;
end;


3. Procedure
Now, we will create a procedure to do the querying from the Oracle database. We used the pagination formula in our condition section of our Select statement.

--PAGINATION PROCEDURE
create or replace procedure foo_pagination(
p_pageno in number,
p_limit IN NUMBER) IS

--parameterized cursor
CURSOR c_foo_page(p_pg in number,
p_lm IN NUMBER) IS
SELECT x.id, x.NAME
FROM
(SELECT id, NAME, rownum AS row_num
FROM foo) x
WHERE x.row_num BETWEEN (p_pg - 1) * p_lm AND p_pg * p_lm;
--variable to hold the rows
v_foo_rows foo%ROWTYPE;

BEGIN
dbms_output.put_line('Values in Page #' || p_pageno);

--open cursor
OPEN c_foo_page(p_pageno, p_limit);
LOOP
--fetch record from cursor
FETCH c_foo_page INTO v_foo_rows;
EXIT WHEN c_foo_page%NOTFOUND;
dbms_output.put_line('ID: ' || v_foo_rows.id ||
' - Name: ' || v_foo_rows.NAME);
END LOOP;

--close cursor
CLOSE c_foo_page;
END foo_pagination;


4. Testing
Below is the sourcecode to test our procedure. We will use PL/SQL to test it.

--TESTING THE PROCEDURE ABOVE
begin
foo_pagination(2, 10);
end;


That was it. Using subquery and the pseudo column rownum, you can do pagination in Oracle, just like what you can do in MySQL.

Monday, September 24, 2007

How To Easily Download Files From The Internet

I know downloading files from the internet is very easy. Just click on the download link or button and it will automatically download the file. But how about you are just provided a link or URL of the file, a swf or pdf file for example. If you just click on the link, it will just open the file in the browser.

I have been using a technique (or trick) for years now. I use this to download swf, pdf, movie, document and many other files on the internet.

There is no special about this technique. All you need is the link or URL of the said file, an HTML file, and the <a> tag and of course an internet connection. Here's where the trick comes, after putting the URL inside the <a> tag, run the HTML file you just created. Right-click on the link and in the pop-up menu that appears, select "Save Link As..." for Firefox users or "Save Target As..." for IE users and then save the file.

See the HTML source code example below:

<html>
<head>
<title>Download Trick</title>
</head>
<body>

<a href="http://www.xml.com/2002/01/23/svg/cubes.swf">
download me
</a>

</body>
<html>


Now, copy the source codes above, create an HTML file and start downloading files from the internet.

To test the source code above, I have added the same <a> tag here: download me

Saturday, September 22, 2007

Search Engines: A Piece of the Google Pie

Everyday millions of people use search engines to search anything on the web. The leading competitor in this field is, yes guessed it, it's Google.

According to searchenginewatch.com, there were 5.04 billion searches in August this year across 65 engines, 10% higher than the previous month (July). If you follow this trends of searches, you can see that this numbers is growing, not by thousands but by millions on the average. And this figures is expected to continue to grow. See the figures of 5 top search engines below:

Top Engines for August
* Google--46% of all searches
* Yahoo--23% of all searches
* MSN--11% of all searches
* AOL Search--8% of all searches
* Ask Jeeves--2% of all searches

Considering that this figures is in billions, have you ever imagine your website have just even a small piece of this traffic? That's a huge amount of traffic coming from organic searches. Even if you optimize your pages only for google and you rank well on them, you will have a rock-solid streams of web traffic to your site. And more traffic means more money for you if you're running an affiliate programs and ads in your site. Fortunately for us and other website site owner, Google offers a lot of tools on how we can optimize our web pages to make it more Google-friendly, the Google Webmaster Center and the Google Webmaster Tools. Visit this sites and consider using the tools and techniques that they offer. Who knows, you might see your website in the top ten organic searches in Google in a very short time. Act now and have a bite of your Google Pie.

Thursday, September 20, 2007

The Five Biggest Worries Facing IT Pros

I received this pictures (as an email) from a fellow developer. I thought this is worth sharing here.

Worry #1
Worry #2
Worry #3
Worry #4
Worry #5

Monday, September 17, 2007

How to Make Your PC Beep in Visual Basic

Making your PC beep in Visual Basic is relatively easy using API.

The source codes below is a reusable procedure to make your PC beep. This uses an API function and written in Visual Basic 6.

'Procedure: BeepPC
'Language: Visual Basic 6
'Parameter: None
'Purpose: This procedure uses an API function to beep the PC.
' The beeping sound is like error beep codes in your PC.
'Usage: Call BeepPC

Public Declare Function Beep Lib "kernel32" _
(ByVal dwFreq As Long, _
ByVal dwDuration As Long) As Long

Public Sub BeepPC()
Dim Cntr As Long
For Cntr = 0 To 5
Beep 700 * Cntr + 50, 1
DoEvents
Next Cntr
End Sub

Saturday, September 15, 2007

Planet Venus Sightings

Planet Venus has been in the night sky for days now, perhaps even weeks. We just don't see it, either because we don't where to look or we don't bother to. We can even see it during the day if you know where to look.

It will attain its greatest brilliance on Sept. 23, appearing at an eye-popping magnitude of -4.6 or 19 times as bright as the brightest star in the sky, Sirius, and 10 times as bright as the next-brightest planet, Jupiter. Venus will be seen with our naked eyes until late October.

Read full story here.

Blogger Play

Blogger launches a new website called Blogger Play. This website features all the pictures posted by bloggers in all public blogs hosted by them (blogspot.com). The pictures run like a slideshow. You can pause and play and control it's sliding speed. If you have a Blogger blog and posted pictures in it, there's a chance that it will appear here. You can visit Blogger Play here.

Here's what the Blogger Team says:

Today we’re pleased to launch Blogger Play, a neat little toy we’ve cooked up to show you photos and blog posts as you’ve never seen them before.

Shortly after Blogger launched photo uploading two years ago, one of our engineers whipped up a web page that would show us the pictures that were being uploaded in real time. The result was fun, often beautiful, but above all, compelling. We couldn’t stop watching.

Over the years we’ve kept this photo scroller as part of the Blogger offices, on a monitor or projector, as an interesting (distracting?) slideshow, and a reminder of the diversity and vivaciousness of Blogger blogs. The fame of the scroller spread within Google, until one day we were asked, “so, when are you launching this?”

Adding Video To Blog Post

Do you know that you can add videos as your blog post in Blogger. Now, you no longer need a third party video uploading websites, such as YouTube, MetaCafe, and etc., to host you videos and put a link to that video in your blog post.

To post videos in your blog, just go to your blog dashboard and click the New Post link to add a new post. Once you are in the Create Post page, just below the Link textbox, you will see the Add Video button. (see picture below).


Clicking that button (Add Video), a new window will appear where you can upload your video. (see picture below)



After selecting the video file from your PC, click the Upload Video button to upload the video to Blogger server. Then, click Publish Post for publish it in your blog.

See how easy it is. It's just like adding pictures to you blog post.

Friday, September 14, 2007

A Classmate's Wedding

Last Saturday, just after being sick for two days, I attended Alde and Shane's wedding. Alde was my college classmate and Shane was one year lower than us. We all went to the same school, USEP, and the took same degree, BSCS.

It was a hilarious and unforgettable occasion because almost all members of BAKI was there. Too bad not even one of the BAKI was present in my wedding last May.

The wedding started at 10:30 in the morning and the reception followed at Kuya Ed's restaurant. After the reception, we (the BAKI), went to Alde's farm and the reception continued until past 6:00 in the evening.

When I went home, I passed by a Durian stand and thought to myself, I should reward myself with a kilo of it. And so I did. (^_^)

The Newly Wed

The Reception

The BAKI

Thursday, September 13, 2007

Two Column CSS Webpage Template

This is a complete source codes for a two-column webpage template. This is written in CSS. I made the background of each column gray to highlight each column. See the source code below.

<html>
<head>
<title>CSS Two Column</title>
<style type="text/css">
#wrapper{
margin: 0 auto;
text-align: center;}

#outer{
width: 800px;
margin: 0 auto;
text-align: left;
border: 0px solid #F00;}

#banner{
margin: 5px 0;
border: 1px solid white;
text-align: center;
background-color: gray;}

#inner{
margin: 0 auto;
border: 1px solid white;
text-align: center;}

#content{
float: left;
width: 600px;
margin: 0 -600px 0 5px;
padding: 5px;
text-align: left;
background-color: gray;
border: 1px solid white;}

#left-sidebar{
float: left;
width: 170px;
margin: 0;
padding: 5px;
text-align: left;
background-color: gray;}

#footer{
clear: both;
margin: 0;
padding: 0;
text-align: center;
background-color: gray;}
</style>
</head>

<body>
<div id="wrapper">
<div id="outer">
<div id="banner">
<h1>Your Logo Here...</h1>
</div>
<div id="inner">
<div id="left-sidebar">
<h2>Left Sidebar</h2>
left sidebar<br />
left sidebar<br />
left sidebar<br />
left sidebar<br />
left sidebar<br />
</div>
<div id="content">
<h2>Content</h2>
This is where your content goes...<br />
This is where your content goes...<br />
This is where your content goes...<br />
This is where your content goes...<br />
This is where your content goes...<br />
</div>

<div id="footer">
<p>footer</p>
</div>
</div>
</div>
</div>
</body>
</html>

How To Hide The NavBar in Blogger

In case you don't know what is a NavBar or navigation bar in Blogger blogs, it's the blue or tan or black or silver bar at the top of every Blogger blogs.

If you feel annoyed by this bar, you can actually make it disappear by adding some CSS script in your template.

See the CSS source codes below:

#b-navbar {
height:0px;
visibility:hidden;
display:none
}


To use this CSS codes, go to your Blogger template and add the codes just after the opening <style> tag or after the code which says: <style type="text/css">

I'm using this CSS source codes in this blog that's why you don't see the NavBar at the top.

Tuesday, September 11, 2007

Email Provider Blocked

After office hours yesterday, I found out that the email providers - Yahoomail, Gmail, etc - were block by our network department. Too bad, I can no longer send emails using those email providers.

Our company uses Lotus Notes in all work related correspondence and all regular employees is given a personal email account. But I think that still doesn't justify the fact to block those providers because some employees - like me - have to send emails through Yahoomail and Gmail. I just hope they reverse this action and unblock those providers again.

It's Nice To Be Back, Again

It's really nice to be back. Last week (Thursday and Friday), I was absent from work because of fever and flu. Now I'm back in the loop. This blog suffered from those absences. I barely touch this for the last three weeks or more because of very busy schedule due to projects here and there. There's again another new project coming next week. Well, I hope my training for month will be approved so that somebody will assume as the team leader for that project. (^_^)

It's 911
It Semptember 11, exactly six year after the attack at World Trade Center, New York, USA. I found this website which features stories on that historic day.

Wednesday, September 05, 2007

Second Program for ANECO

Last Monday we had our planning session for the Map Viewer project for Aneco. This is is the second program that we have to develop. The first program was the Device Manager. The project duration is two weeks. It started on Monday will be expected to be finished on September 17. This project is relatively easier than the first one because we have made three project which has the same requirements as this one.

The Plan

The Development Team

Tuesday, September 04, 2007

Fever and Work

I woke up this morning with a fever. If I had a choice, I wouldn't be here at the office. I have a deadline to beat for our second program for Aneco which is due on second week of this month.

I guess this is just one of drawbacks when you are working for somebody else. You don't have a choice but to meet the work schedule. I have a dream to work for my own and one way to do that to get serious in making money online. Well, I've planted the "seeds". Time will tell if I will be successful. If I do, this blog will be the witness.

Sunday, September 02, 2007

Back At Work

It's Monday morning, back to work again. The weekend seems so long for me though it was only one and a half day.

Saturday afternoon, after an half day duty at work, I went to the mall to watch Rush Hour 3. I thought it was a good one as my co-worker said it was, but it didn't met my expectation. That evening I did my laundry and on Sunday I was a little sore so I just spent the whole morning in front of the DVD player watching 24.

I'm excited now because yesterday I managed to download the the Advance PHP 5 ebook. I was looking for this for a long time already. I was going to buy this book at the bookstore last Saturday but when I look at the prize tag, it was more than one thousand five hundred pesos. I said to myself I might just download this on the internet, and sure I did. I prefer to read printed books, but with that prize, I backed off. Maybe I'll buy this when I have a spare money.

Recent Post