Categories
CMS Drupal Mastering Development

How do you shoot a specific type of content?

I have the content type (node), article, page, recipe. The code above can be used to flag any type of content. How do you shoot a specific type of content ? For example I only want to flag the article and recipe content type. <?php /** * @file * Holds hook implementation for the Admin […]

Categories
Mastering Development Software

What would be the downsides of distributing a desktop application with an embedded web server?

This is an architectural question pertaining to distributing desktop applications on Windows, Mac and/or Linux – not looking for software/framework recommendations. Much has been written on the various advantages/disadvantages of Single Page Applications (SPA – React, Vue, Svelte, etc…) vs Server Side Rendering (SSR – Ruby on Rails with TurboLinks, Django, Node, Elixir/Phoenix etc…) approaches. […]

Categories
Mastering Development

apoc.path.subgraphAll – How to Set Blacklist and Return Only Wanted Nodes & Relationships

Further to apoc.path.subgraphAll Doesn't Return a Graph I’m trying to return a sequence of paths using: MATCH (av:Architecture_View {`view identifier`:’SV-01′})-[:`HAS PART`]->(av_child:Architecture_View),(excludedNode:Node:TRAK) WHERE excludedNode.name IN [‘Software’,’Role’,’Physical’,’Organisation’,’Job’] //pattern is (Architecture_View)-[:SUPPLIES]->(Node)-[:`SUPPLIED TO`]->(Architecture_View) CALL apoc.path.subgraphAll(av,{ beginSequenceAtStart: true, sequence: "Architecture_View,SUPPLIES>,Node,`SUPPLIED TO`>,Architecture_View", blackListNodes:[excludedNode] }) YIELD nodes, relationships RETURN nodes, relationships; The problem with this is that:- the blacklist specified in blackListNodes:[excludedNode] […]

Categories
Mastering Development

Issue with installing node application as a service using innosetup and node-windows script

The service installs but will not start, either straight away or after system reboot, when running the following script from innosetup: #define …. #define NODE "node-v12.16.2-x64.msi" … … [Files] … [Run] Filename: "{sys}\msiexec.exe"; Parameters: "/passive /i ""{app}\{#NODE}"""; Filename: "{sys}\netsh.exe"; Parameters: "advfirewall firewall add rule name=""Node In"" program=""{pf64}\nodejs\node.exe"" dir=in action=allow enable=yes"; Flags: runhidden; Filename: "{sys}\netsh.exe"; Parameters: […]

Categories
Mastering Development System & Network

disk I/O latency spikes (contains log files from amplify)

Ubuntu 18.04 LTS server, disk is ssd. Application stack is: mongodb, node, nignx and some python. Server is up 1 month and already had 3 OS disk fails where Ubuntu would go in read only mode. After restart in boot mode it would show invalid checksum recovering blocks. It would be resolved with fsck command. […]

Categories
Mastering Development

Issue trying to setup jest: application code compiles fine but test code doesn’t

I am trying to migrate to jest and I am facing typescript issues… I have 3 tsconfig files: tsconfig.json (base config) tsconfig.lib.json (application config) tsconfig.jest-spec.json (jest-dedicated test config) Please note that there are also karma/jasmine dedicated tsconfig files but those are irrelevant. I have separated the jest tests from the karma ones. tsconfig.json { "compileOnSave": […]

Categories
Mastering Development

Kth Ancestor of a Tree Node Challenge

The challenge is as follows: You are given a tree with n nodes numbered from 0 to n-1 in the form of a parent array where parent[i] is the parent of node i. The root of the tree is node 0. Implement the function getKthAncestor(int node, int k) to return the k-th ancestor of the […]

Categories
Mastering Development

Gatsby keeps complaining Cannot query field “fields” on type “MarkdownRemark” when I have allMarkdownRemark

I am trying to configure my Gatsby project like this starter https://github.com/gatsbyjs/gatsby-starter-blog In my gatsby-node.js I have const path = require(`path`) const { createFilePath } = require(`gatsby-source-filesystem`) exports.createPages = ({ graphql, actions }) => { const { createPage } = actions const blogPost = path.resolve(`./src/templates/blog-post.js`) return graphql( ` { allMarkdownRemark( sort: { fields: [frontmatter___date], order: […]

Categories
Mastering Development

React Native: Cannot run program “node” error=2, No such file or directory

I’m trying to build my react native app from Android Studio but it failed with showing this error: Gradle Daemon started in 5 s 410 ms :ReactNative:Running ‘[node, -e, console.log(require(‘react-native/cli’).bin);]’ command failed. FAILURE: Build failed with an exception. * Where: Script ‘/Users/ghadeer/LastRoomatyINSALH/node_modules/@react-native-community/cli-platform-android/native_modules.gradle’ line: 179 * What went wrong: A problem occurred evaluating script. > Cannot […]

Categories
Mastering Development

Text document to JSON data Using JavaScript

How to convert the text document data to JSON, I have a text file that should be parsed to JSON data. I had attached the data present in a text document below, the data in the text contains many blank spaces. How to construct a proper JSON… Text document data Name: Test123 Date: 09/05/2019 Gender: […]