MacBook, defective by design banner

title:
Put the knife down and take a green herb, dude.


descrip:

One feller's views on the state of everyday computer science & its application (and now, OTHER STUFF) who isn't rich enough to shell out for www.myfreakinfirst-andlast-name.com

Using 89% of the same design the blog had in 2001.

FOR ENTERTAINMENT PURPOSES ONLY!!!
Back-up your data and, when you bike, always wear white.
x

MarkUpDown is the best Markdown editor for professionals on Windows 10.

It includes two-pane live preview, in-app uploads to imgur for image hosting, and MultiMarkdown table support.

Features you won't find anywhere else include...

You've wasted more than $15 of your time looking for a great Markdown editor.

Stop looking. MarkUpDown is the app you're looking for.

Learn more or head over to the 'Store now!

Tuesday, August 15, 2017

Ran into this question about diffing blocks of text on StackOverflow yesterday after KDiff3 and WinMerge both went crazy trying to diff a file where I'd simply mostly just grouped and, therefore, rearranged lots of methods. Seems like an easy issue, but as that question points out...

Is there a diff-like algorithm that handles moving block of lines? - Stack Overflow:

But it falls down when blocks of text are moved within the file.

Suppose you have the following two files, a.txt and b.txt (imagine that they're both hundreds of lines long rather than just 6):

a.txt   b.txt
-----   -----
1       4
2       5
3       6
4       1
5       2
6       3

diff a.txt b.txt shows this:

$ diff a.txt b.txt 
1,3d0
< 1
< 2
< 3
6a4,6
> 1
> 2
> 3

That really is painful, when it should be a reasonably easy process.

Now I've tried to write my own diff engine before in my usual bullheaded, straight-ahead style, not worrying about efficiency until after something's working. It's not easy. But what you can say is that if you take it as your primary mission to find block movements, it's a lot easier. Enter wikEd diff Online Tool - Cacycle, "The Only JavaScript Diff Library for Visual Inline Text Comparisons With Block Move Highlighting and Character/Word-Based Resolution".

Results are pretty good, both for the simplest case from the SO question, to real-world code.

wikEd example using example from SO question

(The green highlight is for grouping a block, but by default it ignores/doesn't highlight any moved blocks, which is nice when you're diffing code like I mentioned before...)

Now I have to resist the desire to put this into a full-fledged UWP app whose goal is to be a diff tool. There are smarter things to write on my own time. Please realize this, self.

Labels: , ,


posted by ruffin at 8/15/2017 10:02:00 AM
0 comments
Sunday, July 30, 2017

There's a reason John Gruber's initial spec for Markdown didn't approach the level of complexity the CommonMark people wanted: You end up with exceptionally wordy jive like what we find for list items.

From commonmark.org:

And let M be the marker 1., and N = 2. Then rule #1 says that the following is an ordered list item with start number 1, and the same contents as Ls:

[example removed -mfn]

The most important thing to notice is that the position of the text after the list marker determines how much indentation is needed in subsequent blocks in the list item. If the list marker takes up two spaces, and there are three spaces between the list marker and the next non-whitespace character, then blocks must be indented five spaces in order to fall under the list item.

Phew. That was fun, wasn't it?

I was in the CommonMark spec today for two reasons. First, I fairly recently (well, months ago) swapped my main Markdown engine to the .NET CommonMark renderer (don't worry; table support and other features are done outside of CommonMark). Second, I wanted to know why only two of the following were creating nested lists, though my old renderer would create nested lists from all three.

1. Testing ye olde bullet points
    2. Still testing
    3. Testing

1. Testing ye olde bullet points
    * Still testing
    * Testing

1. Testing ye olde bullet points
    1. Still Testing
    2. Testing

Curious? You've probably guessed, but here's the rendered HTML, first as HTML, then the HTML source.

  1. Testing ye olde bullet points 2. Still testing 3. Testing
  1. Testing ye olde bullet points
    • Still testing
    • Testing
  1. Testing ye olde bullet points
    1. Still Testing
    2. Testing
<ol>
<li>Testing ye olde bullet points
2. Still testing
3. Testing</li>
</ol>
<ol>
<li>Testing ye olde bullet points
<ul>
<li>Still testing</li>
<li>Testing</li>
</ul>
</li>
</ol>
<ol>
<li>Testing ye olde bullet points
<ol>
<li>Still Testing</li>
<li>Testing</li>
</ol>
</li>
</ol>

See what happened there? If your nested list starts with a 2., as in the first example, though that'd be a bulleted list without the nest...

2. See? It's still...
4. a list.
  1. See? It's still...
  2. a list.

... it's not when nested.

Note that CommonMark is paying attention to the starting number of your ordered list. See how the list, above, starts with 2., though the next bullet is a 3., even though I used 4. in the raw Markdown?

Why is the nesting ignored in the first example? The spec tells us:

From commonmark.org:

Since it is well established Markdown practice to allow lists to interrupt paragraphs inside list items, the principle of uniformity requires us to allow this outside list items as well. (reStructuredText takes a different approach, requiring blank lines before lists even inside other list items.)

In order to solve of unwanted lists in paragraphs with hard-wrapped numerals, we allow only lists starting with 1 to interrupt paragraphs. Thus,

The number of windows in my house is
14.  The number of doors is 6.
<p>The number of windows in my house is
14.  The number of doors is 6.</p>

We may still get an unintended result in cases like

The number of windows in my house is
1.  The number of doors is 6.
<p>The number of windows in my house is</p>
<ol>
<li>The number of doors is 6.</li>
</ol>

but this rule should prevent most spurious list captures. [emphasis mine -mfn]

Make sense? 1. is special. If your nest doesn't start with 1., CommonMark thinks you're in the same "paragraph", give or take. You're not going to get that nest.

Which means MarkUpDown needs to capture when someone has a bullet from a numbered list, hits return, gets the next number automatically inserted...

1. They enter this first bullet.
2. Hit return and get a two. Then hit tab...

... which leaves them with...

1. They enter this first bullet.
    2. Hit return and get a two. Then hit tab...

... which doesn't render as a nested list. What they likely want is...

1. They enter this first bullet.
    1. Hit return and get a two. Then hit tab...

I'd hoped to get in automatic renumbering of ordered lists anyhow, but we'll start with this simpler change first... if it looks nested, we're going to reset the number to 1.

I realize this is a pretty boring post if you're not a Markdown aficionado. I've got some more interesting drafts around here somewhars. I'll try to find time to post them, but this one bugged me enough to write up.

Labels: , ,


posted by ruffin at 7/30/2017 10:36:00 PM
0 comments
Friday, July 14, 2017

From AppleInsider, reporting on a Wall Street Journal article:

Citing Hollywood studio sources, The Wall Street Journal on Sunday said Apple's share for selling and renting movies, as well as other video content, has dropped to between 20 percent and 35 percent, down from over 50 percent as recently as 2012.

The steep decline comes as competitors Amazon and Comcast enjoy market share gains on the back of aggressive industry moves.

...

Interestingly, the loss of market share is not uniform across genres, the report said. For example, iTunes is a top distributor of independent movies, as Apple promotes and signs exclusive deals for films made outside of the traditional movie studio system, sources said.

Anyone who is surprised by this, raise their hand.

The more interesting question is why Apple cares. I understand they've successfully made the transistion from selling DRM'd media files to selling streaming subscriptions with music. But what's different between music and video?

Apple doesn't make music. They sell subscriptions to listen to everyone's music, not music they produce. I realize they tried to become a cable provider and didn't quite make it, but this Netflix approach they're trying with Planet of the Apps? I'm not a huge fan. Signing independent movies might be a smart move, but why even bother with video subscriptions? What does Apple really want to look like in 15 years?

Apple doesn't tend to have its finger on the pulse of what's popular. I think back to the proverbially skeuomorphic iOSes before 7. And Ping. There's nothing about Apple that says they're great at following the wave. They were fortunate enough to get in front of the wave thrice, but they've never caught one.

I wish they'd stop trying.

Labels: , ,


posted by ruffin at 7/14/2017 11:18:00 PM
0 comments
Friday, May 05, 2017

JavaScript transpilation is a neat trick, but in practice you may seem to simply trade one multifaceted, shifting platform -- what works crossbrowser -- for another -- here, a set of constantly changing hipster libraries.

There are simple solutions to the shifting , each with one major flaw:

  • Target a "lowest common denominator" or "limiting reagent" browser (ie, IE[x]) with "native" JavaScript.
    • This stinks because even IE11's tools are much worse than Chrome's DevTools.
    • Yet if you don't live in your "worst" browser, you're going to miss issues. No, you are. Every time.
  • Pick one set of transpiled technologies & practices, and, within reason, stop.
    • You're still going to have to test in browsers
    • You'll still be responsible for debugging third-party code.
    • You'll disappoint your hipster programmers.

Interpreted incorrectly, transpilation gives the impression that you're developing for an environment like a server: a controlled, homogenous system. You're not. It's not node. And I've yet to see a practical advantage beyond very specific, situated uses -- JSX compilation for React, for example -- provided transpilation. It's all still very familiar zeroes and ones.

Labels: , , ,


posted by ruffin at 5/05/2017 09:48:00 AM
0 comments
Saturday, March 25, 2017

From The Guilty Secret of Distracted Parenting:

And [my children] might point out that when we did sit down, I surreptitiously read the newspaper at the breakfast table. And I pulled a book out of my bag at the playground if I thought I could get away with it. Speaking of old technologies, at our day care center there was one father — a big-shot professor — who was so brave that he did the worktime while wearing his Walkman (remember those?).

And for that matter, may I call as my witness Abraham Lincoln, who is reported to have walked up and down the street in Springfield, Ill., in the mid-1800s, pulling his young sons in a wagon while reading a book (and as the story goes, he went right on reading when a child fell out of the wagon).

I tweeted about a parent I overhead a few weeks back with the gall to tell their give-or-take six year-old, "When I'm on my phone, you DO NOT do that!" We are more distracted as a society, but I enjoy the way this NY Times piece reminds us it's not like this is a new thing. I used to always carry around a paperback until, well, until I could carry the books around even more conveniently on my phone.

What's more important to realize, perhaps, is just how many "distractions" of the 80s (and before) aren't considered distractions today. Talking to someone else, regarding the birds flying, checking out cars on the street... the things we used to do to give our brains a break before would often be considered contemplative and "authentic" engagments today.

Why is that? I think there's some small part of the distinction that's linked to feeling "productive". Phone distractions are measurable. Your digital distractions have metrics. Children, birds, conversations are all unique experiences. You can't, much as Instagram & Facebook tries, share breakfast with others with your network online, not really, not, to borrow a term, losslessly. Distractions that aren't swipeable are in a newly reconfigured set of experiences of unmeasurables.

We no longer value the unmeasurable enough. Before, the unmeasurables were valid pursuits on their own merits. We only had to justify their value to ourselves. Now, unable to "share" them fully as digital copies (and have their worth rubber-stamped by our virtual selves), we undervalue them -- while at the same time lamenting their loss as we search for a new term that could reinvigorate their value in a society no longer predisposed to appreciate them.

I should go to sleep. ;^)

Labels: ,


posted by ruffin at 3/25/2017 01:52:00 AM
0 comments
Friday, March 24, 2017

You might already know that Joel Spolsky's comment, "Old code doesn't rust", is one of my favorites.

But did you realize what a great time capsule that post is with Joel on Software's template redesign?

Joel Spolsky -- then and now

Wow. What a difference sixteen years makes. Why couldn't young Joel find good food? The horrors of bootstrapping, I guess.

I cringe to think of doing a similar comparison for myself. ;^)

Labels:


posted by ruffin at 3/24/2017 09:19:00 AM
0 comments
Tuesday, March 21, 2017

If you're not using Chrome Dev Tools JavaScript Blackboxing, you're doing yourself a serious disservice.

I've been working with some stuff that's heavily React and mobx-i-fied, and constantly get dumped into those third party libraries. With Blackboxing, I can put those and any other third-party libraries into the black box, and will automatically jump over all of that code.

It's beautiful to skip over all third-party libraries. I kid you not. Beautiful.

What I hate is that this stuff seems to have been around in at least pre-release form since 2014!

(>ლ)

Labels: , , ,


posted by ruffin at 3/21/2017 01:04:00 PM
0 comments

Support freedom
All posts can be accessed here:


Just the last year o' posts:

URLs I want to remember:
* Atari 2600 programming on your Mac
* joel on software (tip pt)
* Professional links: resume, github, paltry StackOverflow * Regular Expression Introduction (copy)
* The hex editor whose name I forget
* JSONLint to pretty-ify JSON
* Using CommonDialog in VB 6 * Free zip utils
* git repo mapped drive setup * Regex Tester
* Read the bits about the zone * Find column in sql server db by name
* Giant ASCII Textifier in Stick Figures (in Ivrit) * Quick intro to Javascript
* Don't [over-]sweat "micro-optimization" * Parsing str's in VB6
* .ToString("yyyy-MM-dd HH:mm:ss.fff", CultureInfo.InvariantCulture); (src) * Break on a Lenovo T430: Fn+Alt+B
email if ya gotta, RSS if ya wanna RSS, (◔_◔), ¢, & Δ if you're keypadless


Powered by Blogger etree.org Curmudgeon Gamer badge
The postings on this site are [usually] my own and do not necessarily reflect the views of any employer, past or present, or other entity.