admin


Recent Questions
Recent Answers
  • How to remove one element from list while iterate

    1 hour ago

    Because in the comment you say need solution without iterator I send this answer. If you want use iterator you can read this thread and find all combination.

    You need to create a copy from A with [:] in the first of loop. then the base value in A you remove from copy and add copy to out.

    Try this:

    A = [1,2,3,4,5,6]
    
    out = []
    for a in A:
        B = A[:]
        B.remove(a)
        out.append(B)
    

  • When I put multiple variables in SELECT section, the GROUP BY section does not work

    5 hours ago

    I suggest using this version, going by your current two queries which are almost correct:

    SELECT DATE_FORMAT(InventoryDate, '%Y-%m') ym, SUM(InventoryAmount) AS Amount
    FROM storeHistory
    GROUP BY ym;
    

    Both of your two attempts have various problems. The rule of thumb for GROUP BY queries is that every column appearing in the SELECT clause has to either be an aggregate, such as SUM(), or must also appear in GROUP BY.

  • When I put multiple variables in SELECT section, the GROUP BY section does not work

    5 hours ago

    Your query contains actually a few errors:

    Columns in GROUP BY are separated by command and not AND.
    You need to aggregate (for instance SUM) all columns that you don't group.
    And your HAVING clause does not make sense. So I removed it. HAVING is the WHERE clause for groups.

    SELECT SUM(InventoryAmount)
           YEAR(InventoryDate) AS Year, 
           MONTH(InventoryDate) AS Month
    FROM storeHistory
    GROUP BY Year, Month
    

  • Python Object Changing For No Apparent Reason

    9 hours ago

    Your dictionary checklist violates the unique key constrain (duplicate pine logs):

    It is best to think of a dictionary as a set of key: value pairs, with the requirement that the keys are unique (within one dictionary).1

  • Python Object Changing For No Apparent Reason

    9 hours ago

    you should use for loop and select what results you wan't

  • Python Object Changing For No Apparent Reason

    9 hours ago

    You have duplicate keys in the dict defintion. In this case, the later values will override the earlier ones. For example:

    checklist = {
            "pine logs": ['logs', '2', '4'],
            ...
            "pine logs": ['logs', '3', '4'],
            ...
    }
    

    This is equivalent to:

    checklist = {
            ...
            "pine logs": ['logs', '3', '4'],
            ...
    }
    

    If you want to have multiple instances of the same key, you can either keep a list of value lists for each key, or you can switch to a list representation.

  • Package does not exists, generated java file from annoation processor

    17 hours ago

    my first guess would be that the classPath is not set so it cannot find the package.

    Not what's going on.

    An annotation processor just kicks out a text file. At 'creation time', i.e. when the annotation processor makes this file, it's just a text file; it is not parsed, at all, as source file, and consequently, it is not possible for classpath anything to apply to that file at this phase.

    Because that processor made files, the compiler realizes that new source files now exist, so it starts compilation all over again (but somewhat intelligently, not neccessarily re-processing all files) - this is the 'rounds' system, and what RoundEnv is all about in an annotation processor. It's even perfectly fine for files in the 'first' compilation run to make no sense until some APs made files, in which case those first files are compiled in the second round. In other words, javac will even defer errors of the 'not found' nature, such as the very error you got, until processing is over.

    The classpath applied for any round is no different, and is the full compilation classpath.

    Thus, the most likely explanation is that hamcrest (or junit) isn't on the classpath at all. Possibly you have just the junit jar on the path, and don't have the transient deps of junit (which is org.hamcrest here).

    A good next step is to forget about the annotation for a moment and write the file that your AP makes as actual non-generated source file (just for now, to test and solve this issue), and you'll find you get the same error, thus showing it's not AP-related. Even if you take the entire AP off the path / disable AP processing at that point.

  • Java.lang.NoSuchMethodError: com.google.flatbuffers.FlatBufferBuilder.createString(Ljava/lang/CharSequence;)I

    21 hours ago

    While checking createString() method implementations in FlatBufferBuilder.java class, it has two methods one is accepting CharSequence and another one is accepting the ByteBuffer as a argument.

    public int createString(CharSequence s) {
    
    }
    
    public int createString(ByteBuffer s) {
    
    }
    

    While checking getField() method implementation in Field.java class, here it is passed String value.

    public class Field {
        private final String name;
    
        public int getField(FlatBufferBuilder builder) {
            int nameOffset = name == null ? -1 : builder.createString(name);
    
        }
    }
    

    To fix this issue, we need to pass either CharSequence or ByteBuffer as the argument in getField() method.

    Solution:

    public int getField(FlatBufferBuilder builder) {
       
        java.nio.ByteBuffer bb = java.nio.ByteBuffer.wrap(name.getBytes());
        int nameOffset = name == null ? -1 : builder.createString(bb);
        .......
    }
    

  • 'v-on' directives require a value or verb modifier (like 'stop' or 'prevent')

    1 day ago

    This line is wrong:

    <Task @delete-task:"$emit('delete-task', task.id)" :task="task" />
    

    fixed it by :

    <Task @delete-task="$emit('delete-task', task.id)" :task="task" />
    

  • &#39;v-on&#39; directives require a value or verb modifier (like &#39;stop&#39; or &#39;prevent&#39;)

    1 day ago

    The event value inside template is assigned using = instead of :

    @delete-task="$emit('delete-task', task.id)"