-
Notifications
You must be signed in to change notification settings - Fork 0
/
database-connect.php
111 lines (97 loc) · 46.7 KB
/
database-connect.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<?php
/* Database connection script
* This script creates database and tables needed
* to run the application.
* It also connects to the database when needed in
* other scripts or pages.
*/
// Change this info if needed
$server = ""; // Server address
$user = ""; // User name with privileges to create a database
$pass = ""; // User password
$database=""; // Database Name
// Trying to connect to the server
$connect = mysqli_connect($server, $user, $pass)
or die("Couldn't connect to MySQL Server: " . mysqli_connect_error() . " <strong>Please check the database-connect.php file.</strong>");
// Connecting to the database
$myQuery = "use ".$database.";";
mysqli_query($connect, $myQuery)
or die("Couldn't find database (".$database."): " . mysqli_connect_error() . " <strong>Please check the database-connect.php file.</strong>");
// Check if all tables exist or not, and inserts dummy data
$myQuery = "DESCRIBE users;"; //check users database
if(mysqli_query($connect, $myQuery) === false){
$myQuery = "create table users(email varchar(50) not null,fname varchar(25) not null, lname varchar(25) not null ,pass varchar(30) not null, role varchar(8) not null, constraint email_pk primary key (email));";
if (mysqli_query($connect, $myQuery)) {
echo "<br><span style='color: green;background: black'>Created Users table successfully!</span>";
echo "<br><span style='color: white;background: black'>Adding dummy users</span>";
$myQuery = "INSERT INTO `users` (`email`, `fname`, `lname`, `pass`, `role`) VALUES
('[email protected]', 'Abdo', 'khaled', 'student12', 'student'),
('[email protected]', 'Morrad', 'Mohsen', 'student13', 'student'),
('[email protected]', 'Moody', 'Hossam', 'adminadmin1', 'admin');";
if (mysqli_query($connect, $myQuery)) {
echo "<br><span style='color: green;background: black'>Dummy users added successfully!(email: [email protected], pass: adminadmin1) and (email: [email protected], pass: student12) and (email: [email protected], pass: student13)</span>";
} else {
echo "<br><span style='color: red;background: black'>Couldn't add dummy users, you will create accounts manually.</span>";
}
} else {
echo "<br><span style='color: red;background: black'>Couldn't create Users table</span>";
}
}
$myQuery = "DESCRIBE books;"; //check books database
if(mysqli_query($connect, $myQuery) === false){
$myQuery = "create table books(ISBN int not null AUTO_INCREMENT, name varchar(100) not null, pubYear year not null, author varchar(30) not null,bdesc text,copies int default 0,borrowed int default 0, constraint book_pk primary key (ISBN));";
if (mysqli_query($connect, $myQuery)) {
echo "<br><span style='color: green;background: black'>Created Books table successfully!</span>";
echo "<br><span style='color: white;background: black'>Adding dummy Books</span>";
$myQuery = "INSERT INTO `books` (`ISBN`, `name`, `pubYear`, `author`, `bdesc`, `copies`, `borrowed`) VALUES
(1, 'Rich Dad, Poor Dad', 1997, 'Robert T. Kiyosaki', 'Rich Dad Poor Dad is Robert\'s story of growing up with two dads — his real father and the father of his best friend, his \\\"rich dad\\\" — and the ways in which both men shaped his thoughts about money and investing. The book explodes the myth that you need to earn a high income to be rich and explains the difference between working for money and having your money work for you.', 5, 0),
(2, 'Social Engineering: The Art of Human Hacking', 2010, 'Moody Hossam', 'The first book to reveal and dissect the technical aspect ofmany social engineering maneuvers From elicitation, pretexting, influence and manipulation allaspects of social engineering are picked apart, discussed andexplained by using real world examples, personal experience and thescience behind them to unraveled the mystery in socialengineering.\r\nKevin Mitnick--one of the most famous social engineers inthe world--popularized the term \\\"socialengineering . \\\" He explained that it is much easier to tricksomeone into revealing a password for a system than to exert theeffort of hacking into the system. Mitnick claims that this socialengineering tactic was the single-most effective method in hisarsenal. This indispensable book examines a variety of maneuversthat are aimed at deceiving unsuspecting victims, while it alsoaddresses ways to prevent social engineering threats.\r\nExamines social engineering, the science of influencing atarget to perform a desired task or divulge information\r\nArms you with invaluable information about the many methods oftrickery that hackers use in order to gather information with theintent of executing identity theft, fraud, or gaining computersystem access\r\nReveals vital steps for preventing social engineeringthreats\r\nSocial Engineering: The Art of Human Hacking does itspart to prepare you against nefarious hackers--now you can doyour part by putting to good use the critical information withinits pages.', 4, 0),
(3, 'No Tech Hacking: A Guide to Social Engineering, Dumpster Diving, and Shoulder Surfing', 2007, 'Johnny Long', 'As the clich goes, information is power. In this age of technology, an increasing majority of the world\'s information is stored electronically. It makes sense then that we rely on high-tech electronic protection systems to guard that information. As professional hackers, Johnny Long and Kevin Mitnick get paid to uncover weaknesses in those systems and exploit them. Whether breaking into buildings or slipping past industrial-grade firewalls, their goal has always been the same: extract the information using any means necessary. After hundreds of jobs, they have discovered the secrets to bypassing every conceivable high-tech security system. This book reveals those secrets; as the title suggests, it has nothing to do with high technology.', 6, 0),
(4, 'Tavistock Institute: Social Engineering the Masses', 2011, 'Abdo Yehia', 'The Tavistock Institute, in Sussex, England, describes itself as a nonprofit charity that applies social science to contemporary issues and problems. But this book posits that it is the world’s center for mass brainwashing and social engineering activities. It grew from a somewhat crude beginning at Wellington House into a sophisticated organization that was to shape the destiny of the entire planet, and in the process, change the paradigm of modern society. In this eye-opening work, both the Tavistock network and the methods of brainwashing and psychological warfare are uncovered. With connections to U.S. research institutes, think tanks, and the drug industry, the Tavistock has a large reach, and Tavistock Institute attempts to show that the conspiracy is real, who is behind it, what its final long term objectives are, and how we the people can stop them.', 7, 0),
(5, 'Hacking the Human: Social Engineering Techniques and Security Countermeasures', 2008, 'Ian Mann', 'Information security is about people, yet in most organizations protection remains focused on technical countermeasures. The human element is crucial in the majority of successful attacks on systems and attackers are rarely required to find technical vulnerabilities, hacking the human is usually sufficient.Ian Mann turns the black art of social engineering into an information security risk that can be understood, measured and managed effectively. The text highlights the main sources of risk from social engineering and draws on psychological models to explain the basis for human vulnerabilities. If you are responsible for physical or information security or the protection of your business and employees from significant risk, then Hacking the Human is a must-read.', 2, 0),
(6, 'A Brief History of Time', 1998, 'Stephen Hawking', 'In the ten years since its publication in 1988, Stephen Hawking\'s classic work has become a landmark volume in scientific writing, with more than nine million copies in forty languages sold worldwide. That edition was on the cutting edge of what was then known about the origins and nature of the universe. But the intervening years have seen extraordinary advances in the technology of observing both the micro- and the macrocosmic worlds. These observations have confirmed many of Professor Hawking\'s theoretical predictions in the first edition of his book, including the recent discoveries of the Cosmic Background Explorer satellite (COBE), which probed back in time to within 300,000 years of the universe\'s beginning and revealed wrinkles in the fabric of space-time that he had projected. Eager to bring to his original text the new knowledge revealed by these observations, as well as his own recent research, Professor Hawking has prepared a new introduction to the book, written an entirely new chapter on wormholes and time travel, and updated the chapters throughout.', 1, 0),
(7, 'A Short History of Nearly Everything', 2004, 'Bill Bryson', 'In Bryson\'s biggest book, he confronts his greatest challenge: to understand—and, if possible, answer—the oldest, biggest questions we have posed about the universe and ourselves. Taking as territory everything from the Big Bang to the rise of civilization, Bryson seeks to understand how we got from there being nothing at all to there being us. To that end, he has attached himself to a host of the world’s most advanced (and often obsessed) archaeologists, anthropologists, and mathematicians, travelling to their offices, laboratories, and field camps. He has read (or tried to read) their books, pestered them with questions, apprenticed himself to their powerful minds. A Short History of Nearly Everything is the record of this quest, and it is a sometimes profound, sometimes funny, and always supremely clear and entertaining adventure in the realms of human knowledge, as only Bill Bryson can render it. Science has never been more involving or entertaining.', 5, 0),
(8, 'The Selfish Gene', 2006, 'Richard Dawkins', 'Inheriting the mantle of revolutionary biologist from Darwin, Watson, and Crick, Richard Dawkins forced an enormous change in the way we see ourselves and the world with the publication of The Selfish Gene. Suppose, instead of thinking about organisms using genes to reproduce themselves, as we had since Mendel\'s work was rediscovered, we turn it around and imagine that \\\"our\\\" genes build and maintain us in order to make more genes. That simple reversal seems to answer many puzzlers which had stumped scientists for years, and we haven\'t thought of evolution in the same way since.\r\n\r\nWhy are there miles and miles of \\\"unused\\\" DNA within each of our bodies? Why should a bee give up its own chance to reproduce to help raise her sisters and brothers? With a prophet\'s clarity, Dawkins told us the answers from the perspective of molecules competing for limited space and resources to produce more of their own kind. Drawing fascinating examples from every field of biology, he paved the way for a serious re-evaluation of evolution. He also introduced the concept of self-reproducing ideas, or memes, which (seemingly) use humans exclusively for their propagation. If we are puppets, he says, at least we can try to understand our strings. —Rob Lightner', 2, 0),
(9, 'Cosmos', 2002, 'Carl Sagan', 'Cosmos has 13 heavily illustrated chapters, corresponding to the 13 episodes of the Cosmos television series. In the book, Sagan explores 15 billion years of cosmic evolution and the development of science and civilization. Cosmos traces the origins of knowledge and the scientific method, mixing science and philosophy, and speculates to the future of science. The book also discusses the underlying premises of science by providing biographical anecdotes about many prominent scientists throughout history, placing their contributions into the broader context of the development of modern science.\r\n\r\nThe book covers a broad range of topics, comprising Sagan\'s reflections on anthropological, cosmological, biological, historical, and astronomical matters from antiquity to contemporary times. Sagan reiterates his position on extraterrestrial life—that the magnitude of the universe permits the existence of thousands of alien civilizations, but no credible evidence exists to demonstrate that such life has ever visited earth.', 4, 0),
(10, 'The Elegant Universe: Superstrings, Hidden Dimensions, and the Quest for the Ultimate Theory', 2010, 'Brian Greene', 'Brian Greene, one of the world\'s leading string theorists, peels away layers of mystery to reveal a universe that consists of eleven dimensions, where the fabric of space tears and repairs itself, and all matter—from the smallest quarks to the most gargantuan supernovas—is generated by the vibrations of microscopically tiny loops of energy. The Elegant Universe makes some of the most sophisticated concepts ever contemplated accessible and thoroughly entertaining, bringing us closer than ever to understanding how the universe works.', 3, 0),
(11, 'In the Footsteps of the Prophet: Lessons from the Life of Muhammad', 2007, 'Tariq Ramadan', 'Named by Time magazine as one of the 100 most important innovators of the century, Tariq Ramadan is a leading Muslim scholar, with a large following especially among young European and American Muslims. Now, in his first book written for a wide audience, he offers a marvelous biography of the Prophet Muhammad, one that highlights the spiritual and ethical teachings of one of the most influential figures in human history.\r\n\r\nIn the Footsteps of the Prophet is a fresh and perceptive look at Muhammad, capturing a life that was often eventful, gripping, and highly charged. Ramadan provides both an intimate portrait of a man who was shy, kind, but determined, as well as a dramatic chronicle of a leader who launched a great religion and inspired a vast empire. More important, Ramadan presents the main events of the Prophet\'s life in a way that highlights his spiritual and ethical teachings. The book underscores the significance of the Prophet\'s example for some of today\'s most controversial issues, such as the treatment of the poor, the role of women, Islamic criminal punishments, war, racism, and relations with other religions. Selecting those facts and stories from which we can draw a profound and vivid spiritual picture, the author asks how can the Prophet\'s life remain -- or become again -- an example, a model, and an inspiration? And how can Muslims move from formalism -- a fixation on ritual -- toward a committed spiritual and social presence?\r\n\r\nIn this thoughtful and engaging biography, Ramadan offers Muslims a new understanding of Muhammad\'s life and he introduces non-Muslims not just to the story of the Prophet, but to the spiritual and ethical riches of Islam.', 4, 0),
(12, 'Introduction to Algorithms', 2001, 'Thomas H. Cormen', 'This title covers a broad range of algorithms in depth, yet makes their design and analysis accessible to all levels of readers. Each chapter is relatively self-contained and can be used as a unit of study. The algorithms are described in English and in a pseudocode designed to be readable by anyone who has done a little programming. The explanations have been kept elementary without sacrificing depth of coverage or mathematical rigor.', 5, 0),
(13, 'Algorithms Unlocked', 2013, 'Thomas H. Cormen', 'For anyone who has ever wondered how computers solve problems, an engagingly written guide for nonexperts to the basics of computer algorithms.', 4, 0),
(14, 'The Pragmatic Programmer: From Journeyman to Master', 1999, 'Andy Hunt', 'Ward Cunningham Straight from the programming trenches, The Pragmatic Programmer cuts through the increasing specialization and technicalities of modern software development to examine the core process--taking a requirement and producing working, maintainable code that delights its users. It covers topics ranging from personal responsibility and career development to architectural techniques for keeping your code flexible and easy to adapt and reuse. Read this book, and youll learn how to *Fight software rot; *Avoid the trap of duplicating knowledge; *Write flexible, dynamic, and adaptable code; *Avoid programming by coincidence; *Bullet-proof your code with contracts, assertions, and exceptions; *Capture real requirements; *Test ruthlessly and effectively; *Delight your users; *Build teams of pragmatic programmers; and *Make your developments more precise with automation. Written as a series of self-contained sections and filled with entertaining anecdotes, thoughtful examples, and interesting analogies, The Pragmatic Programmer illustrates the best practices and major pitfalls of many different aspects of software development. Whether youre a new coder, an experienced programm', 5, 0),
(15, 'Pragmatic Thinking and Learning: Refactor Your Wetware', 2008, 'Andy Hunt', 'Software development happens in your head. Not in an editor, IDE, or design tool. You\'re well educated on how to work with software and hardware, but what about wetware--our own brains? Learning new skills and new technology is critical to your career, and it\'s all in your head.\r\n\r\nIn this book by Andy Hunt, you\'ll learn how our brains are wired, and how to take advantage of your brain\'s architecture. You\'ll learn new tricks and tips to learn more, faster, and retain more of what you learn.\r\n\r\nYou need a pragmatic approach to thinking and learning. You need to Refactor Your Wetware.\r\n\r\nProgrammers have to learn constantly; not just the stereotypical new technologies, but also the problem domain of the application, the whims of the user community, the quirks of your teammates, the shifting sands of the industry, and the evolving characteristics of the project itself as it is built.\r\n\r\nWe\'ll journey together through bits of cognitive and neuroscience, learning and behavioral theory. You\'ll see some surprising aspects of how our brains work, and how you can take advantage of the system to improve your own learning and thinking skills.\r\n\r\nIn this book you\'ll learn how to:\r\n\r\nUse the Dreyfus Model of Skill Acquisition to become more expert\r\n\r\nLeverage the architecture of the brain to strengthen different thinking modes\r\n\r\nAvoid common \\\"known bugs\\\" in your mind\r\n\r\nLearn more deliberately and more effectively\r\n\r\nManage knowledge more efficiently', 7, 0),
(19, 'Pragmatic Unit Testing in C# with NUnit', 2007, 'Andy Hunt', 'The NIST estimates that poor testing costs the US economy $60 billion annually. This book gives teams straightforward and proven ways to introduce unit testing into their process, resulting in higher quality and fewer bugs.\r\n\r\nAll over the world, software teams are using unit testing both to verify their code and as a way of helping them design better code. This book is unique in the way it covers two aspects: showing developers both how to test and helping them determine what to test.\r\n\r\nNew in the second edition:\r\n\r\n\r\nUpdated for NUnit 2.4 (.NET 2.0 and Visual Studio 2005) More assert methods New String and Collection assertion support Better support for multiple-platform development Higher-level setup and teardown fixtures Whole new chapter on extending NUnit and more!', 3, 0),
(20, 'Learn to Program with Minecraft Plugins: Create Flaming Cows in Java Using CanaryMod', 2014, 'Andy Hunt', 'The bestselling, kid-tested book for Minecraft is now updated for CanaryMod! Write your own Minecraft plugins and watch your code come to life with flaming cows, flying creepers, teleportation, and interactivity. Add your own features to the Minecraft game by developing Java code that \\\"plugs in\\\" to the server. You\'ll manipulate and control elements in the 3D graphical game environment without having to write tons of code or learn huge frameworks. No previous programming experience necessary.\r\n\r\nExpand your Minecraft experience! You\'ll learn how to write Java code and build plugins for your own Minecraft servers using the popular Java programming language. This new edition has been completely revised to use the freely-available CanaryMod library.\r\n\r\nYou\'ll create plugins that can change blocks from air to stone, or spawn cows and creepers. You\'ll write plugins that react to game events, and even schedule tasks that will run later in the game. Readers from age 9 to 99 will learn how to use variables and functions to build plugins that fling players into the sky, create flying creepers, and of course, shoot flaming cows.\r\n\r\nAlong the way you\'ll learn real programming using Java, from classes, objects, and data structures (including arrays and hashes) to exception handling and threads. You\'ll even learn how to back up your code (and go back in time!) using Git, and run your own server at home or in the cloud. A progress bar shows you how far you\'ve come in each chapter, and by the end of the book you\'ll be able to design and code your own plugins.\r\n\r\nPut your gaming to good use, and learn real programming skills today.\r\n\r\nWhat You Need:\r\n\r\nA modern PC running the Windows, Mac OS X, or Linux operating systems. The book explains how to download Java, the CanaryMod server and API, and all the tools you\'ll need.', 7, 0),
(21, 'Artificial Intelligence: A Modern Approach', 2002, 'Stuart Russell', 'For one or two-semester, undergraduate or graduate-level courses in Artificial Intelligence. The long-anticipated revision of this best-selling text offers the most comprehensive, up-to-date introduction to the theory and practice of artificial intelligence. *NEW-Nontechnical learning material-Accompanies each part of the book. *NEW-The Internet as a sample application for intelligent systems-Added in several places including logical agents, planning, and natural language. *NEW-Increased coverage of material - Includes expanded coverage of: default reasoning and truth maintenance systems, including multi-agent/distributed AI and game theory; probabilistic approaches to learning including EM; more detailed descriptions of probabilistic inference algorithms. *NEW-Updated and expanded exercises-75% of the exercises are revised, with 100 new exercises. *NEW-On-line Java software. *Makes it easy for students to do projects on the web using intelligent agents. *A unified, agent-based approach to AI-Organizes the material around the task of building intelligent agents. ', 6, 0),
(22, 'The C Programming Language', 1988, 'Brian W. Kernighan', 'This book is meant to help the reader learn how to program in C. It is the definitive reference guide, now in a second edition. Although the first edition was written in 1978, it continues to be a worldwide best-seller. This second edition brings the classic original up to date to include the ANSI standard.\r\n\r\nFrom the Preface:\r\nWe have tried to retain the brevity of the first edition. C is not a big language, and it is not well served by a big book. We have improved the exposition of critical features, such as pointers, that are central to C programming. We have refined the original examples, and have added new examples in several chapters. For instance, the treatment of complicated declarations is augmented by programs that convert declarations into words and vice versa. As before, all examples have been tested directly from the text, which is in machine-readable form.\r\n\r\nAs we said in the first preface to the first edition, C \\\"wears well as one\'s experience with it grows.\\\" With a decade more experience, we still feel that way. We hope that this book will help you to learn C and use it well.', 4, 0),
(23, 'The UNIX Programming Environment', 1983, 'Brian W. Kernighan', 'In their preface, the authors explain, This book is meant to help the reader learn how to program in C. It contains tutorial introduction to get new users started as soon as possible, separate chapters on each major feature, and a reference manual. Most of the treatment is based on reading, writing, and revising examples, rather than on mere statement of rules. For the most part, the examples are complete, real programs, rather than isolated garments. All examples have been tested directly from the text, which is in machine-readable form. Besides showing how to make effective use of the language, we have also tried where possible to illustrate useful algorithms and principles of good style and sound design....', 9, 0),
(24, 'Software Tools in Pascal', 1981, 'Brian W. Kernighan', 'With the same style and clarity that characterized their highly acclaimed The Elements of Programming Style and Software Tools, the authors have written Software Tools in Pascal to teach how to write good Pascal programs that make good tools. The programs contained in the book are not artificial, but are actual tools that have proved valuable in the production of other programs. Structured programming and top-down design are emphasized and applied to every program, as are principles of sound design, testing, efficiency, and portability. All of the programs are complete and have been tested directly from the text. The programs are available in machine-readable form from Addison-Wesley. Software Tools in Pascal is ideal for use in a software engineering course, for a second course in programming, or as a supplement in any programming course. All programmers, professional and student, will find the book invaluable as a source of proven, useful programs for reading and study. Numerous exercises are provided to test comprehension and to extend the concepts presented in the book.', 2, 0),
(25, 'Code Complete', 2004, 'Steve McConnell', 'Widely considered one of the best practical guides to programming, Steve McConnell\'s original CODE COMPLETE has been helping developers write better software for more than a decade. Now this classic book has been fully updated and revised with leading-edge practices--and hundreds of new code samples--illustrating the art and science of software construction. Capturing the body of knowledge available from research, academia, and everyday commercial practice, McConnell synthesizes the most effective techniques and must-know principles into clear, pragmatic guidance. No matter what your experience level, development environment, or project size, this book will inform and stimulate your thinking--and help you build the highest quality code.\r\nDiscover the timeless techniques and strategies that help you:\r\nDesign for minimum complexity and maximum creativity\r\nReap the benefits of collaborative development\r\nApply defensive programming techniques to reduce and flush out errors\r\nExploit opportunities to refactor--or evolve--code, and do it safely\r\nUse construction practices that are right-weight for your project\r\nDebug problems quickly and effectively\r\nResolve critical construction issues early and correctly\r\nBuild quality into the beginning, middle, and end of your project', 4, 0),
(26, 'Cracking the Coding Interview: 150 Programming Questions and Solutions', 2011, 'Gayle Laakmann McDowell', 'Now in the 5th edition, Cracking the Coding Interview gives you the interview preparation you need to get the top software developer jobs. This is a deeply technical book and focuses on the software engineering skills to ace your interview. The book is over 500 pages and includes 150 programming interview questions and answers, as well as other advice.\r\n\r\nThe full list of topics are as follows:\r\n\r\nThe Interview Process\r\nThis section offers an overview on questions are selected and how you will be evaluated. What happens when you get a question wrong? When should you start preparing, and how? What language should you use? All these questions and more are answered.\r\n\r\nBehind the Scenes\r\nLearn what happens behind the scenes during your interview, how decisions really get made, who you interview with, and what they ask you. Companies covered include Google, Amazon, Yahoo, Microsoft, Apple and Facebook.\r\n\r\nSpecial Situations\r\nThis section explains the process for experience candidates, Program Managers, Dev Managers, Testers / SDETs, and more. Learn what your interviewers are looking for and how much code you need to know.\r\n\r\nBefore the Interview\r\nIn order to ace the interview, you first need to get an interview. This section describes what a software engineer\'s resume should look like and what you should be doing well before your interview.\r\n\r\nBehavioral Preparation\r\nAlthough most of a software engineering interview will be technical, behavioral questions matter too. This section covers how to prepare for behavioral questions and how to give strong, structured responses.\r\n\r\nTechnical Questions (+ 5 Algorithm Approaches)\r\nThis section covers how to prepare for technical questions (without wasting your time) and teaches actionable ways to solve the trickiest algorithm problems. It also teaches you what exactly \\\"good coding\\\" is when it comes to an interview.\r\n\r\n150 Programming Questions and Answers\r\nThis section forms the bulk of the book. Each section opens with a discussion of the core knowledge and strategies to tackle this type of question, diving into exactly how you break down and solve it. Topics covered include\r\n• Arrays and Strings\r\n• Linked Lists\r\n• Stacks and Queues\r\n• Trees and Graphs\r\n• Bit Manipulation\r\n• Brain Teasers\r\n• Mathematics and Probability\r\n• Object-Oriented Design\r\n• Recursion and Dynamic Programming\r\n• Sorting and Searching\r\n• Scalability and Memory Limits\r\n• Testing\r\n• C and C++\r\n• Java\r\n• Databases\r\n• Threads and Locks\r\n\r\nFor the widest degree of readability, the solutions are almost entirely written with Java (with the exception of C / C++ questions). A link is provided with the book so that you can download, compile, and play with the solutions yourself.\r\n\r\nChanges from the Fourth Edition: The fifth edition includes over 200 pages of new content, bringing the book from 300 pages to over 500 pages. Major revisions were done to almost every solution, including a number of alternate solutions added. The introductory chapters were massively expanded, as were the opening of each of the chapters under Technical Questions. In addition, 24 new questions were added.\r\n\r\nCracking the Coding Interview, Fifth Edition is the most expansive, detailed guide on how to ace your software development / programming interviews.', 6, 0),
(27, 'Clean Code: A Handbook of Agile Software Craftsmanship', 2008, 'Robert C. Martin', 'Even bad code can function. But if code isn t clean, it can bring a development organization to its knees. Every year, countless hours and significant resources are lost because of poorly written code. But it doesn t have to be that way.\r\nNoted software expert Robert C. Martin presents a revolutionary paradigm with Clean Code: A Handbook of Agile Software Craftsmanship . Martin has teamed up with his colleagues from Object Mentor to distill their best agile practice of cleaning code on the fly into a book that will instill within you the values of a software craftsman and make you a better programmer but only if you work at it.\r\nWhat kind of work will you be doing? You ll be reading code lots of code. And you will be challenged to think about what s right about that code, and what s wrong with it. More importantly, you will be challenged to reassess your professional values and your commitment to your craft.\r\nClean Code is divided into three parts. The first describes the principles, patterns, and practices of writing clean code. The second part consists of several case studies of increasing complexity. Each case study is an exercise in cleaning up code of transforming a code base that has some problems into one that is sound and efficient. The third part is the payoff: a single chapter containing a list of heuristics and smells gathered while creating the case studies. The result is a knowledge base that describes the way we think when we write, read, and clean code.\r\nReaders will come away from this book understanding\r\n\r\nHow to tell the difference between good and bad code How to write good code and how to transform bad code into good code How to create good names, good functions, good objects, and good classes How to format code for maximum readability How to implement complete error handling without obscuring code logic How to unit test and practice test-driven development This book is a must for any developer, software engineer, project manager, team lead, or systems analyst with an interest in producing better code.\r\n', 7, 0),
(28, 'The Clean Coder: A Code of Conduct for Professional Programmers', 2011, 'Robert C. Martin', 'Programmers who endure and succeed amidst swirling uncertainty and nonstop pressure share a common attribute: They care deeply about the practice of creating software. They treat it as a craft. They are professionals. In The Clean Coder: A Code of Conduct for Professional Programmers, legendary software expert Robert C. Martin introduces the disciplines, techniques, tools, and practices of true software craftsmanship. This book is packed with practical advice-about everything from estimating and coding to refactoring and testing. It covers much more than technique: It is about attitude. Martin shows how to approach software development with honor, self-respect, and pride; work well and work clean; communicate and estimate faithfully; face difficult decisions with clarity and honesty; and understand that deep knowledge comes with a responsibility to act. Readers will learn What it means to behave as a true software craftsman\r\nHow to deal with conflict, tight schedules, and unreasonable managers\r\nHow to get into the flow of coding, and get past writer\'s block\r\nHow to handle unrelenting pressure and avoid burnout\r\nHow to combine enduring attitudes with new development paradigms\r\nHow to manage your time, and avoid blind alleys, marshes, bogs, and swamps\r\nHow to foster environments where programmers and teams can thrive\r\nWhen to say \\\"No\\\"-and how to say it\r\nWhen to say \\\"Yes\\\"-and what yes really means Great software is something to marvel at: powerful, elegant, functional, a pleasure to work with as both a developer and as a user. Great software isn\'t written by machines. It is written by professionals with an unshakable commitment to craftsmanship. The Clean Coder will help you become one of them-and earn the pride and fulfillment that they alone possess.', 2, 0),
(29, 'Agile Software Development, Principles, Patterns, and Practices', 2002, 'Robert C. Martin', 'Written by a software developer for software developers, this book is a unique collection of the latest software development methods. The author includes OOD, UML, Design Patterns, Agile and XP methods with a detailed description of a complete software design for reusable programs in C++ and Java. Using a practical, problem-solving approach, it shows how to develop an object-oriented application--from the early stages of analysis, through the low-level design and into the implementation. Walks readers through the designer\'s thoughts -- showing the errors, blind alleys, and creative insights that occur throughout the software design process. The book covers: Statics and Dynamics; Principles of Class Design; Complexity Management; Principles of Package Design; Analysis and Design; Patterns and Paradigm Crossings. Explains the principles of OOD, one by one, and then demonstrates them with numerous examples, completely worked-through designs, and case studies. Covers traps, pitfalls, and work arounds in the application of C++ and OOD and then shows how Agile methods can be used. Discusses the methods for designing and developing big software in detail. Features a three-chapter, in-depth, single case study of a building security system. For Software Engineers, Programmers, and Analysts who want to understand how to design object oriented software with state of the art methods.', 6, 0),
(30, 'Agile Principles, Patterns, and Practices in C#', 2006, 'Robert C. Martin', 'With the award-winning book Agile Software Development: Principles, Patterns, and Practices, Robert C. Martin helped bring Agile principles to tens of thousands of Java and C++ programmers. Now .NET programmers have a definitive guide to agile methods with this completely updated volume from Robert C. Martin and Micah Martin, Agile Principles, Patterns, and Practices in C#.\r\n\r\nThis book presents a series of case studies illustrating the fundamentals of Agile development and Agile design, and moves quickly from UML models to real C# code. The introductory chapters lay out the basics of the agile movement, while the later chapters show proven techniques in action. The book includes many source code examples that are also available for download from the authors\' Web site.\r\n\r\nReaders will come away from this book understanding\r\n\r\nAgile principles, and the fourteen practices of Extreme Programming Spiking, splitting, velocity, and planning iterations and releases Test-driven development, test-first design, and acceptance testing Refactoring with unit testing Pair programming Agile design and design smells The five types of UML diagrams and how to use them effectively Object-oriented package design and design patterns How to put all of it together for a real-world project Whether you are a C# programmer or a Visual Basic or Java programmer learning C#, a software development manager, or a business analyst, Agile Principles, Patterns, and Practices in C# is the first book you should read to understand agile software and how it applies to programming in the .NET Framework.', 7, 0),
(31, 'Clean Agile: Back to Basics', 2019, 'Robert C. Martin', 'Twenty years after the Agile Manifesto was first presented, the legendary Robert C. Martin (\\\"Uncle Bob\\\") reintroduces agile values and principles for a new generation of software developers. In this eagerly-awaited book, the best-selling author of The Clean Coder shows how to bring unprecedented levels of professionalism and discipline to agile development -- and thereby write far more effective, successful software.\r\nAs with his other books, Martin\'s Clean Agile: Back to Basics doesn\'t merely present multiple choices and options, and say \\\"use your best judgment\\\": it tells you what choices to make, and why those choices are critical to your success. Writing in the agile context, Martin offers direct, no-nonsense answers to crucial questions like:\r\nHow and why did Agile begin? What are the costs and benefits of Agile? What are the most effective practices of Agile Development? How should an Agile team be organized? What roles do programmers, testers, and managers play in an Agile team? What is the role of the Agile Coach? What about Agile for large projects? What kinds of projects benefit from Agile? Clean Agile: Back to Basics is essential reading for programmers, managers, testers, project managers and every software professional called upon to lead or participate in an agile project.', 3, 0),
(32, 'UML for Java Programmers', 2003, 'Robert C. Martin', 'UML is a graphical notation for drawing diagrams of software concepts. This handbook takes a very pragmatic view of UML providing guidance with a realistic perspective that can be applied immediately.', 1, 0),
(33, 'Design Patterns: Elements of Reusable Object-Oriented Software', 1994, 'John Vlissides', 'Capturing a wealth of experience about the design of object-oriented software, four top-notch designers present a catalog of simple and succinct solutions to commonly occurring design problems. Previously undocumented, these 23 patterns allow designers to create more flexible, elegant, and ultimately reusable designs without having to rediscover the design solutions themselves.\r\n\r\nThe authors begin by describing what patterns are and how they can help you design object-oriented software. They then go on to systematically name, explain, evaluate, and catalog recurring designs in object-oriented systems. With Design Patterns as your guide, you will learn how these important patterns fit into the software development process, and how you can leverage them to solve your own design problems most efficiently.\r\n\r\nEach pattern describes the circumstances in which it is applicable, when it can be applied in view of other design constraints, and the consequences and trade-offs of using the pattern within a larger design. All patterns are compiled from real systems and are based on real-world examples. Each pattern also includes code that demonstrates how it may be implemented in object-oriented programming languages like C++ or Smalltalk.', 4, 0),
(34, 'Permanent Record', 2019, 'Edward Snowden', 'Edward Snowden, the man who risked everything to expose the US government’s system of mass surveillance, reveals for the first time the story of his life, including how he helped to build that system and what motivated him to try to bring it down.\r\n\r\nIn 2013, twenty-nine-year-old Edward Snowden shocked the world when he broke with the American intelligence establishment and revealed that the United States government was secretly pursuing the means to collect every single phone call, text message, and email. The result would be an unprecedented system of mass surveillance with the ability to pry into the private lives of every person on earth. Six years later, Snowden reveals for the very first time how he helped to build this system and why he was moved to expose it.\r\n\r\nSpanning the bucolic Beltway suburbs of his childhood and the clandestine CIA and NSA postings of his adulthood, Permanent Record is the extraordinary account of a bright young man who grew up online—a man who became a spy, a whistleblower, and, in exile, the Internet’s conscience. Written with wit, grace, passion, and an unflinching candor, Permanent Record is a crucial memoir of our digital age and destined to be a classic.', 2, 0),
(35, 'Weapons of Math Destruction: How Big Data Increases Inequality and Threatens Democracy', 2016, 'Cathy O\'Neil', 'A former Wall Street quant sounds an alarm on mathematical modeling—a pervasive new force in society that threatens to undermine democracy and widen inequality.\r\n \r\nWe live in the age of the algorithm. Increasingly, the decisions that affect our lives—where we go to school, whether we get a car loan, how much we pay for health insurance—are being made not by humans, but by mathematical models. In theory, this should lead to greater fairness: Everyone is judged according to the same rules, and bias is eliminated. But as Cathy O’Neil reveals in this shocking book, the opposite is true. The models being used today are opaque, unregulated, and uncontestable, even when they’re wrong. Most troubling, they reinforce discrimination: If a poor student can’t get a loan because a lending model deems him too risky (by virtue of his race or neighborhood), he’s then cut off from the kind of education that could pull him out of poverty, and a vicious spiral ensues. Models are propping up the lucky and punishing the downtrodden, creating a “toxic cocktail for democracy.” Welcome to the dark side of Big Data.\r\n \r\nTracing the arc of a person’s life, from college to retirement, O’Neil exposes the black box models that shape our future, both as individuals and as a society. Models that score teachers and students, sort resumes, grant (or deny) loans, evaluate workers, target voters, set parole, and monitor our health—all have pernicious feedback loops. They don’t simply describe reality, as proponents claim, they change reality, by expanding or limiting the opportunities people have. O’Neil calls on modelers to take more responsibility for how their algorithms are being used. But in the end, it’s up to us to become more savvy about the models that govern our lives. This important book empowers us to ask the tough questions, uncover the truth, and demand change.', 4, 0),
(36, 'Sandworm: A New Era of Cyberwar and the Hunt for the Kremlin\'s Most Dangerous Hackers', 2019, 'Andy Greenberg', 'A chilling, globe-spanning detective story, tracking an elite group of Russian hackers and the future of global warfare\r\n\r\nIn 2014, the world witnessed the start of an escalating series of cyberattacks. Targeting American utility companies, NATO, and electric grids in Eastern Europe, the strikes became ever more brazen, eventually leading to the first-ever blackouts triggered by hackers. They culminated in the summer of 2017 when malware known as NotPetya was unleashed, compromising, disrupting, and paralyzing some of the world\'s largest companies. At the attack\'s epicenter in Ukraine, ATMs froze. The railway and postal systems shut down. NotPetya spread around the world, inflicting an unprecedented ten billions of dollars in damage--the largest, most penetrating cyberattack the world had ever seen.\r\n\r\nThe hackers behind these attacks are quickly gaining a reputation as the most dangerous team of cyberwarriors in the internet\'s history: Sandworm. Believed to be working in the service of Russia\'s military intelligence agency, they represent a persistent, highly skilled, state-sponsored hacking force, one whose talents are matched by their willingness to launch broad, unrestrained attacks on the most critical infrastructure of their adversaries. They target government and private sector, military and civilians alike.\r\n\r\nFrom WIRED senior writer Andy Greenberg comes Sandworm, the true story of the desperate hunt to identify and track those attackers. It considers the danger this force poses to our national stability and security. And as the Kremlin\'s role in manipulating foreign governments and sparking chaos globally comes into greater focus, Sandworm reveals the realities not just of Russia\'s global digital offensive, but of an era where warfare ceases to be waged on the battlefield--where the line between digital and physical conflict begins to blur, with world-shaking implications.', 5, 0);";
if (mysqli_query($connect, $myQuery)) {
echo "<br><span style='color: green;background: black'>Dummy books added successfully!</span>";
} else {
echo "<br><span style='color: red;background: black'>Couldn't add dummy books, you will enter books manually.</span>";
}
} else {
echo "<br><span style='color: red;background: black'>Couldn't create Books table</span>";
}
}
$myQuery = "DESCRIBE borrowed_books;"; //check books database
if(mysqli_query($connect, $myQuery) === false){
$myQuery = "create table borrowed_books(ISBN int not null, user_email varchar(50) not null,borrow_date date not null, return_date date not null, constraint isbn_fk foreign key (ISBN) references books(ISBN), constraint user_fk foreign key (user_email) references users(email) on delete cascade on update cascade );";
if (mysqli_query($connect, $myQuery)) {
echo "<br><span style='color: green;background: black'>Created Borrowed Books table successfully!</span>";
} else {
echo "<br><span style='color: red;background: black'>Couldn't create Borrowed Books table</span>";
}
}