Download a public file in Bitrise Workflow - file

I have my zip uploaded on Gofile, and using the direct download link I'm trying to use CURL in my step to download it on my build.
Even if the step work, the file is not totally donwloaded as I can't unzip it..
+ curl https://srv-store3.gofile.io/download/RIDfRD/xxxx.zip -o xxxx.zip
here is the command I used
I have no idea why this don't download. I also tried the "official" download step

Are you receiving the following error when trying to unzip it?
End-of-central-directory signature not found. Either this file is not
a zipfile, or it constitutes one disk of a multi-part archive. In the
latter case the central directory and zipfile comment will be found on
the last disk(s) of this archive.
This means the zip file is corrupted. I was able to reproduce it with my own file. Go file is intended to be downloaded from the website not through curl.
I would recommend using a different service like https://gist.github.com and copying the raw file link and using that in the curl command.

Related

File format Error after Download - Jekyll blog

I would like users to download a zip file and I have the following code.
<a href="directory/fileName.zip" download>DOWNLOAD</a>
However, when I test it out, the file downloads instantly and when I try to open it, I get the unsupported format error. On localhost, it downloads instantly but the zip file successfully opens.
I am on MacOS and have git lfs installed if that is important. Any help would be greatly appreciated. Thank you.
I tried renaming the file so that there are no spaces in its name, tried to separately compress the directory to be zipped.

How to upload folders to Google Colab?

I want to run a notebook that uses many header files defined in the directory. So basically I want to upload the entire directory to Google Colab so that I can run the notebook. But I am unable to find any such options and only able to upload files not complete folders. So can someone tell me how to upload entire directory to google colab?
I suggest you not to upload them just in Colab, since when you're restarting the runtime you will lose them (just need to re-upload them, but it can be an issue with slow connections).
I suggest you to use the google.colab package to manage files and folders in Colab. Just upload everything you need to your google drive, then import:
from google.colab import drive
drive.mount('/content/gdrive')
In this way, you just need to login to your google account through google authentication API, and you can use files/folders as if they were uploaded on Colab.
EDIT May 2022:
As pointed out in the comments, using Google Drive as storage for a large number of files to train a model is painfully slow, as described here: Google Colab is very slow compared to my PC. The better solution in this case is to zip the files, upload them to colab and then unzip them using
!unzip file.zip
More unzip options here: https://linux.die.net/man/1/unzip
You can zip them, upload, then unzip it.
!unzip file.zip
The easiest way to do this, if the folder/file is on your local drive:
Compress the folder into a ZIP file.
Upload the zipped file into colab using the upload button in the File section. Yes, there is a File section, see the left side of the colab screen.
Use this line of code to extract the file. Note: The file path is from colab's File section.
from zipfile import ZipFile
file_name = file_path
with ZipFile(file_name, 'r') as zip:
zip.extractall()
print('Done')
Click Refresh in the colab File section.
Access the files in your folder through the file paths
Downside: The files will be deleted after the runtime is over.
You can use some part of these steps if your file is on a Google Drive, just upload the zipped file to colab from Google Drive.
you can create a git repository and push the files and folders to it,
and then can clone the repository in colaboratory with the command
!git clone https://github.com/{username}/{projectname}.git
i feel this method is faster.
but if the file size is more than 100 mb you will have to zip the file or will have to add extentions to push it to github.
for more information refer the link below.
https://help.github.com/en/github/managing-large-files/configuring-git-large-file-storage
The best way to approach this problem is simple yet tricky sometimes.
You first need to compress the folder into a zipped file and upload the same into your google drive.
While doing so, Make sure that the folder is in the root directory of the drive and not in any other subfolder!. If the compressed folder/data is in other subfolder, you can easily move the same into the root directory.
Compresses folder/data in another subfolder often messes with the unzipping process when you will be specifying the file location.
Once you did the afore mentioned tasks, enter the following commands in the colab to mount your drive:
from google.colab import drive
drive.mount('/content/gdrive')
This will ask for an access token that can be generated by clicking on the url displayed in the output of the same cell
!ls gdrive/MyDrive
Check the contents of the drive by executing the above command and ensure that your folder/data is displayed in the output.
!unzip gdrive/MyDrive/<File_name_without_space>.zip
eg:
!unzip gdrive/MyDrive/data_folder.zip
Executing the same will start unzipping your folder into the memory.
Congrats! You have successfully uploaded your folder/data into the colab.
zip your files zip -r file.zip your_folder and then:
from google.colab import files
from zipfile import ZipFile
with ZipFile(files.upload(), 'r') as zip:
zip.extractall()
print('Done')
So here's what you can do:
-upload the dataset desired folder to your drive
-over colab, mount the drive wherein this
"from google.colab import drive
drive.mount('/content/gdrive')"
automatically shows up and you just need to run it
-then check for your file over the Files section on the left-hand side (if folder not visible try refreshing, also there should be a drop-down arrow next to it where you can check all the files under the folder )
-left-click over the folder wherein you get a COPY PATH option
-paste the copied path over the desired location in your colab

How to archive new build files in jenkins -pipeline script in groovy ReactJS

trying to archive all the files into a zip file that is formed in the workspace in jenkins pipeline script. I tried using this
archiveArtifacts 'C:\Program Files (x86)\Jenkins\jobs\pipeline CI_MS\workspace'
but error was shown as "file not found"
Thanks for any help
Do you really want to archive everything in the entire workspace? Hardcoding the path like that is a bad idea. The workspace moves, and if you are using a more recent version of Jenkins (that wasn't upgraded from an old version), you are probably not even looking in the right space.
Use this:
archiveArtifacts "${WORKSPACE}"
Add to the end of the path if you want to archive files in subdirectories.

Nunit TestResult.xml is not created during Jenkins build

To run tests in Jenkins I use the next batch command:
"C:\Program Files (x86)\NUnit 2.6.4\bin\nunit-console.exe" /result:TestResult.xml "C:\Users\Denis\Documents\Visual Studio 2013\Projects\MyProject\App.nunit"
Here how it looks in Jenkis:
The problem is: it doesn't generate TestResult.xml file!
When I run the same command as a .bat file from my desctop it creates the TestResult.xml file.
Any ideas what is wrong with Jenkins?
P.S. I searched for created file in all possible folders and even via "search"
I came up with thought that the file is generated and removed then or something like this.
The thing is that I don't see this file indeed but Jenkins generated report based on this file! So I think maybe after generating report the file was removed automatically.
I had faced the same issue and I found the test results xml file under my user directory in Win 7.
Note : I think it's some problem with nunit that it doesn't export the file to the location of which we provide the path.

Why won't drjava allow me to create a jar file?

I'm making a JApplet and need to make a JAR file to connect to a .htm file with the applet tag. The simple solution I could think of was to use the tool in drjava that says "Create Jar File From Project..." but alas, it's not highlighted for some reason, so I can't do that. What I'm really looking for is either (a) an explanation as to why drjava can't turn my classes into a jar file, (b) an alternative to allow me to create this jar file, or ideally (c) both. Thanks for your help ahead of time.
I don't use Drjava, but here is how you can create a JAR file from the command line without any IDE specific complications.
Simply go to the folder/directory where your project is located. Let's say your class files are located in the bin folder. You can then use
jar cvf myapplet.jar -C bin .
The JAR is then ready to be deployed.

Resources