Categories
Mastering Development

need help formating type=”datetime-local” in ColdFusion (not a cold fusion element)

Ok I have searched for 2 days and thought I found the solution but it’s not working maybe I can get a hand here. I’m trying to allow the user to choose the date and time of their form post. I found the type="datetime-local" which achieves this (even though it’s not widely supported by browsers […]

Categories
Mastering Development

Sanitise code output from grep, replacing multiple whitespace after a range of characters

Answer: Thanks to Jerry Jeremiah I have the solution the end result is this: grep -E ‘^\S{8} \S’ test.lst | awk -F’;’ ‘{print substr($1,1,35)gensub("[[:space:]]+"," ","g",substr($1,36));}’ It requires having gawk installed Original Question: I have a file which i want to sanitise the output and then diff however i’m having problems coming up with working regex […]

Categories
User Help

Too many levels of nesting for IF function in Excel

I am using together with “IF” and “filler” function to look for result, but it is just too complex. Is it possible to reformulate formula below earlier and write into one cell? Thanks in advance! J33=IF(I33=A33,1,IF(I33=A32,2,IF(I33=A31,3,IF(I33=A30,4,IF(I33=A29,5,IF(I33=A28,6,IF(I33=A27,7,IF(I33=A26,8,”*”)))))))) =IF(ISBLANK(OFFSET(J33,-J33-1,0)),”Y”,””) K33=IF(K33=”Y”,IF(ISBLANK(B30),”R1″,IF(ISBLANK(B29),”R2″,IF(ISBLANK(B28),”R3″,IF(ISBLANK(B27),”R4″,IF(ISBLANK(B26),”R5″,IF(ISBLANK(B25),”R6″,”R”)))))),””) M33=IF(L33=”error”,IF(ISBLANK(B24),”R7″,IF(ISBLANK(B23),”R8″,IF(ISBLANK(B22),”R9″,IF(ISBLANK(B21),”R10″,”error”)))),””) Q33=IF(L33=”Error”,””,IF(L33=”R2″,CONCATENATE(B30,” “,B31),IF(L33=”R3″,CONCATENATE(B29,” “,B30,” “,B31),IF(L33=”R4″,CONCATENATE(B28,” “,B29,” “,B30,” “,B31),IF(L33=”R5″,CONCATENATE(B27,” “,B28,” “,B29,” “,B30,” “,B31),”Error”)))))&IF(M33=”Error”,””,IF(L33=”R6″,CONCATENATE(B26,” “,B27,” “,B28,” “,B29,” “,B30,” “,B31),IF(L33=”R7″,CONCATENATE(B25,” […]

Categories
Mastering Development

How to replace characters by strtok function – C?

I really want to change all spaces ‘ ‘ in my char array for NULL – #include <string.h> void ReplaceCharactersInString(char *pcString, char *cOldChar,char *cNewChar){ char * p = strtok(pcString,cOldChar); strcpy(pcString,p); while(p != NULL){ strcat(pcString,p); p = strtok(cNewChar,cOldChar); } } int main() { char pcString[] = “I am testing”; ReplaceCharactersInString(pcString,” “,NULL); printf(pcString); } OUTPUT: Iamtesting If […]

Categories
Mastering Development

DuckDuckGo Scraper, can not go to next page

I have written a Url scraping code that works on bing and Google and navigates fine through the pages. I am now tring to set it to work on duckduckgo.com. I have got it working so it scrapes from a single page. The ONLY problem I have is I CAN NOT workout how to get […]

Categories
Mastering Development

How to split a java string with a regex?

I am struggling a bit with splitting a string. Here is an example of an input and the correct output I want: Input: “Hope you’re doing well! I am doing ok. ” <— A few spaces after the period Output: [Hope, ” “, you’re, ” “, doing, well, “!” , ” “, “I”, ” “, […]

Categories
Mastering Development

Speeding up floodfill

To my assignment, I have to create floodfill function for a later use in a minesweeper game. This is a practice exercise for it. Here is my code: def floodfill(planet, x1, y1): width = len(planet[0]) height = len(planet) list = [(y1, x1)] if planet[y1][x1] == ” “: for y, x in list: planet[y][x] = “0” […]

Categories
Mastering Development

Tic Tac Toe Game but there is a bug where the loop doesnt break after one wins

def DrawField(field): for row in range(5): if row%2 == 0: practicalrow = int(row/2) for column in range(5): `enter code here` if column%2 == 0: practicalcolumn = int(column/2) if column !=4: print(field[practicalcolumn][practicalrow],end=””) else: print(field[practicalcolumn][practicalrow]) else: print(“|”,end=””) else: print(“—–“) Player = 1 CurrentField = [[” “, ” “, ” “],[” “, ” “, ” “],[” “, ” […]

Categories
Mastering Development

pivot_wider when there’s no names column (or when names column should be created)

I’m trying to reshape my data from long to wide, but here I need to create names column such as event1, event2, event3, etc. In other words, there’s no natural candidate for names_from argument. I’ve tried a couple of different ways but cannot get what I’m looking for- Here’s a reproducible example. set.seed(57) df <- […]

Categories
CMS Magento Mastering Development

Fetch products from category using elasticsearch

<?php namespace Magento\FetchProductsFromCategory\Model; use \Magento\FetchProductsFromCategory\Api\ProductInterface; use \Magento\Framework\Exception\NoSuchEntityException; class Product implements ProductInterface { protected $_categoryFactory; protected $_category; protected $_categoryRepository; protected $_storeManager; protected $jsonHelper; public function __construct( \Magento\Catalog\Model\CategoryFactory $categoryFactory, \Magento\Catalog\Helper\Category $category, \Magento\Catalog\Model\CategoryRepository $categoryRepository, \Magento\Framework\Json\Helper\Data $jsonHelper, \Magento\Store\Model\StoreManagerInterface $storeManager ){ $this->_categoryFactory = $categoryFactory; $this->_category = $category; $this->_categoryRepository = $categoryRepository; $this->jsonHelper = $jsonHelper; $this->_storeManager = $storeManager; } /** * POST […]