.

Saturday, July 3, 2021

Showing screenfetch and install date on Manjaro

Here is the code:
screenfetch
head -n1 /var/log/pacman.log |awk -F '[' '{printf "                                  \033[1;32mINSTALL DATE :\033[0m [" $2}'
echo ' ' 
 

Reff:

https://ostechnix.com/find-exact-installation-date-time-linux-os/

https://stackoverflow.com/questions/5947742/how-to-change-the-output-color-of-echo-in-linux

Wednesday, June 17, 2020

Internet connection sharing di Linux pakai network connection manager (GUI)

Ini tulisan refresh aja, soalnya saya cari catatan saya kok gak ada, jadi cara bikin internet sharing ke ethernet itu seperti ini langkah-langkahnya:

Jalankan nm-connection-editor dari terminal atau dari edit connection di applet network manager, lalu ikuti langkah selanjutnya....





















udah...gitu aja :D


Saturday, May 9, 2020

Running HarbourMiniGUI (HMG Extended v20.04) on Linux with wine 5.7

I'm using Harbour MiniGUI Extended Edition to develop some applications, previously using HMG 19, and now trying to update to HMG 20.04.

Download current version here http://hmgextended.com/files/CONTRIB/hmg-20.04-setup.exe, and just directly click the exe file to start installation.

The problem with current version of HMG is, the BCC compiler supported only BCC version 5.8, my BCC installed in my computer still using BCC 5.5. So I need to download and install BCC 5.8.

Next, download free BCC 5.8 from the website http://hmgextended.com/files/MISC/bcc582.zip, you need to extract it to c:\borland\bcc58 folder, on Linux drive C folder is on your WINEPREFIX folder, the default is on ~/.wine/drive_c/, except you change the WINEPREFIX when first install Wine.

Try compile simple application in samples folder, I choose /MiniGUI/SAMPLES/BASIC/AlertBoxes

My first attempt :


I got error LM282 and LM350 and not producing an exe output file, after do some search on the internet, I got the solution from here https://stackoverflow.com/questions/28929516/how-to-fix-lme288-unknown-heap-name-warning, I need to modify ilink32.exe to support large memory address on 64-bit system, so I run the command from that reference;

c:\masm32\bin\editbin /LARGEADDRESSAWARE ilink32.exe

Here is the screenshot, you need to press ENTER after run the command


Now, lets try recompiling the samples again,


 Yay...success...there were no error messages appeared, and exe file directly generated and executed.


Happy coding ;)





 

Friday, April 3, 2020

Running PHP56 web based script on PHP7 environment on Nethserver

I need to run my old PHP script on my server, but this conflict with other web that only run on PHP7x, so I need to add special folder into PHP7 environment, below are how to do this.

First, you must install PHP-SCL from this reference https://wiki.nethserver.org/doku.php?id=php-scl

Edit and add following lines at the end of the file /etc/httpd/conf.d/php.conf :


ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
AddHandler php56-fcgi .php
Action php56-fcgi /cgi-bin/php56.fcgi

<Directory /var/www/html/php56>
 DirectoryIndex index.php
 AllowOverride all
 Require all granted
</Directory>


Create file /var/www/cgi-bin/php56.fcgi with following contents:

#!/bin/bash
exec /bin/php56-cgi 

Set executable on the script:

sudo chmod 755 /var/www/cgi-bin/php56.fcgi

ok, now restart php72 

systemctl restart php72-php-fpm

Now add this lines into .htaccess in folder /var/www/html/php56


<FilesMatch "\.(php4|php5|php7|php3|php2|php|phtml)$">
SetHandler php56-fcgi
</FilesMatch>


Thats it, now all php files under /var/www/html/php56 will be run as php56 environtment.



References :
https://wiki.nethserver.org/doku.php?id=php-scl
https://www.tuxtips.net/how-to-run-multiple-php-versions-with-apache-on-centos-7-linux/

Thursday, October 10, 2019

Contoh Script Octave untuk ambil snapshot photo dari webcam

%% In file 'imageViewer.m'
function imageViewer ()
  MainFrm = figure ( ...
    'position', [100, 100, 250, 350]); 

  TitleFrm = axes ( ... 
    'position', [0, 0.8, 1, 0.2], ... 
    'color',    [0.9, 0.95, 1], ...
    'xtick',    [], ... 
    'ytick',    [], ...  
    'xlim',     [0, 1], ... 
    'ylim',     [0, 1] );

  Title = text (0.05, 0.5, 'Computer Vision', 'fontsize', 30);

  ImgFrm = axes ( ...
    'position', [0, 0.2, 1, 0.6], ... 
    'xtick',    [], ... 
    'ytick',    [], ...
    'xlim',     [0, 1], ... 
    'ylim',     [0, 1]);

  ButtonFrm = uicontrol (MainFrm, ...
    'style',    'pushbutton', ... 
    'string',   'GET IMAGE', ...
    'units',    'normalized', ...
    'position', [0, 0, 1, 0.2], ...
    'callback', { @previewImage, ImgFrm });
end

%% callback subfunction (in same file)
function previewImage (hObject, eventdata, ImageFrame)
  pkg load image-acquisition;
  cam=videoinput("v4l2", "/dev/video0");
  set(cam, "VideoFormat", "RGB3");
  set(cam, "VideoResolution", [320 240]);
  start(cam,2);
  preview(cam);
  stop(cam);
  start(cam,2);
  img = getsnapshot(cam);  
  %Img = imread (fullfile(fpath, fname));
  axes(ImageFrame);
  imshow(img, []);
  axis image off
  stop(cam);
end





ref:
http://wiki.octave.org/Uicontrols
https://wiki.octave.org/Image_acquisition_package


Tuesday, September 10, 2019

Shortcut untuk Cardo Pactalk Bold (Bahasa Indonesia)

Iseng-iseng bikin manual buat user pactalk yang males baca yang versi bahasa Inggris, silahkan download disini https://drive.google.com/drive/folders/1M06gdwqrdzWDp2bcRJqIOv2GhAL2--uV?usp=sharing , kalau ada update, saya upload ke folder situ juga.


Thursday, January 31, 2019

Menambah fungsi statistik di Sqlite

Sedang ada kerjaan yang butuh pakai beberapa fungsi statistik macam standar deviasi, median dan yang sejenis, setelah search si mbah, dapat informasi bahwa ada halaman kontribusi di website sqlitenya yaitu disini:

https://www.sqlite.org/contrib

Ada di baris paling akhir:

extension-functions.c (50.96 KB) contributed by Liam Healy on 2010-02-06 15:45:07
Provide mathematical and string extension functions for SQL queries using the loadable extensions mechanism. Math: acos, asin, atan, atn2, atan2, acosh, asinh, atanh, difference, degrees, radians, cos, sin, tan, cot, cosh, sinh, tanh, coth, exp, log, log10, power, sign, sqrt, square, ceil, floor, pi. String: replicate, charindex, leftstr, rightstr, ltrim, rtrim, trim, replace, reverse, proper, padl, padr, padc, strfilter. Aggregate: stdev, variance, mode, median, lower_quartile, upper_quartile.
Nah cara untuk kompilasinya saya dapat dari blog sini http://kedeligdata.blogspot.com/2010/09/sqlite-with-stdev-standard-deviation.html

Jadi tinggal download aja file extension-functions.c  lalu compile di Manjaro Linux saya pakai perintah:

gcc -fPIC  -lm -shared extension-functions.c -o libsqlitefunctions.so

Selanjutnya akan muncul file libsqlitefunctions.so, nah tinggal di test aja:

SELECT load_extension("/home/iipx/project/surveymeter/nganjuk/dashboard/libsqlitefunctions.so");
SELECT stdev(ar04) FROM demografi_DM_AR 



Sepertinya fungsi berjalan dengan baik :)



Showing screenfetch and install date on Manjaro

Here is the code: screenfetch head -n1 /var/log/pacman.log |awk -F '[' '{printf " \033[1...