instruction
stringlengths
71
95.1k
Problem Statement: Users can chat while the replies of the chatbot are based on past messages. So the chatbot needs to have the context of the previous messages and reply accordingly. Here is pseudocode of chatbot for more understanding hi_flag = False message = await websocket.receive_bytes() if message == "Hey": ...
Given an N x N matrix of positive integers, I need to find the shortest path from the first cell of matrix to the last cell of matrix. I can move exactly x steps from any cell, where x is the value of the cell. The possible movements are right or down, i.e from any cell M[i][j] I can move to locations M[i + M[i][j]][j]...
I'm trying to write a script to delete event invites from my personal google calendar. I get invited to multiple events everyday such as "Click here to win an iPhone" etc. I have written a google script to run each hour and delete any events where I am not the owner. However this is getting all events and then iteratin...
I need to round numbers in a Word document, as I couldn't find a built-in way, here is my approach, it rounds all numbers in selection. As I use VBA mainly in Excel I'm not sure whether I've done it the best way possible: Sub RoundNumbers() Dim OrigRng As Range Dim WorkRng As Range Dim FindPattern As Stri...
My program (which eventually will be containerised) should be able to do the following: continuously listening for deployment and daemonsets in kubernetes (2 threads) collect info needed (like annotations) use the info collected in order to create objects in a remote database I could use some peer review for the thre...
How could I refactor this code to get it more cleaner: public List<TestDTO> Map(product product) { if (product == null || product.Tests == null || !product.productTests.Any()) return null; return product.productTests.Select(x => _productService.Map(x)).ToList(); } Is it possible to write this more cleaner? Th...
I reworked the Game I did in FLTK some while ago: Hunt the Wumpus GUI (FLTK) This time I used C++ with the Qt Framework. The result looks like this: If you want to try out the game. The full code can be found in my Git Hub: https://github.com/sandro4912/hunt-the-wumpus One more hint not find in the Instructions. If t...
I want to count the occurrences of a multi line ASCII pattern within a file. The pattern looks like this: a1 b2 c3 The file I want to search looks like this: (The _ represent whitespaces but I thought it's easier to understand with this notation) _ _ _ a1 _ _ _ b2 _ _ _ c3 _ _ _ _ a1 a1_ _ _ _ _ _ _ _ b2 _ _ _ _ a1 ...
I'm looking for feedback on this Personal Finance tool. I want to know what I've done well and what I haven't done so well. Please don't criticise the fact I've used Hungarian notation, it's required in my university assignment and I know I probably should be using classes but at the moment I'm just sticking to the pro...
I built a scanner generator like flex or jflex in Scala for a class last year. Part of this project is a small library for handling and manipulating finite automata. It works completely as intended, except for maybe some bugs in the conversion to dot-code, which is of little concern. I would like to have some aspects o...
I have created a very simple Class Module and a Dictionary to store original values when the workbook is opened as part of this project ive been working on. When the workbook opens I call a test to see if its open in read only mode because multiple people will be in the workbook, but only one person will have it open ...
I wrote this code that makes a fairly long function call multiple times using some of the same parameters match key { Key { code: KeyCode::Left, .. } => self.map.move_object_by(PLAYER, -1, 0), Key { code: KeyCode::Right, .. } => self.map.move_object_by(PLAYER, 1, 0), Key { code: KeyCode::Up, .. } => self.ma...
Motivation In my web app (React, Redux, TypeScript) we have a common need to write paginated API calls, with various UI interactions (infinite scroll, prefetch pages in the background, or manual page navigation controls). Rather than re-write pagination handling in every case, I wanted to create a re-usable method to u...
I have a function that creates a rectangle from two rectangles that overlap, I was wondering if there is a smarter way to do it purely mathematically rather than lots of if statements to check min and max the way I currently have setup. This is my function public static bool Overlaps(this Bounds a, Bounds bounds, o...
In order to plot a squircle using its parametric equations: The equations can be found in page 9 of this this article: Fong, Chamberlain. "Squircular Calculations." arXiv preprint arXiv:1604.02174 (2016). Unfortunately the following singularities are not handled by those equations: For t = 0, t = pi/2, t = pi, t = ...
Exercise 1-17 from the book The C Programming Language: 2nd Edition, K&R Full description: Write a program to print all input lines that are longer than 80 characters. #include <stdio.h> #define MAX_ARRAYCHARACTERS 1000 #define MIN_CHARACTERS 80 int main(void){ int currchar, // current character being read ...
I wanted to create a short little piece of code so that I could see the biases in the random function. import random import statistics import time num = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] average = [] while True: randomNum = random.randint(0, 9) num[randomNum] += 1 average.append(randomNum) print(f"\nThe ...
This problem is from Advent of Code day 4 (part 1). The problem is to find the number of ints in the given range satisfying: all digits are non decreasing there is at least one group of at least two equal digits in a row combinations only generates non-decreasing sequences; for example: λ> combinations 2 ['1'..'3'] [...
Can anyone advise on how to use the SymPy TensorProduct function without having to explicitly indicate the full sequence of objects to take the product of. Below (for the simple case N=3) you can see one of my attempts. But the tensor products are still not coinciding, hence I am still having to write out the full sequ...
My code consists of Split, Mid, Left, Right and Replace functions which are used to trim my data into a more neat manner. However, it's too long and inefficient, it takes too much time to go through all this because I have up to thousands of files that will go through this. My main code goes through a folder and goes t...
I ended up using 2x 2D arrays with a one element border around everything to simplify the kernel logic. import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import java.util.Random; public class WorldSimulation { long generation = 0; int[][] next = null; int[][]...
I have the requirement to return the result of my ViewModel as a Dictionary of KeyValue pairs. My view model comprises of multiple classes and can have null values in properties. I need to return only values which are not null and non-zero in case of double/string types. Following is the class I created: public static ...
I would like feedback on this DistinctUntilChangedBy operator for System.Reactive that only emits when the current value is different than the last by a specified amount. Is there a better implementation? I want to avoid multiple emits when the stream looks like this: 0.80, 0.81, 0.80, 0.81, etc. Using the operator lik...
I am doing Advent of Code 2019 in order to learn Rust (it's been fun, but challenging!). I am looking for help and feedback from more experiences Rustaceans on my solution to Day 6: Universal Orbit Map in Rust. Specifically I am looking to see where I am not doing it the idiomatic Rust way, where my Java background s...
I encountered a use case where it was needed to store each element of a tuple into a list of their respective type of the tuple element. To streamline this feature I wrote a method extension that I overloaded for different sized tuples. The code is quite basic and does not do a lot but I thought you could give me some ...
Asked in interview today: You want to paint a skyline on your wall using only horizontal brush strokes. You are given an array of numbers, each representing the size of the column/building in that position. E.g. [1,2,1] - you can use two (horizontal) brush strokes. The first will paint the entire first row, and the sec...
Was asked in an interview today - You are given an integer (in finite range [-N, N]) and you wish to maximize the number by inserting somewhere the digit '5'. My solution - the idea here is going from left to right and checking if the digit is bigger than 5 or not. The first time you reach one that isn't you insert t...
After working on the project for 15 hours of I had my layout set 1 row and 1 column per square, no problem. Then I decided that I needed each square to have multiple rows. I would have never guessed that it would take almost 6 hours to work this out. The reason that I changed the layout I had most of the logic work...
This is my solution for Day 2 of Advent of Code 2019. It's the eval function I want to get reviewed. Is this acceptable Haskell code? Is it even close to being idiomatic? Also, is it OK to leverage laziness this way? module Day2 where import Data.Vector (Vector, fromList, head, (!), (//)) import Data.List.Split (split...
I am trying to write my own implementation of a hash table (hash map) in C++. It turns out that my code is unoptimized as I can't pass performance tests. Can you please give some advice for optimization of the program? I am using open addressing for resolving collisions with quadratic probing. Hash function for string:...
I need help to dynamically create an array with nested objects holding again an array of objects each. The structure is as follows: tiles=[ { "row": [{isChecked: true, src: ''}, {isChecked: true, src: ''}, {isChecked: true, src: ''}] }, { "row": [{isChecked: true, src: ''}, {isChecked: true, src: ''}, {isChec...
Please review the following code for thread pool in C (I wrote it to implement a threaded web server for my personal project). I have been programming in C++ and Java but never did any serious programming in C. threadpool.h #ifndef THREAD_POOL_H #define THREAD_POOL_H #include <pthread.h> #define MAX_THREAD 10 typede...
The following piece of code will print a text based on the divisibility of number. If the number is not divisible by 3, 5 and 7, then the number gets printed. Does making use of a f-string make the type cast of integers to string implicit? def convert(number): result = "" if (number % 3 == 0): result +=...
I created this package PXP. PXP enables markup to instantiate objects, call methods, and generate HTML. It works similar to a server-side templating engine, but rather than enforcing braces it enables developers to use markup to build dynamic web pages. I'm interested primary in feedback related to core implement bel...
I am new in developer role, and I have my code which I would like to simplify or make it better. And wondering if someone can do a quick check. The code calculates the Score of the Bowling game, which is input as a string of the whole game (ex. as following: "X|7/|9-|x|-8|8/|-6|x|X|X||81"). Program.cs public class Pro...
I have polylines in a GIS database. The polylines are stored using a user-defined type called ST_GEOMETRY. ST_GEOMETRY has lots of spatial functions. However, it does not have a polyline midpoint function. Therefore, I have written a custom PL/SQL midpoint function to fill this gap. As a novice programmer, I'm wonderi...
My application (legacy code) reads a CSV input file with an expected format with regards to Column names as follows: 1st column - Should say "Marker" 2nd column - Should say "Category" 3rd column ... to ... N columns - These are the actual data columns. Should have number starting with 1 and increasing by 1 going righ...
I have modelled a series of school classes as follows. The part I am not sure about is having a separate table for cancellations and substitute instructors. With this setup every time you looked up the class schedule for a given week you would have to search the class_exceptions table in order to see if the class was...
Context Me and my team which I'm part of, for most of the time code in Excel VBA. Writing code in it self is pretty enjoyable, but combining our work in a shared repository is pretty painful. The ease our pain of combining/merging binary files, we have decided to help ourselves and create the Source Code Manager modul...
This code will generate a pseudorandom alphanumeric string of given length. I would welcome suggestions on how to make it more random. Beyond that, have I made any convention violations, Exception cases, and the like? Also, is there any way to make it faster? public class Test { public static String getRandomAlphaN...
I'm also doing the fun little Advent of Code challenges in order to learn Rust. Until now things went quite smoothly, but while I'm proceeding with the tasks I'd love to learn where I can actually improve my Rust coding (and not only getting the correct results). I'm specifically looking for feedback where I'm violatin...
I've written a lock-free state machine in go and I would love to receive some feedback on it. Writing this library my main concerns are keeping it lock-free and very light-weight (no bells and whistles like hooks and such). Because this is lock-free I had to use atomic.CompareAndSwap which meant that the underlining st...
I'd like to know there's a better code than I did. interface AnswerProps{ itemId: string; value: Array<string> } This code works like checkbox. If answers has a value, I try to put the same value again. It would be deleted like toggle. const App = () => { const [answers, SetAnswers] = React.useState<AnswerProps...
I have two datasets. The first dataset “insideMarke1” contains the Best Bid / Best Ask (=BBA) data for a given day, starting at 8.00 am. Every time the BBA is updated, there is a new row with a new timestamp. The second dataset “orders1” contains order data. The order entry timestamps (‘Entry date and time’) in this da...
The goal of this code is to handle processes in multiple platforms, Linux initially. Windows later. The high level handler starts and stops a process or a list of processes. The platform specific drivers must conform to the following interface: open(), close() and is_open(). This system is used in test automation. My o...
I am attempting to construct a background service for an IIS-hosted ASP.NET Core project that basically queues tasks and runs them, and I decided to go with the IHostedService interface in Core 2.1 because of this tutorial. The tutorial does describe the case of running tasks one-by-one and in the order received, very ...
I dont now how to optimize me code. The game i created lags 15 fps, how i can it be reduced and optimize.This my code, I try to do optimize, but i cant. Please help: import pygame from random import randint import time import os pygame.init() name = os.getlogin() path = r'C:\\Users\\' +...
Motivation Python's Abstract Base Classes in the collections.abc module work as mixins and also define abstract interfaces that invoke common functionality in Python's objects. While reading the actual source is quite enlightening, viewing the hierarchy as a graph would be a useful thing for Python programmers. Unified...
I have built an open-source project based on FluentAssertions in order to solve some recurring tasks I was doing while testing the .Net Core APIs I'm developing. I find the capability of doing in memory end-to-end tests of the APIs I build a great addition in terms of productivity and validity. With this project I want...
EDIT1: Suspicion that mariadb++ is affecting my performance results compared to the raw "mariadb/mysql Connector-C"?? EDIT2: I did a barebones C-Only implementation and it comes in at 222ms vs the 262ms using mariadb++. 40ms is significant, given the fixed DB overhead. EDIT3: Changed mysql_store_result to mysql_use_...
I have written a function to calculate all strong components in a graph. How do I make this cleaner and nicer? import java.util.* import kotlin.math.min private fun readLn() = readLine()!! // string line private fun readInt() = readLn().toInt() // single int private fun readStrings() = readLn().split(" ") // list of...
I recently solved Advent of Code 2019 Day 6 in C#. Part 1: You've landed at the Universal Orbit Map facility on Mercury. Because navigation in space often involves transferring between orbits, the orbit maps here are useful for finding efficient routes between, for example, you and Santa. You download a map of t...
Basic idea is to use a Class, with static methods to add and remove references in a static vector, that keeps track of these references, and check that vector upon exit. The class is detecting intentional leaks that I create, but maybe you can find a case where it does not detect the leak, that I am not seeing #include...
I have a sample list which contains nodes and their neighbors, if they have any. The task is to find the node which have the highest number of neighbors. neigh = [['A'],['A','B'],['A','C'],['B','D'],['C','A']] The input is undirected. Meaning that ['A', 'B'] are neighbors. While ['A'] doesn't have any neighbors since ...
My VBA code currently loops for 5,000 iterations and takes about 25 minutes to collect the output data in the Output excel sheet. Is there a way to reduce the time taken for instance by improving the copying and pasting of values, collecting the output data in some kind of array etc.? Given that I will be looping it fo...
I am an old python newbie here, migrating from fortran77 ;) Still unsure of the python terminology at the moment :( The python3 script below fetches a large list of matching files in a folder tree, in the format: [ fully_qualified_folder_name, [list of matching files in this folder] ] Being only a python newbie, ther...
Just for fun, I created a script called TinyBF which can compress Brainfuck programs into a format half their size. For example, take a famous hello world program clocking in at 78 bytes: --<-<<+[+[<+>--->->->-<<<]>]<<--.<++++++.<<-..<<.<+.>>.>>.<<<.+++.>>.>>-.<<<+. When put into TinyBF format, it is only 39 bytes: 7#...
I am in the process of setting up WordPress with WooCommerce, one of the requirements is a bit of integration that takes a person from another website directly to a specific product. I have set the external product references in tags on the products. An example incoming query would be: http://localhost/TestSite/search?...
I have a fair few years experience with programming, and am currently working in a software development role, writing internal web applications in C#. This is the first C++ code I have ever written, so I therefore don't know the conventions, code smells, do's/don't's of the language. I decided to write an extremely bas...
I am creating a small library for controlling bars of leds and have some doubts about my design. I have 2 basic entities in the design so far: BarService (and implementation) template<class T> class BarService{ public: virtual void turnOnLeds(T* bar, int end) = 0; class PinBarService : public BarService<PinBar>{ pu...
My code here loops through my folder and my files inside the folder and use .find and copy the strings into a new Excel sheet and then with all the data in the new sheet, I will use .Find(What:=) to find the strings inside the new worksheet and then either split or use Right, Left, Mid functions, sometimes using replac...
I've written this decorator to avoid too many requests to a backend. Did I get it right? Do I need some locks or can I assume some things are atomic / thread safe because this is asyncio? def batch_calls(f): """Batches single call into one request. Turns `f`, a function that gets a `tuple` of independent reque...
I'm working on one easy question (Leetcode 1275. Find Winner on a Tic Tac Toe Game) and am wondering how I can make the code even cleaner. class Solution: def tictactoe(self, moves: List[List[int]]) -> str: from collections import Counter def is_win(pos: List[List[int]]) -> bool: pos = ...
I am new to Ctypes. I am writing a piece of code that brings an array of unknown size from C to Python using Ctypes. Unknown size here mean that Python initially doesn't know the size of the array. C code has the algorithm which creates the array. Somehow after lot of trails, I managed to write code for that: python c...
I have a 2D array matches where I store the game id and another array of objects games where I store gameId with the playerId. Here is what I have done so far: Step 1: I get the opponent's gameId against the gameId from "matches" array. e.g. gameId "2" has an opponent "1" Step 2: check opponent_game in games and retu...
I am a technical reviewer/writer and I use VBA for Word a lot to manage issues in Word documents I receive. I have frequently come across niggles when using Collections, Scripting.Dictionaries or Array lists. Then I saw some posts on creating a C# library for consumption by VBA. After much reading and research I eve...
DO NOT RUN THIS EXAMPLE BLINDLY, IT REMOVES ALL FILES UNDER argv[1] Hello, This little programm should read all files from a given directory and do some work with them. New files are constantly written into the directory by an outside process. For the duration of the processing, the file should stay in the input direct...
I made a 26-bit binary Wiegand calculator for an ESP32 following this format: This is "Arduino C" : unsigned int * getWiegand(unsigned int dec) { unsigned int* wiegandNum = new unsigned int[26]; Serial.println(); // transform dec number into binary number and store it in binaryNum[] int n = 1; for(int i = 2...
This is my first post here so I hope you will be patient if I'm doing something wrong. I made a small website with create-react-app and I would like to request feedback about. This website was a test and I had a limited amount of time to complete it, hence there are no tests nor license, which for the test purposes wer...
This is my script. I want it to run on a weekly basis on my linux server on a Raspberry Pi 4, to back up all files that may have changed. On the GPIO are just LEDs. It requires a program called notify_run, and a file called "BackupSettings.ini" in its own directory that looks like this: [Sources] Folder1=/home/pi/Deskt...
I've tried to solve AoC day 2 challenge in Haskell (here - don't worry, it's not a competition so sharing a solution here is OK). The goal is to implement a very simple VM with opcodes 1 (add), 2 (mult) and 99 (exit). I feel like my solution is incredibly verbose. That maybe be because I rely heavily on the state monad...
Following scenario: this is the code that resides in Ajax Controller class. It is responsible for handling input in one of the form fields. The logic is as follows: If user-inputted data validate as either Tax Number or Statistical Number, it's supposed to: check for presence of such data in database, and, depending o...
I am looking for a cleaner, more pythonic way to get a list of the name of the months starting with the current month and ending 12 months later. For example, it's December so my list should be ['Dec', 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov'] Here is how I'm currently doing it: fro...
I am collecting 3 years of data and building a string that will be used with an ASP Literal control. The method GetListOfMeetingBygroupId takes in a groupID and year and will return meeting for that group and year. MeetingService ms = new MeetingService(); int groupId = 574; //Meeting int totalYearCou...
I'm using advent of code 2019 to start learning Python. I've read the Python style guide, and I'm trying to write readable and reusable code. This piece of code is an implementation of the IntCode computer used in many of the assignments. If you'd like to see code for the specific assignments, it's on my Github. Here's...
I wrote a function that I use to preprocess pandas dataframes before running them through a machine learning model. The function works perfectly, however I don't think it's the most pythonic way to write it. This function accepts a list of words: ['here', 'is', 'a','sample', 'of','what','the','function','accepts'] def...
This is the first time I am writing R code to access/manipulate and save data. The SQL query I would normally run then save to a spreadsheet, read it into R, save to another sheet then copy and paste that yet to another spreadsheet, then import back into SQL-Server. Too much going on so I wanted to put it all together ...
I have created a wrapper for displaying messages with ArcPy and IDLE (as that is all I have available to myself due to certain circumstances) as I frequently use both to test and develop new tools. However I find myself repeating print statements and arcpy functions to display feedback. Unfortunately, it has to be in c...
This is a simple password generator. What do you think about it? I am learning C for a while at school and at home. This just has a mix of symbols, lowercase, uppercase and numbers, with a configurable length. #include <stdio.h> #include <stdlib.h> #include <time.h> int main() { int i = 0; int n = 0; int r...
With some basic knowledge of Python and referring a lot of sources, I have written the code below. But it takes half an hour for execution. How can I reduce the time? I read about vectorization but not understanding how exactly I can use it here. In this, I have to read 2D skeleton images( Size 1980x1080) and Depth ima...
I need to implement async_read_some from Boost Asio. The reason is here https://stackoverflow.com/questions/59223064/implementing-behaviour-of-boostasio-for-a-class but I don't think it's relevant. Mainly because my code does not use I/O, but I want to fool OpenVPN3 into thinking it's using I/O. async_read_some passes ...
I was playing around with the "eight queens" problem, just to see how I could use C++ algorithms to write less code. I figured out a way to find the next unused column using find_if_not. I am showing both ways of writing it. Assume we are looping over every valid "file" on a given "rank" ( in C++ terms, I am looping ...
I'm developing a toy project for monitoring some network parameters. Now I'm implementing a feature that will allow to measure a packet round trip between hosts by measuring time between TCP SYNC and TCP SYNC/ACK. One of the options for feeding this application with packets will be setting up capture on network device....
This is another review on a program I've asked about before, now translated from VBA into C#. I'm sure I've brought over a lot of bad habits with me, so I'm spotlighting some key areas I'd love open-ended feedback on. This is a WPF desktop app. Program Function As before, this program makes emergency changes to medica...
I am studying C while listening to a lecture by myself. When I was studying coding and listening to a lecture, I heard that writing code should be concise and maintainable. But I didn't know if I was doing well, so I felt the need for feedback. But it's hard to find anyone who can give us feedback, and I don't know whe...
A bit of background. In the application I work on there are emails sent to notify users about articles they need to review. Each email+recipient pair is stored in database and may be assigned a different creation date ( called DateCreated ) due to emails being generated over some time. I needed to calculate how many ti...
Advent of Code 2019: Day 4 I'm doing Advent of Code this year. Below is my attempt at day 4: Problem Part One --- Day 4: Secure Container --- You arrive at the Venus fuel depot only to discover it's protected by a password. The Elves had written the password on a sticky note, but someone threw it out. However, they do...
The function should return a string with balanced parenthesis. The code I wrote is working for all the inputs below. I am using stack data structure. I suppose this should work for all the edge cases. Can this solution be optimized further? import java.util.ArrayList; import java.util.Stack; public class BalancePare...
I have written the following program to read from a file (entire input in single line) and check for: ASCII punctuation characters a final newline import re file_name=input("Please enter the file name ") with open(file_name, 'r') as fp: context=fp.read() regex = re.compile('[@_!#$%^&*()<>?/\|} {~]') if re...
I am doing a project to compare the time complexity of 2 string search algorithms. I lost my previous code due to some issues and so have had to rewrite the majority. However, this time around, my KMP algorithm seems to be running a lot slower, and I can never actually get it to run faster than my Boyer-Moore no matte...
I am writing one logic to iterate numbers first and then additional logic to putting them into particular subset of array. What does this code do: Code accept first $n It creates an array of $n number from 1 to $n Then started converting to subset of $main_array to possible one like ['1'] [1,2] [1,2,3] [2] [2,3] [3...
I wrote a function which picks a two different random elements from a closed range of ints and returns them as a tuple. I would like to take a your feedback, if the solution is a "Clever", "Best practice" or "non of them" func pickTwoRandomElementsFromRange(_ range: ClosedRange<Int>) -> (Int, Int)? { guard range.c...
I am trying to implement a basic circuit breaker design for my internal API calls. I would appreciate some criticism and feedback about my code. I am also planning to implement an interface off of the class once I am happy with it. As mentioned this circuit breaker design will be used for internal gRPC calls between my...
I wrote this method and I would like to refactor it so it is easier to understand and looks cleaner. However, I don't know how or where to start. If you could give it your best shot and explain your approach to how you did it, it would be very helpful to me. The function reduces the size of elements until the parent co...
I have been using this code for a while. I got it from a tutorial 5 years back. Now I'm wondering if it still is secure, or if it's time to find a new one? Maybe it has never been secure enough. LOGIN <?php //Connect to database require("include/config.php"); //Empty Variable $submitted_username = ''; //Check if som...
I've created a library, TomHart/laravel-route-from-model, and looking to get a review on it. As well as the usual code review, I'm also looking for feedback from a users point of view, if you were to use the library, is there anything extra you wish it did, anything different etc. The key class is: <?php namespace TomH...
I am following CIS 194: Introduction to Haskell (Spring 2013) online to teach myself Haskell. Following is my response to first exercise of Homework 3. Since I don't have anyone to show my code, I am posting here to get a little feedback. In which ways I could improve this, without getting too much into advanced topics...
I'd like to improve this operator code if I can. I don't know enough Raku to write idiomatically (or any other way for that matter), but suggestions along those lines would be good also. use v6d; sub circumfix:<α ω>( ( $a, $b, $c ) ) { if ( $a.WHAT ~~ (Int) ) { so ( $a >= $b & $a <= $c ); } else { ...
I've wrote a little program that encrypts text by using the caesar-cipher. Also it contains a little GUI, created by using swing. Here's the full code: import javax.swing.JOptionPane; import javax.swing.JScrollPane; import javax.swing.JTextArea; import java.awt.Dimension; public class caesar { public static void ...
So, I have a project that has a lot of methods that look alike. In the below method as you can see it just fetches a bunch of rows from database and maps it to a model class. In this case ParkingSlipDetails class. There are several such methods in the project that do the exact same thing only with a different set o...