This post is to try clear up any confusion on yesterdays post. The issue was a little confusing and that is probably due to the fact the the example came from some code that was not normal. Ie the code did work as expected it's just not something someone would normally do so it lead to some confusion.
Thanks to Glen who constantly came back with what was really going on I see what I originally thought might have been an error with CF9 was actually functioning as expected.
Here is the demo running: http://cf9.kukiel.net/demos/local/demo4.cfm
All the scopes function the same way as intended.
Anything inside a method that is var scoped will go into the local scope.
local is a scope and will always exist within a method so in CF9 you don't need to define it as its already there.
Here is another sample block of code:
Dec 31, 2009
Dec 30, 2009
Is this an issue with the local scope in ColdFusion 9?
Consider the following:
Demo1:
Run it.
Demo2:
Run it.
With ColdFusion 9 local is supposed to be private to the method. In Demo 2 the code behaves as expected but in Demo 1 the local in the variables scope is over written.
I consider this a bug with the local scope but I'd like some feed back.
BTW how did I find this? A friend on mine had code similar to the example and was wondering why local went blank half way through a page. I tracked it back to a UDF that had:
cfset local = {}
OK so calling a variable in a .cfm local not all the common but it could ( and did ) happen.
Thoughts?
Demo1:
Run it.
Demo2:
Run it.
With ColdFusion 9 local is supposed to be private to the method. In Demo 2 the code behaves as expected but in Demo 1 the local in the variables scope is over written.
I consider this a bug with the local scope but I'd like some feed back.
BTW how did I find this? A friend on mine had code similar to the example and was wondering why local went blank half way through a page. I tracked it back to a UDF that had:
cfset local = {}
OK so calling a variable in a .cfm local not all the common but it could ( and did ) happen.
Thoughts?
Dec 29, 2009
Are you using ColdFusion 9's ORM?
I have been playing with the ORM in ColdFusion 9 since the beta's I think its a really nice feature and helps make coding fun. Recently I have not had the chance to work with CF9 so I'm not massively involved in how to solve all the issues going from traditional SQL to and ORM model but in the past few days I have been helping out a friend with a ColdFusion project and I suggested he use ORM rather then creating tables and building all the SQL himself. Being unfamiliar with what an ORM does I did my best to explain it and this is where I think understanding OO can help alot as he got the concept in less then 5 mins and was coding from examples in about 10 mins ( all in script BTW ).
With a few examples and a bit of light discussion the project began and rather then creating tables and writing SQL he wrote some CFC's and used the ORM in CF9 to do alot of the boring stuff. Now this isn't a massive project and the actual functionality is a small admin section to a site but it goes to show that ORM can save time and is a viable option even for small projects.
I'm not sure if ORM is available in shared hosting? In this instance it doesn't matter as there was a full server to use. So far so good and really the only issues we have is sometimes we need to restart CF to pick up application changes as some times applicationStop() just didn't seem to work 100% ( but not reproducible consistently so probably something we did ).
So are you using the ORM on big or small applications? And has anyone had experiecne with ORM in shared hosting?
With a few examples and a bit of light discussion the project began and rather then creating tables and writing SQL he wrote some CFC's and used the ORM in CF9 to do alot of the boring stuff. Now this isn't a massive project and the actual functionality is a small admin section to a site but it goes to show that ORM can save time and is a viable option even for small projects.
I'm not sure if ORM is available in shared hosting? In this instance it doesn't matter as there was a full server to use. So far so good and really the only issues we have is sometimes we need to restart CF to pick up application changes as some times applicationStop() just didn't seem to work 100% ( but not reproducible consistently so probably something we did ).
So are you using the ORM on big or small applications? And has anyone had experiecne with ORM in shared hosting?
Dec 22, 2009
Want more performance from a default Railo install?
The default Railo install allocated only 256mb of ram to the jee server ( resin ). This is great for smaller projects and lower ends VPS installs but for larger apps that perhaps make use of alot of objects or framworks it can cause some slowness. ColdFusion 8/9 default to 512 so I'll show you how to up the memory to 512.
This is for Windows but its the same for linux/OSX
Find the resin.conf file:
C:\Railo\conf\resin.conf
Find this section:
- The JVM arguments
Change this:
-Xmx256m
to:
-Xmx512m
Restart the Railo service.
Log into the Web Admin and confirm and now watch your CFML application fly.
This is for Windows but its the same for linux/OSX
Find the resin.conf file:
C:\Railo\conf\resin.conf
Find this section:
- The JVM arguments
Change this:
to:
Restart the Railo service.
Log into the Web Admin and confirm and now watch your CFML application fly.
Dec 21, 2009
WizzyWig the comic and snow
My posts are generally very on topic but today they are slightly off topic. I don't read alot of comics but there is on in particular that I think is really great and I like to support independent artists. Ed Piskor is the artist and author and the comic is loosely based on Kevin Mitnik
It also snowed quite a bit over the weekend and I saw this while having a coffee on Saturday:
It also snowed quite a bit over the weekend and I saw this while having a coffee on Saturday:
Dec 20, 2009
Linux Start and Stop scripts for Ventrilo - Ubuntu and Debian
My cousin wanted to have his own Ventrilo server so I set it up for him on a old PC running Ubuntu 9.04. He didn't want to have to start or stop the server just wanted to be able to leave the machine on all the time and if it did happen to be turned off wanted it to start automatically.
Here is the process:
Create a new user on your system to run the process as. I called the user ventrilo.
Create a new script in init.d
vi /etc/init.d/vent
Add the following:
#!/bin/sh
# ventrilo server
case "$1" in
'start')
# Startup ventrilo servers.
VENPATH=/home/ventsrv
VENBIN=$VENPATH/ventrilo_srv
su ventrilo -c "$VENBIN -f$VENPATH/ventrilo_srv -d"
renice -5 `cat $VENPATH/ventrilo_srv.pid` ;;
'stop')
killall ventrilo_srv
;;
*)
echo "Usage: $0 { start | stop }"
;;
esac
exit 0
Make sure you set the path correctly ie:
VENPATH=/home/ventsrv
Make the new script executable.
chmod +x /etc/init.d/vent
Run:
update-rc.d vent defaults
And reboot the server to confirm ventrilo starts on boot.
You can now stop and start your ventrilo server like so:
Start:
/etc/init.d/vent start
Stop:
/etc/init.d/vent stop
Here is the process:
Create a new user on your system to run the process as. I called the user ventrilo.
Create a new script in init.d
vi /etc/init.d/vent
Add the following:
#!/bin/sh
# ventrilo server
case "$1" in
'start')
# Startup ventrilo servers.
VENPATH=/home/ventsrv
VENBIN=$VENPATH/ventrilo_srv
su ventrilo -c "$VENBIN -f$VENPATH/ventrilo_srv -d"
renice -5 `cat $VENPATH/ventrilo_srv.pid` ;;
'stop')
killall ventrilo_srv
;;
*)
echo "Usage: $0 { start | stop }"
;;
esac
exit 0
Make sure you set the path correctly ie:
VENPATH=/home/ventsrv
Make the new script executable.
chmod +x /etc/init.d/vent
Run:
update-rc.d vent defaults
And reboot the server to confirm ventrilo starts on boot.
You can now stop and start your ventrilo server like so:
Start:
/etc/init.d/vent start
Stop:
/etc/init.d/vent stop
Dec 18, 2009
ColdFusion Builder Beta 3 - Any one seen this?
So I un-installed CFBuilder Beta 1 ( as the plug in ) and installed Beta 3. The install went well except for this happening each time I click on a .cfm or .cfc I get this error. Anyone know how to solve it?
Dec 16, 2009
Streaming AMF channel with ColdFusion 9 and BlazeDS
Since ColdFusion 9 comes with BlazeDS intergrated and Adobe removed the express version of LCDS I was no longer able to PUSH data over RTMP as I could with CF8. It's easy enough to work around by using long polling ( or normal polling ) but it's not quite as fast. There are options for streaming AMF which should be able to replicate that LCDS express feature I was using for my simple "Chat to me" app. However no matter how hard I tried I could not get this workign till Joan Fernandes confirmed my suspicion this was a bug.
Well I'm happy to report that this morning I got an update on the bug and its been fixed for 9.01 update of ColdFusion 9.
Here is the bug:
http://cfbugs.adobe.com/cfbugreport/flexbugui/cfbugtracker/main.html#bugId=80083
Here is the Chat demo I am refering to: http://cf9.kukiel.net/Chat/
Well I'm happy to report that this morning I got an update on the bug and its been fixed for 9.01 update of ColdFusion 9.
Here is the bug:
http://cfbugs.adobe.com/cfbugreport/flexbugui/cfbugtracker/main.html#bugId=80083
Here is the Chat demo I am refering to: http://cf9.kukiel.net/Chat/
Forwarding or masking your domain with GoDaddy
This is basically for my own future reference note the IP address is important and needs to be used for the @ A record.
http://help.godaddy.com/article/422?prog_id=GoDaddy
To Forward or Mask Your Domain
- Log in to your Account Manager.
- In the My Products section, click Domain Manager.
- Select the domains to modify.
- Click Forward, and then select Forward Domain.
- Select http:// or https:// depending on your server settings. For more information, see HTTP vs. HTTPS.
- In the Forward to field, enter the URL to which you want your domain to forward.
- To automatically update your nameservers to accommodate your forwarding changes, select Update my DNS setting to support this change.
- To view additional options, including masking, click the Advanced Options hyperlink.
- Select one of the following:
- Forward Only
- Specifies the length of time for this forwarding setting. Select one of the following Redirect types:
- I am permanently forwarding my domain — Redirects to the site you specified in the Forward To field using a "301 Moved Permanently" HTTP response. The HTTP 301 response code tells user-agents (including search engines) that the location has permanently moved.
- I am only temporarily forwarding my domain — Redirects to the site you specified in the Forward To field using a "302 Found" HTTP response. The HTTP 302 response code tells user-agents (including search engines) that the location has temporarily moved.
- Forward with Masking
- Prevents the forwarded domain URL from displaying in the browser's address bar, and lets you specify Meta Tags for search engine crawlers by completing the following fields:
- Title — Displays at the top of the browser window and in search results.
- Description — A short description of your website to display in search engine results.
- Keyword — A list of comma-separated keywords that describes the content and purpose of your website.
- Click OK.
http://help.godaddy.com/article/422?prog_id=GoDaddy
Dec 15, 2009
Cheap ColdFusion hosting
Just throwing out a question. Where are you hosting your ColdFusion sites? I only have one shared hosting account that I use at Hosting A to Z It's OK and it's really cheap ( $30 a year or so ). I know that every now and then they must clear the application scope ( probably due to someone using a ton of memory ) but other then that it's pretty fast once the application is running.
I also have a few VPS's in which I have my own CF server and Railo server and most of my work is on company owned machines but now and then I have someone asking for recommendations for shared hosting and I'd like to hear some feed back on people experience and who they recommend. I have heard horror stories of managed servers running slower then shared hosting and support turnover time > 48 hours ( one of my dirt cheap VPS's has ~36 support turn around time lucky it has a decent control panel and runs linux so nothign much goes wrong ).
So whats out there that you recommend? ( CF8 and higher only )
I also have a few VPS's in which I have my own CF server and Railo server and most of my work is on company owned machines but now and then I have someone asking for recommendations for shared hosting and I'd like to hear some feed back on people experience and who they recommend. I have heard horror stories of managed servers running slower then shared hosting and support turnover time > 48 hours ( one of my dirt cheap VPS's has ~36 support turn around time lucky it has a decent control panel and runs linux so nothign much goes wrong ).
So whats out there that you recommend? ( CF8 and higher only )
Dec 9, 2009
Should I get an iPhone?
For the last year I have been using a BlackBerry. It's a great device. The most important feature is constant access to my email and how seamlessly this works. Yes I use other apps ( Twitter, the camera, skype ) but not as much as email.
As I am moving back to Australia soon I'm almost convinced the iPhone is my to be my next phone. Apple now let you type with the phone longways that's a great addition and for the others int he company that are using iPhones Outlook and ActiveSync work very seamlessly. I also like the ability to tether the iPhone to my laptop and use it as a modem. At the same time I'm concerned about bandwidth usage. Bandwidth is very expensive in Australia so I'm wondering how much data people are using in a month in basic use ( email and some net surfing ).
I have 2 email accounts that I use regularly my work account ( ms exchange) and my personal account ( gmail ). I'm pretty sure I can run both without them interfering on the iPhone at the same time ( correct me if I am wrong ).
The games and apps are also fun from the use I have had so far but I'm still deciding between a BlackBerry and iPhone ( or shoudl I look at the new Nokia n900 ).
What are your thoughts? And what are your annoyances with the iPhone or your current handset.
As I am moving back to Australia soon I'm almost convinced the iPhone is my to be my next phone. Apple now let you type with the phone longways that's a great addition and for the others int he company that are using iPhones Outlook and ActiveSync work very seamlessly. I also like the ability to tether the iPhone to my laptop and use it as a modem. At the same time I'm concerned about bandwidth usage. Bandwidth is very expensive in Australia so I'm wondering how much data people are using in a month in basic use ( email and some net surfing ).
I have 2 email accounts that I use regularly my work account ( ms exchange) and my personal account ( gmail ). I'm pretty sure I can run both without them interfering on the iPhone at the same time ( correct me if I am wrong ).
The games and apps are also fun from the use I have had so far but I'm still deciding between a BlackBerry and iPhone ( or shoudl I look at the new Nokia n900 ).
What are your thoughts? And what are your annoyances with the iPhone or your current handset.
Dec 6, 2009
Full Screen Flex
Since flash 9 there has been the ability to make a full screen flash application. This is also available in Flex.
Here is a tiny demo of jumping between normal screen size and full screen. Be aware that pressing the Escape key will return you to normal screen mode as well and explicitly changing back.
Source: http://demo.kukiel.net/fullScreen/srcview/index.html
The picture was just a random picture inserted so Full Screen wasn't so boring but in case your interested comes from here. http://www.edpiskor.com/
Here is a tiny demo of jumping between normal screen size and full screen. Be aware that pressing the Escape key will return you to normal screen mode as well and explicitly changing back.
Source: http://demo.kukiel.net/fullScreen/srcview/index.html
The picture was just a random picture inserted so Full Screen wasn't so boring but in case your interested comes from here. http://www.edpiskor.com/
Dec 4, 2009
Googe Fade Demo
What is this google fade you've been hearing about?
Look here:
Or here ( higher quality ):
http://vc.kukiel.net/GoogeFade
Look here:
Or here ( higher quality ):
http://vc.kukiel.net/GoogeFade
Dec 3, 2009
Google now providing public DNS
These days Google is pretty much everywhere. Personally I have multiple domains hosted with googles apps for email, my main email address is @gmail, my blog is hosted by google ( blogger ), I just purchased 20 gig of storage for $5 per year not to mention the simple fact that when I search I use google. Now they are introducing their own DNS servers.
http://googleblog.blogspot.com/2009/12/introducing-google-public-dns.html
As a quick reference in case your not sure what DNS is put simple it's the phone book for domain names. When you type in your browser www.learncf.com for example, your actaully sending a request to a DNS server to translate the words into numbers ( IP adddress ) then then you get the website data.
How do we feel about google doing this translation for us? How much trust do we put into google. The reality is that if so inclined by using googles DNS servers they ( google ) could constantly redirect bing.com to one of googles own servers. That's not to mention that now every single site you visit regardless of you being signed in to google or using a search engine can be logged.
There is also the other side. We trust so much with google why not let them provide this service. It's likely to always be up and fast being that they have so many datacenters.
At this point in time I'll stick with my ISP's DNS but I guess more options are good thing.
http://googleblog.blogspot.com/2009/12/introducing-google-public-dns.html
As a quick reference in case your not sure what DNS is put simple it's the phone book for domain names. When you type in your browser www.learncf.com for example, your actaully sending a request to a DNS server to translate the words into numbers ( IP adddress ) then then you get the website data.
How do we feel about google doing this translation for us? How much trust do we put into google. The reality is that if so inclined by using googles DNS servers they ( google ) could constantly redirect bing.com to one of googles own servers. That's not to mention that now every single site you visit regardless of you being signed in to google or using a search engine can be logged.
There is also the other side. We trust so much with google why not let them provide this service. It's likely to always be up and fast being that they have so many datacenters.
At this point in time I'll stick with my ISP's DNS but I guess more options are good thing.
Cumulative Hot Fix 4 for ColdFusion 8.0.1
Cumulative Hot Fix 4 for ColdFusion 8.0.1 is now out.
http://kb2.adobe.com/cps/529/cpsid_52915.html
Looks like there are some security fixes so this is worth applying. As always apply to a test/dev server first.
http://kb2.adobe.com/cps/529/cpsid_52915.html
Looks like there are some security fixes so this is worth applying. As always apply to a test/dev server first.
Dec 2, 2009
Cheap bundled Apple Mac software
I don't you my Mac that often as it's a bit old and slow but when I do I find that most of the software I need is on my PC. While searching for cheap software and asking around I came across Mac Friendly.
The past bundle was a great deal but it wasn't what I needed but the next bundle is coming up soon so I thought I would share.
http://www.macfriendly.org
The past bundle was a great deal but it wasn't what I needed but the next bundle is coming up soon so I thought I would share.
http://www.macfriendly.org
Dec 1, 2009
Reading and writing binary to a mySQL database with ColdFusion
Ever wanted to save an image to a database with ColdFusion? I see this question asked quite often. I don't have a need to do this but I mocked up a quick demo or reading and writing binary data to and from a mySQL database.
The code is very simple. I read the binary data from a image. Write it to a database, read it back out and write it to the browser. I also rotate the image to show the result from the database acts just like any other image data.
You might note I made use of 2 great new features of ColdFusion 9.
1. Data source specific to the application. I no longer need to specify a datasource in my cfquery tags as I have this setup in Application.cfc.
2. On insert ColdFusion can return the autoincrement id value of the record just inserted. Eg in SQL server select @@identity does the same thing. This was available in CF8 but it was lacking and was different depending on the database type.
In ColdFusion 9 the old values still work ( so code wont break ) but we also can now use queryResult.generatedKey.
I always try include a working demo: http://railo.kukiel.net/imageinsert/
Here is the CF Code:
Here is a sample to create the mySQL table:
Also note as this gets alot of people that by default CFadmin only allows 64k to be passed from CF to the database. You will probably need to increase this value. For this example I just added 2 extra 0's ( 6.4meg ). If you don't half the image will be inserted and you will be confused as to what the image ( or other binary files ) are corrupted.
The code is very simple. I read the binary data from a image. Write it to a database, read it back out and write it to the browser. I also rotate the image to show the result from the database acts just like any other image data.
You might note I made use of 2 great new features of ColdFusion 9.
1. Data source specific to the application. I no longer need to specify a datasource in my cfquery tags as I have this setup in Application.cfc.
2. On insert ColdFusion can return the autoincrement id value of the record just inserted. Eg in SQL server select @@identity does the same thing. This was available in CF8 but it was lacking and was different depending on the database type.
In ColdFusion 9 the old values still work ( so code wont break ) but we also can now use queryResult.generatedKey.
I always try include a working demo: http://railo.kukiel.net/imageinsert/
Here is the CF Code:
Here is a sample to create the mySQL table:
Also note as this gets alot of people that by default CFadmin only allows 64k to be passed from CF to the database. You will probably need to increase this value. For this example I just added 2 extra 0's ( 6.4meg ). If you don't half the image will be inserted and you will be confused as to what the image ( or other binary files ) are corrupted.
Subscribe to:
Posts (Atom)



