2018-03-30

Thoughts About New Blog

I’ve finally (baring errors) transferred all my old posts into my new blog.

Doing so has caused me to think about what I’ve spent my time writing about.

So much of the code that I’ve posted feels irrelevant now, and there were many posts dealing with computer technology that also feel like they haven’t provided lasting value. I’m wondering if in the future I’ll mostly post stuff about personal thoughts rather than technology.

I could still see posting about technology if I was trying to teach specific topics, but just posting random snippets doesn’t seem as useful. On the other hand, maybe if I do solve specific problems, maybe it would be useful to post those in case others have the same problems, or in case I have the same problem later (which has happened in the past).


Deft vs Org

I’ve been using Org mode for the last several years off and on for my personal note taking and information storage. Before that I used a package for Emacs called Deft that is very similar to the Mac note taking app Notational Velocity

There are things I like about Org mode that I like, but I haven’t ever found myself really using all it’s features. This morning I started considering if going back to Deft, but using it with Markdown would make sense instead of Org.

There would be some advantages and disadvantages to such a move.

If I used Deft with Markdown, it would be trivial to transfer those entries to my blog. And Deft would allow me to be fairly specific with what I’m working on at the moment without having to use folding. But Deft would create a lot of files if I was using a separate file for every note, and that would make it a little harder to keep in version control, because I would have to add all those files after I created them if I wanted to protect them in version control.

On the other hand, Org mode allows folding, but there are times that makes me nervous that I’m going to somehow delete something that is currently folded without me realizing it. However, because of the folding, Org mode allows me to have many topics in one file, without having to pay attention to what I’m not interested in, by hiding away the outline nodes that I’m ignoring.

I don’t really use the Org mode outline restructuring functions anymore. I’ve been bitten a few times by not understanding how they were going to effect the structure, so now I mostly avoid them and restructure by direct cut and paste.

Org does allow task tracking, with automated agendas, but I haven’t been using that much either these days, since I’m not always at my computer, having a paper based planner seems to be more effective for me these days.

Also, markdown is easy to transform in ways that I care about, whereas, while I know it’s possible with Org, it’s enough harder to figure out that I haven’t really been happy with my attempts so far.

As a result I don’t know that I’m actually getting that much benefit from Org mode these days. I don’t dislike it, but I don’t find myself engaged with it.

In contrast, when I was using Deft, I enjoyed it.


Fish

I think I accidentally ate some fish this morning. At the moment I think I’m ok, but if something happens:

Jayne I love you


Pandoc and Org

The new version of Pandoc (the program I’m currently using to process my blog entries) also handles Org files now. So maybe it’s not such a steep transition to be able to take notes that I’ve got in Org, and transfer them to HTML for my blog.


Prototyping

I’ve been thinking about prototyping applications.

I feel like a lot of my computer skills are oriented around prototyping. I know a lot of languages that excel at creating prototypes.

Things that I feel like are useful in languages for prototyping:

  • They need to make it easy to get something working quickly
  • They need to work together with other programs easily

Given those two things, you can string together lots of little application to get something that works for the task.

Generally what you create won’t be elegant. But if you can solve the problem with it, then you have a much greater understanding of what you are doing, if you want to then create a more elegant application to solve the same problem.

I am realizing that I need to approach problems by starting with a prototype. I need to get something working as soon as possible, and it doesn’t matter if it is in an ugly language or collection of ugly languages.

I have found that if I don’t start by prototyping, I generally won’t start. I will spend my time studying the good languages to use, and flailing around trying to figure out what to use, but won’t get over the initial friction to get something actually started and working.

On the other hand, when I prototype first, I get something running. And I also learn about the actual issues that are lurking beneath the surface, that also need to be solved. But in this case, I have actually made progress. And once I know what I’m doing, I can realistically think about a more elegant rewrite. At that point I can use a more structured language and create one application instead of stringing together separate utilities to achieve my goals.


Prototyping Languages

Languages that I find especially useful for prototyping:

  • Go
  • Perl
  • Tcl
  • PHP
  • Unix Shell

These are all languages that seem to have a bias towards getting something working quickly. They may not be the best at handling edge cases, but they get me initial functionality quickest.

They are fairly simple to use, fairly simple to teach, and have decent documentation available.

In most cases, given a little initial familiarity, one can just sit down and start using them, and figure things out as they go.

Perl is maybe the exception to the easy to learn, easy to teach criteria above. However, if one keeps it’s use to scripts of one file, and to such tasks as Learning Perl teaches, then I think it holds.


Desktop Blog Editor

I’m starting to think about writing an app to help automate all the steps in creating a new post and publishing it to my blog.

I had imagined that it would include an editing pane, but it could be as simple as a toolbar with buttons to perform the following actions:

  • launch an editor
  • commit to local repository
  • push to remote repository
  • submit http request to update blog to latest version

Desktop Blog Script

So far I have a quick script written in Tcl that allows me to:

  1. Launch Vim
  2. commit to my local repository
  3. push to my remote repository
  4. submit an http request to update my blog to the latest version.

There is no graphical component at the moment, but I don’t think it would be hard to add one if I want to.


Blog Entry Scheme

Currently the way that this blog works is that there is one file per day. If there are more than one post per day, they are just subheadings in that daily file.

This doesn’t allow for the possibility of writing essays that would need to stand alone.

There are a couple of possibilities that I can see to address this.

One possibility would be to instead save each entry in it’s own file. Then the blog could be reworked to collect all the posts for one day and concatenate them before displaying them. Or each post could be separate not combined in a per day display.

I could see doing that either by embedding the date and post number in the filename, or by inserting that into metadata in the file somehow.

Another possible solution to allow the ability for standalone essays would be to just have a separate stream for essays. Either, the file would indicate that it is an essay, or perhaps it goes in a separate directory for essays.

These would be displayed by themselves, perhaps not even in the normal day by day navigation. They migth have a separate listing of all of the essays, while the regular posts would form more of a "journal".


Testing Tcl Raise Focus

I’m testing whether my automated script from earlier can display a dialog when the blog is finished updating.

After

The Tcl command after can be used to either schedule a task to run after a certain length of time, or without a script to force a synchronous sleep for a certain length of time.

Update Idletasks

Tcl has an update idletasks command that causes any pending tasks that are waiting for an idle moment to run, to instead be force run immediately even if it blocks other updates momentarily.

Dialog problems

I’m trying to get my Tcl script to display a dialog announcing that the update process is finished. So far it isn’t working. I’m not sure if it’s an interaction between the sleep and the repaint cycle, or something else at this point.

Focus command

Tk’s focus command with the -force option seems like it should make the label visible.

Update: all this seems to do is cause the taskbar icon to flash on Windows 10.

Tcl wm attributes -topmost

Trying this next wm <window> attributes -topmost to attempt to get this to work.

Note: I think this needs to be a toplevel window for this to work.

Note: So far this method has not worked.

Further testing

So far nothing has worked. I’m now trying to get the dialog that I need on the screen before other applications take the focus away.

Final results

So far I have not been able to achieve the dialog box. At the moment that is not a big deal, however, I may try again later.

I am currently considering just shelling out to powershell to have it display a dialog.


Wondering whether tclkit requires a forced exit if I’m not obviously using Tk.

So far the answer is yes.


Testing again

testing tk_messageBox to see if it will raise focus

update: The answer is no.

Testing deiconify

maybe deiconify will work. maybe … maybe … maybe … maybe … no


Next Steps for Blog

At this point I have posting working in some sense, and all of my previous posts imported.

I’m at the point where I can write whenever and whatever I want and have it show up.

I think the next thing I would like to focus on is redoing the post ids so that I can get some kind of permalinks to specific pages or posts.


Blog Thoughts

Today I wrote a fair amount.

One thing I’m realizing that I’m not sure if I like is the way that the blog looks when there are a lot of posts or words on one day.

Maybe it’s something I can address with styling or fonts but at the moment, once the text goes to the bottom of the screen it starts to feel a bit overwhelming.

Maybe that is because I’ve got my monitors at work set up vertically, maybe it wouldn’t be the same feeling if I was looking at it on a laptop or a monitor setup normally.


Pandoc "Smart" option

There is a difference between the version of Pandoc that is running on my current server and the version of Pandoc that I have installed locally on my Windows workstation.

The version on my Windows workstation is more current and by default translates some characters (for example apostrophes or single quotes) to some kind of special unicode representation.

The version of Pandoc on my server is older and does not.

The achieve the older behavior where a quote is just a quote, you need the filter I think you need to run -f markdown-smart instead of just -f markdown.

Standard

2018-03-23

Change and Obsolescence

I’ve been spending the last week or so transcribing or reformatting posts from my old blog into markdown to go on my new blog.

A lot of those posts have been about technology topics. A lot of that stuff that I wrote 5 to 10 years ago is now probably out of date or obsolete. How much is it worth me putting effort into talking about those kinds of topics? If I spend time today talking about technology, those things will be worthless in another 5 to 10 years.

If I focus on things that don’t change, or that will last, then potentially someone else could gain some value from what I write down the road.

Incantations

This is the line of commands that lets me know how many words I’ve transcribed into the new blog today:

ls -l | grep 'Mar 23' | perl -lna -e 'print $F[-1]' | xargs cat | wc -w

Looking at this, I can’t help the feeling, how is this not some kind of magic spell in a secret language?

Who outside of someone who had studied strange things for too long, could even understand what this line of text is doing?

Yet it tells me that so far I’ve transcribed or written 9112 words today.

Standard

2018-03-22

Showing Off

I’m showing off the innards of my current blog implementation.

Hopefully after I create this file in a local repository and committing and pushing to the remote repository the blog will draw from the remote repository and then post it.

Vim Spell Check

One cool thing about Vim that I don’t think many other editors have is a fairly robust spell checking functionality.

To turn it on just do:

:set spell

Then whatever text you are editing will be spell checked on the fly.

I don’t use it much while programming, but I find it useful while writing prose.

Standard

2014-12-11

Language Comparison

Perl:

while (<>) { print "$. : $_" }

Perl:

while (<>) {
  print "$. : $_"
}

CSharp:

using System;
using System.IO;

class App {
	public static void Main(string[] args) {
		int line_number = 1;
		foreach (string arg in args) {
			foreach (string line in File.ReadLines(arg)) {
				Console.WriteLine(line_number + ":" + line);
				line_number++;
			}
		}
	}
}

Python:

import sys

for arg in sys.argv[1:]:
	for index, line in enumerate(open(arg).readlines()):
		print(index + 1, ":", line, end='')

Golang:

package main

import (
	"fmt"
	"os"
	"bufio"
)

func main() {
	line_number := 1
	for _, arg := range os.Args[1:] {
		file, _ := os.Open(arg)

		scanner := bufio.NewScanner(file)
		for scanner.Scan() {
			fmt.Printf("%d : %s\n", line_number, scanner.Text())
			line_number++;
		}
	}
}

Java:

import java.io.*;
import java.util.*;

class Linum {
        public static void main(String[] args) throws FileNotFoundException {
                int line_number = 1;
                for (String arg : args) {
                        Scanner s = new Scanner(new BufferedReader(new FileReader(arg)));

                        while (s.hasNextLine()) {
                                System.out.println(line_number + " : " + s.nextLine());
                                line_number++;
                        }
                }
        }
}

Ruby:

while gets
  puts "#{$.} : #{$_}"
end
Standard

2014-06-18

Food for Two (or three)

Jayne and I went to Olive Garden tonight and took Hiram. We all just ate soup and an appetizer of fried raviolis and fried zucchinis. It was one of the best meals I remember at Olive Garden. It was really simple, but everything tasted really good.

We are trying to cut back our spending on going out to eat, so it was nice to have a really enjoyable meal that was pretty affordable. Over the weekend we also went to La Hacienda Ranch to celebrate Father’s Day with Jayne’s dad. That is another restaurant where one can get a really enjoyable meal for two fairly cheaply. The veggie fajitas for 1 (but shared between two) seems like an excellent choice.

The One Thing I Don’t Like about Scala (so far)

The one thing I’ve found so far about Scala that I don’t like is a tendency to have syntactic shortcuts in certain situations that are not very regular with the rest of the language. One example specifically is in the way that you can define a curried function that takes 2 arguments and then call it with the second argument enclosed in curly brackets ("{" and "}") rather than parenthesis. This seems to be so that you can mimic the look of Scala’s native control structures. However, I believe you can only have one argument (one expression?) in between the curly brackets, which breaks the expectation that curly brackets usually enclose a block. That expectation is set not just by c based languages like C, C++, Java, C# and JavaScript, but also in most other cases by Scala itself.

This breaking of expectation is what frustrates me the most about Scala, because otherwise I really like the language. In general it does a really good job of unifying object oriented and functional concepts, so that semantically it reminds me of a cross between Smalltalk or Ruby and SML. In fact, along with Ruby, I think of it as one of the few languages to really get object orientation right. The frustrating thing about the ways that syntactic sugar seems to have been added for convenience rather than coherence is that it’s not obvious why the shortcuts are that much better than the desugared alternatives. Now this criticism isn’t applicable to all syntactic sugar in Scala, some of it is done really well. But there are enough places where it is rough, that it feels like there is a constant slight cognitive load to the language that doesn’t need to be there.

Even though I’ve noticed these little nits, I still plan to keep using it. Overall, I really like the language. I find it’s support for functional programming refreshing, and I think the way it deals with objects makes dealing with them a lot nicer than in C# or Java.

Standard

2014-06-16

Blathering about Blogging

I’m just blathering about blogging today. If I was going to try to do a blog I think it would be valuable to concentrate on doing actually valuable writing. Maybe it would make sense to do about 1 essay per week and then try to post something in the roughly 200 word range each day. Something like 200 words a day and a 1000 word essay per week. Something like that I think could actually be fairly valuable. I still don’t really know what platform I’d like to use for blogging.

I think I’d like to modify my blog layout so that there is a clear delineation between daily posts that can be just blather and essays and tutorials that should be better written.

Standard

2014-05-22

Testing

I’m just trying out the mobile optimized version of the web post editor on my Blackberry.

Mobile WordPress

I’m just testing the mobile optimized version of the WordPress website to see how well the web based editor and dashboard look on my BlackBerry Q10.

I’d probably prefer a native app for the BlackBerry, but since there isn’t one currently, I think this will be adequate.

Standard

2014-02-20

inactive

It’s been almost a year since my last post. I’ve been journaling mostly offline for a while. I’ve been trying to write 1000 words a day each day. A lot of the time I achieve that, some days I don’t. But I haven’t been good at going back through my writing to pull out things and put them up here on the blog. I’d like to start doing a better job of that.


Thoughts on Lua

I’ve been messing with Lua for the past week or so. I’ve been fairly successfully using it to go through the challenges on code eval (sea6ear on the leaderboard).

So far I really like Lua. I’m kind of a sucker for simplicity and performance, and the abstraction abilities of Lua are pretty good for a language that isn’t Scheme, Common Lisp or Haskell.

However, I’ve used it enough recently that I’ve started to see what are probably the most obvious annoyances. [note: I’ve only been using it steadily for a week, I’m still a newbie. these are mostly first impressions.] Also these are more gotchas than showstoppers, I think once you hit these and are aware of them, you can avoid them.

The most obvious annoyance once you start writing code is the need to explicitly declare local variables. It’s easy to forget and end up with global variables when you didn’t intend for them to be. This is pretty much the same way that JavaScript or Perl handle things, so this isn’t unique to Lua.

A more important annoyance is the interaction between two features that don’t seem dangerous in themselves. Lua automatically coerces values between numbers and strings. usually that’s something I find convenient. However, Lua’s tables also switch between acting like an array and acting like an associative array (dictionary/map/hash etc) based on whether integer indexing or string based (or other value) indexing is used.

What this means is that you have to be very careful when dealing with data that could be either a string or number and may be used as an index of a table. If you accidentally use it in the wrong format, or accidentally switch between trying to index with an integer vs string format, you will put or try to access data in the wrong part of the table. This can make it look like your data has disappeared when really it’s just been shuffled off to another part of the table that you weren’t trying to use right now.

On a different topic, and really just a minor annoyance, arrays are 1-based instead of 0-based. One based array indexing wouldn’t really be an annoyance except that the rest of the computer world has standardized on zero based indexing (except for awk, a language with some similar goals to lua). It’s not too bad in practice, except when you need to be translating between a zero-based scheme and the one-based scheme.

Overall I really like lua. I’m really impressed with it. It seems to have almost everything that I want to have in a language as far as semantics. I like that it has tail-call optimization so well constructed recursive functions don’t have to blow the stack. I like that functions can be passed as values. I like (overall) that tables are the central data structure and that you can use them to build all the other kinds of data structures that you desire. I think I will enjoy it’s lightweight approach to object orientation.

I wish that it was more evidently useful as a general class scripting language instead of being primarily thought of as a language for embedded scripting. On the other hand, I don’t want to change it so that it looses that focus. What I’d like to see is a real secondary distribution that had all the libraries to allow Lua to function in cross-platform general purpose fashion. (luarocks might be that, but I’m not sure how comprehensive it is or how widely it’s used. luadist seems like a similar attempt) so basically, I’d like the core distribution to stay small and focused, but there to be some kind of additional library or platform that would allow one to get all the libraries on needed for doing stand-alone work with lua.

I’m not sure how much work that would be. I’d like to see that happen. I want that enough that I’m willing to work to try to make that happen.

On the other hand, it looks like other people have occasionally tried similar things, and it doesn’t look like any of the other attempts that I saw (outside of luarocks, and maybe luadist?) have gotten persistent traction. Part of that may be that each other attempt at bundling additional functionality has been focused on some fairly narrow niche. I don’t know how much work it would be to create a curated library of various modules that would give you the basics you would need to do real work on various platforms. I’d like it to be something that you would download in addition to the standard lua download rather than instead of.

I’m not sure what kinds of additional functionality (outside the lua core) would be necessary for lua to be able to easily handle the same kinds of tasks that one would do in Python, Ruby or Perl.

Here’s what I can think of:

  • gui bindings
  • file system manipulation
  • http request libraries
  • web server capabilities
  • process interaction and control

Many of these exist in some form currently, but they are scattered and I’m unsure of the level of documentation or consistency of maintenance.

I wonder how many people focused on making it happen it would take to make Lua into a viable language for general purpose computing. I think it could probably be done with less than 20.

I think if I was involved in starting a company I would be tempted to use Lua for the scripting level (along with c for low-level, and erlang for very high-level tasks) in hopes that the company could contribute code to making Lua a viable language for general use outside the game industry and niche areas. Even though lua wouldn’t be as useful as python or ruby starting out, I think it would be worthwhile to focus on it and make libraries that did enable it to be used in a wide range of areas.

Lua could also use some more beginner oriented books. Programming in Lua is awesome, but it’s a pretty advanced text in terms of the language concepts it deals with. I would be interested in writing one of those beginner books once I am more familiar with it.

Standard

2013-03-17

Language Choices

I think that if things were up to me I’d have one list of languages that I concentrate on for continuous study and application development, and a list that I bounce around in for fun and study and making toys and stuff.

The core languages I’d concentrate on for continous study and industrial application development:

  • c++
  • perl
  • common lisp
  • ocaml

The languages for prototypes, utilities, fun, exploration and experimentation:

  • c
  • lua
  • javascript
  • scheme
  • tcl
  • smalltalk
  • forth
  • prolog
  • erlang
  • sml
  • awk
  • assembly

I think the core languages are strong enough that any of them could be used for almost any task, but there’s enough flexibility in the list to pick a good match for any particular use.

I’d use the larger list for single purpose apps and experimentation. Each of them is small enough that I think I could get into a partincular language for a month or so and either learn something useful or develop something small but real using it.

Standard