Categories
Linux Mastering Development

Editing a file based on a pattern appearance

I have a file that contains text and numbers like this: state(1, s(1,a), [s(1,b)]). state(1, s(1,b), [s(1,a)]). state(1, s(2,a), [s(2,b)]). state(1, s(2,b), [s(2,a)]). state(1, s(3,a), [s(3,b)]). state(1, s(3,b), [s(3,a)]). state(1, s(4,a), [t(1), t(2)]). state(1, s(5,a), [t(1), t(3)]). state(1, s(6,a), [s(6,b)]). state(1, s(6,b), [s(6,a)]). …so on I want the numbering with in s(x,y) to change as […]

Categories
Mastering Development

String comparison in Databricks Spark SQL

select distinct promo_name ,case when substring(promo_name,instr(promo_name, "P0"),2) = "P0" then 0 when substring(promo_name,instr(promo_name, "P1"),2) = "P1" then 1 When substring(promo_name,instr(promo_name, "P01"),3) = "P01" then 1 when substring(promo_name,instr(promo_name, "P2"),2) = "P2" then 2 When substring(promo_name,instr(promo_name, "P02"),3) = "P02" then 2 when substring(promo_name,instr(promo_name, "P3"),2) = "P3" then 3 when substring(promo_name,instr(promo_name, "P03"),3) = "P03" then 3 when substring(promo_name,instr(promo_name, […]

Categories
Mastering Development

R conditional loop to replace vallues

I am looking to conditionally replace values in a column and I think a loop is what I need. Though I know on a basic level how loops work, I have little experience using them so I struggle with wrapping my head around the order of operations. Using the dataframe df <- structure(list(player = c(“p1”, […]

Categories
CMS Drupal Mastering Development

Set ‘And/Or’ conditions for view filter criteria – Drupal 8

I have a view with bunch of filter criteria. Of those, I have zip code and miles fields. I am writig the below query to add a where clause to my view query: function mymodule_views_query_alter(\Drupal\views\ViewExecutable $view, \Drupal\views\Plugin\views\query\QueryPluginBase $query) { //If my view is program-search and the Miles field is not empty and not ‘Any’ and […]

Categories
CMS Drupal Mastering Development

Set ‘And/Or’ conditions for view filter criteria – Drupal 8

I have a view with bunch of filter criteria. Of those, I have zip code and miles fields. I am writig the below query to add a where clause to my view query: function mymodule_views_query_alter(\Drupal\views\ViewExecutable $view, \Drupal\views\Plugin\views\query\QueryPluginBase $query) { //If my view is program-search and the Miles field is not empty and not ‘Any’ and […]

Categories
CMS Drupal Mastering Development

Set ‘And/Or’ conditions for view filter criteria – Drupal 8

I have a view with bunch of filter criteria. Of those, I have zip code and miles fields. I am writig the below query to add a where clause to my view query: function mymodule_views_query_alter(\Drupal\views\ViewExecutable $view, \Drupal\views\Plugin\views\query\QueryPluginBase $query) { //If my view is program-search and the Miles field is not empty and not ‘Any’ and […]

Categories
Mastering Development

Replace underscore with white spaces and make the first letter of the name and the surname to upper case

i want to replace _ (underscore) with white spaces and make the first letter of the name and the surname to upper case while printing the nameList in searchKeyword method. #include <stdio.h> #include <stdlib.h> #include <string.h> void searchKeyword(const char * nameList[], int n, const char keyword[]) { int i,name=0; char *str; const char s[2] = […]

Categories
Development

Time difference in execution of MySQL joins

I had a queries in which there was left joins were used and it was taking 30 seconds to complete the execution and return the dataset on mysql terminal. But when I have changed it to join its execution time has been reduced significantly from 30 to 12 seconds. I know this is too much […]

Categories
Development

Why is Entity Framework Core attempting to insert records into one of the tables from many to many relationships and NOT the join table?

Given the following set up where there are many Teams and there are many LeagueSessions. Each Team belongs to zero or more LeagueSessions but only ever one LeagueSession is active. LeagueSessions have many teams, and the teams will be repeated. Many-to-many relationship is established between Teams and LeagueSessions with a join table called TeamsSessions. Team […]

Categories
Development

doesn’t compile code with Include AzureIoThub.h on esp8266 device

I’m trying to connect my esp8266 device to azure IOT hub, and from my understanding the way to go is to use the official AzureIoThub library (as distributed on library manager) but somewhy any code with this included library doesn’t compile. I get the following errors upon including the library. Arduino: 1.8.9 (Windows Store 1.8.21.0) […]