Latest Posts

Your specs don't make sense. A negative number results in ERROR but -1 performs an action. Last I checked, -1 was a negative number. Do we take the spec from your text or from your code? They can't both be correct.

Howdy! I am in a beginners Python class and our current assignment is creating a Tic-Tac-Toe board that can determine a WIN state and that can have a "random play" in which the computer actively tries to beat you. However, I'm unsure of how to do this, as I haven't found much on EZ graphics and Python and it is my first time using these. Do I make functions for those? If so, I'm also unsure of placement, as I have found that order matters.

This is what I have so far:

from ezgraphics import GraphicsWindow

win = GraphicsWindow()

row = [None, None, None]

row[0] = [0, 1, 2]

row[1] = [3, 4, 5]

row[2] = [6, 7, 8]

class TicTacToeBoard:

    def __init__(self, lengthWidth):

        self.size = lengthWidth

        self.win = GraphicsWindow(self.size, self.size)

        self.canvas = self.win.canvas()

        self.game = [ None, None, None, None, None, None, None, None, None ]

    def winTTT(self):

        for i in range(3):

            print(type(self.game[row[i][0]]))

            if (type(self.game[row[i][0]]) == type(self.game[row[i][1]]) ==

type(self.game[row[i][2]])) and (self.game[row[i][0]] != None):

                return True

        return False

    def draw(self):

        self.canvas.clear()

        self.game = [ None, None, None, None, None, None, None, None, None ]

        self.canvas.setOutline("black")

        linebegin = (0, self.size/3)

        lineend = (self.size, self.size/3)

        self.canvas.drawLine(linebegin[0], linebegin[1], lineend[0], lineend[1])

        linebegin = (0, self.size*2/3)

        lineend = (self.size, self.size*2/3)

        self.canvas.drawLine(linebegin[0], linebegin[1], lineend[0], lineend[1])

        linebegin = (self.size/3, 0)

        lineend = (self.size/3, self.size, )

        self.canvas.drawLine(linebegin[0], linebegin[1], lineend[0], lineend[1])

        linebegin = (self.size*2/3, 0)

        lineend = (self.size*2/3, self.size, )

        self.canvas.drawLine(linebegin[0], linebegin[1], lineend[0], lineend[1])

class TTTCrossX:

    def __init__(self, board, nthBox):

        if nthBox == 0:

            self.x1 = board.size/12

            self.y1 = ...

How about changing line 19 to test for not equal -1 (your exit condition)?

And drop line 27 since you will loop around to line 21 for another input.

While this current code omits counting how many valid numbers were input, you can start by fixing up a few basic things then add your input counter later.

Write a Program that asks the user to input a positive integer. If the user inputs a negative number, program should output "ERROR" and ask for /the user's input again. If the user inputs the value of 0, the program says "NO AVERAGE". If the user inputs a -1, the program takes the sum and average of only the positive integers, then outputs "The average is _____ "

I dont understand what I'm doing wrong

//THIS IS WHAT I HAVE SO FAR
#include <iostream>
#include <iomanip>
#include <string>
#include <cmath>
using namespace std;

int main()
{
int number;
double sum, average;
cout<<"Type Positive Integers: ";
cin>> number;
sum += number;
average = sum/=number;

while(number>=1){
    cout<<"Type Positive Integers: ";
    cin>>number;
    if(number==0){
    cout<<"NO AVERAGE: ";
    }
    if(number<=-2){
        cout<<"ERROR!"<< "Enter Another Value: ";
        cin>> number;
    }
    if(number== -1){
        cout<<"The Average of the Positive Integers is :"<< average << endl;
    }
}

Day two of the hearings and I almost forgot to break this out.

Dump_on_Trump.jpg

Unfortunately, like everything else with Trump's name on it, it is of low quality. Nothing sticks to it. I hope that isn't a sign.

rproffitt commented: "An attempt was made." Sideshow Bob defense? +0

Today there are so many variants of work that I am interested in but I choose a software developer. I dream to work for a well-known app development company, where I will have an opportunity to develop professionally.

If you come across a specific code problem feel free to post the code and ask questions. Keep in mind that the more detailed your question, the more likely you are to get an answer.

this is a test

The GridView rows will be selected using CheckBoxes and the selected rows (records) will be inserted into a DataTable which will be later used for bulk inserting records to SQL Server Database using SqlBulkCopy class.
Here is the code with example.


Hope so my answer will help you.. GOOD LUCK..!

Hi All

I work for Oracle India Pvt Ltd on CRM domanin as a JAVA/J2ee developer,
I am getting on with a Project on Python which I am new to, Need help if I come across any Unsolvable issue.

This sounds simarly to the old 15 puzzle game noted at https://rosettacode.org/wiki/15_Puzzle_Game with a few twists.

So that's one well worn code base. I mean if I look at https://rosettacode.org/wiki/Conway%27s_Game_of_Life I see over 100 implementations in 99 languages.

In your case you may wish to start with an array, fill it with the starting data or states then code to follow those rules and iterate (loop) over the rule the number of times you wish.

Finally you exit that loop and print out your array.

I'm going to guess you are new to VB. I see at line 38 the usual End Sub but can't find the beginning of said routine. You are also seem to be filling all the rows as bookedIcon in line 33 but I see in line 2 your command is to delete all the data. So anytime this un-named procedure runs (you don't tell how) that line 2 appears to be the clear the database command.

As you may be new to VB, tell me how you tied this unknown procedure to your reset button.

Hello,
I am stuck on how to exactly do this problem if anyone could offer me any help with either a worked out solution or just some pseudocode that would be great. Here are the rules and information about the assignment below.

Assignment:
What is The Game of life?
Not to be confused with Hasbro's The Game of Life, this problem refers to British mathematician John Conway's famous cellular automation. The term 'cellular automation' refers to a space (in this case a grid) of cells, which continually transform themselves to create new patterns and states, based on the states of neighboring cells, by following a discrete set of mathematical rules. The simulation models cells living, dying, and multiplying over multiple generations.

The Rules
Any live cell with fewer than two live neighbors dies (as if by underpopulation).
Any live cell with more than three live neighbors dies (as if by overpopulation/overcrowding).
Any live cell with two or three live neighbors lives, unchanged, to the next generation.
Any dead cell with exactly three live neighbors will come to life (as if by reanimation or birth).
Neighbors refer to the eight cells adjacent to any given cell in a grid, with the exception of border cells.

The Assignment
For this assignment, we are asking you to implement Conway's Game of Life using a two-dimensional array as a grid in which to store the cells. Live cells are denoted as * characters, dead cells are denoted by the . character.

Input
As input, ...

Hello,
I am stuck on where to go with this assignment for checking if the sliding puzzle is solved right or wrong. I will include the context of the assignment so you can see what needs to be included. If you could just share some code or pseudocode to get me started that would be great or a worked out solution that would be good as well.

Assignment:
The Rules
Each 8-puzzle has tiles labeled 1-8 and one empty space denoted by a 0.
The commands given signify where you should attempt to move the empty space in relation to its current position.
The only moves you are allowed to make are swapping the empty space with an adjacent tile to it.
If asked to make an impossible swap (ie. move the blank tile out of the grid bounds), don't terminate the program, simply ignore that command.
The Assignment
For this assignment, we are asking you to take an 8-puzzle and follow a sequence of movement commands UP, DOWN, LEFT, and RIGHT. At the end of the sequence, you should check whether the puzzle has been solved.

Input
As input you will be given some initial board state in the form of a sequence of numbers where 0 corresponds to the "blank" tile. The example below would be the form of the "initial state" example above. After that will be a sequence of commands "UP", "DOWN", "LEFT", and "RIGHT" represented by characters on a single line separated by spaces. (The ...

The whole coding, I presume. Because this coding deletes the record without even clicking "Reset" button on the system. I only want the button functions to delete the record before the next showtime. :(

That's all well and good but you left out what line is giving you an issue.

Hi, sir. This is the code I use for my reset button:

Dim stSQL As String
    stSQL = "DELETE BookingID,Customer, Seat FROM tblBooking"

    Dim stConString As String
    stConString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\USER\Desktop\Cinema\Database\Data.accdb"

    Dim conBookings As OleDbConnection
    conBookings = New OleDbConnection
    conBookings.ConnectionString = stConString
    conBookings.Open()

    Dim cmdSelectBookings As OleDbCommand
    cmdSelectBookings = New OleDbCommand
    cmdSelectBookings.CommandText = stSQL
    cmdSelectBookings.Connection = conBookings

    'Dim cmdSelectBookings As New OleDbCommand(stSQL, conBookings)

    Dim dsBookings As New DataSet
    Dim daBookings As New OleDbDataAdapter(cmdSelectBookings)
    daBookings.Fill(dsBookings, "Bookings")
    conBookings.Close()

    'MsgBox(dsBookings.Tables("Bookings").Rows.Count)
    'MsgBox(dsBookings.Tables("Bookings").Rows(0).Item(1))

    Dim stOut As String
    Dim t1 As DataTable = dsBookings.Tables("Bookings")
    Dim row As DataRow

    For Each row In t1.Rows
        'stOut = stOut & row(0) & "" & row(1) & "" & row(2) & vbNewLine
        DirectCast(Panel1.Controls("PictureBox" & row(2).ToString), PictureBox).Image = bookedIcon

    Next
    'MsgBox(stOut)

End Sub

As to the code, that would be the same code that you wrote to initialize the database. Maybe you need to share your code and point out where you are stuck as to line number or syntax. And to be clear I don't see members writing the code or system for you. They help you past the error or share ideas about the system but to get others to code it for you, you may have to post a help wanted with rates for the system you would pay.

Next, the system is based on admin view only. The "Reset" button functions to clear all the booked seats to available so that the hall can be used for the following showtime.

Dani 1,857

To rproffitt's point, are you interested in being a web designer or a web developer? (Although I think he may be a little incorrect in terms of the function of a web designer in 2019 / 2020).

Designers focus on the aesthetics of the website. They plan out the user experience (UX) and user interface (UI). They focus on color theory, navigation, user behavior, conversion rates, and how the overall look and feel of a website, and each of its pages, work together to create the best experience for the end-user, and most profitable experience for the website.

Graphic designers don't really exist much nowadays in terms of the web, where so much can be done with CSS and HTML5 nowadays. However, there's definitely still a huge need for graphic design for ad campaigns, magazines, and of course logos and building out the occassional infographic.

Web developers write the actual front-end and back-end code that goes into creating a website. Front-end developers focus on HTML5, CSS, and Javascript, while back-end developers focus on SQL and PHP, Python, or whatever their language of choice is.

Systems administrators are those who maintain the actual web servers, database servers, caching servers, file servers, etc. Their job is to do things like set up and configure the MySQL server, Apache, nginx, load balancer, CDN, etc.

Webmasters are people who are tasked to create or maintain websites for small businesses, usually by using existing tools such as Wix, blogging platforms such as Wordpress, etc. They ...

rproffitt commented: Thanks for this. My buddy did it all but does not consider himself to be a webmaster as he tends to start with deploying the server hardware and build +15

Since I can't find a design specification, only you can decide what those buttons do.

Now to help move things along some observations and comments.

  1. I can't find a question in your top post. So it's hard for folk to guess what your question is.
  2. In such seating and reservation systems you have your admin and per user view. The admin would be capable of a full reset, the user should only reset their choices so far or commit to the seating but at no time would the user/buyer control all seating.
  3. As such another column may be who owns those seats so a reset from the user view would only uncommit their selected seats.
KIRTHANA commented: 1. I'm looking for help to code "Reset" button so that all the booked seats turn to available +0

Where does dollars come from, and how is it different from total_value

def get_left_over_cents(pennies, nickels, dimes, quaters):
    total_value = get_dollars(pennies, nickels, dimes, quaters)
    left_over_cents = int(100 *(total_value - dollars))

Anyone to help?

Just a tip from my years working with accounting software. Skip storing your $3.50 as floating point and move to your lowest non-divisable unit or the penny. Then all display conversions are one way from pennies to dollars and cents and never from dollars to cents.

I created the format:
def main():
    pennies=int(input("Enter pennies:"))
    nickels = int(input("Enter nickels:"))
    dimes = int(input("Enter dimes:"))
    quarters = int(input("Enter quarters:"))

    print("You entered:")
    print("\tPennies:" , pennies)
    print("\tNickels:" , nickels)
    print("\tDimes:" , dimes)
    print("\tQuarters:" , quarters)
    total_value = get_total(pennies, nickels, dimes, quarters)

    v_Dollars, v_Cents = divmod(total_value, 1)

    print("Total = ${:,.2f}".format(total_value))
    print("You have {:,} dollar(s) and {:.2f} cent(s)".format(int(v_Dollars), v_Cents))
# This format from the top^ was already created from "Start the assignemnt with this file":

# Completed the function for get_total:
# displayed the functions for pennies, nickels, dimes, and quaters.
# returning the value of the money sent to the via parameters in dollars. 
def get_total(pennies, nickels, dimes, quarters):
    pennies = (.01 * pennies);
    nickels = (.05 * nickels);
    dimes = (.10 * dimes);
    quarters = (.25 * quarters);
    total_value = pennies + nickels + dimes + quarters
    return total_value

# Completed the function for get_dollars:
# displayed the functions for pennies, nickels, dimes, and quaters.
# returning the value of the money sent to the via parameters in dollars. 
def get_dollars(pennies, nickels, dimes, quarters):
    total_value = get_dollars(pennies, nickels, dimes, quaters)
    dollars = format(total_value // 1, "0.f")
    return dollars

# Completed the function for get get_left_over_cents:
# displayed the functions for pennies, nickels, dimes, and quaters.
# returning the value of the money sent to the via parameters in dollars. 
def get_left_over_cents(pennies, nickels, dimes, quaters):
    total_value = get_dollars(pennies, nickels, dimes, quaters)
    left_over_cents = int(100 *(total_value - dollars))
    return left_over_cents 

main()

Which is shown, however, I need to display dollar value and ...

Hello, I am new to this site and to php and mySQL...and I need some help. I know this topic is all over the web but after a couple of days of looking and refering to several text books it still doesn't work so please bear with me.

I have created a web page with an associated mySQL database for our local women's golf club. I am trying to create a routine that will allow active members to get a web page displaying a listing of other members who live near them (in the same city/town). I have created a drop-down list in file 1 (memberSelect.php) with the following code below.

I want to pass the the value selected (town) to file 2 (activeMemberListing_NearMe.php) using the POST method. The code in file 2 is as follows below.

The While loop processes query results and displayes all records found. Note - I know this while loop works as it is taken from another file that successfully calls a SELECT statement and simply lists all active members of the club.

When I open file 1, select a city and click the "List Members" button I end up right back at file 1. This leads me to believe that I am passing nothing with the the "IF($cityID == 0)" code line in file 2 being true and thereby returning me to file 1.

I know this is a static selection list but before I move to a dynamic selection list I want to ...

try even=modulus(counter,2)==0
odd=modulus(counter,2)==1

Dani 1,857

Don't know who your mobile supplier is, but here in the wilds of rural France my iPhone gets >50M/sec download most of the time, vs the 20 I get from my landline-based WiFi at home.

I have gigabit Internet and dual 5K monitors. But I can't design DaniWeb for what I have. Google Analytics as well as Google Search Console track page timings for visitors who use Chrome. The results of that data plays a huge role in SEO. Google's algorithm cares almost exclusively about how fast your site is on mobile devices, and not desktop. Any improvements to mobile are a huge win.

To see a glimpse into this data, check out: https://developers.google.com/speed/pagespeed/insights/

By removing prettyprinted code from mobile devices, I was able to increase our Mobile score from the lower end of the "Slow" category all the way to the "Medium" category.

It's not just SEO though. The dramatic increase in page speed has very strong correlations to lowering bounce rate and increasing time on site. It's important for us to remain competitive, and there is a strong reason why Stack Overflow does not highlight their code regardless of device.

That having been said, I've never seen any speed problem downloading or rendering DaniWeb on any device.

There are three reasons for that. Firstly, it's because the majority of files required to render DaniWeb have already been cached by your web browser as you navigate between pages. Obviously that isn't the case for people who enter ...

"This irregular channel of diplomacy it’s not as outlandish as it could be, is that correct?”

  • Steve Castor

Isn't that sort of like a defense lawyer saying "My client killed six people, but it could have been worse, Right? He could have killed seven."

Is that the best defense they could muster up?