App.config Data Source Relative Path? - visual-studio-2013

This is the connection string to a local database on my pc:
<connectionStrings>
<add name="DataEntities"
connectionString="metadata=res://*/Data.csdl|res://*/Data.ssdl|res://*/Data.msl;
provider=System.Data.SqlServerCe.4.0;provider connection string="
Data Source=C:\Users\User\Documents\GitHub\incidentapp\incidentapp\Database\Data.sdf""
providerName="System.Data.EntityClient"/>
</connectionStrings>
However I want to move the project back-and-forth between computers. How can I set a relative path to my database if the database is in the project location which is incidentapp.

I got it. It's because I'm running debug, therefore the 'default' location is at the debug folder. So I just needed to move the database location to the debug folder when I'm developing.
Thanks.

Related

Copying a Java Dynamic Web Project and renaming it to new one causes the error in Tomcat

In eclipse whenever we copying a java dynamic web project into new one by renaming it and trying to run the new copied project in tomcat server it causes below error:
"Could not publish server configuration for Tomcat v9.0 Server at localhost.
Multiple Contexts have a path of "/CopiedParentDynamicProjectName".
Anyone have idea how to overcome this tomcat error after copying the dynamicwebproject while running it server.
Step 1) Open Servers folder and click on server.xml file.
Step 2) Scroll all the way down to find following code
<Context docBase="spring-security-demo-01-base-app" path="/spring-security-demo" reloadable="true" source="org.eclipse.jst.jee.server:spring-security-demo-01-base-app"/>
<Context docBase="spring-security-demo-01-base-app" path="/spring-security-demo" reloadable="true" source="org.eclipse.jst.jee.server:spring-security-demo-01-base-app"/>
Step 3) See the duplicate entry and delete one.
Step 4) Change the path so that we have following code.
<Context docBase="spring-security-demo-01-base-app" path="/spring-security-demo-01-base-app" reloadable="true" source="org.eclipse.jst.jee.server:spring-security-demo-01-base-app"/><Context docBase="spring-security-demo-01-base-app" path="/spring-security-demo" reloadable="true" source="org.eclipse.jst.jee.server:spring-security-demo-01-base-app"/>
Step 5) Save the file.
Step 6) Problem is solved.

Unable to configure the PATH environment variable in Kudu shell via XDT

I am trying to set the PATH environment variable for a web app I am building in Azure in python. I tried to use something like os.environ.setdefault('PATH', 'pandoc-2.14.1-1-amd64.deb') locally, however this does not seem to work once uploaded. I have also tried setting the path in the configuration section on the azure portal, but get the following error:
I have seen posts like
setting the webapp %PATH% environment variable in azure.
The post recommends adding a file called applicationHost.xdt to the home/site directory, which should set the PATH variable automatically. However, I am unable to upload applicationHost.xdt to the files in the directory. This is either because the file UI interface no longer exists, or I am unable to access it. Has the ability to upload via the UI been discontinued?
The only other workaround I can think of is to use echo/cat in the Kudu bash shell to create the applicationHost.xdt manually. This is very tricky. Are there any online tools that, given an input of the contents of a file, create the bash script to generate that file from scratch?
You could add a App settings to you web app, like below:
Then, restart your web app, in Kudu console, you could check it.
Note: App setting names must be unique, so when you use PATH as key it is already configured while deploy so while using in App setting from portal use a different Key name.
As a workaround, you can achieve that through an XDT Transform (XML Document Transform).
Yes, you can use echo to create the same. Simple copy paste the content of the file to be inside single quote ' and stream it into the file already created using echo command.
/home>echo '<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<system.webServer>
<runtime xdt:Transform="InsertIfMissing">
<environmentVariables xdt:Transform="InsertIfMissing">
<add name="FOO" value="BAR" xdt:Locator="Match(name)" xdt:Transform="InsertIfMissing" />
<add name="PATH" value="%PATH%;%HOME%\BAR" xdt:Locator="Match(name)" xdt:Transform="InsertIfMissing" />
</environmentVariables>
</runtime>
</system.webServer>
</configuration>' > applicationHost.xdt
Verify the contents using cat command

Restore Oracle Database From Oradata Folder

I have lost my database on the server because the computer has been formatted on drive C. But the oracle folder was located on Drive E, like oradata, etc. Can I restore oracle database like before?
Well, first you need to install the oracle server with the version which was there before formatting.
Follow these steps:
Install the same Oracle database version with the starter database.
Copy all control files, datafiles to oradata directory
Copy init.ora filr to ADMIN folder
Revise the init.ora file for the changed control file, archive and dump locations. (keep instance, SID, and global db name the same)
Create the instance by running oradim with the pfile(init.ora) location
Connect to DB using internal and mount it.
Check existing data and logfile locations by typing:
SELECT name FROM V$DATAFILE;
SELECT member FROM V$LOGFILE;
Now change the file locations that come up above by using:
ALTER DATABASE RENAME FILE <old file loc list> to <new file loc list>;
After renaming them open the database by alter database open.
And you should be set.
Reference

ftp plugin for netbeans 7.1.1 mac

I am trying to use my ftp server on netbeans. Is there a way to only put the host and username + password in and then just see all the folders that are on the server?
I already searched for this but I can't seem to find it anywhere.
I am using a mac and netBeans 7.1.1
First, ensure that ant-commons-net.jar is copied to:
C:\Program Files (x86)\NetBeans 6.7.1\java2\modules\ext
Then modify your project's build-impl.xml file, located under the nbproject directory.
Add a new task, such as this, using your ftpsite, username, and pass. Keep that file safe unless you modify it to prompt each time. To execute, run the ftp task by expanding the build.xml from the NB files tree tab.
Code:
====================
FTP SECTION
====================
-->
<target depends="jar" description="Build." name="ftp">
<ftp server="FTPSITEURLHERE" userid="USERIDHERE" password="PASSWORDHERE">
<fileset file="${dist.dir}/${application.title}.jar" />
</ftp>
</target>
<!--
I'm not sure what you mean, you want to create some project from FTP server and don't want to specify exact path? If so you can leave upload directory with just "/" and the same of "initial directory" and it should work

Problem Unblocking Assemblies in Windows 7 Home Premium

I am getting the following error trying to load a basic project template:
Error 12 Could not load the assembly file://\\psf\home\documents\visual studio 2010\Projects\WindowsPhonePivotApplication1\WindowsPhonePivotApplication1\obj\Debug\WindowsPhonePivotApplication1.dll. This assembly may have been downloaded from the Web. If an assembly has been downloaded from the Web, it is flagged by Windows as being a Web file, even if it resides on the local computer. This may prevent it from being used in your project. You can change this designation by changing the file properties. Only unblock assemblies that you trust. See http://go.microsoft.com/fwlink/?LinkId=179545 for more information. WindowsPhonePivotApplication1
I don't have the Security tab when I try and modify the DLL to unblock the assembly. Any advice?
Did you try copying this assembly locally? Currently it seems to be loaded from a network share. You will need to trust that network location if you want to work this way.
Drive:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\caspol.exe -m -ag 1 -url "file:////\computername\sharename*" FullTrust -exclusive on
Check this KB for details... http://support.microsoft.com/kb/320268/
I just ran into this very same problem - trying to compile a Silverlight application inside Parallels Desktop 8 virtual machine on a Mac - where the SL output directory was located on the emulated drive (appears in Windows as a network drive).
Very simple fix. You can open up devenv.exe.config located in C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE and add this line inside the <Runtime> node:
<loadFromRemoteSources enabled="true"/>
e.g.
<?xml version ="1.0"?>
<configuration>
<configSections>
<section name="msbuildToolsets" type="Microsoft.Build.BuildEngine.ToolsetConfigurationSection, Microsoft.Build.Engine, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</configSections>
...
<runtime>
<loadFromRemoteSources enabled="true"/>
...
To edit the devenv.exe.config file you will also need to open NotePad as administrator. After doing the above I can compile my SL application inside Parallels Virtual Machine, but the above also applies to Silverlight applications hosted on a network drive.
I ran into this. These were the steps I took:
Downloaded a file, WP7PiChartsFromDBSOUP.dll, to my downloads folder (everything locally).
Copied this file to c:/Program Files/ referenced it and attempted to build.
Got this error message.
Removed the reference, and followed the steps to unblock.
Referenced and attempted to build: still same error.
Went back to c:/Program files and noted that the file was still blocked. Somehow my attempt to block didn't take. So I tried to unblock, closed the properties dialog, then reopened. Somehow my attempt to unblock didn't appear to be working.
Went to the downloads folder and unblocked the file that was downloaded to this location, tried to unblock, and it seemed to work. So I felt like I was out of the woods. I copied this file over the file in c:/Program Files and reference it in VS2010, closing and reopening VS2010.
Same error message. I rebooted the machine and tried again. Same error message. And I know this is gonna sound crazy, but I renamed the dll from that long name to PieChart.dll.
And it finally worked.
So, either there was a problem with the name, or maybe changing the name somehow caused the change in blocked status to kick in.
I had the same problem trying to build an application on parallels.
I just copied the whole project in a folder under c:/ and works
it seems that parallels shares certain folders (i.e. desktop, documents) between the OS running on the vm and your mac user home folder. because of that windows treats these folders as network shared folder and forbids you to access them.
It's on the General tab in file properties from explorer. Either via the DLL in question, or you can do it on the zip file before you extract if it was a download, there will be an unblock button at the bottom right.
Make sure it's from a trusted source.
I've tried many solutions also with coping file to external usb drive with FAT32 file format, and some other ideas. But finally I've found post by caliban here: Topic about this problem. He links to a program called Streams which helped solving this problem :)
caliban:
Run this line in the command line
streams -s -d directory
download Streams exe
Add to the project a text file named ServiceReferences.ClientConfig having the following contents:
<configuration>
<runtime>
<loadFromRemoteSources enabled="true"/>
</runtime>
</configuration>
Re-build the project.
If you still didn't get your answer, I just found the solution. You are saving the application into the network hardrive. So while creating the application, change the location to something like your local disk e.g.,
C:/Projects
Then you will be able to run it.
I had the same problem over VMWare using a mac to load windows 7, if you see the path it starts like a network path, that's why VS gives out about the security.
Take the entire folder project and put it in a physical path starting with C://program files... , then open and compile, it will work.
Right click on the dll and select properties. You should see a button to unblock the assembly.

Resources