React: build for relative paths

If it’s not a real production build, you probably test your React Apps in a sub folder at your hosting space. The information on this is scattered and explained way too difficult. There’s nothing to it:

  1. Open package.json in uour App root folder
  2. Find the parameter “homepage” or add it (image above)
  3. Give the parameter the value of the complete path where your app will be hosted (image above)
  4. Save the package.json file
  5. Build the React app using npm start build
  6. Upload the production build (folder build) to your hosting provider
  7. And done!

And when you are building the React App using npm run build, it should confirm the subfolder:

Outgoing port tester: PortQuiz.net

I needed to test whether some ports were enabled or blocked. This tool/ service is great: It simply accepts any port request and tells you if it succeeded. From the PortQuiz page:

This server listens on all TCP ports, allowing you to test any outbound TCP port.

You have reached this page on port 80.
Your network allows you to use this port. (Assuming that your network is not doing advanced traffic filtering.)

Network service: http
Your outgoing IP: 86.93.90.146

Test a port using a command

$ telnet portquiz.net 80 
Trying ...
Connected to portquiz.net.
Escape character is '^]'.

$ nc -v portquiz.net 80 
Connection to portquiz.net 80 port [tcp/daytime] succeeded!

$ curl portquiz.net:80 
Port 80 test successful!
Your IP: 86.93.90.146

$ wget -qO- portquiz.net:80 
Port 80 test successful!
Your IP: 86.93.90.146

# For Windows PowerShell users
PS C:\> Test-NetConnection -InformationLevel detailed -ComputerName portquiz.net -Port 80

Test a port using your browser

In your browser address bar: http://portquiz.net:XXXX
Examples:
http://portquiz.net:8080
http://portquiz.net:8
http://portquiz.net:666

Access portquiz.net. Outgoing Port Tester

Clipboard enhancement

You can use the new Windows 10 clipboard tool with the combination Windows-Shift-S (Try it now). It has nice possibilities like selecting a rectangle, free shape, current window or complete screen. But I want more. For instance: a form of history than can easily be viewed and selected. I found this nice software that can even clip and paste cross platform (haven’t tested it yet) through Google cloud storage.

Enter the free 1Clipboard. You clip whatever you want using Windows-Shift-S. After that, you can see your last clip in the Windows message center. With the key combination Ctrl-Alt-V the program opens, showing you the clipboard history and allowing you to select any clip (which is put onto the clipboard when you click it), or make it a favorite. There is even a search available.

Remote control software

I am using Teamviewer professionally, but It’s pricey and not very well put together. We have a branded quicksupport online, so I receive an e-mail whenever someone starts this program. The e-mail contains a link to the handling system, that is online and you need to log-in to it. There I can open the request which at its turn opens Teamviewer on my desktop. Sometimes the connection will be made instantly without problems, only asking the service requester whether I’m allowed to take over. But lots of times, there are hiccups during the Process and it breaks. We have to try over again way too much times. Furthermore, when it works, I have helped and ended the session even filled the actions taken, the ticket is not closed!? Even worse: the ticket is still in the handling queue waiting to be assigned and treated. Silly software. Who programs this sh*t?

Anyway, I was looking for free software to take over the console as we have some special services computers that need to stay logged-in in the console mode, and it seems that Windows 10 has dropped support for the RDP (mstsc) console access. The program I have tried somewhat successful (1 night testing):

MSP360â„¢ Cloudberry Remote Assistance

This software has the following features:

  • It uses a central server, so remote support can be initiated anywhere (internet needed)
  • It does not need any port forwarding or firewall exclusions
  • It is free software
  • It allows remote control without user interaction, so you can take over unattended desktops
  • There is a rather new iOS client (that does not work at this time)

Link to the MSP360 page.

Brother ADS-1200 document scanner

Motivation

We are using our Canon MG5350 some time now. For the (very) accidental print, and for digitizing our documents. The printer works fine, even printing from our tablets without problems. But scanning of larger volumes is becoming a pain. You have to place each document carefully and the workflow using Filecenter is a labour intensive, time consuming effort.

Time to find an affordable, fast and reliable way to digitize.

Requirements

  1. We really need an ADF: Auto Document Feeder
  2. Small footprint on our desk
  3. Duplex scanning (in 1 go) is bonus
  4. Affordable
  5. Good interfacing and drivers. At least TWAIN and ISIS. And maybe WIA.

Candidates

HP Scanjet Pro 3000 s2 (mfg)

An excellent scanner according to PCmag (review). Affordable at € 228 at Bol.com.. But the review is from 2013, so the model is ancient. The s4 model is way more expensive at € 549 at Kijkshop.

Brother ADS 1200 (mfg)

This Brother has an even smaller footprint, and is highly recommended (Bestbuy reviews). Found it at Bol.com for € 239. It ticks all the requirement boxes.

Xerox Duplex Combo Scanner (mfg)

Impressive performance and sleek interface. But more expensive in Europe than in the States (€ 285 at Centralpoint), and not really a small footprint… Excellent according to a PC magazine review.

Bits and pieces

Stuff I collect because it’s interesting, but has to be organized.

Script to add mobile usage to the body class (WordPress)

<script type="text/javascript">
 if(navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/)) { document.body.className += " using-mobile-browser "; }
</script>

VFP: Create header files

Header files (.H) contain declarations and sometimes code. Software uses codes for specific actions or settings, but these codes are illegible for most humans. The header file for Microsoft Word 2016 contains more than 4.500 lines. It starts like this:

* WdMailSystem
#DEFINE wdNoMailSystem 0
#DEFINE wdMAPI 1
#DEFINE wdPowerTalk 2
#DEFINE wdMAPIandPowerTalk 3

* WdTemplateType
#DEFINE wdNormalTemplate 0
#DEFINE wdGlobalTemplate 1
#DEFINE wdAttachedTemplate 2

The header files are not included in the distributions, so you have to search for them yourself or create them if possible.

This program originates from an old Microsoft article. It creates a dialog where you can locate an .OLB file (Object Library). It then extracts all constants and gives you the ability to save them to your header file.

* Bron: https://web.archive.org/web/20110808014156/http://support.microsoft.com/kb/285396

****************START CODE****************
PUBLIC oform1

oform1=NEWOBJECT("form1")
oform1.SHOW
RETURN


****************FORM CODE****************
DEFINE CLASS form1 AS FORM

	HEIGHT = 445
	WIDTH = 567
	DOCREATE = .T.
	AUTOCENTER = .T.
	BORDERSTYLE = 1
	CAPTION = ".OLB Constants Extractor"
	MAXBUTTON = .F.
	MINBUTTON = .F.
	NAME = "Form1"

	ADD OBJECT txtolbfile AS TEXTBOX WITH ;
		HEIGHT = 27, ;
		LEFT = 65, ;
		READONLY = .T., ;
		TABINDEX = 2, ;
		TOP = 6, ;
		WIDTH = 458, ;
		NAME = "txtOLBFILE"

	ADD OBJECT label1 AS LABEL WITH ;
		AUTOSIZE = .T., ;
		CAPTION = ".\<OLB File:", ;
		HEIGHT = 17, ;
		LEFT = 4, ;
		TOP = 11, ;
		WIDTH = 55, ;
		TABINDEX = 1, ;
		NAME = "Label1"

	ADD OBJECT cmdsave AS COMMANDBUTTON WITH ;
		TOP = 411, ;
		LEFT = 394, ;
		HEIGHT = 27, ;
		WIDTH = 84, ;
		CAPTION = "\<Save to .h", ;
		ENABLED = .F., ;
		TABINDEX = 6, ;
		NAME = "cmdSAVE"

	ADD OBJECT cmdquit AS COMMANDBUTTON WITH ;
		TOP = 411, ;
		LEFT = 480, ;
		HEIGHT = 27, ;
		WIDTH = 84, ;
		CAPTION = "\<Quit", ;
		TABINDEX = 7, ;
		NAME = "cmdQUIT"

	ADD OBJECT edtconstants AS EDITBOX WITH ;
		HEIGHT = 347, ;
		LEFT = 6, ;
		READONLY = .T., ;
		TABINDEX = 4, ;
		TOP = 52, ;
		WIDTH = 558, ;
		NAME = "edtConstants"

	ADD OBJECT cmdgetfile AS COMMANDBUTTON WITH ;
		TOP = 6, ;
		LEFT = 533, ;
		HEIGHT = 27, ;
		WIDTH = 26, ;
		CAPTION = "...", ;
		TABINDEX = 3, ;
		NAME = "cmdGETFILE"

	ADD OBJECT cmdextract AS COMMANDBUTTON WITH ;
		TOP = 411, ;
		LEFT = 280, ;
		HEIGHT = 27, ;
		WIDTH = 110, ;
		CAPTION = "\<Extract Constants", ;
		ENABLED = .F., ;
		TABINDEX = 5, ;
		NAME = "cmdEXTRACT"


	PROCEDURE cmdsave.CLICK
		STRTOFILE(THISFORM.edtconstants.VALUE,PUTFILE([Header File], ;
			JUSTSTEM(THISFORM.txtolbfile.VALUE) + [.h],[.h]))
	ENDPROC


	PROCEDURE cmdquit.CLICK
		THISFORM.RELEASE
	ENDPROC


	PROCEDURE cmdgetfile.CLICK
		LOCAL lcOLBFile

		lcOLBFile = GETFILE([OLB],[OLB File],[Open])
		IF EMPTY(lcOLBFile)
			RETURN .F.
		ENDIF
		
		IF UPPER(RIGHT(lcOLBFile,3)) # [OLB]
			MESSAGEBOX([Invalid File],0,[])
			RETURN .F.
		ENDIF

		THISFORM.txtolbfile.VALUE = lcOLBFile
		THISFORM.cmdextract.ENABLED= .T.
	ENDPROC


	PROCEDURE cmdextract.CLICK
		WAIT WINDOW [Processing...] NOCLEAR NOWAIT
		LOCAL oTLB_INFO, oConstants, lcConstantsStr, Obj, member
		#DEFINE CRLF CHR(13) + CHR(10)

		oTLB_INFO = CREATEOBJECT([tli.typelibinfo])
		oTLB_INFO.ContainingFile = (THISFORM.txtolbfile.VALUE)

		oConstants = oTLB_INFO.Constants

		lcConstantsStr = []
		FOR EACH Obj IN oTLB_INFO.Constants
                        lcConstantsStr = lcConstantsStr + CRLF + "* " + Obj.Name + CRLF   
                        FOR EACH member IN Obj.Members
                            lcConstantsStr = lcConstantsStr + [#DEFINE ] + ;
                            member.NAME + [ ] + ;
                            TRANSFORM(member.VALUE) + CRLF
                        NEXT member
		NEXT Obj

		THISFORM.edtconstants.VALUE=lcConstantsStr
		THISFORM.cmdsave.ENABLED= .T.
		WAIT CLEAR
		WAIT WINDOW [Complete!] TIMEOUT 2
	ENDPROC

ENDDEFINE
****************END CODE****************

VFP: Check already running (NL)

Draait een programma al?

Door jasperdg op 16 Jul 2007

Het is soms niet handig als je een programma start terwijl dit al draait. Vooral bij programma’s die bewerkingen uitvoeren op databases is dit zeer ongewenst (indexeer programma’s etc). Hier een geschikte module die met Win32Api functies de actieve vensters uitleest en kijkt of een specifiek programma in de actieve titels voorkomt…

Met dank aan FoxStuff.

Programma IsRunning.prg :

 (0 als niet gevonden, anders het handle nummer)

* Generic routine to check if a given 
* application is running on the user's system.
* Parameter is all or part of the window's title.
LPARAMETERS tcTitle

DECLARE INTEGER GetActiveWindow IN Win32API
DECLARE INTEGER GetWindow IN Win32API ;
  INTEGER hWnd, INTEGER nType
DECLARE INTEGER GetWindowText IN Win32API ;
  INTEGER hWnd, STRING @cText, INTEGER nType

lhNext = GetActiveWindow() && current app's window
* iterate through the open windows
DO WHILE lhNext#0
 lcText = REPLICATE(CHR(0),80)
 GetWindowText(lhNext,@lcText,80) && get window title
 IF UPPER(ALLTRIM(tcTitle)) $ UPPER(lcText)
  * parameter text is present in window title
  RETURN lhNext
 ENDIF
 lhNext = GetWindow(lhNext,2) && next window
ENDDO
* required window not found
RETURN 0