I've found an amazing behavior in Firefox today. Almost spent my whole night debugging it, and hardly had any time for the music project.
The bug was quite special. In the last couple weeks at some point tests started failing. Slowly one by one. It seemed the regular slow server -> timeout issue. However looking at the details I've realized they all stopped at the access denied page. It was a bit strange so I opened X11 on my iPad and tunneled the headless server to it so I can see what's happening in the background. And then I've found the culprit. Firefox was asking for the htpasswd authentication. Which is weird, we're using the tokens in the URL, so it should work by default. And even more strange, at the background you can see the site already, which is not possible without providing the credentials.
I was struggling for a while - when managed to narrow down the problem to two commands: open('/user/logout') and open('/'). So if you first load the logout page and then the base path then the problem occurs. Why? Absolutely no idea. The authentication is a browser configuration - let's say, meanwhile Drupal's logout action mostly affects on cookies (on the browser side). Google didn't know too much about this particular problem. I need some time tomorrow.
Anyways. I still had an hour to finish the command reference and check out something for the C64 project. Creating a simple sound and configuring it is not a rocket science, so I thought I build up a little mechanism that can play a song. A very simple song. I use the DATA to store all the notes and lengths. I define a small code block where each note can be played. And that's all. Here you are the code:
10 for i = 54272 to 54296
20 poke i, 0
30 next i:rem reset sound settings
50 goto 300
100 poke 54296, 15:rem volume
110 poke 54277, 1:rem attack/decay
120 poke 54278, 100:rem sustain/release
130 poke 54273, n:rem note
140 poke 54272, 37:rem tone
150 poke 54276, 33:rem waveform
160 for d=1 to l:next:rem duration
170 poke 54276, 16:rem turn off
180 return
300 for r = 1 to 2:rem repeat twice
304 restore
306 for j = 1 to 14:rem fetch song data
310 read n:read l
315 l = l *200
320 gosub 100:rem play note
330 next j
340 next r
1000 data 36,1,36,1,37,1,38,2
1010 data 41,1,38,1,41,1,38,1,38,1
1020 data 37,1,36,1,43,1,36,1,43,2
I kinda like this chaotic way of code structure. It really force you to make small independent and error free code. It's almost impossible to get a complete overview. Especially on the C64 screen. Which is a mess. A lovely mess. As you recognized I broke couple of coding conventions. Sorry about that.
I wrote this song to a good and really fat friend of mine, here you are the code when it runs:
Peter
No comments:
Post a Comment
Note: only a member of this blog may post a comment.