Saturday, July 14, 2012

Smartphone app for verbal confidential agreements

A professor recently cautioned a graduate-student class not to share research ideas too liberally as sometimes professors steal the ideas of students. It is helpful to get input on ideas, however, so using a mechanism such as an NDA would seem appropriate in preventing this. I would imagine that most of the most vulnerable type of interaction is face-to-face meetings. In this case what would be nice is to audio-record a quick declaration of confidentiality and then the subsequent conversation. If an IP lawyer made a short script that could be read and recorded then a smart-phone could be created that would play the "this a confidential conversation" audio and then start recording. Any takers?

Wednesday, July 11, 2012

StatWeave in LyX

While it's pretty easy to integrate R into LyX documents (using Sweave or knitr) I hadn't found any native way of integrating Stata code. I've hacked StatWeave (which allows Stata, R, and a bunch of other stat languages) to work in my LyX (in Windows 7 with LyX 2.0.4) and thought that others might like this as well. Here's the steps:

  1. Copy statweave.module to the "Resources/layouts" of your user directory (See HelpAbout LyX).
  2. Open LyX and go to  Tools→Reconfigure
  3. Restart LyX and go to  Tools→Preferences
  4. On the left choose File HandlingFile Formats.
  5. Click the New... button and then fill in  Format: StatWeave, check Document format, Short Name: statweave, Extension: swv. Then Apply.
  6. On the left choose File HandlingConverters
  7. Using the drop-down menus, create a new one from "StatWeave" to "LaTeX (pdflatex)" with the command "statweave --target tex $$i" (make the changes and then click "Add" in the upper right). Then Save.
Once you get that setup you should be able to compile: stata-test-bq.lyx. Notes:
  • LyX disables the enter key from inserting a line-break in insets (anyone who knows about this please let me know why or a work around). You can paste them, though, so copying several lines of code into a Stata Code Chunk insert works fine (if you are writing it in LyX then just copy a line break from somewhere and paste as needed). 
  • If you don't want to use the custom insets you can always just use plain TeX code (e.g. You can always just use TeX code inserts \begin{Statacode} ... \end{Statacode} or \Stataexpr{...})
  • The StatWeave manual is helpful for the non LyX part.
  • When configuring your Stata executable do not include "do " before "%codefile%".
  • You may need to edit the MiKTex path given the default ones are for version 2.6.
  • If you want to use relative paths for input files then you can pass the directory of the LyX file to Stata as an environment variable. In the converter replace the statweave command with "set orig_PWD=$$r && statweave --target tex $$i" (then ModifySave). Then in Stata you can change do that directory with -global orig_PWD =trim("`:environment orig_PWD'")"- (it will have the final slash). Don't cd around in the program or StatWeave wont' know where it's graphics files are for conversion.
Suggestions very appreciated.

Update: I've made a newer version the just focuses on Stata and allows for code block options. You can easily show figures now right-clicking in the block, choosing opts, and then putting in a string like fig, height=4.5in, width=9in, dispw=4in

Monday, May 31, 2010

Exchange for book site credits

I use several online book-exchange sites (e.g. PaperBack Swap and BookMooch). I find, however, that often my demand for books and my available credits will be on different sites. What would be great is if there was a credit-exchange for these kinds of scrip (like a foreign exchange market). On this new website, users could register their book-exchange site usernames and then put in orders for trading the different types of credits. It could operate on varying levels of trust. In all of the level, the minimum requirement is that the book-exchange sites allow people to transfer credits.

  1. If the credit-exchange was completely trusted, it could provide the settlement, logging into the book-exchange sites and transferring the credits simultaneously. This requires giving the credit-exchange one's passwords to the other sites.
  2. If the credit-exchange was partially trusted it could provide escrow services. Once a trade was matched, the two parties would transfer the credits to accounts held by the credit-exchange. Once both parties had transferred, the credit-exchange would complete the trade.
  3. If the credit-exchange wasn't trusted, the site would just inform the matched parties of the trade details and let them settle it themselves. For this latter to work well, the book-exchange sites would probably also have to provide messaging services and some form of feedback/reputation to discourage reneging.

Surveying the current available book-exchange sites (discounting "swap" sites that don't use credits) the two largest sites do allow transferring credits, so this idea is feasible. And it would be good for the sites involved as it would stimulate more usage (regardless of how the "exchange rate" was). Anyone want to try to set this up? For the economists out there, could you use insider access to data on trades in a clever way?

Book exchange sites
Site Credit price Credits per book Coverage Transferable credits Private messaging Reputation/ Feedback
PaperBack Swap $3.45 1 USA Yes Yes No
BookMooch NA 1 Intl Yes ("smooches") Yes Yes
Bookins $0.60 varies (3-8) USA No (user names hidden) No No
What's on my bookshelf $2.00 varies (1-2) Intl No Yes Yes
Readers United $0.50 varies (5-30) Intl No Yes Yes
Title Trader Yes ($3-4) varies (1-2) Intl No Yes Yes
2swap NA 1 USA No Yes No

Update: After searching the forums of PBS and BM, it appears that there are only a few people who ask for trades, so the market is probably fairly small.

Friday, April 27, 2007

Russian books a bit easier

One difficulty I've heard of for the casual reader of many Russian novels, such as those by Dostoyevsky, is the multiplicity of names for the same characters. Well, with a list of names for each character, free translations (from Gutenberg), and some find-and-replace, I've made versions of Crime and Punishment and Brothers Karamazov where each character is only referred to by one name. Of course it looses something with the simplification, but if confusion of the names is a real problem maybe someone will find this useful.