Labels

Android (1) Apache (1) bash (2) boost (2) C (37) C++ (5) cheatsheet (2) CLion (6) css (3) Debian (35) DL (17) dns (1) Docker (3) Dreamweaver (2) Eclipse (3) fail2ban (5) git (6) GitHub (5) Hacking (4) html (8) http (1) iOS (1) iPad (1) IRC (1) Java (34) javascript (3) Linux (186) Mac (22) Machine Learning (1) mySQL (54) Netbeans (7) Networking (1) Nexus (1) OpenVMS (6) Oracle (5) Pandas (3) php (17) Postgresql (8) Python (9) raid (1) RedHat (15) Samba (3) Slackware (54) SQL (14) ssh (1) svn (1) tar (1) ThinkPad (1) Virtualbox (4) Visual Basic (2) Visual Studio (1) Windows (8) wire (1)

Sunday, 21 June 2020

Makefile basics

The basis of a simple Makefile

# Define source filename here:
SRC = main.cpp 

# Define output filename here:
OP = test.o

# Define compiler here:
CC = g++

# Define flags here:
CFLAGS = -o

program:
@echo "Building binary: "$(OP)
$(CC) $(CFLAGS) $(OP) $(SRC)

clean:
@echo "Removing binary:"$(OP)
rm $(OP)


Thursday, 18 June 2020

Path bug with Debian as root.

I noticed a bug in Debian 10.4 https://www.debian.org/News/2020/20200509 where certain commands are not in the root path by default.

Example;
adduser which is in /usr/sbin and as root adducer is not found.

Of course you can do /usr/sbin/adduser but which kind of looney would be wanting to do that.

The above can be seen when doing su and doing su - gets around it without modifying anything.



How to find the Hostname and Domain name on Mac or Linux

To find the hostname on a Mac, simply do as one would on a Linux box;

hostname

To find the domain name on a Mac, we can do as we would on a Linux box also;

cat /etc/resolv.conf

The following may also help on a Mac;

scutil --dns

It may also be worth looking under the Search Domains section;

System Preferences >> Network >> [Select NIC] >> Advanced  >> DNS

On Linux, we can also do the following;

domainname - not always set for some reason, especially on my Slackware systems.

dnsdomainname - This shows on my Slackware systems.

nisdomainname - not always set for some reason, especially on my Slackware systems.

ypdomainname - not always set for some reason, especially on my Slackware systems.


Wednesday, 10 June 2020

Useful Eclipse Java autocomplete settings

Out of the box, autocomplete for Java in Eclipse has been found to be quite, well lacking and just not right, so...

Sunday, 7 June 2020

Double tapping the space bar inserts a period or full stop on Mac

If you have a Mac and find that you are randomly seeing a full stop or period being inserted after words randomly, then it is most likely that you have the following setting enabled;


SETTINGS > KEYBOARD > TEXT

Saturday, 6 June 2020

Stored Procedures in MySQL and PostgrSQL

The following will create a storied procedure called getPercentage() with MySQL

DELIMITER $$

CREATE PROCEDURE getPercentage()
BEGIN   SELECT (COUNT(fault_resolved)/ count(id)*100)AS percent
    FROM log;
END$$
DELIMITER ;

Note:  The DELIMITER $$ exists to change the delimiter used, which is normally ;
This means we can have our statement inside and using a ; but will not be seen as the end of the statement.

This can be called by

CALL getPercentage();

Examples of basic C++ Header and class files.

Example of basic Header and class files