R download file redirect - r

Hi I am following a online class and trying to download the rda dataset provided by the prof.
I tried to run exactly the same command as provided in the class:
download.file("https://dl.dropbox.com/u/7710864/courseraPublic/samsungData.rda", destfile="./samsungData.rda", method="curl")
load('./samsungData.rda')
When I go to the download folder, open the rda file in vi, this is what I see:
<html>
<head><title>Found</title></head>
<body>
<h1>Found</h1>
<p>The resource was found at https://dl.dropboxusercontent.com/u/7710864/courseraPublic/samsungData.rda;
you should be redirected automatically.
<!-- --></p>
<hr noshade>
<div align="right">WSGI Server</div>
</body>
</html>
Clearly there is a redirect here and the download file command did not follow it smartly. When I open up that URL in the browser, it will be successfully redirected.
I took a look at the help manual of download.file there is no such thing as following redirect.
Can anyone show me how to follow the redirect?

Try specifying an extra argument, which will pass command-line arguments to curl:
download.file("https://dl.dropbox.com/u/7710864/courseraPublic/samsungData.rda",
destfile="./samsungData.rda",
method="curl",
extra='-L')

Related

How to fix an error with saving file "index.Rmd" in Blogdown?

I wanted to help with one question, but was recieved my own.
Where is a problem?
I tried to repeat some basics from there: https://bookdown.org/yihui/blogdown/a-quick-example.html
all instructions were followed and fulfilled;
hugo was downloaded and installed;
site was launched by blogdown::serve_site().
It works! But...
Launching the server via the command:
C:/Users/User/AppData/Roaming/Hugo/0.89.4/hugo.exe server --bind 127.0.0.1 -p 4321 --themesDir themes -t hugo-lithium -D -F --navigateToChanged
Serving the directory . at http://localhost:4321
Launched the hugo server in the background (process ID: 1780). To stop it, call blogdown::stop_server() or restart the R session.
... look, where is a message??? (as you can see there):
Rendering content/post/2020-12-01-r-rmarkdown/index.Rmd... Done.
Ok, I tried to add content to index.Rmd:
```{r}
summary(Orange)
```
And, after saving, we can see this message:
Again these hellish replacement symbols and (Sys.setenv("LANGUAGE"="EN") didn't help, but this isn't a story about them).
How to fix this problem with index.Rmd in blogdown? Maybe someone faced with it?
Very grateful for the help.
And a little addition.
I deleted and recreated "my website".
This string was displayed...
Rendering content/post/2020-12-01-r-rmarkdown/index.Rmd... Done.
... but error is the same ...
This answer is for the future sufferers and thoughtless persons (as I am):
Guys, we shouldn't touch the "index.Rmd" in the main directory of our site's folder!
Am I right?
Some proposals to Yihui Xie:
Why "the main index.Rmd" can't have an other name, f.e.:
mainIndex;
primaryIndex;
baseIndex;
etc...
... and it will be nice, if you add to this file some info, f.e.
<!-- If you want to add some new info to your site - come to "content - post - bla-bla - index.Rmd" -->
<!-- Please don't try to edit the current file -->
---
site: blogdown:::blogdown_site
---
Or nevertheless someone can add something and save after "index.Rmd"?

Unable to get to wp-admin log in page

Hi I have recently tried to log in to my site and I keep getting the following error:
Warning: Cannot modify header information - headers already sent by
(output started at
/homepages/6/d700752663/htdocs/clickandbuilds/OnyxMotorsCompany/wp-content/themes/cardealer/includes/base_functions.php:1)
in
/homepages/6/d700752663/htdocs/clickandbuilds/OnyxMotorsCompany/wp-includes/pluggable.php
on line 1210
I have not made any changes to website. The website itself works fine however I cannot get to wordpress dashboard either via wp-login and wp-admin.
Any idea? Thank you
Open base_functions.php & try and add following code on top.
<?php ob_start(); ?>
You have already marked path to file: /homepages/6/d700752663/htdocs/clickandbuilds/OnyxMotorsCompany/wp-content/themes/cardealer/includes/base_functions.php
I hope it will help.

using curl, shell scripting how to upload all the files in Specific path to host?

i have written a script to upload all the files from a specific folder in local to the host, but there was some issue and the files are not getting uploaded to the host.
#!/bin/sh
for i in /main/folder_1/path/*
do
curl -u Pass:"Uname" -T $i http://www.example.com/folder/path/$i
done
echo "*****File Uplodaed ******"
help me to solve this. the following is the error, that i got
<html>
<head>
<title> 500 Internal Server Error </title>
</head>
<body>
<h1>
Internal Server Error
</h1>
</body>
</html>
currently i am having the script inside /main/folder_2, if i change /main/folder_1/path/ to ../folder_1/path/, i got the output as the files are moved. but i want to run the script with the complete path specified.

convert .WAR for auto deploy in karaf/servicemix

I've got very simple .WAR containing example servlet. I'm able to deploy it in servicemix using the following command:
osgi:install file:///home/seiho/apache-servicemix-4.4.2/deploy/TestServlet.war?Bundle-SymbolicName=TestServlet&Webapp-Context=/TestServlet
And then see it in my browser. But only with full path to a file, e.g.: localhost:8080/TestServlet/index.html or localhost:8080/TestServlet/TestServlet (my servlet is TestServlet class).
I'd like to launch the index.html page automatically after entering: localhost:8080/TestServlet
how to do it?
MORE IMPORTANT
I need a way to convert the .WAR file or servlet project (I've got the sources) so that new .WAR file can be auto-deployed by copying it to $SERVICEMIX_HOME/deploy directory.
I've tried editing the MANIFEST.MF file, but with no success. Probably I'm doing something wrong.
Thanks for any advice/help.
To be recognised as a wab, you need to add a context path header to your manifest:
Web-ContextPath: TestServlet
It's working now! I was doing my MANIFEST.MF according to this page: http://team.ops4j.org/wiki/display/ops4j/Pax+Web+Extender+-+War+-+OSGi-fy
The problem was that for some reason "Bundle-Version: 1.0" line was required as opposed to optional as stated on that page.
Honestly, just adding the Bundle-Version fix-it.
I knew it was something wrong with the MANIFEST.MF and after Holly Cummins' question I played with it a bit more. Thanks Holly.
I still can't do anything with the manual site launching (have to manually enter the index.html).
http://localhost:8080/TestServlet/ gives me this:
HTTP ERROR 404
Problem accessing /TestServlet/. Reason:
Not Found
Powered by Jetty://
http://localhost:8080/TestServlet/index.html gives me proper site.

classic asp server.transfer error

I have a file failed.asp in folder abc. Now i want to redirect my user.asp page in folder xyz to page failed.asp when there is a error. When i have my failed.asp in same folder as my user.asp it does not give me error but if i use virtual path in server.transfer it is giving me error. How can i fix this.
Server.Transfer("failed.asp") --Works
Server.Transfer("abc/failed.asp") or Server.Transfer("../abc/failed.asp") --fails saying error when loading file
does not work what is the possible work around for this issue.
Server.Transfer("/abc/failed.asp") should work. Note that the root path starts with a forward slash.

Resources