Amp with Ruby on Rails - ruby-on-rails

I was learning AMP with rails using following links
https://coderwall.com/p/wpyasq/how-to-create-an-amp-page-for-your-dynamic-content-in-rails
I Have cloned a sample app using following links
https://github.com/ProGM/rails-google-amp-example
The application is very simple it just include one show page.
So when i hit
http://localhost:3000/articles/1
It goes to Articles controller Show action, takes only one request.
When i hit
http://localhost:3000/articles/1.amp
It takes 4 request. Am unable to find the reason.
Note: If i replace
<!doctype html>
<html amp>
to
<!doctype html>
<html>
It takes only one request.
Help will be appreciated
Thank you

Related

pyscript error with WordPress integration

Hi Goodies i have an issue in pyscript
issue : when i paste the below pyscript code in my WordPress post as an html and press preview it just simply popups to dawnload the pyodide file instead of showing the hello world message in the code below. Please someone can clear that to me why this is happening.
thanks regards
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="https://pyscript.net/latest/pyscript.css" />
<script defer src="https://pyscript.net/latest/pyscript.js"></script>
</head>
<body>
<py-script> print('Now you can!') </py-script>|
</body>
</html>
the output screenshots from the browser where i get this happening.
(1) From WordPress
this is once i write the code in real time wordpress post as an html
this is what i got once i click on preview
(2) Samething is happening in vscode live server instead of the showing the message hello world it just popup my dawnloader idm to dawnload a pyodide file.
this is the code in vscode with the live server
this is what i got once i run with the live server in vscode
i need to run a small python code in my WordPress post when someone visit my website and in that post once he requests some calculation so the python code should be responsible to do some calculations and show that to the user.
any suggestions please
From the logo on the popup messages you're getting in both cases, it looks like this is behavior caused by having [https://www.internetdownloadmanager.com/](Internet Download Manager) (IDM) installed.
When the Pyodide runtime loads, it fetches certain additional files from the web, including pyodide_py.tar (the compressed Python API files the Pyodide Python API, as well as any additional packages specified in <py-config>. If IDM is configured to interrupt fetching these necessary files, Pyodide will fail to load and/or execute.
You may be able to whitelist (allow) IDM to automatically download these files, but that's beyond my knowledge of that particular plugin.
For more discussion, here's a similar issue on the PyScript GitHub.

Github website hosting, handling incorrect subpages

I have hosted a simple singlepage HTML/CSS website on github. I wanted to redirect incorrect subpages (ie mysite.com/m) to redirect to the homepage (mysite.com) as the default route. Can this be achieved on a static site on github?
You can create a /m/index.html file containing :
<!DOCTYPE html>
<meta charset=utf-8>
<title>Redirecting...</title>
<link rel=canonical href="/index.html">
<meta http-equiv=refresh content="0; url=/index.html">
<h1>Redirecting...</h1>
Click here if you are not redirected.
<script>location='/index.html'</script>

Full html page as startpage in MVC application

Fairly new to MVC, and on my first schoolbased internship!
Im creating a mvc project and they are asking me to set an already finished html page as
"Home page" for the project. This homepage will "if links are clicked" redirect to the mvc
project and what i am creating.
Are there any particular guidelines or ways of how to do this in an pure "MVC correct" fashion?
Getting my info from wherever it is possible, so answers would be very appreciated!
You should first create some layout page like this example:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>Page</title>
</head>
<body>
#RenderBody()
</body>
</html>
In view associated with Home controller Index action place your already finished html code. Remove from there tags already existing in layout.
And after it modify all links url which referencing to your project actions to something like this:
<a href='#Url.Action("Home","SomeAction")'>Link</a>
I presume you use Visual Studio for that, right?
Open it, go to File > New Project
Select ASP.NET MVC 3 Web Application (here you can have many versions of MVC available)
Visual Studio will create a sample application with everything created for you. Study it.

How do I make WebHelp show help for a specific topic instead of the index?

I am in the process of adding help to my Lazarus application. I am using WebHelp rather than CHM help to aid in cross-platform utilisation.
WebHelp essentially uses a pair of html pages within a frameset - an index on the left, and the associated topic on the right. To open the help system at a specific page in the web browser, it is called as:
file:///path_to_help_files/index.htm#specific.htm
The Lazarus form has a THTMLHelpDatabase component, and a THTMLBrowserHelpViewer component as per the instructions at http://wiki.freepascal.org/Add_Help_to_Your_Application.
Individual components have their HelpType set to htKeyword, and the HelpKeyword set to HTML/index.htm or HTML/index.htm#something.htm
Whatever I enter, the help files are only opened at the default page (i.e. index.htm).
Does anyone have any ideas on how to get the help pages to open at a specific page?
[I can't specify a HelpKeyword of HTML/something.htm because that would omit the topic index. Effectively, I have to go through index.htm to get the frameset appearing.]
I have found one solution, but it is a bit clunky, so if anyone has a better idea, I'd like to hear it.
Essentially, I've created a redirect for something.html that looks like:
<!doctype html>
<html>
<head>
<title>Something</title>
<meta http-equiv="REFRESH" content="0;url=index.htm#something.htm">
</head>
<body>
Redirect to index.html
</body>
</html>
I then point the relevant Lazarus control at HTML/something.html in HelpKeyword so that when help is called, it redirects to the correct URL. (And yes, I am using a .html extension for the redirects, while the real files have .htm extensions - forced by the help authoring application).
The real hassle about this is that I've got to have a redirect file for every topic in the help system that I want to access directly from the Lazarus application.

Sending Text and HTML Emails - Why is Gmail Always Picking Text Version?

I'm sending some emails from my ASP.NET MVC application, using ActionMailer.NET.
Now, part of this process is sending both HTML and text versions of the message, to support text-only clients.
But what i'm seeing is that GMail is always picking the text version.
I tried Yahoo, and Yahoo is picking the HTML version correctly.
I tried dumbing down my HTML to nothing but a <h1> and a <span> tag, and GMail still picked the text version, which means there isn't a problem with the content of the HTML.
Is this expected behaviour?
Because when i send only the HTML version, GMail will show the HTML version correctly.
I've set the meta-tags in the HTML as follows:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
Has anyone else encountered this behaviour, and found a solution?
Because as it stands, i'll probably have to send only the HTML version, so that GMail will render it, as too many of our clients use GMail.
Here's an example of basic HTML i'm trying to send:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title></title>
</head>
<body>
<h1>This is the heading</h1>
<span>This is some text.</span>
</body>
</html>
And GMail won't even allow that.
Most web-based clients and desktop email clients ignore anything in the <head> tag of an email.
To send both html and text versions, you will need to construct the mail message properly - have two mime chunks.
Show us the full code you are using to construct your email.
I guess the first thing i should have checked is the ActionMailer.NET issues.
I did some Googling, and it didn't come up.
This issue was fixed 2 days ago, so getting the latest package fixed the problem.
https://bitbucket.org/swaj/actionmailer.net/issue/23/multipart-mail-problem
That issue was actually relating to Thunderbird, but guess GMail has a similar way of handling multipart emails.
Problem solved!

Resources