Cinnamon Desktop on Fedora

Installing Cinnamon desktop on fedora is very easy. You can execute the below command from your terminal.

sudo dnf install @cinnamon-desktop

How to change existing desktop

You can restart your fedora system & while signing in you can select it from a available options settings which is present alongside signin button.

You can also install other fedora Desktop,

Mate Desktop on Fedora

dnf install @mate-desktop

KDE Desktop on Fedora

 dnf install @kde-desktop

For more information about other available desktop spins you can visit here : https://spins.fedoraproject.org/

Related Posts :

Install Redis server on fedora.

Ignore file permission changes in git

If the permission of a file changes inside a git repository,  Git identifies that as a changed file even though you haven’t changed that file. For example if you change a file’s permission from 644 to 755, It will be shown as a modified file. If you don’t want this to be shown as a modified file.

Execute below command in your repository home.

git config core.fileMode false

and if you want to change it for all the git repository in your system.

git config --add --global core.filemode false

MySQL General query logs

MySQL prints each query in General query logs. This can be helpful in application profiling if you want to see how many and which queries are being run in a transaction and when commit/rollback is executed.

You can enable MySQL general query logs by running below sql command from root user:

SET GLOBAL general_log = 'ON';

By default, logs will be stored at /var/log/query.log ,  If you are getting the “permission error” after running above command.

Edit your mysqld.conf file which is located under /etc/mysql/mysql.conf.d ( This location may be different for your installation )

vi /etc/mysql/mysql.conf.d/mysqld.conf

and change the value of

general_log_file = /var/log/query.log

to

general_log_file = /var/lib/mysql/your_log_filename.log

In my case default general query log file location was /var/log/query.log & MySQL didn’t had permission to write at that location.

Credits : Chirag Jain

Increase MySQL maximum connection limit

MySQL’s default configuration sets the maximum concurrent connections to 151. If you get a too many connections error when you are trying to connect to MySQL server, this means that all available connections are in use by other clients / Users.

The number of connections permitted is controlled by the max_connections system variable. Its default value is 151, although you can it can accept a max of 152 connection (1 Connection reserved for Super User).  If you need to support more connections, you can set a larger value for this .

MySQL 3.x:

# vi /etc/my.cnf
set-variable = max_connections = 170

MySQL 4.x and 5.x:

# vi /etc/my.cnf
max_connections = 170

Restart MySQL once you’ve made the changes.

 /etc/init.d/mysqld restart 

or

 service mysqld restart 

You can also change this variable after logging into mysql server as a root user.

max conn var change
change max connections limit from mysql terminal

Find the existing limit :

show variables like ‘max_connections’;

Set the updated maximum connection limit :

SET GLOBAL max_connections = 170;

kill a running query in postgres

There are queries which takes more times to execute. Sometimes you need to stop the queries but you can’t do it simply(Ctrl+c) because queries are coming from application. There are mainly two approaches to kill the query. You can find the process corresponding to the query & kill or you can find the procpid of the query and terminate it from PostgreSQL console. Former approach may not be a great idea cause PostgreSQL thinks there is a crash in the system & restarts the whole PostgreSQL database. for the later approach you need to do the following steps. Get the Status of the running queries. To get the details about all the running on the PostgreSQL,  please execute below query.

SELECT * FROM pg_stat_activity;

or

SELECT procpid,current_query from pg_stat_activity;

Get procid of the query you want to kill / Stop. Stop the query by below query:

SELECT pg_cancel_backend(procpid);

Kill the database connection by below query:

SELECT pg_terminate_backend(procpid);

Django – AttributeError: ‘Http404’ object has no attribute ‘status_code’

If you getting this error, it might be because you are returning Http404 instead of raising it.
you need to raise django.http.Http404, not return it.

example code :

from django.http import Http404

def my_view(request):
    try:
        my_object = MyModel.objects.get(pk=1)
    except MyModel.DoesNotExist:
        raise Http404