Is there any platform where we can practice python coding in pygame?

I am new to python with less experience in programming and I have taken part in a coding competition so I wanted to know that is there any platform where I can practice coding in using Pygame module in python?
Pardon if I didn’t asked question according to the standard

coding style – AWS VPC CIDR and its subnets

I have a CIDR block of and need to create 2 private subnets and 2 public subnets for it.

My private subnets work fine:

# List of private subnets to create in the environment, e.g. ("", "")
variable "private_subnets-west-2" {
  type    = list(string)
  default = ("", "")

However, I have been trying different subnets for my public one’s since an hour now, and cannot find the proper ones:

# List of public subnets to create in the environment, e.g. ("", "")
variable "public_subnets-west-2" {
  type    = list(string)
  default = ("", "")

keep on getting errors for conflict or invalid like these:

Error: Error creating subnet: InvalidSubnet.Conflict: The CIDR '' conflicts with another subnet
        status code: 400, request id:

  on .terraform/modules/vpc-us-west-2/ line 335, in resource "aws_subnet" "public":
 335: resource "aws_subnet" "public" {

Error: Error creating subnet: InvalidSubnet.Conflict: The CIDR '' conflicts with another subnet
        status code: 400, request id: 

  on .terraform/modules/vpc-us-west-2/ line 335, in resource "aws_subnet" "public":
 335: resource "aws_subnet" "public" {

I have been stuck for long, if someone can help me and tell me exactly which 2 subnets I can use, it would be great help!

python – How to compile this program without coding knowledge?

Please forgive my illeteracy as far as coding goes but I am trying to set up a program I found on github and although I don’t have much coding knowledge I was able by following wome tutorial to do some of the part for the installation but I am still confused as to how I should compile it , what toolchain to use and how to do it .
the programme is this one :

I have managed to install elasticsearch so far and I have installed anaconda as recomanded but that’s about it, spent the week-end trying without luck …(I even tried the containerized version using docker but again not enough knowledge on my end to make it work…)
If you can help me interprete and allow me to have a user friendly tutorial on how to build this in my windows OS and have it with a user friendly interface that would be greatly appreciated.

Thanks for your help a thousand time

php – Python3 + MYSQL8.0 – Beginner coding help needed — Query string from serial and pass through MYSQL before executing if/else

I am trying to get this code to pass a string received through serial and formatted to Ascii to MySQL to see if it and associated information are present. The database is part of a PHP application and needs to work with Python unchanged.

I am a beginner at Python and MySql so any help to get me moving forward would be appreciated.

import serial
import mysql.connector
import codecs

rfid = serial.Serial(port = "/dev/ttyUSB0", baudrate=9600) 

while True:
    if (rfid.in_waiting > 0):
            UID = rfid.readline()
            UID = UID.decode('Ascii')
            mydb = mysql.connector.connect(
            getUID = "SELECT * FROM table_mkaccess WHERE id = '%s'"
            mycursor = mydb.cursor()
            result = mycursor.fetchone()
            if result != 0:

This is the working PHP code for a similar function that returns a 0 or 1 based on if there is a name registered with the incoming UID/id

 $pdo = Database::connect();
    $sql = "SELECT * FROM table_mkaccess  where id = ?";
    $q = $pdo->prepare($sql);
    $data = $q->fetch(PDO::FETCH_ASSOC);
    $msg = null;
    if (null==$data('name')) {
            $msg = "bad";
    } else {
            $msg = "good";
    echo $msg;

When did you start PHP coding ?

When you first started coding in PHP what was the current version and what did you code first of all ?

I started learning when version 5…. | Read the rest of

Video Encoding/Trans coding Conversion Dedicated Server Required

[LEFT][COLOR=#242729][FONT=Arial]I am looking to buy a dedicated server for my video project, I have multiple video upload at the same time … | Read the rest of

design – Lost Interest in PHP coding

Well my question is pretty straight forward, I am a PHP web developer from last 2.5 years and i am doing very well in my job, but truthfully i am fed up from coding. The daily work pressure feels me like I become a machine and wasting the important age of my life without enjoyment by doing a 8 hrs of office job and 5 hours of personal clients job. My daily routine will be like waking up 7 am in morning , 10 am to 7pm in office, 8pm-12am clients work and again repeat this cycle for every day of my life. my friends were enjoying their life very well. I thought 1000s of times to switch my job, but i dont have any good job suggestions, however the comfort zone of my office dont let me to leave or join any other office or job.Despite this i am in very need of money because of house installments and bike installments, i dont have any strong financial background. At last any suggestions will be help full to me

secure coding – Objective-C: Security Overview

I am finding it difficult to find any information about the Objective-C programming language. I am currently trying to acquire information such as the default security features of the language, known vulnerabilities, patches, best practices, etc.

Would anybody be able to share their knowledge or advise some good spots to look for this?

Many thanks!

coding style – Question about find the Area and Manipulate function

Here is a link to my previous question
Question about plotting a curve and tangent lines

I want to know how can the area be found between the curve and tangent line for between Point Fun1 and Fun2.This is what I did but im not sure its correct or not. Do I have to use piecewise integration?

    Clear(f, x, g)
    f(x_) = x^3
    g = f(1.2) + f'(1.2) (x - 1.2)
    Plot({f(x), g}, {x, -5, 5}, PlotRange -> 20)
    NIntegrate(f(x), {x, -2.4, 1.4})
    NIntegrate(f(x), {x, -2.4, 4.8})

I also want to know how can I make the Manipulate function work for moving the point Fun1 to 15 positions in the interval(-5,0). I also want to learn how can I use the Manipulate function to update the drawing each time the points move(the drawing shows the tangents the intersection points)

    Plot({f(x),l(x)}, {t, -x, x}, Filling -> Axis, 
    PlotRange -> {{-5, 10}, {-5, 10}}, N(Erf(x))), {1.3, 0.5})), {x,
    0.0001, 3})

coding standards – Is it possible to write very short production-ready programs?

To summarize my answer: this is a frame challenge. Rather than learn how to reduce arbitrary line count, it’s much better to simply not focus on line count, but only on readability and the restrictively scoped responsibilities that a microservice should represent.

Is it possible to write very short production-ready programs?

If you open up your question to such a generalization, the answer is immediately yes.

static void Main(string() args)
    Console.WriteLine("Hello World!");

That’s production ready.

Obviously, how quickly you can develop something to be production-ready very much depends on the complexity of the requirements. Displaying a hard-coded string message is arguably the lowest form of complexity, hence why we tend to use it as the default example.

Fred George, the father of micro-services suggests between 50 and 100 lines of code.

This could be done by “writing code” or “configuring tools” which both increase the number of SLOC.

Apples and oranges. I very much doubt that Fred George is talking about SLOC, but rather LOC (i.e. ignoring the complexity of any libraries used by the microservice.

Given the commonly agreed upon workload of a microservice (e.g. a simple REST API to fetch database entries), if you count all lines of source code including the library dependencies, you are in no way going to be able to write an application in under 100 lines.

my simplest meaningful programs which saw production were about 200 SLOC and were exceptionally simple. They only focused on one specific task and served as a tool for other programs to use.

Initially, this was the intention of microservices. It arguably still is, but we’ve slightly relaxed the constraints on how micro a microservice needs to be.

This is a matter of real world compromise. It may be elegant to keep your microservices incredibly tiny, but in reality a lot of companies are going to stop shrinking their microservices at an earlier stage, leading to slightly bigger microservices being built.

Have you ever seen a picture of a concept car? They are wild, mindblowingly innovative, have funky shapes, and make a very clear artistic statement. But the cars that get built from that concept are much plainer looking.
This is because the theoretical concept can explore wildly different things, but actual cars still have to deal with compromises, such as ride comfort, trunk space, back seat, road legality, …

The same happens for any theory before it is put into practice. Theories can be radical, but their implementation generally dulls them down to make it easier to implement.

Fred George drew a very radical line on how strongly we should minimize microservices, but that doesn’t really work well for a lot of companies whose codebase is, let’s face it, bulkier than any theoretical example tends to be. Therefore, compromises have to be made, and in this case this means allowing for a larger line count, while still respecting the original intention of microservices (i.e. a strongly restricted scope of responsibility per microservice)

two week bootcamp (which involved writing a relatively sophisticated application in just 22 lines of ruby)

I don’t know the specific exercise or its source code, but it does seem valid to put a very big asterisk here, based on how you’ve based your question:

More often than not, line count is the opponent of readability. The fewer lines there are in an application, while retaining the same features), the denser the features are spread across those lines. That’s just simple logic. If you’re carrying 20 eggs, the more baskets you have, the less eggs there are in each basket.

“a relatively sophisticated application in just 22 lines” raises a red flag for me. Sophisticated tends to mean complex (i.e. involving many bits and bobs, not necessarily difficult), which tends to warrant an increased line count to keep things readable.

Like I said, I can’t judge this particular example since I don’t know exactly how complex it is. But your question seems to tie together the concepts of counting lines, being production-ready, and good practice development.

In every common sense scenario, line count should simply not be observed. By common sense, I mean to exclude cases where you’re just willfully generating more code without adding further value, e.g. FizzBuzz Enterprise Edition is a great (though intentionally satirical) example of this.

What seems to be much more relevant, is the responsibility of the microservice, i.e. exactly the service that it provides to outside consumers. This responsibility should be kept to a logical minimum.

What is a logical minimum? Well, that’s arguable. Does a query to fetch all users and a query to fetch a specific user really represent the same responsibility?

Reading Fred George’s opinion on microservices, I cannot help but infer that he would attempt to separate the two as they service a subtly different purpose. However, in commonly agreed upon good practice, it’s well reasonable to have a “user microservice” which allows querying the users in multiple ways, including the two queries I mentioned before.

Am I missing some programming techniques? Could I see example programs which were used in production environment and are less than 100 SLOC?

Any technique that would reduce line count for any application, no matter the context or scope of responsibility, is effectively going to be an exercise in reducing readability.

When applied to such an extent, you effectively set code golf standards. I’m linking to the code golf community to give you an idea on both (a) how much one could actually decrease line/character count if they wanted to and (b) how dramatically it impact the readability and maintainability of the golfed code.

Your question is so broad that it is effectively no longer meaningfully answerable. You’re asking for a LOC-panacea. If it were to exist, and it would somehow be a good idea to do so, then we would all be doing it already.

This is a frame challenge. Rather than learn how to reduce arbitrary line count, it’s much better to simply not focus on line count, but only on readability and the restrictively scoped responsibilities that a microservice should represent.