Configuration with MBUnit - configuration

I want to use MBUnit to write unit tests for my application, however I will require some configuration to be set up.
My understanding is that any App.config files I add to the unit test DLL will not be loaded. I've looked in the wiki and can't see a way, is there a mechanism for loading my configuration?

I have looked into this more by myself, I found this article.
You can do this by creating a config file as you would a regular exe (DllName.dll.config), MBUnit automatically loads this as the appropriate config file.

Related

ZF2 versioning of assets to avoid caching of old files

I have a ZF2 project where I generate, minify, etc... my assets via gulp. For example I generate a styles.css file which gets included with the ZF2 headlink view helper:
echo $this->headLink()->appendStylesheet($this->baasePath('assets/css/styles.css));
Now I have the problem, that the file gets cached by the browser and does't notify any changes. Does anyone know a way to handle that? Maybe add a version number to the generated css file, but then I really don't want to edit all the ZF2 templates which inlcude that file.
Thanks for any reply.
There's a load of ways to do this, but one option is to use Assetic - a well known asset manager package. Tere's a few ZF2 modeules to help integrate this library into the framework too. A quick google search throws up some:
https://github.com/magnetronnie/zf2-assetic-module
https://github.com/kriswallsmith/assetic/
This module will help manage assets such as CSS/JS, and also has some "cache busting" features where by you can change the url based upon the file modification date to ensure if changes when ever the file is re-downloaded by the browser.

urls to html files generated by applications in openshift environment

My (java) application (in openshift environment) generates/updates a few html files for each user (based on changes of user data) on daily basis. Since these are application-generated files, they are stored in a directory under ~/jbosseap/ (e.g. ~/jbosseap/htmls/xxxxxx.html). what should be the urls to these html files, by which they can be accessed on internet?
Just an update on how have I solved the problem I presented above. First of all, it is good to rephrase the issue for clarity:
My objective: I have an application which creates/updates a set of html pages regularly. These pages are stored (by the application) in a directory on the file system. For the purpose of this writing, let's say the fullpath to the directory is "/opt/mydata/*".
Users of the app need to access these html pages from internet. Therefore, urls to these pages need to be provided: e.g., http://mycompany.com/static/sample.html for /opt/mydata/sample.html.
My environment: my app is a J2EE application, developed with Springframework 3.1, running in Openshift's jbosseap environment
My solution: add the following line to the (servlet's) context configuration:
<mvc:resources mapping="/static/**" location="file:/opt/mydata/"/>
The trick, I think, is "file:" in the clause to allow inclusion of resources
on a file system external to the application.
It has worked for me. Hope it helps anyone who have wondered too.
Credit Thanks to Eugen Paraschiv, whose post led me to the answer.

How do I configure a Web Application project for working with html pages without .Net code?

We have a few html pages in one of our solutions that are meant to be extremely simple, client side only, pure html+javascript pages that access our web api. The api itself is in a web application project in the same solution.
We are now using a web site project to contain those files, but it is getting harder and harder to manage that project, since it's information is placed on the solution, and most of it's aspects cannot be controlled like they can on a msbuild project file.
I'd like to migrate those html files to a web application project, but I'm struggling to make it as basic as possible. For instance, I do not want to generate any dlls on the project. It should be in the solution just to provide access to the files and to enable us to control what goes to the _PublishedWebsites folder on the build by setting the build action on the files. We need this because there are some miscellaneous files in the project that should not be published.
I tried creating an empty web application and removing most things from it, by editing the csproj file. I managed to delete all references and the whole Properties special folder (along with the AssemblyInfo.cs file), but when I run the build command, I still see a dll created along with the obj and bin folders. Then, I tried faking the build target on the csproj file, like this:
<Target Name="Build" />
Now when the project is built, no dll/pdb is created, but the obj and bin folders are still there. Next, I tried setting the outputpath property to the current directory, like this:
<OutputPath>.</OutputPath>
But even then, the obj folder is still created.
EDIT:
I just found another common msbuild property that controls where the files inside the obj folder are placed. After placing this in my csproj file:
<IntermediateOutputPath>.</IntermediateOutputPath>
I now get no folders generated on build, which is nice.
There is a small problem now though (and I'm not sure how and where exactly this process happens) when I open the solution or reload the project in Visual Studio. Even though the project is not being built at this time, some files are still generated:
I feel the current approach is enough for my requirements, yet I'd really like to know if there is a more elegant way to achieve that. Thus, the question holds: Is there a way to make the web application project work as if there was no code file in it, effectively disabling output generation (bin and obj folders, and the dll/xml/pdb outputs)?

Manual manifest files

I have a 3rd party executable which I am trying to include in an InstallShield MSI package and I want it to have permissions set in all flavors of Windows, particularly 7 & Vista to be run as Administrator.
I'm not that clued up on the creation or the proper configuration syntax of Manifest files, but I have tried to make one manually as [appname].exe.manifest, and tried the <requestedExecutionLevel level=”asInvoker” uiAccess=”false” /> in the XML, and it didn't run as Administrator, and I want to confirm that is that because the program had not been compiled that way to see that the manifest file was in the same directory, or is it just going to be a case that the manifest file has not got the right syntax.
If there is any other simple ideas, I would love to hear it!
Cheers.
Manifests can either be embedded into an executable (this is preferred) or external, placed next to the file named as you describe. If there is an embedded manifest, an external one is ignored. For launching EXEs, this is all performed by Windows, and is not affected by code in the exe file. For loading DLLs, while this can be somewhat influenced by code you write, it does not change UAC behavior as it is not a process boundary.
As for whether a program not launching as administrator when you place a manifest requesting asInvoker next to it means you created a valid manifest, that depends on what happens when the manifest is not there. Since you mention InstallShield, you can copy a template manifest file such as its <InstallShield>\Support\setupexe.invoker.manifest to ensure your syntax is correct.
Upon re-reading your question, I realize you wanted it to launch as administrator. For that you need to request administrative rights, so you should have requireAdministrator instead of asInvoker, or base it off setupexe.admin.manifest instead.

threepenny-gui - opening files

Dear Haskell community I have written my first gui application and decided to use
threepenny-gui to do so.
The task is the following search the files in a given folder for matches and provide links to open those files. In addition I made nice parse and render function as the files (mostly) have a special formatting.
But now I have stumbled upon a problem - most browsers prohibit links to local files by href="file://localhost/home/user/folder/file.pdf" being opened, for security reasons, which I do understand and find completely sensible.
I tried to use href="./file.pdf" when the program and the file are in the same folder, which also doesn't seem to work.
The code of the whole application is available at github/epsilonhalbe, I run it in a folder and access it via a browser at localhost:100000
The HTTP server provided by threepenny-gui will serve up static content from the directory you specify in tpStatic. Put your files in that directory, and make your links' paths be relative to it, and you'll be good to go!
As of threepenny-gui-0.4.*, there are also two functions loadFile and loadDirectory that can be used to serve a local file or directory at an automatically generated URL. This can be useful if the tpStatic field is not enough.