Documented symbol wifi.NULLMODE is nil? - nodemcu

I love the new tech ref at readthedocs.com, very nice... I just wish I could find firmware that matches them. :-) I would like to call:
wifi.setmode(wifi.NULLMODE)
But it gives an error: "bad argument #1 to 'setmode' (number expected, got nil)"
wifi.STATION is 1, wifi.SOFTAP is 2, wifi.STATIONAP is 3, so I tried 0, -1 and 4, all gave an error: "wrong arg type".
I downloaded what appeared to be the latest firmware from git -- is there some other official source?
Any insight appreciated.

There's a pending PR that will fix this: https://github.com/nodemcu/nodemcu-firmware/pull/1018/files#diff-708acae44868e2f538336aac253c2bc5R219

Related

Vim Error "An error occurred while processing function ~AND" "E716: Key not present in Dictionary~" Solution

■Error Description.
Error detected while processing function <SNR>35_debounceTimeTimerCallback[1]..
<SNR>35_tapSourceCallback[4]..<SNR>35_tapSourceCallback[1]..<lambda>30[1]..<SNR
>55_set_signs[10]..<SNR>55_place_signs:
line 5:
E716: Key not present in Dictionary: linecount + 1
■Cause of error content output
I have set up an environment for Go development using the Vim editor on VirtusalBox.
■Contents of .vimrc
call plug#begin('~/.vim/plugged')
Plug 'prabirshrestha/vim-lsp'
Plug 'mattn/vim-lsp-settings'
call plug#end()
I am unsure of the solution, can you please let me know?
It could be a bug of vim-lsp.
This pull request was merged to master 3 days ago. Removing the following lines from ~/.vim/plugged/vim-lsp/autoload/lsp/internal/diagnostics/signs.vim worked for me.
" Some language servers report an unexpected EOF one line past the end
if l:line == getbufinfo(a:bufnr)[0].linecount + 1
let l:line = l:line - 1
endif
You can see a list of the files that have been sourced by Vim with :help :scriptnames:
:scr
The XX in all the <SNR>XXs in the stack trace refers to script number XX in the output of the command above.
For example, this is the output of :scr in $ vim --clean on my machine:
1: ~/Applications/MacVim.app/Contents/Resources/vim/runtime/defaults.vim
2: ~/Applications/MacVim.app/Contents/Resources/vim/runtime/filetype.vim
3: ~/Applications/MacVim.app/Contents/Resources/vim/runtime/ftplugin.vim
4: ~/Applications/MacVim.app/Contents/Resources/vim/runtime/indent.vim
5: ~/Applications/MacVim.app/Contents/Resources/vim/runtime/syntax/syntax.vim
6: ~/Applications/MacVim.app/Contents/Resources/vim/runtime/syntax/synload.vim
7: ~/Applications/MacVim.app/Contents/Resources/vim/runtime/syntax/syncolor.vim
If I get a stack trace mentioning <SNR>4, I know the problem is in the ~/Applications/MacVim.app/Contents/Resources/vim/runtime/indent.vim file that comes with Vim. In this fictitious case, I would probably debug it a little bit further and open an issue on Vim's issue tracker.
In your case, the problem is very likely to happen in one of your plugins. Once you have identified it, you should head off to its issue tracker.

Load failed: Name cannot begin with the '<' character, hexadecimal value 0*3c. Line 610, position 3

Not able to open solution, I'n not getting how to resolve it any help appreciated,
Thank you,
I found whats causing this error,
Xamarin.ios.commontargets file has that "<" at line 610,
I removed it it's working fine now.
Thank you
I had the error on line 2, position 2 when attempting to load an Android project.
But the error was in AndroidManifest.xml - some merge comments.

How to debug `Error while processing function` in `vim` and `nvim`?

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.

Eper redbug, print line number in message

Here are some messages from using redbug in the shell:
% 02:49:02 <0.116.0>({cowboy_protocol,init,4})
% func1:start(<<"/second">>, [some])
% 02:49:02 <0.116.0>({cowboy_protocol,init,4})
% func1:looper(<<"/home/second">>, #{data => []}])
Is there are way to also print line numbers in redbug messages?
redbug:help() does show this:
print_fun () custom print handler, fun/1 or fun/2;
fun(TrcMsg) -> <ignored>
fun(TrcMsg,AccOld) -> AccNew
But there is no good explanation anywhere how to use it, so I couldn't try to see if I could add line numbers to the message
It doesn't seem you can do it in any straight forward way.
Easiest way to check this, it to just print all data you receive in your print_fun
1> PrintFun = fun (Msg) -> io:format( ">>> ~p~n" , [Msg]) end.
#Fun<erl_eval.6.90072148>
2> redbug:start("erlang" , [{print_fun, PrintFun}]).
{30,249}
>>> {call,{{erlang,demonitor,[#Ref<0.0.0.40>]},<<>>},
{<0.33.0>,{erlang,apply,2}},
{11,40,31,554200}}
>>> {call,{{erlang,atom_to_list,['PrintFun']},<<>>},
{<0.33.0>,{erlang,apply,2}},
{11,40,31,554210}}
>>> {call,{{erlang,group_leader,[]},<<>>},
{<0.33.0>,{erlang,apply,2}},
{11,40,31,554213}}
>>> {call,{{erlang,monitor,[process,<0.26.0>]},<<>>},
{<0.33.0>,{erlang,apply,2}},
{11,40,31,554215}}
>>> {call,{{erlang,port_control,[#Port<0.491>,101,[]]},<<>>},
{<0.24.0>,user_drv},
{11,40,31,554231}}
>>> {call,{{erlang,module_loaded,[calendar]},<<>>},
{<0.20.0>,code_server},
{11,40,31,554257}}
>>> {call,{{erlang,atom_to_list,[calendar]},<<>>},
{<0.20.0>,code_server},
{11,40,31,554263}}
>>> {call,{{erlang,'++',["calendar",".beam"]},<<>>},
{<0.20.0>,code_server},
{11,40,31,554265}}
>>> {call,{{erlang,'++',["ebin","/calendar.beam"]},<<>>},
{<0.20.0>,code_server},
{11,40,31,554268}}
>>> {call,{{erlang,whereis,[erl_prim_loader]},<<>>},
{<0.20.0>,code_server},
{11,40,31,554270}}
redbug done, msg_count - 10
As you can see, all you get is MFA ({Module, Function, Arguments}), calling process, and time stamp.
To get actual line of function call you would have to dig into debug_info attached to beam file (if there is any) with beam_lib module. I think seampleas way to do it would be using beam_lib:chunks( Module, [abstract_code])., just like this
{ok,{redbug,[{abstract_code,{raw_abstract_v1,[{attribute,1,
file,
{"src/redbug.erl",1}},
{attribute,9,module,redbug},
{attribute,11,export,[{help,0}]},
{attribute,13,export,[{unix,1}]},
{attribute,15,export,
[{start,1},{start,2},{start,3},{start,4},{start,5}]},
{attribute,16,export,[{stop,0}]},
{attribute,1,file,{"src/log.hrl",1}},
{function,17,'?log',2,
[{clause,17,[{var,17,...},{var,...}],[[{...}]],[{...}]},
{clause,18,[{var,...},{...}],[],[...]}]},
{attribute,19,file,{"src/redbug.erl",19}},
{attribute,22,record,
{cnf,[{record_field,24,{...},...},
{record_field,25,...},
{record_field,...},
{...}|...]}},
{function,57,help,0,[{clause,57,[],...}]},
{function,123,unix,1,
[{clause,123,...},{clause,...},{...}|...]},
{function,146,to_term,1,[{clause,...},{...}]},
{function,154,maybe_halt,1,[{...}]},
{function,160,is_in_shell,0,[...]},
{function,167,stop,0,...},
{function,174,start,...},
{function,176,...},
{function,...},
{...}|...]}}]}}
There you can find list, on which you could find tuples like {function, LineNumber, FunctionName, Arity, FunctionCodeAsList }. So by going trough this list and finding function you are looking for you can extract LineNumber.
Still you need to take under account few things that might not work.
you are analyzing actual file from disc, so it need to be in you current directory. It has nothing to do if and what is loaded to your VM (what code version). So you might have to put a little work to actually find this .beam
files compiled without debug_info might fail in producing this abstract syntax tree. You need to decide if that is might be your case, and how would you like to handle this.
some beams might be encrypted, some might have other issues. You should read beam_lib module documentation just to get feel what you are dealing with.
If you do come up with something, please do share. Happy hacking !

IDL READFITS() syntax error

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.

Resources