Image Generation in Action: 3 Methods With Code Samples and Image Generation API

Featured Imgs 23

In this article, we share our experience generating millions of images with DynaPictures in the last months. We will go over possible solutions needed to generate images programmatically, possible caveats and pitfalls you may hit, as well as the best practices that emerged from our experience using dynamic image generation.

So let us dive in and discuss what image generation is and then review the available options.

Why is my py code not working as intended?

558fe5180e0e8fc922d31c23ef84d240

Hi guys, i am new here. Been on this code for some days and i seem stuck and not getting the expected output from this code.
first the code functions as a FIFO QUEUE where it takes input from the user and put it at the beginning of a list while deleting the last item on the list and creating a new list.
then i did function to search for four floating numbers (1.3,1.4,1.5,1.6) in the new list such that any float in the list that has identical integer part and decimal part split like any of the four floating numbers(1.4, 1.5, 1.6, 1.3) is denoted as a variant of the float e.g 17.34, 35.19 and 30.01 will be variants of float 1.3. Similarly 12.56, 57.17 and 10.50 will be variant of float 1.5. Also,a float like 14.31 if present in the list will be regarded as a variant of both 1.3 and 1.4 while float 15.61 will be regarded as a variant of both float 1.5 and 1.6.
So anytime the code runs, it takes the first THREE numbers each in the list or queue that are variants of 1.3,1.4,1.5 and 1.6 and create a new list for each variant. for example

list1 =[1.72, 10.60, 34.21,18.40, 11.13, 45.33, 1.03, 35.91]
this list has 4 variants of float 1.3
the new lists that will be created for float 1.3 from this list when i run the search function is:

new list a=[1.72, 10.60,34.21]

new list b=[1.72, 10.60, 34.21, 18.40,11.13]

new list c=[1.72, 10.60,34.21, 18.40, 11.13,45.33,1.03]

Lastly, the code performs a reverse indexing on each of the 3 new list with the second to the last number on each list having an index of 1 and third to the last digit having an index of 2. if there is any number in each of the new list that is equal to or greater than 2 with the same index index number, then there is a match. and the functions returns an output. the number only has to be equal to or greater than 2 but the index must match for all 3 new list.

from the above lists, the code returns an output like this" there is a match at index 1 for variant 1.3"

attached to this post is the code i have written. its a bit longer than it should if not i would have posted it on here. it runs without any problems for the first run, but subsequently fails to bring out expected output when i change the number in the list or when the queue FIFO starts working.

i will be happy if anyone can take a look and help check whats wrong with it or help modify it to work as i want

Japanese Dating Safeness Tips

Featured Imgs 23
If you are looking for a Vietnamese partner, you can sign up in https://www.top10.com/dating/make-dating-profile-stand-out-men free online dating sites. These kinds of platforms give you a wide range of features and services that will help you find suits. These programs also have a large user base, which in turn increases the chance for finding a match. […]

Problem with submitting new topics

Featured Imgs 23

When I create a new topic and enter the mandatory tags, the tag dialog box sometimes overlays the "Continue to the Last Step" button leaving only the merest sliver of a button to click. Could the tag dialog be aligned left to avoid this?

Need help with tKinter Scrollbar, doesnt attach to listbox

558fe5180e0e8fc922d31c23ef84d240

from tkinter import *

app = Tk()

label1_text = StringVar()
part_label = Label(app, bg='#dfe3ee', text='Check1', font=('bold',12), pady=10, padx=20)
part_label.grid(row=0, column=0, sticky=W)
label1_entry = Entry(app, textvariable=label1_text)
label1_entry.grid(row=0, column=1)

label2_text = StringVar()
part_label = Label(app, bg='#dfe3ee', text='Check1', font=('bold', 12), pady=7, padx=20)
part_label.grid(row=1, column=0, sticky=W)
label2_entry = Entry(app, textvariable=label2_text)
label2_entry.grid(row=1, column=1)

label3_text = StringVar()
part_label = Label(app, bg='#dfe3ee', text='Check3', font=('bold', 12), pady=20)
part_label.grid(row=0, column=2)
label3_entry = Entry(app, textvariable=label3_text)
label3_entry.grid(row=0, column=3)

label4 = StringVar()
part_label = Label(app, bg='#dfe3ee', text='check4', font=('bold', 12), pady=7)
part_label.grid(row=1, column=2)
label4_entry = Entry(app, textvariable=label4)
label4_entry.grid(row=1, column=3)

B1_btn = Button(app, bg='#cd8de5', text='Button1',font=('bold', 11), width=12)
B1_btn.grid(row=3, column=1, padx=0, pady=5)

B2_btn = Button(app, bg='#cd8de5', text='Button2',font=('bold', 11), width=12 )
B2_btn.grid(row=4, column=1, padx=0, pady=5)

B3_btn = Button(app, bg='#d5a6e6', text='close',font=('bold', 11), width=12)
B3_btn.grid(row=50, column=2, sticky='E')

output_list = Listbox(app, height=20, width=100, border=5)
output_list.grid(row=20, column=0, columnspan=3, rowspan=6, pady=20, padx=20)

scrollbar = Scrollbar(app)
scrollbar.grid(row=20, column =3, rowspan=5, sticky=(N+S))

output_list.configure(yscrollcommand=scrollbar.set)
scrollbar.configure(command=output_list.yview)

app.title('Test Tool')
app.geometry('900x900')
app.configure(bg='#dfe3ee')

app.mainloop()

to calculate final score

558fe5180e0e8fc922d31c23ef84d240

i already done the scores for each round, i dont know how to calculate the scores for all round, can u help me to solve this?

#include <iostream>
#include <cstring>
#include <fstream>
#include <iomanip>
#include <ctime>
#include <cstdlib>
using namespace std;


//Global variable
const string cardfile=("cards.txt");


//Function Prototypes
void readCards();
int RandomCardP1 (int);
int RandomCardP2 (int);
int CheckType (int [], int ,int);
int CheckSystem (int [], int ,int );
void ShowCardP1(int , string [], string [], string [], string[] , string []);
void ShowCardP2(int, string [], string [], string [], string [], string []);
int Score(int ,int ,int [],int []);
int FinalScore (int,int);


int main(){

    //score
    int sctype[SIZE]={ 3,2,1,2,3,4,1,2,2,2 };
    int scsystem[SIZE]={ 6,4,2,1,5,7,1,2,3,5 };


    //loop for game
    do{
    int scP1=0,scP2=0; 

    for (int round=1;round<6;round++)
    {//loop for 5 round

        cout <<"\t***********";
        cout<<endl<<"\t  ROUND "<<round<<"\n";
        cout <<"\t***********";
        cout<<endl;


    //announce winner and score for each round
    Score(IDcardP1,IDcardP2,sctype-1,scsystem-1);
    cout<<endl;

    cin.get();
    cout<<endl<<endl;


    }//end loop for round


    //score total round
    FinalScore(scP1,scP2);


   } while(respond=='Y'||respond=='y');//end loop for game



}//end main


//scores for each round
int Score(int IDcardP1,int IDcardP2,int sctype[],int scsystem[]){

    int scP1=0, scP2=0;
    cout << "The winner for this round is " <<endl<<endl;
    if (sctype[IDcardP1]>sctype[IDcardP2])
    {
        cout << "  PLAYER 1  " <<endl;
        scP1+=10;
        cout<<endl;
    }
    else
    {
        if (scsystem[IDcardP1]>scsystem[IDcardP2])
        {
            cout << "  PLAYER 1  " <<endl;
            scP1+=10;
            cout<<endl;
        }
        else
        {
            cout << "  PLAYER 2  " <<endl;
            scP2+=10;
        }
        cout<<endl;
    }

    //display score for each round
    cout << "The scores for this round"<<endl;
    cout<<"####################################"<<endl;
    cout<<" Player 1 score :"<<scP1<<endl;
    cout<<" Player 2 score :"<<scP2<<endl;
    cout<<"####################################"<<endl;

}

//score for all round
int FinalScore(int scP1,int scP2){

    //score total round
    cout << "+++++++++++++++++++++++++++++++++"<<endl;
    cout << " Your scores for 5 round : "<< endl;
    cout << " Player 1's score: " << scP1<<endl;
    cout << " Player 2's score: " << scP2<<endl;
    cout << "+++++++++++++++++++++++++++++++++"<<endl;
    cout <<endl;

    //announce the winner for this game
    if (scP1>scP2)
        cout << "\tPLAYER 1 WON!" << endl << endl;
    else
        cout << "\tPLAYER 2 WON!" << endl << endl;
    cout<<endl;
}

WordPress Themes Directory Adds Block Themes to Filter Menu

Best Wordpress Themes 1

This week has been heavy with theme news, as the discussion around improving block themes’ visibility in the directory became heated before the Themes Team landed on a course of action. Meta contributors added a new “Block Themes” menu item to the filter menu on the directory homepage, a solution that some classic theme developers fought tooth and nail to discourage in the ticket over the course of seven weeks.

Clicking on Block Themes displays themes that have the full-site-editing feature tag. Previously, block themes were buried three clicks deep and users had to know how to find them through the feature filter. They are now easily accessible from the directory landing page.

Although most WordPress themes support blocks in the content editor, the “block themes” identifier refers to themes that allow users to edit templates with blocks through the Site Editor.

As the landscape of themes is changing, contributors have been working towards building a shared lexicon for how they refer to themes that support full-site editing. When the team updated the Theme Handbook prior to the WordPress 5.9 release, they settled on using the term “classic” for PHP-based themes and “block” for those that support full-site editing.

Block themes are about to cross a major milestone in the directory. At the time of publishing there are 99 block themes available, representing roughly 1% of the directory’s total number of themes. As part of the project’s big picture goals for 2022, WordPress Executive Director Josepha Haden-Chomphosy set 500 block themes as a goal for the community. The number is not even halfway there but the newly released Create Block Theme plugin should give it a boost, as it allows anyone to design a theme in the editor and export it for others to use.

10 Error Status Codes When Building APIs for the First Time and How To Fix Them

Featured Imgs 23

Things don’t always go well when using an API for the first time, especially if you’re a beginner and it’s your first time integrating an API into another system. Often documentation is lacking in terms of errors, since it’s easier to anticipate things going right, than things going wrong.

In HTTP, many status codes can give you an idea of what was going on when you called an API. The standardized status codes go from 100 to 511, and all have different meanings, but only the ones from 400 to 511 are about errors. See them here in this handy table.

What are WordPress Microinteractions?

Featured Imgs 26

What are WordPress Microinteractions?Microinteractions can significantly improve your website’s user experience. In this article, we’ll tell you what microinteractions are and how you can add them to your WordPress site. You’ll also learn the following: How to use microinteractions in WordPress How to make the most of microinteractions Then, we’ll go over a few tips to help you […]

The post What are WordPress Microinteractions? appeared first on WPExplorer.

The Impact of the Pandemic on the WordPress Community (Two Years After): As Told by Community Leaders

Category Image 091
WordPress Community Two Years After the PandemicAt the beginning of the pandemic, I reached out to a handful of people in the WordPress community to see how they were doing and how all that uncertainty was affecting their work. That was a scary time! People were generally afraid, and no one knew how long the pandemic would last and how it would impact their businesses, their jobs, and their families. Two years have gone by and I wanted to follow up with our interviewees and see if anything significant has happened in their lives in the meantime, plus hear any new lessons learned they might have.

cannot read the txt file

558fe5180e0e8fc922d31c23ef84d240

hi guys, i dont know why when i run the code, its shows my txt is not found, here i attached the txt.file and the coding :)
i just follow the coding in the example that lecturer given, but yeah as i mentioned before, the txt cannot be found :( i hope u guys can help me

#include <iostream>
#include <iomanip>
#include <fstream>
using namespace std;

//Prototype
void readCards();

int main()
{

    readCards();

    return 0;
}

void readCards(){

    const int CARDS = 10;
    int ID[CARDS];
    string cardName[CARDS] ;
    string pcode[CARDS];
    string type[CARDS];
    string plusMode[CARDS];
    string system[CARDS] ;
    int i=0;

    ifstream infile;
    infile.open("cards.txt");
    if (infile)
    {
        while (!infile.eof()){

            //Read from file
            infile >> ID[i] >> cardName[i] >> pcode[i] >> type[i] >> plusMode[i]>>system[i];
            i++;

        }
        infile.close();

    }
    else
    {
        cout << "File cannot be found.\n";
        exit(0);
    }
}

How Does MySQL Configuration Work?

Featured Imgs 23

If you've found yourself in the MySQL space at least for a little while, chances are that you have heard about one of its well-known files: my.cnf. my.cnf is a configuration file exclusive to MySQL and all of its flavors and it's widely regarded as the "go-to" file whenever MySQL configuration errors occur. Sure, we can set up a couple of settings when we start MySQL with the "--" options, but that doesn't do much - it's much more effective to set the settings inside of the configuration file instead.

Why Does MySQL Need a Configuration File?

First things first, we will look into why MySQL needs a configuration file in the first place. After all, MySQL is a powerful beast as-is, right? Well, not quite. You see, these days MySQL is running on a very wide variety of infrastructures and database servers - some servers might have 20TB of hard drive space and 256GB of RAM allocated to them, others - like small virtual private servers or the like - might only have 2GB of space and 256MB of RAM. The difference here is huge and the primary purpose of configuration files in this scenario is to provide an "endpoint" for MySQL DBAs and developers to configure it according to their requirements.