天道酬勤,学无止境

preserve

Loop through folders and only copy files that match certain criteria

Question I am writing a program that copies certain files needed from one folder to another. However, I only want it to copy files that fit certain criteria, More specifically, it should only copy files that are not in the banned files, banned extensions, or banned folders list as stored in an array like this: Public BannedExtensions As String() = {".bak", ".bak2", ".cry", ".max", ".psd", "log", ".lib", "pdb", ".exp"} Public BannedFolders As String() = {"Tools", "Editor", "Code", "LogBackups", "statoscope", "BinTemp", "USER", "rc"} Public BannedFiles As String() = {"Editor.exe", "error.bmp",

2022-05-08 02:54:04    分类:技术分享    vb.net   loops   file-io   copy   preserve

Can XmlStarlet preserve CDATA during copy?

Question How can I make XmlStarlet preserve CDATA when using copy? The <![CDATA[ ]]> must be maintained because the application that generated (and uses) the data insists on having the CDATA directive around certain data. Example.xml <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <RSLogix5000Content SchemaRevision="1.0" SoftwareRevision="20.01" > <Controller Use="Target" Name="SOME_TARGET_NAME" ProcessorType="1789-L60"> <Tags> <Tag Name="gstrScrap" TagType="Base" DataType="STRING" Constant="false" ExternalAccess="Read/Write"> <Data>05 00 00 00 53 43 52 41 50 00 00 00 00 00 00 00 00 00

2022-02-10 17:38:27    分类:技术分享    copy   cdata   xmlstarlet   preserve

How does angular application handle refresh page and could we use $history on loading directives

Question So two questions. How does angular applications handle refresh page, b/c from what I heard, $rootScope destroy() on refresh and application gets re-run and re-config -ed, and I was wondering if there's an elegant way to preserve the $rootScope without having to store $rootScope variables as a string into a storage. If I load a template on a directive that loads a modal on the page, is it possible to configure history to not navigate but to revert the open modal. and due to validations and such, I do not think it is possible to implement same function using href. Answer1 If your url's

2021-12-10 00:34:35    分类:技术分享    angularjs   scope   refresh   history   preserve

How to preserve matlab struct when accessing in python?

Question I have a mat-file that I accessed using from scipy import io mat = io.loadmat('example.mat') From matlab, example.mat contains the following struct >> load example.mat >> data1 data1 = LAT: [53x1 double] LON: [53x1 double] TIME: [53x1 double] units: {3x1 cell} >> data2 data2 = LAT: [100x1 double] LON: [100x1 double] TIME: [100x1 double] units: {3x1 cell} In matlab, I can access data as easy as data2.LON, etc.. It's not as trivial in python. It give me several option though like mat.clear mat.get mat.iteritems mat.keys mat.setdefault mat.viewitems mat.copy mat.has_key mat.iterkeys mat

2021-12-08 22:24:39    分类:技术分享    python   matlab   structure   mat-file   preserve

JAXB: How to keep consecutive spaces as they are in source XML during unmarshalling

Question I am using JAXB to unmarshall an XML message. It seems to replace multiple consecutive spaces by a single space. <testfield>this is a test<\testfield> (several spaces between a and test) upon unmarshalling, the above becomes: this is test How do I keep consecutive spaces as they are in source XML? Answer1 From the msdn page: Document authors can use the xml:space attribute to identify portions of documents where white space is considered important. Style sheets can also use the xml:space attribute as a hook to preserve white space in presentation. However, because many XML

2021-11-08 18:38:42    分类:技术分享    space   preserve

Use dplyr to summarize but preserve date of group row

Question I have a data frame like the following: Date Flare Painmed_Use 1 2015-12-01 0 0 2 2015-12-02 0 0 3 2015-12-03 0 0 4 2015-12-04 0 0 5 2015-12-05 0 0 6 2015-12-06 0 1 7 2015-12-07 1 4 8 2015-12-08 1 3 9 2015-12-09 1 1 10 2015-12-10 1 0 11 2015-12-11 0 0 12 2015-12-12 0 0 13 2015-12-13 1 2 14 2015-12-14 1 3 15 2015-12-15 1 1 16 2015-12-16 0 0 I'm trying to find the length of each flare as well as the total med use during each flare using dplyr. My current solution (inspired by Use rle to group by runs when using dplyr), df %>% group_by(yy = {yy = rle(Flare); rep(seq_along(yy$lengths), yy

2021-10-26 21:29:42    分类:技术分享    r   dplyr   time-series   summarize   preserve

Redim Preserve gives 'subscript out of range'

Question I want to Redim Preserve an array I keep getting the error 'subscript out of range'. I am aware of the fact that only the size of the last dimension can be changed. That is exactly what I am doing. What is going wrong over here? The type of the array is Variant. BmMatrix = Sheets("BENCH").Range("a60", ActiveSheet.Range("a60").End(xlDown).End(xlToRight)) 'totaal gewicht per subdeel in array wegschrijven Dim aBmMatrix() aBmMatrix = BmMatrix rij = UBound(BmMatrix, 1) kol = UBound(BmMatrix, 2) + 1 ReDim Preserve aBmMatrix(rij, kol) TotGewKol = UBound(aBmMatrix, 2) For i = 2 To UBound

2021-09-11 19:07:45    分类:技术分享    arrays   vba   excel   subroutine   preserve

array_splice preserving keys

Question I faced the situation that splicing arrays with preserved-keys, so I made the following function. I reached the solution that wrapping each items with array, but there seems to be some memory-inefficient statements. Have you any ideas? Thank you. array_splice_pk This preserves keys, differently from array_splice. Overview: &$input -> same as array_splice one. $key -> target key. $use_key_as_offset -> use $key parameter as a numeric offset. $length -> same as array_splice one. $replacement -> same as array_splice one. But you can also provide key for each value. Code: function array

2021-07-12 13:00:19    分类:技术分享    php   arrays   array-splice   preserve

Merge file from one barnch to another branch in Clearcase

Question I want to merge a file from one branch to another branch in clearcase, for example from Offshore branch to DEV branch. I want to merge the file with its modification time as it is. If the modification date of a file (example.asp) is 12-02-2011, after merging the file in DEV branch, the modification time for the file (example.asp) in DEV branch should hold the same modification time (12-02-2011). Which view should I take? how should I do merge? Note: I tried preserve modification time option while checkin and checkout during merging. Answer1 The view is easy: when merging, always do so

2021-07-10 06:28:46    分类:技术分享    view   merge   timestamp   clearcase   preserve

Why `git rebase -p` does not preserve conflict resolutions?

Question Has the man page states about git rebase --preserve: Merge conflict resolutions or manual amendments to merge commits are not preserved. Is there any good reason for that? Answer1 It would be the same reason for the existence of the command git rerere (Reuse recorded resolution of conflicted merges) See "rerere your boat" and "Fix conflicts only once with git rerere". Git does not record merge conflict resolution for any merge (including the one done again during a rebase -p) Basically, a conflict merge resolution is a manual step (meaning a human decision has to be made), which git

2021-06-23 18:59:37    分类:技术分享    git   rebase   preserve