*My pygame window is black until i close it at the end

558fe5180e0e8fc922d31c23ef84d240

so i already posted three months ago and only reviwed my coded recently , still dotn know what is wrong . the code is quite simple however something keeps going wrong.

a possible flaw is the FPS clock which would expain why its black screen but the visible when i close t/he window.

if anyone knows what may be the problem please reply and ill send the code if neccesary , thnaks

Add data to table –

558fe5180e0e8fc922d31c23ef84d240

I'm trying to modify a web script.
Currently, upon uploading a video, in the upload Form, among other things, the uploader chooses a sub-category and enters tags
and then submits/uploads. I'd like the sub-category that is selected, to also be searchable as a keyword.

Presently, the 'videos' table has a 'sub-category' column, but only the 'sub_category' ID is stored there (upon a video being uploaded), not the actual searchable name of the 'sub_category'. (All of the sub-category names and related sub_category ID's are stored in another table).

I'd like to modify the script code so that when the sub_category ID gets stored in the VIDEOS table, the corresponding sub_category name also populates in that table, upon a video being uploaded (so that I can add the 'sub_category' name as a searchable keyword).

I believe this code from the script's submit.php file is where the VIDEOS table gets populated (in the data_insert = array):

if (!empty($_POST['category_id'])) {
                if (in_array($_POST['category_id'], array_keys(get_object_vars($pt->categories)))) {
                    $category_id = PT_Secure($_POST['category_id']);
                }
            }
            $video_privacy = 0;
            if (!empty($_POST['privacy'])) {
                if (in_array($_POST['privacy'], array(0, 1, 2))) {
                    $video_privacy = PT_Secure($_POST['privacy']);
                }
            }
            $age_restriction = 1;
            if (!empty($_POST['age_restriction'])) {
                if (in_array($_POST['age_restriction'], array(1, 2))) {
                    $age_restriction = PT_Secure($_POST['age_restriction']);
                }
            }
            $sub_category = 0;

            if (!empty($_POST['sub_category_id'])) {
                $is_found = $db->where('type',PT_Secure($_POST['category_id']))->where('lang_key',PT_Secure($_POST['sub_category_id']))->getValue(T_LANGS,'COUNT(*)');
                if ($is_found > 0) {
                    $sub_category = PT_Secure($_POST['sub_category_id']);
                }
            }

            $publication_date = 0;
            if (!empty($_POST['date']) && !empty($_POST['hour'])) {
                $publication_date = strtotime($_POST['date']." ".$pt->config->hours[$_POST['hour']]);
                $video_privacy = 1;
            }
            $data_insert = array(
                'video_id' => $video_id,
                'user_id' => $user->id,
                'title' => PT_Secure($_POST['title']),
                'description' => PT_Secure($_POST['description']),
                'tags' => PT_Secure($_POST['tags']),
                'video_location' => '',
                'category_id' => $category_id,
                'thumbnail' => $thumbnail,
                'time' => time(),
                'registered' => date('Y') . '/' . intval(date('m')),
                'converted' => '2',
                'size' => $filesize,
                'privacy' => $video_privacy,
                'age_restriction' => $age_restriction,
                'sub_category' => $sub_category,
                'embedding' => $embedding,
                'publication_date' => $publication_date
            );

Can you provide some insight/guidance as to when the video title, description, tags and sub_category ID, etc. gets added to VIDEOS table
how I can also add sub_cat name that corresponds with the populated sub_category ID?

As stated above, all of the sub-category ID's and related sub_category names are stored in another table.

I look forward to any assistance.

How to show 2nd drop-down field after first drop-down selection is chosen?

558fe5180e0e8fc922d31c23ef84d240

Im trying to modify a web script where a drop-down works successfully. How can another drop-down field appear only after a selection has been made from the first drop-down list? Heres the current code:

<?php if ($pt->page == 'category' && $pt->show_sub == true) { ?>
<div class="pull-right col-md-3 no-padding-left">
<select name="type" class="form-control form-group" id="sub_categories_">
<?php echo $pt->sub_categories_array["'".$_GET['id']."'"]; ?>
</select>
<div class="pull-right col-md-2 col-sm-2 text-right"><h5>{{LANG sub_category}}</h5></div>

and this:

$(document).on('change', '#category_id', function(event) {   
event.preventDefault();   
id = $(this).val();   
$('#sub_category_id').html(sub_categories_array["'"+id+"'"]);
});
$(document).on('change','#sub_categories_', function(event) {   
window.location.href = site_url+'/videos/category/<?php echo($_GET['id']) ?>/'+$('#sub_categories_').val();
});

any guidance is appreciated

GETTING INPUT FROM THE KEYBOARD

558fe5180e0e8fc922d31c23ef84d240

Direction: create a program to computer for the final grade using scanner and JOptionpane.

Given:
Quiz- 20%
Activity-60%
Exam-20%

Output
Enter guiz grade:
Enter activity grade:
Enter exam grade:
The final grade of: (Student name) si: (total of quiz, activity,and exam grade

Help with referencing url in code

558fe5180e0e8fc922d31c23ef84d240

I am trying to display something on web pages that show this in the url: "sub" for example: ...com/videos/category/1/sub536. It was suggested I try this code:

$page = basename($_SERVER['PHP_SELF']); 
if ($page=="....") {
echo Hello World; 
} elseif ($page=="....php") {
Some Other code... 
}

but I don't know where to place the url in that code to make it purposeful.
Also, I'm not sure that I need if/else, just would like if: /videos/category/1/sub__ then show echo

Well, when I put that code on the page, as-is, I see "page isn't working.

Any guidance/suggestion is appreciated

Need help guys!

558fe5180e0e8fc922d31c23ef84d240
Error: AttributeError: 'str' object has no attribute 'sort'

brand_name = "Huawei"
count = 3
 while count <= 3:
    brands = str(input(" Enter cellphone brandname:"))
    brand_name.insert(brands, count)
    count = 1 + count
brand_name.sort()
brand_name.remove("Huawei")
print(brand_name)

find avg of high and low temp 2d array

558fe5180e0e8fc922d31c23ef84d240

#include "iostream"
#include "iomanip"
#include "cmath"
#include "string"
using namespace std;

int main()

int temp[7][2]= {0};
int day = 0;

for(int i = 0; i < 7; i++) {
cout<<endl<<" Day: ";
cin >> day;

for(int i = 0; i < 7; i++) {
cout << "\nEnter low temperature: ";
cin >> temp[day][0];

for(int i = 0; i < 7; i++) {
cout << "\nEnter high temperature: ";
cin >> temp[day][1];

for(int i = 0; i < 7; i++) {
cout << "\nDay: " << day << " High: " << temp[day][1] << " Low: " << temp[day][0] <<endl;

Inline Code Example Here
return 0;

How to add score counter?

558fe5180e0e8fc922d31c23ef84d240

How to add score counter to rock paper scissors game? I can't get score counter work. (Player wins, Computerwins)
I got it working without functions but now when I added them I don't just get it how to do it...

#include <iostream>
#include <math.h>
#include <string>

int numGen ();
int choiceConverter (std :: string);
void DisplayComputer (int);
void winner (int, int);

int main ()   
{
std :: string playerChoose;
int player;
int compChoice;
int rounds = 0;
int gains = 0;
int machineGains = 0;

// Ask the user how many rounds to play? 
std :: cout << "How many rounds do you want to play?" << std :: endl;  
std :: cout << "Enter rounds>";
std :: cin >> rounds;

for (int round = 1; round <= rounds; round ++)
{

std :: cout << "Round number:" << round << "/" << rounds << std :: endl;

std :: cout << "\nSelect rock, paper or scissors:";
std :: cin >> playerChoose;
std :: cout << "\ nYour selection is:" << PlayerChoose << "\ n";



compChoice = numGen ();
player = choiceConverter (playerChoice);
displayComputer (compChoice);
winner (compChoice, player);
}

} 
int numGen ()
{
std :: srand (time (0));
int randomi = rand ()% 3 + 1;

return randomi;
}

int choiceConverter(std :: string player1) 
{
int numEquiv = 0;

if (player1 == "rock")
character code = 1;
else if (player1 == "paper")
character code = 2;
else if (player1 == "scissors")
character code = 3;    
return numEquiv
}
void displayComputer (int player2)
{
if (player2 == 1)
{
std :: cout << "The computer chose rock \ n";
}
else if (player2 == 2)
{
std :: cout << "The computer chose paper \ n";
    }
else if (player2 == 3)
{
std :: cout << "The computer chose scissors \ n";
}
}

void winner (int player1, int player2)
{

if ((player1 == 1 && player2 == 2) || (player1 == 2 && player2 == 3) || (player1 == 3 && player2 == 1))
{
std :: cout << "\nYou won the game! \ n \ n";

}
else if ((player1 == 1 && player2 == 3) || (player1 == 2 && player2 == 1) || (player1 == 3 && player2 == 2))
{
std :: cout << "\ nComputer won the game! \ n \ n";

}
else
{
std :: cout << "\nDraw \ n \ n";
}   
}

Building a Metadata Driven UI

558fe5180e0e8fc922d31c23ef84d240

Description

Metadata-driven UI is especially useful in project teams with a high back-end or DBA competence rather than UI.

In general, it provides an element alignment by invocation of a single endpoint which provides all data required like cardinality, language, font size, and the font itself.

how to convert this into a relative path

558fe5180e0e8fc922d31c23ef84d240

how to convert this into relative path code, since if im gonna install my system to other computer this line of code will get an error since the path of the data source doesnt match the current path if im gonna install it to other computer

Screenshot_2021-10-20_195847.png

arrays and strings in c

558fe5180e0e8fc922d31c23ef84d240

can someone explain to me this code and what the output should look like?, is there going to be two strings? and what does dest[I]=to src[] mean, is string bar going to have the string abcd or efghijk.

#include <stdio.h>

void copy_str(char *dest, const char *src);



int main(void)
{
  char foo[7];
  char bar[7] = {'E', 'F', 'G', 'H', 'I', 'J', 'K'};
  copy_str(bar, "ABCD");
  copy_str(foo, bar);
  return 0;
}


void copy_str(char *dest, const char *src)
{
  int i;
  for (i = 0; src[i] != '\0'; i++)
    dest[i] = src[i];

  // point one 
  dest[i] = '\0';
  return;
}

trying to convert a number of seconds into days, hours, min and seconds

558fe5180e0e8fc922d31c23ef84d240

i been trying trying to convert a number of seconds into days, hours, min and seconds. but i keep getting errors, "expected identifier or '('" . how should i fix it.`

#include <stdio.h>
#include <stdlib.h>

void to_dhms(int total_s, int *d, int *h, int *min, int *s);


int main(void)
{
  int seconds_in, days, hours, minutes, seconds, scan_count;

  printf("Enter a number of seconds that is >= 0: ");
  scan_count = scanf("%d", &seconds_in);  
  if (scan_count != 1) 
  {
    printf("Unable to convert your input to an int.\n");
    exit(1);
  }
  if (seconds_in < 0) 
  {
    printf("%d s is out of range!\n", seconds_in);
    exit(1);
  } 

  printf("Doing conversion for input of %d s ... \n", seconds_in);



  result= to_dhms(days, hours, minutes, seconds);
    printf("That is %d day(s), %d hours(s), %d minute(s), %d second(s).\n",
         days, hours, minutes, seconds);

  return 0;


}
void to_dhms(int total_s, int *d, int *h, int *min, int *s);
{
  *d = total_s / 86400;
  remaining= total_s% 86400;
  *h= remaining/ 3600;
  remaningofh= remaining%3600;
  *min= remaningofh/ 60;
  *s =remaningofh % 60;
  return result;

}

`

how to convert a number of seconds into days , hours, minutes and seconds

558fe5180e0e8fc922d31c23ef84d240

hello i want to print convert seconds into days, hours, munite, and seconds but i do not know how to call void into line 28 so it can print.

#include <stdio.h>
#include <stdlib.h>

void to_dhms(int total_s, int *d, int *h, int *min, int *s);


int main(void)
{
  int seconds_in, days, hours, minutes, seconds, scan_count;

  printf("Enter a number of seconds that is >= 0: ");
  scan_count = scanf("%d", &seconds_in);  
  if (scan_count != 1) 
  {
    printf("Unable to convert your input to an int.\n");
    exit(1);
  }
  if (seconds_in < 0) 
  {
    printf("%d s is out of range!\n", seconds_in);
    exit(1);
  } 

  printf("Doing conversion for input of %d s ... \n", seconds_in);


  {  
    //how can i call void to_dhms here 
    printf("That is %d day(s), %d hours(s), %d minute(s), %d second(s).\n",
         days, hours, minutes, seconds);

  return 0;
  }

}
void to_dhms(int total_s, int *d, int *h, int *min, int *s);
{
  *d = total_s / 86400;
  remaining= total_s% 86400;
  *h= remaining/ 3600;
  remaningofh= remaining%3600;
  *min= remaningofh/ 60;
  *s =remaningofh % 60;
  return;

}

can someone help me to solve this?

558fe5180e0e8fc922d31c23ef84d240
    task
123454321
123454321
123454321
123454321
123454321





    #include<iostream>
    using namespace std;
    int main(){
    int i,j;
    for (i=1; i<=5; i++)
    cout<<i;
    for(j=4; j>=1; j--)
    cout<<j;
    }

But what the next ???

Converts a number of seconds into days, hours, minutes, and second?.

558fe5180e0e8fc922d31c23ef84d240

i am trying to Convert a number of seconds into days, hours, minutes, and seconds. using pointers but something seems wrong . can somone tell me what is the problem and how to solve it. it keeps telling me
error: function definition is not allowed here

#include <stdio.h>
#include <stdlib.h>

void to_dhms(int total_s, int *d, int *h, int *min, int *s);


int main(void)
{
  int seconds_in, days, hours, minutes, seconds, scan_count;

  printf("Enter a number of seconds that is >= 0: ");
  scan_count = scanf("%d", &seconds_in);  
  if (scan_count != 1) 
  {
    printf("Unable to convert your input to an int.\n");
    exit(1);
  }
  if (seconds_in < 0) 
  {
    printf("%d s is out of range!\n", seconds_in);
    exit(1);
  } 

  printf("Doing conversion for input of %d s ... \n", seconds_in);

  int main(void)
  {
    printf("That is %d day(s), %d hours(s), %d minute(s), %d second(s).\n",
         days, hours, minutes, seconds);

  return 0;
  }

}
void to_dhms(int total_s, int *d, int *h, int *min, int *s);
{
  days = seconds_in / 86400;
  seconds = seconds_in % 86400;
  hours=seconds_in / 3600;
  hours= hours %3600;
  minutes= seconds_in / 60;
  minutes= seconds_in %60;
  seconds = seconds_in% 60;

}