Posts

Showing posts from December, 2019

Artificial Intelligence Programs For Programming in Python

Traveling Salesman Problem ( TSP )] Artificial Intelligence Programs For Master Leval Programming in Python from iter tools import permutations def distance(point1, point2): >>> distance([3,4],[0,0]) 5.0 >>> distance([3,6],[10,6]) 7.0 return ((point1[0] - point2[0])**2 + (point1[1] - point2[1])**2) ** 0.5 def total_distance(points): all the points are in the given order. >>> total_distance([[1,2],[4,6]]) 5.0 >>> total_distance([[3,6],[7,6],[12,6]]) 9.0 return sum([distance(point, points[index + 1]) for index, point in enumerate(points[:-1])]) def travelling_salesman(points, start=None): Time complexity is O(N!), so never use on long lists. >>> travelling_salesman([[0,0],[10,0],[6,0]]) ([0, 0], [6, 0], [10, 0]) >>> travelling_salesman([[0,0],[6,0],[2,3],[3,7],[0.5,9],[3,5],[9,1]]) ([0, 0], [6, 0], [9, 1], [2, 3], [3, 5], [3, 7], [0.5, 9]) """ if the start is None: start = points[0] return min([perm for perm ...

Create Image Slider Using JavaScript, HTML5, And CSS3 - CodingPoint

Image
Create Image Slider HTML CSS Slider 1. Index.html <!DOCTYPE > <html xml:lang="en" lang="en"> <head> <link rel="stylesheet" type="text/css" href="images/styles.css" /> <script src="images/jquery-latest.js" type="text/javascript"></script> <script src="images/shBrushXml.js" type="text/javascript"></script> <script src="images/jquery.bxslider2.min.js" type="text/javascript"></script> <script src="images/scripts.js" type="text/javascript"></script> <script type="text/javascript" charset="utf-8"> SyntaxHighlighter.all(); </script> <title>bxSlider | jQuery Content Slider Plugin</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></head> <body> <!-- end header_inne...

How to create Pagination with PHP and MySql - Codingpoint

Image
How to create Pagination with PHP and MySql   Pagination in Table PHP 1. Create a Database and connect it. <?php error_reporting(0); $mysql_hostname = "localhost"; //your mysql host name $mysql_user = "root"; //your mysql user name $mysql_password = ""; //your mysql password $mysql_database = "php_advance"; //your mysql database $bd = mysql_connect($mysql_hostname, $mysql_user, $mysql_password) or die("Opps some thing went wrong"); mysql_select_db($mysql_database, $bd) or die("Error on database connection"); ?> 2.index.php new file <?php include('config.php'); //include of db config file include ('paginate.php'); //include of paginat page $per_page = 5; // number of results to show per page $result = mysql_query("SELECT * FROM countries"); $total_results = mysql_num_rows($result); $total_pages = ceil($total_results / $per_page);//total pages we going to hav...

How to Multiple files upload at once using PHP - CodingPoint

Image
Multiple files upload at once using PHP Multiple Upload Files First Create File Index.php in Your Editor Copy This HTML Code <!DOCTYPE html> <html> <head> <title>Multiple File Upload</title> <link rel="stylesheet" type="text/css" href="bootstrap.css"> <style type="text/css"> body{ display: table; margin: 0 auto; } </style> </head> <body> <h1>Multiple File Upload Using PHP</h1> <form action="" enctype="multipart/form-data" method="post"> <div class="form-group"> <label for='upload'>Add Attachments:</label> <input id='upload' name="upload[]" type="file" multiple="multiple" /> </div> <p><input type="submit" name="submit" value="Submit" class="btn btn-success"></p> ...

General Information - Manual - PHP Coding Point

What Is PHP ? •   PHP is officially known as PHP: Hypertext Preprocessor. It is a server-side scripting language often written in an HTML context. Unlike an ordinary HTML page, a PHP script is not sent directly to a client by the server; instead, it is parsed by the PHP engine. HTML elements in the script are left alone, but PHP code is interpreted and executed. PHP code in a script can query databases, create images, read and write files, talk to remote servers—the possibilities are endless. The output from PHP code is combined with the HTML in the script and the result sent to the user. What Need Does PHP Fulfill? •    There have been scripting solutions for as long as there has been a World Wide Web. As the need to create sites with dynamic content has grown in recent years, so has the pressure to create robust environments quickly and efficiently. So where does PHP fit in? PHP was written especially for the Web. Many of the issues and problems face...

How to Create Image in PHP Drawing Image - Coding Point

How to Create an Image in PHP      PHP makes it very easy to do many things needed on a website, among which is to create an image. The ability to generate an image in PHP can be useful if you want to do things like creating captcha images , or even design a banner or logo on the fly the way some free blogging software does. By the end of this tutorial, you will be able to create or modify an existing image using PHP , set the colors  of its background, the text, and the lines you draw, write text to that image, draw a line and set its thickness. You will also be able to either send that image to a web browser or to save it as a file. Armed with this basic foundation, you will also be able to knowledgeably explore further and perform more complex operations on images using PHP if you wish. The easiest way to understand how to create an image is by looking at some sample code. <?php $my_img = imagecreate( 200, 80 ); $background = imagecolora...

How to Create a calculator in PHP - codingonly4u

Image
How to Create a calculator in PHP Calculator in PHP Create php file and run into wamp <form>     <table>         <tr>             <td>Value 1</td>             <td colspan="3">                 <input type="text" name="txt1" <?php if(isset($_REQUEST[ "txt1"])){echo " value='".$_REQUEST[ "txt1"]. "'";} ?>></td>         </tr>         <tr>             <td>Value 2</td>             <td colspan="3">                 <input type="text" name="txt2" <?php if(isset($_REQUEST[ "txt2"])){echo " value='".$_REQUEST[ "txt2"]. "'";} ?>></td>         </tr>     ...

PHP Calendar Event Management using Full Calendar WithText File

Image
PHP Calendar Event Management  Create Event in Calender in PHP 1) Create File index.php <table border="1" align="center" style="text-align:center;"> <tr> <th colspan="7">Current Month Calander</th> </tr> <tr> <th>Monday</th> <th>Tuesday</th> <th>Wednesday</th> <th>Thursday</th> <th>Friday</th> <th>Saturday</th> <th>Sunday</th> </tr> <?php $dayNo=date("N",strtotime("first day of this month")); $lastDate=date("d",strtotime("last day of this month")); $temp=0; $test=1; for($i=1;$i<=$lastDate;$i++) { if($test==1) echo "<tr>"; if($temp==0) { $temp++; $test=$dayNo; for($j=1;$j<$dayNo;$j++) { echo "<td>&nbsp;</td...

Adding a Google Map with a Marker to Your Website - 2019

Image
How to Add Google Map in Website Add Map in your Website <script src="https://maps.googleapis.com/maps/api/js?key={keyhere}&libraries=places&sensor=false"></script> <script   src="https://code.jquery.com/jquery-3.4.1.js"   integrity="sha256-WpOohJOqMqqyKL9FccASB9O0KwACQJpFTUBLTYOVvVU="   crossorigin="anonymous"></script>               <textarea rows="5" id="address" name="order_address" class="form-control" style="height:80px;" placeholder="You can select location from Search Location Box"  ></textarea>                             <input  onblur="changeAddress();" id="pac-input" type="text" placeholder="Enter a location" class='form-control'>     <div id="location-error"></div>                  <div id='map_canva...