raspberry touch 7 inch rotate 90

if you want to rotate the display of your raspberry 7 inch touchscreen (with latest raspian) you need to do the following

  • install xinput sudo apt-get install xinput
  • get the name of your display xinput --list
  • flip your display xinput --set-prop 'FT5406 memory based driver' 'Coordinate Transformation Matrix' 0 -1 1 1 0 0 0 0 1
  • add flipping to /boot/config.txt display_rotate=1 (for 90 degrees)
  • reboot


postgresql refresh function

if you have postgresql view that needs to be refreshed immediately after the parent model has changed you need to define a function and a trigger to do so.

the function:
create or replace function refresh_model_view()
returns trigger language plpgsql
as $$
refresh materialized view model;
return null;
end $$;

the trigger
create trigger refresh_model_view_trigger
after insert or update or delete or truncate
on parent_model for each statement
execute procedure refresh_model_view();