Categories
Mastering Development Software

Segment tree implementation issue

Basically, I have been asked to write a code which inputs a string and for each query(consisting of two indexes), my program needs to output the number of different characters in that string within those indexes. So, I created a segment tree to solve this problem. For easy implementation, I created my own user friendly […]

Categories
Mastering Development

Spark Scala dynamic comparing of all similar dataframe columns

I am trying to compare columns in a JOINed table / relation that have similar names as a result of the JOIN – which can be qualified with l. or r. I note the columns function for a DF is a little imho inconsistent. I am nearly there, but there is a bug. The code […]

Categories
Mastering Development

Date picker validation in multi-row does not work

I inserted two date pickers to select "from" "to" dates inside multi rows. Now I want to validate the "from date" and "to date". So I added validations as follows. $request->validate([ ‘from.*’ => ‘required’, ‘to.*’ => ‘required’, ], [ ‘from.required’ => ‘Please select from date.’, ‘to.required’ => ‘Please select to date.’ ] ); But it […]

Categories
Mastering Development

Explain list comprehension in cumulative sum of list

Python code to get the Cumulative sum of a list def Cumulative(lists): cu_list = [] length = len(lists) cu_list = [sum(lists[0:x:1]) for x in range(0, length+1)] return cu_list[1:] # Driver Code lists = [10, 20, 30, 40, 50] print (Cumulative(lists)) Can anyone help me to expand above list comprehension ? I have written this code […]

Categories
Mastering Development

Creating a string with a repeating structure

I’m trying to create a string with the following output: 1: (a, b), 2: (b, c), 3: (c, d), 4: (d, e), 5: (e, f), … Where the letters are numbers. There are a few factors I would like to be able to control: the start value ‘a’ the number of rows. Sometimes I’ll need […]

Categories
Mastering Development

How would I make a multiplication table and save it a a .txt file?

How would I make a multiplication table and save it as a .txt file? My current code : def tablep(): n=int(input(“Enter a Number:”)) start=int(input(“Enter a start:”)) end=int(input(“Enter an end:”)) if start<end: for i in range(start,end+1): print(n,”X”,i,”=”,n*i) elif start>end: for i in range(start,end,-1): print(n,”X”,i,”=”,n*i) w = tablep() file=open(“table.txt”,”a”) file.write(w) file.close() How do I save this as […]

Categories
User Help Web Apps

What’s causing this error when running Google sheets script?

Exception: The parameters (String,String,String,(class)) don’t match the method signature for CalendarApp.Calendar.createEvent. (line 31, file “Copy of Code”) 29 if (eventID != complete){ 30 var currentCell = sheet.getRange (startRow + i, numColumns); 31 calendar.createEvent(primary,start,end,{ 32 description: phone, email, adults, kids, notes 33 }); Google form updates Google sheet which updates Google Calendar when script is run. […]

Categories
Game Creation Mastering Development

Rotating projectile in direction it is moving

I am using a parabola curve to launch my arrows: public static Vector3 Parabola(Vector3 start, Vector3 end, float height, float t) { Func<float, float> f = x => -4 * height * x * x + 4 * height * x; var mid = Vector3.Lerp(start, end, t); return new Vector3(mid.x, f(t) + Mathf.Lerp(start.y, end.y, t), […]

Categories
Linux Mastering Development

searching logs for failures using grep with wordlist?

I am building a wordlist which will contain words like error,fail,kill,warn,out of,over,too much…..etc. so that I can filter tons of logs for issues within seconds. Log levels 0,1,2,3,4 greperror() { grep -i ‘error\|kill\|fail\|warn’ $* } Especially, it’s for linux logs digging. Edit 1: https://github.com/cornet/ccze static char *words_bad[] = { “warn”, “restart”, “exit”, “stop”, “end”, “shutting”, […]

Categories
Mastering Development

How to respond to a mouse click on a Shape [closed]

I want to create a small functionality i which: User can select any number of objects(like line,circle etc) to offset. User would right-click the object they want to offset from vertically and be provided an enterable field to specify the offset distance. Upon clicking an “OK” button from #2, the objects would offset starting from […]