Monday, October 26, 2009

Using IIF with ColdFusion Report Builder

I was trying to do some conditional logic in coldfusion report builder and having some problems. Evidently the problem was with my misunderstanding of IIF. I was trying the following:

IIF (len(myvar), myVar, myVar2)

The way IIF works is that it expects strings, indicating variables, which to me is counterintuitive. But the solution that worked was:

IIF (len(myvar), 'myVar', 'MyVar2')

This evaluated to the correct values of those variables and works great.
Inserting a Line Break in ColdFusion Report Builder

I had a field that I wanted to insert a line break. This field needed to be dynamic in it's sizing and it is very possible that it will have to wrap. So It was not an option to just place another field box or textbox below the current one, because if it wrapped and expanded, then the text would flow over the box below.

So I needed a way to force a line break inside the expression builder.

Turns out I just needed to insert a "Chr(10)". More detail: query.fieldname & Chr(10) & ' more text here if you want'

That worked great and now the size of the text in query.fieldname doesn't matter. If it wraps everything is just pushed down, as I wanted.

Wednesday, October 21, 2009

Screen Capture and Screen Recording Free Software

Ray Camden posted to his blog using a demo he recorded using the following software to record his screen: http://www.jingproject.com/.

Recording is capped at 5 minutes in both the free and pro version. The pro version is only $14.95 per year. Since it is capped it won't work for long demos. But for short instruction clips or demos of individual items it looks like a great tool, and such a good price.
Displaying the Copyright Symbol &copy in Coldfusion Report Builder

I wanted to display the copyright symbol in coldfusion report builder. We put that at the bottom of each page in our report to state our copyright protection of our content. This took me a while to find, but it is simple. I created a query field and added the following to that field:

chr(169) & ' Copyright 2009 Companyname'

The chr(169) was the trick.

Tuesday, September 08, 2009

mySql server won't start after upgradge to mac osx 10.6 Snow Leopard

After upgrading to Snow Leopard the mySQL server would not start. I found the solution here:

http://www.macintouch.com/readerreports/snowleopard/topic4883.html. You have to search down the page to find the solution, search for Ralph Martin or mySql.

The upgrade to Snow Leopard seems to have broke the symbolic link.


Ralph Martin

I too found that MySQL wouldn't start after upgrading to Snow Leopard.

The answer seems straightforward. Previously there was a symbolic link from
/usr/local/mysql
to
/usr/local/mysql-5.1.37-osx10.5-x86_64
and this seems to have been deleted by the upgrade process.

I got MySQL working again by doing

cd /usr/local
sudo ln -s mysql-5.1.37-osx10.5-x86_64 mysql

(note that you may have to modify this slightly if your MySQL is a different version).


Sunday, August 02, 2009

Show hidden files in finder

There are many times when I want to see hidden files and folders when using my mac. When making changes to the Apache config is one of those times. So how do I make it so I can easily see those files? I found talk of this on this page:

http://www.macworld.com/article/51830/2006/07/showallfinder.html


Which has a link in one of the comments to this nifty little program:

http://gotoes.org/sales/ShowHiddenFilesMacOSX/

I installed this and it makes it easy toggle on and off the ability to see hidden files and folders.

Monday, July 20, 2009

Fixing the IE 8 warning - ‘Do you want to view only the webpage content that was delivered securely?’

Ever since upgrading to IE8 this warning has been driving me crazy. It pops up on almost every page I visit. I found a great article on how to disable it and program for it.

http://blog.httpwatch.com/2009/04/23/fixing-the-ie-8-warning-do-you-want-to-view-only-the-webpage-content-that-was-delivered-securely/

Thursday, April 23, 2009

Returning SQL and other query metadata

I wanted to return the sql from a query that I was running to find out why no records were returned. Found information here about query metadata that not only returns the sql run at the server, but tells you about returning the parameters too.

qryTest.getMetaData().getExtendedMetaData().sql

qryTest.getMetaData().getExtendedMetaData().sqlparameters

Monday, April 20, 2009

_f is undefined

I was getting the above error in my firebug output. It was coming from an included template that I use elsewhere on the website and I couldn't figure it out. Turns out that the page from where the cfwindow is called had a form without a name and id on it. Once I gave the cfform a name and id the problem went away and it works now.

Monday, April 13, 2009

javascript function not found and cutting corners on code

I got hungup for several hours this afternoon on a couple of stupid issues. The first, I was getting a memory leak error and my browser was freezing up so that sometimes I had to restart. Turns out I did something I do alot in coldfusion, I included the end tag of a javascript tag in the emain tag like this:




I don't know why this is but I am sure there is an easy explanation that should make sense to me, but It didn't.

The other thing that took alot longer to figure out was a cfwindow that wasn't findinng the above attached .js file. I played around with the path and all sorts of stuff and couldn't figure out why it wasn't working. Because that script tag above has to be on the parent page that calls the cfwindow, not on the page that comes up inside the cfwindow.

Thursday, April 09, 2009

ModelGlue, Flash movie not loaded.

I am moving a site over to a MG3 site. I moved a flash movie that we have and it wasn't working. When I clicked on the movie (which I couldn't even tell where it was) I got the message "movie not loaded".

After searching the ModelGlue archives there were a few messages and they did give the answer even though it wasn't directly obvious, to me, at least. I was able to navigate directly to the html page that loaded the file, but via modelglue it didn't work.

Had to use absolute paths for all path statements, including where the file only was listed. All necessary files are in the same directory as the .swf movie, but I had to add the path to each of those, and I wasn't able to use a variable set at the top of the page either.

Example: views/page/map/myfile.swf where before it worked with just myfile.swf.

Friday, April 03, 2009

SQL Server Date Formats

As part of my last post I needed to spit out the date in the right format because I was using a javascript output that I couldn't use coldfusion to format. So I needed to use coldfusion and found a great reference for formatting dates natively in SqlServer:

http://www.sql-server-helper.com/tips/date-formats.aspx
SQL query join that returns only a max value in the joined table.

I have a somewhat complicated query. This query includes 4 or 5 tables. In my app, changes to the company table are logged to a company history table. I simply record the time of the update and that it was an update. When the record is created an entry is made recording the date and the type of "create.

Anyway, some records have been updated several times and I am returning search results. The user asked to have those results returned with the last updated date, which means I needed to join to that history table and return only the max(date) from records linked to the corresponding company.

The answer was to use a derived query and I found a great example here: http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=102255

Monday, March 23, 2009

CFDIV CFFORM and Asynchronous submitting

When you submit a form inside a cfdiv it submits without refreshing the whole page, only the cfdiv. This was working great unless I hit submit a second time while but you can use ColdFusion.navigate to fix this.

onclick="ColdFusion.navigate('#event.linkto('admin.countyupdate')#','countydiv','mycallBack','myerrorHandler','POST','countyform')"

Putting this in the onclick event of the cfform button fixed the issue. I had a hard time for a while because I didn't need the mycallback and myerrorhandler arguments, but putting empty quotes worked. I know, I should probably define them.

Friday, March 20, 2009

coldfusion is not defined

I finally got my development environment setup and navigated to my local site and I got "ColdFusion is not defined" error. This had to do with being able to find the CFIDE directory for the coldfusion scripts. I had a cfmapping, but that,k I guess is not enough, I had to create a virtual directory pointing to the CFIDE directory in my IIS settings.

Got the idea from this blog entry:

http://www.mattwoodward.com/blog/index.cfm?event=showEntry&entryId=607BAA40-E199-27C4-02F5BE29E69C4318
ColdFusion 8 And SQL Server 2005

I had a problem setting up a datasource for coldfusion using cf8 and sql server 2005. I read several articles:

ColdFusion And SQL Server 2005
ColdFusion + SQL Server Express 2005

It wasn't working until I went to services and started the "SQL Server Browser" service which had been disabled. Don't know why. But once I started that it worked.

Not sure which of the fixes from the article helped also, but there you go.
Installing coldfusion 8 on vista using IIS

I am trying to install coldfusion 8 on my new dell laptop and it isn't working at all. It installs with no errors, but doesn't work. I can't choose a web server and even using the web server configuration tool says there is no webserver found. But the webserver does work. The fix?

http://dale.fraser.id.au/2008/05/coldfusion-8-vista-sp1-solution.html

I think the part that really fixed it was the comment about modifying the hosts file:

Fix: The c:\windows\system32\drivers\etc\hosts file has a bizarre entry:

::1 localhost

Comment it out using notepad run as administrator like so.

#::1 localhost
127.0.0.1 localhost

I added the 127 part on my own, but this did work. Might have been the combination of changing the iis options and modifying the hosts file, but it worked. I am up and running now.

Thursday, March 12, 2009

DTSWizard.exe and Business Intelligence Development Studio

I have always hated the fact that it was so difficult to do a simple import into sql server with the new version 2005 stuff, like the management express studio. A year or so ago I spent time looking all over for dtswizard.exe and since I just got a new computer from dell I was doing the same thing. It started because I simply wanted to move some data over from excell to a 2005 sql server database.

This use to be a piece of cake in SQL 2000. You just right click on the database and choose import. No idea why microsoft would turn this into such a nightmare.

After spending the last 2 1/2 hours on this I finally find out, I think, that Business Intelligence Development Studio is where this functionality lies. Couldn't figure out how to find that. Normal install doesn't always do it. Found this forum here: http://social.msdn.microsoft.com/Forums/en-US/tfsreporting/thread/eac00857-a7af-4075-aa31-e52335c59304/

The post by a.netAvoider is what worked for me:

Thanks guys,I got away with only uninstalling Workstation components. This way you won't lose your database settings and save yourself a whole lot of installation time.To do this I opened Add/Remove programs from Control Panel, selected SQL Server 2005 Express, clicked on uninstall, and in the uninstall dialogue box which appears next unticked SQL Server 2005 instance and selected Work Station components in the list below.The I installed BIZ DEV using SQL Express Toolkit installation file. I just downloaded it now ( 17/12/2007 ). You'd hope microsoft would have fixed this issue in 5 months.

Sunday, February 08, 2009

Model-Glue 3 (Gesture)

I can't believe I am so late to the party on this, but Model-Glue 3 has been out in Alpha for 8 or 9 months now and it has some really cool features. Features that are simply amazing and will surely save lots of people lots of time. Over the weekend I stumbled across a you tube video demo (Scroll down the page to theMG3 Feature Sneak: Event Generation Video) by Joe Rinehart. Really, the thing that I wanted to try out so bad was the auto-generated code. You have to be in development mode, but you type an event into the url and if it doesn't exist MG3 creates all the best practice code that you need to make that event work. It makes an entry in the modelglue.xml, controller and view files. It even creates the controller if it needs it. Very Cool. I also so a quick touch on SES url's in that video which was interesting. This is something I have needed for quite some time.

Ray Camden has a great blog post on these many features, I think he wrote it while siting in a presentation about this, so it isn't exhaustive but it gives you a great launching pad to find out more. His blog post is here http://www.coldfusionjedi.com/index.cfm/2008/5/2/ModelGlue-3--The-New-Frakin-Awesomeness.

One of the responses on that page shows exactly how to get SES url's working:






Forbidden You don't have permission to access / on this server

I have been using this mac more and more. In fact, I hooked up to the monitor,keyboard and mouse, that were attached to the docking station for my dell laptop (Which isn't working right now) and used the mac all day on friday. No problems other than the keyboard quirks that still drive me nuts.

Anyway, over the weekend I saw a demo by Joe Rinehart on the new Moldel-Glue 3 (gesture) that has been out for some time in alpha release. I really wanted try a couple of the features, so I continued something I had briefly tried a while ago, and that is setting up virtual hosts on my mac to point different urls to different directories on the computer. I found alot of information on that and made what I thought were the correct changes as indicated in the various articles. (this is a whole other blog post). But whenever I tried to pull the new site up in a browser I got the error: Forbidden You don't have permission to access / on this server. I probably spent 4 or 5 hours changed in my settings and stuff, until finally I just moved my files to /Websites/myweb. The problem all along had to do with accessing directories in the /users directories, which is where the files I originally wanted to access were located. There were some articles on making this work, but I didn't mind just moving them to a lower directory that would be easier to find anyway.