I needed to speed up the loading time of some dynamic pages. So I decided to try some kind of caching solution. A coworker sent me this link to Andrew Powell's blog post. I gave his facade a try it seems to be working great.
I made mach-ii plugin to manage the keys for cached content. Plugin has 2 parameters,
first is a name of event arg that has content to store in cache, second is an event to announce if there is cached content.
Here is most of the code for the plugin with makeCacheKey() method omitted because it would be different for others, the main thing is that it returns a string with a key or empty string.
Thursday, October 30, 2008
Wednesday, August 20, 2008
ColdFusion development on Ubuntu 8.04 - part 2
Picking up where I left off with setting up ColdFusion development on ubuntu. I decided to give VirtualBox a try. it's better to download one from the site. I used the binaries download link, not the OSE version. Install is pretty smooth I just double-clicked on the file and debian installer came up.
After that I setup and installed Windows XP virtual box. Had to do it twice since first time didn't give it enough space. Second time gave it 30G.
Installed MSSQL 2005 and restored a database backup.
So far so good. So now I need to connect to this database from host ubuntu (the windows xp in virtual box is referred to as "guest").
The best instructions that worked actually were in the VirtualBox help files.
I added another network adapter to my virtual XP and made that one HIF:
Run ipconfig in virtual XP to find the IP and that's the IP I used in ColdFusion admin to connect.
Remember to enable TCP/IP in SQL for connection:
Start-Programs-MS SQL Server 2005-Configuration Tools - SQL Server Configuration Manager - SQL 2005 Network Configuration - Protocols for MSSQLSERVER
Now I might need to make the IP permanent somehow, but I am very pleased that it works the way it is so far
After that I setup and installed Windows XP virtual box. Had to do it twice since first time didn't give it enough space. Second time gave it 30G.
Installed MSSQL 2005 and restored a database backup.
So far so good. So now I need to connect to this database from host ubuntu (the windows xp in virtual box is referred to as "guest").
The best instructions that worked actually were in the VirtualBox help files.
I added another network adapter to my virtual XP and made that one HIF:
Run ipconfig in virtual XP to find the IP and that's the IP I used in ColdFusion admin to connect.
Remember to enable TCP/IP in SQL for connection:
Start-Programs-MS SQL Server 2005-Configuration Tools - SQL Server Configuration Manager - SQL 2005 Network Configuration - Protocols for MSSQLSERVER
Now I might need to make the IP permanent somehow, but I am very pleased that it works the way it is so far
Saturday, August 16, 2008
ColdFusion development on Ubuntu 8.04
In an effort to have our code tested on linux platform I once again embarked on a quest to setup developing platform on Ubuntu. Last time I had it all (except VPN) working but the hard drive failed.
Now with new laptop I am ready to go at it again. The laptop is Lenovo T60. Here is a list of applications:
Ubuntu 8.04 LTS Desktop edition http://www.ubuntu.com
Downloaded and burned on CD, then boot from CD and choose install Ubuntu. Chose second choice for predefined partitioning.
Eclipse http://www.eclipse.org/downloads/ Java developers edition
Download and and untar somewhere. I just created eclipse directory in home directory. Added a link to "eclipse" executable to start it up. Also eclipse required Java so I installed that through Add/Remove... application in Applications menu. I installed openJDK 6 and Java Runtime 6, not sure which is required or both.
Once Eclipse started working installed following plugins:
CFEclipse http://www.cfeclipse.org/update
subclipse http://subclipse.tigris.org/update_1.4.x
MXUnit http://mxunit.org/update
Apache web server
For apache I chose to install LAMP, the instructions are found here:http://ubuntuguide.org/wiki/Ubuntu:Hardy#Install_a_LAMP_server_on_a_Desktop
no problems here
ColdFuison 8 developers version
Download ColdFusion from here http://www.adobe.com/cfusion/tdrc/index.cfm?product=coldfusion
Pretty good instructions here: http://www.redelijkheid.com/?p=322
The start up script is not created since Ubuntu is not supported platform and in the script that creates the startup scripts it's checking for linux flavor. I added couple of custom application launchers to top bar for starting and stopping ColdFusion. ColdFUsion needs to be started under sudo (or at least it appears that way) so I chose Application in Terminal so that I can type in sudo password when needed. I am sure there is a better way but I didn't want ColdFusion started on start up, and I wanted to be able to restart easily.
Spark IM client
http://www.igniterealtime.org/downloads/index.jsp
This is a IM that we use at work. Like eclipse I just untar into folder and made application launcher to Spark executable.
VPN client or module or something
This was very simple and so far seems to be working fine. Installed VPN Connection Manager through Add/Remove... menu and VPN Connections option appeared in the menu when network connection is clicked. Just configured connection to our work VPN and so far seems to be working. I was able to get to internal websites and connect to internal database.
So far everything seems to be working pretty well.
We use MSSQL 2005 so if I want it localy I am not sure what to do yet.
Now with new laptop I am ready to go at it again. The laptop is Lenovo T60. Here is a list of applications:
Ubuntu 8.04 LTS Desktop edition http://www.ubuntu.com
Downloaded and burned on CD, then boot from CD and choose install Ubuntu. Chose second choice for predefined partitioning.
Eclipse http://www.eclipse.org/downloads/ Java developers edition
Download and and untar somewhere. I just created eclipse directory in home directory. Added a link to "eclipse" executable to start it up. Also eclipse required Java so I installed that through Add/Remove... application in Applications menu. I installed openJDK 6 and Java Runtime 6, not sure which is required or both.
Once Eclipse started working installed following plugins:
CFEclipse http://www.cfeclipse.org/update
subclipse http://subclipse.tigris.org/update_1.4.x
MXUnit http://mxunit.org/update
Apache web server
For apache I chose to install LAMP, the instructions are found here:http://ubuntuguide.org/wiki/Ubuntu:Hardy#Install_a_LAMP_server_on_a_Desktop
no problems here
ColdFuison 8 developers version
Download ColdFusion from here http://www.adobe.com/cfusion/tdrc/index.cfm?product=coldfusion
Pretty good instructions here: http://www.redelijkheid.com/?p=322
The start up script is not created since Ubuntu is not supported platform and in the script that creates the startup scripts it's checking for linux flavor. I added couple of custom application launchers to top bar for starting and stopping ColdFusion. ColdFUsion needs to be started under sudo (or at least it appears that way) so I chose Application in Terminal so that I can type in sudo password when needed. I am sure there is a better way but I didn't want ColdFusion started on start up, and I wanted to be able to restart easily.
Spark IM client
http://www.igniterealtime.org/downloads/index.jsp
This is a IM that we use at work. Like eclipse I just untar into folder and made application launcher to Spark executable.
VPN client or module or something
This was very simple and so far seems to be working fine. Installed VPN Connection Manager through Add/Remove... menu and VPN Connections option appeared in the menu when network connection is clicked. Just configured connection to our work VPN and so far seems to be working. I was able to get to internal websites and connect to internal database.
So far everything seems to be working pretty well.
We use MSSQL 2005 so if I want it localy I am not sure what to do yet.
Saturday, August 2, 2008
Strange behavior, objectid() method in component.cfc
So I was working on something OOP :-). And I am trying to use Hal Hellms BaseComponent.cfc that all CFCs that don't extend anything should extend. For the purpose of this post I reduced it to two methods:
The way I was using it is I included it into ColdFusion component.cfc that all CFCs extend by default:
So I also make test CFC and a cfm page:
When I run cfm file and expend the dump output I see following:
As you can see the objectid() method is missing.
Now I remove the include from component.cfc and make my test component extend BaseComponent
Run cfm again and get following:
Now objectid() method is seen in the dump.
The way I was using it is I included it into ColdFusion component.cfc that all CFCs extend by default:
So I also make test CFC and a cfm page:
When I run cfm file and expend the dump output I see following:
As you can see the objectid() method is missing.
Now I remove the include from component.cfc and make my test component extend BaseComponent
Run cfm again and get following:
Now objectid() method is seen in the dump.
Wednesday, July 23, 2008
Populate coldfusion bean from query
I thought of a nice way to populate coldfusion beans from a query. It might be obvious, but we have code all over in our mach-ii application that explicitly calls setters on a bean after query. So following method got added to BaseComponent.cfc (thanks Hal Helms). It's not checking anything so the burden is on query to have the right data.
If you use generic setter the line:
can be replaced with:
So this allows me to do something like this:
If you use generic setter the line:
can be replaced with:
So this allows me to do something like this:
Saturday, July 19, 2008
Object collection class with iterator
So I added an iterator to my collection cfc. Several people blogged about using java iterator for coldfusion arrays and looks like Transfer uses those.
Here is an iterator method:
I also changed getBy() and removeBy() to use iterator:
Also have to plug MXUnit. Using it made refactoring like that above, much more enjoyable.
Here is an iterator method:
I also changed getBy() and removeBy() to use iterator:
Also have to plug MXUnit. Using it made refactoring like that above, much more enjoyable.
Friday, July 18, 2008
Object collection class
This is collection cfc that's largely based on one I found here.
I added couple of methods, getBy and removeBy that I think will be helpful for working with collection of objects. Each takes a property and a value of that property as arguments, then we try to match those to one of the objects in the collection.
Now I need an Iterator for this.
I added couple of methods, getBy and removeBy that I think will be helpful for working with collection of objects. Each takes a property and a value of that property as arguments, then we try to match those to one of the objects in the collection.
Now I need an Iterator for this.
Wednesday, July 16, 2008
Replacing notepad with notepad++
I discovered notepad++ and wanted to replace windows notepad with it. The instructions are here in the middle of the page under heading "Notepad Replacement". Well it turned out it's not that easy to delete notepad.exe. It kept on reappearing. So I found instructions here and it helped, I am reproducing instructions in case they disappear.
Create backup copy of c:\WINDOWS\notepad.exe
Change Explorer view options to show system files
In temporary folder: Have your new notepad.exe file ready
Copy the exe file into the clipboard ( select the file and hit Ctrl-C )
Open folder C:\WINDOWS\ServicePackFiles\i386 in Explorer
Ctrl-V
Open folder C:\WINDOWS\system32\dllcache in Explorer
Ctrl-V, Backspace
Ctrl-V, Backspace
Ctrl-V, Backspace
*Just for your information Ctrl-V pastes the new notepad and Backspace moves you up a directory. By doing this as outlined above you replace all of the default Windows notepad.exe files. Make sure you copy the notepad.exe that you want to use first by selecting that file and hitting Ctrl-C
Also one other note, for the first step where I said to replace notepad here:
C:\WINDOWS\ServicePackFiles\i386
on some computers it might actually be: C:\WINDOWS\i386 and notepad will have the name like: notepad.ex_ -- Simply copy the notepad.exe over the notepad.ex_ and make sure you keep that same file name with the underscore (or whatever symbol its using)
Create backup copy of c:\WINDOWS\notepad.exe
Change Explorer view options to show system files
In temporary folder: Have your new notepad.exe file ready
Copy the exe file into the clipboard ( select the file and hit Ctrl-C )
Open folder C:\WINDOWS\ServicePackFiles\i386 in Explorer
Ctrl-V
Open folder C:\WINDOWS\system32\dllcache in Explorer
Ctrl-V, Backspace
Ctrl-V, Backspace
Ctrl-V, Backspace
*Just for your information Ctrl-V pastes the new notepad and Backspace moves you up a directory. By doing this as outlined above you replace all of the default Windows notepad.exe files. Make sure you copy the notepad.exe that you want to use first by selecting that file and hitting Ctrl-C
Also one other note, for the first step where I said to replace notepad here:
C:\WINDOWS\ServicePackFiles\i386
on some computers it might actually be: C:\WINDOWS\i386 and notepad will have the name like: notepad.ex_ -- Simply copy the notepad.exe over the notepad.ex_ and make sure you keep that same file name with the underscore (or whatever symbol its using)
Tuesday, July 15, 2008
Mach-ii sub-application - part 2
To demonstrate sub-application setup I am going to use example application from mach-ii site called ContactManager. If you are going to follow along then download it and unzip into ContactManager folder under your webroot. After that you should be able to browse to it using http://[your-web-root]/contactmanager/
Next I made a folder under contactmanager called "subapp". Under that "config" folder. Also I made a subapphome.cfm file in the "views" folder to show something different in subapp. Just put any random text in that file. Look at an image of the ContactManager tree to see added elements.
Now we separate common elements into an include called mach-ii-common.xml
Those elements are removed from main applications mach-ii.xml, but we add an include before properties section
Here is sub-application mach-ii.xml
Notice the properties for SES URLs.
There is at least one issue with this setup is that links need to be relative to the web root so that they work from main app and from sub app. So in mainTemplate.cfm file I added "/contactmanager/" to all the links resource references at the top.
Here is an example, following lines
became...
As you can see I also added a link to my sub-application.
After all this you should be able to get to your subapp by going to http://[your-web-root]/contactmanager/subapp/index.cfm/event/subapphome/
Monday, July 14, 2008
Mach-ii sub-application - part 1
Sometimes it's handy to make a sub-application in mach-ii. Config file gets rather large rather quickly at times. One thing to understand is that sub-application is not a completely stand alone app. It relies on the main application. Mach-ii 1.5 introduced modules and includes so some of the issues of breaking out large chunks of configuration and code that are solved with those.
However one use case just came up where I wanted to have only part of the application to have SES URLs. So by breaking out this new part of the application into sub-application I could reuse layout and user tracking from the main one but use new SES properties (also introduced in mach-ii 1.5) in subapp. I think I could also put common properties, event-handlers, listeners, e.t.c into an include that way duplication of code will be minimal.
I am going to demonstrate this in the next post.
However one use case just came up where I wanted to have only part of the application to have SES URLs. So by breaking out this new part of the application into sub-application I could reuse layout and user tracking from the main one but use new SES properties (also introduced in mach-ii 1.5) in subapp. I think I could also put common properties, event-handlers, listeners, e.t.c into an include that way duplication of code will be minimal.
I am going to demonstrate this in the next post.
Friday, July 11, 2008
ColdFusion Code Highlighting for a blog
One thing that's keeps me amazed is that every time I need to solve something, someone somewhere already encountered that issue and most likely solved it. This is especially true for all things computer. I pretty much expect this behavior. So this proved true as I ventured to find a way to have code highlighting for my blog.
Thanks to Aaquagua!: Web Page Syntax Highlighting for ColdFusion - Brush for SyntaxHighlighter post I was able to add code highlighting. Not only he had instructions for adding SyntaxHighlighter but also added ColdFusion brush. How cool is that?
One thing I want to add though using <textarea> insted of <pre> tag worked better. When using <pre> it adds closing tags for some reason for ColdFusion tags that are not closed. Here is an example of this behavior:
<pre name="code" class="cf">
</pre>
<textarea name="code" class="cf" >
</textarea>
Turns out the above mentioned problem is dependent on a browser. IE7 seems to be fine FF2 and FF3 have an issue mentioned, and Opera blew up completely.
So use <textarea> since that seems to be working in all browsers
Thanks to Aaquagua!: Web Page Syntax Highlighting for ColdFusion - Brush for SyntaxHighlighter post I was able to add code highlighting. Not only he had instructions for adding SyntaxHighlighter but also added ColdFusion brush. How cool is that?
One thing I want to add though using <textarea> insted of <pre> tag worked better. When using <pre> it adds closing tags for some reason for ColdFusion tags that are not closed. Here is an example of this behavior:
<pre name="code" class="cf">
// comments
var bar = 1;
return foo+bar;
</pre>
<textarea name="code" class="cf" >
</textarea>
Turns out the above mentioned problem is dependent on a browser. IE7 seems to be fine FF2 and FF3 have an issue mentioned, and Opera blew up completely.
So use <textarea> since that seems to be working in all browsers
Thursday, July 10, 2008
Custom domain for my blog
I registered a domain for my blog, actually two: ifedotov.com and iheartcf.com (second one is way too fruitty). The domains were registered and parked at goDaddy.com. GoDaddy.com makes it very easy to have your parked domain pointed to blogger.
Also it's a free feature on blogger. WordPress for example charges $10 a year to have your personal custom domain to point to your blog.
I wonder why Blogger doesn't have categories for posts? They have labels so it's probably almost the same and keeps with the google theme.
I think Blogger might be temporary solution. I would like to use some ColdFusion based blogs, maybe machblog or Mango blog.
Also it's a free feature on blogger. WordPress for example charges $10 a year to have your personal custom domain to point to your blog.
I wonder why Blogger doesn't have categories for posts? They have labels so it's probably almost the same and keeps with the google theme.
I think Blogger might be temporary solution. I would like to use some ColdFusion based blogs, maybe machblog or Mango blog.
Preamble
After avoiding blogging scene for years I finally decided to give it a try.
The most important reason is to remember my own findings. Right now I am working as ColdFusion Developer / Architect and there is slew of new things that are being researched, reviewed and implemented. So this is a way to keep track of my findings and thoughts.
Also I do find other peoples blogs helpful occasionally so perhaps this will be a way to give back to the community.
The most important reason is to remember my own findings. Right now I am working as ColdFusion Developer / Architect and there is slew of new things that are being researched, reviewed and implemented. So this is a way to keep track of my findings and thoughts.
Also I do find other peoples blogs helpful occasionally so perhaps this will be a way to give back to the community.
Subscribe to:
Posts (Atom)