build simple professional HTML website one or multi page for $5

build simple professional HTML website one or multi page

I will create a simple but Professional HTML5 website – One page or Multi PageFor Busines presentations, Corporate, Creative, Education etc…You can show me some examples of the websites if you want it to look similar.Also you will have to describe me what the website is about, so i can know how should the website look.I am front end developer, professional in HTML5.Conact me before the ordering

.

composer – Cannot enable simple fb connect module

Drupal 8.9.13.
Acquia Devdesktop on Windows

I installed Simple FB connect module via composer as directed by documentation current version and tried the dev version too: composer require “drupal/simple_fb_connect:3.x-dev”.

The module seems to be installed along with the required Facebook SDK library which is placed in the vendor directory of the project root.

When I try to enable the Simple FB connect module, I am getting the error: Facebook SDK library is not found. I tried several times, no luck.

Please help.

Find all finite dimensional simple Lie algebras satisfying certain conditions

Let $mathfrak{g}$ be a finite dimensional simple Lie algebra over $mathbb{C}$. Suppose that $mathfrak{g}$ can be generated by five nonzero elements $x,y,x’,y’,hin mathfrak{g}$, which satisfy the following relations:

$$(x,y)=h, (h,x)=2x, (h,y)=-2ytag{1}$$
$$(x’,y’)=h, (h,x’)=2x’, (h,y’)=-2y’tag{2}$$
$$(x,x’)=(y,y’)=0tag{3}$$

Basically, ${x,y,h}$ and ${x’,y’,h}$ each form a $mathfrak{sl}(2)$, sharing the same CSA, and with $(x,x’)=(y,y’)=0$. We can represent the relations graphically as follows:
Graphical representation of the generators

Question: what are all possibilities of $mathfrak{g}$? My conjecture is that $mathfrak{g}$ can only be $mathfrak{sl}(2)$, with $x=lambda x’, y’=lambda y$, for some $lambdain mathbb{C}$, but I have no idea how to prove it.

(A vague idea: maybe we can first prove that there exist $fin mathrm{Aut}(mathfrak{g})$ with $f(x)=x’,f(y)=y’,f(h)=h$, and then use our knowledge of automorphisms of simple Lie algebra to restrict the possibilities of $mathfrak{g}$?)

c – a simple interrupt polling program due to AXI DMA IP

The program transfers a data array from a Zynq-7000 PS DDR to a BRAM IP (block RAM) memory in a PL part of a FPGA due to a PL AXI DMA IP. Inferring a xilinx axi dma driver (not scatter-gather mode), an interrupt controller and the vendor’s printf function the data array is carried from the DDR to the BRAM.

main.c

#include "xstatus.h"

#include "platform_.h"
#include "axi_dma_intr_poll.h"

#define TX_BUFFER               (uint32_t *) 0x01100000
#define RX_BUFFER               (uint32_t *) XPAR_BRAM_0_BASEADDR

#define RESET_TIMEOUT_CNTR_VAL  0x1000
#define MAX_TX_VALUE            0x100
#define PAYLOAD_SIZE            MAX_TX_VALUE

volatile _Bool tx_done_flag, rx_done_flag, tx_error, rx_error;

axi_dma_init_str init;
axi_dma_poll_str poll;
axi_dma_handler_str handler;

static void tx_intr_handler(void *callback);
static void rx_intr_handler(void *callback);

static inline void printf_array(uint32_t *p_array, size_t size);

int main(void) {

    uint8_t mul_coefficient = 0;
    const uint8_t c_ascii_num_offset = 0x30;
    uint32_t i = 0;

    memset((uint8_t *) XPAR_BRAM_0_BASEADDR,0,0x100);

    init.dma_id = XPAR_AXIDMA_0_DEVICE_ID;
    init.rx_intr_handler = rx_intr_handler;
    init.tx_intr_handler = tx_intr_handler;
    init.rx_intr_id = XPAR_FABRIC_AXIDMA_0_S2MM_INTROUT_VEC_ID;
    init.tx_intr_id = XPAR_FABRIC_AXIDMA_0_MM2S_INTROUT_VEC_ID;

    poll.p_tx_buf = TX_BUFFER;
    poll.p_rx_buf = RX_BUFFER;
    poll.size = PAYLOAD_SIZE;

    axi_dma_init(&init, &handler);

    while(1) {
        xil_printf("AXI DMA %d: ready. Insert multiplier coefficient (1 - 9): ", init.dma_id);

        mul_coefficient = inbyte();
        mul_coefficient -= c_ascii_num_offset;
        xil_printf("%dnr", mul_coefficient);

        for(i = 0; i < MAX_TX_VALUE; i++) {
            poll.p_tx_buf(i) = (i * mul_coefficient) % MAX_TX_VALUE;
        }

        tx_done_flag = FALSE;
        rx_done_flag = FALSE;

        axi_dma_poll(&poll, &handler.axi_dma, init.dma_id);

        xil_printf("AXI DMA %d: waiting completion of the poll...", init.dma_id);

        while((FALSE == tx_done_flag) || (FALSE == rx_done_flag)) {
            asm("NOP");
        }

        if ((TRUE == tx_error) || (TRUE == rx_error)) {
            xil_printf("AXI DMA %d ERROR: the polling ERROR", init.dma_id);
        }
        else {
            xil_printf("nnrAXI DMA %d: the tx buffer:nr", init.dma_id);
            printf_array(TX_BUFFER ,PAYLOAD_SIZE);

            xil_printf("nnrAXI DMA %d: the rx buffer:nr", init.dma_id);
            printf_array(RX_BUFFER, PAYLOAD_SIZE);
        }

        xil_printf("nnr");
    }

    return XST_SUCCESS;
}

static void tx_intr_handler(void *callback) {

    uint32_t status = 0;
    int reset_cntr = RESET_TIMEOUT_CNTR_VAL;
    XAxiDma *axi_dma = (XAxiDma *) callback;

    status = XAxiDma_IntrGetIrq(axi_dma, XAXIDMA_DMA_TO_DEVICE);

    XAxiDma_IntrAckIrq(axi_dma, status, XAXIDMA_DMA_TO_DEVICE);

    tx_done_flag = TRUE;

    if (FALSE != (status & XAXIDMA_IRQ_ALL_MASK) &&
       (TRUE == (status & XAXIDMA_IRQ_ERROR_MASK))) {
        tx_error = TRUE;
        XAxiDma_Reset(axi_dma);

        while (reset_cntr--) {
            if (XAxiDma_ResetIsDone(axi_dma)) {
                break;
            }

        }
    }
}


static void rx_intr_handler(void *callback)
{
    uint32_t status = 0;
    int reset_cntr = RESET_TIMEOUT_CNTR_VAL;
    XAxiDma *axi_dma = (XAxiDma *) callback;

    status = XAxiDma_IntrGetIrq(axi_dma, XAXIDMA_DEVICE_TO_DMA);

    XAxiDma_IntrAckIrq(axi_dma, status, XAXIDMA_DEVICE_TO_DMA);

    rx_done_flag = TRUE;

    if ((FALSE != (status & XAXIDMA_IRQ_ALL_MASK)) &&
       (TRUE == (status & XAXIDMA_IRQ_ERROR_MASK))) {
        rx_error = TRUE;
        XAxiDma_Reset(axi_dma);

        while (reset_cntr--) {
            if (XAxiDma_ResetIsDone(axi_dma)) {
                break;
            }
        }
    }
}

static inline void printf_array(uint32_t *p_array, size_t size) {
    const uint8_t c_values_per_line = 10;
    uint32_t i = 0;

    for(i = 0; i < size; i++) {
        xil_printf("%d ", *(TX_BUFFER + i));

        if (FALSE == (i % c_values_per_line) && (0 != i)) {
            xil_printf("nr");
        }
    }
}

axi_dma_intr_poll.c

#include "xil_exception.h"

#include "axi_dma_intr_poll.h"

static int enable_intr_(axi_dma_handler_str *p_handler, axi_dma_init_str *p_init);

int axi_dma_init(axi_dma_init_str *p_init, axi_dma_handler_str *p_handler) {

    if ((NULL == p_init) || (NULL == p_handler)) {
        xil_printf("AXI DMA %d ERROR: the entire axi_dma_init function ERRORrn", p_init->dma_id);
        return XST_FAILURE;
    }

    memset(p_handler, 0, sizeof(axi_dma_handler_str));

    p_handler->p_config = XAxiDma_LookupConfig(p_init->dma_id);
    if (NULL == p_handler->p_config) {
        xil_printf("AXI DMA %d ERROR: the dma lookup config FAILEDrn", p_init->dma_id);
        return XST_FAILURE;
    }

    if (XST_SUCCESS != XAxiDma_CfgInitialize(&(p_handler->axi_dma), p_handler->p_config)) {
        xil_printf("AXI DMA %d ERROR: the dma initialization FAILEDrn", p_init->dma_id);
        return XST_FAILURE;
    }

    if(TRUE == XAxiDma_HasSg(&(p_handler->axi_dma))){
        xil_printf("AXI DMA %d ERROR: the device configured as SG modern", p_init->dma_id);
        return XST_FAILURE;
    }

    if (XST_SUCCESS != enable_intr_(p_handler, p_init)) {
        xil_printf("AXI DMA %d ERROR: the interrupt setup FAILEDrn");
        return XST_FAILURE;
    }

    return XST_SUCCESS;
}

int axi_dma_poll(axi_dma_poll_str *p_poll, XAxiDma *p_axi_dma, uint32_t dma_id) {

    if ((NULL == p_poll) || (NULL == p_axi_dma)) {
        xil_printf("AXI DMA %d ERROR: the entire axi_dma_poll function ERRORrn", dma_id);
        return XST_FAILURE;
    }

    Xil_DCacheFlushRange((UINTPTR) (p_poll->p_tx_buf), p_poll->size);

    if (XST_SUCCESS != XAxiDma_SimpleTransfer(p_axi_dma,(UINTPTR) (p_poll->p_tx_buf),
                                              p_poll->size, XAXIDMA_DMA_TO_DEVICE)) {
        xil_printf("AXI DMA %d ERROR: the tx buffer setting FAILEDrn", dma_id);
        return XST_FAILURE;
    }

    if (XST_SUCCESS != XAxiDma_SimpleTransfer(p_axi_dma,(UINTPTR) (p_poll->p_rx_buf),
                                              p_poll->size, XAXIDMA_DEVICE_TO_DMA)) {
        xil_printf("AXI DMA %d ERROR: the rx buffer setting FAILEDrn", dma_id);
        return XST_FAILURE;
    }

    return XST_SUCCESS;
}

int axi_dma_release(XScuGic *p_scu_gic, uint32_t tx_intr_id, uint32_t rx_intr_id) {

    if ((NULL == p_scu_gic) || (0 == tx_intr_id) || (0 == rx_intr_id)) {
        xil_printf("AXI DMA %d ERROR: the entire axi_dma_release function ERRORrn", p_scu_gic->Config->DeviceId);
        return XST_FAILURE;
    }

    XScuGic_Disconnect(p_scu_gic, tx_intr_id);
    XScuGic_Disconnect(p_scu_gic, rx_intr_id);

    return XST_SUCCESS;
}

static int enable_intr_(axi_dma_handler_str *p_handler, axi_dma_init_str *p_init) {

    const uint8_t c_priority = 0xA0, c_trigger_type = 0x3;

    p_handler->p_intc_config = XScuGic_LookupConfig(XPAR_SCUGIC_SINGLE_DEVICE_ID);
    if (NULL == p_handler->p_intc_config) {
        xil_printf("AXI DMA %d ERROR: the scu gic lookup config FAILEDrn", p_init->dma_id);
        return XST_FAILURE;
    }

    if (XST_SUCCESS != XScuGic_CfgInitialize(&(p_handler->scu_gic), p_handler->p_intc_config,
                                               p_handler->p_intc_config->CpuBaseAddress)) {
        xil_printf("AXI DMA %d ERROR: the scu gic initialization FAILEDrn", p_init->dma_id);
        return XST_FAILURE;
    }

    XScuGic_SetPriorityTriggerType(&(p_handler->scu_gic), p_init->tx_intr_id, c_priority, c_trigger_type);
    XScuGic_SetPriorityTriggerType(&(p_handler->scu_gic), p_init->rx_intr_id, c_priority, c_trigger_type);

    if (XST_SUCCESS != XScuGic_Connect(&(p_handler->scu_gic), p_init->tx_intr_id,
                                      (Xil_InterruptHandler)p_init->tx_intr_handler,
                                      &(p_handler->axi_dma))) {
        xil_printf("AXI DMA %d ERROR: the scu gic tx connection FAILEDrn", p_init->dma_id);
        return XST_FAILURE;
    }

    if (XST_SUCCESS != XScuGic_Connect(&(p_handler->scu_gic), p_init->rx_intr_id,
                                      (Xil_InterruptHandler)p_init->rx_intr_handler,
                                      &(p_handler->axi_dma))) {
        xil_printf("AXI DMA %d ERROR: the scu gic rx connection FAILEDrn", p_init->dma_id);
        return XST_FAILURE;
    }

    XScuGic_Enable(&(p_handler->scu_gic), p_init->tx_intr_id);
    XScuGic_Enable(&(p_handler->scu_gic), p_init->rx_intr_id);

    Xil_ExceptionInit();
    Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_INT, (Xil_ExceptionHandler)XScuGic_InterruptHandler,
                                (void *)&(p_handler->scu_gic));

    Xil_ExceptionEnable();

    XAxiDma_IntrDisable(&(p_handler->axi_dma), XAXIDMA_IRQ_ALL_MASK,
                       XAXIDMA_DMA_TO_DEVICE);

    XAxiDma_IntrDisable(&(p_handler->axi_dma), XAXIDMA_IRQ_ALL_MASK,
                       XAXIDMA_DEVICE_TO_DMA);

    XAxiDma_IntrEnable(&(p_handler->axi_dma), XAXIDMA_IRQ_ALL_MASK,
                      XAXIDMA_DMA_TO_DEVICE);

    XAxiDma_IntrEnable(&(p_handler->axi_dma), XAXIDMA_IRQ_ALL_MASK,
                      XAXIDMA_DEVICE_TO_DMA);

    return XST_SUCCESS;
}

axi_dma_intr_poll.h

#ifndef INC_AXI_DMA_POLL_H
#define INC_AXI_DMA_POLL_H

#include "xaxidma.h"
#include "xscugic.h"

#include "platform_.h"

typedef struct {
    uint32_t *p_tx_buf;
    uint32_t *p_rx_buf;
    size_t size;
} axi_dma_poll_str;

typedef struct {
    uint32_t tx_intr_id;
    uint32_t rx_intr_id;
    void (*rx_intr_handler)(void *);
    void (*tx_intr_handler)(void *);
    uint32_t dma_id;
} axi_dma_init_str;

typedef struct {
    XAxiDma axi_dma;
    XAxiDma_Config *p_config;
    XScuGic scu_gic;
    XScuGic_Config *p_intc_config;
} axi_dma_handler_str;

int axi_dma_init(axi_dma_init_str *p_init, axi_dma_handler_str *p_handler);
int axi_dma_poll(axi_dma_poll_str *p_poll, XAxiDma *p_axi_dma, uint32_t dma_id);
int axi_dma_release(XScuGic *p_scu_gic, uint32_t tx_intr_id, uint32_t rx_intr_id);

#endif

python – simple function f(g(x,y))

So the main problem is

def f(x,y):
  return (2*x,2*y)

def g(x,y):
  return (-x,-y)

z = g(0,1)

print(z)
print(f(z))

it’s an example. I have one function and returned two values.
And I want to print the f(g(0,1)), do you have any idea with it?

c++ – SImple pet caring game – console

I’m a beginner programmer and i’m looking for interesting projects to improve my low skills. I tried one day to improve my skills by trying to create a small game in which a user owns a cat, and has to feed it and clean it. My main aim of the game(which yet has many illogical things like the never decreasing happiness and cleanness level) was to try and keep my code as clean and presentable as possible. The game is made in 4 different files, and I will paste them all below. I will be happy if anyone could give me help on understanding where should I improve.

Lets go into the code:

main.cpp

#include "Cat.h"
#include "pet game.h"
#include <iostream>
using namespace std;

int main() {
    //Create the user's profile
    //User();

    //Welcome messages
    cout
            << "Welcome to Unga bonga! Here you buy pets and raise them as your kids, and try to level up, in order to finish the game!"
            << endl;
    showHelp();

    //Command execution
    do {
        commandIdentify();
    } while (true);
}
Cat cat;
//User user;

void showHelp() {
    cout << "The commands in this game are:" << endl
            << "1. to feed your cat, type f" << endl
            << "2. to clean your cat, type c" << endl
            << "3. to check your cat's happiness, type h" << endl
            << "4. to check your cash balance, type m" << endl
            << "5. to check your level status, type l" << endl
            << "6. to display this help message, type ?" << endl
            << "7. to exit, type e" << endl
            << "8. Finally, to play this game, enjoy!" << endl;
}
    
void commandIdentify() {
    //take input
    cin >> command;
    //identify and execute
    switch (command) {
    case 'f':
        feedCat();
        break;
    case 'c':
        cleanCat();
        break;
        case 'h':
         checkHappiness();
         break;
    case '?':
        showHelp();
        break;
    case 'e':
        exit();
    default:
        cout << "That's not a command -yet (probably)" << endl;
    }
}

void feedCat() {
    cout << "Time for food!!!" << endl;
    cat.feed();
}

void cleanCat() {
    cout << "Let's take a bath!!!" << endl;
    cat.clean();
}

void checkHappiness(){
 cat.checkHappiness();
 }

int exit() {
    exit(0);
    return 0;
}

pet game.h:

    #ifndef PET_GAME_H_
#define PET_GAME_H_

#include <iostream>
#include "Cat.h"
//#include "User.h"

using namespace std;

//Global variables
char command;
int exit();

//functions
void commandIdentify();
void buyNextCat();
void showHelp();
void tutorial();
void feedCat();
void cleanCat();
void checkHappiness();

//functions defined for a future use but they cause problems right now
void checkMoney();
void checkLevel();


#endif /* PET_GAME_H_ */

Cat.cpp:

#include <iostream>
#include <string>
#include "Cat.h"

using namespace std;

Cat::Cat(){
    happiness = 1;
    cleanness = 1;
}

void Cat::feed(){
    cout << "Yummy!!" << endl;
    Cat::happiness = Cat::happiness + 0.2;
}

void Cat::clean(){
    cout << "So soupy!!" << endl;
    Cat::cleanness = Cat::cleanness + 0.2;
}

Cat.h:

#ifndef CAT_H_
#define CAT_H_

#include <iostream>

using namespace std;

class Cat {
private:
    int happiness;
    bool happy = happiness >= 0.6;

    int cleanness;
    bool isClean = cleanness >= 0.6;
public:
    Cat();
    void feed();
    void clean();
    void checkHappiness() {
        cout << "Your cat's happiness is " << happiness*100 << "%" << endl;
    }

};

#endif /* CAT_H_ */

it will be great if you could tell me how to improve code

Simple, clean, privacy-friendly analytics (SaaS)

Why are you selling this site?
This is what I do most of the time. I usually build starter sites and sell them.

How is it monetized?
Given that this website costs virtually nothing to operate, any revenue made is pure profit. Analyzz is a SaaS platform. Therefore it can be monetization through either subscription or advertisements. At the time, Analyzz has two paid plan for its users. You can either add more plans or edit them through Analyzz’s admin panel.

There is an on-going LTD on AppSumo which getting sales every day.

Does this site come with any social media accounts?
Yes. You will be given access to Analyzz’s official Facebook and Twitter accounts.

How much time does this site take to run?
Analyzz runs itself through cronjobs. Basically, it’s on auto-pilot.
SEMrush

Executive Summary
(​IMG)

If you operate a website or sell things online, you know how valuable it is to understand each visitor’s journey It pays to know how people engage with your site — how else will you be able to optimize it to convert more visitors into buyers? Understanding customer behavior is crucial for any entrepreneur — the question is how to get it. There are a lot of tools out there, but not many as simple, streamlined, and straightforward as Analyzz

Analyzz lets you figuratively look over your customers’ shoulders online as they shop, buy, register, or click on anything. You can check the path each visitor took to reach a certain destination, record sessions in real-time, and look at heatmaps and analytics to understand what users use most on your website.

The best thing about Analyzz is that we provide two tracking methods, one being fully compliant with GDPR, CCPA, PECR and no tracking consent needed.

Analyzz works on thousands of platforms. The setup requires a simple copy and paste and you’re good to go! – Your customers can monitor any of their websites.

  • WordPress
  • Wix
  • Joomla
  • Squarespace
  • Shopify
  • Weebly
  • WooCommerce
  • and more (you name it!)

Analyzz can easily be in the fight with other biggest providers out there. Analyzz has it all and it’s all automated.

  • No maintenance cost.
  • No need for expensive servers (Can be run on Shared Hosting and that will only cost you around $20 max per year)
  • No need to spend much time maintaining the site. (100% Autopilot)
  • No physical products sale and purchase.
  • Easy to promote on Google ads, Facebook and Instagram
  • 100% customizable, Clean, and developed by the latest codes.

Features of Analyzz

  • Visitor Behavior: Check each visitors path & what they are doing on your site without intruding on their privacy
  • Session Recording: See your visitors journey – what they click, where they’re going & what they like and do not understand
  • Heatmaps: Understand which parts are the most used by a collection of users on your website
  • Analytics: Get a clean & simple interface w/ easy to understand analytics
  • Real-Time Data: Check how many users are online, which devices are the most popular & what pages are most accessed
  • Privacy: Unlike other analytics platforms, we don’t use your data. You control your data.

What’s included in the sale?

  • Brand assets (Logos, covers, etc)
  • Hosting accounts
  • Domain name
  • Website files, source code, and content
  • Post-sale support

 

performance – PostgreSQL: Simple IN vs IN values performace

We have queries with IN filters with long list of INT values

Sometimes, they running extremely slow, and I have found suggestion to use syntax

Field IN (VALUES(1465), (1478), ...

Instead of

Field IN (1465, 1478, ...

On some cases it helps, but on other it makes query running 1000+ times slower

So the issue is:

  • some queries much faster with simple IN
  • some queries much faster with IN + VALUES

Here is explain on case when it’s extremely slow:

->  HashAggregate  (cost=5.78..9.62 rows=385 width=4)
       Group Key: ""*VALUES*"".column1" 
                   ->  Values Scan on ""*VALUES*""  (cost=0.00..4.81 rows=385 width=4)" 

What is the right way to pass long INT values list to IN filter?

I am using PostgreSQL 13.1 on Ubuntu

c++ – Simple read/write lock implementation without starvation

I’ve built a read/write lock and have been testing it without encountering any problems. It was made to avoid writer starvation, but I believe it works against reader starvation as well. I’ve seen alternatives online, but was wondering if this is a solid implementation.

If you use a normal shared mutex, new read actions can still be queued, which will prevent write actions from ever being processed while there is any read action present. This will cause starvation. I used a second mutex which will be locked by the write process and prevents any new read processes to be queued. Thank you!

class unique_priority_mutex
{
public:

    void lock_shared(void)
    {
        // If there is a unique operation running, wait for it to finish.
        if( this->_is_blocked ){
            // Use a shared lock to let all shared actions through as soon as the unique action finishes.
            std::shared_lock<std::shared_mutex> l(this->_unique_mutex);
        }

        // Allow for multiple shared actions, but no unique actions.
        this->_shared_mutex.lock_shared();
    }

    void unlock_shared(void)
    {
        this->_shared_mutex.unlock_shared();
    }

    void lock(void)
    {
        // Avoid other unique actions and avoid new shared actions from being queued.
        this->_unique_mutex.lock();

        // Redirect shared actions to the unique lock.
        this->_is_blocked = true;

        // Perform the unique lock.
        this->_shared_mutex.lock();
    }

    void unlock(void)
    {
        this->_shared_mutex.unlock();
        this->_is_blocked = false;
        this->_unique_mutex.unlock();
    }

    std::shared_mutex _shared_mutex;
    std::shared_mutex _unique_mutex;
    std::atomic<bool> _is_blocked = false;
};

python – how to refactor this simple but tricky input task?

I’m embarassed i spent so much time on this seemingly simple but tricky coding exercise.

The task is this: input is various numbers.

The only valid numbers are :

  • 1,2,3 ,4,5,6
  • +1, +2, … +6
  • 1.0, 2.0,… 6.0
  • any scientific notation that represent numbers 1 to 6.

if number is 1 – print “rule1” , 2- “rule2” etc.

If input number is 0 or .0 or 0.e00 it prints all 6 – “rule1, rule2,…. rule6”

  • Negative numbers should simply be printed as-is: -1 prints ‘-1’
  • any digits in scientific notation that are not in (1 .. 6) should be printed as is.
  • any char like dot is printed as-is – ‘nine’ is printed ‘nine’

Sample input:

1.0  03
 
 +5
 
 2.0e0
+.4e1
6.E+00
20e-1 2e1 2ва . 1e-307

expected output:

rule1
rule3
rule5
rule2
rule4
rule6
rule2
2e1
2ва
.
1e-307

Here is my code – how to refactor it , more elegant way?:

from math import modf
import fileinput


rule1 = 'rule1'
rule2 = 'rule2'
rule3 = 'rule3'
rule4 = 'rule4'
rule5 = 'rule5'
rule6 = 'rule6'


def print_rule(n):
    if n == 1:
        print(rule1)
    elif n == 2:
        print(rule2)
    elif n == 3:
        print(rule3)
    elif n == 4:
        print(rule4)
    elif n == 5:
        print(rule5)
    elif n == 6:
        print(rule6)


def print_all():
    print(rule1)
    print(rule2)
    print(rule3)
    print(rule4)
    print(rule5)
    print(rule6)


def get_num(s):
    try:
        s = int(s)

        if s == 0:
            print_all()

        elif s in (1, 2, 3, 4, 5, 6):
            print_rule(s)
        elif s < 1 or s > 6:
            print(s)
    except ValueError:
        try:
            saved = s
            s = float(s)
            if s == 0:
                print_all()
            elif s < 1 or s > 6:
                print(saved)

            else:
                s = float(s)
                s = check_float(s)
                if s == 0:
                    print_all()
                elif s in (1, 2, 3, 4, 5, 6):
                    print_rule(s)
                else:
                    print(s)

        except ValueError:
            print(s)


def check_float(n):
    frac, _ = modf(n)
    if frac != 0:
        return n
    else:
        return n


def test2():

    for line in fileinput.input():
        line = line.strip().split()

        for item in line:
            get_num(item)


if __name__ == "__main__":

    test2()