Monday, January 21, 2013
This is the old blog
After about 400 posts here, I have decided to move to a different blogging platform. So I won't be posting here any more. I'll be posting on my new blog! Onward - to the future!
Thursday, January 17, 2013
Fix R Tcl/Tk dependency problem on Mac OS X by installing working Tcl/Tk
For some reason, if you just install R on Mac OS X, you don't have a working Tcl/Tk by default. The problem manifests itself like this:
> tkplot(g)
Loading required package: tcltk
Loading Tcl/Tk interface ... Error : .onLoad failed in loadNamespace() for 'tcltk', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/Library/Frameworks/R.framework/Versions/2.15/Resources/library/tcltk/libs/x86_64/tcltk.so':
dlopen(/Library/Frameworks/R.framework/Versions/2.15/Resources/library/tcltk/libs/x86_64/tcltk.so, 10): Library not loaded: /usr/local/lib/libtcl8.5.dylib
Referenced from: /Library/Frameworks/R.framework/Versions/2.15/Resources/library/tcltk/libs/x86_64/tcltk.so
Reason: image not found
Error in tkplot(g) : tcl/tk library not available
There are other functions that depend on Tcl/Tk as well. It's particularly annoying that you don't see the problem when you install or even load a library, but only when you try to use a function that depends on Tcl/Tk.
Fortunately, there's an easy solution. You need these two things:
> tkplot(g)
Loading required package: tcltk
Loading Tcl/Tk interface ... Error : .onLoad failed in loadNamespace() for 'tcltk', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/Library/Frameworks/R.framework/Versions/2.15/Resources/library/tcltk/libs/x86_64/tcltk.so':
dlopen(/Library/Frameworks/R.framework/Versions/2.15/Resources/library/tcltk/libs/x86_64/tcltk.so, 10): Library not loaded: /usr/local/lib/libtcl8.5.dylib
Referenced from: /Library/Frameworks/R.framework/Versions/2.15/Resources/library/tcltk/libs/x86_64/tcltk.so
Reason: image not found
Error in tkplot(g) : tcl/tk library not available
There are other functions that depend on Tcl/Tk as well. It's particularly annoying that you don't see the problem when you install or even load a library, but only when you try to use a function that depends on Tcl/Tk.
Fortunately, there's an easy solution. You need these two things:
- X Windows for Mac OS X. You may already have this. If not, install it.
- A Tcl/Tk installation that actually works. This will do the trick. Just install!
After you have these two installed, things should work. I didn't even have to restart R.
> tkplot(g)
Loading required package: tcltk
Loading Tcl/Tk interface ... done
Wednesday, January 16, 2013
Opinionated notes from the NYC Ed Tech Meetup
Context: A friend asked for highlights from the NYC Ed Tech meetup that happend earlier today, so I decided to make it into a blog post.
Tonight's meetup at Knewton was great! Here are highlights, in decreasing order of how much I like them:
Tonight's meetup at Knewton was great! Here are highlights, in decreasing order of how much I like them:
- Dr. Bruce Wexler of C8 Sciences is a genius. His startup product, C8Kids, is a cognitive training web app along the lines of Lumosity, but way more sophisticated, more complete, and with better teacher interfaces for working with classes of students. It helps people make better decisions to help all kids, but especially kids with special needs, which is really cool. Not only is the project incredible, but Dr. Wexler was CONSISTENTLY the most articulate speaker, saying the right things at the right times and passing the mic when that was more appropriate. Lumosity should really just give their stacks of venture capital to C8 Sciences.
- Disclaimer: I have not actually used C8Kids, but it seems really great.
- Dr. Wexler also pointed me to BrainWare Safari, which has a kind of similar product but seems to be behind both C8Kids and Lumosity. Disclaimer again: I haven't tried it either.
- Dr. Wexler also mentioned ESCoNS2, the second meeting of the Entertainment Software and Cognitive Neurotherapeutics Society, which is happening in March in LA and has perhaps the most hippified web site I've seen in a while.
- Josh Baron from Marist (go raptors!) has done cool open source work using predictive modeling to identify students for interventions.
- Sakai is some sort of open source SIS/LMS thing. It seems like it could be good. I don't know. These sort of things have a tendency to get bloated. But: open source!
- Pentaho is some sort of open source business intelligence analytics thing. Maybe good?
- I had never even heard of PMML, the Predictive Model Markup Language. It is super cool that such a thing exists! At least in spirit, I'm totally in favor.
- OAAI is the Open Academic Analytics Initiative, which is maybe what all this is about. It's apparently their model which is supposed to be released in PMML, but I sure don't see it. I didn't search that long, either.
- Apparently there's some open source project called "Student Success Plan" but their web site is down. Possibly cool?
- The NYC Schools Gap App Challenge was totally in the house!
- I learned about things from people around me:
- Adium is apparently a chat client that some people use.
- Notability seems to be a very good iPad app for taking notes stylus-style.
- Most of Knewton's code is Java, it seems. Gross.
- Some IBM talk. connectedEDU, desire2learn, looking like you're wearing a three-piece suit even when you're not, blah blah blah. Okay there was some good message in there somewhere about united disparate data systems so that user experience is positive and the end result is good for kids, but mostly I wasn't feeling the corporate vibe and I started writing snarky tweets:
- tweet: "Bad metaphors are the new oil."#EdTechNYC Oh - also data. I hear it's a growth industry. Also, perhaps, education is good for children?
- tweet: Learning at #EdTechNYC: if you say "next chart" every 20 seconds through your presentation, you sound like an IBMer from the 1980s.
- Also somebody else tweeted about problems with a big IBM ed tech project, which sounded about par for the course: CALPADS 'in danger of failure'
Okay! So that was it! Pretty good! Thanks for the space and drinks, Knewton, but next time please provide plates to carry snacks on - I can't stand right by the snack table all the time! Important issue!
Sunday, January 13, 2013
Upload images to your imgur account from the command line
If you just want to anonymously do a command line upload to imgur, use Bart Nagel's fairly complete imgurbash.sh, available along with many other tools on imgur's apps page. To make it work on my Mac I installed GNU sed with brew install gnu-sed and changed sed to gsed in the script, and it works fine, but it doesn't connect to your imgur account.
Another approach is to pull out an imgur cookie from a browser session and then sort of just pretend to be that browser session from some programming language. Lance Pollard wrote up something about this for Ruby. It might work. To me, it's a pretty ugly way to go about it.
I had never really done anything with OAuth2, so I felt pretty victorious when I got this to work. Alternate title: "Five minutes to OAuth2 uploads on imgur". I presume that you already have an imgur account for the following.
Step One: Register an application. The application is really just you, but that's fine. Choose "Desktop" for "Application Type". You should quickly get to a success page that gives you a "Client ID" and "Client secret". These are just strings that identify you; use them in the all-caps spots in subsequent steps.
Step Two: In a browser, go to this URL:
https://api.imgur.com/oauth2/authorize?client_id=YOUR_CLIENT_ID&response_type=pin
This is where you log in, convincing imgur that you are really you. You should quickly get to another success page that gives you a new string, this one being a "PIN".
Step Three: At the command line, enter this:
curl -X POST -F "client_id=YOUR_CLIENT_ID" -F "client_secret=YOUR_CLIENT_SECRET" -F "grant_type=pin" -F "pin=YOUR_PIN" https://api.imgur.com/oauth2/token
This will get you a JSON response which will include "access_token", which is the useful bit. You might also be interested in "refresh_token", but I'm not going there in this post.
Step Final: At the command line, enter this:
curl -X POST -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -F "image=@PATH_TO_YOUR_IMAGE_FILE" https://api.imgur.com/3/upload
If cURL is talking about not being able to access your file, mess around with un-escaping spaces and stuff like that. It'll work. And this time you'll get a nice JSON response which includes an "id" and a "link" to your newly uploaded file - and that file will also now be appearing on your imgur account images page! This is especially good if you have a pro account and want your images to stay up indefinitely.
That's it! You can probably automate this further if you want. If you're building a web app, there are other better ways to interface with OAuth2. You can check the whole imgur API documentation.
Another approach is to pull out an imgur cookie from a browser session and then sort of just pretend to be that browser session from some programming language. Lance Pollard wrote up something about this for Ruby. It might work. To me, it's a pretty ugly way to go about it.
I had never really done anything with OAuth2, so I felt pretty victorious when I got this to work. Alternate title: "Five minutes to OAuth2 uploads on imgur". I presume that you already have an imgur account for the following.
Step One: Register an application. The application is really just you, but that's fine. Choose "Desktop" for "Application Type". You should quickly get to a success page that gives you a "Client ID" and "Client secret". These are just strings that identify you; use them in the all-caps spots in subsequent steps.
Step Two: In a browser, go to this URL:
https://api.imgur.com/oauth2/authorize?client_id=YOUR_CLIENT_ID&response_type=pin
This is where you log in, convincing imgur that you are really you. You should quickly get to another success page that gives you a new string, this one being a "PIN".
Step Three: At the command line, enter this:
curl -X POST -F "client_id=YOUR_CLIENT_ID" -F "client_secret=YOUR_CLIENT_SECRET" -F "grant_type=pin" -F "pin=YOUR_PIN" https://api.imgur.com/oauth2/token
This will get you a JSON response which will include "access_token", which is the useful bit. You might also be interested in "refresh_token", but I'm not going there in this post.
Step Final: At the command line, enter this:
curl -X POST -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -F "image=@PATH_TO_YOUR_IMAGE_FILE" https://api.imgur.com/3/upload
If cURL is talking about not being able to access your file, mess around with un-escaping spaces and stuff like that. It'll work. And this time you'll get a nice JSON response which includes an "id" and a "link" to your newly uploaded file - and that file will also now be appearing on your imgur account images page! This is especially good if you have a pro account and want your images to stay up indefinitely.
That's it! You can probably automate this further if you want. If you're building a web app, there are other better ways to interface with OAuth2. You can check the whole imgur API documentation.
Subscribe to:
Posts (Atom)