filenames

How to get minimal absolute path from relative path without any permission checks?

风格不统一 提交于 2019-12-11 02:20:50
问题 Say, I have two path strings, an absolute one such as @"C:\abc\xyz" , and a relative one such as @"..\def" . How do I reliably combine those to yield the minimal form @"C:\abc\def" ? As the process should work for any forms of path that .NET's I/O API supports (i.e. the native paths of the system that .NET or Mono is currently running on, or alternatively something like UNC paths and the like), manual string manipulation seems to be too unreliably a solution. In general, the tidy way to

boost build - sources with the same name

你说的曾经没有我的故事 提交于 2019-12-11 01:17:56
问题 src |--Manager.cpp |--Specializations | |--Manager.cpp Building this Boost.Build tries to create /bin/... |--Manager.o |--Manager.o but fails. How to resolve this automatically? I read FAQ item, but I don't like the solution, as I have to fix things manually when I have a same class name, but different namespace. Would it be possible to make Boost.Build automatically prefix object file names with directory? /bin/... |--Manager.o |--Specializations.Manager.o Or duplicate the source directory

Batch file to copy files from a file contents

馋奶兔 提交于 2019-12-10 23:57:06
问题 I have a master file ( File1.txt ) where some names are maintained in the contents. I have to find all the files which has those kind of names (wild cards) in a folder and move them to a different folder using batch file program. Eg : File1.txt has contents abcd efgh now in the folder say c:\temp\Source i have files like 12abcd34.asc 56efgh78.asc testing.asc I have to move only those 2 files to a folder say c:\temp\Target. Here's my code, but it gives error saying i*.* is unexpected at this

SyntaxException with Neo4j LOAD command

这一生的挚爱 提交于 2019-12-10 20:42:41
问题 I'm using neo4j 2.1.2 for windows I was attempting to use Neo4j's load csv command but I get the following error... neo4j-sh (?)$ load csv with headers "file:../test/unclaimed.csv" AS csvLine MERGE (o:Original_Transaction_Number { value: csvLine.OTN }) MERGE (i:Institution {name: csvLine.Institution }) MERGE (i)<-[:TRANSACTION_OF]-(o) ; SyntaxException: Invalid input 'l': expected <init> (line 1, column 1) "load csv with headers "file:../test/unclaimed.csv" AS csvLine" ^ infact I get the same

Variable name to string in Python

我是研究僧i 提交于 2019-12-10 17:33:11
问题 I have written some code in Python and I would like to save some of the variables into files having the name of the variable. The following code: variableName1 = 3.14 variableName2 = 1.09 save_variable_to_file(variableName1) # function to be defined save_variable_to_file(variableName1) should create 2 files, one named variableName1.txt and the other one variableName2.txt and each should contain the value of the corresponding variable at the time the function was called. This variable name is

Renaming an image created from an HTML5 canvas

你说的曾经没有我的故事 提交于 2019-12-10 17:03:13
问题 I have made a simple canvas and save it as an image. I have done this with the help of this code: var canvas = document.getElementById("mycanvas"); var img = canvas.toDataURL("image/png"); and pop up the created image with this: document.write('<img src="'+img+'"/>'); But its name is always a weird one. I want to rename the image name like faizan.jpg etc. How can I do this? 回答1: To put it simply, you can't. When you call the toDataURL method on an HTMLCanvasElement it generates a string

Translate url to a valid file name and back to url

佐手、 提交于 2019-12-10 16:41:48
问题 I need to store some information that is unique for each site that my users accesses. (It is actually a thumbnail of the site that he has looked at.) This thumbnail (jpeg file) needs to have a name indicating which site it represents so that it can be viewed later on. Can you recommend a simple translation from url to a valid file name and back? Example: www.ibm.com could be mapped to www_ibm_com . I am not sure that this will always work with all valid urls in some cases urls have very

How to download a file with its original filename from GAE's blobstore?

狂风中的少年 提交于 2019-12-10 16:24:21
问题 Once you upload a file to the blobstore, it renames it something like "s9QmBqJPuiVzWbySYvHVRg==". If you navigate to its "/serve" URL to download the file, the downloaded file is named this jumble of letters. Is there a way to have the downloaded file retain its original filename when uploaded? 回答1: When the file is uploaded using the BlobUploadHandler the original filename is stored as name property in the newly created BlobInfo entity. In the blob serve handler, you can specify that the

How does Instagram name files

拜拜、爱过 提交于 2019-12-10 16:24:19
问题 How does Instagram name files, are the file names random? based on some sort of hash? or is there some meaning to them? for example http://distilleryimage2.instagram.com/21a9ca729bf511e2985c22000a1f9ad3_7.jpg 回答1: Good answer - The blog post is out of date now as their naming has changed, but it's probably still based on MD5. 回答2: After further inspection, I think it's just an MD5 hash or something followed by _# for the image size 回答3: Instagram uses an MD5 hash as the base name, followed by

Linux file names & file globbing

别来无恙 提交于 2019-12-10 15:58:57
问题 I have a list of files named: file000 file001 file002 file003 ... file1100 How can I match all files that have a number greater than 800 but less than 1000 ? I am using linux bash Thank you Edit Actually, my files are named like: ab869.enc cp936.enc g122345.enc x2022.enc abc8859-14.enc aax5601.enc cp936-1.enc so the first solution dont match the correct files :( How can I match files that have number between 800-999 ? 回答1: *[89][0-9][0-9].enc That uses Bash's "pathname expansion" feature (aka