Difference between Dynamic & Static Website

Static Website looks basic and is for a smaller company,and simply delivers information without any bells and whistles, it could be a static website.
Static websites can only really be updated by someone with a knowledge of website development. Static websites are the cheapest to develop and host.

Advantage :Quick to develop, Cheap to develop, Cheap to host.

Disadvantage : Requires web development expertise to update site, Site not as useful for the user, Content can get stagnant

Dynamic website can give the website owner the ability to simply update and add new content to the site.Some examples of dynamic website features could be: content management system, e-commerce system, bulletin / discussion boards, intranet or extranet facilities, ability for clients
or users to upload documents, ability for administrators or users to create content or add information to a site (dynamic publishing).

Advantage : Much more functional website, Much easier to update, New content brings people back to the site and helps in the search engines
,Can work as a system to allow staff or users to collaborate

Disadvantage : Slower / more expensive to develop, Hosting costs a little more.

 

Convert Big WordPress Website into Static HTML Files

How can i do that, and deploy it to Fireb… | Read the rest of https://www.webhostingtalk.com/showthread.php?t=1834936&goto=newpost

php – Are static websites significantly faster than dynamic?

For a typical site on a server which is not under heavy use the difference should be negligible – certainly nowhere near 500ms. That said, generalization is difficult and very site/application dependant.

Most of the overhead is not the reading/writing to/from the database, but the additional overheads of parsing the code through php – especially when the database contents are manipulated/parsed – eg adding a header and footer, searching the returned page for placeholders (eg shortvodes in WordPress), complex designs which require multiple database queries, access perms etc.

That said, computers are unbelievably fast at these kinds of operations, and a filesystem is just a kind of non-sql database – in fact I’d go for an optimised database based solution on SSD over an unoptimised staric html solution on hdd on a system which is memory constrained.

Its worth noting that – on a lightweight database/static page setup overheads relating to Internet traffic – eg DNS lookup, https negotiation will be a far bigger component of how long it takes to load a page then actually getting the page.

Its also worth commenting that many caching modules/plugins are a hybrid system which renders the static page to disk and whenever its changed in the database recreates a static page which is given to users on request.

How to add static pages in the Magento 2 search result?

I’m using a Magento 2.4 and in my project I have many static pages that I would like to be part of my search results.

Magento 2 search

How could I add Magento 2 static pages in my search results?

static analysis – Is my compilers assignment irrational?

In our assignment we are given a grammar (called minipython) and we are asked to implement some phases of compilation (parsing, some semantic analysis).

One of the requirements is to be able to check for types in an arithmetic expression (arithmetic expressions are only defined for integers). For example in the below code:

def add(x,y):
   return "hello world"
print add(2,1)+ 2

We are expected to detect such errors. However the language,like python, seems dynamic to me. Meaning that the return type of a function depends on the runtime (for example the function def f(x): return x

When we showed the instructor the code below:

a=0
b=1
if b>2:
    a = 'a'
c = a + b

The instructor told us we are supposed to detect such errors (in the arithmetic expression one type is string, the other is a number). And also he said we should run the code tracking the value of each variable.

Well… i haven’t heard of a compiler that runs the program in order to detect errors. I mean that would be impossible if the language is Turing-complete right? (I’m not sure if minipython is though)

One of my classmates is attempting to do this by setting a limit on the times he remains on any loop or setting a max recursion depth. But I don’t think this is right , i mean what compiler does this? I don’t know what magic people do in static analysis tools but i don’t expect that anyone runs the code in order to check type errors… unit tests are for that.

My question: Are my assignment’s tasks irrational?? Can this language have a totally inferred type system? I’m really confused and I don’t have much experience with compilers. Please correct me at any point if I have said anything that is wrong

I can also provide minipython’s BNF if its necessary.

networking – how to save static routes permanently in ubuntu

The current configuration:

server1:    
sudo route add -host 10.0.1.2 dev enp131s0f0
sudo route add -host 10.0.1.3 dev enp131s0f1

server2:    
sudo route add -host 10.0.1.1 dev enp131s0f0
sudo route add -host 10.0.1.3 dev enp131s0f1

server3:    
sudo route add -host 10.0.1.1 dev enp131s0f0
sudo route add -host 10.0.1.2 dev enp131s0f1

This configuration on both sides will be lost if any server is rebooted or the cable is unplugged and replugged.

Saving them in /etc/rc.local does not work for the above situations.

So, how to save them permanently for both netplan and NetworkManager. I have both Ubuntu desktop and Ubuntu server installed.

template – Html Templating for a WIP static site generator, written in Javascript

I wrote this to go in my simple static site generator. it takes any plaintext file (but meant for html) and injects the specified file contents and other data at matching tags. This is my first “big” JavaScript project, and most of my knowledge has come from several-year-old posts on StackExchange, YouTube, and Medium, so I cannot guarantee that I have followed modern conventions.

I have included test code, and It should run as-is however it does require a single index.html file in the same dir to test fileInject().

const fs = require('fs');

var test = `<!-- template:one -->
<!-- template:two -->
<!-- template:three -->
<!-- template:index.html -->
<!-- template:five -->`;

// Grab tags from template files. Does not return duplicates.
const getTags = (template) => {
    const regex = /<!-- template:(?<label>(?:(?!<!--).)+) -->/g;
    var match, matches = ();
    while(match = regex.exec(template)) {
        if(!matches.includes(match)) {
            matches.push((match.groups.label, match(0)));
        }
    }
    return matches;
}

// Inject data at matching tags. Tag object format: (('key','value'), ...)
// Silent on failure, but mostly because I do not know how to check if template.replace() succeeds or fails. 
const dataInject = (template, tags) => {
    for(let tag of tags) {
        const regex = new RegExp(`<!-- template:${tag(0)} -->`, 'g');
        template = template.replace(regex, tag(1));
    }
    return template;
}

// Find and inject file contents at matching tags.
// Logs errors on failure.
const fileInject = (template) => {
    const tags = getTags(template);
    for(let tag of tags) {
        try{
            fs.accessSync(tag(0));
            const partial = fs.readFileSync(tag(0)).toString();
            template = template.replace(tag(1), partial);
        } catch(e) { console.log(`error injecting file '${tag(0)}'`) }
    }
    return template;
}

// Individual tests
//console.log(dataInject(test, (('one','apple'),('three','orange'),('five','banana'))));
//console.log(fileInject(test));

//combined tests. Both work, however (if combined) dataInject() should be called first as fileInject() will finish quicker encounter fewer failures.
//console.log(dataInject(fileInject(test), (('one','apple'),('three','orange'),('five','banana'))));
console.log(fileInject(dataInject(test, (('one','apple'),('three','orange'),('five','banana')))));

magento2 – How to override phtml / add a static image to .phtml file from the extension?

I’m try to add a banner image to the list.phtml, but it’s not displaying.

This is what i did:

step 1: copied /public_html/vendor/mirasvit/module-rewards/src/RewardsCustomerAccount/view/frontend/templates/account/list.phtml

into

/public_html/app/design/frontend/Infortis/ultimo/Mirasvit_RewardsCustomerAccount/templates/account/list.phtml

step2: upload the image to /public_html/app/design/frontend/Infortis/ultimo/web/images/membership-banner.jpg

step 3: modify the list.phtml as below

<?php
/** @var MirasvitRewardsCustomerAccountBlockAccountListing $block */
$collection = $block->getTransactionCollection();
$earnRules = $block->getDisplayEarnRules();
$spendRules = $block->getDisplaySpendRules();
?>
<div class="block block-rewards-account-summary order-details-items">
    <div class="block-title">
        <?= $block->getChildHtml('rewards.page.main.title'); ?>
        <strong><?= __('Points Summary') ?></strong>
    </div>

    <div class="block-content">
        <p><?= __('You have <b>%1</b> in your account.', $this->helper('MirasvitRewardsHelperData')->formatPoints($block->getBalancePoints())); ?></p>
        <p><?= $block->getChildHtml('rewards.notification') ?></p>
        <p><?= __('test.'); ?> </p>
    </div>
    
    <!--adding this part trying to display the image-->
    <div class="block-content"> 
        <img src="https://magento.stackexchange.com/<?php echo $this->getViewFileUrl("Infortis_Ultimo::images/membership-banner.jpg'); ?>' alt="membership-banner" width="1150" height="325">
    </div>


</div>

step 4: run php bin/magento s:s:d; php bin/magento c:f but nothing changes on the frontend.

Workaround for handling email subscriptions/notifications on static blog without third party app?

Problem

I have a static blog and want to have an email subscription form without a third-party app. Mainly for privacy reasons and for learning how to do it.

Background

I have a static blog. I love it! Posting couldn’t be easier and everything loads superfast. I’m using zola to produce the output (an SSG like Hugo, Jekyll, etc.) and hosting for free on Netlify. I’m not wedded to any platform.

I would like to be able to have people sign up (in some way) for notifications. They don’t have to get them right away, but within a day or two. But I just want to avoid collecting a bunch of emails and sending them out by hand.

Do I have to have a database of some kind? Is there a way of having the site send information to my local database through Netlify? I’m quite lost about how to go about this.

For an example of how I handle comments: I got around using JS by having a mailto link for each page. If people want to comment, they click it, and it sends me an email with the subject “Comment on (page name)”. If I like the comment, I can then add it to the bottom of the page. A kind of workaround solution like this for email would work for me.

I’m not opposed to learning how to code more, but I am kind of a beginner when it comes to web apps.

What I’ve tried

  1. Learning Django (from zero). Really quite a challenge for a beginner and wouldn’t work on Netlify anyway. Would need to move to Heroku. Is this a reasonable ask of a beginner programmer? Would I be able to migrate my content easily?

  2. Adding Feedburner link. Works okay, just don’t like having to go through a third party.

  3. ??? something I haven’t thought of yet?

c++ – How do I stop a moving object when colliding with a static wall or falling to a static ground

I’m writing my very first 2D game engine in C++ and SDL2. I wrote a very simplistic RigidBody class that computes the resultant force, applies forces and simulates gravity. I also wrote a BoxCollider class and a QuadTree class which as any game dev would know manages collisions. Every thing seems to be working fine, however I’m facing a pit stop I can’t wrap my head around. How do I stop a GameObject when it collides with a static wall or ground. I tried setting the velocity to zero but that literally freezes the object and I can’t move it using my controls. Also setting the gravity to zero doesn’t stop the object since it still has a non zero velocity and it sort of digs it’s way through the ground. How can I implement this and if there are any decent tutorials regarding my question please do share them. Thanks!