diffyQ
u/diffyQ
I'm trying to write code to scrape the National Gallery of Art's calendar page and turn it into an atom feed. The problem I have is that the resulting file generates 'invalid byte sequence' errors when I later try to parse it. Here's the code snippet that generates the atom file:
require 'curb'
c = Curl::Easy.new('http://www.nga.gov/programs/calendar/') do |curl|
curl.follow_location = true
end
c.perform
doc = c.body_str
doc = national_gallery_of_art doc
filename = 'example.xml'
File.open(filename, 'w+') do |f|
f.puts doc
end
where the national_gallery_of_art function is defined [here](http://pasteb
clojure has the handy doto macro for java interop. You pass it a symbol and a series of forms -- usually representing java method calls -- and it calls those methods on the object referenced by the symbol. So
(def out (java.io.PrintWriter. "example.txt"))
(.println out "The first line of the file")
(.println out "The second line of the file")
(.flush out)
is equivalent to
(def out (java.io.PrintWriter. "example.txt"))
(doto out
(.println "The first line of the file")
(.println "The second line of the file")
.flush)
I'm learning about scheme macros, and I've made a first attempt to implement doto using syntax-rules:
(define-syntax doto
clojure has the handy doto macro for java interop. You pass it a symbol and a series of forms -- usually representing java method calls -- and it calls those methods on the object referenced by the symbol. So
(def out (java.io.PrintWriter. "example.txt"))
(.println out "The first line of the file")
(.println out "The second line of the file")
(.flush out)
is equivalent to
(def out (java.io.PrintWriter. "example.txt"))
(doto out
(.println "The first line of the file")
(.println "The second line of the file")
.flush)
I'm learning about scheme macros, and I've made a first attempt to implement doto using syntax-rules:
(define-syntax doto
THIS IS HAPPENING! Get down to the Vera Project and check out Seattle's small press scene.
I've got a reasonably strong DEEE of Ashenzari (I'm playing the wedkly challenge) and I'm trying to decide how to play out the late game. Here's the char dump. I've picked up the serpentine, barnacled, and silver runes and I've cleared Hive, Elf, Crypt, and the dungeon down to level 27. Any suggestions before I dive for the Orb?
Hells: I've never obtained a rune from any hell branch, but I'm not sure that this is the character to do it. I'm worried about my low HP and I don't have a reliable means of channelling. I could maybe train evocations and carry a staff of channelling, but I feel that poor Ioannis is too squishy to survive. If
I read articles about Lua and Guile, and it looks like one thing that separates these languages from other popular scripting languages is the ease of embedding an interpreter into your C program (for example). I don't have any experience with this kind of embedding, but I have used FFIs for a couple different languages to call out to C APIs. What sorts of design considerations would favor the embedded approach over writing a C library with a clean API?
Erik the Demigod Sensei
This is my second ever DCSS ascension! For a while now I've been wanting to play a transmuter whose late game was all dragon form + haste. Success! Mostly when playing transmuters I play sludge elves, but every so often I throw in a demigod. The stat bonuses works well with transmuter combat spells, but the slow level gain usually means early game death.
This time, I happened across a staff of energy early on. This was huge, because it meant that I could cast blade hands indiscriminately without keeping an eye on my food supply. I found a spellbook with dragon form fairly early; the main difficulty was getting my skills to the point that I could cast it reliably. I
I'm working on a project now where I'd like to do Monte Carlo simulations of a stock market. In my reading, I've come across geometric random walks, ARIMA models, and GARCH models. The problem is that I'd like to generate runs that go about 30 years into the future (I'd like to model retirement savings plans), and I don't feel comfortable extrapolating any of these models that many steps.
So far, I haven't had much luck on Google. I was hoping someone here could point me to a resource. Academic papers are good, but I'd be happy just to know what the industry standard is here.