server.mappath returning wrong path - asp.net

Sever.mappath is returning wrong path that is I think it is converting the initial part of the path to lowercase which is the problem;
String path = Server.MapPath("~/UploadImages/");
When I check for the path in my page by storing it in a textbox it returns:
c:\users\dell\documents\visual studio 2013\Projects\OFR\OFR\UploadImages\
instead of
C:\Users\DELL\Documents\Visual Studio 2013\Projects\OFR\OFR\UploadedImages
What can I do to get the proper path?

It is just spell mistake. you have to write like this
String path = Server.MapPath("~/UploadedImages/");
which will give your expected path
C:\Users\DELL\Documents\Visual Studio
2013\Projects\OFR\OFR\UploadedImages
Instead of UploadImages use UploadedImages.

Related

How to write a function to change "\" to "/" in R

Firstly, I understand that "\" is an R escape character and also the file path separator on windows.
I know that it can be escaped by using either / or \.
I am developing a package and I want a function for the user to literally just be able to call it like:
makeFileLocationRCompatable("H:\Temp")
and for the function to return
"H:/Temp"
or
"H:\\Temp"
but it seems to be impossible in R due to the fact that \ escapes the following character.
I don't want my users to have to change the way they input the file path.
Any ideas?
You can use Rstudio snippetsaddin to convert the slash
download it from here.
devtools::install_github("sfr/RStudio-Addin-Snippets", type = "source")
Restart Rstudio.
Select the path or the code where slashes needs to be replaced.
Click on Addin -> select convert slash
It will reverse all slashes if the path is selected.
normalizePath from the base package might provide this functionality? (I cannot test on Windows myself; sorry if this is a moot proposal)
For example
normalizePath('H:\\Temp', winslash = '\\')
See also ?normalizePath

Error while bootstrapping cloudify nodecellar example on localhost using virtualenv

executing bootstrap validation
Invalid input:
inputs.yaml. inputs must represent a dictionary.
Valid values can either be a path to a YAML file, a string formatted as YAML or a string formatted as key1=value1;key2=value2
How to solve this problem??
Since there are a lot of missing details in your question, I'll try to explain what could be the answer:
You didn't give the right path to the input.yaml file.
The path could be relative to your working directory, or a full path, but either way it must lead to the file.
Your input file is not formatted correctly.
An input.yaml file should include a dictionary of keys and values as in: image: 'redhat_santiago'. Tabs are not allowed, only spaces. All keys should be aligned to the same column.
Please try to check the above, in the future it would be better if you add the input file and the command you are using.
Best,
Jonathan

How to convert xls to xlsx in vb.net?

I am using a resource file(abc.xls) in my project.
" IO.File.WriteAllBytes(tempPath, My.Resources.abc) "
But i want to use abc.xlsx instead of abc.xls without changing resourse file.
can I do saveAs? how?
or please give any other solution.
Thanks.......
Not sure what you exactly want to do, but I'll try to answer the second portion of your question.
'Make a path where you want to save the file
Dim Path as String
Path = "C:\Programs\blabla\"
Dim Final As String
Final = Path & "Filename.xlsx"
YourWorkBook.SaveAs(Final)
Or just try searching google for a more detailed explanation. (You've given little no none info, showing very little research made)
Try searching "How to save excel file in vb.net"

How to use URL path as a file name to download?

I want to download these 2 app.zip files from a server:
https://tempapps.myserver.com/apps%2FNews%2Fapp.zip
https://tempapps.myserver.com/apps%2Fsports%2Fapp.zip
When I download these files with mozilla, it downloads them as apps_news_app.zip and apps_sports_app.zip.
I want to achieve the same in my program.
To get normal-human readable url from percent-encoded one:
QString humanReadable = QUrl::fromPercentEncoded("https://example.com/something%20here.zip");
To get percent-encoded url:
QUrl myUrl("https://example.com/something here.zip");
QString percentEncoded = myUrl.encoded();
For more information, be sure to visit the QUrl documentation.
If using java, you would use something like
String newUrl = "whatever the url is".replace("\%2F", "_");
Open http://doc.qt.io/qt-5/qstring.html and scroll to replace for info.
BTW, I am not sure about the backslash. If the above doesn't work, try different combinations of backslash or not before those argument strings.

Difference between ../ and ..// in a file path

I am using a relative file path in one of the cs file to get a location to save an image.
Is there any difference in using ../ and ..// for getting the path.
I don't know if your slashes are actually backslashes, but in c#, you have to escape backslashes.
var path = "..\\file.txt";
path's value is actually ..\file.txt, because the "\" is actually one (escaped) backslash.
However, if it is:
var path = #"..\file.txt";
then it is the same. The # means you want the string as-is, without any escaping, so both "path" variables are the same.
On Unix, and I think MS-DOS and hence Windows follows Unix closely enough here that it is not a difference between the systems, then you can have any number of consecutive slashes at any point in a pathname and it is equivalent to a single slash. Consequently, your two examples are equivalent.
Note that on Windows, a double slash at the start of a path name indicates a UNC path - a machine name followed by a path on that machine.

Resources