Friday, November 13, 2009

How to call a controller in FW/1

Sean Corfiled wrote a simple MVC framework a few months ago called FW/1 (check it out here). I have been following the discussion list since the beginning. Last night I finally gave it a try. I was very impressed by it's simplicity. There isn't alot of documentation but there doesn't need to be a whole lot because it is so easy and Convention based. I had a view up and running based on the getting started doc in just a few minutes. Very nice. It is not only easy, understanding the conventions will surely help my development in model-glue and other frameworks, even when I don't use a framework this will help with my mental and code organization.

Then I moved to controllers. I just couldn't grasp how they were called. I reread the docs a few times and finally went to bed a defeated man. This morning I reread once more and it clicked, and the docs explain it perfectly, I was just a little thrown by the verbage, which I shouldn't have been. In model glue I call an event like so:

<event-handler name="maint.city">
<broadcasts>
<message name="needCity"/>
</broadcasts>
<results />
<views>
<include name="body" template="maint/city.cfm" />
</views>
</event-handler>

In FW/1 your url would be http://www.whatever.com/myapp/index.cfm?action=maint.city

FW/1 automatically calls the city() function in the controllers/maint.cfc controller. It seems almost silly that I couldn't figure this out, but It did escape me for a minute. I knew to create a controller and where to put it, but I wasn't sure how to call different functions etc.. In model-glue I would broadcast different messages. So I was thinking maybe I needed to call functions from my view or something, like city = rc.controller.getCityById().

Turns out, as mentioned that FW/1 calls the city() function automatically and i can call other stuff from inside that function.

Wednesday, November 11, 2009

Posting Code Snippets in blogger

I have always wanted a good way to post code snippets on this blog. My favorite is the way that Ben Nadel does it at his blog: http://www.bennadel.com/. I sent him a message asking him how he does this, but I have not heard back from him. I found a way to post code snippets but it ain't that pretty.

You use blockquote and the returned output from this parser: http://www.blogcrowds.com/resources/parse_html.php
ColdFusion Report Builder has Report Functions

I stumbled on a discussion at: http://www.justskins.com/forum/archive/index.php?t-5171.html that made me realize that Report Functions are available in ColdFusion Report Builder. I had been struggling with the expression builder using iif to conditional show fields. iif is a bear, you have to use DE(" ") and different things and it can be ugly.

As mentioned in the article, you cant use cfml syntax in the expression builder. But you can using report functions. This is a very nice feature. Since I get mad at adobe for that bad things better get happy for the good things. Nice one Adobe!
Coldfusion Report Builder Frustration

In my detail band I want to eliminate the blank lines when a field has no value. I my situation I return a lot # and subdivision and often times there isn't any listed so the line is blank. I don't want a blank line to show up. In Crystal Reports they let you add sections and you can choose to not print the whole section if it is blank anyway.

Coldfusion report builder has an option "Remove Line When Blank" but it flat out does not work for me. Nothing is removed. Whatever the secret combination of options is to make this work, I can't figure it out. C'mon Adobe, we really need this tool, please upgrade and fix it.

Thursday, October 29, 2009

Salesforce.com frustration

We are nearing our limit of 1GB storage space in salesforce.com. I emailed my sales rep about increasing storage and his reply was $1500 for an additional 1GB. After some frantic screaming (by me) he said he had made a mistake and new pricing was actually$750. Anyway it sent me on a tyraid because I feel such a sense of vendor lockin with salesforce and such a prisoner to their EXPENSIVE product line that I did some research on alternatives. My post to a blog that sums up my problems very well eplains my thoughts pretty good. We are currently at 95% usage. See image below for our actual usage right now.

Blog Post: http://forcemonkey.blogspot.com/2009/08/salesforcecom-data-storage-space.html

My Comments:

Great post. This is exactly the problem we have and our stats look exactly like yours. 61% used up in tasks, and our usage grows about 5-7 % per month. Problem is that 15 of our users are sales people who call, email and do stuff all day long. So 50 - 80 tasks is nothing when you consider, emails, calls etc..

It is pretty scary the strangle hold salesforce is applying to my company. The quoted price for more data was at first $1500 per year for 500 meg, but after screaming loud enough he told me he made a mistake and the new pricing was $750. We have 30 users and pay approx $36,000 per year for salesforce. In a world where google gives me 17 GB free, salesforce should be a little more liberal with their storage space. They aren't the only kid on the block any more either.

I could save 70% with sugarcrm and 88% with zoho. Admittedly, especially since we are so comfortable with it, salesforce is still top dog (in my opinion) and worth some extra bucks. But at some point you break the camels back. Then you give up a few features (increasingly fewer) to save $25 to $30 K per year.

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.

Thursday, January 22, 2009

Blackberry Storm Upgrade

I recently upgraded from a blackberry 8703e to the new storm, I did this around December 10, 2008. First, transferring contacts and calendar was awesome, easy, fantastic. I use google synch to synch my contacts and calendar with my google apps calendar and contacts, so All I did was install google synch on the new STORM, entered my credentials and it did take a try or two (there was alot to synch) all my stuff was there.

I was severely disappointed with the battery life of the storm. But after a few days, the battery life was fine. I attribute that to overusage cause it was new and maybe battery conditioning. At first it was only lasting about 12 hours, and since I unplug it between 5 and 5:30 AM, that means it was shutting off on my way home from work around 5 or 6 pm. It now consistently lasts until midnight which is when I usually plug it in. Sometimes I plug it in for the night earlier and once in a while later, but there is still juice left when I do.

I think it uses alot more juice when you actually use it, but when it is just in your pocket or the holster, it sleeps pretty good, if you are in a digital area.

I like this phone, I don't love it. It is slow and I often have to wait for it. My brother-in-law got one and traded it in for the curve, and to tell you the truth if I had that option now I would go with the curve. The new affect was fun and it is a pretty cool phone, but it lacks in functionality because of the slowness and usability of the interface. It has froze several times, even during a phone call twice.
Adding All Option CFSELECT

I am creating a web page that makes use of related cfselect's. This is a handy feature of coldfusion that allows the contents of one select box to be dependent on the contents of another. For me that means I have one select that lists areas that our company covers. Another box lists the counties we cover. Using the related selects the counties will only show for the area selected in the first box. Very nice. I also link a jurisdiction select to the counties select.

I wanted to add a default "All" option to these selects. Colfusion has an atribute for CFSELECT - queryposition which you can set to above or below. This works great if you are not using the bind attribute in CFSELECT. I was using bind to connect those cfselects so I had to find another way to add "All". I found a comment on Ben Forta's Blog by Matt Bennett that gave me sample code like the following which I adapted slightly for my own use:



sortArray = ArrayNew(1);
QueryAddColumn(qry, "sort_order", sortArray);
QueryAddRow(qry);
querySetCell(qry, "name", "All");
querySetCell(qry, "id", "0");
QuerySetCell(qry, "sort_order", "1");


SELECT *
FROM qry
ORDER BY sort_order desc, name asc



Works great, I just added that code after the qry I was already returning and boom, success.