Although the answer provided by Zentrope was correct for the question as stated, it turns out I didn’t understand what was actually going on, and so it didn’t work in production. Now that I have a better answer, here’s me trying to explain it:
I’m using zip and zip-filter to work with an Amazon ECS library. This is how Amazon presents author names:
<authors>
<author>Author One</author>
<author>Author Two</author>
</authors>
That can be arbitrarily long; textbooks, for example, have a half-dozen authors sometimes. The Harry Potter books list both Rowling and Mary GrandPre as the authors, sometimes even listing GrandPre first in the XML.
The way that I was handing this in the interpretation stage resulted in this
(zf/xml-> Item :ItemAttributes :Author zf/text)
which appeared to return a string, but actually, whenever I tried to work with it, behaved like a lazy sequence. Passing it forward into my JSON wrapper resulted in a string that wrapped author names in brackets and double-quotes.
So when I asked about dealing with a string with those attributes, I thought I was dealing with the problem. It turns out that the code provided
(apply hash-map (read-string “["these are" "author names"]”))
works on a string, but throws errors, for good reason, when handed my lazy sequence.
All is not lost, though; this pointed me in the right direction. This works:
(apply vector (zf/xml-> Item :ItemAttributes :Author zf/text))
That resolves down to a vector with an arbitrary number of author names in it, which I can then safely JSONize and deal with forward and backward.
I have a sequence in clojure that returns the string “[“These are” “author names”]”. How do I turn that into the map {“These are” “author names”}?
The bacterium, with its 525 genes, is far less complex, for example, than another more traditional bacterium used in traditional laboratory experiments, E. coli, which contains 4,288 genes. The researchers said that more complex cells would present significant challenges. Currently it takes about 9 to 10 hours of computer time to simulate a single division of the smallest cell — about the same time the cell takes to divide in its natural environment.
“The real question on our minds is: what happens when we bring this to a bigger organism, like E. coli, yeast or even eventually a human cell?” Dr. Covert said. He noted that E. coli divides every 20 to 30 minutes and that the number of molecular interactions in E. coli is a much higher multiple, which would significantly extend the time required to run the simulation.
“I’ll have the answer in a couple of years,” he wrote.
“I’ll have the answer in a couple of years,” he wrote.
NYTimes: In First, Software Emulates Lifespan of Entire Organism
Use an inner join
…But that only gives me everyth— wait
Oh, hell, no one pointed out you can AND inside an inner join. Duh.
“SELECT * FROM books INNER JOIN userbooks ON books.isbn10 = userbooks.isbn AND userid = #”
So, I’m a complete moron when it comes to database design, but I thought I’d be a little clever with my current learning project (building a library management in clojure using noir — think delicious library, but not as polished and using the web) and make the database structure a little more sophisticated than just a big pile of book metadata. I wanted to theoretically be able to support multiple users, accounts, etc.
So I mapped out a three-table system. In one table, you have users: username, hashed password, and user_id. In another, you have all the book metadata: titles, authors, descriptions, isbn numbers, and book_id. In a third table, you have the user-to-book mapping: user_id, book_id, date_added, the idea being that when a user adds a book to their library, I just kick another row into that table and get on with things.
What I didn’t think through was what SQL I needed to write in order to get out of this database an arbitrary list of books that a user has. I can do the first step: “SELECT * FROM userbooks WHERE user_id = “. But I don’t know how to map the list of book_ids (I might switch over to using ISBNs, but the mechanics are the same) I get from that onto the books table. Can this be done in a single SQL statement? Have I doomed myself, and need to rethink my databases?
What a brilliant “interview”.
I interviewed Jodi.org about their uncompromising work via email and, in typical fashion, they refused to respond to me using text… communicating only in scrambled HTML code and links. No, really. It was like interviewing someone from the future (or the past’s version of the future?). You try to figure it out.
Mark Allen: Can I ask you guys a few questions about your work?
i j=kNow thKKANKAAark Allei j=kNow the answerKKANKAAark Allei j=kNow the answerKKANKAAark Allei j=kNow the answerKKANKAAark Allei j=kNow the answerKKANKAAark Allei j=kNow the answerKKANKAAark Allei j=kNow the answerKKANKAAark Allei j=kNow the answerKKANKAAark Allei j=kNow the answerKKANKAAark Allei j=kNow the answerKKANKAAark Allei j=kNow the answerKKANKAAark Allei j=kNow the answerKKANKAAark Allei j=kNow the answerKKANKAAark Allei j=kNow the answerKKANKAAark Allei j=kNow the answerKKANKAAark Allei j=kNow the answerKKANKAAark Allei j=kNow the answerKKANKAAark Allei j=kNow the answerKKANKAAark Allei j=kNow the answerKKANKAAark Allei j=kNow the answerKKANKAAark Allei j=kNow the answerKKANKAAark Allei j=kNow the answerKKANKAAark Allei j=kNow the answerKKANKAAark Allei j=kNow the answerKKANKAAark Allei j=kNow the answerKKANKAAark vccccccccccccccccAllei j=kNow the answerKKANKAAark Allei[…]
The Awl: A Suitably Bizarre Interview With The Early Web Provocateurs At Jodi.Org
The difference between working nook support at the retail level at Barnes and Noble and my current job supporting Kindling is this:
At Barnes and Noble, if a customer came in with a weird software problem, or they’d identified a bug in the software, there wasn’t much I could realistically do. I certainly couldn’t fix it, and there wasn’t much of a communications channel to the developers in California to pass the relevant information along.
Now, the support team has a meeting every afternoon with the CTO of the company, the man who leads the development team, to talk about problems that customers are facing that we can’t solve on our own, or are likely bugs in the software. Today, we identified, wrote, tested, and deployed a fix for a bug that was preventing a customer from using a part of the app that had gone unnoticed in production until that point because it required a setup we didn’t test with all that rigorously. It took three hours front-to-back to go from identification to deployment.
That’s the power of startups.
Neat hack, although stunningly pointless.
Carbon fiber: not just for meaningless detailing on overpriced sports cars anymore!
Hands-on with Gigabyte’s incredibly light carbon fiber X11 laptop | The Verge