use clisp to download website - sockets

I am trying to use clisp to dump webpages like, e.g. to define a function "read-url", such that (read-url "http://www.kernel.org/index.html") would display the html source code like:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- $Id: index.shtml,v 1.422 2012/02/09 17:13:11 root Exp $ -->
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>The Linux Kernel Archives</title>
<link rel="icon" type="image/png" href="favicon.ico" />
<link rel="alternate" type="application/rss+xml"
title="Latest Linux Kernel Version RSS"
href="http://kernel.org/kdist/rss.xml" />
<link rel="stylesheet" href="/kernel.css" type="text/css" />
......
does anyone know how?
Many thanks!!

I would recommend using drakma: "a fully-featured web client".
Where you could easily write a function as:
(defun read-url (url)
(drakma:http-request url))
which will then return the corresponding (sent back by the server) html-code. It works very well and (as far as I explored it) bug-less.

try CLOCC/CLLIB/url.lisp, see with-open-url, url-get &c.

Related

React: 'paypal' is not defined

I copied this code straightly from the official page of PayPal with correct client credentials. Here is my code:
index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Web site created using create-react-app"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
<script src="https://www.paypal.com/sdk/js?client-id=SECRET"></script>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>
YourComponent.js
import React from "react";
import ReactDOM from "react-dom"
const PayPalButton = paypal.Buttons.driver("react", { React, ReactDOM });
class YourComponent extends React.Component {
createOrder(data, actions) {
return actions.order.create({
purchase_units: [
{
amount: {
value: "135",
},
},
],
});
}
onApprove(data, actions) {
return actions.order.capture();
}
render() {
return (
<PayPalButton
createOrder={(data, actions) => this.createOrder(data, actions)}
onApprove={(data, actions) => this.onApprove(data, actions)}
/>
);
}
}
export default YourComponent;
App.js
import logo from './logo.svg';
import './App.css';
import YourComponent from './YourComponent';
function App() {
return (
<div className="App">
<YourComponent/>
</div>
);
}
export default App;
When I run it, it says PayPal at line 4:22 is not defined. I guess it is a silly error or might be my misunderstanding on the API too. Can anyone tell me what I can do?
https://www.paypal.com/sdk/js?client-id=SECRET
If you are actually using your REST App's API secret as part of the script src, that would be invalid. The REST App's client-id value must be passed here.
Load the app and check the browser's Developer Tools to make sure the script is actually being loaded successfully.
Instead of paypal.Buttons.driver you can try window.paypal.Buttons.driver
Alternatively, use the official react-paypal-js module instead.

Using wget with a URL

I am trying to get the content of this particular URL using wget command in ubuntu but the message I get is as given below:
http://192.92.176.8/cgi-bin/oindex.mbr/alldetail?Official=N&Birth=N&Death=N&Marriage=N&Maps=N&Fbn=N&USERKEY=2017031500000000000061&Batno=176233&Batsq=1&Cert=2016005450&Last_Rcd=00010&oindex_Name=BANUELOS%20JEFFREY%20GEORGE&Doc_Date=20160202&Counter=1&Doc_Desc=Trust%20Deed&RelDoc=%2E00&TYPE=&Book=&Page=0&APN=&Doc_Type=007&Pages=13&Image=B16033AA.AAB&Path=&Prev_Search=0006%20&P_Stat1=&P_Desc1=&P_Stat2=&P_Desc2=&P_Stat3=&P_Desc3=&P_Stat4=&P_Desc4=&P_Verify=Y&FIRST=Y&Doc_request=SELECT
Message:
<head>
<meta http-equiv="Expires" content="0">
<meta http-equiv="Pragma" content="no-cache">
<STYLE TYPE="text/css">
#loading { position: absolute }
NET.DATA Error: Function call to DTW_RGETCOOKIE failed. Error Number is 8000.
I am not sure what exactly the problem is.

sitemap for multilingual page

I try to create a sitemap for a typo3 installation with multible languages. I tried like 10 extensions and noone of them seems to fit. Some of them create the sitemap just for the default language. Some of them create links for all languages, but they also create links to pages that are not translated at all.
Idealy I would like to output a sitemap like this: https://support.google.com/webmasters/answer/2620865?hl=en
And only add links to other languages if that page exists in that language. Also we do not use the default language at all. So I just want the localized links in it.
I also tried to create something with fluid and then output it as XML, without good success.
Any idea how to archive that?
Edit (this edit belongs to the answer of Jozef Spisiak and his changes to seo_basics)
The changed seo_basics from Jozef Spisiak output following code:
Config:
tx_seo_xmlsitemaps.10.sysLanguageHrefLangMappings {
# sys_language_uid = hreflang
1 = de-ch
4 = de-at
12 = de
}
Output:
<url>
<loc>http://domain.com/</loc>
<lastmod>2016-10-13T17:53:56+02:00</lastmod>
</url>
<url>
<loc>http://domain.com/home/</loc>
<lastmod>2016-06-27T15:25:24+02:00</lastmod>
<xhtml:link rel="alternate" hreflang="" href="http://domain.com/home/" />
<xhtml:link rel="alternate" hreflang="de-ch" href="http://domain.com/ch/home/" />
<xhtml:link rel="alternate" hreflang="de-at" href="http://domain.com/at/home/" />
<xhtml:link rel="alternate" hreflang="de" href="http://domain.com/de/home/" />
</url>
<url>
<loc>http://domain.com/ch/home/</loc>
<lastmod>2016-06-27T15:25:24+02:00</lastmod>
<xhtml:link rel="alternate" hreflang="" href="http://domain.com/home/" />
<xhtml:link rel="alternate" hreflang="de-ch" href="http://domain.com/ch/home/" />
<xhtml:link rel="alternate" hreflang="de-at" href="http://domain.com/at/home/" />
<xhtml:link rel="alternate" hreflang="de" href="http://domain.com/de/home/" />
</url>
<url>
<loc>http://domain.com/at/home/</loc>
<lastmod>2016-06-27T15:25:24+02:00</lastmod>
<xhtml:link rel="alternate" hreflang="" href="http://domain.com/home/" />
<xhtml:link rel="alternate" hreflang="de-ch" href="http://domain.com/ch/home/" />
<xhtml:link rel="alternate" hreflang="de-at" href="http://domain.com/at/home/" />
<xhtml:link rel="alternate" hreflang="de" href="http://domain.com/de/home/" />
</url>
<url>
<loc>http://domain.com/de/home/</loc>
<lastmod>2016-06-27T15:25:24+02:00</lastmod>
<xhtml:link rel="alternate" hreflang="" href="http://domain.com/home/" />
<xhtml:link rel="alternate" hreflang="de-ch" href="http://domain.com/ch/home/" />
<xhtml:link rel="alternate" hreflang="de-at" href="http://domain.com/at/home/" />
<xhtml:link rel="alternate" hreflang="de" href="http://domain.com/de/home/" />
</url>
We are using seo_basics and created this feature together with typoscript configuration on which languages to show in sitemap. You can check the code here: https://github.com/pixelant/t3ext-seo_basics/
For configuration, check commented out section of typoscript setup. We also created pull request, but it is still waiting for feedback:
https://github.com/b13/t3ext-seo_basics/pull/30

In Middleman, redirects to a temporary home page in my config.rb not working

Originally in my config.rb I had the following:
activate :i18n, mount_at_root: false, langs: ['en-us', 'es-mx']
activate :directory_indexes
redirect 'index.html', to: 'en-us'
This works great for redirecting localhost:4567/ to localhost:4567/en-us. However, I would actually like to redirect localhost:4567/ and localhost:4567/en-us to localhost:4567/en-us/temporary-home-page.
Changing my previous redirect in config.rb works fine:
redirect 'index.html', to: "en-us/temporary-home-page"
When I try adding the redirect for localhost:4567/en-us, it doesn't work:
redirect 'en-us/index.html', to: "en-us/temporary-home-page"
I still end up on localhost:4567/en-us. I also tried each of the following combinations with the same result:
redirect 'en-us', to: "en-us/temporary-home-page"
redirect 'en-us/', to: "en-us/temporary-home-page"
redirect 'en-us/index.html', to: "en-us/temporary-home-page"
redirect '/en-us', to: "en-us/temporary-home-page"
redirect '/en-us/', to: "en-us/temporary-home-page"
redirect '/en-us/index.html', to: "en-us/temporary-home-page"
On some it would output this in the browser:
<html>
<head>
<link rel="canonical" href="en-us/temporary-home-page" />
<meta http-equiv=refresh content="0; url=en-us/temporary-home-page" />
<meta name="robots" content="noindex,follow" />
<meta http-equiv="cache-control" content="no-cache" />
</head>
<body>
</body>
</html>
What am I missing? How can I get the /, /en-us, and /en-us/ URLs to redirect to /en-us/temporary-home-page?

a slippery JSF syntax error

If I try to display a JSF 2 page on Tomcat 7.0.34 with:
jsf-api/impl 2.1.7
el-api 2.5
jstl 1.2
like this one:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:fn="http://java.sun.com/jsp/jstl/functions"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui"
xmlns:cis="http://java.sun.com/jsf/composite/comp">
<h:head>
<title>Prova errore di sintassi</title>
</h:head>
<h:body>
<f:view>
<ui:include src="/WEB-INF/include/menubar.xhtml" />
<h:form>
<p:ajaxStatus style="width: 32px;height: 32px;" />
<p:growl />
<p:panel id="pannello">
<p:focus />
<p:messages
showDetail="true"
globalOnly="true" />
<h:panelGrid columns="3">
<p:outputLabel
for="ckpensionat2"
value="Pens2"
title="tit x pens2"
style="padding-right: 3px; display: inline-block; min-width: 60px;" />
<p:selectBooleanCheckbox
id="ckpensionat2"
value="#{miocomp.pensionato}"
title="tit x pens2"
valueChangeListener="#{miocomp.pensCambiato}" />
</p:selectBooleanCheckbox>
<h:outputLabel value="pippo" />
</h:outputLabel>
<p:message for="ckpensionat2" />
<p:commandButton
value="agg"
update="pannello" />
</h:panelGrid>
</p:panel>
</h:form>
</f:view>
</h:body>
</html>
Nothing is showing!
please pay attention to the error of double closing tag
.../>
</p:selectBooleanCheckbox>
<h:outputLabel value="pippo" />
</h:outputLabel>
My questions are:
why </h:outputLabel> is evincted like a syntax error on Eclipse while </p:selectBooleanCheckbox> not
when I try to show this page I get a blank page. If I remove the error all goes fine.
no errors at all appears on my log view neither on tomcat 7 log dir
thanks in advance for any suggestions
It is a syntax error (invalid XML) since in <h:outputLabel value="pippo" />
</h:outputLabel> you close the tag twice; once with the /> end tag and secondly with the </h:outputLabel> element. Also, p:selectBooleanCheckbox doesn't have title attribute. I'm pretty sure IDE can't validate the rest of the document because of these errors, so it only complains about the first.
That's normal...
I believe you should increase the log level or change the javax.faces.PROJECT_STAGE parameter to Development in your app's web.xml