This is supposed to prefix the given path:
date = Date(2016, 6, 3)
const FILEDATE_FORMAT = "YYYYmmdd"
const FILE_PATH_FORMAT = "/YYYY/mm/"
joinpath(
"path-prefix",
Dates.format(DateTime(date), FILE_PATH_FORMAT),
Dates.format(DateTime(date), FILEDATE_FORMAT)
)
Expected: "/path-prefix/2016/06/20160603"
Actual: "/2016/06/20160603"
What is wrong here?
On Linux, / is the root directory. Since your FILE_PATH_FORMAT begins with the character /, joinpath is interpreting this as the root directory, and, as per the behaviour of that function, everything that comes before it is omitted since the path is already absolute.
The solution is to just drop the leading / from FILE_PATH_FORMAT.
By the way, I need to use yyyy, not YYYY on my system. Not sure why YYYY works for you...
Related
I am trying to set the dictionary option (to allow autocompletion of certain words of my choosing) using wildcards in a filename glob, as follows:
:set dict+=$VIM/dict/dict*.lst
The hope is that, with this line in the initially sourced .vimrc (or, in my case of Windows 10, _vimrc), I can add different dictionary files to my $VIM/dict directory later, and each new invocation of Vim will use those dictionary files, without me needing to modify my .vimrc settings.
However, an error message says that there is no such file. When I give a specific filename (as in :set dict+=$VIM/dict/dict01.lst ), then it works.
The thing is, I could swear that this used to work. I had this setting in my .vimrc files since I started using Vim 7.1, and I don't recall any such error message until recently. Now it shows up on my Linux laptop as well as my Windows 7 and Windows 10 laptops. I can't remember exactly when this started happening.
Yes, I tried using backslashes (as in :set dict+=$VIM\dict\dict*.lst ) in case it was a Windows compatibility issue, but that still doesn't work. (Also this is happening on my Linux laptop, too, and that doesn't use backslashes for filepaths.)
Am I going senile? Or is there some other mysterious force going on?
Assuming for now that it is a change in the latest version of Vim, is there some way to specify "use all the dictionary files that fit this glob"?
-- Edited 2021-02-14 06:17:07
I also checked to see if it was due to having more than one file that fits the wildcard glob. (I thought that if I had more than one file that fit the wildcard, the glob would turn into two filenames, equivalent to saying dict+=$VIM/dict/dict01.lst dict02.lst which would not be syntactically valid.) But it still did not working after removing extra files so that only one file fit my pathname of $VIM/dict/dict*.lst . (I had previously put another Addendum here happily explaining that this was how I solved my problem, but it turned out to be premature.)
You must expand wildcards before setting an option. Multiple file names must be separated by commas. For example,
let &dictionary = tr(expand("$VIM/dict/dict*.lst"), "\n", ",")
If adding a value to a non-empty option, don't forget to add comma too (let is more universal than set, so it's less forgiving):
let &dictionary .= "," . tr(expand(...)...)
In Julia, I can get the current directory from
#__DIR__
For example, when I run the above in the "Current" folder, it gives me
"/Users/jtheath/Dropbox/Research/Projects/Coding/Current"
However, I want it to return one folder above the present folder; i.e.,
"/Users/jtheath/Dropbox/Research/Projects/Coding"
Is there an easy way to do this in a Julia script?
First, please note that #__DIR__ generally expands to the directory of the current source file (it does however return the current working directory if there are no source files involved, e.g when run from the REPL). In order to reliably get the current working directory, you should rather use pwd().
Now to your real question: I think the easiest way to get the path to the parent directory would be to simply use dirname:
julia> dirname("/Users/jtheath/Dropbox/Research/Projects/Coding/Current")
"/Users/jtheath/Dropbox/Research/Projects/Coding"
Note that AFAIU this only uses string manipulations, and does not care whether the paths involved actually exist in the filesystem (which is why the example above works on my system although I do not have the same filesystem structure as you). dirname is also relatively sensitive to the presence/absence of a trailing slash (which shouldn't be a problem if you feed it something that comes directly from pwd() or #__DIR__).
I sometimes also use something like this, in the hope that it might be more robust when I want to work with paths that actually exist in the filesystem:
julia> curdir = pwd()
"/home/francois"
julia> abspath(joinpath(curdir, ".."))
"/home/"
I try to use the like-Button and therefor the open graph.
My problem is, that "&" and "$" chars are always replaced by & and %24
Of course, thats the normal case, but I need a clean $ and no entity there, becuase otherwise the link is not working for this image.
I could see, that facebook´s raw output produces \u0024 and so on (seems to be XKBSymbols). But if I try to put this symbols in the link in my typo3 meta-tag, it doesnt work either.
I already tried:
#page.headerData.12345.htmlSpecialChars = 0
#page.headerData.12345.htmlSpecialChars.preserveEntities = 1
#page.headerData.12345.rawUrlEncode = 0
to solve this problem, but none of those work.
Please give me a useful hint.
Thanks
try to write to your php code trough htmlspecialchar php function and add it to header with
$GLOBALS['TSFE']->additionalHeaderData['somekey'] = '...'
I am having problem with checking the existence of the directory.
i take path from user input (e.g QLineEdit) and check for directory exists or not and if user specify the path "K:\" (k drive does not exists at all) my code becomes like this
QDir tmp("K:\\");
if(tmp.exists())
return true;
else
return false;
Ideally it should return false, as the Driver Letter "K" is not mapped, but unfortunately it returns true all the time, does anyone have any idea why is it like that? or
what is the correct method to check the existence of the directory?
Two suggestions:
Try tmp.makeAbsolute()
If that doesn't work, try substituting QDir tmp ("K:/"); (Unix forward slash instead of DOs/Windows backslash).
More beautiful way to check for drives is QDir::drives() method. Also you need to use platform independent directory seperator for QDir::exists().
Super simple example:
var Path:String="E:\SWF Security\Acess Current Path\Access SWF URL.swf"
var Path1:Array = Path.split("\\") // Split using the backslash as delimiter (No limit the number of returned tokens)
trace(Path1)
What do you expect path1 to be ?
E: ?
No its E:SWF SecurityAcess Current PathAccess SWF URL.swf and i have no idea why.
In this situation you should use forward-slash instead of back-slash in your path. AS3 will treat them as the same when you're trying to load a file.
Then you can split using Path.split("/");