Categories
Mastering Development

Powershell import in a CSV and Exporting to a Text File

I been ting to research this and I’m trying to do something that I’m not sure is possible in Powershell. I have a CSV like this with the header included: Field1,Field2,Field3 Field1aaa,abc,rst Field2bbb,ghi,xyz In the end, I’m looking to take the CSV and export to a text file in a specific format. And it needs […]

Categories
Mastering Development

Get all the values of a key in json

I have a json file with the following structure: How do I get all the values of key “verb” in c#? In this example, values of key “verb” are abc, def, ghi, jkl. { “$schema”: “schema.json”, “actions”: [ { “verb”: “abc”, “fieldType”: “Text” }, { “verb”: “def”, “subactions”: [ { “verb”: “ghi”, “internalName”: “PKC_Floor” } […]

Categories
Development

Is savepoint required inside FOR loop of PLSQL oracle?

just wondering if we really need rollback/savepoint required inside a LOOP statement if we have exception catch inside. create table my_Tab (id number, name varchar2(10), address varchar2(100)); insert into my_tab values (1,’ABC’,’XXX’); insert into my_tab values (2,’DEF’,’YYY’); insert into my_tab values (3,’GHI’,’ZZZ’); insert into my_tab values (4,’JKL’,null); DECLARE CURSOR cur_my_tab is select * from my_tab; […]

Categories
Development

python: replace multiple columns in pandas frame with values form dictionary

import pandas as pd df = pd.DataFrame([[1,’192.168.1.10′, ‘45.7.12.34’, ‘abc’],[4, ‘10.10.1.11’, ‘90.90.67.33’, ‘def’], [77, ‘52.1.7.90’, ‘67.5.3.5’, ‘ghi’ ], [90, ‘19.19.90.7’, ‘77.88.99.44’, ‘xyz’]], columns=[‘A’, ‘sip’, ‘dip’, ‘location’]) addrs = {‘192.168.1.10’: ‘myhost.net’, ‘45.7.12.34’: ‘myhost-goo.net’, ‘10.10.1.11’: ‘myhost-foo.net’ }`enter code here` df[[‘sip’,’dip’]].replace(addrs, inplace=True) This code returns the warning, and in fact it does not replace dataframe‘s cell values: /usr/lib/python3.5/site-packages/pandas/core/frame.py:4042: SettingWithCopyWarning: […]

Categories
Development

Converting the type of a column of a pyspark DataFrame from BigInt to Int

when I create a pyspark DataFrame the follwing way: df = spark.sparkContext.parallelize([ (‘Client1’, ‘abc’, 1), (‘Client2’, ‘def’, 2), (‘Client3’, ‘ghi’, 3) ]).toDF([‘CLIENT_NO’, ‘CLIENT_FAMILY’, ‘CLT_INT’]) the ‘CLT_INT’ column is of the type BigInt. Any suggestions on how I can cast that column to not contain BigInt but instead Int without changing the way I create the […]

Categories
Development

Python- IF Else statement and return

I’m trying to write a code to let user input a letter and return the digit like our phone keypad. My working is: phone_letters = [” “, “”, “ABC”, “DEF”, “GHI”, “JKL”, “MNO”, “PQRS”, “TUV”, “WXYZ”] def let_to_num(): letter =input(“Enter: “) key = 0 while key < 10: if letter.upper() in phone_letters[key]: return key else: […]

Categories
Development

Pad within grouped dates in R

library(tidyverse) library(lubridate) library(padr) df <- tibble(`Action Item ID` = c(“ABC”, “DEF”, “GHI”, “JKL”, “MNO”, “PQR”), `Date Created` = as.Date(c(“2019-01-01”, “2019-01-01”, “2019-06-01”, “2019-06-01”, “2019-08-01”, “2019-08-01”)), `Date Closed` = as.Date(c(“2019-01-15”, “2019-05-31”, “2019-06-15”, “2019-07-05”, “2019-08-15”, NA)), `Current Status` = c(rep(“Closed”, 5), “Open”)) %>% pivot_longer(-c(`Action Item ID`, `Current Status`), names_to = “Type”, values_to = “Date”) #> # A tibble: […]

Categories
Development

How to search a comma separated DB column in Oracle

I have an Oracle DB table with one column that contains comma-separated values (not my design!). In a web application when user attempts to add an object that results in making a new entry into this table, I am trying to check for duplicates. I know how to check for single value (e.g. trying to […]

Categories
Development

Return all possible combinations of X elements in a given array

I’ve got a question about safing and returning all possible combinations of a char**. The algorithm only swaps elements if necessary. How can I handle it to safe all elements in a new char**. I would be grateful for any hints if it can be solved with a simple algorithm. I can save Abc Def […]

Categories
Development

Creating relationship between two nodes using intermediate table

I’m very new to the Neo4j world so please forgive me if this is a trivial question. I have 2 tables I’ve loaded into the database using LOAD CSV artists: artist_name,artist_id “Bob”,”abc” “Jack”,”def” “James”,”ghi” “Someone”,”jkl” “John”,”mno” agency_list: “Agency” “A” “B” “C” “D” Finally, I have an intermediary table that has the artist and the agencies […]