There is no try. Only while not pcall( _do ) do end
The one ringing tone…
Plumb Foolish
Pobody’s Nerfect
I woke up this morning remembering that silly phrase, “Pobody’s Nerfect”, which my grandmother had on display in her home. I’m not sure of its origin. Funny the things you remember.
Set Volume on Raspberry PI
This sets output to 100%, which seems the best for driving an amplifier:
amixer set PCM -- 100%
use smaller numbers to get quieter, and 0% to mute. Thanks to Joe (see comments) for finding a simpler solution than my original post.
Check out Cy DeCosse’s new Blog
Cy is now in the blogosphere at http://www.cydecosse.com/blog/. Crazy!
Botnet Attacks
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 INDEX for IS NULL
499969
CPU Time: user 0.054242 sys 0.001700
baseline timings with INDEX for IS NOT NULL
500031
CPU Time: user 0.085374 sys 0.002607
baseline timings with 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 INDEX for IS NULL”;
.timer on
select COUNT( rowid ) FROM test WHERE x IS NULL;
.timer off
SELECT “baseline timings with INDEX for IS NOT NULL”;
.timer on
select COUNT( rowid ) FROM test WHERE x IS NOT NULL;
.timer off
SELECT “baseline timings with 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.