An easy way to put sharp Icons on your webpage is by using Google Icons.
Installing Visual Foxpro on Windows 10 64bit
After replacing my computer, I needed to reinstall Visual Foxpro. I had the install disc contents, but whatever executable I started with: it kept on crashing. A Google search brought silly advice, but fortunately there was a gem: an article on wOOdy’s Blog. This explained what the right procedure is and what file to start with (VFPSTART.HTA). It stil would not work. Not from a folder, and not from a mapped network disc. I found the free AnyBurn software that gave me the opportunity to create an ISO file from my install folder. Now it was as easy as double clicking the ISO file to have Windows mount the CD image and assign it a drive letter. Now everything worked like a charm. Then we have to apply both service packs, and perhaps some useful suggestions wOOdy made.
Foxpro ReturnObject
Function to prevent problems during object creation to crash your program. When problems arise, your program might be unable to continue, but at least you can show the user what went wrong instead of an uninformative crash warning.
* ReturnObject
* 2011.05.31 start
* 2012.07.06 parameters added
* Tries to create an object and return this. If object creation failed, a false is returned
* Parameters: Class to instantiate object from, max 2 parameters
FUNCTION ReturnObject( tcClass,tuPar1,tuPar2)
LOCAL loReturn,lnCount,loError
lnCount = PCOUNT()
TRY
DO CASE
CASE lnCount = 1
loReturn = CREATEOBJECT(tcClass,tuPar1)
CASE lnCount = 2
loReturn = CREATEOBJECT(tcClass,tuPar1,tuPar2)
OTHERWISE
loReturn = CREATEOBJECT(tcClass)
ENDCASE
CATCH TO loError
loReturn = .f.
ENDTRY
RETURN loReturn
ENDFUNC
Foxpro and Excel
It is very possible to automate spreadsheets from Visual Foxpro using VBA/ COM automation. Here I wil document the parts I need.
Connecting to Excel
oExcel = CreateObject("Excel.Application")
if vartype(oExcel) != "O"
* could not instantiate Excel object
* show an error message here
return .F.
endif
I use my own library (JLIB) containing a ReturnObject function that fetches errors. Using that function my code looks like this:
PUBLIC goX && global Excel object
IF InitiateExcel()
* Code here
ELSE
? [Error initiating Excel automation]
ENDIF
PROCEDURE InitiateExcel
goX = ReturnObject([excel.application])
RETURN (VARTYPE(goX)=[O])
ENDPROC
Open an existing spreadsheet
oWorkbook = oExcel.Application.Workbooks.Open("C:\temp\test.xls")
Create a new blank spreadsheet
oWorkbook = oExcel.Application.Workbooks.Add()
Create a new spreadsheet from a template
oWorkbook = oExcel.Application.Workbooks.Add("C:\temp\template.xlt")
Sheets collection/ objects
oWorkbook.sheets.count && returns the number of tabs/ sheets
oSheet = oWorkbook.sheets(1) && get an object to control the sheet
? oSheet.name && show the sheet name
Tables
A table is called a ListObject in Excel/ Microsoft terminology
oSheet.ListObjects.count && gives the number of tables on the sheet
oTable = oSheet.ListObjects(1) && get an object to control the table
? oTable.ListRows.count && displays the number of data rows in the table
oTable.DataBodyRange.delete && deletes al rows. Error (crash) if there are no rows!
Working with table rows
Adding a table row needs several steps: 1. Add the row and keep the reference to it. 2. Add the column data 1 by 1:
oRow = oTable.ListRows.Add && you have a new row and a reference to it
oRow.Range(1) = Date(2020,7,6) && Add a date in the first column
Using named cells
? oSheet.Range("ProductionDate").value && show value of cell named ProductionDate
oSheet.Range("TotalPages").value = 13
Saving and closing
The save method is in the workbook object. And you can quit from the Excel application object:
oSheet.SaveAs([x:\reports\report.xlsx]) && Save
oExcel.Quit && quit Excel
The Quit only works on this Excel application you’ve initiated. So existing opened Excel sheets are untouched (remain opened).
Sources used
OpenXava rapid web development
This Java based development framework makes developing a (enterprise) web app as easy as defining your data model. Your main task is to create a good data model, pour it into classes, and defining the relationships and referential integrity. The framework creates the web app for you! When you are ready to deploy, the web app can be hosted in a Tomcat environment.
Node.js: Application as a Windows service
node-windows
node-windows is a standalone module that makes it possible to offer a Node.js script as native Windows services..
Prerequisite: You have succesfully installed Node.js.
Install with npm using the global flag:
npm install -g node-windows
In the project root run:
npm link node-windows
Hello world example
Create a hello.js file with this code (Hello World sample from the Express website):
const express = require('express')
const app = express()
const port = 3000
app.get('/', (req, res) => res.send('Hello World!'))
app.listen(port, () => console.log(`Example app listening at http://localhost:${port}`))
You can (should) test if it works by running it from the command line:
node hello.js
If there are no errors, point your browser to http://localhost:3000. If it says Hello World! you are well on your way!
Script to create the service
Now we have our app, we want to make it a service. This is achieved by another script we call hello-windows-service.js:
var Service = require('node-windows').Service;
// Create a new service object
var svc = new Service({
name:'Node app hello',
description: 'Node app hello as Windows Service',
script: 'C:\\npm\\.node_modules_global\\hello.js'
});
// Listen for the "install" event, which indicates the
// process is available as a service.
svc.on('install',function(){
svc.start();
});
svc.install();
Most important is the correct location of the script in the Service call..
Now run this script to install the service into Windows:
node hello-windows-service.js
Now if you check your services, I hope you’ll find this:
Great! The Node app is running as a Windows service under a local system account. The app is running even when nobody is logged in. Goal achieved. Oh and because it’s on Automatic start, it wil always become available after each server restart.
Based on this article by Peter Eysermans.
Node.js: Install
Node.js org offers a complete install package at https://nodejs.org/en/download/ .
The install is a complete developer’s package that sets you up with a complete set of tools you need to develop and build Node.js apps.
The install package includes:
The package is delivered through a Chocolatey package, and is completely unattended (so well written installer!).
m1m0 learn to code
An article in Computer Totaal mentioned this App. It is said to be a kind of game to learn programming bit by bit. By solving puzzles you gain points, thus rewarded for learning. The App gives you languages like HTML, CSS, SQL, Java, Python, Ruby, C++ and more. I haven’t tried it yet, but it looks like fun.
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:
- Open package.json in uour App root folder
- Find the parameter “homepage” or add it (image above)
- Give the parameter the value of the complete path where your app will be hosted (image above)
- Save the package.json file
- Build the React app using npm start build
- Upload the production build (folder build) to your hosting provider
- And done!
And when you are building the React App using npm run build, it should confirm the subfolder:
FTP: FileZilla
The free FTP solution
FileZilla has been around for quite a while now. It’s an unbeatable combination: it does what it should, and it’s free!
Thanks sponsors! I’ve visited your pages 😉