copy

Recursive folder synchronization using VBScript (Mirror Folders)

醉酒当歌 提交于 2020-01-14 06:48:06
问题 I've never really written in vbs (once wrote a script that would welcome me on boot) but I'm after a script to essentially perform : robocopy "folder1" "folder2" /MIR At the moment what I've got is a copied script from here VBS Mirror, Using the top script : This code synchronizes the contents (files and subfolders) of two folders. Each folder is traversed recursively and any missing subfolders and files are copied both ways. If corresponding folders contain files with matching file names but

why File.copy works but File.OpenRead prompts access denied?

落爺英雄遲暮 提交于 2020-01-13 16:30:34
问题 I want to copy an encrypted file which is being used by another process. This works: System.IO.File.Copy("path1", "path2",true); but the below code is not working. Prompts "file access denied" error: using (FileStream fileStream = new FileStream(fileName, FileMode.Open, FileAccess.Read))//access denied open file { using (Stream copyFileStream = new StreamDecryption(new FileStream(copyTo, FileMode.Create))) { } } How can i copy an encrypted file if file is used by another process? Thanks

Is there a back_inserter variant that takes advantage of move?

爷,独闯天下 提交于 2020-01-13 11:43:08
问题 In generic code I was trying to tell an output iterator (in practice a std::back_inserter_iterator to move a range of elements. To my surprise it looked as if elements were moved in a move-to-back_inserter operation. #include<algorithm> // move #include<iterator> // back_inserter #include<vector> int main(){ std::vector<std::vector<double> > v(10, std::vector<double>(100)); std::vector<std::vector<double> > w; assert( not v[0].empty() and w.size() == 0 ); std::copy(v.begin(), v.end(), std:

Is there a back_inserter variant that takes advantage of move?

谁说我不能喝 提交于 2020-01-13 11:43:08
问题 In generic code I was trying to tell an output iterator (in practice a std::back_inserter_iterator to move a range of elements. To my surprise it looked as if elements were moved in a move-to-back_inserter operation. #include<algorithm> // move #include<iterator> // back_inserter #include<vector> int main(){ std::vector<std::vector<double> > v(10, std::vector<double>(100)); std::vector<std::vector<double> > w; assert( not v[0].empty() and w.size() == 0 ); std::copy(v.begin(), v.end(), std:

unterminated CSV quoted field in Postgres

送分小仙女□ 提交于 2020-01-13 10:39:30
问题 I'm trying to insert some data into my table using the copy command : copy otype_cstore from '/tmp/otype_fdw.csv' delimiter ';' quote '"' csv; And I have this answer : ERROR: unterminated CSV quoted field There is the line in my CSV file where I have the problem : 533696;PoG;-251658240;from id GSW C"; This is the only line a double quote and I can't remove it, so do you have some advice for me ? Thank you in advance 回答1: If you have lines like this in your csv: 533696;PoG;-251658240;from id

What is the best way to load a massive amount of data into PostgreSQL?

对着背影说爱祢 提交于 2020-01-13 06:29:07
问题 I want to load a massive amount of data into PostgreSQL. Do you know any other "tricks" apart from the ones mentioned in the PostgreSQL's documentation? What have I done up to now? 1) set the following parameters in postgresql.conf (for 64 GB of RAM): shared_buffers = 26GB work_mem=40GB maintenance_work_mem = 10GB # min 1MB default: 16 MB effective_cache_size = 48GB max_wal_senders = 0 # max number of walsender processes wal_level = minimal # minimal, archive, or hot_standby synchronous

Java copy part of InputStream to OutputStream

Deadly 提交于 2020-01-13 04:47:13
问题 I have a file with 3236000 bytes and I want to read 2936000 from start and write to an OutputStream InputStream is = new FileInputStream(file1); OutputStream os = new FileOutputStream(file2); AFunctionToCopy(is,os,0,2936000); /* a function or sourcecode to write input stream 0to2936000 bytes */ I can read and write byte by byte, but it's to slow (i think) from buffered reading How can do I copy it? 回答1: public static void copyStream(InputStream input, OutputStream output, long start, long end

Copy java object/class from one classloader to another classloader

佐手、 提交于 2020-01-12 15:51:12
问题 Hi is there a way to copy one class loaded context (atrributes etc) from one classloader (for instance a 'made' class Point) to another classloader? Making clear, Example: I have an object Point on CL 1. Now running on another CL2, I want to creat this object in CL 3. Some obj: class Point { int x; int y; public Point() {} //getters and setters Scenery: ... class CL2 { // Running on CL 2 ... // Point obj from CL 1 Object point = gotFromCL1(); // Want to create the object on Cl2 Object

Create file in resources/source folder in java programmatically?

。_饼干妹妹 提交于 2020-01-12 13:51:11
问题 I have two resources folders. src - here are my .java files resources - here are my resources files (images, .properties) organized in folders (packages). Is there a way to programmatically add another .properties file in that resources folder? I tried something like this: public static void savePropertiesToFile(Properties properties, File propertiesFile) throws IOException { FileOutputStream out = new FileOutputStream(propertiesFile); properties.store(out, null); out.close(); } and before

How to change slow parametrized inserts into fast bulk copy (even from memory)

梦想与她 提交于 2020-01-12 10:09:31
问题 I had someting like this in my code (.Net 2.0, MS SQL) SqlConnection connection = new SqlConnection(@"Data Source=localhost;Initial Catalog=DataBase;Integrated Security=True"); connection.Open(); SqlCommand cmdInsert = connection.CreateCommand(); SqlTransaction sqlTran = connection.BeginTransaction(); cmdInsert.Transaction = sqlTran; cmdInsert.CommandText = @"INSERT INTO MyDestinationTable" + "(Year, Month, Day, Hour, ...) " + "VALUES " + "(@Year, @Month, @Day, @Hour, ...) "; cmdInsert