Skip to main content

Posts

Showing posts from 2019

Console API In JavaScript

From system development using JavaScript and NodeJS Found that using the command console.log() is a lot Often, the result is not as desired. Therefore introducing a little more Console Console usage Let's get started. Basic Console API In JavaScript Most will find in the debug of the work system as follows. console.log () encountered the most. console.warn () console.error () Let's look at some other useful methods. 1. Console.table() Display data of objects and arrays in a tabular format. Which is easy to read and easy to understand. 2. Console.assert() Check the submitted value to be true or false. If the value entered is false and will write a log for us to see But if true it will not display the log The false value consists of 0, false, blank, etc. 3. Console.count() For counting values or counting work times Very useful when we debug a system. Especially those with a strange life cycle will make us understand work more easily Which will be used to

How to JOIN Tables with MySQL

In this article, I will talk about the speed of the JOIN table in various forms of MySQL , which will be useful. In choosing the right command style in order to get the fastest results The test is nothing much. I tested the functionality on phpMyAdmin and then saw the results of the query speed from phpMyAdmin . If applied to other tests, try it. Testing, I chose the test command in the JOIN group to select all the data to be displayed. It is a query that gives the same result in 3 types without sorting. SELECT I.*,T.* FROM eduparty_index AS I INNER JOIN eduparty_template AS T ORDER BY I.username 3,060 total, keywords lasted 0.1406 seconds SELECT I.*,T.* FROM eduparty_index AS I CROSS JOIN eduparty_template AS T ORDER BY I.username 3,060 total, keywords lasted 0.1145 seconds SELECT I.*,T.* FROM eduparty_index AS I,eduparty_template AS T ORDER BY I.username 3,060 total, keywords lasted 0.1043 seconds The total time obtained is the average time for each order

Priorities Within the WHERE Statement of MySQL

Prioritization within the WHERE clause of MySQL has a profound effect on query performance, especially in the case of the database is large or complex queries, in which MySQL processes the SQL statements from left to right. The important principle of the priority of queries in this section is to specify the results that are ordered in ascending order from left query to right query. I give an example of the member database. Suppose there are 100 records in total. 50 men, 50 women and have a unique name. I want information that is male. SELECT * FROM user WHERE sex='m' I will get 50 records. If I need information called test. SELECT * FROM user WHERE username='test' I will get only one record (if any). The above command will execute a loop from the first record one by one and compare the data within the WHERE statement. Of course, it will need to process 100 cycles according to the amount of data. Suppose, if I want the data named test male, I ca

Order Operation SELECT MySQL

Many people may not know how MySQL has the sequence of the SELECT statement that we use. And many others as well, probably asking me, why do we know it (FA) In the official program Determining the order of work, It is very important. Determining the correct order will result in the result being incorrect. It may cause the result to be incorrect, such as multiplying 2 + 5 * 3 multiplying before adding. Will get the result 17, but if adding before multiplying Will get a result of 21 which is not equal As for the result, it will be correct depending on the problem. Which we have a way to force the result to be always correct with the work order such as SELECT 2 + 5 * 3 และ SELECT 5 * 3 + 2 The result will always be 17 since MySql will always execute * before +. Therefore, if the correct result is 21, then this calculation will be wrong. Control results are always accurate by placing parentheses around the order in which MySQL will calculate the results from Innermost brac

Create Multiple Domains on Localhost

Usually, when we install Appserver, we will get the domain name is  http://localhost  If we want to change to a different name, such as  http://project  Or when wanting to have multiple domains to use with multiple projects, what to do? For example,  http://project1  Keep the file in the project1 directory and  http://project2  Keep files in project2. Managing or testing is probably a lot easier. Especially if there are many projects and the work will be a lot easier The basic principle is similar to making a subdomain on localhost : 1. Open the file  C:\windows\system32\drivers\etc\hosts  with a general text editor and add the desired domain, such as 127.0.0.1 project1 127.0.0.1 project2 And save Can be added according to the number of projects desired And the desired name (Including being able to create subdomain too) 2. Open Appserver's httpd.conf file. Don't know where it is. You can look at the Appserver menu. Click on Apache Edit the httpd.conf Configurati

What is chmod

chmod is a command on UNIX systems. It is used to allow file permissions. Or folders About what someone can do Which is divided into 3 groups which are 1. The owner of the file (owner) 2. File owner group 3. General users, external (public) Which can specify that each group can 1. Can read the file or download the file in that directory (read) 2. Write a file or create a file or directory in that directory (write) 3. The file can be processed (execute). For example, if you want any directory Can create files into directories We have to give permission to the directory to write (or write) or if we want any files to be Can only read Set the file to read (read) and if you want the file to be rewritten or deleted Must grant rights to that file Can read (write) owner group public 4 read read read 2 write write write 1 execute execute execute a sample 1.  chmod 666 is set to that file Read + Write (4 + 2) 2.  chmod 777 is to specify that the

How to Improve W3C Rule

In general, if it is HTML , it is not difficult to make a website via W3C . Using Dreamweaver, it is already passed. If not, there is still an error. But if it's a script, you're dizzy, so you have to sit and do it yourself line by line What I would say here is Things that I often encounter img does not have an alt and without/before the end of the tag, especially in the first case. If we don't know what to put alt, they can put a blank value <img src = "xxx.jpg" alt = "" /> The script does not have a type. For example, <script language = "JavaScript" src = "js / function.js" type = "text / javascript"> </script> style, also must have type <link rel = "stylesheet" href = "style / style.css" type = "text / css" /> Some of the properties of the tag, such as align bgcolor. They are no longer used. In truth Must remove it all. If there is an error as soon as I st

Changing AppServ Path Directory

Usually when we install AppServ on our machine Important instructions for installation are Use the given value in the program as the best, which will allow us to The directory that stores files on our device is "C:\AppServ\www" which, if we want to change this file store to another place Let us do as follows Go to Start Menu -> Programs -> AppServ -> Apache Configure Server -> Edit the Apache httpd.conf Configuration File. Clicking will open the file httpd.conf and edit it with NotePad. Let us use Replace to search and replace. "C:/AppServ/www" with the new directory name that we want. For example, "D:/www", every character is assigned to the new directory "D:\www" After that, save the file to the same name and then restart the Apache is complete. Now that we have a new directory that holds our files as "D:\www" as needed, let us put the index.php file into this directory. And then test by typing http://l

Config MySQL Server

MySQL is at the heart of another Web Server. Because MySQL is a source of information that can be used quickly. Today I will take the experience of Config MySQL to read. Beginning with PHP Compile to support MySQL. Usually, Compile PHP supports MySQL with --with-mysql. This method will use the MySQL Lib Client Bundle with PHP, which is the old version. There is also a new extension called MySQLi. If using MySQLi will not You can use the MySQL Lib Client that Bungle comes with. It will be a hit, so to start, I'd recommend Compile PHP as well --with-mysql = / usr / local / mysql (or if mysql is somewhere else, use a different path). For ease of use, Thai language is usually setup in my.cnf that default-character-set = tis620. This method will cause MySQL to run around 20 - 30% slower, but that's fine. Because anyway I have to use Thai already After putting the statement that default-character-set = tis620 into my.cnf, then I get the MySQL Client. It's a must