I know I haven't been writing for a while, however this is something really interesting that happened to us here at work and I figure it may help someone else out there. We are using the well known Illudium PU-36 Code Generator from Brian Rinaldi. I use it for a project that connects to MSSQL and had no trouble generating the code, I even created my own template based on the "Prototype" provided with the generator. It creates nice clean code that we can start working on right away. The problem we had was that we were getting "duplicate parameters" and "duplicate Properties" once we started using any Oracle database. I started digging the code and learned a lot in the process, one thing I noticed is that on the adminAPIFacade.driverOrClassToType() method Brian checks for the datasource's Driver and Class values and if it finds "oracle" then uses "oracle.cfc" to get metadata from the database. If it finds "mssql" then it uses "mssql.cfc" to get the metadata from SQL Server. If nothing is matched then it tries to use the new CF8 for metadata extraction, the component used for that is scorpio.cfc. Well everything looked good there, logic look solid and things were working OK. The problem was on our side. I checked our datasources and every Oracle DSN is using "Other" as the driver. This turns out to be a JDBC connection where the Driver Class is "macromedia.jdbc.MacromediaDriver" and the driver Name is "MacromediaDriver" nowhere in these values you will find the word "Oracle". That's why the adminAPIFacade.driverOrClassToType() method was returning "Scorpio" all the time. Now I don't know why the CF8 tags are returning duplicate information on the metadata but I knew that I needed to find a way to tell the method to start using Oracle.cfc instead of scorpio.cfc. I found the answer on the datasource.url value. Right now it reads JDBC URL : jdbc:macromedia:oracle://[serverName]:1521;ServiceName=[ServiceName];AlternateServers=([ServerName2]:1521);LoadBalancing=true So I added that to the method and now all generated code is coming the way is supposed to be. Final method looks like this. <cffunction name="driverOrClassToType" access="private" output="false" returntype="string"> <cfargument name="datasource" required="true" type="struct" /> <cfif ((arguments.datasource.driver eq "MSSQLServer") or (arguments.datasource.class contains "MSSQLServer") or (arguments.datasource.url contains "MSSQLServer"))> <cfreturn "mssql" /> <cfelseif ((arguments.datasource.driver contains "mySQL") or (arguments.datasource.class contains "mySQL"))> <cfreturn "mysql" /> <cfelseif ((arguments.datasource.driver contains "Oracle") or (arguments.datasource.class contains "Oracle") or (arguments.datasource.url contains "oracle"))> <cfreturn "oracle" /> <!--- if you are running cf8 we can try to leverage db metadata tags ---> <cfelseif listFirst(server.coldfusion.ProductVersion) gte 8 and arguments.datasource.driver neq "MSAccess"><!--- only access with unicode seems to work with dbinfo ---> <cfreturn "scorpio" /> <cfelse> <!--- not a supported type ---> <cfreturn "" /> </cfif> </cffunction> çB^]\..
Illudium generator gotcha!
Posted by
grtfercho
on
Tuesday, August 26, 2008
1 comments
Labels: code generation, coldfusion, programming tips
I hate Windows Vista
That's it. I just hate it. I don't have time or patience to find out where everything is. The File explorer is completely messed up. I do not like it. Microsoft : "fix it " .. Oh wait, you created this, never mind.
Posted by
grtfercho
on
Sunday, December 02, 2007
0
comments
Labels: rants
Get Firefox FIRST!
We'll I ended up buying a new laptop for work.I figured that I can use the old laptop for Ubuntu and this new one for Windows.Yes, maybe I could use one for both, however I'm pretty sure my old trusty laptop won't be able to handle two systems, no matter what I do to it.It is from 2001!!.
So for now the old trusty is my Ubuntu play area and this new one is the one I'll be using for work from Bolivia.
It is a Toshiba Satellite L45-S7423, nothing fancy really. I don't do games or watch DVDs that much so I just went for the bare necessities. It has 1gb of RAM which I think would be good enough for the things I do.
Why a Toshiba? My sister got one a year ago, when my old trusty started failing on me, I borrowed hers for a while and I liked it. The price was also good.
One thing I don't like is that it comes with the over hyped Windows Vista, I'd rather have XP pro." No problem" said the 18 year old sales person at Circuit City we can downgrade it for you it will cost $350 though.
Anyway I feel weird using Vista, I don't like it. I don't need it. I think is too much make up for the system with nothing really beneficial for the work I do.
First thing I did is install Firefox, I don't care if IE has tabs now. I cannot use IE outside work (they pay me to use it). I got my Firefox installed and the first thing I'm doing in it is write this post.
Next thing? get rid of all the trial garbage they install on these machines. That's one really cool think about Ubuntu, install it, power up, get to work, simple as that.
After that Eclipse, and all the tools for development.
çB^]\..
Posted by
grtfercho
on
Sunday, December 02, 2007
0
comments
NoDans Series on ModelGlue Reloaded Part 5
This was also a short entry. The main purpose here is to change the free form text for the Contact Types to a Select box. We do this by creating a MAP with ENTRIES in Coldspring.xml and then calling a method getContactTypes() on the ContactService bean. Once we have the collection of values we set the variable "ContactTypes" for later use un the final view (frmContact.cfm). Direct Link to MindMap of Part 5 (opens full Size)
Posted by
grtfercho
on
Thursday, November 08, 2007
0
comments
Labels: coldfusion, Model-Glue, NoDans Series
NoDans Series on ModelGlue Reloaded Part 4
This was an easy and short one. Part 4 deals with the validation of the form. We have two main objectives here
- Check the values provided against our validation rules
- Display error messages if the values don't pass validation
Posted by
grtfercho
on
Monday, November 05, 2007
0
comments
Labels: MindMaps, Model-Glue, NoDans Series
NoDans Series on ModelGlue Reloaded Part 3
I'm finding Mindomo a bit of a pain to work with, there are some restrictions on the application that are starting to get me. However, I still think it is a good tool and has a lot of potential, not only that but I want to keep consistent with the MindMaps. I didn't want to recreate the first one I did and I didn't want to do this third part in some other system.
I think I'll just finish the whole series using Mindomo and then look for other more interesting options.
Anyhow, I went through part 3 of the series from Dan Wilson's blog and I broke all the information on 4 sections.
- Create the Bean that will hold data from the form.
- Create the Form that will gather data on the front end.
- Create the Action handler for the form once data is submitted.
- Something I called ColdSpring Magic. Dan creates a Service and wires the whole thing using Coldspring and Model Glue.
Dan uses a cool code generator called ROOIBOS.
I tried to put as much detail as possible but you can only go so far with mindomo.
Direct Link to mindmap of Part3 (opens full Size)
Apparently Mindomo has a set width and height, therefore if you open all branches at the same time some text will get cut off. I recommend keeping (2) and (3) open and then when you are ready for (4) collapse (2).
-----------------------------
I want to make something clear, I'm doing this to help me understand how a ModelGlue application works. I'm using Dan Wilson's series since it is easy to digest and covers all the basics. I don't claim to be an expert on ModelGlue, this is a compliment effort to what Dan Wilson has on his website. You still have to read the entries on Dan's blog but hopefully all the verbose will make more sense if you have a graphical way of connecting things.
If anybody has questions about the mindmap please let me know.
çB^]\..
Posted by
grtfercho
on
Sunday, November 04, 2007
1 comments
Labels: MindMaps, Model-Glue, NoDans Series
NoDans Series on ModelGlue Reloaded Part 1 & 2
When I have to work on complex stuff,tackle a new project or learn a new technology, I usually create a Mind Map on a big piece of paper. I started looking for options on the Internet that I can use from anywhere and that can help me diagram fairly complex concepts. I found www.mindomo.com and I like it!! the fact that the application was created in FLEX is even better. Anyways, I've finished the series of 10 tutorials from Dan Wilson. I learned a lot of things related to ModelGlue and I decided to do the whole 10 exercises again and this time create my usual Mind Maps so I can absorb things in a graphical way. I'll start posting the different Parts and the related MindMap, hopefully this Maps will be a complement to anybody trying to learn ModelGLue and following Dan's tutorials. Here are the two first Parts of the series. If anybody has questions/comments about the Maps please let me know. Direct Link to Parts 1-2 (opens full Size) çB^]\..
Posted by
grtfercho
on
Wednesday, October 31, 2007
Labels: MindMaps, Model-Glue, NoDans Series