September 16 2013

Remove GUI (GDM, Gnome, X Window) from CentOS

Tagged Under :

Linux
If you install a CentOS server, but accidently also installed Desktop Environment such as GDM, GNOME or X Window, you can easily remove the GUI packages and return back to Command Line (CLI).

There are two ways to do that. You can simply disable GUI or completely uninstall it. I will provide steps to do both.

Temporary Disable GUI (GDM)
Open inittab with nano
nano /etc/inittab
change
id:5:initdefault:
to
id:3:initdefault:

Remove GUI

September 16 2013

Retrieving the last record in each group

Tagged Under : ,

MySQL
Sometimes we keep all the records/logs in one table. But if we want retrieve each group last records in one SQL it look like impossible.

Below Example showed how to:
SELECT rs1.*
FROM TABLE rs1 LEFT JOIN TABLE rs2
  ON (rs1.name = rs2.name AND rs1.id < rs2.id)
WHERE rs2.id IS NULL;
Above method can get the last record results group by name.

If you want retrieve first records in each group, just change to