Getting started with Flutter

One of my best friends asked what was a good intro to Flutter.

I’m sure there are a lot of good intros, but I’m not familiar enough with the ecosystem to know where everything is yet, so I’m going to do a dump of the things I’ve looked at the past few days to get started.

A good first app tutorial for Flutter is part 1 and part 2. And here is a video walkthrough of the codelab by the person who wrote the original example app.

The learning section on flutter.dev is an incredible resource for information on Flutter.

There is a great codelab on Dart.dev for getting to know Dart, and the overview for Dart is also a great reference when it comes to the details of Dart.

Standard

Trying out Flutter and Dart

I’ve been checking out Flutter – the cross-platform UI toolkit from Google. I’ve been noticing it mentioned over the past year, and since desktop support just stabilized, it looks like it might give me something I’ve wanted for a long time. For most of the time that I’ve been programming, I’ve been interested in options that allow cross-platform development.

Flutter is written in the Dart language also developed by Google.

So for the past few days I’ve been diving pretty deep into Flutter and Dart tutorials.

I’m trying to learn the Dart language. So far it mostly seems like an easier / slightly less verbose Java.

I know that Dart is a pretty niche language, but maybe it’s just my doom / destiny that I will only be drawn to niche languages. It does seem like Dart is pretty close to my sweet spot for what I want in a language at the moment.

One thing I like is that Dart can be compiled to a single file executable.

It looks like when you do that it just bundles a copy of the runtime with it, but I’m used to that from some other languages that I like. It can also be compiled to some kind of package that can be deployed to Android or iOS. In addition, it can be compiled to JavaScript for the web. As a result, Flutter is also deploy-able to all those platforms (iOS, Android, Web, Windows, MacOS, Linux).

I don’t have much more to say right now, but I’m enjoying the thought of working with these more.

Standard

Emacs Typing Tutor

Last night I re-read this Steve Yegge article about learning to type as a programmer. I can touch type, but I don’t usually manage to break 60 WPM. The article made me curious if regular practice could increase my speed any more.

A long time ago I mentioned a hack that would let you use Vim as a sort of typing test.

The original article that post referred to has long vanished into the internet (maybe retrievable by the wayback machine?) and it looks like through some of the migrations of my blog (or changes in versions of Vim through the years) the syntax of that post is no longer producing the behavior that was useful as a typing test.

So I went today looking for something else that could be used as a typing tutor. Since I spend a reasonable amount of time near Emacs these days, I figured that would be a good (and likely) environment to find something. And I did – I found something that I really like. It has essentially the same simplicity of the Vim hack (when it was working) but it offers a little more automation and more variety.

The speed-type package is available on Melpa and it installs in Emacs with basically no configuration via list-packages. It includes samples from Project Gutenberg books, so it also exposes you to new vocabulary – so double win. It can also use sample text you provide if desired.

So far it looks great. I spent a little time (is it wasted, or is it training?) playing with it this morning. I think I’m going to try practicing with it a little each day and see if I can make any progress.

Standard

2021-06-23

Wow, it’s been a few years since my last real attempt at a blog. I’ve just been journaling locally since then.

I’m finally ready to do some blog based writing again. I’m going to have to figure out how I’m going to approach importing or transcribing all of the writing I’ve been doing for the last few years into this blog.

I’ve got to go back through all my Org mode files for the past few years and I also need to collect all my random paper based attempts at writing or journaling and figure out where to go from there.

Standard

2018-04-20

Windows Color command

On Windows (at least Windows 10) you can use the color command at a cmd prompt to change the foreground and background color of the console.

The default color scheme of the cmd console is color 07, but if I want to flip to a black on white I can do:

color F0

Here is the help (found by color /?):

Sets the default console foreground and background colors.

COLOR [attr]

attr Specifies color attribute of console output

Color attributes are specified by TWO hex digits — the first corresponds to the background; the second the foreground. Each digit can be any of the following values:

0 = Black       8 = Gray
1 = Blue        9 = Light Blue
2 = Green       A = Light Green
3 = Aqua        B = Light Aqua
4 = Red         C = Light Red
5 = Purple      D = Light Purple
6 = Yellow      E = Light Yellow
7 = White       F = Bright White

If no argument is given, this command restores the color to what it was when CMD.EXE started. This value either comes from the current console window, the /T command line switch or from the DefaultColor registry value.

The COLOR command sets ERRORLEVEL to 1 if an attempt is made to execute the COLOR command with a foreground and background color that are the same.

Example: "COLOR fc" produces light red on bright white

Standard

2018-04-11

Writing Locally

I’ve been writing locally recently as I’ve been transferring old notebooks over to a digital format.

I would have thought that I would want to post stuff that I find in the notebooks on the blog, but what I’ve found is that a lot of the stuff that I write seems trite and uninteresting when I read it later.

This is something I’ve noticed before, the obvious implication is that a blog that is updated with current unfiltered thoughts is unlikely to be interesting. It may be that a blog would be better served purely as a repository for essays, than as a public journal of my life and thoughts.

Is it worth having both?

  • A section for essays
  • A section for daily thoughts

Is there value in daily thoughts that is worth having those published in addition to the essays that I put time and effort into?

Notebook Writing for Blog

One thing that is hard about just directly transferring notebook writing to the blog is that a lot of times I’m just jotting down my current thoughts about a topic in my notebook, and it’s only after I’ve gone on and returned to the topic a few times that my thoughts actually coalesce into a coherent whole. Just directly transferring the notes verbatim forces someone else to go through that whole process rather than getting the finished product.

Looking at the pieces one at a time is often annoying.

Getting the whole, is usually more satisfying.

Standard

2018-04-06

My Life this Week

So far this week I’ve mainly focused on 3 things:

  • Lazarus – an open source clone of Delphi written on top of Free Pascal
  • Boxing – I took my first boxing lesson this week
  • Jump Rope – Related to Boxing, I’ve started trying to learn to jump (or skip) rope

So far with Lazarus I’ve done some quick GUI toys, one of which fired off requests to a web server written in Go to process the data and then displayed the result of that process. I’m a bit excited about that as it offers a possible way to connect a GUI written in Lazarus to code written in another language as long as that other language can expose itself over http.

I had my first Boxing lesson on Tuesday, and I’m totally engaging with it now. I think I would really like getting into Boxing. It seems simple enough to learn that I should be able to get the basics down quickly. After that I think I’ll be able to continue working at it on my own. It emphasizes getting in shape in a way that I think I wouldn’t have gotten from other martial arts I’ve been considering.

That has actually been surprisingly exciting, I am liking the exercise activities related to boxing that I’ve been doing. I’m enjoying learning how to jump rope. It’s been encouraging to realize that my previous attempts at jumping rope were frustrating not just because I’m uncoordinated, but because it actually takes a while to get to where you can successfully jump rope.

So, I’m working on this "30 days to Jump Rope" video that is on YouTube, and I’m currently on the 3rd day. I will have to see whether I need to continue to try this "day" for a while, or whether I can handle moving on.

Evolving Applications

You can evolve an application by adding another layer to maintain compatibility with the old architecture.

How do you handle the accumulation of those layers as further evolutions and migrations happen?

Is there a way to simplify things or is each layer doomed to be locked and ossified?

Windows 10 Popup from Script

I had been trying to figure out how to create a popup that would be visible from a Tcl script after it had started several other processes to tell you that they had completed.

The problem was that Tk never got the focus back once the the other gui applications started. The best I could achieve was to get the tray icon to flash, which when clicked would raise the dialog.

Today I found a solution, and perhaps a principle that could apply even to other solutions.

Windows has a command line utility called msg that allows one to send a message to a user that appears as a popup.

Here is an article that describes it.

It seems to appear over other application windows, but I’m not sure if that’s innate to the utility or because it’s a new process.

That last point is what I think might be more generally applicable. I think any new application on Windows 10 seems to steel focus when it appears onscreen.

So if I wanted to do a popup that would be seen purely in Tcl, I think I could have executed another Tcl process that would then produce the Tk Dialog. That way, when it came onscreen it would take the focus so that people could see it.

Windows Popups via PowerShell

Here is another article from the same source that describes how to do the same thing using PowerShell.

Standard

2018-04-03

Lazarus and other Cross Platform GUIs

I’ve been thinking about cross-platform GUI toolkits since sometime last night.

I typically use Tcl and Tk for writing quick GUI applications. I think that’s a great combination for prototyping.

However, I’ve been wondering what I would use if I had a bigger application.

The obvious contenders are:

  • C++ with WxWidgets
  • C++ with Qt
  • Java with Swing

However, I took a look at Lazarus again, and tried it out.

I’ve only used it briefly on Windows so far, but it’s been a way easier process than trying to get going with the other options.

It’s still pretty niche, but it continues to be developed, and has a good reputation by people who use it.

Now I’m trying to figure out if there is a way to develop a GUI using it, that can interface with other languages that I’m interested in.

Pascal can call into C, so that’s one way to do it. The ease of that method of interface would depend on how easy it is to talk to C from the other language.

Standard

2018-04-02

Easter Weekend

I didn’t work on the blog at all this weekend. I don’t know if that’s going to be typical, or if it was just an artifact of this weekend being Easter. It’s easy between dealing with the kids, and interacting with my wife, to never have time to focus on coding for a long period.

Two solutions I can see to this might be:

  • Get up early in the morning and work on personal programming in the morning. This might or might not work – the kids tend to also wake up early and might want to play.
  • Try to have bite size tasks to work on, and have things setup where I can immediately get to my code to work on it. That doesn’t really allow for research or discovery time, where I don’t really know what I’m doing yet, and still need to figure it out.

Mercurial Add files

I mostly interact with Mercurial on Windows through TortoiseHG. But I’ve been trying to script using the command line lately.

I needed to script adding new files to the repository without having to confirm each one.

It turns out to do that you use the -A option, so the mercurial command looks like:

hg commit -Am "<message>"

I guess because of Git, I was expecting the add option to be -a, so Mercurial’s use of a capital in the option took me by surprise.

However, now that I’ve really looked at the details, the -A for Mercurial and the -a for Git are somewhat different scenarios.

For Git the -a does not include adding files that Git does not already know about, whereas for Mercurial it does. So that probably justifies the capital letter for Mercurial, whereas for Git, adding an untracked file is a separate command first:

git add

Launching Chrome from Tcl on Windows

I’ve been working on getting a preview (really a post-view) of blog post changes in my blog post script.

So, I’ve been trying to figure out how to launch Chrome pointing at web page from a script.

It turns out that on Windows 10 the easiest way to start chrome from the command line is using "start":

start chrome <url>

However, it’s not quite that simple from a Tcl script because Tcl doesn’t know where to find "start". So you have to launch an instance of cmd.exe and give that the start command.

Thus it becomes (from Tcl):

exec cmd.exe /c start chrome <url>

Unproductive

I’m ignoring my guideline of no internet before noon today. My productivity will probably suffer.

However, I’ve learned some interesting things. Or at least it feels that way. Maybe that’s the problem with the internet – it feels important while you are doing it, but after the fact you look back and say – "What did I really gain from that?".

That is especially prevalent on Twitter, which is the extreme end of the spectrum for me. It is the epitome of urgent but ultimately meaningless.

At least the stuff I was looking at this morning was research inspired by coding. And I found some packages that might be interesting if I look at them further.

I also found some interesting people to read more about. Sadly, I also found out that one of the people I’ve enjoyed following over the years has decided to stop writing publicly again.

Single click blog post

Right now I’ve got:

  1. a Windows shortcut
  2. that starts a Windows .bat file
  3. that executes a Tcl script that does everything else.

That’s a lot of indirections.

However, I can now click on a file, and get the entire process rolling.

Morning Productivity

One consequence of my guideline of no internet use before noon is that I am more likely to read material that I have previously saved offline. Some of that stuff I would probably never have the patience to read if it was competing against the instant gratification game of the internet.

For example, I am current reading Category Theory for Programmers, which I haven’t in the past been willing to put the effort into. But now, I have the focus to be able to work through it when my morning workload is light, instead of going toward instant distractions.

Apache Rivet

This morning I was reminded of Apache Rivet, which is a project that embeds a Tcl interpreter into Apache much like mod_php embeds PHP.

I don’t know if I have an immediate use for it, but it seems like it has had some recent updates, or at least someone verified that it is working on current version of Apache on Windows.

Since I’ve decided to focus on Apache as my production HTTP server instead of Nginx with fastcgi, this seems like it might be useful.

For me, Apache makes more sense as the application delivery platform than Nginx. I’m more familiar with configuring Apache and Apache seems more flexible without having to pull in FastCGI.

I am still planning to use Nginx for SSL termination. I might also use it for caching if I don’t stick Varnish in between Nginx and Apache.

Tcl Alive

Looking at Tcl this morning, there seemed to be more signs of stable life than previous times I’ve looked at it recently.

Un-Spiritual Life

I want to write more about spiritual life, but I haven’t really read the Bible in a few days or prayed. For me particularly, if I haven’t been doing activities that promote thinking about God or the kingdom of heaven, I don’t dwell on them.

Jesus said "Abide in me, and you will bear much fruit."

I see clearly that if I am not doing things that cause me to think about God, my life suffers.

It is not just that my "spiritual life" suffers if I’m not dwelling in my thoughts on God. It’s also that I am less happy, and I am less inspired in my normal life. I am also less likely to act in ways that are helpful to myself or others.

Go and PHP

I’m pretty sure I want to transition my bookmark app from PHP to Go at some point.

Doing so would decouple the bookmark app from Apache and allow it to run in whatever other environment I might want it to in the future.

I’ve been thinking about how to decide between PHP and Go for different application. For example, why PHP for the blog but Go for the bookmark app? I think the decision really boils down to …

Do I know how to build the app?

  • If yes, build it in Go
  • If no, build it in PHP

I think it might make sense to prototype things in PHP and then rewrite them in Go. PHP is much more flexible than Go as far as adding to the project on the fly. Once the application is nailed down and stabilized, then the higher performance of Go becomes attractive.

Both PHP and Go are easier for me to deal with as far as building web apps than Python, Ruby, or C#.

A Little Blah

I’m feeling a little blah this afternoon. Maybe it’s because I haven’t really eaten lunch. Whatever …

Blog Next Steps

I’ve been thinking about the next things I need to do for this blog.

I still need to figure out what I want to do about permalinks for posts, or separate entries for posts or essays. I also need to figure out how I want to deal with images. I suppose I could host images somewhere else, which might be easier than figuring out how to upload images to my server. But that seems like an easy way to lose control of my images or pictures, or let them disappear if I’m not paying attention. I also still want to come up with two archive listings, one by date and one by topic. And I need to point connorberry.com to this new blog instead of the error page it currently goes to. Also, it desperately needs some more styling.

So far, the blog still needs:

  • A topic index
  • A date index[
  • Permalinks
  • A solution for essays
  • Some way to deal with images
  • Better styling
  • A domain name that points directly to it

Poem

   Strange day in which I live
   can't find Spirit, heart or edge.
   Maybe I could find a way
   if I could live another day
   
   Where wolves dwell or willows weep
   and trees and mortals intermix
   And find myself a single tree
   where mountains meet the sea
Standard