instruction
stringlengths
71
95.1k
I'm trying to display the fetched data on a table. I structured the data based on the columns table in the UI and stored them in an array, then *ngFor on the table rows on the frontend. Good or bad practice? Or are there other ways to do this in a much simpler way? getLicensesofDealer(id) { this._license.ge...
I was writing a little coding kata, and wanted to have a hook which managed a list of names. The hook should allow adding a name to the list, and also make the list available to the component. I didn't want to bring in a state management library, or complicate the code with having to useDispatch or anything like that. ...
I am experimenting with the best way to standardise my dynamic import() expressions when importing javascript modules. import() returns a promise, so, to handle the asynchronous steps after theimport() expression, I can use either: .then() syntax; or async / await syntax Whilst I am quite familiar with the older XHR2...
I have the below code that takes the sql data and exports it to xml or csv. The xml is processing at good speed but my csv sometimes takes 1 hour depending on how many data rows it exports. My question is my code effective writing the csv or it can be improved for speed? Has around 40 columns and x rows which can be ov...
public class EmployeeDBHandler { public List<Employee> GetEmployees() { List<Employee> empList = new List<Employee>(); string sqlConnstr = Utils.GetDBConnection(); SqlConnection sqlConn = new SqlConnection(sqlConnstr); SqlCommand sqlCmd = new SqlComma...
I'm trying to compile stats for college basketball games. I have two inputs: regular_season_boxscore_df: A DataFrame consiststing of regular season boxscores. It looks like this: print(regular_season_boxscore_df.head()) Season DayNum WTeamID WScore LTeamID ... LAst LTO LStl LBlk LPF 0 2003 10 11...
I am working to a python application for some operational test on a Arista brand Network (more info here: https://gitlab.com/networkAutomation/pyateos) I am the only one doing coding in my team so I do not have much chance to compare myself with someone really knowledgeable that can suggest me a better way to do coding...
I have a code to get most similar element in an array of categories of jobs to another job using Google's Universal Sentence Encoder. #@title Setup common imports and functions import numpy as np import pandas as pd import tensorflow.compat.v2 as tf import tensorflow_hub as hub from tensorflow_text import Sentencepiec...
I implemented a simple producer-consumer where producer produces links to fetch and several workers consume those URLs and return write data into response queue. Unfortunately, sometimes API can start responding 400-x errors and in that case we need to sleep each for some time. I have implemented it using a queue where...
Lets say I have one method, which extracts property name and value: public TModel Get (Expression<Func<object>> param) { using (OracleConnection connection = new OracleConnection(GetConnectionString())) { connection.Open(); var propertyName= ((MemberExpression)param.Body).Member...
I need to transfer data from one vendor's system to another. The source vendor has a view that generates data that combines invoice and line-item data into records w/ line-item cardinality: "Invoice","Date","Line","Description","Price" "A","2/1/2020","1","something","100" "A","2/1/2020","2","something else","75" "B","1...
I know that if you are using too many if else statements there is a better way, I hope. Please help me learn, thank you everyone. I tried to think of a better way but just couldnt come up with anything better than this. data is coming from back end as rows from mysql i.e array of objects <template> <div class="col-xs...
I haven't been programming for a while, I wanted to do a simple project to warm myself up and get back into the game; I made this simple tool that finds the probabilities of coin toss combinations. Enter a number to get all combinations with that many flips, or enter a string to search for that combination, i.e. H**H w...
We scan the string from left to right finding the unique characters. We also need to find the non unique characters and count them on how many times they appear. If we can’t find any unique characters, then we return an empty list. Here’s the code: def unique_occ(the_str): res1 = list(the_str) unique_letter = ...
I'm a beginner at C++; all my previous programming experience is mainly through PLCs in industrial maintenance. I have to accept 10 integers and a target value, then print all the pairs that sum to the target. The pairs cannot be of the same integer. For example, if the target value is 10 then we cannot have a pair of...
I'm trying to make a password program that you can login to or make a new user. I want to make this better, so any help would be appreciated, also any suggestions to make this better would be good import time LOGIN = ("Login", "login", "L", "l", "LOGIN") CREATE = ("Create", "create", "C", "c", "CREATE", "Create Acc...
I was given that assignment recently as part of a coding interview. The idea is to find if a gtin is valid or not valid. The requirements are the following: make sure the input is in a string format the length must be either 8,12,13,14,17 or 18 The algorithm is the following: TL;DR: You need to multiply all odd posi...
Context The main goal located a configuration NavigationService and NavigationView in one place. In order to minimalization a consequence in case adding, modifying or removing of NavigationItem. I would like to get some feedback about advantages and disadvantages of the my implementation. We have a Page with Navigation...
I have created this first-timer implementation of Merge Sort and I got confused by the C++ syntax once or twice. So I have some questions about this code: #include <iostream> #include <thread> #include <cstdlib> #include <vector> #define NUM 1048576*2 int sort(std::vector<int>* vec); void run(std::vector<int>* vec, i...
It takes in a string from the command line. prints out the length of the string. I'm mostly looking for tips and general convention suggestions But I'm open to any other criticism also. Roast it please thanks. global _start extern printf section .data arg_err db `Invalid Arg Length\n\0` len_arg_err equ $ ...
I need to run a evaluation for large (1 Million) number of components and build a string with error which has comma separated error codes. As the final string is to be persisted in RDBMS TABLE.COLUMN with MAX length for 255, I need to truncate the string (not abruptly) and append an ellipses to indicate there were more...
Today I have attempted a Codility exercise "Fish" (https://app.codility.com/programmers/lessons/7-stacks_and_queues/fish/), and I have to say I found it to be: 1) Not necessarily "easy" as implied by the page, AND 2) Quite satisfying to figure out in the end. Below the text of the challenge: You are given two non-empt...
Recently got this coding assignment as the first round of interview at a tech organization. I could get the expected result, however, my code failed the best practices check. Please let me know if it needs a different approach or specific things are missing. I was confused about how to add tests since this will fetch r...
I am doing a Pandas project on alcohol consumption. For your information, the dataset has the following columns: | Continent | Country | Beer | Spirit | Wine | The following is my code: # Separating data by continent # ---------------------------- data_asia = data[data['Continent'] == 'Asia'] data_africa = data[data[...
Background I crated a CLI tool which executes an npm command (to create a react app) and modifies the contents of the generated files. It was a practice attempt at creating CLI tools for NodeJS and a chance for me to experience publishing NPM packages. What I set out to do My plan was to create something which follows ...
In an interview I was asked to solve two JavaScript questions. I thought I did pretty well because I: Covered the edge cases Wrote comprehensive tests Documented the code using jsdoc The interviewer responded with this exact feedback: Overly Complex Solution, Strange Coding Conventions, Poorly Structured, Hard to ...
this is my code to implement DFS with recursion but no stack. I ran few test cases which turned out to be positive but wanted to check the efficiency of the code. graph = {'A': set(['B', 'C']), 'B': set(['A', 'D', 'E']), 'C': set(['A', 'E']), 'D': set(['B', 'F']), 'E': set(['C', 'B'...
Just for fun and practice purpose, I have written a short program in C# console with few classes which will create 30 seats for a cinema during program initialization with these options. Print all seats Seed 20 random taken seats Print all empty seats Print all taken seats I think my algorithm for generate 20 random ...
I just implemented a version of A* search in JavaScript for educational purposes. I'd really love it if you could take a look and tell me how to improve my code. The grid passed in is just a multidimensional array (2-D array) where each slot in the inner array is an object with property weight. The point of this functi...
I am new to Haskell and currently trying to port my solutions for the 2019 installment of the coding challenge AdventOfCode to Haskell. So, I would very much appreciate any suggestions how to make the code more readable and more idiomatic. In particular, I am interested in whether my use of the State monad is sensible ...
I have two lists: Users - [<UserObject1>, <UserObject2>, ...] Contributions - [<ContributionObject1>, <ContributionObject2>, ...] Every ContributionObject further can have single or multiple UserObject in it which are mentioned as person_links here and both the objects that are ContributionObject and UserObject has c...
This function takes a list, deletes every occurrence of the number 13 and deletes the number present after 13 in every instance and then prints the sum of the list. How can I shorten it? def average(nums): thirteen_idx = [] bad_idx = [] final_list = [] num_length = len(nums)-1 #list of indexes where 13 res...
I have some legacy code which gets a list of Students and their corresponding School. It's LinqToSql and there is no lazy loading: public class Student { public string FirstName { get; set; } public string LastName { get; set; } public School AttendedSchool { get; set; } public Student(int studentId) {...
02/02/2020 is a palindrome day because reading the date left-to-right or right-to-left still refers to the same calendar date. And because it doesn't matter whether you use the DD/MM/YYYY format or the MM.DD.YYYY format, it's called a Universal Palindrome Day. No one year can have more than 1 palindrome day. This is ...
I'm trying to calculate with SUMIFS and COUNTIFS some data. The output sheet looks like this: I've hidden some irrelevant or sensitive data to make it easy to go to the point. My code runs an array on this worksheet and calculates per each day and user some KPIs I need from this worksheet: The calculation is pretty s...
I have a simple application that reads a couple of csv files and outputs the input into catalogues for the website. However, users have a habit of opening the csv files and inserting extra columns etc and it causes obvious issues, I have tried to tell people not mess with the files with no success, so i thought i woul...
The intention is to transcribe .docx files to have modified font and font sizes while keeping the run attributes such as bold, underline, italic etc. I'll then add some headers and graphics to the newly created target.docx files How to reconstruct paragraphs from runs? Each one, currently, gets it's own separate line! ...
This is not a traditional maze where you find the shortest path (like the gif on the left). In order to solve it, you need to visit every available node before reaching the end, where once a node is visited it turns into a wall (like the gif on the right).       My current solution works quickly for smaller mazes or ...
I recently downloaded an app called "SoloLearn" to improve my coding skills as I am a beginner with Java while I am not at home. Today I solved the following challenge: Everything worked but I have a feeling that there is a much easier way to get it done. Here is my code: import java.util.ArrayList; import java.util.S...
There is a popular game called 4 Pics 1 Word that presents to the user 4 pictures representing a common word. The word has to be typed by selecting some of the 9 random letters appearing below the images. The German version of this app has an annoying bug. When the random letters contain a letter from the set ÄÖÜß, it ...
I am trying to XOR two files each 1Mb which contains only 0 and 1. It works, but I think it is very slow for the C++ program - approximately 4 sec. Could someone, please, suggest the fastest XOR method on large files or at least tell what you think about XORing 1MB files running time? May 0.5sec or 1sec? or even less.....
I am looking to optimize one function that returns error messages to the user. /// <summary> /// Handles the Ouverture event of the PrescriptionVue control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance contai...
I coded a function that takes an array with numbers and randomly chooses one of these numbers (Returns the index of the chosen one). The value of each number works as an weight which determines the probability to that number be chosen. E.G.: A possible input for the function could be [1.5, 3.5, 2.0, 1.3] and the respec...
I am new to community and please pardon me if I didn't provide information as intended. This code is supposed to be creating a custom model which will be used with lmfit for curve fitting purposes. hc(q,radius,pd) is the function. It is one of the simplest functions that I will be using but even this function is taking...
First I'm not sure what this is called formally but whatever. Basically I need to form "wildcard buckets". I think the best way to explain what I need to do is to take an example. For instance, say I have the three words "aaa", "aab", and "baa". Let me use * as the wildcard. Then from aaa I can form -aa, a-a, aa-, --a,...
From the last few days I have been studying scraping webpages and for further development I challenge myself to transform the script I have created into a class which will receive inputs from a user. The main reason I'm posting this is because I would like advice and insights on how should I approach and manipulate ins...
This is a simple GUI to display employee data stored in the database, with editing options that sync with the database and adjust display according to mouse clicks/ keyboard scrolling/add/delete ... and please do not mind pictures of dogs, I thought they might look cooler for the sake of demonstration. Awaiting your fe...
As part of learning Vue and Vue Test Utils I develop some simple games. I made a simple version of craps. Because in many other games a die (or dice) is used, I decided to create a reusable component GameDie. GameDie.vue <template> <span class="dice">{{ dice.icon }}</span> </template> <script> export default { nam...
const getSelectedItemsIds = selectedItemsList => { let keys = Object.keys(selectedItemsList); let selectedItems = []; keys.map(k => { selectedItemsList[k].map(id => { if (k.includes("projectIds")) { return selectedItems.push({ type: "PROJECT", id }); } else if (k.includes("subjectGroupId...
I will be inserting a new text line in a setup.py file, this new line will contain text, and is part of the REQUIRED_PACKAGES. I parsed the file and look for REQUIRED_PACKAGES pattern (REQUIRED_PACKAGES = [ ... ]). Looking for alternatives during file insertion. A sample setup.py file looks like this: from __future__ ...
Basically I have written a matrix class for addition, multiplication and scalar multiplication. I need your review of the class implementation below in terms of efficiency, memory consumption and new C++11/14/17 features that can be used. Here goes the code: Matrix.hpp // Created by prajwal.sapare on 2/18/2020. // #...
if ($v->getMedical()) { $visitorHasMedical = $v->getMedical()->getMedCon() == true; // $visitorHasMedical will be false if "falsey" i.e. empty string or NULL } else { $visitorHasMedical = false; } Where getMedical() is a OneToOne Doctrine relationship that might not exist. Does this snippet read OK? Firstly, I...
I created this function it is looking for the html tag and replacing it with the ^value. It seems complicated wanted to know if there is a better way to do something like this. Will you review the syntax, structure, and logic of my code. It can be tested using the main. Output dsfsadfsad 5<sup>8</sup> dsfsadfsad ds...
I am currently coding a tool for my work that modifies a textfile by removing unneeded parts of a string at specific spots in the file. I would like to know if there are any obvious things I am missing or doing too complicated. I know that some of the comments are considered too long for PEP8. class vis_file_tools: ...
I'm looking to improve my code writing in general by peer review. I've followed the following exercise: https://edabit.com/challenge/dLnZLi8FjaK6qKcvv. The exercise is to create an English version Shiritori Game. You can find an explanation by following the link but I'm going to explain below anyway. The game is a word...
Team, I have a working script but when we upgraded some drivers on the GPU system it’s starting to cause zombie process and system is lowing down as script runs periodically as a crib job. so I am trying to see is there a way I can have a graceful clean up after the Scripts run what is the best procedure to clean up ...
let date= new Date() let day = date.getDay() let weekday = new Array(7); weekday[0] = "Sunday"; weekday[1] = "Monday"; weekday[2] = "Tuesday"; weekday[3] = "Wednesday"; weekday[4] = "Thursday"; weekday[5] = "Friday"; weekday[6] = "Saturday"; changeText = () => { if(day === 1){ firstD...
I have two python libraries, let's call them lib and extended_lib, that provide a very similar public API. To be more specific, extended_lib enriches the API of lib with new features and functionality; it also modifies the behavior of some functions that are also provided in lib (e.g. get_version()). I have a pair of c...
I made a formula retriever that works and allows importing of fractions. This python code is meant for the fx-cg50 calculator's micropython, where there are a lot of functions that don't work including fractions, some mathematical functions such as math.gcd and math.isclose. So I really require some advice or coding t...
I have a weather app that allows the user to save Cities (with nickname and zip) into a room database. I'm using mvvm and livedata to observe the list of cities and update the recyclerview accordingly. I then perform an API call for each item in the recyclerview, which to me seems wrong. It works but seems wrong. I'd...
I asked this question on Stackoverflow, but thought it might be a better fit here. I'm playing around with the titanic dataset, and wanted to create a custom imputer to fill in missing age values with predictions from a LinearRegression model. Please find the code below: import seaborn as sns import pandas as pd from...
I want inputs on how I can square the sorted Array more efficiently in haskell. I wrote a very naive algorithm to solve the problem. What I am doing is comparing the head and the last element of list on absolute value and whichever is max I square the element and add it to accumulator. But I think it is very slow. Is t...
I am beginning to learn about object oriented programming in my programming class, and to make sure I had all the ideas down, I made a small palindrome checker program. It works by checking if the letter on the opposite side is the same. from time import sleep # To add readability delays class PalindromeFinder: ...
I'm new to Haskell, so I wrote a program to crack Caesar Ciphered text for practice. The program calculates the frequency of each letter in the input, and then checks to see which shift minimizes the Euclidean norm of the element-wise difference between the text's frequencies and pre-measured frequencies in the English...
I've been practicing my folds and tail-call recursive programming, and I wanted to work on unzip for the general case as opposed to just pairs. This was very easy to do with standard tail call recursion. However, I was also told that any time you can use tail call recursion on a list, you could also use a fold. I was e...
I have a javascript function that will accept an array of objects (from a database or websocket) and then spit out HTML <ul> lists. The code works -- but I am "self-taught" and always learning. I want to be producing professional looking/behaving code. I will be graduating from university, but job prospects in my field...
I wanted to ask this here because what I wanted to originally do felt like a really Pythonic method. I want to be able to use the syntax: d = {'apple':{'cranberry':{'banana':{'chocolate':[1,2,3,4,5,6]}}},'b':2} with d['apple']['cranberry']['banana']['chocolate'] as item: for i in item: print(i) item.ap...
Intrigued by the events chronicled here (also here and here), I saw the inherent utility in having a program-specific GUID available. The SO answers that were correct seemed a bit tightly-coupled and verbose. So I set out to make my own for use. Looking for a critique on the idea itself as well as maintainability, perf...
The program was to turn an integer into exact change and uses a bunch of if statements. Are there steps a beginner like me can do to remove some or is it just how it will be? I can't find anything on it. At least I'm not sure as I'm still in the basic course. The program is turned in and was fine and this would be fo...
This was part of a code challenge. I use them to help me learn c++/c# along with tutorials and guides. Basically I was taking a string... The quick brown fox jumps over the lazy dog. ...and reversing the words in the string like this. ehT kciuq nworb xof spmuj revo eht yzal .god The following code works and compi...
So I needed to represent by objects in terms in ini format and change their values from the ini as well, so I thought why don't implement a property system for this. I want it to be bit fast so I would really like if anyone can remove the std::function if possible but its not necessary. The target application is GUI so...
id: "1" email: "TEST@TREST.COM" selection1: "2" race1: "1" selection2: "4" race2: "1" selection3: "3" race3: "0" selection4: "2" race4: "0" selection5: "1" race5: "0" selection6: "1" race6: "0" selection7: "1" race7: "0" This is 1 on the objects in the Json array. so if race1=1 the class .race1 innerhtml = the ema...
I want to achieve different animation for many elements on scroll, so instead of using window.scroll i'm using intersection observer api, but i want to know if my approach is effective and won't cause performance drop, basically what i did is make a single function to hold the entire animation of the website and check ...
My code as a whole works for me without issues, but what I want to improve is a small part right out of the middle of it. I hope it's ok to post a simplified snippet here that just shows the structure (it's not something you can copy paste and it works), but I'll try to explain what it is about. If this is against the ...
I would like to show the tree-like structure contained in a multi-dimensional tuple by using the set of graphical glyphs that exist in Unicode fonts (e.g. \u2500, \u2502, \u2514 and others). Here is an example of the kind of output, I'm talking about: >>> showtree('(01, (02, 03, 04), 05, ((06, 07), 08), (09, (10, 11),...
I have a file that i use as database. It has the records and in the row 1 several cells used as buttons, (open folder, copy text, send mail, ecc.) At any change on any column of any record the file register the time in one column in order to have the last change of that record. It also change the color of the row if th...
I am relatively new to C language and Linux systems I would like some feedback/review. The main function of the code is to read the dhcpcd file looking for the 3 lines and then either adding/removing to the new file. It works and the Pi can switch from AP to client without a reboot, but I feel like it is more of a hack...
This code is to have a dictionary of names and birthdays. It will ask who's birthday it is that you're looking for. Then if it is in the dictionary, it will print back what that birthday is. If not, it will ask if you want to add it then have you insert the birthday as the value and use the name that you input before a...
So I made a Python program to solve some of my A-level binomial questions or just to let me check my answer overall. I need advice on how to make it more compact and simplify it. This Python code is meant for the fx-cg50 calculator's micropython, where there are a lot of functions that don't work including fractions, s...
I wrote a Python script to generate a video file of typing the contents of any program file. It works, but I'm really not very happy with how it works. I have several issues with it. In order to generate the video file I had to generate an image for every character in the file. As you can imagine, this is extremely ti...
Introduction I'm working on a Statistics Library that can record observations and produce a Summary of the statistics when there's enough observations. Right now, it's at its early stages and is expected to change a lot as I develop it gradually. Minimal Example Suppose I want to record the run time of a particular pi...
I have a class that needs to provide access to an internal List<int> member. The functions that use this class need to be able to work with that list, mutating the contents and sorting/filtering the list etc, without changing the internal list in the class object. Having a method that provides a copy of the list instea...
The problem: I have some text that I go through line-by-line, if I find a line containing the keyword DATA_TYPE_1 and/or DATA_TYPE_2, I know all the following values are that data type. What I do right now is keep track of if the last keyword I saw was DATA_TYPE_1 or DATA_TYPE_2 (or in the case where I see both in the ...
I have two closely related questions: 1) I have a mixed PHP array. Not mixed in that it contains strings, floats, booleans etc. but mixed in that it is a hybrid indexed / associative array. Most of its entries look like they are from an indexed array while the very last entry looks like it's from an associative array: ...
I prepared a method to make possible to select elements of the array except for some indexes. def array_except(array, *indexes) indexes = indexes .flat_map { |e| e.is_a?(Range) ? e.to_a : e } .map { |e| e.negative? ? e + array.length : e } array.values_at(*((0...array.length).to_a - indexes)) end ...
I would appreciate feedback especially if you would be embarrassed by this code, or if I was on your team and you would expect better and/or you would mention something. This code was derived from comments made on Function To Add DOM Nodes (it also lead to new ideas that are unique to this post). If there are things th...
After watching this video by Tom Scott, I decided to make a program that follows that idea. This is what I came up with: # If a number is divisible by the key, add the value RULES = { 3: "Fizz", 5: "Buzz" } def is_divisible(num: int) -> list: output = [] for divider in RULES: if (num % divider...
Here is my solution for CodeAbbey - Blackjack Counting My code passes all tests on Code Abbey but I think I have some poor implementation specifically with my handling of the Aces in the score but otherwise I think I overall used good practices and design. def calculate_player_hand(player_hand_input): """Return th...
I'm still a beginner, so I'm still learning. I'm trying to take test scores for 3 different students, enter them in an array, then display the name, test scores and the average. Trying to also have reusable code for the average. I'm not even sure I'm going about it the right way. This is what I've got so far. It works,...
This has been done a thousand times on here already, but here's another binary heap implementation. The implementation is generic in terms of heap elements, allows for injection of any type of comparison strategy via the constructor, and has an extra internal lookup scheme to achieve element removal in O(log(n)) time. ...
I'm in need of a simple wrapper for a fixed-size std::vector that can ensure atomic insertion. Since my only real problem is with atomic insertion and I know beforehand the amount of entries it will have, I don't need any other parallelism related feature. I am happy to have the initial allocation (std::vector::resize)...
This is the function I've wrote to filter a two-dimension array. I use it mainly on forms with user-defined filter (categories, dates, search bar, etc). It works fine, but it's ugly. Do you have any advice? Function FilterArray(ByVal originalArray As Variant, _ Optional arrayOfColumnToReturn As V...
I'm new to Python, but have experience in a variety of other languages. I've learnt that a code review early on would make sure I don't start with bad habits. Which are more difficult to get out the longer you keep them. This is a Discord bot for one of my hobby projects. import os import random import discord from dis...
I am trying to make the following function as fast as possible on large matrices. The matrices can have dimensions in the range of 10K-100K. The matrix values are always between 0 and 1. The function resembles matrix multiplication, but with log operations in the inner loop. These log operations appear to be a bottlene...
I'm working with a ASP.NET Core (v2.2) Web Api project and implemented some APIs. However, I'm facing performance issues, hence trying to optimizing the code. Here is the login API code. [ValidateModel] [AllowAnonymous] [HttpPost("login")] public async Task<IActionResult> Login([FromBody]UserLoginDto loginDto) { va...
I want to create an object, that represents a progress output. In a GUI this would be a progress bar, in a console application it may be a text output, that can only be written, but not changed anymore (e.g. the progress bar cannot rewind). Other possible implementations could include sending a e-mail every 10% of pro...
I am very new to Rust. I have written a conjugate gradient algorithm function for CsMatrix structure from nalgebra fn conjugate_gradient(m: &CsMatrix<f64>, rhs: &DVector<f64>, tol: f64, max_iter: Option<u32>) -> DVector<f64> { let n_iters = max_iter.unwrap_or(1000); println!("Iters: {}", n_iters); let mut ...
function get_sql_string(dbConn,query_string,col_delim,row_delim) { var result = dbConn.executeCachedQuery( query_string ); var result_string = ''; var column_count = result.getMetaData().getColumnCount(); if ( col_delim ){ col_delim = col_delim; } else { col_delim = ','; ...
I'm just wondering Is there any ways I could simplify the following code without making it too difficult: Actually I want to extract specific year data from content node based on lastNumberOfYears variable. Example: Content array has 2019,2018,2017,2016 years data and lastNumberOfYears value is 2 then output should hav...
I need to generate random text for tests. I do that using alphanumeric characters and some special characters as well. For some special cases, I cannot generate the random text with tags. I have the concept of a tag as text surrounded in curly braces (e.g. {name}). I have written a simple code to clean up the tags (e.g...