Categories
Development

How to convert the object which contains multiple array into an array of objects in javascript?

Below object should be converted into an array of object. This is just a random problem statement. How to convert this to an array of objects? Please help. // input objects={ 0:[1,2,3], 1:[“a”,”b”,”c”], 2:[“i”,”ii”,”iii”] } //expected output objects2=[ {0:1,1:”a”,2:”i”}, {0:2,1:”b”,2:”ii”}, {0:3,1:”c”,2:”iii”} ] Below code gives me only last entry mean [3,”c”,”iii”] //tried solution var res=[] […]

Categories
CMS Development Wordpress

How WP archive with custom field filter (ACF) not working

I’m using Advanced Custom Fields and have been following along with this tutorial on Creating a WP archive with Custom Field Filter I have Field name: check Field type: check Choices: 1:a , 1:b , 1:c. my function: $GLOBALS[‘my_query_filters’] = array( ‘check’ => ‘check’, ); // action add_action(‘pre_get_posts’, ‘my_pre_get_posts’, 10, 1); function my_pre_get_posts( $query ) […]

Categories
Development

Umarshalling JSON results in empty struct [duplicate]

This question already has an answer here: json.Unmarshal returning blank structure 1 answer Why struct fields are showing empty? 1 answer I have the following JSON structure: dataJson := `{“data1” : [[“a”,1][“b”,2]], “data2”: [“a”,”b”,3]}` And want to unmarshal it with Go. I am trying the following code: type myData struct { row map[string][][]interface{} `json:”data1″` column […]

Categories
Development

umarshel json with golang

I have the following json structure dataJson := `{“data1” : [[“a”,1][“b”,2]], “data2”: [“a”,”b”,3]}` and want to unmarshel it with golang , I am trying the following code type myData struct { row map[string][][]interface{} `json:”data1″` column map[string][]interface{} `json:”data2″` } var arr myDaya _ = json.Unmarshal([]byte(dataJson), &arr) log.Printf(“Unmarshaled: %v”, arr) but I get empty data Unmarshaled: {map[] […]

Categories
Development

Computation failed in `stat_alluvium()`: Each row of output must be identified by a unique combination of keys

I have a data.frame that was built with a collection of Tidyverse tools, mostly dplyr stuff with piping. The data looks formatted correctly for the geom_flow() examples that you can find for ggalluvial. My dataset undergoes a pile of iterations after its imported from an MSSQL database and is around 300k rows. So I created […]

Categories
Development

Dynamically sorting an ObservableCollection

I have an Observable Collection of about 5,000 objects returning from a SQL query to my WCF service. I have been asked to sort the collection by 3 fields in the object. For brevity, lets say this is my c# model: public class TestObject{ public string type1{get; set;} public string type2{get; set;} public string type3(get; […]

Categories
Development

R mtext/lines “plot.new has not been called yet” in markdown

I am trying to create a markdown for simple R functions for a course I am taking and to be able to reuse later. Only problem is when I copy my R code from various courses into the markdown, I get an error message. My original code A<-seq(1,10,1) B<-rnorm(10,15,1.5) C<-rnorm(10,25,1.5) df<-cbind(A,B,C) plot(A~B,df, type=”l”) mtext(“example”,side=3, line=1) […]

Categories
Development

How to use a formula in VBA

make formula work in VBA “=IF(LEFT(VLOOKUP(J2,A:H,8,FALSE),1)=B,S,B)”

Categories
Development SQL

SQL feasibility: possible to extrude rows by value and combine tables in custom fashion?

Suppose I have the following sql table: // foo // columns ID DATE SIZE LIFETIME Where foo represents the size and date when the object was deleted from the drive. Suppose I have a second table, // bar ID DATE SIZE Where bar is just a table with, for each day the particular object was […]

Categories
Development

why does my loop stop at 3, and reports an incorrect order

I’m working on a program that uses bubble sort in order to sort a defined array in descending order. My code seems to loop 3 times, creating an incorrect result as well too, before stopping. This is in HCS12 assembly language. RAMStart EQU $0800 ROMStart EQU $4000 N EQU 8 ; absolute address to place […]