Check out Cy DeCosse’s new Blog
May 17th, 2013Cy is now in the blogosphere at http://www.cydecosse.com/blog/. Crazy!
Cy is now in the blogosphere at http://www.cydecosse.com/blog/. Crazy!
The other day I noticed lots of hits to wp-login.php on my WordPress install. So I moved it to a new filename, and wrote a quick php file that appends the POST data received to a file. Actually, I used a linux “named pipe” so I could then run the command “cat” to print out what was being sent as it came in. I considered capturing all the attempted passwords and ip addresses, they might be useful…. but I lost interest. I got enough joy by just watching the server log fill with 404 responses.
Today we were discussing SQLite query performance with respect to “IS NULL”. We are either misremembering, or SQLite has gotten better.
“IS NULL” will leverage an index on a column, just the same as comparing with any other value, such as “== 0″. So, it appears that NULL is indexed. IS NOT NULL, however, is only marginally helped by an index.
Evidence: save attached test.sql and run. Notice how the timing for the query drops from 95ms to 54ms for both “x == 0″ as for “x IS NULL” with the addition of an index. The “x IS NOT NULL” query drops only minutely, from 95ms to 85ms.
sqlite3 test2.db < test.sql
SETUP
INSERT 1,000,000 rows, about 50% of which are, randomly NULL, the others are 0
turn on timer
baseline timings with NO INDEX for IS NULL
499969
CPU Time: user 0.095477 sys 0.003140
baseline timings with NO INDEX for IS NOT NULL
500031
CPU Time: user 0.091441 sys 0.003123
baseline timings with NO INDEX for == 0
500031
CPU Time: user 0.094747 sys 0.002805
Create index on x
baseline timings with NO INDEX for IS NULL
499969
CPU Time: user 0.054242 sys 0.001700
baseline timings with NO INDEX for IS NOT NULL
500031
CPU Time: user 0.085374 sys 0.002607
baseline timings with NO INDEX for == 0
500031
CPU Time: user 0.053888 sys 0.001612
SQL:
SELECT “SETUP”;
DROP TABLE IF EXISTS numerals;
CREATE TABLE numerals ( N );
INSERT INTO numerals VALUES ( 0);
INSERT INTO numerals VALUES ( 1 );
INSERT INTO numerals VALUES ( 2 );
INSERT INTO numerals VALUES ( 3 );
INSERT INTO numerals VALUES ( 4 );
INSERT INTO numerals VALUES ( 5 );
INSERT INTO numerals VALUES ( 6 );
INSERT INTO numerals VALUES ( 7 );
INSERT INTO numerals VALUES ( 8 );
INSERT INTO numerals VALUES ( 9 );
DROP TABLE IF EXISTS test;
CREATE TABLE test ( x );
SELECT “INSERT 1,000,000 rows, about 50% of which are, randomly NULL, the others are 0″;
INSERT INTO test select NULLIF(random()>0,1) FROM numerals AS A, numerals AS B, numerals AS C, numerals AS D, numerals AS E, numerals AS F;
SELECT “turn on timer”;
SELECT “baseline timings with NO INDEX for IS NULL”;
.timer on
select COUNT( rowid ) FROM test WHERE x IS NULL;
.timer off
SELECT “baseline timings with NO INDEX for IS NOT NULL”;
.timer on
select COUNT( rowid ) FROM test WHERE x IS NOT NULL;
.timer off
SELECT “baseline timings with NO INDEX for == 0″;
.timer on
select COUNT( rowid ) FROM test WHERE x == 0;
.timer off
SELECT “Create index on x”;
CREATE INDEX test_x ON test (x );
SELECT “baseline timings with NO INDEX for IS NULL”;
.timer on
select COUNT( rowid ) FROM test WHERE x IS NULL;
.timer off
SELECT “baseline timings with NO INDEX for IS NOT NULL”;
.timer on
select COUNT( rowid ) FROM test WHERE x IS NOT NULL;
.timer off
SELECT “baseline timings with NO INDEX for == 0″;
.timer on
select COUNT( rowid ) FROM test WHERE x == 0;
.timer off
I host multiple blogs on my site, but not enough instances that I remember all the details of how to set them up.
This error had me going for an hour or so: Plugin could not be deleted due to an error: Unable to locate WordPress Plugin directory
The reason was that the user for that blog was not a member of the www-data group.
Simple:
sudo addgroup newusername www-data
Fixed.
Yesterday I performed the Elegy for English Horn by Jack Stamp with the Star of the North Concert band. We played at Edinborough Park in Edina, MN. There was some drama, as the venue was double booked, and the Golden Valley Orchestra was already on stage, decked in their finest tuxedos when we arrived. But unfortunately for them, their concert master was unable to come, and so they canceled their performance! So we flew on stage and performed!
Anyhoo, here’s the recording of the English Horn Solo by Jack Stamp:
If you ever use the “dd” command do duplicate a drive, you’re probably familiar with the unnerving wait that accompanies its use. The command generally takes on the order of *minutes* to complete, and gives no feedback.
If you read the MAN page, you’ll see you can monitor the progress by sending a SIGINFO signal.
Open another terminal window, and do
kill -SIGINFO <dd pid>
Where <dd pid> is the process id of your dd command. For example, when I was formatting the SD card for use in my Raspberry Pi via dd on the command line, I was able to monitor progress this way:
sudo dd if=~/Downloads/2013-02-09-wheezy-raspbian.img of=/dev/disk2 bs=2048k 193+0 records in 192+0 records out 402653184 bytes transferred in 314.132226 secs (1281795 bytes/sec)
UPDATE: OMG! I just realized that the moment in time when I sampled my software installation on my Raspberry Pi was 100π to 4 digits of precision. What a wonderful omen!
Here is how to transpose a viola part written in “C” clef for English horn.
Summary: To make an English horn produce a concert pitch, play the note that is 7 semitones higher. Often you want to simultaneously go down an octave — in which case play 5 semitones lower.
Viola plays in “C” clef. It has it’s notes written one semitone lower on the staff. Oh, and one octave. So “middle c” is on the center line of the staff.
Armed with those facts, here is my recipe for tranposing a viola part written in “C” clef on the fly for English horn. First, look at the note as if it were treble clef (realizing it’s actually an octave less one line lower than it appears) then move it down TWO spaces or lines, and add a sharp to the key signature.
E.g. Suppose it looks like a ‘b’ and there are no sharps or flats in the key signature. (In viola’s “C” clef that isn’t a ‘b’ — the middle line is really a ‘c’ concert.) EH plays in “F”, so we must transpose down. The clef already moved it down one line, so we go down TWO more from ‘b’ to arrive at ‘G’.
Let’s take another example: Suppose the note looks like ‘a’. To a violist who knows the “C” clef, they would say, no, that looks like a ‘b’ — and they are right. To play a concert ‘b’ on an English horn, go down three and add a sharp. So it’s time to play an “F SHARP”. Simple!
A related, helpful shortcut: The same number of fingers rule!
When transposing a “C” part in TREBLE clef for English horn: If the note looks as though you’d play it with 1/2/3 fingers of the left hand as written, simply finger 1/2/3 fingers on the right. E.g. ‘b’ is one finger down. So is F#.
EDIT: The first time I wrote this I got thoroughly confused between how to transpose from Treble Clef vs how to transpose from “C” Clef. I think it’s correct now.