Category Archives: StackOverFlow

Stack Overflow is a question and answer site for professional and enthusiast programmers.

on_message() and @bot.command issue

When I have on_message() in my code, it stops every other @bot.command commands from working. I’ve tried to await bot.process_commands(message), but that doesn’t work either. Here is my code that I have:

@bot.event
@commands.has_role("Owner")
async def on_message(message):
    if message.content.startswith('/lockdown'):
        await bot.process_commands(message)
        embed = discord.Embed(title=":warning: Do you want to activate Lock Down?", description="Type 'confirm' to activate Lock Down mode", color=0xFFFF00)
        embed.add_field(name="\u200b", value="Lock Down mode is still in early development, expect some issues")
        channel = message.channel
        await bot.send_message(message.channel, embed=embed)
        msg = await bot.wait_for_message(author=message.author, content='confirm')
        embed = discord.Embed(title=":white_check_mark: Lock Down mode successfully activated", description="To deactivate type '/lockdownstop'", color=0x00ff00)
        embed.add_field(name="\u200b", value="Lock Down mode is still in early development, expect some issues")
        await bot.send_message(message.channel, embed=embed)

read more

Kitkat Error inflating class android.support.design.widget.NavigationView

I have a problem with the design of my code and I do not know how to solve it.

My error:

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.**********/com.*********.activity_fragment.Fragment_1_Main}: android.view.InflateException: Binary XML file line #17: Error inflating class android.support.design.widget.NavigationView

I hope to solve this problem soon, I appreciate very much the participation to the resolution to my problem.

Here is my attempts I have already made and the code in the files

Stacktrace

04-15 15:02:06.842 23657-23657/? W/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0x9ccfeb20)
04-15 15:02:06.842 23657-23657/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.************, PID: 23657
         java.lang.RuntimeException: Unable to start activity ComponentInfo{com.************/com.************.activity_fragment.Fragment_1_Main}: android.view.InflateException: Binary XML file line #17: Error inflating class android.support.design.widget.NavigationView
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
            at android.app.ActivityThread.access$800(ActivityThread.java:135)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:136)
            at android.app.ActivityThread.main(ActivityThread.java:5017)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)                                          
    at dalvik.system.NativeStart.main(Native Method)                                    
    Caused by: android.view.InflateException: Binary XML file line #17: Error inflating class android.support.design.widget.NavigationView                                       
    at android.view.LayoutInflater.createView(LayoutInflater.java:621)                                       
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:697)                                       
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:756)                                       
    at android.view.LayoutInflater.inflate(LayoutInflater.java:492)                                       
    at android.view.LayoutInflater.inflate(LayoutInflater.java:397)                                       
    at android.view.LayoutInflater.inflate(LayoutInflater.java:353)                                       
    at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:249)                                       
    at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:106)                                       
    at com.************.activity_fragment.Fragment_1_Main.onCreate(Fragment_1_Main.java:100)                                       
    at android.app.Activity.performCreate(Activity.java:5231)                                       
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)                                       
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)                                      
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)                                        
    at android.app.ActivityThread.access$800(ActivityThread.java:135)                                        
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)                                        
    at android.os.Handler.dispatchMessage(Handler.java:102)                                       
    at android.os.Looper.loop(Looper.java:136)                                        
    at android.app.ActivityThread.main(ActivityThread.java:5017)                                        
    at java.lang.reflect.Method.invokeNative(Native Method)                                        
    at java.lang.reflect.Method.invoke(Method.java:515)                                        
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)                                        
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)                                        
    at dalvik.system.NativeStart.main(Native Method) 
    Caused by: java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Constructor.constructNative(Native Method)                                       
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at android.view.LayoutInflater.createView(LayoutInflater.java:595)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:697)                                                        
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:756) 
    at android.view.LayoutInflater.inflate(LayoutInflater.java:492) 
    at android.view.LayoutInflater.inflate(LayoutInflater.java:397) 
    at android.view.LayoutInflater.inflate(LayoutInflater.java:353) 
    at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:249) 
    at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:106) 
    at com.************.activity_fragment.Fragment_1_Main.onCreate(Fragment_1_Main.java:100) 
    at android.app.Activity.performCreate(Activity.java:5231) 
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) 
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159) 
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245) 
    at android.app.ActivityThread.access$800(ActivityThread.java:135) 
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) 
    at android.os.Handler.dispatchMessage(Handler.java:102)             
    at android.os.Looper.loop(Looper.java:136) 
    at android.app.ActivityThread.main(ActivityThread.java:5017) 
    at java.lang.reflect.Method.invokeNative(Native Method)                                                        
    at java.lang.reflect.Method.invoke(Method.java:515) 
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) 
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)       
    at dalvik.system.NativeStart.main(Native Method) 
    Caused by: android.content.res.Resources$NotFoundException: Resource is not a Drawable (color or path): TypedValue{t=0x1/d=0x7f020043 a=2 r=0x7f020043}
    at android.content.res.Resources.loadDrawable(Resources.java:2073)
    at android.content.res.Resources.getDrawable(Resources.java:700)
    at android.support.v4.content.ContextCompat.getDrawable(ContextCompat.java:353)
    at android.support.v7.internal.widget.TintManager.getDrawable(TintManager.java:145)
    at android.support.v7.internal.view.menu.MenuItemImpl.getIcon(MenuItemImpl.java:422)
    at android.support.design.internal.NavigationMenuPresenter$NavigationMenuAdapter.prepareMenuItems(NavigationMenuPresenter.java:383)
    at android.support.design.internal.NavigationMenuPresenter$NavigationMenuAdapter.<init>(NavigationMenuPresenter.java:255)
    at android.support.design.internal.NavigationMenuPresenter.getMenuView(NavigationMenuPresenter.java:97)
    at android.support.design.widget.NavigationView.<init>(NavigationView.java:149)
    at android.support.design.widget.NavigationView.<init>(NavigationView.java:88)
    at java.lang.reflect.Constructor.constructNative(Native Method) 
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423) 
    at android.view.LayoutInflater.createView(LayoutInflater.java:595) 
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:697) 
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:756)                                                  
    at android.view.LayoutInflater.inflate(LayoutInflater.java:492)                                            
    at android.view.LayoutInflater.inflate(LayoutInflater.java:397) 
    at android.view.LayoutInflater.inflate(LayoutInflater.java:353)                                                        
    at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:249)                 
    at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:106)                                                        
    at com.************.activity_fragment.Fragment_1_Main.onCreate(Fragment_1_Main.java:100)                                                        
    at android.app.Activity.performCreate(Activity.java:5231)                                                        
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)                                                        
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159) 
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245) 
    at android.app.ActivityThread.access$800(ActivityThread.java:135) 
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) 
    at android.os.Handler.dispatchMessage(Handler.java:102) 
    at android.os.Looper.loop(Looper.java:136) 
    at android.app.ActivityThread.main(ActivityThread.java:5017) 
    at java.lang.reflect.Method.invokeNative(Native Method) 
    at java.lang.reflect.Method.invoke(Method.java:515) 
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) 
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) 
    at dalvik.system.NativeStart.main(Native Method) 

read more

OWL punning to represent a placeholder or abstract class

I’m trying to develop an ontology to represent a curricula, and in this curricula a student must take 6 elective courses (and has a long list of courses from which to choose).

Right now I have this classes:

- Course
--- Elective (defined class by isElective = true && type = Course)

And all my possible elective courses are instances of the type Course with the data property isElective set to true.

read more