Display corrupted in Linux mint (Cinnamon/AMD)

I love mint, but it keeps messing up my display drivers whenever i do a mass update.

If an update has corrupted your display drivers you may have to do two three things:

  1. reset to default drivers
  2. uninstall any previous drivers
  3. install the new proprietary drivers

So here we go:

Step 1. Reset to default drivers:

  1. Press ctrl+alt+F2 to open a terminal and login:
  2. sudo /etc/init.d/mdm stop
  3. sudo apt-get purge fglrx*
  4. sudo apt-get install --reinstall xserver-xorg-core libgl1-mesa-glx:i386 libgl1-mesa-dri:i386 libgl1-mesa-glx:amd64 libgl1-mesa-dri:amd64
  5. sudo dpkg-reconfigure xserver-xorg
  6. sudo reboot

You have to reboot at this point.

reference: https://forums.linuxmint.com/viewtopic.php?t=199556

Step 2: Remove previous drivers:

sudo sh /usr/share/ati/fglrx-uninstall.sh –force

Step 3: Install latest version of AMD drivers

  1. Download latest drivers from AMD official site
  2. unzip
  3. navigate to that directory
  4. sudo apt-get install cdbs dh-make dkms execstack dh-modaliases linux-headers-generic libqtgui4 xserver-xorg-dev debhelper lib32gcc1
  5. chmod +x amd-driver-installer-15.302-x86.x86_64.run
  6. sudo ./amd-driver-installer-15.302-x86.x86_64.run
  7. sudo amdconfig –initial -f
  8. sudo reboot

You have to reboot at this point.

reference: https://mintguide.org/system/461-install-latest-amd-catalyst-driver-into-linux-mint.html

 

Advertisements

Install latest Qt to Ubuntu

  1. sudo mkdir opt/Qt Β  Β  Β  Β  (notice Q has to be uppercase)
  2. Download open source Qt run file from official site
  3. execute .run file
  4. install at opt/Qt

Have more than 1 versions of qt?

sudo update-alternatives –install /usr/bin/qmake qmake /opt/Qt/ 10

Repeat for each version but with a different number.

To select which version to use as default, run:

sudo update-alternatives –config qmake

references:

http://jpnurmi.kapsi.fi/blog/2008/03/16/how-to-switch-qt-version-in-ubuntu/

Distance between point and rectangular box without case logic

Assuming you have a point (x,y) and a rectangle parallel to x and y axis defined by its upper left and lower right corner. How can we calculate its distance without using case logic?

P = (x,y)
A = { (x1,y1), (x2,y2) }

The answer is:

dx = max(A.x1 - p.x, 0, p.x - A.x2)
dy = max(A.y1 - p.y, 0, p.y - A.y2)
distance = sqrt(dx*dx + dy*dy)

Its very tricky.

Here is a great analysis here by MultiRRomero:

http://stackoverflow.com/questions/5254838/calculating-distance-between-a-point-and-a-rectangular-box-nearest-point

Determine if two rectangles intersect without case logic

Assuming you have two rectangles A and B that exist parallel to the x and y axis and are defined by their upper left (x1,x2) and lower right corners (x2,y2). How can you calculate if A and B intersect without using case logic?

A = { (x1,y1), (x2,y2) }
B = { (x1,y1), (x2,y2) }

 

intersect

 

The answer is:

if (A.x1 < B.x2 && 
    A.x2 > B.x1 &&  
    A.y1 < B.y2 && 
    A.y2 > B.y1) {
  then A and B intersect
}

There is a great analysis here:

http://stackoverflow.com/questions/306316/determine-if-two-rectangles-overlap-each-other

And an awesome interactive visualization by Matthew Crumley here:

https://silentmatt.com/rectangle-intersection/

Git Setup instructions

Setup your account and your project:

  1. Create a google account
  2. Use that account to login to gitlab.com
  3. Create a new project
  4. Note the URL of the project displayed by gitlab.
  5. Optionally add members (other users) to that project as developers

Install git client to a linux (debian) machine:

  1. sudo apt-get install xclip
  2. sudo apt-get install git
  3. ssh-keygen -t rsa -C “blabla@hohomail.com”
  4. xclip -sel clip < ~/.ssh/id_rsa.pub

Step 3 has created a public and a private key to the computer to be used from SSH. The paths are:

  • private key file: ~/.ssh/id_rsa
  • public key file: ~/.ssh/id_rsa.pub

Step 4 has copied the public key to clipboard buffer. You have to login to gitlab and paste that key to your profile’s SSH keys.

Configure GIT global variables:

  1. git config –global user.name “John Doe”
  2. git config –global user.email “blabla@hohomail.com”

Now you are ready to either create a new repository or clone an existing one:

To create a new repository:

  1. git init
  2. git remote add origin git@gitlab.com:blabla/projectsth.git
  3. git add .
  4. git commit -m “blabla comment”
  5. git push -u origin master

To clone an existing one:

  1. git clone git@gitlab.com:blabla/projectsth.git
  2. touch newfile
  3. git add newfile
  4. git commit -m “blabla comment”
  5. git push -u origin master

Pet nutrition

From catster you have a handy estimation:

For wet food:

  • 3 ounce = 85gr = 125 calories
  • 6 ounce = 170gr = 250 calories

For dry food:

  • 1 cup = 300 calories

Here are some sites with important information on pet diet:

Calculator for calories per 100g of dry food:

http://fnae.org/carbcalorie.html

Cat nutrition table from animalmedicalcenter:

http://www.animalmedicalcenterofchicago.com/pdf/CalorieRequirementsForCats.pdf

Best daily calorie calculator site for cats and dogs:

http://petnutritionalliance.org/calculator/cat.php

http://www.petplace.com/article/cats/keeping-your-cat-healthy/feeding-nutrition/how-to-calculate-your-cats-daily-calorie-intake

Advices for cat nutrition:

http://www.2ndchance.info/catfood.htm

http://www.catster.com/cat-food/how-much-should-i-feed-my-cat

Another calculator

http://petsci.co.uk/feline-calorie-calculator/

 

Personal portal to the Internet