You Are My Sofa

Sunday, January 15, 2012

Preventing your users from using

Hey, maven; how's that crawling/mirroring prevention working for you?


doppelganger:~> wget http://repo1.maven.org/maven2/org/clojure/clojure/1.3.0/clojure-1.3.0.zip
--2012-01-15 13:01:48-- http://repo1.maven.org/maven2/org/clojure/clojure/1.3.0/clojure-1.3.0.zip
Resolving repo1.maven.org... 207.223.241.90
Connecting to repo1.maven.org|207.223.241.90|:80... connected.
HTTP request sent, awaiting response... 403 Forbidden
2012-01-15 13:01:48 ERROR 403: Forbidden.

8 doppelganger:~> wget -U foo http://repo1.maven.org/maven2/org/clojure/clojure/1.3.0/clojure-1.3.0.zip
--2012-01-15 13:01:36-- http://repo1.maven.org/maven2/org/clojure/clojure/1.3.0/clojure-1.3.0.zip
Resolving repo1.maven.org... 207.223.241.90
Connecting to repo1.maven.org|207.223.241.90|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 4502666 (4.3M) [application/zip]
Saving to: `clojure-1.3.0.zip'

100%[==================================================================================>] 4,502,666 451K/s in 9.6s

2012-01-15 13:01:46 (459 KB/s) - `clojure-1.3.0.zip' saved [4502666/4502666]

Sunday, July 10, 2011

How I accidentally deleted everything from my Dropbox (and then recovered it again)

How I deleted everything


I had dropboxd running on a headless Linux box, but at some point I stopped running it and deleted ~/Dropbox altogether. Thought nothing more of it.

Today, I decided I needed it back, so I ran dropboxd again. It helpfully reminded me that I had deleted my Dropbox dir:

$./dropboxd
Couldn't locate your Dropbox folder. Did you move it somewhere?


Ok, cool, so I just need to mkdir ~/Dropbox. No problem. Done.

Then a minute later I see this notification pop up on my desktop: "481 files have been removed from your Dropbox folder." Cue flipping out, and verifying on the Dropbox website that yes, I have removed 481 files and 171 folders. Unfortunately I didn't see any way to revert that change.

Why it happened


Of course, I had had Dropbox set up on this box before, so it knew what files it should be seeing, from the last time it ran. And when I re-created that folder, to Dropbox it appeared that I had simply deleted everything in it.

Had I thought to rm ~/.dropbox/filecache.db and maybe rm ~/.dropbox/sigstore.db, it would simply have thought I never had any files, and performed a sync from scratch.

But I didn't had thought to did that.

How I fixed it


This isn't a perfect fix, but I thought, hey, what if I delete the db files from my laptop's installation? It's been in sleep mode this entire time, and I can turn it on without a network connection, stop Dropbox, delete those files, and then when I restart Dropbox it'll think they're all newly-added files from this computer. It'll also give me a chance to make a copy of my laptop's Dropbox folder.

And as a bonus, Dropbox is smart enough not to re-upload files it recognizes are the same locally as remotely, even in the absence of its file cache database.

Less than 5 minutes later, my laptop has re-submitted the recently-deleted files to my Dropbox account, and both my desktop and headless box have re-downloaded them. The event log on the Dropbox site informs me that after deleting 481 files and 171 folders, I then added 481 files and 171 folders. Cool. And one conflicted file that I had updated on my desktop after putting my laptop to sleep yesterday. Easily fixed.

My full process to restore the files:
  1. Kill the rogue deletion dropboxd process
  2. rm -fr ~/.dropbox (just to be safe — meant I had to re-link the computer to Dropbox)
  3. Turn off wireless switch on laptop
  4. Turn on laptop
  5. Quit Dropbox
  6. Back up Dropbox folder
  7. Erase filecache.db and sigstore.db from C:\Users\me\AppData\Roaming\Dropbox\
  8. Start Dropbox
  9. Watch as it compares the contents of my local folder against the repository, re-uploading the accidentally deleted files and pointing out my not-deleted conflicted file


Other thoughts


Dropbox keeps a history of all your files and their contents in its versioning system. Even if you delete a file, it's still stored on the server; for me, this fell apart because the UI lacked a way to undo an entire "event". In order to restore my files, I would have to go into every folder and identify the most-recently-deleted files to restore them. A large number of the stuff deleted was various backups of SD cards and stuff with lots of contents; not really feasible to do that one folder at a time.

The fix I used worked for me because I didn't actually delete ALL my files, and I assumed (correctly, I believe) the only files that got removed were all present and unmodified on my laptop compared to their state immediately before removal. That meant my laptop was able to upload them all and restore the state of the repository as a whole. The conflicted file was handled in a particularly sane manner, and it stood out on the event list.

Of course, you could create a support ticket and ask them to undo your mistake too. That would be a lot less work, and they seem to be pretty quick about it.

Tuesday, March 22, 2011

Android fragments and fragmentation

Android 3.0 introduces "fragments" for tablets, which act like activities but you can have several of them on screen at once.

However, since using fragments requires an Android 3.0 device, even if it's not a tablet, they've introduced some fragmentation, which is everyone's favourite reason to dislike Android.

So, to solve this problem, Google has released a fragments library for older API versions.

Effectively, what they've done is introduce a fragmentation library to deal with fragmentation introduced by introducing fragmentation.

Sunday, January 02, 2011

why i now hate time machine

system.log.3.bz2:Dec 29 20:25:41 robot com.apple.backupd[4085]: Backup content size: 318.7 GB excluded items size: 81.5 GB for volume Godzilla Hårddisksson

EXCLUDED ITEMS? Why isn't it a little louder about this, rather than letting me try to restore the backup 4 days later and finding that a shitload of files are just MISSING? I'll never have those recipes again.

Argh...

Can I see a list of files I've lost from that 81.5 GB?

Wednesday, November 10, 2010

Remote desktop and updates

When you use your Windows box exclusively over Remote Desktop, it doesn't seem to care much that you're logged in when updates come. Instead of pestering you about installing them, it just reboots. So sometimes I come in in the morning and my session is gone.

Sunday, November 07, 2010

mmm frozen blueberries

mmm frozen blueberries

Friday, November 05, 2010

Aspects

There are all these shows and movies that depict a future timeline, and they all try to show computers as being futuristic while completely missing the mark[0].

That's fine. One thing that I find absolutely remarkable about them all, though, is that they almost invariably use a 4:3 aspect ratio for their screens. Even if they have wide-ass screens, they are often still composed of 4:3 screens. Even if they DIDN'T EVEN USE REAL SCREENS for them.

These days, 4:3 screens are becoming rare. Everyone's all 16:9 or 16:10, with 16:9 seeming to be becoming the more common one, even on computers where 16:10 has generally been the more common widescreen format.

[0] I assume. Some of these still happen in the future, so maybe 4:3 will become popular again. I would be perfectly happy to see 1:1. Square things make me happy. Remember when non-square pixels were particularly common?