No implicit conversion of Symbol into Integer only happening sometimes - ruby

Can someone explain what I'm doing wrong!?
if response[:result]
response[:credentials].each do |cred|
AntHQ.logger.debug "==> #{cred}"
c = app_instance.credentials.find_by(name: cred[:name])
if c && cred[:value]
c.value = cred[:value]
c.expiry = cred[:expiry]
c.save!
end
end
end
Error
TypeError: no implicit conversion of Symbol into Integer
File "/usr/local/lib/ruby/gems/2.1.0/bundler/gems/ant_light_tasks-01095a3ea065/lib/ant_light_tasks/app/update_credentials.rb" line 16 in []
Line 16:
c.value = cred[:value]
Example "response":
{:result=>true, :credentials=>[{:name=>"access_token", :value=>"...", :expiry=>"..."}]}

Hi guys I appreciate your answers.
The real cause was because our jenkins agent wasn't deploying the code to all our instances.

Related

Ren'Py - If Elif Dialogue Statement

My code:
if $ nice_dec4 = true:
a "Last night, was fantastic, I.."
a "Needed it."
elif $ mean_dec4 = true:
a "Hey.."
a "I was wondering if.."
a "Nevermind."
b "NO!"
b "Could I.. stay over?"
show sloane tired school
a "Why would you lie to me..?"
a "Why do you hit the mouse button like this isn't my life."
a "Why don't you care.. anymore?"
a "Come back soon,"
a "{b}{i}Darling."
The traceback is as follows:
[code]
I'm sorry, but an uncaught exception occurred.
While running game code:
File "game/script.rpy", line 712, in script
if $ nice_dec4 = true:
SyntaxError: invalid syntax (script.rpy, line 712)
-- Full Traceback ------------------------------------------------------------
Full traceback:
File "game/script.rpy", line 712, in script
if $ nice_dec4 = true:
File "/Users/NAME/Desktop/renpy-8.0.1-sdk/renpy/ast.py", line 2115, in execute
if renpy.python.py_eval(condition):
File "/Users/NAME/Desktop/renpy-8.0.1-sdk/renpy/python.py", line 1081, in py_eval
code = py_compile(code, 'eval')
File "/Users/NAME/Desktop/renpy-8.0.1-sdk/renpy/python.py", line 1018, in py_compile
raise e
File "/Users/NAME/Desktop/renpy-8.0.1-sdk/renpy/python.py", line 970, in py_compile
raise orig_e
File "/Users/NAME/Desktop/renpy-8.0.1-sdk/renpy/python.py", line 963, in py_compile
tree = compile(source, filename, py_mode, ast.PyCF_ONLY_AST | flags, 1)
SyntaxError: invalid syntax (script.rpy, line 712)
macOS-10.16-x86_64-i386-64bit x86_64
Ren'Py 8.0.2.22081402
Me And Sloane 1.2
Sun Dec 4 15:33:04 2022
[/code]
I expected the code to change based on a decision I made the player make earlier, all I got was this error.
IGNORE-----------------------------------------------------------------
"It looks like your post is mostly code; please add some more details":
mabklwglabd,jagdwlvgkulygwdvg agwlgd. w gdwilyavjkdfwvakuwdmvawwhmgwa,fywdjgcwfuwgcmhv aw,vw j, dwa dfldf,vdwm kw amvwdjawf wdlva;hwjha.,mww
When you use an if/elif operator in Ren'Py, you don't need to use the $ symbol.
if nice_dec4 = true:
a "Last night, was fantastic, I.."
a "Needed it."
elif mean_dec4 = true:
a "Hey.."
a "I was wondering if.."
$ symbol is used to define variables. For example, $ var1 = True

Error with Condor: "$INT() macro: 50+ $((0/41)) does not evaluate to an integer!"

I want to run several jobs with Condor, my executable take as an argument b such that: b1=50+ $(($(Process)/41)), where $(())stands for the quotient of $(Process) divided by 41. b is defined in quotient.sh. Here is my submit file:
# Unix submit description file
include : PATH/quotient.sh
executable = PATH/script_test.sh
arguments = $(b) $(Process)
log = fit_it_data_$INT(b)_$(Process).log
output = outfile_fit_$INT(b)_$(Process).txt
error = errors_fit_$INT(b)_$(Process).txt
transfer_input_files = PATH
should_transfer_files = Yes
when_to_transfer_output = ON_EXIT
queue 81
However I am getting the error Submitting job(s)ERROR at Queue statement on Line 13: $INT() macro: 50+ $((0/41)) does not evaluate to an integer!. I don't understand why it complains that is does not evaluate to an integer, since b should be equal to 50 here...
Any idea how to fix that issue?
b1=50+ $(($(Process)/41))
I think you have an extra "$" in there. Try this:
b1=50+ ($(Process)/41)

IndentationError: unexpected unindent in time series

The code i wrote in time series forecasting is as follows.
It keeps getting the error.
for param in pdq:
for param_seasonal in seasonal_pdq:
try:
mod = sm.tsa.statespace.SARIMAX(indexedDataset,order=param,seasonal_order=param_seasonal,enforce_stationarity=False,enforce_invertibility=False)
results = mod.fit()
print('ARIMA{}x{}12 - AIC:{}'.format(param,param_seasonal,results.aic))
except: continue
File "<ipython-input-211-c755485ed830>", line 7
except: continue
^
IndentationError: unexpected unindent
for param in pdq:
for param_seasonal in seasonal_pdq:
try:
mod = sm.tsa.statespace.SARIMAX(indexedDataset,order=param,seasonal_order=param_seasonal,enforce_stationarity=False,enforce_invertibility=False)
results = mod.fit()
print('ARIMA{}x{}12 - AIC:{}'.format(param,param_seasonal,results.aic))
except:
continue
except needs to be at the same level of indent with try.
Please be more careful with indentation when you write python scripts.

Using addprocs() and pmap() inside a function in Julia

In Julia, I want to use addprocs and pmap inside a function that is defined inside a module. Here's a silly example:
module test
using Distributions
export g, f
function g(a, b)
a + rand(Normal(0, b))
end
function f(A, b)
close = false
if length(procs()) == 1 # If there are already extra workers,
addprocs() # use them, otherwise, create your own.
close = true
end
W = pmap(x -> g(x, b), A)
if close == true
rmprocs(workers()) # Remove the workers you created.
end
return W
end
end
test.f(randn(5), 1)
This returns a very long error
WARNING: Module test not defined on process 4
WARNING: Module test not defined on process 3
fatal error on fatal error on WARNING: Module test not defined on process 2
43: : WARNING: Module test not defined on process 5
fatal error on fatal error on 5: 2: ERROR: UndefVarError: test not defined
in deserialize at serialize.jl:504
in handle_deserialize at serialize.jl:477
in deserialize at serialize.jl:696
...
in message_handler_loop at multi.jl:878
in process_tcp_streams at multi.jl:867
in anonymous at task.jl:63
Worker 3 terminated.
Worker 2 terminated.ERROR (unhandled task failure): EOFError: read end of file
WARNING: rmprocs: process 1 not removed
Worker 5 terminated.ERROR (unhandled task failure): EOFError: read end of file
4-element Array{Any,1}:Worker 4 terminated.ERROR (unhandled task failure): EOFError: read end of file
ERROR (unhandled task failure): EOFError: read end of file
ProcessExitedException()
ProcessExitedException()
ProcessExitedException()
ProcessExitedException()
What I'm trying to do is write a package that contains functions that perform operations that can be optionally parallelized at the user's discretion. So a function like f might take an argument par::Bool that does something like I've shown above if the user calls f with par = true and loops otherwise. So from within the definition of f (and within the definition of the module test), I want to create workers and broadcast the Distributions package and the function g to them.
What's wrong with using #everywhere in your function? The following, for example, works fine on my computer.
function f(A, b)
close = false
if length(procs()) == 1 # If there are already extra workers,
addprocs() # use them, otherwise, create your own.
#everywhere begin
using Distributions
function g(a, b)
a + rand(Normal(0, b))
end
end
close = true
end
W = pmap(x -> g(x, b), A)
if close == true
rmprocs(workers()) # Remove the workers you created.
end
return W
end
f(randn(5), 1)
Note: when I first ran this, I needed to recompile the Distributions package since it had been updated since I had last used it. When I first tried the above script right after the recompiling, it failed. But, I then quit Julia and reopened it and it worked fine. Perhaps that was what is causing your error?

RPAREN error when compiling code

I am currently trying to build and conplie a code for my game inb UDK but i keep getting this error Parser: missing RPAREN at '{'
I have a copy of the code that is creating the problem located below.
{
if (Stamina - StamJumpPenalty > 0 && super.DoJump(bUpdating)
{
Stamina -= StamJumpPenalty;
return true;
}
return false;
}
can some one please help me out, and maybe explain why this is happening please?
thanks guys
You're missing a closing parenthesis in the condition of the if statement.

Resources