NetCAT 11.0 

So, NetCAT 11.0 has started

Register

If you want to register, take a look here: NetCAT 11.0 Participants

Get the stuff

If you are looking for development version of NetBeans – current version is 11.0-vc1 – take a look here: Download

If you are looking for development version of NetBeans – current version is 11.0-vc2 – not yet available

You will need JVM to run things

If you are looking for preferred JVM release, take a look here: JDK 12, JDK 11

If you want to download GlassFish, make sure to check out this one: GlassFish

Are you looking towards Web based developments?

WildFly can be found here: WildFly

If you plan to test Profiler, take a look here

If you plan to use Docker based tests for FTP and Profiler, make sure to download Docker: Download Docker

Do some tests

Test specification: Tests

Reporting bugs: JIRA based tracker for NetBeans

↓↓↓↓

 

Scanning remote machines in macOS

If you have issues while testing your remote services, it’s very convenient to use Network Utility in macOS.

You can start it either using Spotlight Search (⌘-space)

or you can call it directly from CLI

> /System/Library\
/CoreServices/Applications/\
Network\ Utility.app/Contents/\
MacOS/Network\ Utility

All you have to do is to scan your target machine using Prot Scan

If you want to start port listener on Linux machine, it’s good to remember you can use nc for that purpose

> nc -l 80
↓↓↓↓

 

Quotes like this make my day ;)

So the svd and the principle components, and principle components analysis is essentially the same thing. And so if you hear, you know, you’re in a cocktail party and you hear two people talking about the svd and pca you can rest assured that they’re basically doing the same thing.

source: Exploratory Data Analysis

One is a shift pattern and the second is this kind of alternating pattern, so that’s the truth. But of course, we rarely know the truth, so we need to learn the truth from the data.

source: Exploratory Data Analysis

↓↓↓↓

 

And Now for Something Completely Different – Reputacje


↓↓↓↓

 

How do I work with development build on macOS – NetBeans 11.0

Whenever you download NetBeans 11.0 (development version) from the official page here: Download, you end up with a zip file that contains working copy of NetBeans. It looks like this

netbeans
|-- CREDITS.html
|-- DEPENDENCIES
|-- DISCLAIMER
|-- LICENSE
|-- NOTICE
|-- README.html
|-- apisupport
|-- bin
|-- enterprise
|-- ergonomics
|-- etc
|-- extide
|-- groovy
|-- harness
|-- ide
|-- java
|-- javafx
|-- licenses
|-- nb
|-- netbeans.css
|-- php
|-- platform
|-- profiler
|-- webcommon
`-- websvccommon

If you want to run it, you can make a symlink to netbeans/bin/netbeans, you can open the directory and double-click the executable file, you can put in on PATH. You have numerous options. However, macOS users (like me) are used to run everything from /Applications folder. This is why I have prepared very simple setup for my testing environment.

I have this small empty structure inside /Applications

NetBeans.app
|-- Contents
|   |-- Info.plist
|   |-- MacOS
|   `-- netbeans.content
`-- Icon\r

Info.plist is just an empty shell that is supposed to make macOS happy with application structure.

> cat Info.plist
<plist><dict></dict></plist>

More interesting part of this “wrapper” lays here MacOS/NetBeans. As you can see, I simply run whatever comes bundled inside development version of NetBeans.

> cat MacOS/NetBeans
#!/usr/bin/env bash

ABSPATH=$(cd "$(dirname "$0")"; pwd)

${ABSPATH}/../netbeans.content/bin/netbeans

All I have to do, each time new version of NetBeans is ready, is drag and drop content of zip file inside /Applications/NetBeans.app/Contents/netbeans.content. Since now, I can run NetBeans directly from /Applications folder.

If you don’t want to waste your time reinventing the wheel, you can always download “empty shell” here: Download

After you open it, just drag and drop NetBeans inside /Application. Then, make sure to right click it and choose: Show Package Contents. Navigate to Contents -> netbeans.contents. Drop here the whole content of netbeans directory after unpacking development version of NetBeans.

↓↓↓↓

 

macOS and VMware Tools for Ubuntu
– sharing files between host and guest system

You can share your macOS directories between your host system and guest system while running VMFusion.

In my case, the easiest way to do it was as follows.

Download VMware Tools

You can download it here: VMware tools

Unpack the archive

After unpacking the archive you will find structure like this

VMware-Tools-core-10
|-- floppies
|   |-- pvscsi-Windows2008.flp
|   |-- pvscsi-Windows8.flp
|   `-- pvscsi-WindowsVista.flp
`-- vmtools
    |-- buildNumber.txt
    |-- isoimages_manifest.txt
    |-- isoimages_manifest.txt.sig
    |-- linux.iso
    |-- linux.iso.sha
    |-- linux.iso.sig
    |-- linux_avr_manifest.txt
    |-- linux_avr_manifest.txt.sig
    |-- version.txt
    |-- windows.iso
    |-- windows.iso.sha
    |-- windows.iso.sig
    |-- windows_avr_manifest.txt
    `-- windows_avr_manifest.txt.sig

Mount the iso file

Open VMware Fussion and make sure to mount linux.iso to your Ubuntu based VM.

Once you have selected ISO image, make sure to perform Connect CD/DVD

You should be able to see your newly mounted VMware Tools CD

Install tools

Open terminal application and run sudo su -. This way, you will become root. Now, you can create directory inside ~root and install tools.

> sudo su -
> mkdir install_vmware_tools
> cd install_vmware_tools
> find /media -name "VMwareTools*" -exec cp {} . \;
> find . -name "VMwareTools*" -exec tar -zxf {} \;
> cd vmware-tools-distrib
> ./vmware-install.pl

Proceed with installation until it is finished. Once it’s done, restart your VM machine.

Share the directory

Inside VM preferences, make sure to share directory between host and guest systems.

Inside /mnt/ you will be able to see the files you have shared between systems.

↓↓↓↓

 

OpenVPN on macOS 10.14

If you want to install most recent version of OpenVPN on macOS you will need:

tuntap – git clone git://tuntaposx.git.sourceforge.net/gitroot/tuntaposx/tuntaposx
LZO – http://www.oberhumer.com/opensource/lzo/download/
OpenSSL – git clone https://github.com/openssl/openssl.git
OpenVPN – https://openvpn.net/index.php/download/community-downloads.html

Make sure you have XCode installed as well – XCode

Double check you can download all the stuff. Once it’s in place, you can proceed with installation.


# Make sure to install command line tools

> xcode-select --install

# Then, you can proceed with tun/tap

> mkdir -p ~/opt/src
> cd ~/opt/src
> git clone git://tuntaposx.git.sourceforge.net/gitroot/tuntaposx/tuntaposx 
> cd tuntaposx/tuntap
> make

# note that make install will put some files inside /Library

> make install

# make sure to load modules before running OpenVPN
# sudo kextload /Library/Extensions/tap.kext
# sudo kextload /Library/Extensions/tun.kext

# it might be you need to disable system integrity protection on more recent macOS installations

# once tun/tap is in place, you can install LZO

> cd ~/opt/src
> curl -O http://www.oberhumer.com/opensource/lzo/download/lzo-2.10.tar.gz
> tar zxf lzo-2.10.tar.gz
> cd lzo-2.10
> mkdir -p ~/opt/lzo
> ./configure --prefix=$HOME/opt/lzo
> make
> make install

# another piece of software we need is OpenSSL

> cd ~/opt/src
> git clone https://github.com/openssl/openssl.git
> cd openssl
> ./config --prefix=$HOME/opt/openssl
> make
> make install


# Download tar.gz from
# https://openvpn.net/index.php/download/community-downloads.html

cd ~/opt/src
curl -O https://swupdate.openvpn.org/community/releases/openvpn-2.4.6.tar.gz
tar -zxf openvpn-2.4.6.tar.gz
cd openvpn-2.4.6

# eventually, we can compile OpenVPN
# make sure to export CFLAGS and LDFLAGS in order to use
# our own installation of libs and headers

> export CFLAGS="-I/Applications/Xcode.app/Contents/Developer\
/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-migrator\
/sdk/MacOSX.sdk/usr/include\
 -I$HOME/opt/lzo/include -I$HOME/opt/openssl/include"

> export LDFLAGS="-L$HOME/opt/lzo/lib/ -L$HOME/opt/openssl/lib"

# eventually, you can configure and install OpenVPN

> ./configure --prefix=$HOME/opt/openvpn
> make
> make install

> ~/opt/openvpn/sbin/openvpn --version
OpenVPN 2.4.6 x86_64-apple-darwin17.4.0 ...
library versions: OpenSSL 3.0.0-dev xx XXX xxxx, LZO 2.10
...
...
...

That’s it.

↓↓↓↓

 

macOS with multiple displays-
prevent mouse from jumping to other screen

Working with multiple displays can make you suffer while moving mouse close to the edge. Suddenly you end up at the other display.

Solution is so freaking simple ;)

↓↓↓↓

 

cat and next line continuation ‘\’

This one, gave me one, huge, headache.

> cat script.sh
#!/bin/bash
cat file \
 | sed "s|aa|bb|g"

> touch file
> ./script.sh
cat:  : No such file or directory
./script.sh: line 3: syntax error near unexpected token `|'
./script.sh: line 3: ` | sed "s|aa|bb|g"'

Yes, you are right, there is an extra space at the end of line cat file \ .

↓↓↓↓

 

macOS + VIM + Modifer Keys… – make life easier

↓↓↓↓

 

yank the line

Whenever you need that line – without leading spaces, and without new line character: ^y$.

↓↓↓↓

 

retreat

> svn merge -r HEAD:some_revision_back_in_time .
↓↓↓↓

 

indent

> indent -npsl -bli0 -brs -br -brf -bs -cdw -ce -cs -i2
↓↓↓↓

 

xz

# This one works for macOS

> tar zxf archive.xz
↓↓↓↓

 

macOS – disable notifications

I am not sure who’s idea was it to force people to use notifications. The first thing I always do (after installing macOS) is going to System Preferences -> Notifications -> Turn on Do Not Disturb. There is no other way, unless you want to be disturbed every, freaking, minute :)

↓↓↓↓

 

/dev/ufs/ no such file or directory

I was struggling for quite some time with my USB backup drive attached to NAS server based on FreeBSD. From time to time, during boot time, I was getting error

/dev/ufs/usbstorage no such file or directory

and machine was going into single user mode. It turned out, that adding late inside /etc/fstab was enough to solve the issue.

/dev/ufs/usbstorage   /media/usbstorage   ufs   rw,late   0   0

It solved the problem of missing location during the boot time.

↓↓↓↓

 

NetBeans – make macOS installer beautiful again

It’s fairly easy to make macOS like Application based on zip file distributed by Apache. All you need to do is to create structure like this:

NetBeans.app
|-- Contents
|   |-- Info.plist
|   |-- MacOS
|   |   `-- NetBeans
|   `-- netbeans.content
`-- Icon\r

and make sure to run actual application inside NetBeans wrapper script

#!/usr/bin/env bash

ABSPATH=$(cd "$(dirname "$0")"; pwd)

${ABSPATH}/../netbeans.content/bin/netbeans

Then, you need just a little bit of this, a little bit of that, and you can end up with something like this :)

↓↓↓↓

 

vsftpd and nasty ‘vsftpd failed – probably invalid config.’ error

If you have encountered this sort of issue

 * Starting FTP server vsftpd
 * vsftpd failed - probably invalid config.

try this one. Inside /etc/init.d/vsftpd replace these lines

  start-stop-daemon --start --background -m ...

  n=0
  while [ ${n} -le 5 ]

with this one

  start-stop-daemon --start --background -m ...

  sleep 1  # this one, will remove race condition

  n=0
  while [ ${n} -le 5 ]

I have spent few hours to resolve this one ;)

↓↓↓↓

 

NetCAT – NetBeans 10 and testing FTP connections
– Docker based

That’s yet another post about making live easier through Docker. This time, I am focusing on FTP.

Testing FTP features in PHP based project requires running FTP server. And, let’s be honest, this is a place where you can face some issues. First of all, you have to have FTP server running, you have to convince your FTP server admin to give you some space there, and you have to convince him to allow you to play with WWW storage :) I guess, you can call it a challange.

Another approach is to set up your own machine – doable.

And yet another approach is to use specially crafted Docker image. Brought to you as a dedicated solution for all your NetCAT testing related troubles ;)

> git clone https://github.com/mkowsiak/FTPDocker.git

That’s almost everything you need to do. There are just few more steps to go. Simply build it, run it and let it go.

You can run container with one of three, available, flavors: implicit_ssl, explicit_ssl, or no_ssl.

> docker build -t ftptest .

> docker run -i -t \
  -p 80:80 \
  -p 2020:20 \
  -p 2021:21 \
  -p 990:990 \
  -p 21100-21110:21100-21110 \
  ftptest /bin/start.sh no_ssl

After it is successfully started you will be able to read

        *************************************************

              https://github.com/mkowsiak/FTPDocker

        *************************************************

        NetCAT FTP testing server
        -------------------------
        - FTP User: html
        - FTP Password: html
        -------------------------

That’s it. We have server running. And, it’s not just a FTP server. We have apache2 on board as well.

To get it running inside NetBeans, we simply have to configure PHP Application from Remote Server. Once you are there, make sure to use proper settings for the project

and location of the server (make sure to clear Upload Directory) field.

While setting up FTP connection, you can choose Pure FTP when you have started container with nossl option, or you can use Explicit FTP using TLS when you have started container with ssl option.

That’s it. You have your own, remote, PHP project ready for development

 

↓↓↓↓

 

CLI, diff, and something like meld

If you work with remote machines, and you need to take a brief look at some changes in files it might be really painful.

If need a quick glimpse into differences between two files, you can always use diff.

diff file_a.txt file_b.txt
3c3
< It's alive!
---
> And his name will be forty and four.

you can even get some context, together with difference

diff -u file_a.txt file_b.txt
--- file_a.txt	2018-10-26 11:28:40.000000000 +0200
+++ file_b.txt	2018-10-26 11:28:40.000000000 +0200
@@ -1,3 +1,3 @@
 Hello world!

-It's alive!
+And his name will be forty and four.

But, let’s be honest, that’s not what regular developers want to see. I know there are people who are extraordinary.

– I wanna tell you my secret now
– OK
– I see dead people

However, for most of us, seeing things as they are, visually, where you can actually see the difference served on the plate in front of you, is a sort of warm place where we feel comforted. And, what’s more important, you can have it, while working with CLI.

First of all, you can always resort to Vim. Yes, old good Vim can provide you with visualization of differences.

> vim -d file_a.txt file_b.txt

Second approach, is to use dedicated tool called: ydiff

All you have to do, is to download it from GitHub.

> curl -ksSL https://raw.github.com/ymattw/ydiff/master/ydiff.py > ~/bin/ydiff
> chmod +x ~/bin/ydiff

and pass outcome of diff directly to ydiff.

> diff -u file_a.txt file_b.txt | ~/bin/ydiff -s

And what is your preferred way of checking differences while working with CLI?


 
←Older