I have some forms I have created in a local directory D:\PsToolBox. I added them to the repository, now when I inherit from them the IDE adds the Base form to the project's file, no problem. I get :
PsListView in 'D:\PsToolbox\Source\View\PsListView.pas' {frmPsList},
Unit4 in 'Unit4.pas' {frmPsList4};
However I code on 2 different computers through version control on BitBucket. The PsToolBox directory is in different locations so I need a common path in the project file.
I tried creating an environment variable PsToolBox with the path D:\ToolBox on the first machine and then editing the dpr file path of the base form to
PsListView in '${PsToolbox}\Source\View\PsListView.pas' {frmPsList},
This compiles and runs, however if I try to edit my form I get an error that the system cannot find the file. Also moving between projects in the group triggers the error as well. Closing and reopen same result.
I tried adding the environment path
$(PsToolbox)\Source\View
to both the Tools/Options/Langauge/Delphi/Library Windows32 platform, as well as the project search path. No Joy.
What am I missing? Is this even possible?
Related
So this was quite a hilarious error and was quite difficult to trace, so I'm going to chuck everything on here in case it happens to anyone else;
While working on a website in production, its name changed. I noticed that the IISExpress instance displayed not only the new name, but a '\' and the old name as three separate instances.
As I was attempting to add log4net to the project, I attempted to use this line in the web.config:
<log4net configSource="log4net.config" />
Which caused the following error on app run:
the configSource file '[file]' is also used in a parent, this is not allowed.
the configSource file is also used in a parent, this is not allowed.
This was perplexing as I had not used this source anywhere else, and no matter what file I changed it to, I got the same error.
log4Net worked fine when I defined it entirely within my web.config, but that's not what I wanted, so I investigated further. Interestingly, a colleague who'd just been brought onto the project could run the app fine with the separated config, but I and another dev who'd been working on this project for a while could not.
How can I and another colleague with exactly the same setup have a failing app with the same config as someone with a fresh checkout have it work fine?
The web.config file is "composed" when it is read by the application by scanning the file system from the current directory up to the drive root and by looking in a number of pre-defined places (such as the location of the Machine.Config and the default ASP.NET config.) If you're using Virtual Directories on the same website in IIS, things can turn even more interesting.
Any of these files can define configuration sections and can possibly externalize the configuration, and thus cause the error message you're seeing.
The following doc on MSDN outlines exactly how the configuration is being parsed and composed:
https://msdn.microsoft.com/en-us/library/ms178685.aspx
It turned out to be that IISExpress had saved the previous settings in a .vs folder at solution's root level, and all three of those instances were using the same config, and looking for the same file, hence the error.
The solution was as follows:
In the web-app's project, reset the web properties to look at the root site (\ instead of \newname\)
Trash the entire .vs directory
Restart Visual Studio and Reload the project.
For different versions of VS, the .vs folder is in different locations on your machine.
I have been searching for a long time but the topic seems to be quite special. I didn't come up with anything. Maybe the specialists arounf here can help me.
I run a Windows Service which accesses some databases and does some calculation. If something fails, then that will result in an entry in a log file.
My wish is to lacalize these entries.
This worked fine with every project so far except for this Windows Service.
I use the resource manager and localized resources files.
During runtime the CultureInfo is changed by:
Thread.CurrentThread.CurrentUICulture = new CultureInfo(this.language);
where language is a value read from the config file.
The changes are veryfied at the next line:
LogService.WriteEntry(CultureInfo.CurrentUICulture.Name, EventLogEntryType.Information);
This works and returns the correct CultureInfo.
The resources files are named correctly but still, the localized file (in that case "de") can't be accessed and the default (english) file is used.
I added the resource files to the project output in the setup project.
Edit:
In other Projects, the following worked fine, but not for the Windows Service:
ResourceManager locRM = new ResourceManager("WindowsService.ResWindowsService", Assembly.GetExecutingAssembly());
It seems the Windows Service just can't find the satellite assembly and then falls back to the neutral resource file which seems to be within the Windows Service exe file.
Has anyone an idea how i can get the Windows Service to find the satellite assembly.
Edit 2: THE SOLUTION
A dear colleague helped.
I strongly named the satellite assembly and registered it in the GAC. That was the solution. Now the Windows Service can access it.
Detailed steps:
In the setup project's file system editor: Add special folder -> Global assembly cache folder.
Add file -> I added the resource file here
Then under Project Properties -> Signing mark "Sign the Assembly" and create a new key file.
That's it.
Thanks,
Nils
I am creating web application in C# using ASP.NET MVC and I am using MSSQL server installed on my machine.
Also I wanted to publish application as open source project, and run it on production server.
Should I add web.config file to source code repository? If i should, how I should track "open source version" (pointing on MsSQL installed on localhost) and production version (pointing on my hosting of web.config (I am using Mercurial).
The recommended way to do this is as follows:
Create a copy of the public version of the file you'd like people to use as a starting point, and name it something other than the actual usable file. In your case, it could be web.config.template. Make sure the file would be usable if you just renamed it.
Instruct Mercurial to ignore the actual file, ie. web.config
If possible, make the build process figure out if the actual file is present, and if not, make a copy from the template file into the actual file
If step 3 is not possible, a batch file to make the actual file is the next best thing, or simple instructions on how to make it.
This ensures that:
There is a simple way of getting the actual configuration file
You can edit your local actual configuration file without worrying about committing it (it is ignored)
If step 3 was possible, this is largely transparent unless you need to make modifications to the file
Step 3 can be handled with a pre-build event for your project, something like:
if not exist web.config copy web.config.template web.config
You could commit a generic version to your repository, probably on the initial load only (so that the project will build for those who don't know how to create their own), and then add an ignore rule later so that you can add your connection strings and whatnot.
I switched from netbeans to emacs and I am pretty happy with the change. The thing I am missing the most is autocompletion and jump to definitions. In order to get this I have installed Rsense. It works fine for the gems code, though, I cannot jump-to-definitions of my Rails project nor autocomplete according to the methods I defined.
I tried to add my project's load path to Rsense's load_path configuration, though, it still doesn't work.
Does anyone know how to get this working?
You can use tags for browsing through files and jumping directly to function definitions.
I use Exuberant Ctags (its got Ruby support). You can download it from here.
I am assuming that you are working on windows. Getting the tags to work initially on windows is a pain especially if you are using emacs for the first time.
These are the steps I followed:
Install Cygwin from here.
Include the cygwin\bin\ folder in your environment variable PATH. E.g. here
Install exhuberant ctags. Note that emacs may sometime have a built in ctags. Later on you will have to use the ctags command in cygwin to create tags. At that time you may encounter some errors in case it uses the ctags in emacs instead of exuberant ctag.
Once you have installed ctags, add that to the environmental variable PATH as well.
If you have a small project with relatively lesser number of files (<500). So you just need a single global TAGS file. For that open cygwin, change your directory to the root directory of your project and type in the command ctags -R -e Check this out for other approaches
Your tags file will be created. It will be named "TAGS" and will be present in the root directory of your project.
Next open emacs, and browse through the code. In case you come across a function and want to jump to its definition, put your cursor on the function name and press M-. your minibuffer should then show something like Find tag (default <function-name>): Press Enter and voila!!! you are magically transported to the function definition!!!
Note: You may have to specify the TAGS file the first time you use the M-. This needs to be done only once after emacs startup. You can also modify your .emacs file to take in the TAGS file automatically on startup.
Refer to this and this for more info for tags related commands in emacs.
Until now, I have been using rtags to jump to definitions. It's not perfect, but it does the trick in many cases.
Does anybody know how to (easily) "rename" an existing grails application? I'm running into this because my PaaS provider does not allow me to delete a subscription... So I want to deploy my application under a different name.
Of course, I can do this manually, but I think it might be a useful 'top-level' script (i.e. "grails rename-app newappname")
Manual hints:
When I do a "grails create-app myappname" I can see the myappname exists in the following files (and filenames)... Of course this is done by the create-app script, which replaces #...# tokens in the template. I guess once they are replaced, it's not trivial to do a rename.
./.project: <name>myappname</name>
./application.properties:app.name=myappname
./build.xml:<project xmlns:ivy="antlib:org.apache.ivy.ant" name="myappname" default="test">
./ivy.xml: <info organisation="org.example" module="myappname"/>
./myappname-test.launch:<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="myappname"/>
./myappname.launch:<listEntry value="/myappname"/>
./myappname.launch:<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.launching.JRE_CONTAINER" javaProject="myappname" path="1" type="4"/> "/>
./myappname.launch:<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="myappname"/>
./myappname.launch:<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dbase.dir="${project_loc:myappname}" -Dserver.port=8080 -Dgrails.env=development"/>
./myappname.tmproj: <string>myappname.launch</string>
And of course... the top-level directory name is "myappname"
Any hints, or information about ongoing initiatives in this area are welcome
Greetz,
Johan
I had to do this, I renamed my project top level directory to the new name and
edited the application.properties file. There is a line app.name=youroldappname which should be changed.
Actually, you do not even have to rename the directory. You could have a different web-app name.
Hmm, I know it doesn't look fun, but it shouldn't be difficult (just boring) to rename the project directory, then all the files with your project name in them (you can ignore .tmproj unless you use TextMate). Finally, a quick search through all the files for your old project name to replace and you should have it.
Oh! First, if you're using an IDE, you'll want to remove the project from the IDE, then re-import it once you've completed your renaming procedure.
As far as I know, nothing project-specific is stored anywhere except the project directory and below, so it's a very finite set to search, and you only have to do this once (I hope).
Not very elegant, I know, but brute force does have its uses.
I used the brute force Method and it worked for me. Took 5-10 minutes to find all files with the name in it and replace it with the new one. Also Netbeans was ok afterwards. The only thing that changed was the port number which I had to change again.
Just renaming works except when you are using plugins. They will be stored in the $USER_HOME/.grails/$GRAILS_VERSION/projects/OLDNAME folder.
So after renaming your project you "lost" your plugins. I haven't tried renaming the plugin's folder however just installing all your plugin works as well (at least with Google App Engine and gorm-jpa).
If only changing the web app name isn't enough you can try the rough way - make a backup before.
(In workspace folder)
zip -r oldname.zip oldname/
Then, in eclipse/ggts, use
Disable project, Build automatically
Search, File, Containing text : "oldname", Search
Right click on search results, Replace all, ... "newname"
Exit eclipse and rename all folders to the new project name. On Unix/Mac run
find . -name "oldname"
and mv the handful of results to properly reflect the new names.
For me it worked like a charm, but make sure your project name is not a keyword and reasonably unique.