The ColdFusion website is now fully data-driven
I learned a way to write code for the menus by using database instead of using cfswich. Now the course website is completely database-driven. I used the CMS approach to redesign the links in each menu. Here is the entire code for the content page that corresponce to the menu items:
<cfquery name=”qGetURL” datasource=”DSN0111″>
SELECT *
FROM tblMenu
WHERE 0=0 AND
<cfif isDefined(“URL.projectid”)>
menuID = #URL.projectid#;
<cfelseif isDefined(“URL.pageid”)>
menuID = #URL.pageid#;
<cfelse>
menuID = 18;
</cfif>
</cfquery><cfoutput>
<cfset filePath = ExpandPath(“#qGetURL.linkLoc#”)>
<cfif fileExists(filePath)>
<cfinclude template=”../#qGetURL.linkLoc#”>
<cfelse>
<div id=”noVal”>Not Found</div>
<cfinclude template=”index.cfm”>
</cfif>
</cfoutput>
As you can see from the above code, the file location and the file names are stored in the database instead of the page content. This way, I can create web pages inside site directories and then include it to the website through database without change the above code.
I also plan to create a ColdFusion web application that can directly update the database without launch MS Access. Right now I’m using CFEclipse to write the ColdFusion code on my Fedora system and virtualized Windows XP through VirtualBox to modify and viewing the database. My goal for this web application is to allow me to modify or view the database with less or no MS Access usage.
For those who don’t know, my ColdFusion course is Microsoft Access based, not MySQL based. I successfully installed ColdFusion 9 on my Fedora system, but I failed to install MS Access driver onto the system. That’s why I plan to create this application in the next few weeks.
Experience with Proprietary NVIDIA Driver and one Compiz Fusion tip
After I installed proprietary graphic driver from the official NVIDIA website because of the recent decision of using Second Life on my Fedora system, I installed Compiz Fusion. I was surprised to see that the animations produced by Compiz Fusion is smoother than before, although I don’t know why the NVIDIA driver installed from RPM Fusion does not have the same performance as the official driver. Aside from great performance and ability to smoothly run Second Life, I also noticed that the print screen key didn’t work. The problem came from using Compiz desktop. The print screen works once I switched to Metacity window manager by right-click the Compiz Fusion icon, select “Select Window Manager”, and choose Metacity. I decided to find the solution of this problem since I want to completely use Compiz Fusion and will be taking screenshot in the future. After I searched over in the CompizConfig Settings Manager, I discovered a neat feature in the settings manager to search the whole text across the Compiz Fusion plugins.
- After you opened CompizConfig Settings Manager, choose Advanced Search on the bottom left, at the top of the Close button.
- Wait a few moment to allow it to scan all of the Compiz Fusion plugins.
- After that, check “Settings value” checkbox under “Search in…” (Note: this will be unchecked once the manager window is closed, I guess that the search settings cannot be saved).
- Then type the word you want to search under Filter (in my case, it’s “print”).
- While you type, the plugins that contain the filter characters appear under Plugin.
- I found that the print screen key is in the Gnome Compatibility plugin. So I went back to the plugins list by clicking the Back button and enabled the Gnome Compatibility plugin.
- Now I can use the print screen key to make the screenshots. The problem solved.
I’m not sure why the Gnome Compatibility plugin was not enabled by default because it seems to be enabled by default during my re-installation of Fedora in the past. Maybe perhaps because of the proprietary NVIDIA Driver. But I’m still believing the open source Nouveau video driver. I hope its 3D support version will be released soon.
Still Solving Flash Problem in Second Life
Yesterday I successfully ran Second Life official viewer on Fedora x64. However, I discovered that I cannot view YouTube video and other Flash-enabled websites when testing the new Shared Media feature in SL Viewer 2 Beta. Today I found out there only have one blog post related to the Flash problem over Second Life blog. It talks about Flash and Firefox issues related to SL Viewer 2 Beta. You can view this blog post right here: https://blogs.secondlife.com/message/111720, and don’t be afraid to start a discussion if you have any problem with SL Viewer 2 Beta on GNU/Linux.
Finally got Second Life Official Viewer Working under Fedora 12 x64 Updated
Second Life viewer 2 beta has been out for a while. It features a web browser like interface and a new feature called Shared Media that makes me to rethink about trying to install SL viewer on my Fedora x64 laptop. The new feature has the ability to bring web applications to the Second Life, even Flash games and YouTube.
UPDATE: Unfortunately, I cannot get the flash to work. neither do the Youtube and HTML 5 ogg forfmat.
Two websites opened on one prime
Top: youtube.com  Front: robbychen.com
Click the image to enlarge
System requirement for the SL Viewer 2 beta is the same as the original viewer. This means that it still doesn’t support 64-bit Linux system. I have to install 32-bit compatibility libraries on the Fedora x64 system. After a little research on Google, I found a blog post about installing 32-bit support onto Fedora 11. I followed its steps to install the 32-bit support libraries. Because of the differences between Fedora 11 and 12, I changed the architecture for the libraries mentioned in the post from i586 to i686. Below is the list of support libraries that I installed:
arts.i686
audiofile.i686
bzip2-libs.i686
cairo.i686
compat-expat1.i686
compat-libstdc++-33.i686
compiz.i686
cyrus-sasl-lib.i686
dbus-libs.i686
directfb.i686
esound-libs.i686
fltk.i686
freeglut.i686
gtk2.i686
hal-libs.i686
imlib.i686
jack-audio-connection-kit.i686
lcms-libs.i686
lesstif.i686
libacl.i686
libaio.i686
libao.i686
libattr.i686
libcap.i686
libdrm.i686
libexif.i686
libgcrypt.i686
libgnomecanvas.i686
libICE.i686
libieee1284.i686
libsigc++20.i686
libSM.i686
libtool-ltdl.i686
libusb.i686
libwmf.i686
libwmf-lite.i686
libX11.i686
libXau.i686
libXaw.i686
libXcomposite.i686
libXdamage.i686
libXdmcp.i686
libXext.i686
libXfixes.i686
libxkbfile.i686
libxml2.i686
libXmu.i686
libXp.i686
libXpm.i686
libXScrnSaver.i686
libxslt.i686
libXt.i686
libXtst.i686
libXv.i686
libXxf86vm.i686
lzo.i686
mesa-libGL.i686
mesa-libGLU.i686
nas-libs.i686
nss_ldap.i686
opencdk.i686
openldap.i686
pam.i686
popt.i686
pulseaudio-libs.i686
sane-backends-libs-gphoto2.i686
sane-backends-libs.i686
SDL.i686
svgalib.i686
unixODBC.i686
zlib.i686
Notice that I removed any of the version number from the original list in order to install the updated libraries, and I also removed three libraries that doesn’t available in the Fedora 12 repositories. It seems that it’s working despite of missing three libraries.
After the installation completed, I launched SL to see if it’s working. Sadly, it displayed an error stated that creating window error. I knew it was the video driver problem since I stuck at this step before and gave up. I thought the problem is that the installed NVIDIA driver through RPM Fusion was outdated. I removed this driver and installed the official proprietary driver from NVIDIA website, restarted my laptop. Finally, I started the new SL viewer and logged into the in-world. I have been used it for 30 minutes. Up until now, the performance and stability of the viewer is great. I suppose I can use the new SL viewer thanks to the proprietary driver after all, although I don’t know why it doesn’t work under the driver in the RPM Fusion repo.
Rainbows jQuery Plug-in Makes Text Gradient
I just discovered a great jQuery extension called Rainbows. It basically adds gradient effect to the text. It is best used for the text in the logo. There are lots of great examples over its website. It not only supports gradient effect, but it also supports highlight and shadow effects. I downloaded this extension and tried it out. Following the online manual, I created the following logo effect:
This is just an image. Click the above image for the TEXT effect using Rainbows
I didn’t apply the shadow effect to the logo because I feel it didn’t like a logo when applied with shadow effect.
After I created this effect, I noticed that it basically uses jQuery to split the text into small pieces in order to apply the gradient effect. This is a good technique for the Flash-like text animation Javascript effect.
You can view other cool AJAX projects from the same company by visiting its labs homepage at labs.dragoninteractive.com.
Learning PHP Object Oriented Programming
Today I have learned about using Object Oriented Programming (or OOP) in PHP. It is very easy once you understand the structure of the OOP and have lots of practice on this technique. I learned this while I was looking over my Google Reader before my PHP class. I’m taking beginning PHP course this semester. This means that the OOP topic is not included in this course. You need to know basic PHP structures like functions and loops in order to understand OOP. Fortunately, I already self-learned PHP language during the end of year in 2009 through Lynda,com. So I tried to use OOP in the PHP script. At first. I think that I will practice more of this technique because this is new to me. I followed the simple tutorial on this website. After finishing the tutorial, I went to attend the PHP class. To me surprise, it had a test today. I happened to need more practice over the OOP. I took the second part of the test which was the hands-on test entirely using OOP. Here is the Object-oriented based test page. The following is one of the classes I created:
class todayDate {
public $month;
public $mesg;
public function __construct($tdMon) {
date_default_timezone_set(“America/New_York”);
$tdDate = date($tdMon);
$this->month=$tdDate;
switch ($tdDate) {
case “June”:
case “July”:
case “August”:
$this->mesg=”Drive safely: school is in session”;
break;
default: $this->mesg=”Enjoy your vacation: Drive safely”;
}
}
public function getMonth() {
return $this->month;
}
public function displayMsg() {
return $this->mesg;
}
}
I just learned the basics of Object Oriented Programming so I can only write these basic classes. As I learn more about OOP, I will improve my code for better readability and performance.
For more information and to learn more about Object Oriented Programming in PHP, visit this article on devarticles.com.
Ubiquity Experiment was Ended For Now
Ubiquity was an experiment Firefox add-on released by Mozilla back in 2008. It basically added a command line interface to the browser to search almost everything on the web using Google search engine. According to the Ubiquity homepage, the first phase of the experiment was successfully ended in 2009. Some of its feature has been integrated to Jetpack, another experiment add-on developed by Mozilla to allow web developers to develop Firefox add-ons more easily. Mozilla stated on the Ubiquity homepage that it will launch second phase of the experiment in “indefinite future”.
I used Ubiquity long time ago. In my experience, it is very easy to use, best for people who love using the command line. However, I always forgot to use Ubiquity by pressing Ctrl+Space when I was doing my research rather than use the search bar. Maybe sometimes in the future Mozilla should add the option to add Ubiquity onto the Firefox toolbar in their Phase II experimentation.
Successfully using ColdFusion array for the First Time Without Knowing Anything
I just improved my ColdFusion class website. I used more fileExists functions to automate the detection of the project files in the URL variables. Now I don’t have to worry about adding the projects to the cfswitch statement anymore. Here is the code snippet for one of my cfcase statements:
<cfcase value=”4″>
<cfif fileExists(filePath[4])>
<cfinclude template=”../projects/project4.cfm” />
<cfelse>
<div id=”noVal”>This project is not available yet!</div>
<cfinclude template=”index.cfm” />
</cfif>
</cfcase>
Noted that I used an array in the fileExists function. Here is the cfloop statement for the filePath array:
<cfloop from=”1″ to=”10″ index=”i”>
<cfset filePath[#i#] = ExpandPath(“projects/project#i#.cfm”)>
</cfloop>
As you can see, I used an array inside cfset statement to store 10 ExpandPath functions. This is my first time to use the array in a ColdFusion variable. In fact, I didn’t know anything about how to use ColdFusion array. I just applied the array based on the other programming languages that I have already known. According to course syllabus, we should learn ColdFusion array at later chapter.
At first, I used filePath#i# inside the loop to declare a regular ColdFusion variable. ColdFusion outputted an error stated that “ColdFusion was looking at the following text: #” . Then I tried the traditional method of adding an array by surrounding the loop variable with a pair of brackets. I was very surprised that it actually worked.
I applied the same technique to the title of each webpage so that I no longer forget about adding project title to the title.cfm when completed a project. Here is the code snippet for one of the cfcase statements:
<cfcase value=”7″><cfif fileExists(filePath[7])>#titleName[7]#<cfelse>#defaultTitle#</cfif></cfcase>
The defaultTitle variable is the default title on the site homepage.
The following are the additional updates for the site:
- Projects are now re-organized
- Project 1 has become homepage
- Project 2 has changed to project 1
- New project 2, Advanced SQL, was completed and added to the homepage
The FSF Open Letter to Google
The following is the email I received from FSF about Google’s recently purchased On2 video codec maker. I already talked about Google’s usage of On2′s VP8 codec might come true in the post “The future version of Youtube might not support Firefox” almost one month ago. I strongly support this statement to encourage Google to license its newly acquired video codec as a royalty-free license. If Google freed the VP8 video codec and switched its proprietary Flash-based Youtube site to its new VP8-based site using royalty-free license, more people will aware the importance of open video format as well as open source movement.
Dear supporter,
This week, Google’s attempt to purchase video codec maker On2 was
approved by On2′s shareholders. If Google does the right thing, this
could be wonderful news for free formats.The FSF has just posted an open letter to Google, calling on it to
free On2′s VP8 codec with an irrevocable royalty-free license, and to
promote the newly freed video codec through YouTube.Read why it would be so amazing for free software developers, free
software users, and all users of the web if Google does the right
thing:http://www.fsf.org/blogs/community/google-free-on2-vp8-for-youtube/
We feel that this is a very important message for web developers,
video creators, and tech-savvy members of the public to hear. Please
help us spread it around, particularly here:http://www.reddit.com/r/technology/comments/b462q/open_letter_to_google_free_vp8_and_use_it_on/#
And if you have an account on digg:
http://digg.com/tech_news/Open_letter_to_Google_free_On2_VP8_and_use_it_on_YouTube
(It’s important that we let people everywhere know about the
importance of free software and free formats, so please help spread
the word — but please don’t let sharing important news about free
software lead to further use of services that promote and use proprietary
software.)Thanks!
Sincerely,
Holmes Wilson
Free Software Foundation
Discovered a Bug in the Web Application
I encountered a small bug in my Computer Concepts web app while I was doing the assignment using the app. It seems to always output a forward slash in front of each single quote on the print layout table. Please refer to the following screenshot if you don’t know what I’m talking about.
Forward slash bug. Click the image to enlarge
Thankfully, I found this post in the Dev Shed forum that provide a native PHP function to remove the forward slashes. I applied the function stripslashes($string) to the output value and the forward slashes are now gone.
Here is the updated source code for anyone who downloaded my last source code:
http://www.robbychen.com/cs110/worksheet_sourcecode.zip
If you find more problems while using the app, please leave a comment. I will fix it as soon as possible. Thanks.