Monday 27 March 2023

seeking help from chatGPT for coding :)

 All the below took some 30 odd minutes? .. only config.php needed custom login/credentials .. edit.php is still NOT working - have to figure out :)


me:
can you write a CRUD application in PHP
Sure, I can provide a basic example of a CRUD application in PHP using MySQL as the database. Here's an example code for a simple book management system:
php [Stopped half-way it seems AFTER good 80-90 lines of code]
<input type=
me:
what will be the SQL to create table for this?
Here's an example SQL code to create a table called "books" for the book management system:
[gave a useful SQL query to create relevant table]
This code creates a table with four columns: "id", "title", "author", and "price". The "id" column is set to auto-increment, which means a unique value will be generated automatically for each new record added to the table. The "title", "author", and "price" columns are set to not allow null values. The "price" column is defined as a decimal with 10 digits and 2 decimal places. The primary key of the table is set to the "id" column.

me:
any CSS you suggest for this sample application?
Sure! Here's an example CSS code that you can use to style the book management system:
[Responds with CSS code applies basic styles ..]

me:
i asked to regenerate because the php code you originally responded with seems to be incomplete - the books crud sample
I apologize for the confusion. Here's a complete example of a CRUD application for managing books using PHP:
[This time responds with - index.php, add.php, edit.php ...]

me:
where is delete.php?
I apologize for the oversight. Here's the code for delete.php:
[gives that php too ..]
You can use this file to delete a book from the database. When you click the "Delete" button for a book in the index.php file, it will send a POST request to delete.php with the book's ID. The script will then delete the book from the database and redirect back to the index.php file.

me:
and seems config.php too is needed Yes, you're correct. Here's an example of what config.php could look like:
[now, it is done?!]
You would need to replace "your_username", "your_password", and "your_database_name" with your actual database credentials. This file is used to create a database connection that can be reused across multiple PHP files in your application.

Monday 13 March 2023

innocence of screen-agers

during March break - i was involved with kids camp

one young chap (even below the minimum age mentioned) somehow was part of the group .. and obviously i could not include him in all the coding related activities meant for little older kids .. he happily was passing time playing games on the desktop computer ..


on roblox (i need to learn/explore that platform more) he might have come across something similar (as above pic) .. and i might be busy in some other corner of the room when he requested some money from a fellow camper (he assumed he has to pay for some kind of "upgrade") .. the other kid also just passed a $20 bill (note) and did not bother what our friend was up to .. 

during the lunch break, the kind/generous 'lender' mentioned to me that he cannot go out and buy his lunch because he is out of money (he had given $20 to the youngest camper!) .. on further inquiry we figured out that the innocent screenager had clicked the button next to CD drive and "inserted" the bill/note "inside" assuming it was some kind of system to pay for his "upgrade" in his game .. i thought they were all joking and did not believe the "story" till they convinced with some "green" shade i could sense inside the drive - unfortunately the note was stuck inside and we could neither get it out nor confirm its presence. i called the IT support desk and mentioned that i might have the weirdest "problem" they have ever heard of - and i requested someone to come physical down to the computer lab we were in ..

the technician happened to be my former student - and he said he needs to "unlock" the hardware first and then take the system to their "shop" to actually open up the case and see if they can get the money back :D

i requested him to take at least a picture for me - it was such an interesting 1st day of the week long camp :)



ahh, the innocence of the screen-agers these days !!

Sunday 5 March 2023

vertical garden

 glimpse of vertical garden at Sheridan College (Brampton) Davis campus on 1 March