[Solved] How to extract JSON values that does not have attribute names?

Analysis XPath can’t read unnamed attributes. It will always result in an exception. If you want to get the values, you need to use JsonPath. Solution Even then, it makes sense to add surrounding brackets, otherwise the first level will be consumed as well: [ { “A1”:{ “name”:”Ad hoc”, “projectId”:0 }, “X2”:{ “name”:”BBB”, “projectId”:101 }, … Read more

[Solved] If a cell contains mulitple instances of specific text, then extract top 3 of the specified text found in the cell

google-spreadsheet solution: ‘for a CSV of all matches =arrayformula(TEXTJOIN(“, “, TRUE, IF(ISNUMBER(SEARCH(E2:E8, A2)), E2:E8, “”))) ‘for a CSV of the first three matches =replace(arrayformula(TEXTJOIN(“, “, TRUE, IF(isnumber(search(E3:E9, A3)), E3:E9, “”))), find(“|”, substitute(arrayformula(TEXTJOIN(“, “, TRUE, IF(isnumber(search(E3:E9, A3)), E3:E9, “”))), “,”, “|”, 3)&”|||”), len(A3), “”) excel-2016textjoin solution: ‘for a CSV of all matches input as array formula … Read more

[Solved] java converting date in string format to timestamp

String str = “Fri Mar 1, 2013 4:30 PM”; SimpleDateFormat sdf1 = new SimpleDateFormat(“EEE MMM dd, yyyy hh:mm a”); Date date = sdf1.parse(str); System.out.println(“Date Object:” + date); SimpleDateFormat sdf2 = new SimpleDateFormat(“yyyy-MM-dd HH:mm a”); System.out.println(“Formatted Date:” + sdf2.format(date)); Output: Date Object: Fri Mar 01 16:30:00 EST 2013 Formatted Date: 2013-03-01 16:30 PM solved java converting … Read more

[Solved] Count total lines with open in Python

You are increasing your total line count incrementally with each processed line. Read in the full file into a list, then process the list. While processing the list, increase a counter thats “the current lines nr” and pass it to the output function as well. The len() of your list is the total line count … Read more

[Solved] Combine multiple paired data frames from two lists

Given the explanation of your problem, the following may work: # get all overlapping names bindNames <- intersect(names(ww), names(dd03)) # get a list of rbinded data.frames, keeping unique observations newList <- lapply(bindNames, function(i) unique(rbind(ww[[i]], dd03[[i]]))) If at this point, you want to append all of your data.frames into a single data.frame, you can once again … Read more

[Solved] How do i write a function to insert into database

Instead of putting $i in each of the names, give them array-style names like name=”bill[]” and name=”vendor[]”. Then $_POST[‘bill’] and $_POST[‘vendor’] will be arrays, and you can loop through them: $stmt = $conn->prepare(“INSERT INTO yourTable (bill, vendor, detail, quantity, remark) VALUES (?, ?, ?, ?, ?)”);; $stmt->bind_param(“sssis”, $bill, $vendor, $detail, $quantity, $remark); foreach ($_POST[‘bill’] as … Read more

[Solved] how to get `jQuery` as a function (not as a Module symbol) after ES6 style `import * as jQuery from “./js/jquery.js”;`

This: <script type=”module”> import “./js/jquery.js”; window.console.log(window.$); </script> creates jQuery on window as “side effect”. JQuery code ( function( global, factory ) { “use strict”; if (typeof module === “object” && typeof module.exports === “object”) { // … } else { // we are there when loading as ES6 native module factory( global ); } } … Read more

[Solved] Perform DELETE request to Github API in PHP

You can use cURL with its CURLOPT_CUSTOMREQUEST to perform a DELETE request. The result would look a bit like the following (untested!) code: $curl = curl_init($apiUrl . ‘/user/following/:username’); curl_setopt($curl, CURLOPT_CUSTOMREQUEST, “DELETE”); $result = curl_exec($curl); solved Perform DELETE request to Github API in PHP

[Solved] Decryption method for two keys

All I needed to do was fix my getKey method. The changes below are what I did: public int getKey(String s){ int [] arr=countLetters(s); int maxDex=indexOfMax(arr); int key; if (maxDex<4) key= maxDex-4+26; else key=maxDex-4; return key; } solved Decryption method for two keys

[Solved] How to create a Class inside of a namespace?

classname.h #include <iostream> namespace N { class classname { public: void classmethod(); } } classname.cpp #include “classname.h” namespace N { void classname::classmethod() { std::cout << “classmethod” << std::endl; } } main.cpp #include “classname.h” int main() { N::classname a; classname b; // Error! a.classmethod(); return 0; } solved How to create a Class inside of a … Read more