im going through the setup on
http://www.railstutorial.org/chapters/static-pages#fig:autotest_green
and im stuck on this particular error:
ERROR READOUT: http://pastie.org/1015405
What i can see being the tell-tale issue here is the
No such file or directory - Files/rubygems-1.3.7/rails_projects/sample_app/spec/controllers/pages_controller_spec.rb
"Program Files" has been truncated to just "Files" and hence the programs cant find what its supposed to be looking for
READOUT of pages_controller_spec.rb: http://pastie.org/1015412
Looks to me like it's an issue with a space in the filepath:
c:/Program Files/rubygems-1.3.7/rails_projects/sample_app/spec/controller s/pages_controller_spec.rb
Seems that is getting translated to
Files/rubygems-1.3.7/rails_projects/sample_app/spec/controller s/pages_controller_spec.rb
be sure to always place quotes around paths that contain a space ;)
SO i finally get what you're suggesting .. and it makes sense..
'mtime' => lambda {|file_a, file_b| File.mtime(file_b) <=> File.mtime(file_a)}
the above code is what is contained on line 7 of the "options.rb"
i tried supstituting in single as well as double quotes in the following manners:
'mtime' => lambda {|"file_a", "file_b"| File.mtime("file_b") <=> File.mtime("file_a")}
and
'mtime' => lambda {|'file_a', file_b'| File.mtime('file_b') <=> File.mtime('file_a')}
both led to new/different errors soo thats now how to do it
SADLY i think this is what i didnt want to see:
https://rspec.lighthouseapp.com/projects/5645/tickets/711-autospec-fails-when-filepaths-include-spaces
Related
TL;DR
How to find where exactly vim or nvim error started (which file?) when I'm interested in fixing the actual issue and not just removing the bad plugin? Anything better than strace and guesswork to find the error origin?
Issue
I often add a plugin to my vim or nvim config and end up getting errors on hooks (buffer open, close, write):
"test.py" [New] 0L, 0C written
Error detected while processing function 343[12]..272:
line 8:
E716: Key not present in Dictionary: _exec
E116: Invalid arguments for function get(a:args, 'exec', a:1['_exec'])
E15: Invalid expression: get(a:args, 'exec', a:1['_exec'])
The problem is, I have no idea where those come from, only get some line number of unknown file and I know it's not my vim/nvim config file.
Somewhere, you have a plugin that has defined a dictionary with anonymous-functions (check the help related to this tag).
For the curious ones, it's done this way:
let d = {}
function! d.whatever() abort
throw "blah"
endfunction
When you execute this function, you'll get the kind of error you're currently observing. That's why I stopped working this way to prefer:
let d = {}
function s:whatever() abort
throw "blah"
endfunction
let d.whatever = function('s:whatever') " a workaround is required for older versions of vim
" At least this way I'll get a `<SNR>42_whatever` in the exception throwpoint, and thus a scriptname.
That's the why. Now, back to your problem, AFAIK, the only things you'll be able to know are the two functions that have been called:
in line 12 of :function {343}, you've called
:function {272} which contains an error at line 8.
Thanks to these two commands (may be prefixed with :verbose, I don't remember exactly), you'll get the source code of the two functions, which you should be able to use in order to grep your plugins to know where it appears.
Just beginning to learn programming, and starting out with Ruby. Doing some copy typing exercises from Zed Shaw's Learn Ruby the Hard Way
In doing exercise 15 and 16, covering opening files, I run into the same problem when I try to run it.
target = open(filename, 'w')
I get the message:
say.rb:10:in open': no implicit conversion of nil into String
(TypeError) from say.rb:10:in'
What does this mean? And how do I correct this?
Thanks in advance!
Direct screen shot from the LRTHW website
I think your filename variable value is not initialized or nil.
filename = "path/to/file"
target = open(filename, 'w') if filename.present?
Everyone: thanks for peering into my question. I had a friend of mine figure out what the problem was. I had forgotten that the whole point of the exercise was to use the ARGV, and that was the missing link, and thus the error. The first line of code is: filename = ARGV.first. When I was running this on the Terminal, I ran it as >ruby say.rb, without submitting a filename afterwards. So, on the prompt, I should have submitted it as >ruby say.rb whateverfilename.doc. So, without that, the program had nothing to chew on. Thanks again!
I'm trying to use the READFITS() function on IDL 8.3 on Mac 10.9.3
My input on the IDL promt:
readfits('image.fits',h, /EXTEN, /SILENT)
Result:
readfits('image.fits',h, /EXTEN, /SILENT)
^
% Syntax error.
*note: the '^' is below '/EXTEN'
Maybe it will help, so here is a link to the IDL help page on using READFITS() --> http://www.exelisvis.com/docs/readfits.html
I tried using the brackets like they show on that help page, but it still didn't work, so I'm stuck now. Didn't know if anyone here has experience reading .fits files in IDL.
ok, so it turns out the readfits procedure isn't included in IDL's original library, so I just had to download AstroLib (contains lots of useful astronomy procedures - including Readfits). The original syntax then worked.
I'm using IDL 8.2.2 on OS X 10.9.4.
Try keeping it simple first. Do these work?
readfits('image.fits')
readfits('image.fits', header)
Next try this:
readfits('image.fits', header, EXTEN_NO=0)
I suspect you really want extension number 0, not 1. See (e.g.) http://www.stsci.edu/documents/dhb/web/c02_datafiles.fm2.html.
I am trying to compile PHP on my Mac OS X 10.8 and I am getting the following problem:
In file included from /Users/ryan/Downloads/php-5.4.5/ext/phar/util.c:23:
ext/phar/phar_internal.h:223:19: error: invalid token at start of a preprocessor
expression
# if SIZEOF_SHORT == 2
^
I'm not sure why this error is occurring as this looks fine to me. I have opened the header file and could make changes if not or remove the if all together as I know what my system should be, but I was wondering if this is the proper approach to this problem.
It looks like SIZEOF_SHORT expands to no tokens. You should investigate where SIZEOF_SHORT is being #defined (this may be on the command line via -DSIZEOF_SHORT=) and fix that to provide the right value.
Alternatively, you could use this:
#include "limits.h"
/* ... */
#if SHRT_BIT == CHAR_BIT * 2
I didn't really find a solution to this problem, but I removed the if's and left behind the line that would be processed anyway and the program compiled just fine. I really don't know what was wrong with this file.
I'm doing some unit testing, and some of the code is checking to see if files exist based on the relative path of the currently-executing script by using the FILE variable. I'm doing something like this:
if File.directory?(File.join(File.dirname(__FILE__),'..','..','directory'))
blah blah blah ...
else
raise "Can't find directory"
end
I'm trying to find a way to make it fail in the unit tests without doing anything drastic. Being able to overwrite the __ FILE __ variable would be easiest, but as far as I can tell, it's impossible.
Any tips?
My tip? Refactor!
I didn't mark this as the real answer, since refactoring would be the best way to go about doing it. However, I did get it to work:
wd = Dir.getwd
# moves us up two directories, also assuming Dir.getwd
# returns a path of the form /folder/folder2/folder3/folder4...
Dir.chdir(wd.scan(/\/.*?(?=[\/]|$)/)[0..-3].join)
...run tests...
Dir.chdir(wd)
I had tried to do it using Dir.chdir('../../'), but when I changed back, File.expand_path(File.dirname(__ FILE __)) resolved to something different than what it was originally.
Programming Ruby 1.9 says on page 330 that __FILE__ is read only. It also describes it as a "execution environment variable".
However, you can define __FILE__ within an instance_eval. I don't think that'd help with your problem.