FtpWebRequest and foreign characters/utf-8 characters - utf-8

When using FtpWebRequest to list files and folders, can I list names with foreign characters?
A file name with 3 Chinese characters will come accross as "???" when enumerating files with FtpWebRequest:
-rwxr-xr-x 1 user group 1800 Dec 22 16:13:10 ???
Am I doing something wrong, or does FtpWebRequest not support this?
my code is derived from the example here:
http://msdn.microsoft.com/en-us/library/ms229716.aspx
Thanks,
Bryan

If its just a string, try to use Encoding.Convert() method which can convert the file name from ome encoding to another. (Add System.Text)
http://msdn.microsoft.com/en-us/library/kdcak6ye.aspx

Related

How to Ignore or permanently block the files, which contain date or date+time in their filenames, from being detected by Git as files added/modified

As I mentioned in the Q-title, I have some files whose names contain either date string or date+time timestamp in their names which are in the project configured with Git.
File names with dates or timestamps(date+time) are like below:
....
....
FileName1_18-07-2022.php
FileName2_18-07-2022_10-28-17_PM.vue
FileNameOther1_18-07-2022_10-28-28_PM.vue
....
....
And there are more than 20s of such files, which I want permanently ignored from Git detection. Filename can have numbers but when they contain exact date format strings(like shown in the examples above) in their names they must not be detected by Git whenever created/modified.
I know there are 2 methods for this, one is .gitignore and other is in Project's .git/info/exclude and I know couple wildcards like * and ?, but can't figure out how to block those files that have date or date+time in their names.
Anyone can help figure this out ?
Note: "_PM" or "_AM" are optional and apparently they would be only present if Filename contains full date+time string. And date or date+time strings will always be in exact pattern as shown in list above. No other pattern of date/date+time is there, positively.
Add to your .gitignore:
*_??-??-????[._]*
This will match files with a date followed by a dot or an underscore, and is unlikely to match anything else.
With the help of John Kugelman's answer and some of turek's nice suggestions from comments I came up with a pattern that won't have any issue from year 1000 until year 9999 ;).
So this perfectly matches all filename patterns that I have in my project and successfully ignores those files when this pattern is added in either .gitignore or .git/info/exclude file:
*_[0123][0-9]-[01][0-9]-[1-9][0-9][0-9][0-9][._]*.php
*_[0123][0-9]-[01][0-9]-[1-9][0-9][0-9][0-9][._]*.vue
If anyone wants to block all file extensions then they can use this:
*_[0123][0-9]-[01][0-9]-[1-9][0-9][0-9][0-9][._]*.*
Thanks both John and turek for help. Anyone having any suggestions or point-outs feel free to mention in comments below.

BASH - How to delete all numerals from a text file, unless they are part of a specific string?

I have a text file, and I want to delete all the numerals included in them. However, there are two key strings "9/11" and "September 11", in which I want to keep the numerals. How can I delete all the numerals except when they are a part of these key strings?
I use sed 's/[0-9]*//g' to get rid of the numerals. So for now, the sample text before processing would be something like this:
12 Aug. 2002, News Section. 9/11 was a terrible tragedy for the nation, in which 2,500 ...
And I want the file after processing to look like this:
Aug. , News Section. 9/11 was a terrible tragedy for the nation, in which ...
I tried searching for the answer, but to no avail. Thanks in advance for any suggestions.
This will do the job. It's like a kind of capturing the part we want to stay and matching the part you want to remove. So by replacing all the matched characters with the chars present inside group index 1 will make the captured chars to stay and the other matched chars to leave.
sed 's~\(\b9/11\b\|\bSeptember 11\b\)\|[[:digit:]]~\1~g' file
DEMO

How to create a cfcollection / verity collection with a UTF-8 character in the name?

I'd just like to be able to use a UTF-8 character in the name of the collection. We base our code logic on the names of the collections which are related to a given company. This new company has an abbreviation of XØZ3, and both the CFAdminstrator and cfcollection seem to have issues with using the ø in the collection name.
The errors presented are:
Unable to create collection peoplexscvdocsXØZ3.
Unable to create collection peoplexscvdocsxøz3.
An error occurred while creating the collection: com.verity.api.administration.ConfigurationException: Fail to create the index. (-6220)
If verity doesn't accept UTF-8 and there isn't a work around, I guess you'll have to
have 2 fields, one with ascii based version of the character, one with the html/xml version of the character
pass through the ascii version of the characters when searching the collection to match
so you'd have:
plaintext: XOZ3
XMLText: X&#216Z3;
And a function that takes Ø and changes it to O when searching verity on the plaintext field and return the matching XMLText field

Whats the right name for fixed position files?

You can structure data in various ways: for example comma separated or tab separated.
But you can also structure data on positions. So, for example, the first 20 characters are meant for a phone number, the following 2 characters are meant for the age of someone etc...
How would you call such a file in general?
If you had id[3]name[5]phone[6]
001Liz 882833
002Paul 892733
003John 927477
this is a fixed format file.

How to read title and id from Blu-ray disc?

Is it somehow possible to fetch Blu-Ray Disc id and title programmatically on Windows7+ platform?
If you can programmatically open the following files you'll probably get what you need:
/AACS/mcmf.xml - This file is the Managed Copy manifest file and will contain a 'contentID' attribute (in the mcmfManifest tag) that can be used to identify the disc. Typically it is a 32 hexadecimal digit string.
There is sometimes, also an /CERTIFICATE/id.bdmv file which contains a 4 byte disc organization id (at byte offset 40) followed by a 16 byte disc id.
Sometimes, there is metadata information in the /BDMV/META/DL directory in the XML file bdmt_eng.xml (replace eng for other 3 letter language codes for other languages). For example on the supplemetary disc of The Dark Knight I see this file contains:
<di:title><di:name>The Dark Knight Bonus Disc</di:name></di:title>
For .NET, the BDInfo library will parse the relevant disc structure.

Resources