apple-touch-icon-144x144-precomposed

How to install LAMP on Ubuntu

1. Install Apache
To install Apache you must install the Metapackage apache2. This can be done by searching for and installing in the Software Centre, or by running the following command.

sudo apt-get install apache2

2. Install MySQL
To install MySQL you must install the Metapackage mysql-server. This can be done by searching for and installing in the Software Centre, or by running the following command.

sudo apt-get install mysql-server

3. Install PHP
To install PHP you must install the Metapackages php5 and libapache2-mod-php5. This can be done by searching for and installing in the Software Centre, or by running the following command.

sudo apt-get install php5 libapache2-mod-php5

4. Restart Server
Your server should restart Apache automatically after the installation of both MySQL and PHP. If it doesn’t, execute this command.

sudo /etc/init.d/apache2 restart

5. Check Apache
Open a web browser and navigate to http://localhost/. You should see a message saying It works!

6. Check PHP

You can check your PHP by executing any PHP file from within /var/www/. Alternatively you can execute the following command, which will make PHP run the code without the need for creating a file .

php -r 'echo "\n\nYour PHP installation is working fine.\n\n\n";'

Congratulations, you have just Installed a Ubuntu LAMP Server!

Command line force reboot / restart windows

Force reboot / restart Windows XP

shutdown -r -t 0

This will restart computer immediate in quiet mode (not showing any pop-up).


Windows 7/8/8.1/10

Here’s how to do the shutdown functions via a batch file:

  • shutdown -r — restarts
  • shutdown -s — shutdown
  • shutdown -l — logoff
  • shutdown -t xx — where xx is number of seconds to wait till shutdown / restart / logoff
  • shutdown -i — gives you a dialog box to fill in what function you want to use
  • shutdown -a — aborts the previous shutdown command….very handy!
  • shutdown -h — hibernate. Easy mistake – it’s not for help

Additional options:

  • -f — force the selected action

 

sql-option-a

How to Check Table Size (KB/MB) in Sql Server 2014

SELECT 
    t.NAME AS TableName,
    s.Name AS SchemaName,
    p.rows AS RowCounts,
    SUM(a.total_pages) * 8 AS TotalSpaceKB, 
    SUM(a.used_pages) * 8 AS UsedSpaceKB, 
    (SUM(a.total_pages) - SUM(a.used_pages)) * 8 AS UnusedSpaceKB,
    (SUM(a.total_pages) * 8)/1024 AS TotalSpaceMB, 
    (SUM(a.used_pages) * 8)/1024 AS UsedSpaceMB, 
    ((SUM(a.total_pages) - SUM(a.used_pages)) * 8)/1024 AS UnusedSpaceMB
FROM sys.tables t 
INNER JOIN sys.indexes i ON t.OBJECT_ID = i.object_id 
INNER JOIN sys.partitions p ON i.object_id = p.OBJECT_ID AND i.index_id = p.index_id 
INNER JOIN sys.allocation_units a ON p.partition_id = a.container_id 
LEFT OUTER JOIN sys.schemas s ON t.schema_id = s.schema_id 
WHERE t.NAME NOT LIKE 'dt%' 
    AND t.is_ms_shipped = 0 
    AND i.OBJECT_ID > 255 
GROUP BY t.Name, s.Name, p.Rows 
ORDER BY t.Name