Some Bits: Nelson's log

6 posts in February 2014

Dogecoin notes

I toyed around with running Dogecoin on my iMac. Some notes.

Wallet

  • The official Dogecoin client starts by downloading the blockchain. That is still very big, gigabytes I think. I didn’t wait for it to finish. Apparently the initial sync can be made faster by download a file separately. Derp. Or use an alternate client that doesn’t require the whole blockchain: maybe MultiBit maybe something from @datamingle.
  • Crashplan will try to back up the Dogecoin state, including gigabytes of blockchain data. Have to exclude both the “blocks” and “chainstate” directories; but then don’t exclude wallet.dat from the backup! That’d be dumb. (Or do: is it encrypted adequately in the backup?)

Mining. Er, digging.

  • The mining pool I picked is fast-coin. It’s the biggest no-fee pool right now.
  • I tried several miners. fast-pool recommends cgminer, which is an awkward command line program and lacks the --scrypt flag they try. cgminer recommends Asteroid, which hung for 1+ minutes with no UI feedback. I finally settled on MacMiner 1.5.18e. It’s basically a GUI wrapper for command line tools, including bfgminer.
  • The CPU miner seems to work well. Each CPU (i7 at 3.4GHz) is giving me about 5.7 khash/second. I have 8 CPUs, so I’m doing about 45 khash/second.
  • The pool as a whole is doing 8.2G Hash/sec with 5891 worker, or an average of 1400 khash/second for a worker. So my worker is about 3% of the average worker. I’m not sure, but I suspect “worker” means “single computer” in the pool, so this is a fair comparison.
  • My Mac is using about 140W running the CPU miner, or about $1 / day at PG&Es outrageously high price for electricity. Temperature isn’t so bad, the fans aren’t making noise.
  • According to this litecoin site my AMD 6970M GPU should get about 210khash / second. That’s about 5x what my CPUs can do; a significant improvement, but not ridiculously so.
  • According to that list very few GPUs push 1000 khash/second. I wonder how the pool average is 1400? Surely no one is building Dogecoin mining rigs.
  • The MacMiner GPU client crashes on my iMac soon after starting to run. There are some flags to tune the GPU usage settings but I have them all set to defaults. It may simply not work, who knows. (it’s an EXC_BAD_ACCESS, KERN_INVALID_ADDRESS, on the main thread).
  • In MacMiner I tried using these command line flags I found on the 6970M stats page and it still crashes.
    -I 13 -g 1 -w 128 --thread-concurrency 5600
  • When the MacMiner GPU client crashes, the whole applications crashes but it manages to leave behind a running bfgminer process that is consuming resources somehow. I had about 4 hanging around before I figured out why my Mac was so slow even though I’d shut off all the doges.
  • I was able to run the MacMiner’s version of bgfminer by hand from the command line. It appears to work, yields about 150khash/second.
    bfgminer -S opencl:auto -o stratum.fast-pool.com:3002 -u workername -p password
    Update:
     see below for the --scrypt flag
  • The GPU miner costs about 100W to run, or about $0.33 cents a day.
  • There’s contention between the GPU and CPU client. No CPU client: 160 khash/sec. With all 8 CPUs pegged: 100 kh/s. Those 8 CPUs are only generating 45 kh/s, so it’s better to run GPU only.
  • Nothing seems to check the worker password I set on bfgminer. The username is checked though.

It may be that GPU miner does not work. bfgminer with just the GPU running never got me any credit in my pool. And the displayed hash/sec values don’t really make sense, or rather the units don’t. The display literally reads “150 MH/s”, which I was interpreting as a sane kH/s.

The fact bfgminer is not checking passwords also makes me suspicious. Maybe it’s just not posting work credit correctly. Update: yeah, bfgminer is not getting my credit with the pool and is reporting weird hash/sec speeds. Something is just wrong. Turns out I wasn’t setting the --scrypt flag; see below.

Profit

  • The pool tells me a rate of 21 khash/sec is worth 74 doge/day.
  • If my best rate is 150 khash/sec, that would be about 530 doge/day.
  • At a rate of 1000 Doge = $1.17, I could make $0.62 / day mining Dogecoin at a cost of $0.33 in electricity.

bfgminer screenshot

No idea what this really means. Like I said, this miner isn’t getting me credit in the pool.

Screen Shot 2014-02-27 at 11.32.55 AM

Update: scrypt

Oops, I was running bfgminer without the “--scrypt” flag. That will still take work and appear to do it, but with the old Bitcoin algorithm and not the new litecoin/dogecoin scrypt algorithm. And nothing ever gets posted. The following command line actually works and posted work to the pool:

bfgminer --scrypt -S auto -o stratum.fast-pool.com:3002 -u worker -p password

With no -I flag (“intensity”, a nice value) I get the desktop default, which yields about 12 kh/s from the GPU and another 12 kh/s from the 8 CPUs together. Ie: much slower than the CPU only miner I was using before. Switching to GPU-only mining doesn’t help. The results seem fairly random .With -I 12 (commonly recommended) I get about 55 kh/s; maybe 60 kh/s if I turn off the CPU miner. “-I 8” is slow again, 8 kh/s. “-I -10” locks up the machine solid, even a remote ssh login and killing the process didn’t recover. “-I 20” also locked up the GUI, maybe that was just bad luck?

Running GPU only results never report to the pool. Maybe the computations aren’t correct.

BTW, all this testing is hard to do because it seems the way the pool works it takes a few minutes before any work shows up. And if your rate is too slow it may never show up, maybe you’re always posting too late?

Lieux-dit

Lieux-dit are little placenames in France, for a farm or field. Les Courtes, La Botte D’Asperges, La Belle Vue, Le Télégraphe... They’re hyper-local placenames, known only to nearby residents. They do show up on road signs though, and occasionally wine labels, and they are lovely and historically evocative.

And of course they exist in Shapefile databases. Here’s some from Nantes. Sorry for the lack of basemap; I tried adding some public raster tile source to QGIS 2 but got defeated.

Screen Shot 2014-02-22 at 9.18.19 AM

 

Update: and here’s something a bit nicer done with TileMill, with Migurski’s OSM extract thrown in as a vector basemap.

Screen Shot 2014-02-23 at 4.35.52 PM

QGIS install on Mac

It takes roughly 60 UI actions to install QGIS on a Mac. And then you only get QGIS 2.0, not the latest 2.2. The problem is the official install is KyngChaos’ packages. They’ve done a great job over the years packaging Python and GIS software for Macs, but it’s seriously old school stuff. 4 different framework libraries have to be installed first by hand, each one individually packaged in a PKG installer script inside a DMG, then you install QGIS itself. Each installer takes many mouse clicks to install and also requires the root password.

In some sense KyngChaos is doing this right; the libraries he installs are useful for other projects, and this way you see all the license and components. But it’s really user unfriendly. It’d be nice if someone built a single self-contained QGIS.app that could just be dragged and run anywhere.

Digital National Geographic schema notes

I bought a digital copy of the National Geographic Magazine archives. Great data collection, horrible Adobe Air interface to access it. Fortunately the archive is basically a bunch of lightly obfuscated image files and SQLite databases. I might take a crack at making a more usable index to all the articles. To that end, some notes on the database schema I found.

There’s individual sqlite files on the DVDs and downloads, but I think they are all merged in a file called Contents/Resources/assets/db/cngcontent.sqlite3.full. I find 7977 article entries in 1416 issues for my set up to 2012, which sounds roughly the right scale. Here’s the tables in it and some notes on schema. Numbers in parentheses are how many rows are in the table.

Tables all have simple primary keys named “id”. “search_time” is a popular field, it stores the date of the issue as an integer. IE “1977 Sep” has a search_time of 19770901.

articles (7977)

“id” INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
“start_page_offset” integer,
“page_count” integer,
“display_name” varchar(255),
“summary” varchar(255),
“search_time” integer,
“issue_id” integer

issues (1416)

“id” INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
“display_name” varchar(255)
“search_time” integer
“page_count” integer
“numbered_page_offset” integer
“numbered_page_count” integer
“numbered_page_start_value” integer
“page_exceptions” varchar(255));

geolinks (27570)

“id” INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
“location_id” integer
“article_id” integer
“department_id” integer
“map_id” integer

locations (5016)

“id” INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
“display_name” varchar(255)
“lat” float
“lng” float
“bounds_ne_lat” float
“bounds_ne_lng” float
“bounds_sw_lat” float
“bounds_sw_lng” float
“geo_provider” varchar(255)
“kms_per_lng_degree” float

contributors (12400)

“id” INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
“display_name” varchar(255)
“search_time” integer
“article_id” integer
“department_id” integer
“map_id” integer
“start_page_offset” integer

other tables

article_subjects (25774),
ad_subjects, ads,
departments, department_subjects,
maps, map_subjects,
photos (251002), photo_subjects,
links, schema_migrations, trivia_questions, trivia_rankings

 

Looks totally feasible to join through geolinks to find all articles in a specific region.

Sochi ski area maps

This Wired piece on Sochi maps notes that OpenStreetMap has way more map detail for the Olympic ski area than Google maps. It’s not entirely a surprise; Google’s coverage in Russia isn’t great, they’re not really into mapping ski lifts and trails, etc. Still, it’s a big world event, you’d think Google would have put some more effort into getting good data. Anyway, I did a map comparison from more sources than the Wired article. Nothing comes near OSM, but the Yandex maps aren’t bad. I did my best to make maps at the same scale centered on 43.6639, 40.3058.

Images in the gallery on this post. Some of why OSM looks so impressive is they just map a whole lot more kinds of features than other maps. That’s a mixed blessing. From worst to best, Bing and Apple have noticeably worse river and road data and are missing the railroad entirely; must be older data. Google’s maps won’t get you lost, Yandex has more local info still, and then the OSM maps have a generous amount of extra info.

Update: the OSM data in Sochi is years old, contributed by many mappers. Not just an Olympics one-off.

fixing iTunes corruption

iTunes corrupted my MP3 files. Not sure what happened, but I mounted my carefully-groomed 300GB of music via SMB on my Mac, imported the music, and suddenly a bunch of my MP3 files no longer play on the Sonos system. Particularly the music I bought from Amazon. Not sure what the corruption is. The file lengths are the same but the ID3 tags are different, maybe it wrote album art in? That’s worked in the past, but iTunes 11 is such a clusterfuck maybe they finally screwed it up. Or maybe it’s Apple’s broken SMB implementation causing filesystem level corruption. Either way I have to restore from backup. iTunes will no longer have write access to my music library. Screw you, iTunes.

I didn’t want to just rsync everything from a backup; was not positive that wouldn’t do some harm, and at first I had a concern that the 300GB directory might take too long. (Which is dumb; rsync is very smart.) In the end I just did an rsync, trusting the way it doesn’t delete / overwrite stuff it doesn’t need to. But first I did a bunch of verification of the files. The good news is the mtimes on the files at least got set, so it’s relatively easy to find the damage. I have to be a bit careful because the directory names are full of all sorts of messy Unicode, spaces, etc that shell programs don’t like. Also it’s 300 gigs of files, so I don’t want to just rsync the whole thing.

# find all files modified in last 20 days
$ find . -mtime -20 > /tmp/mp3.txt
$ wc -l /tmp/mp3.txt
369 /tmp/mp3.txt

# get just the directory names (ended up not using this)
$ cat /tmp/mp3.txt | while read l; do echo `dirname "$l"`; done | sort | uniq > /tmp/dirnames.txt

# make a list of what's restorable from backup
$ cat /tmp/mp3.txt | while read f; do o=/mnt/sdb1/BACKUPS/rsnapshot/monthly.1/localhost/home/nelson/Music/"$f"; [ -f "$o" ] && echo "$f"; done >| /tmp/restore.txt
$ wc -l /tmp/restore.txt
339 /tmp/restore.txt

# check what rsync would do
$ rsync -avn /mnt/sdb1/BACKUPS/rsnapshot/monthly.1/localhost/home/nelson/Music/ /home/nelson/Music/
# visual inspection
$ rsync -avn /mnt/sdb1/BACKUPS/rsnapshot/monthly.1/localhost/home/nelson/Music/ /home/nelson/Music/  | grep / | wc -l
344
# meh, close enough

# restore from backup
$ rsync -av /mnt/sdb1/BACKUPS/rsnapshot/monthly.1/localhost/home/nelson/Music/ /home/nelson/Music/