Categories
Linux Mastering Development

Brace expansion with elements of an array

In Bash we can already do this: echo foo.{a,b,c} # == foo.a foo.b foo.c How do we get roughly: arr=(a b c) echo foo.{${arr[@]}} # == foo.a foo.b foo.c

Categories
Mastering Development

Return and display the count of items from a list in flutter

I have a list of Strings: list = [‘a’,’b’,’b’,’c’,’a’,d] I want to display the strings in the list in a column with the count next to them. Eg a:2, b:2 etc… Column( children[ …list.map(letter)=> Text()… ] ) any pointers would be welcome..

Categories
Mastering Development

Type Error: list indices must be integers or slices, not str

What is the issue with my code?Keep getting :" Type Error: list indices must be integers or slices, not str" ata2 = [{‘one’: 1, ‘two’: 2}, {‘one’: 5, ‘two’: 10, ‘three’: 20}] pd.DataFrame(ata2,index=[‘a’,’b’],columns=[‘one’,’two’,’three’]) ata2[‘four’]=ata2[‘one’]* ata2[‘two’]

Categories
Mastering Development

How to select only certain items from a collection using Streams in Java

I am trying to select only names from a collection using streams: These are the entries: Person{id=4, name=E, color=red}] [Person{id=0, name=A, color=blue} Person{id=1, name=B, color=green} Person{id=2, name=D, color=pink} Person{id=0, name=C, color=yellow I’ve tried using map, but it doesn’t seem to alter the list since the function I’m mapping it to is supposed to be a […]

Categories
Artificial Intelligence (AI) Mastering Development

Do the order of the features ie channel matter for a 1d convolutional network?

Do the test dataset feature order and inference (real world) feature order have to be the same as the training dataset? For example, if features are in the order (a,c,b,e,d) for the training dataset, does that particular order have to match for the inference and test dataset?

Categories
Mastering Development Software

Should developers somehow specify and verify business software more formally (finance, accounting)?

I am fighting with yet another bugs in the financial software which we are developing – the usual problems: partially specified assumptions that becomes false in some border-cases and that introduces unexpected results, not captured all the branches in the code, unpredicted situations, etc. I had formal specificion course in the college (e.g. https://en.wikipedia.org/wiki/Formal_specification and […]

Categories
Artificial Intelligence (AI) Mastering Development

Formulating a prediction (labeled data) problem as RL (Q-learning)?

so one of friends sent me some problem he was working on lately and I couldn’t help but to wonder how could it be solved using Q-learning. The statement is as follows : Given the following datasets, the objective is to find a suitable strategy per customer contract to maximize Gain and minimize Cost according […]

Categories
Mastering Development

Subtract two values from current row cells and output that value into a new cell row (google script)

I am making a Google Sheet that will track clock in-out times. I want to add a column e that will calculate the number of hours worked given the start time (column c) and end time (column d). How can I go about implementing this? Here is my code: function setValue(cellName, value){ SpreadsheetApp.getActiveSpreadsheet().getRange(cellName).setValue(value); } function […]

Categories
Mastering Development

pandas – merge df with multiindex on column with other df on index (without multiindex)

My Google-fu didn’t bring me the answer so I am posting my question here. Let’s say I have two data frames df1 and df2 and I want to merge them. df1 has a multi-index on columns and df2 consists of one multi-index column with an index. The index of df2 has a name that coincides […]

Categories
Database Development

Cannot use “ON CONFLICT” with postgres updatable view and partial index

I have an updatable view pointing to an underlying table that has a partial index. It looks something like this CREATE TABLE if not exists foo ( a INT, b INT, x INT, y INT, z BOOLEAN, CONSTRAINT x_or_y CHECK ( (z and x is not null and y is null) or (not z and […]