text:
Q: Float Stacked divs side by side without a column wrapper I am trying to make stacked divs appear as though they are in a column. I am unable to directly edit the html due to the application being used. The problem is the right column is pushed farther down the document. I would like them to align at the top. Usually I would wrap each side in a div and float or inline-block them. I also am unable to use jQuery like .wrapAll() to inject the needed html into the document. Any help or reading would be appreciated. Thanks.
An example of the code is at this jsfiddle
https://jsfiddle.net/itivae/30xhjwcz/5/

Content

Content

Content

Content

Content

Content

Content

Content

Content

Content

Content

Content

A: Your main issue is the relative position of the wrapper class and your width needs to be less than 100% for each side. Sometimes it's best to work back and think simple.
.content-wrapper {
  width: 100%;
  overflow: hidden;
}
.div-1, .div-2, .div-3, .div-4, .div-5 {
  float: left;
  width: 50%;
}
.div-6, .div-7, .div-8, .div-9, .div-10, .div-11, .div-12 {
  float: right;
  width: 50%;
}

https://jsfiddle.net/4ezcbkmo/


text:
Q: Ideal way to config all the buttons of my Tkinter application at once? This is my first tkinter/gui project. I set up a mvc pattern and have a view class for each window of my application.
An example for the main window:
class ViewMain(tk.Frame):
    def __init__(self, master):
        tk.Frame.__init__(self, master, height = 300, width = 500)
        self.pack(fill='both', expand=True)
        self.BUTTON_SIZE = {'relheight' : 0.3, 'relwidth' : 0.35}
        self._set_widgets()
        self._set_layout()

    def _set_widgets(self):
        self.button = tk.Button(self, text = 'Text')

    def _set_layout(self):
        self.button.place(relx = 0.1, rely = 0.15, **self.BUTTON_SIZE)

Currently, I have 6 view classes and I want to change the relief of the buttons to groove. As I have 30+ buttons, I look for a way to not write the following all the time:
self.button = tk.Button(self, text = 'Text', relief = 'groove')

As you can see, one flaw in my train of thought is that I'm already using a repetitive approach to configure the size of the buttons. But let's just ignore that.
As I'm fairly new to all of this, I see three ways of doing this:

*

*Add "relief = 'groove'" as an option every time I create a button

*Use a ttk.Button and config the style. But I'd have to do this for every view class and add the style every time I create a button as well

*Write a wrapper for the tk.Button and use that instead

The last option led me to this:
class CustomButton(tk.Button):
def __init__(self, master, text):
    super().__init__(master, text = text, relief = 'groove')

Which works but I cannot stop thinking if there is a better way to approach this?

A: I didn't test it but the way I would work around is like this:
for widget in root.winfo_children():
    if isinstance(widget, tk.Button):
        widget.configure(relief = 'groove')

the winfo_children() gives you all widgets.
With if isinstance you checking if the widget is an instance of tkinter.Button.
If it's true you configure the Button how you like.
I did something like this before and it worked fine.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Unable to load class 'org.gradle.internal.logging.LoggingManagerInternal'. Possible causes for this unexpected error I want to publish my library on Bintray. I tried here steps but gradle didn't sync.
build.gradle file of project
buildscript {
    repositories {
        mavenCentral()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.1.2'
        classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7'
        classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
    }
}

allprojects {
    repositories {
        jcenter()
        mavenCentral()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

build.gradle file of library
apply plugin: 'com.android.library'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'com.github.dcendents.android-maven'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"

    defaultConfig {
        minSdkVersion 10
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.4.0'
}

and error like that
20:10:03: Executing external task 'preBuild'...
        Configuration on demand is an incubating feature.
        Failed to notify ProjectEvaluationListener.afterEvaluate(), but primary configuration failure takes precedence.
        java.lang.IllegalStateException: buildToolsVersion is not specified.
            at com.google.common.base.Preconditions.checkState(Preconditions.java:176)
            at com.android.build.gradle.BasePlugin.createAndroidTasks(BasePlugin.java:606)
            at com.android.build.gradle.BasePlugin$10$1.call(BasePlugin.java:572)
            at com.android.build.gradle.BasePlugin$10$1.call(BasePlugin.java:569)
            at com.android.builder.profile.ThreadRecorder$1.record(ThreadRecorder.java:55)
            at com.android.builder.profile.ThreadRecorder$1.record(ThreadRecorder.java:47)
            at com.android.build.gradle.BasePlugin$10.execute(BasePlugin.java:568)
            at com.android.build.gradle.BasePlugin$10.execute(BasePlugin.java:565)
            at org.gradle.internal.event.BroadcastDispatch$ActionInvocationHandler.dispatch(BroadcastDispatch.java:93)
            at org.gradle.internal.event.BroadcastDispatch$ActionInvocationHandler.dispatch(BroadcastDispatch.java:82)
            at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:44)
            at org.gradle.internal.event.BroadcastDispatch.dispatch(BroadcastDispatch.java:79)
            at org.gradle.internal.event.BroadcastDispatch.dispatch(BroadcastDispatch.java:30)
            at org.gradle.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
            at com.sun.proxy.$Proxy10.afterEvaluate(Unknown Source)
            at org.gradle.configuration.project.LifecycleProjectEvaluator.notifyAfterEvaluate(LifecycleProjectEvaluator.java:67)
            at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:61)
            at org.gradle.api.internal.project.AbstractProject.evaluationDependsOn(AbstractProject.java:578)
            at org.gradle.api.internal.project.AbstractProject.evaluationDependsOn(AbstractProject.java:570)
            at com.android.build.gradle.internal.DependencyManager.ensureConfigured(DependencyManager.java:724)
            at com.android.build.gradle.internal.DependencyManager.resolveDependencyForConfig(DependencyManager.java:240)
            at com.android.build.gradle.internal.DependencyManager.resolveDependencies(DependencyManager.java:139)
            at com.android.build.gradle.internal.TaskManager.resolveDependencies(TaskManager.java:356)
            at com.android.build.gradle.internal.VariantManager$9.call(VariantManager.java:597)
            at
    com.android.builder.profile.ThreadRecorder$1.record(ThreadRecorder.java:47)
        at com.android.build.gradle.internal.profile.SpanRecorders.record(SpanRecorders.java:51)
        at com.android.build.gradle.internal.VariantManager.createVariantData(VariantManager.java:593)      at com.android.build.gradle.internal.VariantManager.createVariantDataForProductFlavors(VariantManager.java:750)
        at com.android.build.gradle.internal.VariantManager$1.call(VariantManager.java:260)
        at com.android.builder.profile.ThreadRecorder$1.record(ThreadRecorder.java:55)
            at com.android.build.gradle.internal.VariantManager.createAndroidTasks(VariantManager.java:259)
            at com.android.build.gradle.BasePlugin$12.call(BasePlugin.java:657)
            at com.android.build.gradle.BasePlugin$12.call(BasePlugin.java:654)
            at com.android.builder.profile.ThreadRecorder$1.record(ThreadRecorder.java:55)
            at com.android.builder.profile.ThreadRecorder$1.record(ThreadRecorder.java:47)
            at com.android.build.gradle.BasePlugin.createAndroidTasks(BasePlugin.java:653)
            at com.android.build.gradle.BasePlugin$10$1.call(BasePlugin.java:572)
            at com.android.build.gradle.BasePlugin$10$1.call(BasePlugin.java:569)
            at com.android.builder.profile.ThreadRecorder$1.record(ThreadRecorder.java:55)
            at com.android.builder.profile.ThreadRecorder$1.record(ThreadRecorder.java:47)
            at com.android.build.gradle.BasePlugin$10.execute(BasePlugin.java:568)
            at com.android.build.gradle.BasePlugin$10.execute(BasePlugin.java:565)
            at org.gradle.internal.event.BroadcastDispatch$ActionInvocationHandler.dispatch(BroadcastDispatch.java:93)
            at org.gradle.internal.event.BroadcastDispatch$ActionInvocationHandler.dispatch(BroadcastDispatch.java:82)
            at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:44)
            at org.gradle.internal.event.BroadcastDispatch.dispatch(BroadcastDispatch.java:79)
            at org.gradle.internal.event.BroadcastDispatch.dispatch(BroadcastDispatch.java:30)
            at org.gradle.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
            at com.sun.proxy.$Proxy10.afterEvaluate(Unknown Source)
            at org.gradle.configuration.project.LifecycleProjectEvaluator.notifyAfterEvaluate(LifecycleProjectEvaluator.java:67)
            at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:61)
            at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:510)
            at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:90)
            at org.gradle.execution.TaskPathProjectEvaluator.configureHierarchy(TaskPathProjectEvaluator.java:47)
            at org.gradle.execution.TaskSelector.getSelection(TaskSelector.java:84)
            at org.gradle.execution.TaskSelector.getSelection(TaskSelector.java:75)
            at org.gradle.execution.commandline.CommandLineTaskParser.parseTasks(CommandLineTaskParser.java:42)
            at org.gradle.execution.TaskNameResolvingBuildConfigurationAction.configure(TaskNameResolvingBuildConfigurationAction.java:44)
            at org.gradle.execution.DefaultBuildConfigurationActionExecuter.configure(DefaultBuildConfigurationActionExecuter.java:48)
            at org.gradle.execution.DefaultBuildConfigurationActionExecuter.access$000(DefaultBuildConfigurationActionExecuter.java:25)
            at org.gradle.execution.DefaultBuildConfigurationActionExecuter$1.proceed(DefaultBuildConfigurationActionExecuter.java:54)
            at org.gradle.execution.DefaultTasksBuildExecutionAction.configure(DefaultTasksBuildExecutionAction.java:44)
            at org.gradle.execution.DefaultBuildConfigurationActionExecuter.configure(DefaultBuildConfigurationActionExecuter.java:48)
            at org.gradle.execution.DefaultBuildConfigurationActionExecuter.access$000(DefaultBuildConfigurationActionExecuter.java:25)
            at org.gradle.execution.DefaultBuildConfigurationActionExecuter$1.proceed(DefaultBuildConfigurationActionExecuter.java:54)
            at org.gradle.execution.ExcludedTaskFilteringBuildConfigurationAction.configure(ExcludedTaskFilteringBuildConfigurationAction.java:47)
            at org.gradle.execution.DefaultBuildConfigurationActionExecuter.configure(DefaultBuildConfigurationActionExecuter.java:48)
            at org.gradle.execution.DefaultBuildConfigurationActionExecuter.select(DefaultBuildConfigurationActionExecuter.java:36)
            at org.gradle.initialization.DefaultGradleLauncher$3.run(DefaultGradleLauncher.java:143)
            at org.gradle.internal.Factories$1.create(Factories.java:22)
            at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
            at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:52)
            at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:140)
            at org.gradle.initialization.DefaultGradleLauncher.access$200(DefaultGradleLauncher.java:32)
            at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:99)
            at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:93)
            at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
            at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:62)
            at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:93)
            at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:82)
            at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:94)
            at org.gradle.tooling.internal.provider.runner.BuildModelActionRunner.run(BuildModelActionRunner.java:46)
            at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
            at org.gradle.tooling.internal.provider.runner.SubscribableBuildActionRunner.run(SubscribableBuildActionRunner.java:58)
            at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
            at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:43)
            at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:28)
            at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:78)
            at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:48)
            at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:52)
            at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
            at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
            at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:37)
            at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
            at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
            at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
            at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
            at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
            at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74)
            at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72)
            at org.gradle.util.Swapper.swap(Swapper.java:38)
            at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72)
            at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
            at org.gradle.launcher.daemon.server.health.DaemonHealthTracker.execute(DaemonHealthTracker.java:47)
            at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
            at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:66)
            at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
            at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
            at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:72)
            at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
            at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
            at org.gradle.launcher.daemon.server.health.HintGCAfterBuild.execute(HintGCAfterBuild.java:41)
            at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
            at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50)
            at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:246)
            at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
            at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
            at java.lang.Thread.run(Thread.java:745)

        FAILURE: Build failed with an exception.

        * Where:
        Build file '/Users/emrekose/AndroidStudioProjects/MyLibraryApp/mylittlelibrary/build.gradle' line: 3

        * What went wrong:
        A problem occurred evaluating project ':mylittlelibrary'.
        > Failed to apply plugin [id 'com.github.dcendents.android-maven']
           > Could not create plugin of type 'AndroidMavenPlugin'.

        * Try:
        Run with --info or --debug option to get more log output.

        * Exception is:
        org.gradle.api.GradleScriptException: A problem occurred evaluating project ':mylittlelibrary'.
            at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:93)
            at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl$1.run(DefaultScriptPluginFactory.java:144)
            at org.gradle.configuration.ProjectScriptTarget.addConfiguration(ProjectScriptTarget.java:72)
            at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:149)
            at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:38)
            at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:25)
            at org.gradle.configuration.project.ConfigureActionsProjectEvaluator.evaluate(ConfigureActionsProjectEvaluator.java:34)
            at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:55)
            at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:510)
            at org.gradle.api.internal.project.AbstractProject.evaluationDependsOn(AbstractProject.java:578)
            at org.gradle.api.internal.project.AbstractProject.evaluationDependsOn(AbstractProject.java:570)
            at com.android.build.gradle.internal.DependencyManager.ensureConfigured(DependencyManager.java:724)
            at com.android.build.gradle.internal.DependencyManager.resolveDependencyForConfig(DependencyManager.java:240)
            at com.android.build.gradle.internal.DependencyManager.resolveDependencies(DependencyManager.java:139)
            at com.android.build.gradle.internal.TaskManager.resolveDependencies(TaskManager.java:356)
            at com.android.build.gradle.internal.VariantManager$9.call(VariantManager.java:597)
            at com.android.build.gradle.internal.VariantManager$9.call(VariantManager.java:594)
            at com.android.builder.profile.ThreadRecorder$1.record(ThreadRecorder.java:55)
            at com.android.builder.profile.ThreadRecorder$1.record(ThreadRecorder.java:47)
            at com.android.build.gradle.internal.profile.SpanRecorders.record(SpanRecorders.java:51)
            at com.android.build.gradle.internal.VariantManager.createVariantData(VariantManager.java:593)
            at com.android.build.gradle.internal.VariantManager.createVariantDataForProductFlavors(VariantManager.java:750)
            at com.android.build.gradle.internal.VariantManager.populateVariantDataList(VariantManager.java:459)
            at com.android.build.gradle.internal.VariantManager$1.call(VariantManager.java:263)
            at com.android.build.gradle.internal.VariantManager$1.call(VariantManager.java:260)
            at com.android.builder.profile.ThreadRecorder$1.record(ThreadRecorder.java:55)
            at com.android.builder.profile.ThreadRecorder$1.record(ThreadRecorder.java:47)
            at com.android.build.gradle.internal.VariantManager.createAndroidTasks(VariantManager.java:259)
            at com.android.build.gradle.BasePlugin$12.call(BasePlugin.java:657)
            at com.android.build.gradle.BasePlugin$12.call(BasePlugin.java:654)
            at com.android.builder.profile.ThreadRecorder$1.record(ThreadRecorder.java:55)
            at com.android.builder.profile.ThreadRecorder$1.record(ThreadRecorder.java:47)
            at com.android.build.gradle.BasePlugin.createAndroidTasks(BasePlugin.java:653)
            at com.android.build.gradle.BasePlugin$10$1.call(BasePlugin.java:572)
            at com.android.build.gradle.BasePlugin$10$1.call(BasePlugin.java:569)
            at com.android.builder.profile.ThreadRecorder$1.record(ThreadRecorder.java:55)
            at com.android.builder.profile.ThreadRecorder$1.record(ThreadRecorder.java:47)
            at com.android.build.gradle.BasePlugin$10.execute(BasePlugin.java:568)
            at com.android.build.gradle.BasePlugin$10.execute(BasePlugin.java:565)
            at org.gradle.internal.event.BroadcastDispatch$ActionInvocationHandler.dispatch(BroadcastDispatch.java:93)
            at org.gradle.internal.event.BroadcastDispatch$ActionInvocationHandler.dispatch(BroadcastDispatch.java:82)
            at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:44)
            at org.gradle.internal.event.BroadcastDispatch.dispatch(BroadcastDispatch.java:79)
            at org.gradle.internal.event.BroadcastDispatch.dispatch(BroadcastDispatch.java:30)
            at org.gradle.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
            at com.sun.proxy.$Proxy10.afterEvaluate(Unknown Source)
            at org.gradle.configuration.project.LifecycleProjectEvaluator.notifyAfterEvaluate(LifecycleProjectEvaluator.java:67)
            at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:61)
            at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:510)
            at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:90)
            at org.gradle.execution.TaskPathProjectEvaluator.configureHierarchy(TaskPathProjectEvaluator.java:47)
            at org.gradle.execution.TaskSelector.getSelection(TaskSelector.java:84)
            at org.gradle.execution.TaskSelector.getSelection(TaskSelector.java:75)
            at org.gradle.execution.commandline.CommandLineTaskParser.parseTasks(CommandLineTaskParser.java:42)
            at org.gradle.execution.TaskNameResolvingBuildConfigurationAction.configure(TaskNameResolvingBuildConfigurationAction.java:44)
            at org.gradle.execution.DefaultBuildConfigurationActionExecuter.configure(DefaultBuildConfigurationActionExecuter.java:48)
            at org.gradle.execution.DefaultBuildConfigurationActionExecuter.access$000(DefaultBuildConfigurationActionExecuter.java:25)
            at org.gradle.execution.DefaultBuildConfigurationActionExecuter$1.proceed(DefaultBuildConfigurationActionExecuter.java:54)
            at org.gradle.execution.DefaultTasksBuildExecutionAction.configure(DefaultTasksBuildExecutionAction.java:44)
            at org.gradle.execution.DefaultBuildConfigurationActionExecuter.configure(DefaultBuildConfigurationActionExecuter.java:48)
            at org.gradle.execution.DefaultBuildConfigurationActionExecuter.access$000(DefaultBuildConfigurationActionExecuter.java:25)
            at org.gradle.execution.DefaultBuildConfigurationActionExecuter$1.proceed(DefaultBuildConfigurationActionExecuter.java:54)
            at org.gradle.execution.ExcludedTaskFilteringBuildConfigurationAction.configure(ExcludedTaskFilteringBuildConfigurationAction.java:47)
            at org.gradle.execution.DefaultBuildConfigurationActionExecuter.configure(DefaultBuildConfigurationActionExecuter.java:48)
            at org.gradle.execution.DefaultBuildConfigurationActionExecuter.select(DefaultBuildConfigurationActionExecuter.java:36)
            at org.gradle.initialization.DefaultGradleLauncher$3.run(DefaultGradleLauncher.java:143)
            at org.gradle.internal.Factories$1.create(Factories.java:22)
            at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
            at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:52)
            at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:140)
            at org.gradle.initialization.DefaultGradleLauncher.access$200(DefaultGradleLauncher.java:32)
            at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:99)
            at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:93)
            at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
            at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:62)
            at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:93)
            at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:82)
            at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:94)
            at org.gradle.tooling.internal.provider.runner.BuildModelActionRunner.run(BuildModelActionRunner.java:46)
            at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
            at org.gradle.tooling.internal.provider.runner.SubscribableBuildActionRunner.run(SubscribableBuildActionRunner.java:58)
            at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
            at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:43)
            at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:28)
            at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:78)
            at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:48)
            at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:52)
            at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
            at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
            at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:37)
            at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
            at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
            at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
            at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
            at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
            at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74)
            at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72)
            at org.gradle.util.Swapper.swap(Swapper.java:38)
            at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72)
            at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
            at org.gradle.launcher.daemon.server.health.DaemonHealthTracker.execute(DaemonHealthTracker.java:47)
            at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
            at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:66)
            at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
            at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
            at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:72)
            at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
            at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
            at org.gradle.launcher.daemon.server.health.HintGCAfterBuild.execute(HintGCAfterBuild.java:41)
            at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
            at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50)
            at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:246)
            at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
            at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
        Caused by: org.gradle.api.internal.plugins.PluginApplicationException: Failed to apply plugin [id 'com.github.dcendents.android-maven']
            at org.gradle.api.internal.plugins.DefaultPluginManager.doApply(DefaultPluginManager.java:160)
            at org.gradle.api.internal.plugins.DefaultPluginManager.apply(DefaultPluginManager.java:112)
            at org.gradle.api.internal.project.ProjectScript.apply(ProjectScript.groovy:35)
            at org.gradle.api.Script$apply$0.callCurrent(Unknown Source)

            at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:91)
            ... 113 more
        Caused by: org.gradle.api.plugins.PluginInstantiationException: Could not create plugin of type 'AndroidMavenPlugin'.
            ... 124 more
        Caused by: java.lang.TypeNotPresentException: Type org.gradle.internal.logging.LoggingManagerInternal not present
            at org.gradle.api.internal.plugins.DefaultPluginManager.instantiatePlugin(DefaultPluginManager.java:59)
            ... 125 more
        Caused by: java.lang.ClassNotFoundException: org.gradle.internal.logging.LoggingManagerInternal
            ... 128 more

        BUILD FAILED

        Total time: 1.337 secs
        20:10:05: External task execution finished 'preBuild'.

A: May be its too late to answer here but i just want to share my solution for same.
what i did is removed build folder and gradle folder after that i did invalidate cache and restart android studio.
Bingo now its working cool. so ultimately no need to downgrade or upgrade your gradle version just follow this it will definitely help you.
Thanks


text:
Q: useEffect needs to call function and render it after 5 seconds I need to show cookies after 5 seconds on the home pages. The function renderCookie works fine but I'm not sure how to implement useUffect and to call function renderCookie after 5 seconds. At the moment it runs immediately but not after 5 seconds. Anyone have any suggestions, I'm not sure where I went wrong?
import React, {useState, useEffect} from "react";
import { MdDone } from "react-icons/md";
import {getCookie, setCookie} from 'tiny-cookie';

const CookieNotice = () => {
    const [items, setItems] = useState({
        name: "zureaCookie",
        value: ""
    });

useEffect(() => {
    const delay = 5000;
    const timeoutId = setTimeout(() => {
        renderCookie();

    }, delay);
    return () => {
      clearTimeout(timeoutId);
    };
  }, []);

    const acceptCookie = (e) => {
        e.preventDefault();
        let newItemsObj = {...items};
        newItemsObj.value = "Accepted";
        setItems(newItemsObj);
        setCookie(items.name, newItemsObj.value, { expires: '1Y' });
    }

    const declineCookie = (e) => {
        e.preventDefault();
        let newItemsObj = {...items};
        newItemsObj.value = "Declined";
        setItems(newItemsObj);
        setCookie(items.name, newItemsObj.value, { expires: '1Y' });
    }

        const renderCookie = () => {
            const zureaCookie = getCookie(items.name);
            return (
                <>
                    {!zureaCookie ? (

We use cookies to improve your experience on our website. By browsing this website,
                                    you agree to our use of cookies.

                                Terms & Conditions
                                Decline
                                Accept<MdDone className="md-done" />

) : (null)}
                </>);

        }

    return renderCookie();

}

export default CookieNotice;

A: import React, { useState, useEffect } from "react";
import { MdDone } from "react-icons/md";
import { getCookie, setCookie } from "tiny-cookie";

const CookieNotice = () => {
  const [items, setItems] = useState({
    name: "zureaCookie",
    value: "",
  });
  const [elapsed, setElapsed] = useState(false);

  useEffect(() => {
    const delay = 5000;
    const timeoutId = setTimeout(() => {
      setElapsed(true);
    }, delay);
    return () => {
      clearTimeout(timeoutId);
    };
  }, []);

  const acceptCookie = (e) => {
    e.preventDefault();
    let newItemsObj = { ...items };
    newItemsObj.value = "Accepted";
    setItems(newItemsObj);
    setCookie(items.name, newItemsObj.value, { expires: "1Y" });
  };

  const declineCookie = (e) => {
    e.preventDefault();
    let newItemsObj = { ...items };
    newItemsObj.value = "Declined";
    setItems(newItemsObj);
    setCookie(items.name, newItemsObj.value, { expires: "1Y" });
  };

  const renderCookie = () => {
    const zureaCookie = getCookie(items.name);
    return (
      <>
        {!zureaCookie && elapsed ? (

                  We use cookies to improve your experience on our website. By browsing this website, you agree to our
                  use of cookies.

                  Terms & Conditions

                  Decline

                  Accept
                  <MdDone className="md-done" />

        ) : null}
      </>
    );
  };

  return renderCookie();
};

export default CookieNotice;


text:
Q: checking unique while inserting to mongoDB I have a program to insert some values into the mongo db and i want to avoid repeated product_src inserting into the database. how can i set that in code? my code is
BObject doc = new BasicDBObject("product_name", bean.getProductName()).
                    append("product_url", bean.getProductURL()).
                    append("product_img", bean.getImageURL()).
                    append("product_price", bean.getPrice()).
                    append("product_src", bean.product_src).
                    append("country", bean.country));

thanks in advance.

A: You have two options to ensure the uniqueness of product_src:

*

*Store it  as the documents _id. There is always a unique index constraint on _id

*Create a unique index on product_src

With a unique index MongoDB will throw an error when inserting a document with a duplicate value and not add the document to the collection.

A: After much research I found unique check without raising duplicate Error.
db.collection("collection_name")
    .updateOne({ field1:"field1", field2:"field2" }, {
        $setOnInsert: { _id: "ObjectID" }
    }, {
        upsert: true
    })

The above query will insert only if document not found.
If document found then the response will be as shown below.
{
  acknowledged: true,
  modifiedCount: 0,
  upsertedId: null,
  upsertedCount: 0,
  matchedCount: 1
}

If document not found then response will be as shown below.
{
  acknowledged: true,
  modifiedCount: 0,
  upsertedId: 'some_upserted_id',
  upsertedCount: 1,
  matchedCount: 0
}

To summarize my research, if we have

upsertedCount: 1 or upsertedId: 'some_upserted_id'

then record inserted successfully else document already exist and we don't do anything.


text:
Q: Controlling the display of things typed in text input (with JS)? Is there a way to change the display of a text input with JS?
for example: I input in a text field input: "help please"
and i want it do be displayed directly as it is typed (within the text input as: "help ******"
So just the second word will be changed to "*****", but it has to keep its value when submitted

A: Try utilizing input event , .replace()

var text = "", res = "";

document.querySelector("input").oninput = function() {

  this.value = this.value.replace(/p(?=l)|l(?=e)|e(?=a|s)|a|s|e\s/, function(m) {
      text += m
      return "*"
  });

  if (this.value.length > 10 && this.value.slice(-2) === "*e") {
    text += this.value.slice(-1);
    this.value = this.value.replace(/e$/, "*");
    res = this.value.slice(0, 5).concat(text);
    // do stuff with `res`
    document.querySelector("label").innerHTML = res;
    text = res = "";
  }
}
<input type="text" /><label></label>


text:
Q: Check a customer list for purchases I have a patient list that includes the patient number, the date of hospital entry, the day of visit and the type of care that they required during the visit, if any. Some of them only stayed for a sigle day and therefore have a single entry, while most of them have multiple entries for each day they stayed in the hospital. Is there a way to check whether each patient received a specific type of care during their whole stay? I have tried with an IF function geting the values from the respective columns but i only got as fas as getting the type of care that they had on their first day without showing what happened on the other days: =IF('[@date_of_visit]'='[@date_of_entry]';'[@Care];'blank')
and whether they received care on each day: =IF([@Care]="Care_1";"YES";IF([@Care]="Care_2";"YES";IF([@Care]="Care_3";"YES";IF([@Care]="Care_4";"YES";IF([@Care]="No_Care";"No";IF([@Care]="N.A.";"N.A.";"N.A."))))))
I would like to have a single cell for each patient describing whether there was care given to them during the visit or not and my problem lies in the fact that most patients were visited over many days and hence have multiple entries.
Edit: Updated 1st formula for accuracy


text:
Q: Why is Google Analytics telling me my regex is invalid? I am trying to match the below url pattern using the Matching RegExp advanced filter on the Landing Page dimension:
/shop/lenses/sigma--f-1-4--35-mm--prime-fixed-focal-length.html
with this regex:
^\/shop\/lenses\/[a-z]+\-\-f\-([\d\-]+?)\-\m+\-\-prime\-fixed\-focal\-length\.html$
This type of page has three attribute variables that come after /lenses and before /prime-fixed-focal-length.html sometimes there is only hyphen and one digit after f and other times there can be two sets of hyphenated digits.
3 Attribute Patterns
First Variable Value --
First word after /lenses/ subdirectory and before --f
Second Variable Value --
Digit values that come after --f- (potentially can be 2 digits that will always have a hyphen between them)
Third Variable Value --
Digit values that come before -mm-- (potentially can be 1-3 digits that will never have a hyphen separating the digits)
Regexr.com is telling me it should work, but Google Analytics tells me it's invalid
(see attached image for Google Analytics prompt when applying the matching regexp filter)
Google Analytics Response

A: Thier engine for whatever reason doesn't seem to know that \d is a digit.
By replacing it to [0-9] class seems to fix it up.
Analytics Cheat Sheet ?
https://www.analyticsmarket.com/blog/regular-expressions-for-google-analytics/
Google Analytics RegEx tester:
https://www.analyticsmarket.com/freetools/regex-tester/
Regex: ^/shop/lenses/[a-z]+--f-[0-9-]+?-m+--prime-fixed-focal-length\.html$
Target: /shop/lenses/sigma--f-1-4--35-mm--prime-fixed-focal-length.html


text:
Q: append() function in python behaving strangely This is the code:
import random
mylist=[]
position=[300,300]
while 1:
    randomint = random.randint(1,3)
    print mylist
    if randomint == 3:
        position[0]+=5
        mylist.append(position)

and instead of this:
[]
[[305, 300], [310, 300]]
[[305, 300], [310, 300], [315, 300]]
[[305, 300], [310, 300], [315, 300]]
[[305, 300], [310, 300], [315, 300]]

...
I get this:
[]
[[305, 300]]
[[305, 300]]
[[305, 300]]
[[305, 300]]
[[305, 300]]
[[305, 300]]
[[310, 300], [310, 300]]
[[315, 300], [315, 300], [315, 300]]
[[315, 300], [315, 300], [315, 300]]
[[315, 300], [315, 300], [315, 300]]
[[315, 300], [315, 300], [315, 300]]
[[315, 300], [315, 300], [315, 300]]
[[315, 300], [315, 300], [315, 300]]
[[315, 300], [315, 300], [315, 300]]
[[315, 300], [315, 300], [315, 300]]
[[320, 300], [320, 300], [320, 300], [320, 300]]
...

Why? It's strange, isn't it?

A: Every time you append position to the list, you only add a reference, not a copy. When then printing mylist you are seeing the same shared list being printed several times.
Create a copy when appending with the slice syntax:
mylist.append(position[:])

Here position[:] creates a slice from start to finish, returning a new list object with a shallow copy.


text:
Q: Drop duplicated values with specific condition on another colunm pandas I want to drop duplicate values on "Nit", but keeping when date "Date" is 31-12-2018
Nit       sales    date

12345      56    31-12-2018
12345      45    31-06-2018
23346      87    31-12-2018
76553      93    31-12-2018
44556      34    31-06-2018
44556      52    31-12-2018

A: Let's try:
(df.assign(valid_date=df['date']=='31-12-2018')
   .sort_values('valid_date', ascending=False)
   .drop_duplicates('Nit')
   .sort_index()
   .drop('valid_date', axis=1)
)

Output:
     Nit  sales        date
0  12345     56  31-12-2018
2  23346     87  31-12-2018
3  76553     93  31-12-2018
5  44556     52  31-12-2018

Note: A simple
df[df['date']=='31-12-2018']

may do what you want.


text:
Q: How does a CPU tell if a virtual address is pointing to a huge page? I'm reading about huge pages in Linux, where the idea is using, say, 2MiB page size instead of 4KiB page size, to reduce TLB misses. I understand that modern CPUs have both data and instruction TLBs, and have separate TLBs for huge pages. What I don't understand is how does the CPU know that a given virtual address is actually pointing to a huge page? It can't just be alignment because there's no guarantee that there are any huge pages allocated at all. Does this mean that the CPU always have to look in both the 4K and the 2M TLBs, just in case? Or what's the mechanism being used?
A related question is, how does Linux handle page tables when a process uses a mixture of 4K and 2M pages? I mean, it can't just mix them in the same page tables, right?


text:
Q: Apache Beam Python DoFn process method and keyword arguments I am using Apache Beam SDK 2.43.0 with Python 3.8 and I am seeing some behaviour in the example below that I do not understand.
If I run the snippet as given, I get the error:
  ...
  File "apache_beam\runners\common.py", line 983, in apache_beam.runners.common.PerWindowInvoker._invoke_process_per_window
TypeError: process() got multiple values for argument 'some_side_input' [while running 'use side input']

If I use beam.ParDo(UseSideInput(), beam.pvalue.AsSingleton(pcollect_bar)) instead of beam.ParDo(UseSideInput(), some_side_input=beam.pvalue.AsSingleton(pcollect_bar)), i.e. use a positional argument for the some_side_input parameter instead of a keyword argument, the pipeline runs as expected.
Similarly, if I use the UseSideInputNoTimestamp DoFn, which does not have the timestamp parameter in the process method, the pipeline runs and allows some_side_input to be supplied as a keyword argument.
Another option is to specify the process method as process(self, element, timestamp=beam.DoFn.TimestampParam, some_side_input=None) and the snippet runs as is allowing a keyword argument. But, I am then providing a default value just to allow for the keyword argument.
Just wondering, is this error expected and if so what is the reason for it?
import apache_beam as beam
import time

class UseSideInput(beam.DoFn):
    def process(self, element, some_side_input, timestamp=beam.DoFn.TimestampParam):
        yield f"{element}~{some_side_input}~{timestamp.to_rfc3339()}"

class UseSideInputNoTimestamp(beam.DoFn):
    def process(self, element, some_side_input):
        yield f"{element}~{some_side_input}"

with beam.Pipeline() as p:

    pcollect_bar = p | "create bar" >> beam.Create(["bar"])

    (
        p
        | "create foo" >> beam.Create(["foo"])
        | "add timestamp" >> beam.Map(lambda element: beam.window.TimestampedValue(element, int(time.time())))
        # | "use side input" >> beam.ParDo(UseSideInput(), beam.pvalue.AsSingleton(pcollect_bar)) <-- works
        # | "use side input no ts" >> beam.ParDo(UseSideInputNoTimestamp(),
        #                                        some_side_input=beam.pvalue.AsSingleton(pcollect_bar)) <-- works
        | "use side input" >> beam.ParDo(UseSideInput(), some_side_input=beam.pvalue.AsSingleton(pcollect_bar))
        | "print" >> beam.Map(print)
    )

A: From what I understood, the behaviour is if you have only the side input parameter, you can pass it with a keyword argument or positional argument,  but if you have multiple parameters, you have to use positional arguments :

*

*Only side input argument :

def test_side_input(self):
        import apache_beam as beam
        import time

        class UseSideInput(beam.DoFn):
            def process(self, element, some_side_input, *args, **kwargs):
                yield f"{element}~{some_side_input}"

        with beam.Pipeline() as p:
            pcollect_bar = p | "create bar" >> beam.Create(["bar"])

            (
                    p
                    | "create foo" >> beam.Create(["foo"])
                    | "add timestamp" >> beam.Map(
                lambda element: beam.window.TimestampedValue(element, int(time.time())))
                    | "use side input one arg positional" >> beam.ParDo(UseSideInput(), beam.pvalue.AsSingleton(pcollect_bar))
                    # | "use side input one arg param" >> beam.ParDo(UseSideInput(),
                    #                                        some_side_input=beam.pvalue.AsSingleton(pcollect_bar))
                    | "print" >> beam.Map(print)
            )

*

*Multiple arguments :

def test_side_input(self):
        import apache_beam as beam
        import time

        class UseSideInput(beam.DoFn):
            def process(self, element, some_side_input, other, timestamp=beam.DoFn.TimestampParam, *args, **kwargs):
                yield f"{element}~{some_side_input}~{timestamp.to_rfc3339()}"

        with beam.Pipeline() as p:
            pcollect_bar = p | "create bar" >> beam.Create(["bar"])

            (
                    p
                    | "create foo" >> beam.Create(["foo"])
                    | "add timestamp" >> beam.Map(
                lambda element: beam.window.TimestampedValue(element, int(time.time())))
                    | "use side input" >> beam.ParDo(UseSideInput(),
                                                     beam.pvalue.AsSingleton(pcollect_bar),
                                                     0)
                    | "print" >> beam.Map(print)
            )

In the second example, I have 2 arguments : some_side_input and other
According to the documentation : 4.5.3. Accessing additional parameters in your DoFn, the timestamp allows to access to the timestamp of element and needs to have a default value with beam.DoFn.TimestampParam :
import apache_beam as beam

class ProcessRecord(beam.DoFn):

  def process(self, element, timestamp=beam.DoFn.TimestampParam):
     # access timestamp of element.
     pass

This timestamp argument is not considered like other usual arguments.
You also have an alternative for side inputs and use methods as functions in Map or FlatMap (built in Beam DoFn) and in this case the keyword arguments works everytime :
def test_other(self):
        import apache_beam as beam
        import time

        def to_element(element, some_side_input, other):
            return f"{element}~{some_side_input}~{other}"

        with beam.Pipeline() as p:
            pcollect_bar = p | "create bar" >> beam.Create(["bar"])

            (
                    p
                    | "create foo" >> beam.Create(["foo"])
                    | "add timestamp" >> beam.Map(
                lambda element: beam.window.TimestampedValue(element, int(time.time())))
                    | "use side input" >> beam.Map(to_element,
                                                   some_side_input=beam.pvalue.AsSingleton(pcollect_bar),
                                                   other=0)
                    | "print" >> beam.Map(print)
            )


text:
Q: Is it natural to say "punch something/someome at full tilt" meaning to punch the thing or someone as hard as one can possibly can? Is it natural to say  punch something/someome at full tilt meaning to punch the thing or someone as hard as one can possibly can? For example:

The was punching the punching bag at full tilt. He must have been letting off steam.

If it isn't, then what would you say to mean that someone punched something as hard as they could?


text:
Q: Calculating resistance value for voltage range I have been working on a DIY Nixie tube clock.  Looking at the schematic for my specific Nixie tubes, the ignition voltage is 170V. This led me to buy a 12V - 170V boost converter. Using this I can power on the Nixie tubes, but the main issue is that the most efficient voltage to run the tube at once it has been ignited is 145V.
I can't remember where, but someone told me that I should use a resistor. I am not entirely sure why, I am quite new to electrical engineering so it would be helpful if someone could explain why I need a resistor and how to calculate it.

A: It takes a certain minimum voltage to make a Nixie tube light up.
Once it is lit, the current controls the brightness.  More current = brighter light.
More current also means shorter life span for the tube.
You want a balance between useful brightness and long life time.
The ignition voltage will push a rather large current through the tube, making it rather bright and shortening the lifetime of the tube.
If you know the rated operating current of the tube, then you can figure out a series resistor.
You need the source voltage (Vs,) the operating voltage (Vo,) and the operating current (Io.)
The series resistor is then given by \$ R = \frac{V_s - V_o}{I_o}\$.
The required information should be in the datasheet for the tube.
If you have the datasheet, though, then you probably won't have to calculate anything.  The needed resistor value will be given.
Like in this example:

The "Test conditions" give the operating voltage and the value of a series resistor.  Problem solved.
It also includes the typical operating current if you'd like to do your own calculations.

A: If you have a tube with no current flow, and you apply 170 volts, this will cause a current to flow. If you maintain the "ignition voltage" on the tube, the current will increase as the temperature of the tube increases and this could cause the tube to "run away" and result in damage to the tube. If you put a properly sized resistor in series with the tube, you will apply the 170 volts to the tube before current starts to flow but once the tube gets started, the current will cause a voltage drop across the resistor and lower the "applied" voltage on the tube thereby limiting the current through the tube at a safe level. If you measure the current through the tube when you apply 145 volts, then you can calculate the resistance required to give you that 25 volt drop. Don't forget to calculate the wattage required for the resistor and size it appropriately.


text:
Q: How to store a Drawable/Bitmap in SQLite (Android) I would like to pass the Int Value of a Drawable through the Bundle in CreateActivity. From this Int value (Resource ID) I would like to use it to create an Event Object that is stored in a SQLLITE DB. When the program generates a listview it should be able to use this Int value to assign its associated Drawable to a part of the listview.
**What should I do to store a Drawable in an SQLite DB or atleast store the INT Value in the DB? **
Main Activity
public class MainActivity extends FragmentActivity implements OnClickListener {

ListView listView;
int lastIndex = -1;
ArrayList<Event> lstEvents = new ArrayList<Event>();

// detail view
TextView tvTitle, tvTime, tvDate;
ImageView ivPic;
View vw_master;

boolean _isBack = true;

ImageButton add;

String title;
String date;
String time;
int resId;

static final int PICK_CONTACT_REQUEST = 0;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

    // // get detail controls
    tvTitle = (TextView) findViewById(R.id.textViewTitle);
    tvDate = (TextView) findViewById(R.id.textViewDate);
    tvTime = (TextView) findViewById(R.id.textViewTime);
    ivPic = (ImageView) findViewById(R.id.imageView1);

    add = (ImageButton) findViewById(R.id.add);
    add.setOnClickListener(this);

    /////////////////////////////////LISTVIEW////////////////////////////////////////
    // Create the adapter to convert the array to views
    EventAdapter adapter = new EventAdapter(this, lstEvents);

    // attach adapter to a list view
    listView = (ListView) findViewById(R.id.listViewFragment);
    listView.setAdapter(adapter);
    /////////////////////////////////LISTVIEW////////////////////////////////////////

    // /////////////////////////////DATABASE/////////////////////////////////////////////
    DatabaseHandler db = new DatabaseHandler(this);
    // /////////////////////////////DATABASE/////////////////////////////////////////////

    List<Event> events = db.getAllContacts();

    adapter.addAll(events);
    adapter.notifyDataSetChanged();

}

@Override
public void onClick(View v) {
    // TODO Auto-generated method stub
    switch (v.getId()) {
    case R.id.add:
        Intent intent = new Intent(this, CreateActivity.class);
        startActivityForResult(intent, 100);
        break;
    }
}

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    // /////////////////////////////DATABASE/////////////////////////////////////////////
    DatabaseHandler db = new DatabaseHandler(this);
    // /////////////////////////////DATABASE/////////////////////////////////////////////

    // Create the adapter to convert the array to views
    EventAdapter adapter = new EventAdapter(this, lstEvents);

    // attach adapter to a list view
    listView = (ListView) findViewById(R.id.listViewFragment);
    listView.setAdapter(adapter);

    if (requestCode == 100) {
        if (resultCode == RESULT_OK) {
            Bundle b = data.getExtras();
            title = b.getString("TITLE");
            time = b.getString("TIME");
            date = b.getString("DATE");

            // retrieving bitmap from CreateActivity

            Bitmap bitmap = (Bitmap) b.getParcelable("DRAWABLE");

            // converting from bitmap to drawable
            Drawable drawable = new BitmapDrawable(getResources(), bitmap);

            // Event newEvent = new Event();
            // newEvent.set_date(date);
            // newEvent.set_title(title);
            // newEvent.set_time(time);

            // set drawable
            // newEvent.set_drawable(drawable);

            // lstEvents.add(newEvent);

            // adapter.addAll(lstEvents);
            // adapter.notifyDataSetChanged();

            ///////////////////////////////DATABASE/////////////////////////////////////////////
            /**
             * CRUD OPERATIONS
             */

            Log.e("Insert: ", "Inserting ..");
            db.addEvent(new Event(0, title, time, date, drawable));

            // Reading all contacts
            Log.e("Reading: ", "Reading all contacts..");
            // List<Event> events = db.getAllContacts();
            List<Event> events = db.getAllContacts();
            adapter.addAll(events);
            adapter.notifyDataSetChanged();

            //logging all events

            for (Event ev : events) {
                String log = "Id: " + ev.get_Id() + " ,Title: "
                        + ev.get_title() + " ,Date: " + ev.get_date();
                // Writing Contacts to log
                Log.e("Name: ", log);

            }

            ///////////////////////////////DATABASE/////////////////////////////////////////////
        }

    }
}
}

Event Class
public class Event {
public int _id;
public String _title;
public String _time;
public String _date;

//drawable
public String _bitmap;

public Event() {
    super();
};

public Event(int id, String title, String time, String date, String bitmap) {
    this._id = id;
    this._title = title;
    this._time = time;
    this._date = date;
    this._bitmap = bitmap;
};

public Event(JSONObject object){
    try {
        this._id = object.getInt("id");
        this._title = object.getString("title");
        this._time = object.getString("time");
        this._date = object.getString("date");
   } catch (JSONException e) {
        e.printStackTrace();
   }
}

// Event.fromJson(jsonArray);
public static ArrayList<Event> fromJson(JSONArray jsonObjects) {
       ArrayList<Event> users = new ArrayList<Event>();
       for (int i = 0; i < jsonObjects.length(); i++) {
           try {
              users.add(new Event(jsonObjects.getJSONObject(i)));
           } catch (JSONException e) {
              e.printStackTrace();
           }
      }
      return users;
}

public int get_Id() {
    return _id;
}

public void set_Id(int _Id) {
    this._id = _Id;
}

public String get_title() {
    return _title;
}

public void set_title(String _title) {
    this._title = _title;
}

public String get_bitmap() {
    return _bitmap;
}

public void set_drawable(String _bitmap) {
    this._bitmap = _bitmap;
}

public String get_time() {
    return _time;
}

public void set_time(String _time) {
    this._time = _time;
}

public String get_date() {
    return _date;
}

public void set_date(String _date) {
    this._date = _date;
}

}

DatabaseHandler
public class DatabaseHandler extends SQLiteOpenHelper {

// All Static variables
// Database Version
private static final int DATABASE_VERSION = 1;

// Database Name
private static final String DATABASE_NAME = "scheduleManager";

// Contacts table name
private static final String TABLE_EVENTS = "events";

// Contacts Table Columns names
private static final String KEY_ID = "id";
private static final String KEY_TITLE = "title";
private static final String KEY_TIME = "time";
private static final String KEY_DATE = "date";
private static final String KEY_BITMAP = "bitmap";

public DatabaseHandler(Context context) {
    super(context, DATABASE_NAME, null, DATABASE_VERSION);
}

@Override
public void onCreate(SQLiteDatabase db) {
    // TODO Auto-generated method stub
    String CREATE_EVENTS_TABLE = "CREATE TABLE " + TABLE_EVENTS + "("
            + KEY_ID + " INTEGER," + KEY_TITLE + " TEXT,"
            + KEY_TIME + " TEXT," + KEY_DATE + " TEXT" + KEY_BITMAP + " TEXT )";
    db.execSQL(CREATE_EVENTS_TABLE);

}

@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
    // Drop older table if existed
    db.execSQL("DROP TABLE IF EXISTS " + TABLE_EVENTS);

    // Create tables again
    onCreate(db);

}

/**
 * All CRUD(Create, Read, Update, Delete) Operations
 */

//adding an event (NEEDS TO ADD DRAWABLE)
 public void addEvent(Event event) {
        SQLiteDatabase db = this.getWritableDatabase();

        ContentValues values = new ContentValues();
        values.put(KEY_ID, event.get_Id()); //Event ID
        values.put(KEY_TITLE, event.get_title()); // Event Title
        values.put(KEY_TIME, event.get_time()); // Event Time
        values.put(KEY_DATE, event.get_date()); // Event Date
        values.put(KEY_BITMAP, event.get_bitmap()); // Event Drawable

        // Inserting Row
        db.insert(TABLE_EVENTS, null, values);
        db.close(); // Closing database connection
    }

   // Getting single contact
   public Event getEvent(int id) {
       SQLiteDatabase db = this.getReadableDatabase();

       Cursor cursor = db.query(TABLE_EVENTS, new String[] { KEY_ID,
               KEY_TITLE, KEY_TIME, KEY_DATE }, KEY_ID + "=?",
               new String[] { String.valueOf(id) }, null, null, null, null);
       if (cursor != null)
           cursor.moveToFirst();

       Event event = new Event(Integer.parseInt(cursor.getString(0)),
               cursor.getString(1), cursor.getString(2), null, null);
       // return contact
       return event;
   }

    // Getting All Contacts
   public List<Event> getAllContacts() {
      List<Event> eventList = new ArrayList<Event>();
      // Select All Query
      String selectQuery = "SELECT  * FROM " + TABLE_EVENTS;

      SQLiteDatabase db = this.getWritableDatabase();
      Cursor cursor = db.rawQuery(selectQuery, null);

      // looping through all rows and adding to list
      if (cursor.moveToFirst()) {
          do {
              Event event = new Event();
              event.set_Id(Integer.parseInt(cursor.getString(0)));
              event.set_title(cursor.getString(1));
              event.set_time(cursor.getString(2));
              event.set_date(cursor.getString(3));
              // Adding contact to list
              eventList.add(event);
          } while (cursor.moveToNext());
      }

      // return contact list
      return eventList;
  }

// Getting event Count
    public int getEventsCount() {
        String countQuery = "SELECT  * FROM " + TABLE_EVENTS;
        SQLiteDatabase db = this.getReadableDatabase();
        Cursor cursor = db.rawQuery(countQuery, null);
        cursor.close();

        // return count
        return cursor.getCount();
    }

 // Updating single contact
    public int updateEvent(Event event) {
        SQLiteDatabase db = this.getWritableDatabase();

        ContentValues values = new ContentValues();
        values.put(KEY_TITLE, event.get_title());
        values.put(KEY_TIME, event.get_time());
        values.put(KEY_DATE, event.get_date());

        // updating row
        return db.update(TABLE_EVENTS, values, KEY_ID + " = ?",
                new String[] { String.valueOf(event.get_Id()) });
    }

    // Deleting single contact
    public void deleteEvent(Event event) {
        SQLiteDatabase db = this.getWritableDatabase();
        db.delete(TABLE_EVENTS, KEY_ID + " = ?",
                new String[] { String.valueOf(event.get_Id()) });
        db.close();
    }
}

Create Activity
public class CreateActivity extends Activity implements OnClickListener {

EditText etTitle;
Button btDate;
Button btTime;
Button btPic;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_create);
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

    //onclicklistener
    findViewById(R.id.btn_confirm).setOnClickListener(this);
    findViewById(R.id.btn_back).setOnClickListener(this);

    etTitle = (EditText) findViewById(R.id.editTextTitle);
    btDate = (Button) findViewById(R.id.btn_date);
    btTime = (Button) findViewById(R.id.btn_time);
    btPic = (Button) findViewById(R.id.btn_picture);

}

// Will be called via the onClick attribute
// of the buttons in main.xml
public void onClick(View view) {
    switch (view.getId()) {
    case R.id.btn_confirm:
        String title = etTitle.getText().toString();
        String time = btTime.getText().toString();
        String date = btDate.getText().toString();

        Drawable drawable = btPic.getCompoundDrawables()[1];
        Log.e("DRAWABLE", "DrawableId" + drawable);
        Bitmap bitmap = ((BitmapDrawable)drawable).getBitmap();

        Log.e("LOG", title);
        Log.e("LOG", time);
        Log.e("LOG", date);

        Bundle newBundle = new Bundle();
        newBundle.putString("TITLE", title);
        newBundle.putString("TIME", time);
        newBundle.putString("DATE", date);

        //Trying to pass a drawable from one activity to another
        newBundle.putParcelable("DRAWABLE", bitmap);

        Intent intent = new Intent(this, MainActivity.class);
        intent.putExtras(newBundle);

        setResult(RESULT_OK, intent);

        finish();

        break;

    case R.id.btn_back:
        finish();
        break;
    }

}

public void showTimePickerDialog(View v) {
    DialogFragment newFragment = new TimePickerFragment();
    newFragment.show(getFragmentManager(), "timePicker");
}

public void showDatePickerDialog(View v) {
    DialogFragment newFragment = new DatePickerFragment();
    newFragment.show(getFragmentManager(), "datePicker");
}

public void showPicturePickerDialog(View v) {
    DialogFragment newFragment = new PicturePickerFragment();
    newFragment.show(getFragmentManager(), "picturePicker");
}

}

A: Store images in database isn't recommended. You must store images in internal or external memory and store a reference of your image in your database.
// GET INT VALUE FROM RESOURCE
int home = R.drawable.home;

// SET IMAGE RESOURCE
img.setImageResource(home);

A: if you want to put images in internal memory of your project then put your images in assets folder and save their names in sqlite then use below code to display images:
 String imageUrl = imgArraList.get(position).getUrl();
/*imageUrl variable will contain image name that should be available in assets folder.*/
    Bitmap bitmap = BitmapFactory.decodeStream(getAssets().open(imageUrl));
    touch.setImageBitmap(bitmap, null, 1.0f, 2.0f);


text:
Q: how to access objects method in a event bind

(function() {
  let create = {

    init() {
      this.cacheDom();
      this.bindEvent();
    },

    bindEvent() {
      $(this.$content_buttons).click(function() {
        create.preformAction(this);
      });
    },

    cacheDom() {
      this.$content_buttons = $('.content_button');
    },

    preformAction(el) {
      alert('its class is ' + $(el).attr('class'));
    }
  };
  create.init();
}());

consider my code above I am able to access performAction method of create object by doing this create.performAction . is there any other way of doing. thanks in advance.

A: try it:

(function() {
 let create = {

init() {
  this.cacheDom();
  this.bindEvent();
},

bindEvent() {

  $(this.$content_buttons).click(function() {
    create.preformAction(this);
  });
},

cacheDom() {
  this.$content_buttons = $('.content_button');
},

preformAction(el) {
  alert('its class is ' + $(el).attr('class'));
}
 };
  create.init();
}());
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<button class="content_button class1">click1</button>
<button class="content_button class2">click2</button>


text:
Q: How to enable fullscreen when pressing a key in LibGDX Hello kinda new to LibGDX and currently having issues with the fullscreen mode on pc, what i'm trying to do is set my game to fullscreen whenever someone presses a key and this doesn't do anything whenver i type something in the main method in desktopLauncher.java. And importing the LwjglApplicationConfiguration class in the core map doesn't work because it isn't available there for some reason.

A: I tested the answer provided by PandaBR on this question and it works.
https://gamedev.stackexchange.com/a/119867/81956
Put this in the render method of your main LibGDX / Game class (not DesktopLauncher). Change "Input.Keys.TAB" to be the key you want to toggle your program in and out of full screen mode.
if (Gdx.input.isKeyPressed(Input.Keys.TAB)){
    Boolean fullScreen = Gdx.graphics.isFullscreen();
        Graphics.DisplayMode currentMode = Gdx.graphics.getDisplayMode();
        if (fullScreen == true)
            Gdx.graphics.setWindowedMode(currentMode.width, currentMode.height);
        else
            Gdx.graphics.setFullscreenMode(currentMode);
}


text:
Q: Not able to replace more than 2 array values I want to replace my existing array with new array. But I am not able to add/replace more than 2 array values. After 2 values, it gets stuck even though the variables show multiple values in console.
function add_comments_in_editor() {
    var comment = '';
    // Get selected Action
    $('input[type=radio]:checked').each(function() {
      comment = '' + actions[$(this).attr('id')] + '';
      window.radioNew = '' + actions[$(this).attr('id')] + '';

    });
    // Get selected reason
    var arrCheck = [];
    window.newCheck = [];
    var arrOld = [];

    $('.voting_parameters input[type=checkbox]:checked').each(function() {
      var voting_parameter_id = $(this).attr('id');
      voting_parameters_array[$(this).attr('id')] + '
';
      arrCheck.push('
' + voting_parameters_array[$(this).attr('id')]);
      window.newCheck = arrCheck;
      // Get selected reasons parameters
      $(this).parent().next('.voting_parameter_reasons').find('input:checkbox').each(function() {
        if ($(this).is(':checked')) {
          var voting_parameter_reasons_id = $(this).attr('id');
          var reason_index = (voting_parameter_reasons_array[voting_parameter_id].map(function(item) {
            return item.voting_parameter_reason_id;
          }).indexOf(voting_parameter_reasons_id))

      voting_parameter_reasons_array[voting_parameter_id][reason_index]['reason_name'] + '

';
        }
      });

    var radioOld = window.oldRadio || '';
    var checkOld = window.oldCheck || '';

    tinyMCE.activeEditor.setContent(tinyMCE.activeEditor.getContent().replace(checkOld, window.newCheck).replace(radioOld, window.radioNew));

    window.oldRadio = '
' + actions[$('input[type=radio]:checked').attr('id')] + '
';
    arrOld.push('
' + voting_parameters_array[$('.voting_parameters input[type=checkbox]:checked').attr('id')]);
    window.oldCheck = arrCheck;
  }

I just need to see why I am not able to replace more than 2 values.

A: String.prototype.replaceAll()
Ref:
https://developer.mozilla.org/pt-BR/docs/Web/JavaScript/Reference/Global_Objects/String/replaceAll
tinyMCE.activeEditor.getContent().replaceAll(checkOld, window.newCheck)


text:
Q: Split a numeric string to a list of integers I have fetched a list using pandas, but the numeric is like a numeric string. I am trying to convert it to a list of integers.
excel_frame = read_excel(args.path, sheet_name=1, verbose=True, na_filter=False)
data_need = excel_frame['Dependencies'].tolist()
print(data_need)

intStr = data_need.split(',')
map_list = map(int, intStr)
print(map_list)

I am getting the following error.
$python ExcelCellCSVRead.py -p "C:\MyCave\iso\SDG\Integra\Intest\first.xlsx"
Reading sheet 1
['187045, 187046']
Traceback (most recent call last):
  File "ExcelCellCSVRead.py", line 31, in <module>
    intStr = data_need.split(',')
AttributeError: 'list' object has no attribute 'split'

The target output must be like this -> [187045, 187046]. The current output is coming out like this ->['187045, 187046']
I am pretty sure I have followed suggested approach to resolve the issue, yet it is throwing error.
Regards
data_need

A: The problem is:
data_need = excel_frame['Dependencies'].tolist()

returns a list. So you can't split it further.
Change your existing code to this:
intStr = data_need[0].split(',') ## if you have only 1-element in data_need
map_list = list(map(int, intStr))
print(map_list)

Tested on your sample:
In [1000]: data_need = ['187045, 187046']

In [1001]: intStr = data_need[0].split(',')

In [1002]: map_list = list(map(int, intStr))

In [1003]: print(map_list)
[187045, 187046]


text:
Q: How to use WHERE and INNER JOIN together Selected name, surname and sum of costs but it doesn't work. Is using WHERE possible here?
SELECT DISTINCT ad, soyad, SUM(gunluk_ucret) AS toplam
FROM Kart as k
INNER JOIN musteri ON k.TCNO=musteri.TCNO
INNER JOIN ekipman ON k.ekipman_id=ekipman.ekipman_id
GROUP BY ad,soyad,gunluk_ucret;

A: In your query, the group by keys and select keys are not consistent.  Perhaps that is the problem you are asking about:
SELECT ad, soyad, SUM(gunluk_ucret) AS toplam
FROM Kart k INNER JOIN
     musteri m
     ON k.TCNO = m.TCNO INNER JOIN
     ekipman e
     ON k.ekipman_id = e.ekipman_id
GROUP BY ad, soyad;

You should qualify all column references in the query.  I don't know what tables the columns come from, so I cannot make any suggests there.


text:
Q: zsh ignores the shebang in macOS Monterey Problem
In macOS Monterey, a script with a shebang (e.g. #!/bin/sh) is not executed by the indicated interpreter via zsh. For example, the following script will yields the below outcome:

Script
#!/usr/bin/env bash
echo $SHELL

Output
% chmod u+x my_script
% my_script
/bin/zsh

I want my scripts to run with bash. I would prefer that the shebang be respected than entirely change my shell. How can I ensure this happens?
Related questions that don't answer mine:

*

*The shebang doesn't work if you're sourcing the script with '.': I'm not

*Run the script like: bash my_script: I want it to respect the shebang, not change my behaviour so I need to check each script before running it with the right shell.

*Change your shell to bash: I wish to keep the standard macOS shell.

A: Your script is being run with bash. $SHELL is set once to the path to your login shell when it starts, not a dynamically changing value for the shell currently executing the command that prints $SHELL.

A: One big difference is that bash by default sets the variable SHELL, but zsh doesn't. Therefore in some implementations, the system configuration (for instance via /etc/zshenv) set SHELL as environment variable to the zsh binary; AFIK, Apple is doing this in MacOS.
bash would set SHELL to the path of its binary, but it does this only if there is no environment variable of this name. You can verify this (while in zsh) with
SHELL=foo bash -c 'printenv SHELL'

(unset SHELL; bash -c 'echo $SHELL')

The first line will print foo, while the second one will print something like /bin/bash.
Hence, if you want bash to get SHELL to be set, you have to unset it in your zsh before running your bash script. However, since the cases where this variable is actually needed are rare, I don't think this is worth the effort.


text:
Q: Kotlin Coroutines Flow with Room and state handling I'm trying out the new coroutine's flow, my goal is to make a simple repository that can fetch data from a web api and save it to db, also return a flow from the db.
I'm using room and firebase as the web api, now everything seems pretty straight forward until i try to pass errors coming from the api to the ui.
Since i get a flow from the database which only contains the data and no state, what is the correct approach to give it a state (like loading, content, error) by combining it with the web api result?
Some of the code i wrote:
The DAO:
@Query("SELECT * FROM users")
fun getUsers(): Flow<List<UserPojo>>

The Repository:
val users: Flow<List<UserPojo>> = userDao.getUsers()

The Api call:
override fun downloadUsers(filters: UserListFilters, onResult: (result: FailableWrapper<MutableList<UserApiPojo>>) -> Unit) {
    val data = Gson().toJson(filters)

    functions.getHttpsCallable("users").call(data).addOnSuccessListener {
        try {
            val type = object : TypeToken<List<UserApiPojo>>() {}.type
            val users = Gson().fromJson<List<UserApiPojo>>(it.data.toString(), type)
            onResult.invoke(FailableWrapper(users.toMutableList(), null))
        } catch (e: java.lang.Exception) {
            onResult.invoke(FailableWrapper(null, "Error parsing data"))
        }
    }.addOnFailureListener {
        onResult(FailableWrapper(null, it.localizedMessage))
    }
}

I hope the question is clear enough
Thanks for the help
Edit: Since the question wasn't clear i'll try to clarify. My issue is that with the default flow emitted by room you only have the data, so if i were to subscribe to the flow i would only receive the data (eg. In this case i would only receive a list of users). What i need to achieve is some way to notify the state of the app, like loading or error. At the moment the only way i can think of is a "response" object that contains the state, but i can't seem to find a way to implement it.
Something like:
fun getUsers(): Flow<Lce<List<UserPojo>>>{
    emit(Loading())
    downloadFromApi()
    if(downloadSuccessful)
        return flowFromDatabase
    else
        emit(Error(throwable))
}

But the obvious issue i'm running into is that the flow from the database is of type Flow<List<UserPojo>>, i don't know how to "enrich it" with the state editing the flow, without losing the subscription from the database and without running a new network call every time the db is updated (by doing it in a map transformation).
Hope it's clearer

A: I believe this is more of an architecture question, but let me try to answer some of your questions first.

My issue is that with the default flow emitted by room you only have
  the data, so if i were to subscribe to the flow i would only receive
  the data

If there is an error with the Flow returned by Room, you can handle it via catch()

What i need to achieve is some way to notify the state of the app,
  like loading or error.

I agree with you that having a State object is a good approach. In my mind, it is the ViewModel's responsibility to present the State object to the View. This State object should have a way to expose errors.

At the moment the only way i can think of is a "response" object that
  contains the state, but i can't seem to find a way to implement it.

I have found that it is easier to have the State object that the ViewModel controls be responsible for errors instead of an object that bubbles up from the Service layer.
Now with these questions out of the way, let me try to propose one particular "solution" to your issue.
As you mention, it is common practice to have a Repository that handles retrieving data from multiple data sources. In this case, the Repository would take the DAO and an object that represents getting data from the network, let's call it Api. I am assuming that you are using FirebaseFirestore, so the class and method signature would look something like this:
class Api(private val firestore: FirebaseFirestore) {

fun getUsers() : Flow<List<UserApiPojo>

}

Now the question becomes how to turn a callback based API into a Flow. Luckily, we can use callbackFlow() for this. Then Api becomes:
class Api(private val firestore: FirebaseFirestore) {

fun getUsers() : Flow<List<UserApiPojo> = callbackFlow {

val data = Gson().toJson(filters)

functions.getHttpsCallable("users").call(data).addOnSuccessListener {
    try {
        val type = object : TypeToken<List<UserApiPojo>>() {}.type
        val users = Gson().fromJson<List<UserApiPojo>>(it.data.toString(), type)
        offer(users.toMutableList())
    } catch (e: java.lang.Exception) {
       cancel(CancellationException("API Error", e))
    }
}.addOnFailureListener {
    cancel(CancellationException("Failure", e))
    }
  }
}

As you can see, callbackFlow allows us to cancel the flow when something goes wrong and have someone donwnstream handle the error.
Moving to the Repository we would now like to do something like:
val users: Flow<List<User>> = Flow.concat(userDao.getUsers().toUsers(), api.getUsers().toUsers()).first()
There are a few caveats here. first() and concat() are operators you will have to come up with it seems. I did not see a version of first() that returns a Flow; it is a terminal operator (Rx used to have a version of first() that returned an Observable, Dan Lew uses it in this post). Flow.concat() does not seem to exist either. The goal of users is to return a Flow that emits the first value emitted by any of the source Flows. Also, note that I am mapping DAO users and Api users to a common User object.
We can now talk about the ViewModel. As I said before, the ViewModel should have something that holds State. This State should represent data, errors and loading states. One way that can be accomplished is with a data class.
data class State(val users: List<User>, val loading: Boolean, val serverError: Boolean)
Since we have access to the Repository the ViewModel can look like:
val state = repo.users.map {users -> State(users, false, false)}.catch {emit(State(emptyList(), false, true)}
Please keep in mind that this is a rough explanation to point you in a direction, there are many ways to accomplish state management and this is by no means a complete implementation. It may not even make sense to turn the API call into a Flow, for example.

A: The answer from Emmanuel is really close to answering what i need, i need some clarifications about some of it.

It may not even make sense to turn the API call into a Flow

You are totally right, in fact i only want to actually make it a coroutine, i don't really need it to be a flow.

If there is an error with the Flow returned by Room, you can handle it via catch()

Yes i discovered this after posting the question. But my problem is more something like:
I'd like to call a method, say "getData", this method should return the flow from db, start the network call to update the db (so that i'm going to be notified when it's done via the db flow) and somewhere in here, i would need to let the ui know if db or network errored, right?. Or should i maybe do a separate "getDbFlow" and "updateData" and get the errors separately for each one?

val users: Flow> = Flow.concat(userDao.getUsers().toUsers(), api.getUsers().toUsers()).first()

This is a good idea, but i'd like to keep the db as the single source of truth, and never return to the ui any data directly from the network


text:
Q: Detections are way off and mAP is always zero with M-RCNN training I'm attempting to apply Matterport's Mask-RCNN setup to my own data, but despite all of the great examples of impressive detections I've seen out there, I'm really struggling to get results that are at all promising, and so I'm suspecting that there's something fundamental I'm overlooking in my setup.
My dataset consists of aerial RGB shots of a city, with two classes: tree and background.
Image info: Aerial RGB photos, all 512x512, training: 324, validation: 36, using random crops of 128x128.
~46 trees per image on average.
Each training session ends up with something looking pretty similar to this:

With the following rough stats when testing on the validation set with no image cropping using the inspect_model.ipynb as a guide:
Original image shape:  [512 512   3]
Processing 1 images
image                    shape: (512, 512, 3)         min:   23.00000  max:  255.00000  uint8
molded_images            shape: (1, 512, 512, 3)      min:   23.00000  max:  255.00000  uint8
image_metas              shape: (1, 14)               min:    0.00000  max:  512.00000  int64
anchors                  shape: (1, 65280, 4)         min:   -0.17712  max:    1.11450  float32
gt_class_id              shape: (12,)                 min:    1.00000  max:    1.00000  int32
gt_bbox                  shape: (12, 4)               min:   20.00000  max:  512.00000  int32
gt_mask                  shape: (512, 512, 12)        min:    0.00000  max:    1.00000  float64
AP @0.50:    0.000
AP @0.55:    0.000
AP @0.60:    0.000
AP @0.65:    0.000
AP @0.70:    0.000
AP @0.75:    0.000
AP @0.80:    0.000
AP @0.85:    0.000
AP @0.90:    0.000
AP @0.95:    0.000
AP @0.50-0.95:   0.000

I keep getting the same results (seemingly high confidence with zero or very close to zero IoU, generally clustered at the tops of the images), even after implementing advice I've found elsewhere in the Mask-RCNN repo (for small datasets) such as only training on heads, initializing with coco weights but not for too long, adjusting my anchor scales to match the general sizes and aspect ratios of the annotations, etc.
So far I'm questioning:

*

*Is my dataset simply too small for the complexity a Resnet101 backbone?

*Maybe something is up with my annotations?

*I'm screwing up a fundamental aspect of my config

*Unknown unknowns

Checking out the losses, what obviously stands out is the high overall loss (epoch_loss) which increases with each training iteration (just heads -> resnet +4 -> all layers):

My config:
Configurations:
BACKBONE                       resnet101
BACKBONE_STRIDES               [4, 8, 16, 32, 64]
BATCH_SIZE                     8
BBOX_STD_DEV                   [0.1 0.1 0.2 0.2]
COMPUTE_BACKBONE_SHAPE         None
DETECTION_MAX_INSTANCES        100
DETECTION_MIN_CONFIDENCE       0.5
DETECTION_NMS_THRESHOLD        0.3
FPN_CLASSIF_FC_LAYERS_SIZE     1024
GPU_COUNT                      1
GRADIENT_CLIP_NORM             5.0
IMAGES_PER_GPU                 8
IMAGE_CHANNEL_COUNT            3
IMAGE_MAX_DIM                  128
IMAGE_META_SIZE                14
IMAGE_MIN_DIM                  128
IMAGE_MIN_SCALE                0
IMAGE_RESIZE_MODE              crop
IMAGE_SHAPE                    [128 128   3]
LEARNING_MOMENTUM              0.9
LEARNING_RATE                  0.001
LOSS_WEIGHTS                   {'rpn_class_loss': 1.0, 'rpn_bbox_loss': 1.0, 'mrcnn_class_loss': 1.0, 'mrcnn_bbox_loss': 1.0, 'mrcnn_mask_loss': 1.0}
MASK_POOL_SIZE                 14
MASK_SHAPE                     [28, 28]
MAX_GT_INSTANCES               101
MEAN_PIXEL                     [107.  105.2 101.5]
MINI_MASK_SHAPE                (56, 56)
NAME                           tree
NUM_CLASSES                    2
POOL_SIZE                      7
POST_NMS_ROIS_INFERENCE        1000
POST_NMS_ROIS_TRAINING         2000
PRE_NMS_LIMIT                  6000
ROI_POSITIVE_RATIO             0.33
RPN_ANCHOR_RATIOS              [0.5, 1, 1.5]
RPN_ANCHOR_SCALES              (16, 32, 64, 128)
RPN_ANCHOR_STRIDE              1
RPN_BBOX_STD_DEV               [0.1 0.1 0.2 0.2]
RPN_NMS_THRESHOLD              0.9
RPN_TRAIN_ANCHORS_PER_IMAGE    64
STEPS_PER_EPOCH                500
TOP_DOWN_PYRAMID_SIZE          256
TRAIN_BN                       False
TRAIN_ROIS_PER_IMAGE           200
USE_MINI_MASK                  False
USE_RPN_ROIS                   True
VALIDATION_STEPS               50
WEIGHT_DECAY                   0.005


text:
Q: What's the most efficient way to multiply 4 floats by 4 floats using SSE? I currently have the following code:
float a[4] = { 10, 20, 30, 40 };
float b[4] = { 0.1, 0.1, 0.1, 0.1 };
asm volatile("movups (%0), %%xmm0\n\t"
             "mulps (%1), %%xmm0\n\t"
             "movups %%xmm0, (%1)"
             :: "r" (a), "r" (b));

I have first of all a few questions:
(1) if i WERE to align the arrays on 16 byte boundaries, would it even work? Since the arrays are allocated on the stack is it true that aligning them is near impossible?
see the selected answer for this post: Are stack variables aligned by the GCC __attribute__((aligned(x)))?
(2) Could the code be refactored at all to make it more efficient? What if I put both float arrays in registers rather than just one?
Thanks

A: Write it in C, use
gcc -S -mssse3

if you have a fairly recent version of gcc.

A: Does GCC provide support for the __m128 data type? If so that's your best plan for guaranteeing a 16 byte aligned data type.  Nonetheless there is __attribute__((aligned(16))) for aligning things.  Define your arrays as follows
float a[4] __attribute__((aligned(16))) = { 10, 20, 30, 40 };
float b[4] __attribute__((aligned(16))) = { 0.1, 0.1, 0.1, 0.1 };

and then use movaps instead :)

A:
if i WAS to align the arrays on 16 byte boundaries, would it even work? Since the arrays are allocated on the stack is it true that aligning them is near impossible?

It is required that alignment on the stack works. Otherwise intrinsics would not work. I would guess the post you quoted had to do with the exorbitant value he selected for the alignment value.
to 2:
No, there shouldn't be a difference in performance. See this site for the instruction timings of several processors.

How alignment of stack variables works :
push    ebp
mov ebp, esp
and esp, -16                ; fffffff0H
sub esp, 200                ; 000000c8H

The and aligns the begin of the stack to 16 byte.

A:
(1) if i WAS to align the arrays on 16 byte boundaries, would it even work? Since the arrays are allocated on the stack is it true that aligning them is near impossible?

No, it's quite simple to align the stack pointer using and:
and esp, 0xFFFFFFF0 ; aligned on a 16-byte boundary

But you should use what GCC provides, such as a 16 bytes type, or __attribute__ to customize alignment.

A: Using intrinsic is much faster  especially with optimization.
I wrote simple test and compare both version (asm and intrinsic)
unsigned long long time1;
__m128 a1,b1;

a1=_mm_set_ps(10, 20,30,40);
b1=_mm_set_ps(0.1, 0.1, 0.1, 0.1);
float a[4] = { 10, 20, 30, 40 };
float b[4] = { 0.1, 0.1, 0.1, 0.1 };

time1=__rdtsc();
a1=_mm_mul_ps(a1,b1);
time1=__rdtsc() - time1 ;
printf("Time: %llu\n",time1);

time1=__rdtsc();
asm volatile("movups (%0), %%xmm0\n\t"
                 "mulps (%1), %%xmm0\n\t"
                 "movups %%xmm0, (%1)"
                 :: "r" (a), "r" (b));
time1=__rdtsc() - time1 ;
printf("Time: %llu\n",time1);

Intrinsic version 50-60 processor timestamps
Asm Version ~1000 proc timestamps
You can test it on your machine

A: About refactoring. You can use intrinsic.
Example:
#include <emmintrin.h>

int main(void)
{
    __m128 a1,b1;

    a1=_mm_set_ps(10, 20,30,40);
    b1=_mm_set_ps(0.1, 0.1, 0.1, 0.1);

    a1=_mm_mul_ps(a1,b1);

    return 0;
}

With optimization gcc (-O2 , -O3) it may be work faster then asm.


text:
Q: Logic: Teichmüller-Tukey Lemma and the Axiom of Choice How can you proof that the Teichmüller-Tukey Lemma (which says that if $S$ is nonempty and of finite character, $S$ contains a maximal element with respect to the subset ordering), implies the Axiom of Choice?
Any hints or solutions will be appreciated!

A: The proof is not difficult, let $\{A_i\mid i\in I\}$ be a family of non-empty sets. Now consider $\scr F$ to be the collection of all partial choice functions, that is every choice function on a subset of $I$.
First note that any maximal element must be a full choice function on $I$, otherwise we can always extend it by one more element. So if we can prove $\scr F$ has a finite character we're essentially done.
But now, suppose that $f$ is a partial choice function, then every subset of $f$ is a partial choice function, in particular its finite subsets. And if $A$ is a set such that every finite subset of $A$ is in $\scr F$ then $A$ is a partial choice function, and therefore in $\scr F$. And therefore we're done.


text:
Q: Rename unnamed columns in Pyspark Dataframe The data is in excel file that means file format is in '.xlsx'. The Header for the table has been sort of split amongst the first two rows. How do I fix this? Are there any  solutions to take the best of the two names for each column, and make that column name as header
I have these rows in source file:
|Unnamed:_0|Unnamed:_1|Unnamed:_2|Unnamed:_3|Unnamed:_4|Year |2018|2018.1|
|Col1      |Col2      |Col3      |Col4      |Col5      |Month|Jul |Aug   |

I want to display header for the table as:
|Col1|Col2|Col3|Col4|Col5|Year_Month|2018_07|2018.1_08|

I would be glad if you would help me provide a solution for this since i am new to pyspark

A: you can share more of your code but I bet that it header option for csv:
df = spark.read.format("csv").option("header", "true").load("csvfile.csv")

if it is not csv you can use schema and specify column names in schema. Example with schema:
schema = StructType([
 StructField('firstname', StringType(), True),
 StructField('middlename', StringType(), True),
 StructField('lastname', StringType(), True),
 StructField('languages', ArrayType(StringType()), True),
 StructField('state', StringType(), True),
 StructField('gender', StringType(), True)])
df = spark.createDataFrame(data = data, schema = schema)

sometimes also for csvs can be useful to auto detect schema from file so:
df = spark.read.format("csv").option("header", "true").option("inferSchema", "true").load("csvfile.csv")

if you load from excel you can also use above options like
.option("header", "true")

in loading excel useful is also option dataAddress as you can target table/selection as you do in excel so after some experiments header will match:
.option("dataAddress", "'My Sheet'!B3:C35")

if any of that solution is not working you can promote your first line to header but it is a bit complicated. An excellent script and manual how to do it by @desertnaut is described here https://stackoverflow.com/a/34837299/10972959


text:
Q: GenerationValue dont work in one to one relationship i have 2 tables: userapp and owner, userapp have username as id. the relationship between both tables are one to one, and owner pk is the pk of userapp, i map this relationship like this:
UserApp entity:
@Entity
@Inheritance(strategy = InheritanceType.JOINED)
public class UserApp{

    @Id
    private String username;
    @Column
    private String password;
    @Column
    private String email;
    @Column
    private String role;

Owner Entity:
@Entity
public class Owner extends UserApp{

    @Column(unique = true)
    @GeneratedValue
    private int personId;
    @Column
    private String name;
    @Column
    private String address;
    @Column
    private String neighborhood;

    public Owner(String username, String password, String email, String name, String address, String neighborhood) {
        super(username, password, email, "owner");
        this.name = name;
        this.address = address;
        this.neighborhood = neighborhood;
    }

i am using postgresql and when i see the tables, they are correctly created, when i create a owner  is persisted correctly too, the problem is the personId column, that for some reason the @GeneratedValue dont works, i mean, when i try to create other owner, i have and error that says the key personId already exits. and indeed, hibernate still create the person Id with value 0 to all new owners, i tried with all GenerationType and still have the problem

A: This is not how you map a one-to-one in JPA.
What you did is mapping inheritance, that's something different.
I think the mapping you are looking for is this one:
@Entity
public class UserApp {

    @Id
    private String username;
    @Column
    private String password;
    @Column
    private String email;
    @Column
    private String role;
}

@Entity
public class Owner {

    @Id
    private int personId;

    @OneToOne
    @MapsId
    UserApp userApp;

    @Column
    private String name;
    @Column
    private String address;
    @Column
    private String neighborhood;
}

Check the mapping for one-to-one associations with @MapsId on the Hibernate ORM documentation for more details.


text:
Q: Анимация svg (Волна)

<svg id="bg"viewBox="0 0 1440 761" fill="none" xmlns="http://www.w3.org/2000/svg">
                    <path d="M1150 8.61221C843.181 111 842.5 458.768 441.962 309.552C303.655 258.027 156 309.891 -2 358.578V402.142C-2 402.142 307 260.5 606.5 613.5C906 966.5 1440 575 1440 575V93.9001C1322.5 37.0415 1272.82 -22.6491 1150 8.61221Z" fill="url(#paint0_linear_2_39)"/>

                    <defs>

                    <linearGradient id="paint0_linear_2_39" x1="1318" y1="521.112" x2="187.078" y2="644.159" gradientUnits="userSpaceOnUse">
                    <stop stop-color="#590D56"/>
                    <stop offset="1" stop-color="#8C1688"/>
                    </linearGradient>
                    </defs>
                    </svg>

Господа, прошу помощи - есть svg, моя задача анимировать изображение так, чтобы по обеим сторонам (сверху и снизу) были небольшие волны.
В сети много вариантов, как сделать волны, но они все односторонние.
Этот svg будет фоном на сайте.
Пробовал keyframes и transform - ничего не вышло, не нашёл там необходимого оператора.
Прошу помощи практической или подсказки, что загуглить и где, что найти.