How to enable Code Assist for ColdFusion builder 2.0.1? - coldfusion

I tried my best to enable the code assist in ColdFusion builder 2.0.1 but no luck.
I found two helping pages:
http://help.adobe.com/en_US/ColdFusionBuilder/2.0/Using/WS0ef8c004658c1089-554789f8121af8f0c8c-7ffb.html
and
http://help.adobe.com/en_US/ColdFusionBuilder/2.0/Using/WSf01dbd23413dda0e1736ebc1213a528ab0-7ffb.html#WS0ef8c004658c1089794dbeb6124c7814753-8000
what I am looking for is to let the coldFusion Builder assist me by auto-completing the REQUEST, SESSION, & APPLICATIONS variables. I tried the follow the instructions in the second link but it didn't work, maybe I wrote some incorrect data?
If any one managed to let it work, please help me.

Assuming you have set up the server correctly in CF Builder, it will talk to the server and cache the respond of what methods does a CFC have. (Console Tab: "Server is available. Getting server settings.")
E.g. If Person.cfc has property Name and Age with accessors=true, and you type p = new Person(), then "p." (Ctrl+Space) should see getAge(), getName(), setAge(), setName(). If you got that to work, you have set it up correctly.
As for variables in REQUEST, SESSION, & APPLICATIONS scopes, I think CFB would see if you have referenced them before on the same .cfm and may give you autocomplete, but don't count on it to be smart enough to know exactly what variables are there in the scopes.

Related

Read AICC Server response in cross domain implementation

I am currently trying to develop a web activity that a client would like to track via their Learning Management System. Their LMS uses the AICC standard (HACP binding), and they keep the actual learning objects on a separate content repository.
Right now I'm struggling with the types of communication between the LMS and the "course" given that they sit on two different servers. I'm able to retreive the sessionId and the aicc_url from the URL string when the course launches, and I can successfully post values to the aicc_url on the LMS.
The difficulty is that I can not read and parse the return response from the LMS (which is formatted as plain text). AICC stipulates that the course start with posting a "getParam" command to the aicc_url with the session id in order to retrieve information like completion status, bookmarking information from previous sessions, user ID information, etc, all of which I need.
I have tried three different approaches so far:
1 - I started with using jQuery (1.7) and AJAX, which is how I would typically go about a same-server implementation. This returned a "no transport" error on the XMLHttpRequest. After some forum reading, I tried making sure that the ajax call's crossdomain property was set to true, as well as a recommendation to insert $.support.cors = true above the ajax call, neither of which helped.
2 & 3 - I tried using an oldschool frameset with a form in a bottom frame which would submit and refresh with the returned text from the LMS and then reading that via javascript; and then a variation upon that using an iFrame as a target of an actual form with an onload handler to read and parse the contents. Both of these approaches worked in a same-server environment, but fail in the cross-domain environment.
I'm told that all the other courses running off the content repository bookmark as well as track completion, so obviously it is possible to read the return values from the LMS somehow; AICC is pitched frequently as working in cross-server scenarios, so I'm thinking there must be a frequently-used method to doing this in the AICC structure that I am overlooking. My forum searches so far haven't turned up anything that's gotten me much further, so if anyone has any experience in cross-domain AICC implementations I could certainly use recommendations!
The only idea I have left is to try setting up a PHP "relay" form on the same server as the course, and having the front-end page send values to that, and using the PHP to submit those to the LMS, and relay the return text from the LMS to the front-end iframe or ajax call so that it would be perceived as being within the same domain.... I'm not sure if there's a way to solve the issue without going server-side. It seems likely there must be a common solution to this within AICC.
Thanks in advance!
Edits and updates:
For anyone encountering similar problems, I found a few resources that may help explain the problem as well as some alternate solutions.
The first is specific to Plateau, a big player in the LMS industry that was acquired by Successfactors. It's some documentation that provide on setting up a proxy to handle cross-domain content:
http://content.plateausystems.com/ContentIntegration/content/support_files/Cross-domain_Proxlet_Installation.pdf
The second I found was a slide presentation from Successfactors that highlights the challenge of cross-domain content, and illustrates so back-end ideas for resolving it; including the use of reverse proxies. The relevant parts start around slide 21-22 (page 11 in the PDF).
http://www.successfactors.com/static/docs/successconnect/sf/successfactors-content-integration-turley.pdf
Hope that helps anyone else out there trying to resolve the same issues!
The answer in this post may lead you in the right direction:
Best Practice: Legitimate Cross-Site Scripting
I think you are on the right track with setting up a PHP "relay." I think this is similar to choice #1 in the answer from the other post and seems to make most sense with what you described in your question.

C++ cgi script gets empty environment variables as action of a form

I have a cgi c++ program on bluehost that works when you manually feed it environment variables. However, when called by a perfectly legit html form, the environment variables fail to carry a query string to the script.
Question: How do I debug this situation? Is there a way to alert the query string before it's sent? Is there a way to track the query string on the server?
You could start with the access log to see what's submitted and the error log to see if something is broken. If you can't get those from bluehost, then you could set up your own Apache server to help debug. You can also put up a simple cgi that just echos a page with what is submitted wrapped in <pre>.
Another useful debug method is ACTUALLY POST SOME CODE when asking a programming question.

Error inserting new record with Flex 4 via ColdFusion 9 with Apptacular extension

I have a little problem with using Flex 4 with Coldfusion 9. I hope you can tell me what I have to fix.
I use Coldfusion 9, hosted on my development machine.
I created a table in MySQL database with 2 columns: idPlayer as integer and auto increment. 2nd column is Name.
I use a ColdFusion Builder, Apptacular, to generate solid CFC service for me. It generates PlayerService.cfc here.
Now I use Flash Builder 4's data wizard to generate data service class from PlayerService.cfc. I create a form on update method of that service.
Ok, now look at the generated code.
// Please uncomment the below line if Data Management is enabled for Player and update is used as the create function.
// var player:Player = new Player();
So I uncommented the code and run the form. After fill the data, and click update, the pop up appear like this:
Unable to invoke CFC - Field 'idPlayer' doesn't have a default value
For details, turn on Robust Exception Information in the ColdFusion Administrator
So I don't know how Apptacular generate the code to work as ORM. But it should have some way or workaround to let the system act with idPlayer has no default value to insert other columns and generate idPlayer as auto-increment value (as I set in MySQL).
Could you help me solve this?
I don't know what your Player.cfc looks like (that's where the error is actually happening), but you'll need to set the generator attribute of the id property to let Hibernate know that the database is supposed to take care of that for you. You'll most likely have the exact same error if you tried to save the object via ColdFusion, so test your Service using CF first, and then move onto Flash so that you know if your issue is really with your Flex integration, or with your CF app.

Check for live Data Source Name Before proceeding

Would it be ok to get a CF app to check for a valid database before proceeding to process that request?
This is because there may be instances where the database server may be down or being upgraded, hence an error comes when a db dependant request is made.
If there is no connection to the db server, the user can be safely redirected to a safe page.
Or can cfcatch work?
How can this check be done?
Thank you.
in your onRequestStart method of your Application.cfc file or in an Application.cfm file you can run a simple query to check that the database is available. Wrap the query in cftry/cfcatch. If the query fails, you can redirect the user in the cfcatch, if it succeeds, you can be reasonably sure that your database is "alive".
I've used such a check in one project. Code may looks as follows (not sure if it will work in versions of ColdFusion lower than 8), consider this sample as chunk of UDF written in CFScript:
// service factory object instance
factory = CreateObject("java","coldfusion.server.ServiceFactory");
// the datasource service
dsService = factory.DatasourceService;
// verify the dsn
return dsService.verifyDataSource(arguments.dsn);
Oh, I have even found small note in the code I wrote on my old laptop couple of years ago:
// [performance note] this server check takes 1-3ms at local PC (Kubuntu 7.10, CF8 + Apache2, Sempron 3500+, 1GB RAM)
While time looks like small I have found out that doing this check on each request is not really useful for my application. Any way I have a habit to use the try/catch extensively for errors handling. But if your datasources may cheange frequently it may have more sense.
Adding an extra query to every request to make sure that the database is up is a patently bad idea. A better approach would be to build a "maintenance mode" switch into your application, that you would manually enable when you are doing planned maintenance (upgrades, etc).
If you want to have a "friendly" page displayed when an error (like database issues) occur, then use the onError() method in Application.cfc and/or the <cferror .../> tag in Application.cfm, as a global error handler.
If you are worried the db could vanish, I would implement a "SELECT 1 AS A" query in your OnRequestStart handler that runs only every N minutes. This can be accomplished by using the query caching feature. I'd start with performing the query every 30 min.

ie useragent wxWidgets

Im currently using ie as an active x com thing on wxWidgets and was wanting to know if there is any easy way to change the user agent that will always work.
Atm im changing the header but this only works when i manually load the link (i.e. call setUrl)
The only way that will "always work," so far as I've been able to find, is changing the user-agent string in the registry. That will, of course, affect every web browser instance running on that machine.
You might also try a Google search on DISPID_AMBIENT_USERAGENT. From this Microsoft page:
MSHTML will also ask for a new user
agent via DISPID_AMBIENT_USERAGENT
when navigating to clicked hyperlinks.
This ambient property can be
overridden, but it is not used when
programmatically calling the Navigate
method; it will also not cause the
userAgent property of the DOM's
navigator object or clientInformation
behavior to be altered - this property
will always reflect Internet
Explorer's own UserAgent string.
I'm not familiar with the MSHTML component, so I'm not certain that's helpful.
I hope that at least gives you a place to start. :-)
I did a bit of googling today with the hint you provided head geek and i worked out how to do it.
wxWidgets uses an activex rapper class called FrameSite that handles the invoke requests. What i did was make a new class that inherits from this, handles the DISPID_AMBIENT_USERAGENT event and passes all others on. Thus now i can return a different user agent.
Thanks for the help.
Head Geek already told you where in the registy IE will look by default.
This is just a default, though. If you implement [IDocHostUIHandler::GetOptionKeyPath](http://msdn.microsoft.com/en-us/library/aa753258(VS.85%29.aspx) or [IDocHostUIHandler2::GetOverrideKeyPath](http://msdn.microsoft.com/en-us/library/aa753274(VS.85%29.aspx), IE will use that registry entry instead.
You'll probably want to use SysInternal's RegMon to debug this.