SAS : how copy a folder containing subfolders - sas

I want copy a folder containing subfolders in SAS:
Example of the folder that I want copy :
folder_to_copy/
├─ sub_folder_1/
├─ sub_folder_2/
│ ├─ file_sub1
│ ├─ file_sub2
│ ├─ file_sub3
├─ file1/
├─ file2/
I've try
option xwait xsync;
X copy "folder_to_copy" "new_folder";
But this copy only file1 and file2
and
data _null_;
call system ('cp folder_to_copy new_folder');
run;
doesn't work too, this does nothing

Use cp -R if you're using Linux.
x 'cp -R folder_to_copy new_folder';
Use robocopy /E if you're using Windows.
x 'robocopy folder_to_copy new_folder /E';

Related

Share common test code between multiple packages in rust

I am having common functionality that I want to reuse in junit tests that live in different packages and I don't know how to do it. I've tried with different modules and libs but something is not working. My current structure looks something like this:
.
├── Cargo.lock
├── Cargo.toml
├── foo
│ └── bar
│ └── baz
│ ├── template
│ │ ├── Cargo.lock
│ │ ├── Cargo.toml
│ │ └── src
│ │ └── tests
│ │ ├── mod.rs
│ │ └── test1.rs
│ │
│ └── template_implementation
│ ├── Cargo.lock
│ ├── Cargo.toml
│ └── src
│ └── tests
│ ├── mod.rs
│ └── test2.rs
│
└── utils
└── testpackage
├── Cargo.toml
├── lib.rs
└── common.rs
So in common.rs I have something like this:
/// setup for tests
pub fn setup() { ... }
pub fn mock_x() { ... }
pub fn mock_y() { ... }
lib.rs looks like this:
#[cfg(test)]
pub mod common;
I want to use those functions in common.rs in both test1.rs and test2.rs. I made sure dependencies are correct on the cargo files, and even though they are "found" by the IDE, I get an error when doing cargo test that the methods are not found in testpackage.
It "works" if I remove #[cfg(test)] from the mod but I don't want that to be included when doing cargo build, besides I get bunch of warnings when running the tests and it doesn't even compile the artifacts then.
I tried moving common.rs around, to include it in the template package for example but still couldn't get it work, I face similar issues. Not sure if I am missing some annotation or what, if feels like a very silly issue.
How would you do something like this?
Just a hunch (I haven't tried to recreate your folder structure there and never tried to compile a #[cfg(test)] library), but by the way it looks you're juggling three different crates in a workspace setup. In this case your testpackage would (to my understanding) only be included as a pseudo-external dependency in your template and template_implementation crates. To my understanding of the workspaces build process, workspace sub-crates will be compiled for debug or release (but never in testing configuration) for inclusion in other sub-crates of a workspace, while #[cfg(test)] is only ever used within the scope of a single crate.

How to run tests in a multimodule Go project

I'm learning Go with the specialization Programming with Google Go. It has several courses, each of which has several modules.
My project looks like the following (made with https://ascii-tree-generator.com/):
google-golang/
├─ .github/
│ ├─ workflows/
│ │ ├─ ci.yml
├─ golang-getting-started/
│ ├─ module1/
│ │ ├─ main.go
│ │ ├─ main_test.go
│ ├─ module2/
│ │ ├─ trunc/
│ │ │ ├─ main.go
│ │ │ ├─ main_test.go
├─ .gitignore
├─ README.md
I'd like to run all the tests in the *_test.go files for every commit, and it's not clear to me how to do that from the root directory (google-golang). I don't see a need for one module to import another as the exercises can be done independently. This question has two answers, one suggests using submodules, another recommends using Go workspace, but neither provide specific instructions that someone new like me can learn from.
I'm not asking for help on GitHub Actions, I know how to write those. I'm looking for one or more commands that'll find and run the tests.
You seem confused about what a module is. The rule of thumb is, one go.mod file equals one module. Go Wiki, gomod:
A module is defined by a tree of Go source files with a go.mod file in the tree's root directory.
Based on your directory tree shown in your question, there is no go.mod file in sight, hence nothing there is a Go module. As a matter of fact, if you attempt running a module-aware command from google-golang or golang-getting-started you'll have:
go: go.mod file not found in current directory or any parent directory; see 'go help modules'
If you want to run all tests from the root of a multi-module repo, as the title of your question says, with Go 1.17 you can:
init the sub-modules:
$ cd google-golang/golang-getting-started/module1
$ go mod init example.com/module1
$ cd ../module2
$ go mod init example.com/module2
use the trick suggested by Cerise Limón from the root dir of the multi-module project
$ cd google-golang
$ find . -name go.mod -execdir go test ./... \;
If you don't actually care about keeping the sub-repos as separate modules, you can init a module in the root repo and run all tests from there:
$ cd google-golang # or google-golang/golang-getting-started/
$ go mod init example.com/mainmod
$ go test ./...
...however, even this hack works right now, it doesn't make a lot of sense, because your repos named moduleN have main.go files, whose packages are supposedly named main, in each of them. So they are indeed organized as separate sub-modules.

Error after implementing 'curl': E1696 cannot open source file "curl/curl.h"

The title says it all. I'm using VS 2019 since as far as I can understand, curl is more used on VS 2019 rather than VS Code (correct me if I'm wrong). So my project has this structure:
── myproject
├── myproject
│ ├── src
│ │ ├── main.cpp
│ ├── myproject.vcxproj
│ ├── myproject.vcxproj.filters
│ └── myproject.vcxproj.user
├── externals
│ ├── curl [SUBMODULE]
│ │ ├── include [THE INCLUDE DIRECTORY]
│ │ │ ├─ ···
│ │ ├── ···
│ ├── ···
├── .git
├── .vs
├── .gitmodules
├── myproject.sln
I added curl (see https://github.com/curl/curl) as a Git submodule in the folder ./externals/curl:
2. In my solution, I went to the project 'myproject' -> (Right Click) -> Properties -> C/C++ -> General -> Additional Include Directories and added the following line:
$(SolutionDir)externals\curl\include -> Apply -> OK
I went to ./src/main.cpp and pressed View Code (F7), then added the line #include "curl/curl.h". But even after doing steps 1 and 2, VS 2019 won't detect the curl headers:
Consequently obtaining that error.
(Thanks to #drescherjm)
All you have to do is ensure you have applied the change in step #2 for all the configurations and platforms (go to the project 'myproject' -> (Right Click) -> Properties -> C/C++ -> General -> Additional Include Directories; in the top of the window, set 'Configurations' to "All Configurations" as well as 'Platforms' to "All Platforms"). See Image
You may want to apply these Include Directories only to one (or a few) of the configurations and/or platforms, so once you're done just set that(those) configuration(s) on your Visual Studio IDE.

Linking SDL-bgi in Code::Blocks on windows using a custom install dir

I have a program, that works on Linux using SDL-bgi. I have downloaded the SDL-bgi binaries from http://libxbgi.sourceforge.net/ , and can get it to compile, but I can't get it to link (giving me"undefined reference to ... errors). The download provides a DLL, but according to the answer to this question, I need a .lib. I can't find any .lib anywhere n the download.
Here is the output of tree /f in the folder extracted:
│ AUTHORS
│ BUGS
│ build.sh
│ ChangeLog
│ CMakeLists.txt
│ INSTALL.md
│ LICENSE
│ README.md
│ sdl_bgi.spec
│ TODO
│ VERSION
│
├───bin
│ ├───CodeBlocks
│ │ SDL_bgi.dll
│ │
│ ├───Dev-Cpp
│ │ SDL_bgi.dll
│ │
│ └───Mingw64
│ SDL_bgi.dll
│
├───doc
│ functions.md
│ functions.pdf
│ howto_CodeBlocks.md
│ howto_CodeBlocks.pdf
│ howto_Dev-Cpp.md
│ howto_Dev-Cpp.pdf
│ sdl_bgi-quickref.pdf
│ sdl_bgi-quickref.tex
│ SDL_bgi_logo.png
│ SDL_bgi_logo.svg
│ turtlegraphics.pdf
│ turtlegraphics.tex
│ using.md
│ using.pdf
│
├───src
│ graphics.h
│ Makefile
│ Makefile.CodeBlocks
│ Makefile.DevCpp
│ SDL_bgi.c
│ SDL_bgi.h
│
└───test
[... a bunch of c files]
I am trying to link to the library from where it is, instead of C:\CodeBlocks\MinGW\bin as recommended by the docs, because I don't have the right privileges.
First Method if you don't have installed old bordland graphics interface in Codeblocks then use this method other-wise you get error like multiple declaration because both library use same function declaration
step:1- Create a New c console project name it what ever you want then paste the
files from include folder from the zip below and paste it here
C:\Program Files (x86)\CodeBlocks\MinGW\include
then paste libsdlbgi.a from the zip file to this path
C:\Program Files (x86)\CodeBlocks\MinGW\lib
SDLBGI.zip
step:2-Go to the codeblocks then go to setting then select compiler go to linker option and click add then browse to previously pasted libsdlbgi.a file then add it then go to search directory linker and do same with libsdlbgi.a
again.
Step:3-Write any simple program and built and compile and run it.
Second method if you want both bgi and sdl bgi
Follow all the steps carefully to get it works
Step:1- Simply create a new project in Code-Block using SDL2 from the category click enter and give a title to the project then click next and finish to create to new project.
Step:2- Go to your directory where you have created your project then copy these files
'SDL_bgi.c' , 'SDL_bgi.h' and 'sdlbgidemo.c' , 'logo.bmp' from the "SDL_bgi-2.2.4" [src folder] and [test folder] to project folder.
Step:3-First delete default main.cpp file from codeblock project then add "sdlbgidemo.c" into the project then click ok in next window in CodeBlocks which ask for
select target file to "debug" and "release"
Step:4-select the sdlbgidemo.c in codeblock then open it in the code editor then change the #include <'graphics.h'> header to #include "SDL_bgi.c"
Step:5-Last Step press built and run button it will built and run the project and you will probably see the previously pasted logo.bmp on the screen then you can see demo of all SDL_bgi Library funtions.
Here it is Code-block project file [zip] for you with all the necessary modification so you can easily run it using Code-blocks.
[Code-Blocks Project File.zip]
if you don't want to repeat step:2 and step:3 every time you created new project you follow Step:5 to solve this problem.
Step:6-First go to the directory where you have installed your Codeblocks then browse through [Mingw] then [include] folder in this folder you can simply copy 'SDL_bgi.c' , 'SDL_bgi.h' or if you have already installed Old Borland Graphics library [BGI] then you have to create separate folder for SDL-BGI and have to paste all files which i tell you earlier in this newly created folder then if you want you to use or include these files in your project simply
type these lines #include "SDL_bgi.c" or #include "[Previously created folder]/SDL_bgi.c" to run your program.
Here is the link of zip file which have some screen shot of all the steps we have taken so far...
[ScreenShot.zip]
I hope this solve your problem and save your time.
At Last
That's all folks

Is it possible to install Fortran Compiler into flash drive?

Currently I'm running the gfortran compiler in my computer. But I'm just wondering if I'm able to install the fortran compiler in my flash drive. That way I can run fortran anywhere else without installing the compiler into the main computer. I try to search in Google but I'm not able to find a solution to it. Does that mean that I'm not able to do it just like any other compiler??
Edited:
Sorry currently I'm using Window 7 to run the Fortran Compiler. But I may run the compiler in Window Vista or XP if I'm able to install the compiler in my flash drive.
The flash drive size is 8 GB. I used about half of it already.
Thank you very much!
A flash drive is not an operating system. A compiler is simply a computer program, which itself has been compiled for a certain operating system. So you can put the compiled binary for a given operating system on a flash drive and execute it from the flash drive, but every computer that you use it on would have to be running the same operating system. If this solution does not work for you, you could look into making a bootable flash drive (which is an entire operating system hosted on a flash drive) and installing a Fortran compiler on that.
I hope this helped.
--- EDIT ---
After seeing your edit, it is very possible that you could install a compiler on your flash drive and then use it on other Windows 7 Machines or other compatible Windows machines. It is probably as simple as setting the installation directory to the flash drive during the time of installation, as long as the compiler doesn't rely on any registry values.
I don't know much about gfortran which I just use on the HPC(Linux OS) but I think u cna give g95 a try.
I simply copy the whole directory to some place and I wrote a .bat file to set the path, it works.
The only problem is , that program can not know where is the HOME dir.
my files:
D:\bin\g95>tree
卷 D: 的文件夹 PATH 列表
卷序列号为 00000200 5E6C:35EF
D:.
├─bin
├─doc
└─lib
└─gcc-lib
└─i686-pc-mingw32
└─4.1.2
D:\bin\g95>tree /f
卷 D: 的文件夹 PATH 列表
卷序列号为 00000200 5E6C:35EF
D:.
├─bin
│ a.exe
│ ar.exe
│ as.exe
│ b.f
│ b.zip
│ f.dat
│ g95.exe
│ h.ctl
│ h.grd
│ ld.exe
│ mingwm10.dll
│ ranlib.exe
│ rm.dat
│ strip.exe
│ ua.dat
│ uc.dat
│ va.dat
│ vc.dat
│ za.dat
│ zc.dat
│
├─doc
│ bg.gif
│ COPYING.txt
│ docs.html
│ g95.bmp
│ G95Manual.pdf
│ Readme.html
│ README.txt
│
└─lib
│ crt1.o
│ crt2.o
│ dllcrt2.o
│ libadvapi32.a
│ libgdi32.a
│ libkernel32.a
│ libm.a
│ libmingw32.a
│ libmingwex.a
│ libmoldname.a
│ libmsvcrt.a
│ libshell32.a
│ libuser32.a
│ libws2_32.a
│
└─gcc-lib
└─i686-pc-mingw32
└─4.1.2
cc1.lnk
f951.exe
libf95.a
libgcc.a
and my setg95.bat file:
set PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;d:\bin\g95\bin;d:\bin\vim\vim63;d:\bin\bin;
SET LIBRARY_PATH = d:\bin\g95\lib
set G95_LIBRARY_PATH=d:\bin\g95\lib
d:
rem under win32 :
rem g95 -ffree-form -fendian=big -o readv3 readv3.f
cmd