Can't publish HTML to server using org-mode ox-publish - html

The relevant code from my .emacs is:
(require 'ox-publish)
(require 'ox-html)
(setq org-publish-project-alist
'(("org-html"
:base-directory "~/org/"
:base-extension "org"
:publishing-directory "/ssh:user#server:/public_html/"
:recursive t
:publishing-function org-html-publish-to-html
:table-of-contents: nil
:auto-postamble nil
)
("org-static"
:base-directory "~/org/"
:base-extension "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|ogg\\|swf"
:publishing-directory "/ssh:user#server:/public_html/"
:recursive t
:publishing-function org-publish-attachment
)
("org" :components ("org-html" "org-static"))
)
)
I get an error message which states the following:
byte-code: Couldn't find exit status of `test -e /public_html/'
It exports fine if I publish to a directory on my local machine and it was working for a minute but then stopped. Any clues?

I've the impression the problem is coming from Tramp, due to your ssh: spec for the remote file location.
Try first, maybe, to use Tramp against that remote dir, and check if everything's running fine.

Related

AWS.Client raised PROGRAM_ERROR : aws-client.adb:543 finalize/adjust raised exception

I am trying to write a simple Ada (with AWS) program to post data to a server. The curl command is working as follows and return a valid response in JSON after successful login:
curl -XPOST -d '{"type":"m.login.password", "user":"xxx", "password": "xxxxxxxxxx"}' "https://matrix.org/_matrix/client/r0/login"
My Ada program:
with Ada.Exceptions; use Ada.Exceptions;
with Ada.Text_Io; use Ada.Text_IO;
with AWS.Client;
with AWS.Communication.Client;
with AWS.MIME;
with AWS.Net;
with AWS.Response;
use AWS;
procedure Communicate is
Result : Response.Data;
Data : String := "{""type"":""m.login.password"", ""user"":""xxx"", ""password"": ""xxxxxxxxxx""}";
begin
Result := Client.Post
( URL => "https://matrix.org/_matrix/client/r0/login",
Data => Data,
Content_Type => AWS.MIME.Application_JSON ) ;
Put_Line ( Response.Message_Body ( Result ) ) ;
end Communicate;
An exception was raised. I can't figure out what is wrong with this code.
$ ./Communicate
raised PROGRAM_ERROR : aws-client.adb:543 finalize/adjust raised exception
To test the code, you can create an account at http://matrix.org and replace the login credential.
Thanks.
Adrian
After a few minor changes (mostly because I don't like compiler warnings), and an adaption to the Debian/Jessie version of AWS, I got it to work.
Here's the adapted version:
with Ada.Text_IO; use Ada.Text_IO;
with AWS.Client;
-- with AWS.MIME;
with AWS.Response;
use AWS;
procedure Communicate is
Result : Response.Data;
Data : constant String :=
"{""type"":""m.login.password"", ""user"":""xxx"", " &
"""password"": ""xxxxxxxxxx""}";
begin
Result := Client.Post
(URL => "https://matrix.org/_matrix/client/r0/login",
Data => Data,
Content_Type => "application/json");
-- Content_Type => AWS.MIME.Application_JSON);
Put_Line (Response.Message_Body (Result));
end Communicate;
Here is my project file:
with "aws";
project Communicate is
for Main use ("communicate");
package Builder is
for Default_Switches ("Ada")
use ("-m");
end Builder;
package Compiler is
for Default_Switches ("Ada")
use ("-fstack-check", -- Generate stack checking code (part of Ada)
"-gnata", -- Enable assertions (part of Ada)
"-gnato13", -- Overflow checking (part of Ada)
"-gnatf", -- Full, verbose error messages
"-gnatwa", -- All optional warnings
"-gnatVa", -- All validity checks
"-gnaty3abcdefhiklmnoOprstux", -- Style checks
"-gnatwe", -- Treat warnings as errors
"-gnat2012", -- Use Ada 2012
"-Wall", -- All GCC warnings
"-O2"); -- Optimise (level 2/3)
end Compiler;
end Communicate;
I built the program with:
% gprbuild -P communicate
gnatgcc -c -fstack-check -gnata -gnato13 -gnatf -gnatwa -gnatVa -gnaty3abcdefhiklmnoOprstux -gnatwe -gnat2012 -Wall -O2 communicate.adb
gprbind communicate.bexch
gnatbind communicate.ali
gnatgcc -c b__communicate.adb
gnatgcc communicate.o -L/usr/lib/x86_64-linux-gnu -lgnutls -lz -llber -lldap -lpthread -o communicate
%
And then tested with:
% ./communicate
{"errcode":"M_FORBIDDEN","error":"Invalid password"}
%
It looks like the problem is located in your AWS version/installation.
Problem resolved by building AWS with gnutls from MacPorts. Apple deprecated OpenSSL since OS X Lion and used CommonCrypto so modern macOS does not come with OpenSSL. The solution is to download and install OpenSSL or gnutls from Mac Ports or Home Brew.
Another problem is that Apple introduced SIP (System Integrity Protection) since El Capitan. With SIP enabled, user with administrator's rights is unable to change the contents in /usr/include and /usr/lib etc.
Mac Ports installs to /opt/local so I made references to /opt/local/include and /opt/local/lib so that AWS can build with either OpenSSL or gnutls.

download a csv zip file

I'm trying to download the following file. The code works just find in RStudio when I run to the console. But when I try to compile a markdown file (to either html or pdf), it gives an error. Why can't markdown communicate with the csv zip file?
```
temp = tempfile()
download.file("http://www.cms.gov/Research-Statistics-Data-and-Systems/Statistics-Trends-and-Reports/Medicare-Provider-Charge-Data/Downloads/Inpatient_Data_2013_CSV.zip", temp)
temp2 = unz(temp, "Medicare_Provider_Charge_Inpatient_DRG100_FY2013.csv")
medData = read_csv(temp2)
```
Gives the following error (I had to remove URLs in error because I don't have enough reputation points):
trying URL Quitting from lines 41-49 (medicare.Rmd) Error in
download.file("..", : cannot open URL '...' Calls: ...
withCallingHandlers -> withVisible -> eval -> eval -> download.file

How to connect to Amazon RDS using go-sql-driver

I can connect to the RDS instance using mysql -h ... command so I know it's not a security group problem.
I've tried to use:
sql.Open("mysql", "id:password#tcp(your-amazonaws-uri.com:3306)/dbname")
in the readme file of go-sql-driver(https://github.com/go-sql-driver/mysql), but it doesn't seem to work.
I'm using my username under the RDS instance instead of id here though.
Edit:
The error returned is: panic runtime error: invalid memory address or nil pointer deference [signal 0xb code=0x1 addr=0x20 pc=0x5b551e]
goroutine 16 [running]
runtime.panic(0x7d4fc0, 0xa6ca73)...database/sql.(*Rows).Next...
It works fine with my local DB.
The connection string for sql.Open() is in DSN format.
import (
"database/sql"
"fmt"
_ "github.com/go-sql-driver/mysql"
)
db, err := sql.Open("mysql", "<username>:<password>#tcp(<AWSConnectionEndpoint >:<port>)/<dbname>")
if err != nil {
fmt.Print(err.Error())
}
defer db.Close()
Make sure the actual error isn't related to an import issue (as in issues 266)
Check (to be sure you are using the latest versions, as in this issue):
your Go-MySQL-Driver version (or git SHA)
your Go version (run go version in your console)
If the error isn't directly in the Open step, but when accessing the Rows, check this comment out:
Use either a for loop (for rows.Next() { ... }) or something like this:
if rows.Next() {
// whatever
} else {
// catch error with rows.Err()
}
rows.Close() // <- don't forget this if you are not iterating over ALL results

Cryptic message on org-html-publish-to-html

I am trying to publish org files to html but I receive this error upon trying to publish my .org file:
org-export-dispatch: Wrong number of arguments: #[(&optional force) "
Then a bunch of weird symbols that won't paste... followed by
[wconfig force org-publish-use-timestamps-flag project current-window-configuration ((setwindow-configuration wconfig)) org-publish-get-project-from-filename buffer-file-name up error ...] 4 ("/usr/share/emacs/24.1/lisp/org/org-publish.elc" . 31315) "P"], 2
Here is the setup of the relevant portions of my .emacs file for the publishing:
(require 'org-publish)
(setq org-publish-alist
'(("org-html"
:base-directory "~/org/"
:base-extension "org"
:publishing-directory "~/public_html/"
:recursive t
:publishing-function org-html-publish-to-html
:table-of-contents: nil
:auto-postamble nil
)
("org-static"
:base-directory "~/org/"
:base-extension "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|ogg\\|swf"
:publishing-directory "~/public_html/files"
:recursive t
:publishing-function org-publish-attachment
)
("org" :components ("org-html" "org-static"))
)
)
Any suggestions as to why this won't publish?
I was having a conflict with my syntax because of some recent changes to the exporter. Here is my code, which is now fully functioning:
(require 'ox-publish)
(require 'ox-html)
(setq org-publish-project-alist
'(("org-html"
:base-directory "~/org/"
:base-extension "org"
:publishing-directory "~/public_html/"
:recursive t
:publishing-function org-html-publish-to-html
:table-of-contents: nil
:auto-postamble nil)
("org-static"
:base-directory "~/org/"
:base-extension "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|ogg\\|swf"
:publishing-directory "~/public_html/"
:recursive t
:publishing-function org-publish-attachment)
("org" :components ("org-html" "org-static"))))

SBCL load error for clsql-mysql from quicklisp for version clsql-20110829

For SBCL 1.0.45, using quicklisp to load clsql-mysql, I get an error about "no symbol", which appears to cause the interface to fail to load. Specifically, the error is:
[package clsql-mysql]
file: /home/blake/quicklisp/dists/quicklisp/software/clsql-20110829-git/db-mysql/mysql-sql.lisp
in: DEFPACKAGE #:CLSQL-MYSQL
(DEFPACKAGE #:CLSQL-MYSQL
(:USE #:COMMON-LISP #:CLSQL-SYS #:MYSQL #:CLSQL-UFFI)
(:EXPORT #:MYSQL-DATABASE)
(:IMPORT-FROM :CLSQL-SYS
:ESCAPED
:UNESCAPED
:COMBINE-DATABASE-IDENTIFIERS
:ESCAPED-DATABASE-IDENTIFIER
:UNESCAPED-DATABASE-IDENTIFIER
:DATABASE-IDENTIFIER
:%SEQUENCE-NAME-TO-TABLE
:%TABLE-NAME-TO-SEQUENCE-NAME)
(:DOCUMENTATION "This is the CLSQL interface to MySQL."))
;--> EVAL-WHEN
;==>
(SB-IMPL::%DEFPACKAGE "CLSQL-MYSQL" 'NIL 'NIL 'NIL 'NIL
'("COMMON-LISP" "CLSQL-SYS" "MYSQL" "CLSQL-UFFI")
'(("CLSQL-SYS" "ESCAPED" "UNESCAPED"
"COMBINE-DATABASE-IDENTIFIERS"
"ESCAPED-DATABASE-IDENTIFIER"
"UNESCAPED-DATABASE-IDENTIFIER"
"DATABASE-IDENTIFIER" "%SEQUENCE-NAME-TO-TABLE"
"%TABLE-NAME-TO-SEQUENCE-NAME"))
'NIL '("MYSQL-DATABASE") '("CLSQL-MYSQL") 'NIL ...)
caught ERROR:
(during compile-time-too processing)
no symbol named "ESCAPED" in "CLSQL-SYS"
Has anyone else experienced this problem?
It looks like you are using clsql from outside Quicklisp. Did you download it at some time in the past? What does (asdf:system-source-directory "clsql") show?
The clsql-sys that is loadable via Quicklisp does have a symbol named ESCAPED.