Monday, June 01, 2015
Slow clap
- From
- Sean Conner <sean@conman.org>
- To
- XXXXXXXXXXXXXXXXXXXXX
- Subject
- We wouldn't want anything to happen to the page rank on your nice website, now would we?
- Date
- Mon, 1 Jun 2015 00:10:00 -0400
- Mime-Version
- 1.0
- Content-Type
- text/plain; charset=utf-8
- Content-Disposition
- inline
- Content-Transfer-Encoding
- quoted-printable
- User-Agent
- Mutt/1.4.1i
<blockquote cite=3D"http://googlewebmastercentral.blogspot.jp/2014/08/https-as-ranking=
-signal.html"
title=3D"Official Google Webmaster Central Blog: HTTPS as a ranking signal=
"><p>For these reasons, over the past few months we=E2=80=99ve been running =
tests taking into account whether sites use secure, encrypted connections a=
s a signal in our search ranking algorithms. We've seen positive results, s=
Oh,
thank you mutt
!
Thank you so very much for deciding now was the perfect time to content-encode the post I sent to mod_blog
.
I've been using you for what,
ten years now?
And not once have you ever decided on this behavior before?
But for whatever reason
[There are non-7-bit characters in the email body and SMTP is not defined as being 8-bit clean so of cou—]
[SHUT UP, Editor! I'm on a rant here! —Sean]
[Okay. —Editor]
mutt
decided now was the time to encode the email,
breaking mod_blog
in a way I've never seen before.
Way to go,
mutt
.
Way to go!
<slow clap>
Tuesday, June 02, 2015
Level 3 Diagnostics
Early in my career I worked on military flight data recorders, including the development of the software for the F-22's "black box". Those systems have SBIT, IBIT, PBIT and MBIT sub-systems were BIT is "built in test" and S = startup, I = initiated, P = periodic and M = maintenance. I remember making the Star Trek diagnostic joke myself when I was assigned the SBIT work.
Each BIT does varying level of testing based on it's runtime budget but there are a lot of very basic tests that don't make much sense until you see your first field report of some register bit "sticking". Its much better to ground a plane that can't add 1+1 than to find that out in mid- flight.
This comment (one out of many comments about testing critical software) really hit home, especially given the testing currently going on here in the Ft. Lauderdale Office of The Corporation (with the Monopolistic Phone Company, who's mantra seems to be “it's your fault we're not ready for testing!”). While I would love to order a Level 3 Diagnostic, alas, our software is not written with such diagnostics in mind (and given the difficulty we've seen from the other side it's clear their software isn't either).
In fact, I'm having a hard time even figuring out what a “Level 3 Diagnostic” would even mean in the compoent I wrote, much less every other component involved with “Project: Sippy- Cup.”
Reading up on SBIT, IBIT, PBIT and MBIT sub-systems, it seems that it's really only applied to avionics and possibly automotive computer systems. The closest thing to it is the POST that most PCs do when powered on, which seems to be the functional equivelent of SBIT. The rest, IBIT, PBITand MBIT, not so much.
Out of all the components in “Project: Sippy-Cup,” only mine has an explicit “health-check” function built in (which just basically says, “Yes, I'm running” and that's it) which is close to PBIT(from my understanding); everything else is queried for known data at fixed intervals. But diagnostics seem to be “search the logs and/or configuration for for anomalous behavior.”
Sigh.
Leverage the synergy between my company and Google's social media empire and search engine with a side of mocha
That was weird.
“Google Plus” (which is Google's attempt at Facebook) just called me on my cellphone.
Yeah. I didn't believe it was Google Plus either.
At first, it was a robot wanting to talk to the “business owner” of “a website” and to press one to talk with a “specialist” who could help “leverage the synergy between my company and Google's social media empire and search engine with a side of mocha” (or something to that effect, I wasn't really paying much attention frankly; I was just amused that “Google Plus” would even be calling me about “my domain”). Okay, I can play along.
I press “one.”
“Hello there! How can I help you?”
“You called me. I'm the ‘business owner.’”
“Okay! And your business is … ?”
“You tell me. Which business are you calling about?”
“So you are the business owner of the domain?”
“That is a possibility. I do own several domains. Which one are you calling about?”
“Well! Okay! Let me pull up the domains that are associated with your phone number. Um … you are in ‘Bokka Ratone?’”
“Yes.”
“33431?”
“Yes, that is the zip code around these parts. So what domain are you calling about?”
“Webboar.”
“Excuse me?”
“webboar. The domain “webboar.’ Double-you ee bee bee oh ay are.”
“No, I never had that domain.”
“Really?”
“For true.”
“Okay, what about flummux.org?”
“Yes, that's one of mine.”
“And domaincrawler.com.”
“Nope. I don't have anything to do with that one.”
“Oh, my mistake, that's probably how we found you.”
“Okay.”
“And who does your marketing?”
“I do.”
“Okay. Web site design?”
“Tha would be me.”
“Oh. So, are you intersted in leveraging the synergy between your company and Google Plus? We offer full search engine optimization and can help you market your site via social media.”
“No, I am not interested in that at this time.”
“Really?”
“Really.”
“Okay then.” <click>
Really? 50%?
- From
- Fredrick Tamata <ftamata@vanuatu.gov.vu>
- To
- undisclosed-recipients:;
- Subject
- RE:
- Date
- Wed, 3 Jun 2015 05:28:56 +1100
Hello,
Let's split fifty percent each from a lucrative deal I will like to discus with you, please respond if you want to know more.
"Trevor H"
It's not calling random people up claiming to be Google Plus and trying to get them to sign up for guarenteed search engine optimization, is it?
But in any case, no.
Wednesday, June 03, 2015
Isn't this how the Toxic Avenger got his start?
My manager is apparently under pressure by the HR Department of the Corporation Overlord Corporation to get the rest of his team to fill out the Employee Goals on the Employee Goal Website De L'année, and thus, I am now under pressure by my manager to appease the HR Department of the Corporation Overlord Corporation by filling out my “goals” on the Employee Goals on the Employee Goal Website De L'année. The first hurdle was to figure out which of a dozen different account IDs I needed to log into this site, and which of two dozen passwords to use.
Once that was sorted out, I started the process of filling out my “goals.” Fortunately, there was a pull down menu of predefined “goals” I could select from to save me the cognative overload of trying to come up with plausible sounding “goals” instead of the “goals” I really wanted to add, like “become a vegetarian skateboarding cab driver who saves the world” or “overthrow the illegitimate government of Patagonia” or something else equally silly.
So I'm running down this list of pre-canned results, like “keep accurate records” and “deliver on revenue” when I see, and I kid you not, “ensures 100% of hazardous waste is re-used/re-processed.”
…
SCORE!
How can I not use that?
Thursday, June 04, 2015
You can't make it look too easy
As I mention in the video, what’s really interesting is that this locksmith was penalized for getting better at his profession. He was tipped better when he was an apprentice and it took him longer to pick a lock, even though he would often break the lock! Now that it takes him only a moment, his customers complain that he is overcharging and they don’t tip him. What this reveals is that consumers don’t value goods and services solely by their utility, benefit from the service, but also a sense of fairness relating to how much effort was exerted.
Via Hacker News, Dan Ariely » Blog Archive Locksmiths «
Even Richard Feynman knew this trick back in the 40s:
I didn't need any tools, but I'd go to my office and look up the number of his safe. I had the last two numbers for everybody's safe in my office. I'd put a screwdriver in my back pocket to account for the tool I claimed I needed. I'd go back to the room and close the door. The attitude is that this business about how you open safes is not something that everybody should know because it makes everything very unsafe. So I'd close the door and then sit down and read a magazine or do something. I'd average about 20 minutes of doing nothing, and then I'd open it. Well, I really opened it right away to see that everything was all right, and then I'd sit there for 20 minutes to give myself a good reputation that it wasn't too easy, that there was no trick to it. And then I'd come out, sweating a bit, and say, “It's open. There you are."
Los Alamos From Below: Reminiscences 1943-1945, by Richard Feynman
You can't make it too easy else people will question the work required to make it look easy. I'm reminded of this joke: A large mainframe computer is broken, so the company sends for a computer repair technician. The technician comes in and sits down in front of the mainframe computer for a few moments, opens one of the cabinets, pulls a card out and replaces it, then says, “That will be $5,000.”
“Five thousand?” says the company owner. “You just came in, sat for a minute and replaced a card. How is that worth five thousand dollars?”
“Well,” said the technician, “It's $100 for the new card, and $4,900 for the time and effort for me to learn which card to replace.”
Friday, June 05, 2015
It's such a buggy day
“There's an FPL truck in the neighborhood.”
“Well, that explains why I couldn't log onto my home computer.”
Bunny and I were coming home from an errand to Lowes. Bunny was picking up supplies for a project and I wanted to test the Wi-Fi hotspot on my iPhone. The Wi-Fi hotspot worked wonderfully.
But logging into my home computer, not so much. I figured something was going on, perhaps the Monopolistic Phone Company's DSL going down again but no, it was FPL again.
Sigh.
Normally,
I type my entries into a text file which I mail to mod_blog
.
But to do that,
I need to send the entry to my email server.
And to do that,
I need to be logged into my now powerless computer.
But wait,
I thought,
I have a web inerface to mod_blog
,
I should use that!
Only,
the
last change I made
broke the web interface
(technobabble:
the editing template had a field for
Facebook
but I removed all support for Facebook;
there is some memory corruption somewhere in the code—I need to track that down.
Can you tell I use the web interface often?).mod_blog
couldn't find support for the Facebook portion of the template which caused
Just as my iPhone was running out of power.
Sigh.
Fortunately,
FPL restored power just then,
and I was able to remove the offending portion of the template,
and I'm now trying this yet again through the web interface
(on my iPad)
running through the iPhone hotspot just to make sure it works in an emergency.
I'm going to have to debug mod_blog
some more before I can use the web interface;
the EPS isn't quite up to snuff.
Dog food
Well, let's see if it works this time.
I was able to track the issue down to a double call to free()
.
But the really scary bit is that the behavior only exhibited itself on the webserver;
on my development box,
I never saw the bug.
Sigh.
Debugging on a production server—never a good thing.
But more on that after I finish dogfooding the web interface on an iPad over the iPhone hotspot.
Saturday, June 06, 2015
I'm lucky in that I run the server, so I can do this type of debugging
As I was unable to reproduce the issue on the development system, but it was all too easy to reproduce on server, I had no choice but to debug on the server. It's not an ideal situation but in this case, as I run the server in question and the appropriate software tools are installed, I figured I might as well debug on the server.
The approach I took is one I've been using for a long time—insert this bit of code:
volatile int g_debug = 1; while(g_debug) ;
into the proper code path (in this case,
the program was crashing in
cmd_cgi_post_show()
,
which is the function called when I want to preview a post from the web interface).
Then I can submit the data,
the web server will spawn mod_blog
,
and the infinite loop will give me a chance to attach the debugger to it
(setting up a fake web environment to debug
CGI programs is a pain).
And from there,
it was pretty straightforward to isolate the issue by setting breakpoints and examining memory.
The issue ended up being multiple calls to free()
,
and I suppose the difference in behavior between the development system and server can be attributed to the different versions of the standard C library.
Yes,
in an ideal world,
there would be no difference between the two,
but this isn't an ideal world and I have to make do with what I have.
Sunday, June 07, 2015
A note to Sweden: we don't have one-fifth cups over here
“I want you to read the directions,” said Bunny. She dropped a packet of Swedish meatball sauce she picked up at Ikea on my desk.
I flip the package over and start reading. “Pour one and a third cup of water—”
Bunny interrupted. “Read closer.”
“One and a fifth?”
“Yes. One and a fifth.”
“There's no such measurement.”
“Yes.”
“Wow.”
The meatballs from Sweden
Dinner turned out fine.
Swedish meatballs, lingonberries, and green beans.
Mmmmmmmmm.
Monday, June 08, 2015
TempleOS
TempleOS is somewhat of a legend in the operating system community. Its sole author, Terry A. Davis, has spent the past 12 years attempting to create a new operating from scratch. Terry explains that God has instructed him to construct a temple, a 640×480 covenant of perfection. Unfortunately Terry also suffers from schizophrenia, and has a tendency to appear on various programming forums with a burst of strange, paranoid, and often racist comments. He is frequently banned from most forums.
This combination of TempleOS’s amateurish approach and Terry’s unfortunate outbursts have resulted in TempleOS being often regarded as something to be mocked, ignored, or forgotten. Many people have done some or all of those things, and it’s understandable why.
…
Perhaps we should instead look at TempleOS as a research operating system: what can be accomplished if you’re not locked into established thinking, backwards compatibility, and market demands.
What can we learn if we are only willing to listen?
Via Hacker News, codersnotes / A Constructive Look At TempleOS
I've been meaning to link to TempleOS for some time now. It's not pretty. It's written in its own language (loosely based on C). And it's programmer is schizophrenic. Which is a shame, since the resulting software is impressive.
Sure, it might not be easy to use for a normal user, but as a programmer? All code (and everything is written in HolyC, with just a smattering of assembly) instantly crosslinked and documented. Images and sounds are directly embedded in the source code. There really is no distinction between the shell, the text editor and anything else, really.
The last time software was built like this was in research labs in the 60s and 70s. TempleOS is an impressive piece of work for one man. Everything was written from scratch. And there exist a ton of online video tutorials on how it works (that is, if you can watch them—I find it difficult to watch for more than a few minutes as Terry is not easy to listen to, and it's often hard to follow what, exactly, is going on since the operating system is so out there).
Tuesday, June 09, 2015
Notes on a barely overhead conversation at The Ft. Lauderdale Office of The Corporation
Rattle rattle rattle rattle rattle rattle rattle rattle!
“HEY! IS THERE SOMETHIGN GOING ON?”
Rattle rattle rattle rattle rattle rattle rattle rattle!
“I CAN'T UNDERSTAND YOU! THERE'S SOMETHING GOING ON!”
Rattle rattle rattle rattle rattle rattle rattle rattle!
“WHAT?”
Rattle rattle rattle rattle rattle rattle rattle rattle!
“DID YOU ASK SOMETHING?”
Rattle rattle rattle rattle rattle rattle rattle rattle!
“I DON'T KNOW! I ASKED YOU!”
Notes on an email about a barely overheard conversation at The Ft. Lauderdale Office of The Corporation
- From
- The Ft. Lauderdale Office Manager <XXXXXXXXXXXXXXXXXXXXXX>
- To
- The Ft. Lauderdale Office of The Corporation <XXXXXXXXXXXXXXXXXXXXXXXX>
- Subject
- Plumbing Work on 10th Floor
- Date
- Tue, 9 Jun 2015 15:30:13 -0500
Hello Everyone,
Please excuse the loud rattling noise occurring at this moment. There is a backup in the plumbing fixtures above us and what you are hearing is the snake.
They are unable to stop the job due to the issue at hand can get much worse. We have asked the plumbers to be as diligent as possible and complete the work as soon as possible.
The noise can be heard more towards the North end, so please move if necessary.
Sorry for the inconvenience,
The Ft. Lauderdale Office Manager
Rattle rattle rattle rattle rattle rattle rattle rattle!
“AH, SO THAT EXPLAINS THE NOISE!”
Rattle rattle rattle rattle rattle rattle rattle rattle!
“WE'LL BE TESTING IN VAN NUYS? I THOUGHT IT WAS SUPPOSED TO BE IN MURRAY HILL?”
Rattle rattle rattle rattle rattle rattle rattle rattle!
“YOU SHOULD GO HOME IF YOU FEEL ILL!”
Wednesday, June 10, 2015
Just a small observation about software projects
There are times when I'm sitting at work, answering questions (and it doesn't matter if it's face-to-face, over email, or via a chat program) when it feels like there is no one who fully understands how our product works. Not me, not the other developers, not my manager, no one!
It's not that nobody understands their part of the project—they do. But there are a lot of parts to the project. There's the front end code (multiple clients) which talks indirectly to the backend code (many moving parts) which is managed by the billing and provisioning code (many many pieces there as well), all written by different teams with sometimes less that perfect understanding of how the other parts work, and mangaged by two more teams (one for the servers, one for the network).
Not to mention the fun we have working with The Monopolistic Phone Company (“We don't have to care!”).
Sometimes, I find it amazing that what we do have works as well as it does—it could always be worse.
Thursday, June 11, 2015
What is Code?
A computer is a clock with benefits. They all work the same, doing second-grade math, one step at a time: Tick, take a number and put it in box one. Tick, take another number, put it in box two. Tick, operate (an operation might be addition or subtraction) on those two numbers and put the resulting number in box one. Tick, check if the result is zero, and if it is, go to some other box and follow a new set of instructions.
You, using a pen and paper, can do anything a computer can; you just can’t do those things billions of times per second. And those billions of tiny operations add up. They can cause a phone to boop, elevate an elevator, or redirect a missile. That raw speed makes it possible to pull off not one but multiple sleights of hand, card tricks on top of card tricks. Take a bunch of pulses of light reflected from an optical disc, apply some math to unsqueeze them, and copy the resulting pile of expanded impulses into some memory cells—then read from those cells to paint light on the screen. Millions of pulses, 60 times a second. That’s how you make the rubes believe they’re watching a movie.
Via Lobsters (but really, many, many, other sites linked to this), Paul Ford: What is Code? | Bloomberg
Wow.
I've been a fan of Paul Ford for many years (I even had a link to his site in the sidebar years ago but removed it as he hasn't updated his site in several years now) so it's always nice when I come across his work elsewhere.
This is a really good article on programming. It's also a really long article (38,000 words) on programming. And while it's ostensibly for the non- programmer (it uses second-person view point (which I do no like, Sam-I-am) to paint you as an executive in a company trying to fund some internal software development) I'm not sure if the average non-programmer won't be overwhelmed by the presentation, or be unable to follow along when it gets technical in spots.
Do I recommend it?
It's not technical enough for a programmer (and some of the details, while in spirit okay, are technically inaccurate) but I'm afraid it might be a bit too technical (or overwhelming) for its intended audience.
But yeah, I would recommend it.
You have been warned.
This is more “bootstrapping a langauge” than it is “creating a language”
Via Hacker News comes presentation on creating a language using only assembly language. It's an interesting project starting with the simplest thing that could work and building successive layers, gaining capabilities as you go.
But it's funny to see this being presented as novel, when that's how it was done back in the late 50s and early 60s. Personally, I might be inclined to go the Forth route instead of Lisp, but that's just me.
Friday, June 12, 2015
Overheard conversation at Chez Boca about the possible names for a feral lizard on the back porch
“You remember that lizard on the back porch?”
“The one you decided to keep as a pet?”
“Yes. I'm trying to come up with a name for him.”
“Godzilla.”
“That's actually my forth choice. My first choice is ‘Elliot.’”
“‘Elliot?’”
“From ‘Pete's Dragon.” Or ‘Smaug.’”
“What about ‘Eddie?’”
“Sigh. I hate your creativity.”
“So ‘Eddie” is it, then?”
“Yes.”
Saturday, June 13, 2015
The unbearable lightness of Forth
I mentioned
Forth
in conjunction with
bootstrapping a language
and I think it would be constructive to show just how small Forth can be.
I'm referencing JONESFORTH
,
an implemention of Forth bootstrapped from assembly language.
It took only 2,313 lines of assembly for JONESFORTH
(and easily half of that is comments describing the inner workings of the Forth environment)
versus the 3,663 lines of assembly for the first stage of amber
(the other language mentioned the other day).
Now,
granted,
the first stage of amber
is usable as is,
whereas JONESFORTH
takes another 1,788 lines of code in Forth
(and again, about half is just comments describing the implementation) to get a near fully fledged Forth system
(JONESFORTH
does not support DOES>
and why that is important will take another post).
So yes,
Forth is pretty easy to bootstrap.
(and small—the JONESFORTH
executable is only 17K—when
was the last time you saw a compiler that small?)
Sunday, June 14, 2015
An IDE for BASIC, on a machine with 128 bytes of RAM
- Your entire program can not exceed 64 symbols - a symbol being a number, variable, or reserved word (i.e. Goto, If, Then)
- There's a maximum of 9 lines, not really an issue considering the first item
- You only get integers from 0-99
- Only five math functions are available (+,-,*,÷,mod)
- In terms of graphics, you have two dots you can move by setting their coordinates
- You can play a range of beeps but I'm not musically inclined so I can't map them to notes
- Instead of a keyboard you have two 12 button pads to work with
If this sounds horribly limited and lame it's because you haven't yet thought about the hardware it's running on…
Via Reddit, HuguesJohnson.com - Atari 2600 BASIC Programming
Ah, the good old Atari 2600 Video Computer System. It could only address 4,096 bytes of ROM and 128 bytes (not megabytes, not kilobytes, but bytes) of RAM, and as far as graphics are concerned, the Atari 2600 is responsible for drawing every pixel on the screen, as the screen is being drawn by the eletronic beam on the television (or in other words, you are Racing the Beam).
It's not an easy machine to program.
So to even contemplate BASIC on the thing is insane. But it exists. And it has that oh so very sweet Atari cover art:
followed by the dismal reality that comprise most of the Atari 2600 programs:
Still, I find it a fascinating system. Like Hughs Johnson says, you could Tweet most Atari 2600 Basic programs they're so short. And because the language is so constrained, it seems like one could easily randomly generate scores of valid Atari 2600 Basic programs.
Hmmm … I have yet to figure out what my next Stupid Twitter Trick™ is to be …
Monday, June 15, 2015
Only in America
So, given that we have a white woman claiming to be black leading a NAACP chapter, comedians afraid to play to college audiences, a group dedicated to diversity excluding people based on skin color, and the Klu Klux Klan accepting black, Jewish and gay members (meanwhile, I appear to have 1992 on the phone ranting about wanting its election back or something), it's easy to think that satire has given up, gone home, and is curled in a fetal position under the covers in bed, wimpering for a simpler time.
But no, it's not given up—it's just that satire has gotten harder to detect: Black Chicago men start Klu Klux Klan chpater citing a declining culture as a reason. That is simply brilliant (but alas, real life still has a way of trumping satire when it wants to).
Tuesday, June 16, 2015
A constructive look at the Atari 2600 BASIC cartridge
I installed Stella (an Atari 2600 VCS emulator), downloaded the Atari 2600 BASIC cartridge and have been playing around with it for the past few days. If I'm going to do some Stupid Twitter Trick™ with it, I might as well know how it works, right?
And thus, this review.
Honestly, I don't think the Atari 2600 BASIC has ever had a fair review. It's pretty much reviled as a horrible program, a horrible programming environment and practically useless. But I think that's selling it short. Yes, it's bad (and I'll get to that in a bit), but in using it for the past few days, there are some impressive features on a system where the RAM can't hold a full Tweet and half the CPU time is spent Racing The Beam. I'll get the bad out of the way first.
Input comes from the Atari Keypads, dual 12-button keypads. If that weren't bad enough, I'm using my keyboard as an emulated pair of Atari Keypads, where I have to keep this image open at all times.
Okay, here's how this works. I want to enter this line:
A←A+1
(Ah yes! The “left arrow” for assignment. Mathematicians rejoice!) Upon startup, the Atari 2600 BASIC cursor is white. This is important, because this tells you what mode you are in. Hit a key when the cursor is white, and you do the functions labeled in white above each key. To get an “A,” you hit the bottom center button on the left controller (the one with the arrow circling around it) until the cursor turns blue, then you can hit the upper left key on the left controller (labeled “STATUS + A IF”). It's a bit hard to see, but yes, that “A” is indeed blue.
To get the “←” symbol (it's the top right button on the left controller) you hit the bottom middle button the the left controller until the cursor cycles back to red, then hit the upper right button on the left controller. Then cycle the cursor back to blue to get the “A,” then cycle to red to get the “plus” and the “1” (top left button on the right controller).
That's probably bad enough on the real thing. On the simulated Atarti 2600? Okay, what key on my keyboard is the “cycle” key? Then what key is the “A” key? Here's what I have to type to get that line of code:
xx1xxx3x1xxx19
But to be honest, it's on par with other keyboards of the time and may be a bit better, having actual tactile feedback instead of a simple membrane. I'm also picky about keyboards so I'm always going to bitch about the keyboard unless it's an IBM model M.
And given that the Atari 2600 only has 128 bytes of memory, it's expected that the programs are going to be rather short. I at first thought that you had 64 bytes for the program, but no—it's 64 bytes for the program, variables and runtime expression evaluation! That actually surprised me. Even worse, running this program over and over again (spaces added for clarity):
1 A ← 1 2 B ← 2 3 PRINT A,B
leaks memory!
No, really, that program, if run multiple times, will eventually exhaust all of memory. But not all programs leak memory. This program, if run over and over again (more on this little program in a bit):
1 D ← 1 2 HOR1 ← HOR1 + D 3 IF HOR1 = 0 THEN GOTO 5 4 IF HOR1 ← 99 THEN GOTO 2 5 D ← 99 - D + 1 6 GOTO 2
won't leak so much as a byte. Go figure.
Worse though,
is that each variabled used in the program
(and it doesn't matter if it's a predefined variable like HOR1
or a user defined variable like A
)
consumes three bytes out of the precious 64 bytes you get for your program!
On the plus side though,
unused variables (event the builtin ones) don't use space at all
(I figured this out by watching the RAM use in Stella).
The grahics are pretty pathetic as well.
There are two dots that can be manipulated.
The builtin variables HOR1
and VER1
control the horizontal and vertical position for one dot;
HOR2
and VER2
are used for the other dot.
The colors are fixed.
Oh,
and if the builtin variable HIT
is 1,
the two dots are in the same position.
The positions are themselves limited to 0 to 99, but that's because all variables are limited to the range 0 to 99. The values wrap though—add 1 to 99 and you get 0. Subtract 1 from 0 and you get 99.
Which leads us into the ugly.
Yes,
there are no negative values—everything is unsigned.
And the values are all limited from 0 to 99.
This stems from a unique feature of the Atari 2600 CPU,
the 6507
(a cheaper variation on the 6502).
That CPU can do math in either binary or binary-coded decimal
and the Atari 2600 BASIC uses the binary-coded decimal mode, which restricts the values from 0 to 99.
So while you don't have negative numbers,
you do in a way because of the way the math works.
99 plus 99 is 198,
but because the range is modulus 100,
the result is 98.
Add 99 again,
and you end up with 97.
I use this fact in the above program.
Line 5 negates D
—it converts 99 to 1,
or 1 back to 99.
Essentially,
1 to -1 and back again,
causing the dot to slowly crawl back and forth across the screen.
But now we finally arrive at what's good, or rather, what's amazing about this program.
First and foremost, it's an IDE.
Seriously.
Dispite it being only 4,096 bytes, there's a pretty credible, windowed(!) integrated development environment in there. If you look back at the keypad, you'll notice the first six buttons on the left controller are labeled:
- STATUS
- PROGRAM
- STACK
- VARIABLES
- OUTPUT
- GRAPHICS
Those are the various “windows” (and technically, they are windows, even if they don't overlap but are instead, stacked vertically on the screen) and the buttons there toggle the “windows” on and off.
The “STATUS” window (you can see it in the screen shot from the other day) shows memory usage (how many bytes, called “symbols”) and how fast the program will run (1, 2, 4, 8, 15, 30 and 60 are the speed values and they reflect how often the interpreter is run—once a second, twice a second, on up to 60 times a second). The “PROGRAM” window obviously contains the program (all nine lines if you have that many—and the IDE automatically numbers the lines for you even though it doesn't use them or store them—more on that below).
The “VARIABLES” window contains a list of the variables used in the program, listed as:
A is 1 HOR1 is 40 B is 2
“OUTPUT” is the text output window;
output of PRINT
. “GRAPHICS” is the laughable graphics screen.
Leaving the “STACK” window, which is a misnomer actually. It's not a true stack, since there is no concept of “subroutine” in the Atari 2600 BASIC. You could think of it as “TRON” as it actually shows you the execution of each statment that is abolutely amazing! Imagine each line below being shown one at a time and you'll get a feeling for how this works. We'll be following line 5 from the above program (assuming D is 1):
D D← D←99 D←99-D D←99-1 D←98 D←98+1 D←99
One more example, to show that the Atari 2600 BASIC also follows mathematical precedence. Here, A is 1, B is 2 and C is 3. The line of code we're following is:
D←A+B*C
and during execution:
D D← D←A D←1 D←1+B D←1+2 D←1+2*C D←1+2*3 D←1+6 D←7
Strange as it sounds, this blew me away. I don't think I've ever seen anything like this. Sure, in debuggers where you execute a line at a time. Or in assembly language, instruction by instruction. But never substeps in expression evaluation. And of course, you can always step through the code with the “STEP” button. I just find it amazing that all of this, as simple as it is, can fit in 4,096 bytes of code.
How it stores the code internally is interesting. Most BASICs I'm aware of store the line number as part of the program, but here, that's not done. Take this program for example:
1 A ← 1 2 HOR1 ← HOR1 + 1 3 A ← A + 5 4 GOTO 2
Internally in memory, it's stored:
Byte | Symbol |
---|---|
BC | A |
E8 | ← |
01 | 1 |
F1 | <end of line> |
B2 | HOR1 |
E8 | ← |
B2 | HOR1 |
E3 | + |
01 | 1 |
F1 | <end of line> |
BC | A |
E8 | ← |
BC | A |
E3 | + |
05 | 5 |
F1 | <end of line> |
A6 | GOTO |
02 | 2 |
FF | <end of program> |
Not a line number in sight,
which means GOTO
statements do a linear scan of the program
(a typical design choice of BASIC systems on 8-bit computers at the time)
but the end of each line is marked.
Weird,
but whatever works I guess.
Variables are stored after the program, sequentially:
Byte | Symbol |
---|---|
B2 | HOR1 |
EE | is (see below) |
02 | current value |
BC | A |
EE | is |
15 | current value |
As best as I can tell,
the value EE
is used when displaying the variables on the “VARIABLES” window,
and probably means “is.” It's probably done that way to avoid a special case when displaying data—it can be treated the same when displaying the program.
I'm guessing there's not much space left what with the font data and code to support the IDE in addition to running a
(admittedly very simple) BASIC interpreter for special casing the variables.
As a “proof-of-concept” it's an amzing piece of work. As an actual product, yes, it sucks, mostly because of the limitations of the hardware. The ideas behind it are incredible though, and I think it's gotten short shrifted because of the limitations, which is sad. There is something to learn from here.
Update Wednesday, June 17th, 2015 at 1:56 AM
I almost forgot—the IF
statement is an expression!
You can do the following:
A ← IF B = 15 THEN 40 ELSE 99
and A
will be 40 if B
is 15,
otherwise A
will be 99.
There aren't many languages I've used that have allowed this.
Wednesday, June 17, 2015
It's never lupus nor a compiler bug
While testing “Project: Sippy-Cup,” one of the components I was using for testing asserted:
tpp.c:63: __pthread_tpp_change_priority: Assertion `new_prio == -1 || (new_prio >= __sched_fifo_min_prio && new_prio <= __sched_fifo_max_prio)' failed.
This is not good.
This wasn't our code that called assert()
,
but pthreads.
Sigh.
The hardest part of debugging this was getting it to happen consistently (yes, it's one of those bugs) to test out various hypotheses.
It wasn't neglecting to initialize a variable. It wasn't a compiler bug. It turned out to be a abuse of the mutex API, where one thread locks a mutex, and some other thread attempts to unlock the mutex.
Thursday, June 18, 2015
It's not even a Heisenbug
I don't think it's a case of one thread releasing a mutex locked by another thread.
Whatever the bug, I can reproduce it rather consistently and every crash has always been along the same call chain. The mechanism used to trigger the problematic call chain is a way to work around a deficiency in POSIX (which I'm sure the original author of said mechanism would say stands for “Piece of XXXX In eXecution”)—not that I blame the original author, Unix and threads don't really mix that well (but then in my opinion, if it wasn't in Unix Version 7, it's not supported well or has a horrible interface—threads, networking, removable storage, graphical user interfaces, all have … issues under Unix).
But as of now, I've yet to figure out the actual root cause of the assert:
tpp.c:63: __pthread_tpp_change_priority: Assertion `new_prio == -1 || (new_prio >= __sched_fifo_min_prio && new_prio <= __sched_fifo_max_prio)' failed.
Every source I've found on the web with that bug states it has to do with an uninitialized mutex attribute. The code isn't using mutex attributes, and even when I added code to use a mutex attribute (initialized!) it still asserts. Sigh.
And the even weirder thing is—I don't think the component that's crashing is even being used by what I'm testing! See, the component I'm testing, E, makes a service request to T. T requires that service X (the one that is crashing) to be running, but the requests from E shouldn't cause T to make a request to X. X just sits there and periodically, logs a bunch of stats that basically show it's not doing a whole lot of work.
I got nothing.
Friday, June 19, 2015
No product survives first contact with production
Many months ago, my manager S asked about a “health check service” for “Project: Sippy-Cup.” Something that operations could query to see if my component was still up and running. I rejected the idea of embedding a web server in the component as being complete overkill (and really, any embedded webserver would swamp the amount of code that actually does the useful work in my component, which just processes one SIP message.
So I did the simplest thing that could possibly work:
a simple UDP service. It accepts a packet with the string “STATUS”
and replies with “OKAY.”
It was only a few lines of code,
and with netcat
I figured it would be a simple matter for operations to do a health check.
It seems that UDP is too confusing for operations to deal with,
so I changed the underlying protocol to TCP.
It's a bit more complicated to support as I now have to listen and accept connections,
but then it should be even easier for operations to handle it with netcat
.
The protocol stills accept a string of “STATUS” and returns with “OKAY”.
And it's still apparently too much for operations to deal with. Operations actually asked if they could send a SIP message, and I was like, Wow! If it's easier for you guys to send a SIP message for a health check, more power to you! But my manager nixxed that idea and we stuck with the current TCP version, which he feels is the simplest thing that could work.
I'm not sure what operations is actually doing.
My manager mentioned that my component was failing the health check,
yet when check it was fine
(using netcat
of course).
Yet the logs were filled with errors (“recvfrom: Bad file number” and “poll: Invalid argument”),
probably from all the failed attempts by operations to do a health check.
I did ask operations what is sent and how often. What they're sending is right, but they're asking “Areyoustillup?Whyhaven'tyouansweredme?Areyoup?Areyouup?McFly!McFly!Answerme!” before my component has a chance to even answer. I think they're a bit too aggressive. They don't.
Sigh.
Saturday, June 20, 2015
A park dedicated to The Art of the Brick
When I showed Bunny a video on making Lego gummy candy a few weeks ago, she said that was all the excuse we needed to go visit Legoland!
And lo! We arrived! To the sound of the Lego Theme!
Unfortunately grim reality asserts itself in the outrageous parking fee and ticket prices (really, you'd think at those prices you would at least get a small Lego kit, but then again, Lego was getting $36/lb for raw Lego bricks—wait a minute … that isn't that bad a price actually—it's about 500 2×2 bricks … wait! Where was I?).
Yeah, the high price tends to dampen the entire experience, making what could be wonderful (and I'm sure for the kids, it is) into something that's just a tad underwhelming.
Although the Lego sculptures are wonderful.
The pirate-themed water skiing show at the park was unfortunately cut short due to threatening weather.
Sadly, this meant that the kid behind us who really got into the show did not get closure, leaving open the question if Brickbeard escaped justice along with his bounty.
The weather then stopped threatening and made the decision to rain heavily, cutting our stay at Legoland a bit short and drenching us on the way back to the car.
Overall, I'm glad we went. Even though there wasn't anything special about the rides >per se, they were all Lego themed or made to look like they were built out of Lego bricks. We didn't eat at any of the restaurants, so I can't comment about them. The stores all sold Lego or Lego themed items (obviously—and Bunny did get the silicone molds for the jelly candies) so there isn't much to say about them either (other than the scores and scores of Lego kits all beckoning to be bought).
I just wish the park didn't cost so much.
A tigerwood cutting board
We met with Jim and Cis for dinner, two of Bunny's friends who live in the area. Seeing how she hasn't seen them in some time, Bunny thought it might be nice to give them a small present. So over the week, she made another cutting board, this time from tigerwood.
While it is a hardwood, Bunny found it somewhat difficult to plane smooth as it was prone to tearout and gouges. But she got the results she wanted.
The perils of hotelling
Sigh.
Nothing like a hotel (not the Legoland hotel) right next to a bar with the karaoke cranked up to 11.
Closing time can't come soon enough.
Sunday, June 21, 2015
These look to be the easiest crystals to make
Oooh … shiny!
And sooo easy to make …
[No! You are not using any of my pans, mister! —Bunny] [Awww … you're no fun! —Sean]
Monday, June 22, 2015
Technology is like a lightsaber, useful for both good and bad
Yesterday, news broke that Google has been stealth downloading audio listeners onto every computer that runs Chrome, and transmits audio data back to Google. Effectively, this means that Google had taken itself the right to listen to every conversation in every room that runs Chrome somewhere, without any kind of consent from the people eavesdropped on. In official statements, Google shrugged off the practice with what amounts to “we can do that”.
Via Instapundit, Google Chrome Listening In To Your Room Shows The Importance Of Privacy Defense In Depth
It's not that Google is spying on you, it's that Android is sitting there, listening for you to say, “Okay, Google!” and then sending the audio data to Google (as the comments at Hacker News point out). The real concern is law enforcement abusing this feature.
Tuesday, June 23, 2015
It's a wonder we survived this long as a species
“Free range parenting” is all but illegal and childhood is a completely different experience these days.
...
Our children have been enveloped in this softly padded culture of fear, and it's creating a society of people who are fearful, out of shape, overly cautious, and painfully politically correct. They are incredibly incompetent when they go out on their own because they've never actually done anything on their own.
When my oldest daughter came home after her first semester away at college, she told me how grateful she was to be an independent person. She described the scene in the dorm. “I had to show a bunch of them how to do laundry and they didn't even know how to make a box of Kraft Macaroni and Cheese,” she said. Apparently they were in awe of her ability to cook actual food that did not originate in a pouch or box, her skills at changing a tire, her knack for making coffee using a French press instead of a coffee maker, and her ease at operating a washing machine and clothes dryer. She says that even though she thought I was being mean at the time I began making her do things for herself, she's now glad that she possesses those skills. Hers was also the room that had everything needed to solve everyday problems: basic tools, first aid supplies, OTC medicine, and home remedies.
Via Instapundit, The Last Rebels: 25 Things We Did As Kids That Would Get Someone Arrested Today | Zero Hedge
They can't even make a box of Kraft Macaroni and Cheese.
Sigh.
The free range kids are going to eat the other kids alive. Not that that's a bad thing.
Of the list of 25 things we used to do as kids, I've done most of them (not playing ``dangerous games'' like dodgeball---I was smart enough to avoid that as the other kids were out for blood) but really, nothing in that list is out of the ordinary.
I'm blaming the 24-hour news cycle for this.
Wednesday, June 24, 2015
Be very very quiet … I'm hunting bugs
I now know what the bug is, and I want to confirm it. But it knows I know and thus it is hiding, taunting me. And the second I stop paying attention—I awake to a dead program!
Update many, many hours later …
Gotcha! And yes, it's exactly what I thought—a race condition. But catching and verifying is one thing. Fixing it—that's another issue altogether.
Thursday, June 25, 2015
A history of character encodings
From Reddit comes Character Encodings For Modern Programmers, a facinating look into the history of character sets used by computers. Did you know that some form of electrical communications have existed for about 175 years? Or that time-division multiplexing (multiple messages sliced into segments, sharing a single wire) was done as early as 1873? That Thomas Edison tried his hand at time-division multiplexing in 1876? Or that the first serial communication system using bits was designed in 1882? I didn't.
And we haven't even gotten to character sets yet!
I don't know … I just find this stuff interesting.
Friday, June 26, 2015
There's no reason for C to have just a single stack
This patch adds the safe stack instrumentation pass to
LLVM
, which separates the program stack into a safe stack, which stores return addresses, register spills, and local variables that are statically verified to be accessed in a safe way, and the unsafe stack, which stores everything else. Such separation makes it much harder for an attacker to corrupt objects on the safe stack, including function pointers stored in spilled registers and return addresses. You can find more information about the safe stack, as well as other parts of or control-flow hijack protection technique in our OSDI paper on code-pointer integrity (http://dslab.epfl.ch/pubs/cpi.pdf) and our project website (http://levee.epfl.ch).
Via Hacker News, Protection against stack-based memory corruption errors using SafeStack ⋅ llvm-mirror/llvm@7ffec83
I'm really surprised this wasn't done sooner. There's nothing in the C
Standard that mandates how the call stack must be
implemented, but it seems that for the past forty years or so, the system
stack (the stack the CPU uses to
store return addresses for subroutine calls or state information when
handling interrupts) has been the default place to store the call stack,
which is the prime reason why buffer overflows are
so dangerous (because with a buffer overrun, the attacker can embed machine
code and cause the CPU to return
to the embedded machine code to do nefarious things). Sure, it
might appear that dedicating another CPU register to point to this secondary stack might be wasteful,
but most C compilers on modern systems already use a second CPU register to point to the primary
stack (to make it easier to generate stack frames when debugging or analyzing
a core
dump). Also, the system stack wouldn't have to be so big—even an 8K stack on a 64-bit machine would easily allow a call
depth (A
calls B
which calls C
which
calls D
is a call-depth of 4) of over 500 (technically, 1,024
but this would disallow other uses of the stack, such as temporarily saving
registers, or handling of interrupts) which should handle most programs (the
exception being badly written programs with unbounded recursion; sidenote to Google: good one,
you got me).
This patch, however, seems to still save the call stack in the system stack with the exeception of arrays or items whose address is taken, and it stores the pointer to the “unsafe stack” in a thread-specific variable. It turns out the performance loss isn't that bad as most routines don't have such problematic variables to begin with.
Saturday, June 27, 2015
“If you don't know how to handle an error, crash the program.”
I still haven't been able to recreate this bug in mod_blog
.
Or rather,
I haven't been able to get
mutt
to use
“quoted-printable” encoding I was so not expecting.
All my attempts failed,
and mutt
sent the emails encoded as
“8bit” encoded
(which isn't an encoding per se,
more of an “indication” of what to expect).
Sigh.
In the meantime, I added a bit of code to detect the issue and abort immediately so I won't have to scramble to manually fix the blog like I've done twice now.
Sunday, June 28, 2015
It's rather simple, but you would never know it
Rob Landley is right—terminal control is obsolete. Precious few have actual terminals, and those of us who still use command line interfaces are using software programs that emulate physical devices talking to other software programs that emulate physical devices. Furthermore, all those software programs emulating physical devices have pretty much converged on using ANSI terminal control codes, so much of the reason for termcap has gone away.
So now it should be a simple matter to look up ANSI terminal control codes to see what to send to scroll the screen to the left, right?
Yeah …
And lest you think that page on xterm
control codes is intentionally incomprehensible,
it's not.
Well,
it is incomprehensible,
and it may be intentional,
bit it's not alone.
They
are all
pretty abysmal.
And they're all pretty abysmal because the actual standard,
ECMA-48,
is pretty abysmal as standards go.
Here's a representative sample:
5.3 Elements of the C1 set
These control functions are represented
a) in a 7-bit code by 2-character escape sequences of the form ESC Fe, where ESC is represented by bit combination 01/11 and Fe is represented by a bit combination from 04/00 to 05/15;
b) in an 8-bit code by bit combinations from 08/00 to 09/15; however, when the announcer sequence ESC 02/00 04/06 according to Standard ECMA-35 is used, the control functions of the C1 set are represented by ESC Fe sequences as in a 7-bit code.
and here's a translation into more modern terminology:
5.3 Elements of the extended ASCII control set
These control functions are represented
a) in a 7-bit code by a 2-character escape sequence of the form <ESC> <Fe>, where <ESC> is ASCII character 0x1B and <Fe> is ASCII characters 0x40 ('@') through 0x5F ('_');
b) in an 8-bit code by byte values between 0x80 and 0x9F; however, when the sequence <ESC> ‘ ’ ‘F’ (0x1B 0x20 0x46) according to Standard ECMA-35 is used, the control functions of the C1 set are represented by <ESC> <Fe> sequences as in a 7-bit code.
Yes, the ECMA standards represent characters using a (to me) bizarre column-based format which are kind of hexadecimalesque (4/13 is column 4, row 13) without being actual hexadecimal (0x4D), which makes reading the standard a bit more difficult. It was only reading these old standards in conjunction with this page did is start making a bit of sense.
For instance,
on the
xterm
reference page,
there's the sequence “APC
Pt ST
” but it's never defined what APC
or ST
actually are,
but Pt is defined to be `printable text.”
It's only by reading the other documentation closely that you realize that the sequence will either be
0x9F
<printable text>0x9C
or
0x1B
‘_’ <printable text>0x1B
‘\’
Which is beside the point,
because xterm
will ignore such sequences anyway.
Sigh.
The sequences themselves are pretty simple; it's just the presentation that universally sucks (and all the presentations except the ECMA-48 one assume you have read and understand the ECMA-48 standard).
Monday, June 29, 2015
But is it music?
I'm thinking Bunny would let me melt bismuth in her pans before she would accept Melodyne (link via Instapundit) as a valid music making tool. It definitely looks more flexible than Auto-Tune (say, add a harmonizing vocal track only to words sung in B, for instance). The vocals that are “corrected” are still noticeable—it's just a different effect than the robotic reverberations of Auto-Tune. Don't get me wrong, it's still noticeable, but it isn't … um … as tinny? Robotic? Computerized? as Auto-Tune.
So … Tool? Crutch? Does it depend upon your viewpoint? As a non-musician, I find Melydyne to be an incredible tool to allow people who otherwise can't carry a tune to create music. But Bunny, having had musical training, might think differently (I can relate—I hate PHP yet it allows people who aren't programmers write programs, for better but usually worse).
Tuesday, June 30, 2015
Guess what? You'll get an extra second of sleep tonight! Woot!
Gaining and losing an hour is a yearly thing.
Gaining a day happens once every four years.
But gaining a second?
It actually happens about every 18 months (but not on any type of set schedule). Wall Street is freaking out about it. What about you? Will you be watching Bobby Cannavale screaming “Leap Second!”? Or will you just spend an extra second sleeping tonight?