raise PortAudioError(errormsg, err, hosterror_info) sounddevice.PortAudioError: <unprintable PortAudioError object> - raspberry-pi3

can anyone help me with this problem
I have tried using rate 16000 but it does not work for me

Take a look at your actions.json and make sure each action has a simpleResponse = "say something" field within its fulfillment. That helped me.

Related

How to programatically evaluate expression(spel/variable reference) used in annotation?

Say that I have use case for finding method annotated via say #Scheduled(cron = "${variable}"), and I'd like to know the value of "cron" parameter. If I check via reflection, no surprise, I will find there value "${variable}".
Can someone share link/snipet how to evaluate variables/spel expression present in annotation? I found some answers, but neither of them worked.
Just to extend #crizzis answer, maybe filling the missing part.
Fist you need to inject/autowire ConfigurableBeanFactory beanFactory;. Looking at implementation of ExpressionValueMethodArgumentResolver and it's parent AbstractNamedValueMethodArgumentResolver it seems to me, that full code which does variable substitution and spell needs one more line:
BeanExpressionResolver beanExpressionResolver = beanFactory.getBeanExpressionResolver();
String expressionWithSubstitutedVariables = beanFactory.resolveEmbeddedValue(expression);
Object resultWithResolvedSPEL = beanExpressionResolver.evaluate(expressionWithSubstitutedVariables, new BeanExpressionContext(beanFactory, null));
then string like #{!${some-boolean-variable} ? 'a' : 'b'} was correctly evaluated for me. Not sure if this is the way-to-go as I don't know spring well, but this worked for me.
I'm sure there are a couple of ways, but the easiest is probably:
beanFactory.getBeanExpressionResolver().evaluate(
"${variable}",
new BeanExpressionContext(beanFactory, null))

How to format default help command

Can someone please tell me how to format the Default help command in discord.py
I already know how to change the description however, I want to be able to change the width and sort them alphabetically.
Thanks for any help
:)
You can override certain functions in the default help command. Below is an official example on how to set this up initially:
class MyHelpCommand(commands.MinimalHelpCommand):
def get_command_signature(self, command):
return '{0.clean_prefix}{1.qualified_name} {1.signature}'.format(self, command)
class MyCog(commands.Cog):
def __init__(self, bot):
self._original_help_command = bot.help_command
bot.help_command = MyHelpCommand()
bot.help_command.cog = self
def cog_unload(self):
self.bot.help_command = self._original_help_command
The example above overrides the implementation of get_command_signature.
As you can see, you're supposed to create a new HelpCommand class and change the functions. Stuff that you don't want to change can just be left untouched, you don't have to copy-paste the existing code in there.
To see what a HelpCommand and MinimalHelpCommand can do (to override the methods), I suggest scrolling through the relevant API Documentation.
This way, in case there's something that you don't like about the default help, you can just change it's behaviour and fix it yourself. In your case, you're gonna want to sort the list of commands before adding them to the codeblock.
I recommend flicking through the default implementation's functions to see what you have to change about it. In your case, send_bot_help, send_cog_help, send_command_help, and send_group_help will need the lists sorted.

Problems with the bot discord Moderation

I created a lot of moderation teams, ban, kick muta, etc. I tried to do such a thing: If a person enters a command (for example, ban) and does not enter arguments (participant name and reason), the bot gives the corresponding message that there are not enough arguments and which one. Please help!
MissingRequiredArgument is called whenever a parameter that is required, is not encountered. You can use this exception to send a message in chat whenever a required argument is missing.
MissingRequiredArgument also has a parameter of its own, which details the argument that is missing.
Hope this points you in the right direction!
That's simple to implement. Here is the snippet of code to give you an idea.
async def test(ctx,name = None,reason = None):
if name == None or reason == None:
await ctx.send('Provide the Name and Reason')
else:
#PROCEEED HERE
pass

Arduino Parse Cloud Code

I am trying to pass a variable (emailAddress) to Parse Cloud Code from Arduino.
ParseCloudFunction cloudFunction;
cloudFunction.setFunctionName("SendEmail");
cloudFunction.add("email", emailAddress);
ParseResponse response2 = cloudFunction.send();
However, Parse sees this as a Boolean...
E2015-08-19T16:17:14.622Z]v10 Ran cloud function SendEmail for user XXXXXXXX with:
Input: {"email":true}
Result: Uh oh, something went wrong
Anyone know how to pass the variable without sending as a Boolean?
I had a similar problem and i think i've just solved it.
If you change the datatype for the email address to char* (i'm assuming you were using a string before) then it should work.
I'm not 100% sure why but i think its to do with referencing a pointer. I think parse.com requires a pointer to reference a variable and so a 'String' does not have that and parse.com only sees a boolean. Anyway this may not be quite correct but all i know is when i changed my String to char* it worked!
I took the inspiration from this documentation from Parse http://parse.com/docs/arduino/api/class_parse_object_create.html
Hope it works!

Correct initializion with arguments

Apologies for the dumb question, but I’m a beginner to Ruby.
I’m trying figure out how to pass arguments correctly to this gem from the constructor: https://github.com/miketierney/artii/blob/master/lib/artii/base.rb
I’m initializing an instance with artii = Artii::Base.new([]) but I’d like to pass a different font name as an argument.
I’ve tried artii = Artii::Base.new([:font_name => ’slant']) , as well as setting artii.font_name after initializing, but this doesn’t seem to work.
Can anyone tell me what I’m doing wrong?
Many thanks,
Stephan
Have you tried
artii = Artii::Base.new({:font_name => ’slant'})

Resources