RSS Feed

Posts Tagged ‘Programming’

Oracle 06413: Connection Not Open (x64)

February 17, 2010 2 Comments »

Having changed to a 64-bit development machine at work recently I ran in to an Oracle error while trying to generate files using CodeSmith. This error was ORA-06413: Connection Not Open. Assuming it was a connection string error, as I had not ran this particular generation in some time and it was likely that the server or username/password had changed, I proceeded to test the connection from SQL Developer. Success!

After ruling out that the connection was indeed valid I did a quick Google search for the error message. After a few clicks I discovered a very well known (has been around for a few years) Oracle issue; When executing an Oracle command from an application with parentheses or equals — ‘(‘ or ’)’ or ‘=’ — in the path then the specified error message is thrown.

In this particular case CodeSmith had been installed under C:\Program Files (x86)\CodeSmith\ which was causing Oracle to fail. The quickest work around was to simply move CodeSmith from the Program Files (x86) path e.g. in to C:\CodeSmith\. However; there is a patch (5383042) for Oracle 10g, which I believe is also applied to Oracle 11G.

 

See Code, See CodeRun

June 19, 2009 2 Comments »

Merbla wrote a short post today about a site he came accross, CodeRun. The site is an online code respository, with the added advantage of an online IDE include on the site which allows you to see the code and run / debug it as it is. After signing up with a free account you can create your own projects (AJAX, ASP.NET, PHP and WPFAJAX and ASP.NET also have support for facebook applications) which you can develop, store and run all from their website.

The concept is brilliant — everything from start to go can be done online via your standard web browse (currently only supports Internet Explorer and FireFox) and publishing of your source code is as simple as a right-click and a left-click. Once source has been published other people can freely go and search for source code in the repository and open it directly in the browser, make modifications and run them all from within the browser.

CodeRun Online IDE

However; The actuall implementation of it so fair (while still very impressive) is significantly lacking from a development perspective. Although it is possible to do the majority of thing you can do in Visual Studio, it is a little cumbersome and slow at times and does have a few limitions. For example, there is no toolbar — and therefore no drag and dropping of controls (which Microsoft presentations always seem to contain a lot of ;-).

Although the site seems to be focused on web applications some features are also unavaliable in the online IDE. You do not have the ability to create folders with underscores in them, and there does not seem to be anyway of creating the special ASP.NET folders such as App_Data or App_Themes… not such a big deal. Designer files are not automatically created and if you try to create one an exception is thrown saying the file already exists.

The biggest problem however is the speed. Perhaps it is just my machine or my internet connection, but the online IDE is very slow to use and navigate. Menues and and prompts tend to hang the browser for a couple of seconds before they load and the intellisense (ctrl+space) does not allows function correctly. Code highlighting, although not important or required, is lacking from the Visual Studio equivalent and take a signifant amont of time to process and display.

Copying and pasting from Visual Studio in to the online IDE also seems to be out of question, as it seems to past the text multiple times; Copy and paste from within the online IDE works fine.

All that being said the online IDE is quite feature rich and imitates Visual Studio very well. You are able to apply breakpoints and step through code, attach to processes (only online applications — not system processes), watch variables, etc. There is also an option to open a project from a zip file — which works great, providing you zip the project from the root of the project folder (it must not be under a sub folder).

In the end (as Merbla suggested in his post) something like this teamed up with StackOverflow, for the purpose of displaying simple solutions to problems with working example would be brilliant! However as far as online development goes I think there is a long way to go.

See running example: Hello World!

 

InfoPath Roles And Views

February 18, 2009 No Comments »

InfoPath RolesOne useful feature of InfoPath is its built in support for user Roles. While it is not overally powerful (and it should not be used for security purposes as all data can be viewed and edited in xml format via notepad or a similar) it can be handy for autmoatically switching views based on AD users or groups.

To add a role simply go to Tools -> User Roles (alt + t + e) and click Add (alt + a). You can then specify which users, groups or user names from the form should belong to the new role.

One thing to note is that when you are designing an InfoPath form and click “Preview Form” it shows the form based on the default role. If you wish to preview the form under a different role you need to go to File -> Preview Form -> With User Role… (alt + f + r + r). The form will then be launched in preview mode under the select role.

There is also the option to set a role as either the default role or the initiator role (only one role can occupy either or both of these options). The default setting specifies that this role is the default role for all users, should they not meet the requirements of another role. The initiator setting is the role assigned to a user when they open the infopath form for the first time.

Another point of interest is that roles are assessed on a top-down approach, however you can not change the ordering of roles from within the InfoPath IDE. In order to change the ordering of roles, should you be required to, you must open the manifest.xsf and manually re-order the <xsf:role /> elements.

 

Adding Custom Toolbar Buttons To VS2008

December 4, 2008 2 Comments »

So you’re a smart cookie and you’ve written yourself some scripts to build your DAL or perhaps to deploy or package for a different environment; However, when you want to run said scripts you have to open up a command window, navigate to working folder and run the scripts. Not only is this a pain and waste of valuable time, it also inevitably results in a taskbar full of command prompt windows! Well there is a quick and easy way to add custom buttons to your Visual Studio 2008 toolbar which will fire off your scripts and display the results in the output window.

The first step is to ensure you have a consistent approach to how your projects are set up in order to run your scripts. After all, you don’t want to have to create a unique toolbar button for every single application you’re developing. One simple approach to this is to create a batch file of the same name (e.g. GenerateDAL.bat) for each application which can then call of to project specific actions. Once you have a consistent pattern to your projects your custom toolbar buttons will become much more useful and save you lots of time.

Steps for creating a custom toolbar button:

  1. In Visual Studio 2008 go to Tools -> External Tools…
  2. Click Add -> (Complete the form)
    Title: (Name of the script e.g. Generate)
    Command: (Location of script e.g. $(SolutionDir)CodeSmith\Code.Generate.cmd if your script is in the folder ‘CodeSmith’ of all your project)
    Arguments: (Leave this one empty if you wish)
    Initial directory: (Location of script or the folder level from which you would usually call your script e.g. $(SolutionDir)CodeSmith\)
    (Check Use output window to display results in the output window)
  3. Click Ok.
  4. Right-Click on the toolbar -> Click Customize…
  5. Select the Toolbars tab -> Click New -> (Enter a suitable name e.g. Scripts)
  6. Select the Commands tab.
  7. Under Categories scroll down and select Tools -> Under Commands scroll down to External Command 3 (this assumes you only have to default 2 commands in Visual Studio — if you have more than the external command number will match the order of your external commands list)
  8. Drag-and-Drop “External Command 3″ and/or any other external commands you created previously.
  9. Click Close (At this point the button should automatically be renamed to the title of the external command they are linked to).
  10. Drag the new toolbar group to where you want it on the toolbar and enjoy :-)