Python in Functional Style: How to add 2 lists of integers without using loops

Usually you’d add a list of integers this way: [pastacode lang=”python” manual=”a%20%3D%20%5B2%2C%202%2C%202%2C%202%5D%0Ab%20%3D%20%5B2%2C%202%2C%202%2C%202%5D%0Ac%20%3D%20%5B%5D%0Afor%20i%20in%20range(len(a))%3A%0A%20c.append(a%5Bi%5D%20%2B%20b%5Bi%5D)” message=”” highlight=”” provider=”manual”/] You can do it functionally without any loops in different ways: Using map and a lambda that adds them up [pastacode lang=”python” manual=”c%20%3D%20list(map(lambda%20x%2Cy%3A%20x%2By%2C%20a%2C%20b))” message=”” highlight=”” provider=”manual”/] or you can import the add operator as a named function [pastacode lang=”python” manual=”from%20operator%20import%20add%0Ac%20%3D%20list(map(add%2C%20a%2C%20b))” […]

[CODING/SOLVED] gradle build (android) breaks after upgrading a dependency with NullPointerException thrown at ProgramClass.constantPoolEntryAccept

You’ve just upgraded one of your Android project’s dependencies and when you ./gradlew assembleRelease the build process breaks. You invoke it again with –stacktrace to find the following exception:   [pastacode lang=”java” manual=”java.lang.NullPointerException%0Aat%20proguard.classfile.ProgramClass.constantPoolEntryAccept(ProgramClass.java%3A537)%0Aat%20proguard.shrink.UsageMarker.markConstant(UsageMarker.java%3A1246)%0Aat%20proguard.shrink.UsageMarker.visitRequiresInfo(UsageMarker.java%3A1040)%0Aat%20proguard.classfile.attribute.module.ModuleAttribute.requiresAccept(ModuleAttribute.java%3A138)%0Aat%20proguard.shrink.UsageMarker.visitModuleAttribute(UsageMarker.java%3A739)%0Aat%20proguard.classfile.attribute.module.ModuleAttribute.accept(ModuleAttribute.java%3A99)%0Aat%20proguard.classfile.ProgramClass.attributesAccept(ProgramClass.java%3A619)%0Aat%20proguard.shrink.UsageMarker.markProgramClassBody(UsageMarker.java%3A124)%0Aat%20proguard.shrink.UsageMarker.visitProgramClass(UsageMarker.java%3A94)%0Aat%20proguard.classfile.visitor.MultiClassVisitor.visitProgramClass(MultiClassVisitor.java%3A67)%0Aat%20proguard.classfile.visitor.MultiClassVisitor.visitProgramClass(MultiClassVisitor.java%3A67)%0Aat%20proguard.classfile.visitor.ClassNameFilter.visitProgramClass(ClassNameFilter.java%3A128)%0Aat%20proguard.classfile.ProgramClass.accept(ProgramClass.java%3A430)%0Aat%20proguard.classfile.ClassPool.classesAccept(ClassPool.java%3A124)%0Aat%20proguard.classfile.visitor.AllClassVisitor.visitClassPool(AllClassVisitor.java%3A45)%0Aat%20proguard.classfile.visitor.MultiClassPoolVisitor.visitClassPool(MultiClassPoolVisitor.java%3A85)%0Aat%20proguard.classfile.ClassPool.accept(ClassPool.java%3A110)%0Aat%20proguard.shrink.Shrinker.execute(Shrinker.java%3A90)%0Aat%20proguard.ProGuard.shrink(ProGuard.java%3A381)%0Aat%20proguard.ProGuard.execute(ProGuard.java%3A145)%0Aat%20proguard.ProGuard.main(ProGuard.java%3A572)” message=”” highlight=”” provider=”manual”/] This is a ProGuard bug, which my friend, has been solved by the ProGuard team ages ago, and your […]

nginx server configuration for a wordpress instance served from a URL’s subdirectory

You want to serve a wordpress instance on a website’s domain url but not at the path’s root, you want it under a sub-directory, for example “blog”, the same as this blog: https://www.gubatron.com/blog  Here’s how my NGINX’s server block for ‘www.gubatron.com’ looks like at the moment (https/ssl hasn’t been configured yet) [pastacode lang=”javascript” path_id=”fc6f967d7689931c81e9e9691b714f29″ file=”” […]

gradle/groovy: A simple way to check if a gradle task name has been invoked (e.g. “assembleRelease” for Android developers)

If you google for this question, you’ll find a bunch of crap answers about creating tasks and checking the task graph, bullshit. All you need to do is check if a parameter has been passed to gradle. Keep it simple and stupid: [pastacode lang=”java” manual=”boolean%20isAssembleRelease%20%3D%20gradle.startParameter.taskNames.contains(%22assembleRelease%22)” message=”” highlight=”” provider=”manual”/] (If you’re working with an android project, […]