Apache appears to be listening on ::1 but not 127.0.0.1.
$ telnet localhost 80
Trying ::1...
Connected to localhost.
Escape character is '^]'.
$ telnet 127.0.0.1 80
Trying 127.0.0.1...
Apache appears to be listening on ::1 but not 127.0.0.1.
$ telnet localhost 80
Trying ::1...
Connected to localhost.
Escape character is '^]'.
$ telnet 127.0.0.1 80
Trying 127.0.0.1...
I receive a number of periodic emails that prompt me to do something (e.g. take an electricity meter reading). I wanted to be able to add information to those emails to remind me how to perform the task.
This JavaScript allows me to configure rules so that I can display a link to a web page when I'm viewing an email with a specific subject in Gmail.
I'm currently hosting the JavaScript and installer web page using rawgit.com.
Visit this page to install the bookmarklet.
Chriss-MacBook-Air-2:~/Code/alphagov/smart-answers$ rake test TESTOPTS="--seed=56021" | |
* DEFERRED: sequence of two questions a question raises an error should permit custom error messages per question. | |
Run options: --seed=56021 | |
# Running: | |
............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................. |
I disabled my Internet connection and ran the tests in the Smart Answers project to see how many relied on being able to make connections to the outside world.
The current test set-up requires the use of contexts to move through the Smart Answer. We can avoid this by removing the memoization of @state
in FlowTestHelper
. I temporarily removed it and ran the tests to see how much longer they took and whether we'd have any failures.
def current_state
# @state ||= begin
@flow.process(@responses)
# end
end
source 'https://rubygems.org' | |
gem 'nokogiri', '1.5.11' | |
gem 'test-unit' |
I've been using [FileWatcher][] to perform actions on new/changed files. I ran into problems where FileWatcher invokes the block before the file has finished copying and my code then fails.
My script runs using launchd so I considered investigating the WatchPaths
launchd.plist directive. The man page for that directive says not to use it because of the some of the problems I've been having with FileWatcher.
Use of this key is highly discouraged, as filesystem event monitoring is highly race-prone, and it is entirely possible for modifications to be missed. When modifications are caught, there is no guarantee that the file will be in a consistent state when the job is launched.
The scripts in this gist are investigations into alternative approaches to only acting on files that have been created/changed.
In 'storing-a-hash-of-files.rb' I also compared the performance of Ruby's Digest::MD5
to the system md5
but there didn't seem to be any difference. The system md5
required me to use Shellwords
t
Demonstration of the problem of precalculate
blocks not being evaluated in the first question of a Smart Answer.
Assuming the flow lives in "lib/smart_answer_flows/" and the test lives in "test/integration/smart_answer_flows/", you can run the test with bundle exec ruby test/integration/smart_answer_flows/example_flow_test.rb
.
Note the absence of "Q1 - precalculate" in output.txt.
Comparison of the visualisation of two Smart Answers: one using next_node_if
and one using a combination of next_node
and permitted_next_nodes
.
The Smart Answer using next_node_if
can be visualised correctly while the one using next_node
and permitted_next_nodes
cannot. See the attached screenshots for both visualisations.