Labels

Android (1) bash (2) boost (2) C (34) C++ (2) cheatsheet (2) CLion (6) css (3) Debian (33) DL (17) Docker (1) Dreamweaver (2) Eclipse (3) fail2ban (4) git (5) GitHub (4) Hacking (3) html (8) http (1) iOS (1) iPad (1) IRC (1) Java (30) javascript (3) Linux (164) Mac (19) Machine Learning (1) mySQL (47) Netbeans (4) Networking (1) Nexus (1) OpenVMS (6) Oracle (1) Pandas (3) php (16) Postgresql (8) Python (9) raid (1) RedHat (14) Samba (2) Slackware (45) SQL (14) svn (1) tar (1) ThinkPad (1) Virtualbox (3) Visual Basic (1) Visual Studio (1) Windows (2)

Friday 26 June 2020

C++ Boost Libraries

Usage examples of the c++ boost libraries

C++ Header file template

C++ Header file template (including a guard)



#ifndef HEADERNAME_H_
#define HEADERNAME_H_

// CONTENT

#endif

The above basically ensures that only one instance of a definition is loaded or defined.

A basic C++ file with a header

What follows is a basic C++ file with a Header file


 -- taken from https://www.learncpp.com/cpp-tutorial/header-files/ --


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

How to add Eclipse software repository to RedHat Core Ready Studio

RedHat Code Ready Studio is just a customised Eclipse but there may be reasons for wishing to use this as opposed to Eclipse itself, which as it happens can also have the RedHat stuff added to, termed "Bring your won Eclipse":

https://access.redhat.com/documentation/en-us/red_hat_codeready_studio/12.12/html/installation_guide/assembly_installing-devstudio-in-eclipse

Thursday 4 June 2020

How to boot into macOS Recovery and optionally erase the disk

The following can be used to reboot into recovery;


Command (⌘) + R
Reinstall the latest macOS that was installed on your Mac (recommended).

Option + ⌘ + R
Upgrade to the latest macOS that is compatible with your Mac.

Shift + Option + Command (⌘) +  R
Reinstall the macOS that came with your Mac, or the closest version still available.

To optionally erase the disk;


Choose View > Show All Devices and then choose the top drive, the system drive and choose erase.
Note: Its worth copying the drive name as we can use it to name the newly formatted drive, if that's your thing.

Reference here and here for recover options.

Wednesday 3 June 2020

SCS upgrade to support usb mouse and keyboard.

This document is/was written retrospectively and exists to document the changes made to the SCS Linux computer during the upgrade to support USB keyboard and mouse. This was successfully tested in Glasgow and at the time of writing, will can be rolled out to all other depots.


1- BACKGROUND.

1b- NOTES AND FILES.


2- PROCEDURE TO UPGRADE SCS USING CONFIGURED KERNEL (HEISENBERG).


3- STEPS TO SWITCH FROM PS2 TO USB.


4- STEPS TO SWITCH FROM USB TO PS2.


5- PROCEDURE TO REVERSE UPGRADE.


6- PROCEDURE TO CREATE HEISENBERG KERNEL.


7- LINKS.


LAST UPDATED: 29 July 2020

Tuesday 2 June 2020

Some quick comparisons between black and while box testing.

Black Box Testing:


  1. Requires No knowledge of the internal structure of program or application.
  2. Requires No programming knowledge required.
  3. The main goal is to test the behaviour of the software or application.
  4. Focused on the external or end-user perspective.
  5. Generally provide less detailed reports.
  6. Not time consuming.

White Box Testing:


  1. Requires knowledge of the internal structure of program.
  2. Requires programming knowledge.
  3. The main goal to test the internal operations of the system.
  4. Focused on code itself, its structure, conditions, paths and branches.
  5. Generally provide the most detailed reports.
  6. Extremely time consuming.