Categories
Mastering Development

Is there a way to be able to hold HoverTool information by clicking in Bokeh?

I am working on a project where lines are made between circles, right now the user can see the lines between circles by hovering over a circle. For ease of use I would like the user to be able to see the lines when hovering over a circle but also when clicking on a circle […]

Categories
Database Development

Food Database Design Project

Goal Just looking to hear some feedback on my current Database design. Summary We sell products such as nuts. Either individually or sell it as a mix. For example, we sell Californian Whole almonds in any weight and also Broken Brazil’s in any weight, each of these have 2 separate product codes. Also we sell […]

Categories
Mastering Development

Match regex with overlap for DNA

I am trying to match DNA sequences that begin at the beginning or a multiple of 3 letters from the beginning, and start with either ATG or CGA, followed by 6,9,12,15,… letters and ending in AGT. The following code only gets one of the matches (the longest one). I have looked into "positive lookaheads" (e.g. […]

Categories
Mastering Development

Conditional Formatting formula for if cell begins with number list item (“1. “, “2. ” etc)

I want to conditional format a few things in my Google Sheet (this applies to excel too though). Q1: Highlight any cell that begins with a number point. Such as "1. " or "2. " etc. So ‘Number, dot, space’. My working formula currently is: =OR(LEFT(C1,3) = "1. ", LEFT(C1,3) = "2. ", LEFT(C1,3) = […]

Categories
Mastering Development

Issues with Hadoop syntax

I have a filter that passes when validating however, I get an error when attempting to run the query. "(?Report View?=’Q’) and ([Creation Date] between cast(add_months(trunc(_add_months(?Report Period?,-3*(?Look Back?)),’q’),3)-1,date) and cast(add_months(trunc(_add_months(?Report Period?,0),’q’),3)-1,date))" I thought ‘trunc’ function is the culprit. so, i’ve changed to – ‘to Char’ for compatibility sakes to honor oracle. but i still have […]

Categories
Mastering Development

How to build clusters in DBSCAN Algorithm

I am trying to implement the DBScan algorithm in Python. Using the below example as a reference: point X Y P1 3 7 P2 4 6 P3 5 5 P4 6 4 P5 7 3 P6 6 2 P7 7 2 P8 8 4 P9 3 3 P10 2 6 P11 3 5 P12 2 […]

Categories
Mastering Development

check if all the values for different keys are the same

I want to return true if all the values in dict for different keys is same else false: for example: this should return true: {1: [1, 1, 1], 2: [1, 1, 1], 3: [1, 1, 1]}) this should return false. {1: [1, 1, 1], 2: [1, 1, 1], 3: [1, 2, 1]}) I tried the […]

Categories
Mastering Development

List self nesting in Javascript

Question I am trying to achieve a function that transforms a list into a second list with two sublist of itself. This function must do so by being called in a chain i.e [1,2,3] => [[1,2,3],[1,2,3]] The function form should look something like this, where fn is the function i am looking for [1,2,3].map(x=>[x]).fn() // […]

Categories
Mastering Development

Is there a function to sort a Table in MS Report Designer for a String like xx.xx.x.xxx.x.xx?

I do have a report for BOM that receives a so called "RowOrder" from a SQL query. The report pops up correctly, but I want to change the sorting of the rows: If there is now the row order: 1, 2, 3, 4, 5, 3.1, 3.2, 3.3 I do want the row order instead: 1, […]

Categories
Mastering Development

How to get cosine similarity scores for all users and all the items in PySpark, if user’s and item’s embeddings are given?

I have a users df- df1 = spark.createDataFrame([ ("u1", [0., 2., 3.]), ("u2", [1., 0., 0.]), ("u3", [0., 0., 3.]), ], [‘user_id’, ‘features’]) print(df1.printSchema()) df1.show(truncate=False) Output- root |– user_id: string (nullable = true) |– features: array (nullable = true) | |– element: double (containsNull = true) None +——-+—————+ |user_id|features | +——-+—————+ |u1 |[0.0, 2.0, 3.0]| […]