Thursday, November 26, 2015

How do you access MariaDB in XAMPP?

We have seen that MariaDB is an off spring of MySQL and when we launch (as administrator) XAMPP from its shortcut shown here:

 
XAMPP-Maria01.png

What we see displayed is the following (it is assumed any service running is stopped and the bottom pane is cleared):
 
XAMPP-Maria01.png

Click Start for MySQL and it is already running as shown here:

 
XAMPP-Maria03.png

MySQL is running on Port 3306.
Click on Shell.

The XAMPP prompt is displayed with the following message.
---
Setting environment for using XAMPP for Windows.
Jayaram@HODENTEK8 c:\j
#

----------------
When you enter mysql as shown you get the MariaDB prompt as shown
 
XAMPP-Maria04.png

MariaDB syntax is very similar to MySQL syntax as for as its usage is concerned.
Alternately you can do the same from the install directory as shown here:
-----------
Microsoft Windows [Version 10.0.10240]
(c) 2015 Microsoft Corporation. All rights reserved.

C:\Users\Jayaram>cd\

C:\>cd C:\J\mysql\bin

C:\J\mysql\bin>dir mysql*
 Volume in drive C is TI10672700E
 Volume Serial Number is 16FB-D230

 Directory of C:\J\mysql\bin

10/14/2015  10:44 PM         3,571,528 mysql.exe
10/14/2015  10:45 PM         3,517,768 mysqladmin.exe
10/14/2015  10:45 PM         3,595,080 mysqlbinlog.exe
10/14/2015  10:44 PM         3,515,208 mysqlcheck.exe
10/14/2015  10:45 PM        11,527,496 mysqld.exe
10/14/2015  10:44 PM         3,568,456 mysqldump.exe
10/14/2015  10:16 PM             8,385 mysqldumpslow.pl
10/14/2015  10:16 PM            25,817 mysqld_multi.pl
10/14/2015  10:16 PM            36,102 mysqlhotcopy.pl
10/14/2015  10:45 PM         3,506,504 mysqlimport.exe
10/14/2015  10:45 PM         3,507,528 mysqlshow.exe
10/14/2015  10:45 PM         3,525,448 mysqlslap.exe
10/14/2015  10:44 PM         3,916,616 mysqltest.exe
10/14/2015  10:48 PM         9,949,000 mysqltest_embedded.exe
10/14/2015  10:38 PM         3,899,392 mysql_client_test.exe
10/14/2015  10:48 PM        10,124,104 mysql_client_test_embedded.exe
10/14/2015  10:16 PM             8,799 mysql_config.pl
10/14/2015  10:16 PM             4,417 mysql_convert_table_format.pl
10/14/2015  10:48 PM         9,804,104 mysql_embedded.exe
10/14/2015  10:46 PM         3,735,368 mysql_install_db.exe
10/14/2015  10:45 PM         3,119,944 mysql_plugin.exe
10/14/2015  10:16 PM             9,565 mysql_secure_installation.pl
10/14/2015  10:46 PM         3,124,040 mysql_tzinfo_to_sql.exe
10/14/2015  10:45 PM         3,178,824 mysql_upgrade.exe
10/14/2015  10:46 PM         3,109,192 mysql_upgrade_service.exe
10/14/2015  10:57 PM         1,750,344 mysql_upgrade_wizard.exe
              26 File(s)     95,639,029 bytes
               0 Dir(s)  797,801,631,744 bytes free

C:\J\mysql\bin>mysql
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 4
Server version: 10.1.8-MariaDB mariadb.org binary distribution

Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Typ
e '\c' to clear the current input statement.

----------------------------------------------------
You can also get to the administrator using the mysqladmin.exe as shown here (truncated portion):
 
XAMPP-Maria05.png

For MariaDB server find contents as shown here:

XAMPP-Maria06.png

MariaDB has good documentation. Here is the help on Utility | Use:
-----------------------------------------
MariaDB [(none)]> help Utility
You asked for help about help category: "Utility"
For more information, type 'help ', where is one of the following
topics:
   EXPLAIN
   HELP STATEMENT
   USE

MariaDB [(none)]> help USE
Name: 'USE'
Description:
Syntax:
USE db_name

The USE db_name statement tells MySQL to use the db_name database as
the default (current) database for subsequent statements. The database
remains the default until the end of the session or another USE
statement is issued:

USE db1;
SELECT COUNT(*) FROM mytable;   # selects from db1.mytable
USE db2;
SELECT COUNT(*) FROM mytable;   # selects from db2.mytable


Here are some queries run on this version:

 MariaDB Version
------------
MariaDB [(none)]> Select Version(), CURRENT_DATE;
+----------------+--------------+
| Version()      | CURRENT_DATE |
+----------------+--------------+
| 10.1.8-MariaDB | 2015-11-26   |
+----------------+--------------+
1 row in set (0.04 sec)

MariaDB [(none)]>

---------------------
 Find User interactively
---------
Find the USER() (this is interactively run)
----------------
MariaDB [(none)]> SELECT
    -> USER()
    -> ,
    -> CURRENT_DATE;
+----------------+--------------+
| USER()         | CURRENT_DATE |
+----------------+--------------+
| ODBC@localhost | 2015-11-26   |
+----------------+--------------+
1 row in set (0.00 sec)

MariaDB [(none)]>

--------------------
There are only two bases in the installation.
Show databases
-----------
MariaDB [(none)]> show databases
    -> ;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| test               |
+--------------------+
2 rows in set (0.08 sec)

MariaDB [(none)]>



How do you run a simple query in HeidiSQL?

It is really no different from running a query in SQL Server Management Studio. You need to have an instance of SQL Server running on your computer. Launch HeidiSQL and get connected to the instance.

You will be seeing this (different in your case) displayed in the HeidiSQL user interface. Either you can get connected to a session you created or a new one using the New button at the bottom of the UI.
 
RunAQuery01.png

You can connect to a single database by selecting it from the list as shown. Here Northwind was selected.

RunAQuery02.png
The Nov21 sessions gets changed and the changed sessions window opens as shown:


RunAQuery03.png

Click on Query to open a window for inserting query related statements as shown:
RunAQuery04.png

In the Query Window insert your SQL statement. For example a query such as the one shown:

SELECT TOP 50 [CategoryName]
      ,[ProductName]
      ,[ProductSales]
  FROM [Northwind].[dbo].[Product Sales for 1997]


 

Click Query and the response will appear below the query window as shown.

 
RunAQuery07.png

The tabbed window in the center has all the necessary tabs like the SAP SQLAnywhere Studio Central.

Wednesday, November 25, 2015

What is an uniqueidentifier?

 Unique Identifiers are used in many places, SQL Server's data type; as GUID in ActiveX Controls, and as a 128 bit IP address in IPV6 although it is not called GUID. Using 128 bits for the IP address makes it possible to assign a whole lot more addresses than IPV4.

Uniqueidentifiers are also called GUIDs(Globally Unique Identifier) which are unique and different from any other. It was introduced in SQL Server 7.0. The GUID is obtained by the function call NewID()or as a hexadecimal formatted string. The unique identifier data type is stored in the computer as a 16-byte (128 bits) binary value. The formatted GUID using Hexadecimal is usually a string represented by groups separated by hyphens:
4bytes-2bytes-2bytes-2bytes-6bytes
Here is how the uniqueidentifier obtained by calling the NewID() function.
---
Declare @myid uniqueidentifier
set @myid=NEWID()

---
A uniqueidentifier is obtained every time this function is called as shown here:



While it is great for security, it takes up too much space (think of millions of rows with a uniqueidentifier data type column).

More about uniqueidentifier in SQL Servers here.

Saturday, November 21, 2015

How do you connect to SQL Server 2012 using HeidiSQL?

 HeidiSQL is a client application and you can use it to work with databases. If you want to know more about it, or download and install HeidiSQL go here.

Launch HeidiSQL from your desktop or click the HeidiSQL app from the All Apps menu shown.



The Heidi Session Manager is launched as shown.

 
Heidi_Session_00.png

Click New and choose Session in root folder from the drop-down list as shown.


Heidi_Session_01.png

You can change the session name by over-writing as shown. Herein it is Nov21.

Heidi_Session_02.png

By default the connection is to MySQL using TCP/IP and localhost(127.0.0.1)

Let us change the Network type to Microsoft SQL Server using TCP/IP by using the drop-down menu shown.

Heidi_Session_03.png

Choose Windows authentication as shown.

Heidi_Session_04.png

Click Open. The connection is refused.

 Heidi_Session_05.png

OK. Let us look if the SQL Server has started. Open the Control Panel|...|Services and verify that the server has started. Indeed it is running (option chosen at SQL Server Installation).


Heidi_Session_06.png

Now let us change the Hostname /IP to Hodentek8\RegencyPark (over write 127.0.0.1)
Click Open after changing the hostname.
 You may get a save modifications message.

 
Heidi_Session_07.png


Click Yes. The program processes this information and the client is now connected to the named instance of SQL Server 2012 as shown.


Heidi_Session_08.png

Now you are cooking!




What is HeidiSQL?

It is a client tool used by web developers for working with MySQL Server, Microsoft SQL databases and PostgreSQL. It is free, Open Source since 9 years of active development and very useful.

What all HeidiSQL can do?

HeidiSQL which is a client application can carry out a lot of data related tasks:
•Connect to multiple servers in one window
•Connect to servers via command line
•Connect via SSH tunnel, or pass SSL settings
•Create and edit tables, views, stored routines, triggers and scheduled events.
•Generate nice SQL-exports, compress these afterwards, or put them on the clipboard.
•Export from one server/database directly to another server/database
•Manage user-privileges
•Import text-files
•Export table rows as CSV, HTML, XML, SQL, LaTeX, Wiki Markup and PHP Array
•Browse and edit table-data using a comfortable grid
•Bulk edit tables (move to db, change engine, collation etc.)
•Batch-insert ascii or binary files into tables
•Write queries with customizable syntax-highlighting and code-completion
•Pretty reformat disordered SQL
•Monitor and kill client-processes
•Find specific text in all tables of all databases of one server
•Optimize and repair tables in a batch manner
•Launch a parallel mysql.exe command line window using your current connection settings

Where do you install HeidiSQL?

Download the HeidiSQL 9.3 Installer here. There are other options as well. Double clicking the executable begins the installation.
Here are some screen shots.



 Agree to license terms and click Next.

 Accept default folder.

Chose not to associate for now.

 Done!
 Launches HeidiSQL Session if the checkbox is checked.

 Leaves a new app on All Apps in Windows 10


It also enters the Programs and Features list in Control Panel.



Friday, November 20, 2015

What is the difference between MySQL and MariaDB?

MySQL predates MariaDB. In fact MariaDB is a fork of MySQL. MySQL was handed down from Sun Microsystems to Oracle which made it somewhat non-open source (http://hodentek.blogspot.com/2009/07/taking-table-over-to-mysql-from-ms.html) and a need for an open source version became desirable. MariaDB has found acceptance from the likes of Google(http://hodentek.blogspot.com/2013/09/mysql-is-challenged-by-its-fork.html) and others. Customers like RedHat,SUSE and WikiPedia have moved away from MySQL.

The reasons are obvious:

  • MariaDB has more storage engines then MySQL.
  • Better speed
  • Has new extensions and features
  • Better test and test suites
  • Fewer warnings and bug
  • Truly Open Source (GPL, LGPL or BSD)
  • Strong Community(https://mariadb.com/kb/en/who-is-behind-mariadb/)

Sunday, November 15, 2015

What is Bitnami?

If you want to work in Open Source, this is where you should look into.

This is a very useful site to keep in touch. It is a great resource if you want to work with Open Source stuff. Millions of developers use this site and you should too. This is great if you are trying to teach to yourself or doing some computer stuff for the non-profits. The pre-packaged apps and development environments are free to use and share.

These are some of the things you can do:
  • Running apps in production
  • Complete software development environment for your team
  • Develop locally, deploy in the cloud
  • Quickly test new apps
  • Running your business
  • Maintain parallel environments
  • Research and learn new technologies
  • Launch apps without extensive expertise
It does cover all OSs, Virtualization Platforms; and Cloud Platforms. It covers the whole universe of computer software.

The number of applications that you can get on to is really impressive. Here is a screen shot of the more popular applications.
  
Microsoft Web Platform Installer (WPI) is another similar program geared towards all the different Microsoft Technologies although WPI also offers many Open Source programs .

Here and here you have two detailed posts to get on to Microsoft Web Platform Installer.


Where can I find XAMPP download with MariaDB for Windows?

MariaDB does lot more than MySQL and it is MySQL's challenger arising out of MySQL (MariaDB is MySQL's fork). MySQL in LAMP stack has been replaced by MariaDB. The download link for XAMPP with MariaDB  is here.

The download versions are v5.5.30 and v5.6.14 (both x32bit). These versions have  the following components and they can be downloaded from here.

    Updated PHP to 5.5.30 / 5.6.14
    Updated Apache to 2.4.17
    Updated MariaDB to 10.0.17
    Updated phpMyAdmin to 4.5.0.2


Xampp_Maria.png

Friday, November 13, 2015

Can I make Cortana to understand another language in Windows 10?

She is very versatile, she can.

Well first of all this is supported in couple of countries like UK, China, France, Italy, Germany, Spain and perhaps few other countries. Let us say you travel from US to France and you want to find things there using Cortana. Then you can switch the language that Cortana understands by default (US English in USA) to French. I assume you can access Cortana on your Windows 10 Desktop, If not go here.

In Windows 10 Desktop you can open Control Panel and choose to change your language preferences.


CortanaLang_01

In the above, I have added couple of languages ( this means I have downloaded the necessary language packs) and I have also set the default as French. You can add another language by hitting the Add a Language button. You may have download the language pack.

With just this setting my Cortana settings in Windows 10 desktop is as shown.

CortanaLang_02

 Of course you cannot use it in USA and you will have to be in France.

Now I move up Japanese to the top in 'Change your language preferences'  as in the following:

CortanaLang_03

Voila! Cortana language settings has changed as well.




CortanaLang_04

You return to USA and you want to restore. It is just as easy. Just bump up English(United States) to the top (you need not restart the computer).

How about voice commands to Cortana? How about in Windows Phone? Well you will have to work with speech and speech recognition settings.

Come back again to learn, How?

Thursday, November 12, 2015

Is Cortana on Windows 10 Desktop?



 Image source: Cortana



Cortana was a sensation on Windows Phone 8.1. It is not in the All Apps group on desktop running Windows 10 OS. . If you type 'Cortana' in the 'Search the web' on your desktop running Windows 10 OS you get the following:


CortanaSearch_01

Click 'Cortana Search and Settings'(system Settings)

CortanaSearch_02

Turn OFF to ON.

Cortana welcomes you and before proceeding you need to agree to her terms.

CortanaSearch_03.png

Click I agree and she is ready at your bidding.

CortanaSearch_04.png

Before asking for license agreement she may ask to use the 'Notebook' where user items are stored. If you do not want to use 'Cortana' just turrn it off, but the Notebook items will be saved but not accessed.

These are the items that go into Notebook.

CortanaSearch_05.png
Now your 'Search the web' at the bottom of screen, it will read 'Ask me anything'

If you hit the microphone you get the following and you may need to follow her advice before she can listen to your voice commands.


Sunday, November 8, 2015

How do you open a C# compiler prompt in Windows 10?


I assume you have installed Visual Studio 2015 Community. If this is correct, when you installed Visual Studio 2015 Community you also installed VS 2015 x86 Native Tools command prompt. This will be in your Program Files(x86) directory. Just double click this and type in CSC at command prompt as shown:


Compiler0.png

You can type in the command for help and get all the related information:

Please note the next two screen shots are for yet another version of the compiler(an earlier version)

Continued