marți, 29 septembrie 2015

OpenSuSE 13.2 / Snapper / free space on ROOT

     I installed OpenSuSE 13.2 a while ago (about 5 months) and I noticed that the used space on ROOT was growing steadily. I ignored the issue until yesterday, when the free space on root was only 760 MB (from a total of 20GB).
     After searching the internet for a while, I concluded that "Snapper" was responsible for that situation.
     As far as I can tell, Snapper is a backup system, so it creates periodically "snapshots" that can be used for recovery. Since I never used it in about 3 years of LINUX, I decided that I don't need this application, and I removed it. Result? About 9 (nine) GB free on rood and a visibly faster system. I admit though that my system is no longer a "modern" one, but it's doing its job: Acer Core 2 Duo 2200 MHz, 3GB RAM, 300GB HDD.
     If you decide to remove the Snapper, the files created for recovery must also be removed, otherwise you accomplished nothing (except the fact that it will stop growing). So, before you uninstall, you must start Snapper from your program list and there you will find all of the backup files ever created, so you can delete them

luni, 21 septembrie 2015

Lazarus / FPC: sort a StringGrid

Here it is, a nice simple procedure that sorts a StringGrid. Tested an a 5000 records StringGrid, the sorting is done in about 1-2 seconds
   sg: your stringgrid
   col: column that will be sorted
   numeric: if the values in column are numbers
   asc: ascendent or descendent
   numeric: if datas are numbers

procedure sort(sg:tstringgrid;col:integer;asc:boolean=true;numeric:boolean);
var i,c:integer; numeric:boolean; f:string; r:real; negat:boolean; x1:integer; semn,s1,s2:string;
begin
  numeric:=false;
  negat:=false;


  if asc=true then sg.SortOrder:=soascending else sg.SortOrder:=sodescending;

  if numeric=false then
     sg.SortColRow(true, col, sg.FixedRows, sg.RowCount-1)
  else begin
     f:='000000000000000.00';
     c:=sg.colcount;
     sg.ColCount:=c+1;
     for i:=1 to sg.RowCount-1 do
       begin
          try r:=strtofloat(sg.Cells[col,i]) except r:=0 end;
          if r<0 then
            begin
              negat:=true;
              sg.Cells[c,i]:='-'+formatfloat(f,r);
            end else sg.Cells[c,i]:='+'+formatfloat(f,r);
       end;
     sg.SortColRow(true, c, sg.FixedRows, sg.RowCount-1);
     if negat=true then
       begin
          x1:=0;
          semn:=sg.Cells[c,0][1];
          s1:=semn; s2:=' ';
          for i:=0 to sg.RowCount-1 do
            if sg.Cells[c,0][1]<>semn then
              begin
                semn:=sg.Cells[c,0][1];
                s2:=semn;
                x1:=i;
              end;
          if s1='-' then
            begin
               if sg.SortOrder=soascending then sg.SortOrder:=sodescending else sg.SortOrder:=soascending;
               sg.SortColRow(true, c, sg.FixedRows, x1-1);
            end;
          if s2='-' then
            begin
               if sg.SortOrder=soascending then sg.SortOrder:=sodescending else sg.SortOrder:=soascending;
               sg.SortColRow(true, c, x1, sg.RowCount-1);
            end;
       end;
     sg.ColCount:=c;
  end;
end;

duminică, 20 septembrie 2015

OpenSuSE 13.2 / Quickview plasmoid

After switching to OpenSuSE 13.2 I found that a certain plasmoid is no longer available - Quickview. Finally, I found the sources and I managed to install it on my system. I also uploaded it here:


Download the archive somewhere where you can use it (Documents, for example) and unpack it (right click > Extract here). You will find a "readme " file with full instructions of how to build and install the plasmoid. Be careful about the required extra packages (kdelibs, libxonq, - devel packages and gettext package) and don't forget to restart the system. The file also contain proper credit for those who created this plasmoid - I have no contribution