Visitors from Germany

Recently I had both Christian Schmitz and one of my clients from Germany visit

Christian and I spent his first full day in Canada touring about to the Royal Tyrell Museum and some of the sights on thee way out. Weather was crappy so we didnt spend a lot of time outside.

At the end of the day we got together with several other Xojo users at a local restaurant and enjoyed a nice meal and discussions around all kinds of things.

Spectacular !

Last night the northern lights were out in full force.
Walked to the end of the deck and WOW !
We took some pictures but they didnt come out nearly as nicely as the ones my youngest took (like this)

Truly an awesome display

Copy & paste is not a code reuse strategy

Code reuse is an admirable goal for any developer.

Being able to re-use well written well tested code is a good thing.

Especially if you can reuse it across multiple facets of one project, or across several projects.

And I wouldn’t be surprised if a lot of people start out reusing code using copy paste from one place to another.

However, copy paste isn’t usually a well regarded code reuse technique.

Why not ? Stack overflow wrote a blog about the reasons. You might copy & paste someone else’ insecure code into your projects and thereby introduce security vulnerabilities. That’s certainly a possibility.

But what if you’re just copying & pasting your own code around ? Where’s the harm ?

Suppose you have some code you really think is top notch. And you want to reuse it over & over. Suppose you want to reuse it in the event handler of numerous controls across several projects in Xojo.

And sometime later you find there’s a bug in it.

Now how many places do you have to fix in one project ? Or worse across many projects ?

This is where copy paste as a code reuse technique can cause you extra work.

You have to find & fix all that code in every project you’ve used it in.

I’ve been using externals in SVN (yes I still use SVN)

And in every project that uses these shared modules its a simple “update” and they have all the latest code from all the shared items.

Git has similar capabilities.

All good things come to an end

Some time ago Bob had said he would let the domain registration for BKeeney Briefs lapse. Today it finally came home to roost.

Trying to visit gets you one of several things.

What I got was a domain name squatter site trying to sell me the name.

Sad to see that finally happen but with Bob’s employment changing from contractor to full time employee its not surprising.

And, with this change, another one bites the dust somehow seems strangely appropriate.

Thanks for everything Bob !

Bit in the ass by API 2

Was tracking down a bug in my app and couldnt figure out what was wrong initially.

All the code seemed right but setting a value to code like

value = string.ToInteger

seemed to be the culprit. Sure enough the string contained a value like 3.0e+2 (an integer expressed in exponential form) But the docs say

String.ToInteger

Method

Returns the integer equivalent of the source string. This function is the same as the Val function but is international-savvy.

But experience was telling me this wasnt true

So a quick test in 2021r2.1 with

Dim s As String = "3.0e+2"

Dim i1 As Int32 = Val(s)
Dim i2 As Int32 = s.Val
Dim i3 As Int32 = s.ToInteger

Break

shows that indeed i1 = 300, i2 = 300, and i3 is 3 not 300 like I would have expected. I changed my use of ToInteger to Val and things work as expected.

Be careful out there

EDIT : reported bug http://feedback.xojo.com/case/65567

Survey

If youre one of the people who didnt get the Xojo Experience survey there’s one thats a lot alike at INN

Filetype help

On the forums someone is looking for a way to identify what kind of file they are dealing with. And then a way to “sort” knowing those types.

The suggestion given is to look at each extension in a simple way

But, you can get away without ever having to look at the extension. Folderitem already assigns a TYPE IF there is a filetype defined that matches.

You can use this built in ability to do many things.

I posted about this on INN along with a sample project

Help keep your code sanity

Ever think to yourself “Oh I have this project to do and I’ll just cut and paste the code from there and tweak it?” And now you have two copies that are a lot alike but maybe not exactly the same.

And then you do this over & over and now you have many copies of that code?

How do you deal with issues when you find them ?

Which copy is the newest & the most correct ? And which one is the right good copy to use as the basis for yet another copy ?

I’ll admit that I will copy & paste code to examine it. Play with it to see how it breaks. And then I throw it away and fix the real single working copy that IS the master for all others.

And there are some neat tools for this like Snippets for BitBucket Server

Copy & paste coding is fast. Repetitive. And it has issues. Which is why copy-paste programming is used mostly as a negative comment on coding style.

And it can be dangerous

If you have the ability to avoid it by using submodules, includes, sub-projects in whatever version control system you’re using (you ARE using version control right?), or similar mechanisms I’d encourage you to do so.

It will help you avoid the proliferation of many different versions of the same code in all your projects.

And when you need to fix the code you can fix one copy and all your other projects can be updated with it.

Labelling

A long time ago I was in a BEd\Bsc program at University.

It was supposed to end with me having two degrees. One Degree in Education and one in Computer Science. But the two faculties couldn’t agree on the course of studies over 5 years. And when I got to year 5 it turned out both expected me to do at least one more full year in each faculty. I wasnt financially in a position to do that and had to decide which to finish. Since I had more credits towards my BSc at that point I finished that. But I did have the better part of 3 years of a BEd under my belt as well.

One of the things that came up for discussion during that education was “labels” and how they affect not only the person(s) being labelled, but also the person who applied the label. If you thought of a kid as “slow” or “stupid” or some other negative term, then you, as their teacher, were more likely to react and treat them in accordance with those labels. And you could inadvertently contribute to that child being treated as “slow” or “stupid”. How you perceived them had a direct impact on how you treated them.

If instead you thought of this student as “smart” and “capable” that too could factor in to how you treated those students.

The best defence was to realize when you were doing this and ACTIVELY work to combat doing this. (This article is VERY good on what to do and how to avoid it)

This sort of thing occurs a lot. We probably all do it from time to time. We label people in various ways. Kind. Considerate. Jerk. A-hole. You name it.

The trouble with applying such labels is that once they are applied they tend to stick. And this assumes that whatever behaviour was labelled is permanent, unchangeable and fixed for all time.

A single clumsy attempt at a joke could end up getting a person labelled as a jerk. And the person applying that label remembers that forever and treats that person as “a jerk” from then on. And never bothers to attempt to ever see that person they labelled in any other way. They were “a jerk”. They are “a jerk”. They always will be “a jerk”. Period.

The trouble is that it’s not realistic. People can in one moment be jerks, and in another extremely considerate, caring and compassionate. Rarely are people ALWAYS some singular label. People ARE complex and labels are often too simplistic. Especially if they are applied rigidly and NEVER re-examined to see if the reasons we labelled that person that way. Re-examination is hard because its very likely we base that re-examination ON the labels we have already applied.

The other downside to labels is that the person applying the label can use that label to dismiss the other person. Whether its complaints, concerns, or whatever its easy to see how labelling someone a jerk leads to “so I dont have to listen to them or try to understand their concerns – they’re jerks !”

And since “they’re jerks” everything is seen through that lens. Reasonable criticisms are seen as “Its by that jerk so I dont have to listen or even try to see IF they have some legitimate reason for that criticism. They’re jerks !”

I’ll admit that I do get frustrated with people and complain about them.
Esp as I drive (ask my wife) I do try to avoid labelling people – but its not a 100% success rate.

And, to be honest, I expect that the people this post is meant for might not read it.
Because they have applied a label which they feel gives them permission to ignore this.
Because that single fixed label that requires no thought, no reexamination, or consideration of anything that other person says, thinks, or does.