Copying an existing Linux system to a new hard drive

I recently upgraded my home desktop's hard drive, because the old one was getting a bit full. Googling for instructions about how to transfer an existing system onto a new drive, many posts suggest using the cpio command, and that's what I tried. While this command does the job for the most part, there is one caveat which I encountered that makes cpio not the ideal tool to use.

Don't use cpio to clone filesystems. Why? Because GNU cpio doesn't support access control lists (ACLs) or extended attributes (xattrs).

Using cpio will end up a little screwy in some edge cases because of this. The particular case I ran into involved folders in /media that are managed by udisks2. udisks2 creates personal mount folders under /media with tailored ACLs to help properly manage permissions for permission-capable filesystems mounted by regular users. If you already have one of these personal mount folders, cpio will break it, and you'll lose permission to view any filesystems that you mount under it henceforth.

A better solution than cpio: rsync -caHAX src/ dest/

(Edit: Add -v to also see progress.)

As a side-note: if applicable, don't forget to run sudo dpkg-reconfigure grub-pc and set the [...]

Read this post

Adding the binary entropy function to LibreOffice Calc

Lately at work I've been doing some data analysis in LibreOffice Calc that requires the binary entropy function. The function itself looks like H2(x) =  − xlog2(x) − (1 − x)log2(1 − x), where 0log2(0) is taken to be 0. It's this latter point that makes things a little tricky. LibreOffice Calc doesn't have this function built-in, sadly, and you have to explicitly guard for the case where x is 0 or 1, which is not easy to pull off inside a cell.

So I wrote a basic macro that implements it:

Function BINENT(x)
    If x = 0 Or x = 1 Then
        BINENT = 0
    ElseIf x > 0 And x < 1 Then
        BINENT = -(x*Log(x) + (1 - x)*Log(1 - x))/Log(2)
    Else
        BINENT = Null
    End If
End Function

To be able to use BINENT in Calc, go to the “Tools” menu, “Macros”, “Organize Macros”, and select “LibreOffice Basic...”. You'll be shown a window with a library hierarchy on the left. Under the “My Macros” collection, select the “Standard” library, then click the “New” button on the right. This will open up the editor. Copy and paste the BINENT code above into the editor window [...]

Read this post

How to subscribe any email address, including a GMail alias, to a Google group

A few of the interests I have and projects I follow use Google Groups to keep in touch. Essentially, these are just mailing lists that Google maintains. At any rate, while it's possible to subscribe to a group without having a Google account by sending an email to (group name)+subscribe@googlegroups.com, if you do have a Google account and use GMail with aliases, it can be tricky to ensure that you subscribe using your preferred address. This is because Google, in its infinite wisdom, will subscribe your GMail address if it detects you attempting to subscribe under any alias that's associated with your GMail account. That has the side-effect that you won't be able to post to the group with anything but your GMail address.

Luckily there's an alternative subscription mechanism (which I spotted here). If you instead use the Google Groups web interface, Google won't have the opportunity to inspect your email headers and determine if you're using a GMail alias. So, you will end up with your preferred address subscribed to the group, instead of your GMail address.

The URL you need is https://groups.google.com/forum/#!forum/(group name)/join where (group name) is [...]

Read this post

How to find, and obliterate, large files in the history of a subversion repository

Sometimes, as I have, you'll find yourself working with colleagues who, through no fault of their own, are either not acquainted with the etiquette of Subversion repository use, or simply have an accident. What you may then end up with is a repository that contains one or more giant blobs of useless data that, really, should never have been added in the first place. Whether or not the culprit well-intentionedly removes these giant blobs in subsequent revisions, you're still left with a huge chunk of nothing-much wasting space on your server's hard drive.

Though a long-standing item on Subversion's wishlist, there is no command that will simply obliterate files from the repository's history. Nevertheless, there is a way to achieve this. Here's how.

The first step of the process is to determine which files need to go. (Some snippets in the following are derived from StackOverflow and Christosoft blog.) First, find the size of each revision in the repository. Replacing REPO appropriately, run this on your server:

REPO=[/absolute/path/to/repo]
for r in `svn log -q file://$REPO | grep ^r | cut -d ' ' -f 1 | tr -d r`
do
    echo "revision $r is " `svn diff -c $r file://$REPO [...]

Read this post

A new beginning: Relaunching my website

Some time ago in a far off land, I kept a website. It was a cozy little website, housing a few bits and bobs that I had made and thought to share should other people find them at all useful. It was hosted with my ISP, accessible via a free domain, which made things cheap and easy for me, but also meant that if I were ever to move I'd have to find a new host, or lose my site.

Of course I moved and I lost my site. This was a couple of years ago, now. From then until now I've been meaning to get this thing back up and running at some point, but lack of time and real impetus meant that it didn't happen. Recently I got my butt into gear and began a focused effort to finally get it off the ground, getting myself some cheap hardware and a new domain name for the purpose.

What you see here is the result—welcome to Quantum Furball! Over the next little while I'll be reposting old things (backdated as accurately as I can guess), along with things I should've posted at the time, and I hope to [...]

Read this post

Published in Optics Express: Generating polarization-entangled photon pairs using cross-spliced birefringent fibers

Generating entangled photon states is vital for numerous quantum communications and quantum computation primitives. Here we pioneer a new approach to in-fiber generation of entangled photon pairs. We take inspiration from a technique in bulk-optics, where two nonlinear crystals are sandwiched close together, and splice two pieces of birefringent optical fiber together at 90 degree orientation. With suitable compensation optics, all of which could be implemented in fiber, we show fidelity with a maximally-entangled Bell state of better than 92%.

E. Meyer-Scott, V. Roy, J.-P. Bourgoin, B. L. Higgins, L. K. Shalm, and T. Jennewein
Optics Express 21, 6205–12 (2013)

Read this post


← Previous | Page 6 of 9 | Next →