New Lazarus .lpi files and oddities

Double clicking on a new Lazarus .lpi file, does open the code and form. As noted it wasn’t working on older .lpi projects.

Something strange is happening though. After getting things working, I’m unaware of making any other changes. But perhaps look at another project…once again not making any changes or saving that I’m aware of. When I go back to previously saved working project…it no longer works! Thank God after the project worked, I closed it then tar gziped it, Delete now not working project…extract working project…and it works again!

So I don’t think File/Close All is trustworthy. I’m guessing it’s probably OK to do that. But then you should totally exit/restart Lazarus before doing further work on a project.

Free Pascal

I remember learning Pascal (Free Pascal) and Lazarus soon after. First attempts was in 2003. I remember writing a decent name parsing (Prefix, First, Middle, Last, Suffix) routine in Free Pascal. Below, timings for a million records.

bill@bill-MS-7B79:~/Mystuff/Pascal> time ./nameparse  
Enter Input file :  
Enter Output file :  
1000001 records read.

real    0m4.016s
user    0m1.962s
sys     0m0.983s
bill@bill-MS-7B79:~/Mystuff/Pascal>

More on Lazarus

Should I even bother with it? Only for personal enjoyment. Not for employment points. Nobody talks about Pascal these days or for many years. However it’s been around and improved since 1999…over 20 years. And the language it’s based on, Free Pascal has been around and improved since 1993…over 25 years. Free Pascal also offers OO programing based on Delphi’s Object Pascal. If you’re into that.

So I began looking a little into Lazarus again. I forgot a lot. Was about to give up on my old Lazarus projects. Would double click on .lpi and .lpr files (they both had the cheetah head icon) which would start Lazarus, but no forms or code showed. I think that worked in the past. So just for the heck of it instead I used Lazarus File menu and opened the .lpi, which was a bigger file than the .lpr, and that seemed to work opening code and form. F12 toggles between the 2. Lazarus actually is a very cool project.

I think I stopped playing with it because I was having trouble using SQLite. I need some type of DB, preferably SQLite to be able to do many productive things. I don’t remember the details but evidently I did make some SQLite progress because I had 4 SQLite project directories. It would be a MS-Access killer if I could work with SQLite. MS-Access is a great single user database program. I’ve written a few MS-Access programs for fun and profit. Because of things I already stated, I think I’d prefer it over MS-Access today.

Python virtual environment

Installed using the distribution package manager on Mint. Activated. But pip list shows everything! To me virtual environment seem like a moving target that hasn’t been nailed down. Do it this way no do it this way. Oh you’re on this distro? Then never mind do it this way. Successfully used them before. I moved to a previously created virtual environment. Activated Installed a package. Became apparent that it was installed globally. Pip list shows everything. When I activated the old environment there were no old version message. So I decided to create new a new virtual environment using python -m venv env it tells me …

The virtual environment was not created successfully because ensurepip is not
available. On Debian/Ubuntu systems, you need to install the python3-venv
package using the following command.

apt install python3.8-venv

You may need to use sudo with that command. After installing the python3-venv
package, recreate your virtual environment.

Failing command: [‘/home/bill/MyStuff/Python3/test-env/bin/python’, ‘-Im’, ‘ensurepip’, ‘–upgrade’, ‘–default-pip’]

WTH?

It didn’t say remove old first…but I did… and it seemed to work.
I don’t like including the version point release. Shouldn’t install figure that out?
The package install said python3-virtualenv

My old notes showed creating the virtual environment like

virtualenv project1_env …did not work
python3 -m venv env …seemed to work

Lazarus

Installed v 2.0.12 in Tumbleweed. Lazarus is “The professional Free Pascal RAD IDE”. So it also installed Free Pascal version 3.2.0.I found an old Pascal directory. The one click install was much easier than I remembered installing it on Mint years ago.

I created the below GUI Judo scoreboard using Lazarus, many many years ago (2005-2006) , when my kids were in Judo. The program still executed hence the screenshot. There was also a Windows exec in the directory.

It works similar to MS Visual Basic in that you design your interface by placing various objects on a form such as a text box. You can set various properties on these objects. And you can respond to Events such as a mouse chick on a mouse button object. However unlike VB, Lasarus uses Pascal. Also it is a compiled (standalone) language, so much faster than VB. If you remember Delphi from Borland it was very similar…also using Pascal. As a matter of fact Lazarus says…Converts from Delphi. Apparently Delphi is still a thing and now owned by Embarcadero Inc.

Julia 1.6.2

Good time to dip my toes back into the Julia language pool. I’ve had some complaints about Julia. Quite possibly due to my not understanding certain concepts. One thing I can give Julia credit for is pushing me to move to Python 3! Julia to me had strong similarities to Python. At the same time it was also very different. I figured if I can learn Julia I could certainly learn Python 3. Going to Python 3 from Python 2 is way easier than going to Julia.

If I look at Date Modified for my Julia programs it looks like I haven’t written any since August of 2020, so almost a year ago. I had made a Julia YouTube video back in May 2019 that had over 532 views. Pretty good for me. I took it offline quite a while ago because I thought it was no longer relevant because of more recent updates. Just for kicks I put it back online. I watched it and it still seems relevant. The video was using version 1.1.0.

Ran an old SQLite program I wrote. Required packages SQLite and DataFrames. When I first started playing with SQLite in Julia back in the day I had no idea what a dataframe was but thanks Python Pandas I now do. And that always helps.

There was also this odd magic statement I was using because I saw it somewhere that looked like this…
df=DBInterface.execute(db, sql) |> DataFrame

I didn’t understand it but it worked! I’d rather understand it first before using magic. So today, I googled “|>” and found that it like linux piping. Def “Applies a function to the preceding argument. This allows for easy function chaining.” So I found the following 2 statements do the same thing as the 1 magic statement…

df=DBInterface.execute(db, sql)
df=DataFrame(df)

So now that I understand, I can happily go back to using the single magic statement!