Labels

Android (1) bash (2) boost (2) C (34) C++ (2) cheatsheet (2) CLion (6) css (3) Debian (33) DL (17) Docker (2) Dreamweaver (2) Eclipse (3) fail2ban (4) git (5) GitHub (4) Hacking (3) html (8) http (1) iOS (1) iPad (1) IRC (1) Java (31) javascript (3) Linux (167) Mac (19) Machine Learning (1) mySQL (48) 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 (47) SQL (14) svn (1) tar (1) ThinkPad (1) Virtualbox (3) Visual Basic (1) Visual Studio (1) Windows (2)

Wednesday, 11 December 2019

Java Component tab order

To set the component tab order in a java application, specifically in Netbeans;

Wednesday, 4 December 2019

multiple JAR files signed with different certificates

REF: https://docs.oracle.com/javase/8/docs/technotes/guides/javaws/developersguide/faq.html#s213

Basically, if I have multiple jar files, some of which are signed by a different certificate, then we need to create separate jnlp files for these resources.

TLDR - Signing each jar with the same certificate, seems to work, regardless if it has been signed before.

Sunday, 1 December 2019

Code signing with Certum and SimplySign

What follows are my own personal notes relating to the purchase, installation and use of Code signing with Certum and SimplySign.

Sensitive or personal information has been removed from this post.


Friday, 22 November 2019

Updating java GUI components

I've had numerous problems over the years trying to update java components such as labels before carrying out other tasks and reaearch tells me that Threads are the way to do this.

see also: java-threads.html

Connect to Windows share from Linux command line.

An example of connecting to a Windows share from Linux command line;

smbclient //IP_ADDRESS/SHARE_NAME -U username

smbclient //192.168.254.198/public -U username

Then you will be promted for the password and find yourself at the smb: \> prompt.

You can then use;
ls for a listing of files
get filename to grab a file
cd folder to change directory
...etc

exit to exit


Thursday, 21 November 2019

Java Threads and populating a list in real time

Thread t = new Thread(new Runnable()
            {
                @Override
                public void run()
                {
                    //do Work here...
                }

            });
            t.start();



Java jList

To create a jList and populate it in real time;

Thursday, 14 November 2019

Setup Postgres on Slackware


TODO: Add Slackware install

with user postgres run psql

CREATE DATABASE dbname;


GRANT ALL ON DATABASE dbname TO postgres;

Wednesday, 13 November 2019

Python reading file error - 'utf-8' codec can't decode byte


 
When reading in a file and getting errors such as example:
'utf-8' codec can't decode byte 0xa3 in position 2897: invalid start byte 
 
Add errors='ignore' as per the following example: 
 with open(fname,"r", errors='ignore') as fo:
 
 

Tuesday, 5 November 2019

Saturday, 2 November 2019

Install docker on Slackware


https://slackware.pkgs.org/

quick notes

google-go-lang-1.10.2-x86_64-1_slonly.txz
tini-0.13.0_949e6fa-x86_64-1_slonly.txz
docker-proxy-20180412_c15b372-x86_64-1_slonly.txz


libseccomp-2.3.3-x86_64-1_slonly.txz
runc-1.0.0_rc5-x86_64-1_slonly.txz
containerd-1.0.3-x86_64-1_slonly.txz
docker-18.03.1-x86_64-1_slonly.txz

Revised Sep 2024

See note below.

Revisited Aug 2024

The below is related to Slackware 15 and used the sbopkg method, see here for more information about getting sbopkg up and running.

So, I set about building Docker using the following order:

which is required to satisfy dependencies.

Once google-go-lang was installed, the build or runc failed and I found my way to the solution [here]. Essentially, you should build and install google-go-lang and then log out and back in before continuing with runc.

Once the above was done, or running the shell script at /etc/profile.d/go.sh then was good to continue (note, I done this using my current user, with and without sudo and also as root. I eventually had to open a new terminal to get it to work without error).


Once complete, do;

sudo groupadd -r docker

sudo usermod -a -G docker <username>

Note: 

then you need to install docker-cli which I chose to do using sbopkg thanks to Audrius Kažukauskas for this [https://slackbuilds.org/repository/15.0/system/docker/]

In hindslight, this should be added to the above packages order, after docker itself.


References

https://slackbuilds.org/repository/15.0/system/docker/

 

Change form GPT to MBR partition types

To change from GPT to MBR partitioning type under linux;

disk /dev/sda (assuming the drive is sda)

Then use the x option (extra functionality)

then use option z to destroy GPT

Now you can use cfdisk /dev/sda as per normal and choose DOS

Tested on Slackware 14.2



Wednesday, 4 September 2019

change eth1 to eth0

After cloning a system or replacing network card or for some other reasons, I have seen eth0 missing and ifconfig only showing eth1

removing the following file and rebooting resolved;

/etc/udev/rules.d/70*

Also this file can be edited and udevadm trigger refreshes.

This may also apply to /dev/hda /dev/hdb /dev/sda /dev/sdb etc (to be verified)

Friday, 23 August 2019

mount CD on RHEL 7 Linux

run blkid to find out the correct device, example /dev/sr0

Create a mount point if it doesn't already exist.

mount /dev/sr0 /mnt/cdrom

mount /dev/cdrom /mnt/cdrom (might work)

Thursday, 22 August 2019

RHEL Network configuration

The primary network configuration files are as follows:



/etc/hosts
Resolve host names that cannot be resolved any other way, by DNA for example. 
/etc/resolv.conf
This file specifies the IP addresses of DNS servers and the search domain.
/etc/sysconfig/network
This file specifies routing and host information for all network interfaces.
/etc/sysconfig/network-scripts/ifcfg-interface-name
For each network interface, there is a corresponding interface configuration script. Each of these files provide information specific to a particular network interface.

Change Linux run level

On systemd (including RedHat) do the following;
Text Only
ln -sf /lib/systemd/system/multi-user.target /etc/systemd/system/default.target
Graphical Envirment
ln -sf /lib/systemd/system/graphical.target /etc/systemd/system/default.target
UNIX System V (including Solaris and Slackware), do the following;
Edit /etc/inittab
Look for the section Default Runlevel
and edit the line that follows (normally 3 for multiuser mode, 4 is X11 and 1 is single user mode)

Wednesday, 7 August 2019

Configure apache to run python scripts

Edit httpd.conf file to include the following;

Uncomment LoadModule
<IfModule !mpm_prefork_module>
        LoadModule cgid_module lib64/httpd/modules/mod_cgid.so
</IfModule>
<IfModule mpm_prefork_module>
        LoadModule cgi_module lib64/httpd/modules/mod_cgi.so
</IfModule>

Add ExecCGI
    Options Indexes FollowSymLinks ExecCGI

Add .py
    AddHandler cgi-script .cgi .py

Tuesday, 2 July 2019

When lilo fails to boot or there's a problem with MBR



Boot with Slackware install DVD, tested with 13.37 (only one I had to hand).


At boot prompt, follow instructions to boot existing system, something like;

huge.s root = /dev/sda1

Once system boots, we need to do the following:
Set keyboard map and login as root (no password).
cfdisk shows partitions (note root partition)

mount /dev/sda1 /mnt # where sda1 is the root partition. (discovered from cfdisk)

No need to mount any other partitions unless you need to make other changes.

The following was not needed but is documented as part of the process:

mount -o bind /dev /mnt/dev
mount -o bind /proc /mnt/proc
mount -o bind /sys /mnt/sys

chroot /mnt /bin/bash


Once in here you can edit /etc/lilo.conf
Note, in the case of SCS, location of boot bitmap needed to be changed to /boot/...

I choose to have at least 2 working kernels listed in there one at /dev/hda1 and one at /dev/sda2
this was due to the system showing current disk as sda and I knew original system showed as hda
I leave boot= flag untouched.

install lilo using lilo -b /dev/sda
and reboot, removing Slackware installation DVD


One of the kernel images should boot and then change lilo.conf back to normal and install lilo using lilo

UPDATE: 09 JULY 2021
On a 14.2 install with a failed lilo installation, I was able to follow the above but it would seem I was able to boot my system using;
huge.s root = /dev/sda1 rdinit=ro
and did not need to mount the root partition in order to make the changes, I was able to make a change to /etc/fstab.conf although in this case I didnt need to and was able to simply install lilo using lilo -b /dev/cciss/c0d0p
Additional notes, we can run fdisk -l and use that information to look in the /dev/* directory for where we should be installing lilo, in this case we have a raid setup so the usual /dev/sda wasn't going to cut it.
 

Tuesday, 25 June 2019

Linux mouse gpm

The following gets the mouse working in the console;

gpm -m /dev/input/mice -t imps2

https://www.linuxquestions.org/questions/slackware-14/setting-up-a-usb-mouse-in-slackware-401496/

put the following in rc.gpm and make bootable - chmod +x /etc/rc.d/rc.gpm

#!/bin/sh
# Start/stop the GPM mouse server:

if [ "$1" = "stop" ]; then
echo "Stopping gpm..."
gpm -k
else # assume $1 = start:
echo "Starting gpm..."
gpm -m /dev/mouse -t imps2
fi


Finally do ln -si /dev/input/mice /dev/mouse to create link
For usb /dev/mouse points to /dev/input/mice
For PS/2 /dev/mouse points to /dev/psaux


Optionally add/comment the following lines in /etc/X11/XF86Config for usb

#Option "Protocol"    "PS/2"
#Option "Device"      "/dev/psaux"
Option "Protocol" "imps/2"
Option "Device" "/dev/mouse"


Slightly related note: for keyboard, the following should be present:
#Option "XkbLayout"  "us"
Option "XkbLayout"  "uk"

Tuesday, 18 June 2019

backup and restore mysql

Backup;
mysqldump -u [username] -p [databaseName] > [filename]-$(date +%F).sql
 
Restore; 
mysql -u [username] -p [databaseName] < [filename].sql

See here for more details...

Saturday, 27 April 2019

Categorical and Continuous Variables - Nominal, Dichotomous, Ordinal, Interval, Ratio

Categorical and Continuous Variables

Categorical variables are also known as discrete or qualitative variables. Categorical variables can be further categorized as either nominalordinal or dichotomous.

Friday, 22 February 2019

Linux - remount filesystem rw

mount -o remount,rw / (might have used only w)

lilo.conf - Check boot parameter is correct /dev/sd* matches where drive is connected.
run lilo from /boot (if need be use lilo -b /dev/sd* where sda is the drive not the partition.
Check root = /dev/sd* is the correct partition

Check /etc/fstab has correct /dev/sd* entries
 

Wednesday, 23 January 2019

Normalization Normal forms

First Normal Form 1NF

No repeating columns or columns contain only a single value.


Second Normal Form 2NF

As per 1NF but each non PK value can be uniquely identified by the PK

Third Normal Form 3NF

As per 2NF but each no PK value can ONLY be identified by the PK

Comparison between SQL and Pandas

Comparison with SQL


Thursday, 10 January 2019

VirtualBox command line. Removing innaccessable VMs change machine location

To delete virtual machines from the command line, first I removed the *.vbox *.vmdk files etc (basically the folder that these files are in).

Then;
VBoxManage list vms (this lists virtual machines)
VBoxManage unregistervm ********* (where *** is the number of the VM as shown by the previous command).

To change default location of VM's
vboxmanage setproperty machinefolder /path/to/directory/
Note use path in quotation marks if folder needs a space, example;
vboxmanage setproperty machinefolder "/var/VirtualBox VMs"

Friday, 4 January 2019

Mac add Open With to Right Click menu

Add OPEN WITH to Right click menu
  1. Open Automator and select Service document type.
  2. Select Files and Folders in the top Service receives selected menu
  3. Search for and select the Open Finder Items action.
  4. Now select TextEdit in Open with:
  5. Save the service with a name you want to see in the menus
You can now find this by: 
  • Right-clicking the file > Services

Tuesday, 1 January 2019

Renaming a file to include date

To rename a file to include the date in the filename use the following:

mv myfile.txt myfile_$(date + %d-$m-%Y).txt

This can be useful when creating backup files.

A script called by cron like the below might be useful.

#!/bin/bash
rm myfile_*.tar
tar -cf myfile.tar myfile.txt && mv myfile.tar myfile_$(date + %d-$m-%Y).tar