Categories
Development JSON

Using COPY to import a .json file into a PostgreSQL table

I want to import some weather data (temperature, wind speed, …) that is all formatted in a JSON file into a PostgreSQL 11 table so I can then make queries on that data. I’ve been able to manually insert some data into a table but that’s only OK because it’s a small amount of data […]

Categories
Development

How to execute a spark task using Luigi?

I run a lot of Spark jobs, and I’d like to coordinate them using Luigi. However I’m getting an error message that I don’t know how to fix. Here is my basic script: import luigi from luigi.contrib.spark import PySparkTask import pandas as pd class rddTest(PySparkTask): def input(self): d = [1, 2, 3, 4, 5] return […]

Categories
Development Windows

How to get parameters of an Picture Transfer Protocol event in Windows Portable Devices?

I’m trying to support a digital camera with WPD. I have working request/data/response communication (PTP types 1,2,3), but have problems with events (type 4). From the event I need a command code (ex. 0xc102) and up to three integer parameters. I have registered and am receiving events using the code from Microsoft’s Portable Devices COM […]

Categories
Development

No of Subsequences without duplicates

I have an array of certain length (say 8) 1,2,2,3,3,4,5,6 I wish to find number of subsequences of this array of length (say 4). This is 8 choose 4 (8C4) = 70. However, in the list of 70 subsequences above, I do not want to count sequences having duplicate elements e.g. 1223 1224 1334 2233 […]

Categories
Development

How to make listview.builder builder that starts from the center?

I am making an application that query data from an external database that returns a list of 100 events sorted by date. (50 future dates, 50 past dates) The homepage would then render a Listview.builder filled with ExpansionTile to then show it to the user. The catch is, we to set the first item on […]

Categories
Development

Keras layer and Nonetype [on hold]

Edit 2: Well, the problem in this case seems to be that, when creating a custom Keras layer, self.add_weight does not allow a Nonetype input. Keras’ own BatchNormalization function does not seem to allow Nonetype inputs either. According to this article, this code should work; It should provide a functioning Faster RCNN. However, I cannot […]

Categories
Development

How to fix VBA regression code that works when executed without a button, but not with a button

I’d like to tie my regression code to a button, but when I do, my regression code no longer works. I have tried to be very explicit on where the ranges are, enabling more references (Solver, atpvbaen.xls, Ref Edit Control), and rewriting the syntax of my code. Dim nextReg As Integer Dim nextRegEnd As Integer […]

Categories
Development

group by column and identify key rows

I divide the problem into two: Problem1: I have a list(list1) of matrices(Mat1, Mat2). Each matrix has the same dimensions but different elements. For each matrix I need to group the data by “number” and then move to “score” and find the corresponding row number. I want to store this row number in a list […]

Categories
Development

How to map discrerte values to a heatmap in seaborn?

I am trying to plot discrete values in a heatmap using seaborn. Here is the list I am trying to plot: xa = [[5, 4, 4, 4, 13, 4, 4], [1, 9, 4, 3, 9, 1, 4], [4, 1, 7, 1, 5, 3, 7], [1, 9, 4, 3, 9, 5, 4], [2, 1, 4, 1, […]

Categories
Development

Rails: How to get enum value for joined table?

I have two models with enum fields: class TempAsset < ApplicationRecord enum state: { running: 0, stopped: 1, terminated: 2 } end class AssetCredential < ApplicationRecord enum map_status: { pending: 0, inprogress: 1, passed: 2, failed: 3 } end When I select column from the first table, it gives proper values from enum: TempAsset.joins(‘INNER JOIN […]