Struggling with file upload path on cURL - windows

Beginner user on cURL. I'm really struggling with the path format used to upload a file through cURL.
curl -X POST https://XXXXXXXXX … -F file=#C:\Users\John\Downloads\test.csv
I keep getting the following error message "curl: (26) Failed to open/read local data from file/application"
Most of the examples provided start with file=#/home/, which is confusing as I don't have such directory to my understanding. Also, examples use "/" instead of "\". Why is it so?
Can anyone provide some feedback on how to properly write the path to a file?
Thanks!

Finally solved this! After some trials and errors, I figured out that the path's syntax should have used double backslash, so:
C:\\Users\\John\\Downloads\\test.csv
and not:
C:\Users\John\Downloads\test.csv
Honestly, I have never used this syntax before and don't understand why this is required. Your comments/input would certainly be appreciated.

Related

Apache 403 on windows using AliasMatch and -D

After i packaged apache to be portable (used any where), I had the surprise to get 403 error on AliasMatch but not on regular Location resources.
Update: I found the fix. Check answer.
And so, here is my own response.
I check the error.log and saw the path of the aliasmatch was wrong ( what a scoop). But note this path is made using a variable. Actually, all the character / that we can expect have been removed.
I look to the origin of the variable but not at the beginning, because all URI based on Location was working. Amazing ! But , the fact is, Location directive seems to convert the ugly \ windows in / to work, but not the AliasMatch directive. I forget to tell that i launched Apache using command line httpd with option -D and ... an ugly windows path with \ and not /. So, i convert the path in a pretty unix path and all is back in order.
In dos command : SET APACHE_ROOT="%THE_WINDOWS_PATH:\=/%"

Biopython: SeqIO.parse() FileNotFoundError

I'm new in Bioinformatics and Biopython, so I have some difficulties with it.
I was reading the Biopython (SeqIO) documentation, but when I try to execute some SeqIO.parse() commands I get FileNotFoundError.
For example, I want to get "example.fasta" file (which I don't have it on my PC). I try to do it with this command:
for record in SeqIO.parse("example.fasta", "fasta"):
print(record.id)
But, all I get is FileNotFoundError: [Errno 2] No such file or directory
Can someone help me with this?
My understanding is that FileNotFoundError occurs when the code tries to open a file on your computer and does not find it.
This can happen either because you simply do not have this file, or you gave the name with a typo, or the path to the file is not correct (This is an important notion: the path to the file should be absolute, or relative to the current working directory (usually the one from which you executed the python script)).
As suggested in the comments to your question, you seem to be expecting SeqIO.parse to get the file for you. This is not the case. The first argument you give to this function (in the example "example.fasta") is the path to an existing file that you want to "parse", that is, interpret its information content and make this content available to the rest of your program in a convenient form.
So in order to get this example working, you first need to get a fasta file. If you do not already have one, you can download some manually from genbank, or find one in the biopython installation (if you installed it from source and know where the source code is located), for instance in Tests/Quality/example.fasta.

Downloading Only Newest File Using Wget / Curl

How would I use wget or curl to download the newest file in a directory?
This seems really easy, however the filename won't always be predictable, and as new data comes in it'll be replaced with a random filename.
Specifically, the directory I wish to download data from has the following naming structure, where the last string of characters is a randomly generated timestamp:
MRMS_RotationTrackML1440min_00.50_20160530-175837.grib2.gz
MRMS_RotationTrackML1440min_00.50_20160530-182639.grib2.gz
MRMS_RotationTrackML1440min_00.50_20160530-185637.grib2.gz
The randomly generated timestamp is in the format of: {hour}{minute}{second}
The directory in question is here: http://mrms.ncep.noaa.gov/data/2D/RotationTrackML1440min/
Could it have to be something with something in the headers, where you'd use curl to sift through the last-modified timestamp?
Any help would be appreciated here, thanks in advance.
You can just run following command periodically:
wget -r -nc --level=1 http://mrms.ncep.noaa.gov/data/2D/RotationTrackML1440min/
It will download recursively whatever is new in the directory after last run.

How to find line that is causing the error

I have just started using Laravel and cannot get my head around how it throws errors. It doesn't show the line where the error is so I don't know how to locate it. Can anyone help?
htmlentities() expects parameter 1 to be string, array given (View:
M:\webserver\www\app\views\products\admin\create.blade.php)
This file is incredibly long and I cannot see where this array is being sent.
It's obviously coming from a Form::text() but I am passing a null as the second param in all that I can see. Why doesn't Laravel simply tell me the line that is erroring. The error it puts out is no use to me.
check the error file:
app/storage/logs/laravel.log
you can watch changes in the file (on Mac and *NIX) using command line:
tail -f app/storage/logs/laravel.log
remember that the storage directory must be writable by the webserver/PHP process because it's used as scratch space (for blade views, logs, etc.)

mkdir on windows - CAKEPHP

Hi I am searching for a good solution since a while and I found nothing to help me on google.
I got an error on my website with the function mkdir, but only when I set the debug at 2.
Here is the error
Warning (2): mkdir() [function.mkdir]: Invalid argument
[CORE\cake\libs\folder.php, line 498]
Im on windows server 2003 and every permission are given to all my folder.
The path that is given to the function is
C:\Inetpub\vhosts[DOMAIN NAME]\subdomains[SUBDOMAIN
NAME]\httpdocs\app\webroot\C:
I notice the last C: at the end of the path but don't know where it come from nor does I know what the function is trying to create.
mkdir() should ideally take the path to directory and should not include the file name. The invalid argument warning seems to suggest the same. Try passing the argument without filename.
/Thanks.

Resources