Spoiler Alert: This weekly challenge deadline is due in a couple of days (February 9, 2020). This blog post offers some solutions to this challenge, please don’t read on if you intend to complete the challenge on your own.
I have really very little time to complete this blog post in time for the deadline. My explanations will be minimal, sorry about that.
Roman Calculator
Write a script that accepts two roman numbers and operation. It should then perform the operation on the give roman numbers and print the result.
The new features are pretty minor. Most of the improvements are in documentation and testing.
Totally rewritten manual/tutorial.
Every issue on RT has been handled.
Bigger test suite. The exact number of tests run varies based on the availability of optional dependencies, but I just ran the test suite with EXTENDED_TESTING set to false and most of the optional dependencies installed, and it was nearly 7500 tests, compared to just over 2700 for Type::Tiny 1.6.0. With EXTENDED_TESTING true, there are nearly 13900 tests.
Spoiler Alert: This weekly challenge deadline is due in a couple of days (February 9, 2020). This blog post offers some solutions to this challenge, please don’t read on if you intend to complete the challenge on your own.
Garbled Message
The communication system of an office is broken and message received are not completely reliable. To send message Hello, it ended up sending these following:
H x l 4 !
c e - l o
z e 6 l g
H W l v R
q 9 m # o
Similarly, another day we received a message repeatedly like below:
Write a script to calculate the total number of weekdays (Mon-Fri) in each month of the year 2019.
I used the core module Time::Piece and its companion from the same distribution, Time::Seconds. Let’s start on the first day of the month, and keep adding one day while we stay in the same month. Along the way, count the days that aren’t Saturdays and Sundays.
The square secret code mechanism first removes any space from the original message. Then it lays down the message in a row of 8 columns. The coded message is then obtained by reading down the columns going left to right.
For example, the message is “The quick brown fox jumps over the lazy dog”.
Ahh, the venerable comma separated variable format, beloved of data scientists.
I grabbed a couple of csv files from Matt Pettis’
csvkit talk
to prepare for the datafile that I should be getting my mitts on and
tripped and bumped my way through the documentation for
PDL::IO::CSV
and metaphorically skinned my knees,
as you do when you don’t read too carefully.
A common challenge in calling C functions from any language other than C or C++ is dealing with constants. In C these are usually implemented using #define pre-processor directives which are lost by the time the code is linked into a dynamic library. (In fact it is lost before the source is even compiled, since it is a pre-processor directive). For example, the libarchive library provides these constants in its header file for dealing with errors:
/* * Error codes: Use archive_errno() and archive_error_string() * to retrieve details. Unless specified otherwise, all functions * that return 'int' use these codes.*/
#defineARCHIVE_EOF1/* Found end of archive. */
#defineARCHIVE_OK0/* Operation was successful. */
#defineARCHIVE_RETRY (-10) /* Retry might succeed. */
#defineARCHIVE_WARN (-20) /* Partial success. *//* For example, if write_header "fails", then you can't push data. */
#defineARCHIVE_FAILED (-25) /* Current operation cannot complete. *//* But if write_header is "fatal," then this archive is dead and useless. */
#defineARCHIVE_FATAL (-30) /* No more operations are possible. */
You are given a string “123456789”. Write a script that would insert ”+” or ”-” in between digits so that when you evaluate, the result should be 100.
Only 100, Please, in Perl
For solving this task, we first use a recursive combine subroutine that generates all possible strings by inserting between the digits of the “123456789” string the + plus addition, the - subtraction operator, or the '' empty string (i.e. no operator). We then use the evaluate subroutine with each string to perform the various arithmetic operations and compute whether the total is 100.
Write a program to validate given Vehicle Identification Number (VIN).
I followed the description at Wikipedia. Sometimes, it wasn’t exactly clear whether the described rule should be valid everywhere or just in a part of the world; the rules also developed with time, so older vehicles can bear VINs that would be considered invalid for a modern car.
Most of the validation is implemented in a single subroutine validate_vin. It takes two parameters, $vin and $sold: the second one says where the car was sold. "North America" and "China" are two values that trigger a different behaviour of the validator.
Work on the Rakudo.js grant has been completed and now I'm add the stage where community feedback is needed. It would be super grateful for Your feedback. You can provide it in blog comments on this post.
The final grant status update is available HERE
Spoiler Alert: This weekly challenge deadline is due in a couple of days (January 19, 2020). This blog post offers some solutions to this challenge, please don’t read on if you intend to complete the challenge on your own.
Challenge # 1: Olympic Rings
There are 5 rings in the Olympic Logo as shown below. They are color coded as in Blue, Black, Red, Yellow and Green.
We have allocated some numbers to these rings as below:Blue: 8Yellow: 7Green: 5Red: 9
The Black ring is empty currently. You are given the numbers 1, 2, 3, 4 and 6. Write a script to place these numbers in the rings so that the sum of numbers in each ring is exactly 11.
Well some-days it would be nice to get a little advice, without asking for it, before one heads down a very long and in the end futile path.
Today that happened to me when I was starting down a path that I dreaded. Namely creating the 'response' test suite for all those S3 requests I have fixed up over the past few weeks. This type of programming ranges from so mind numbingly dull as to cause your ears to bleed to so incredibility repetitive that you consider that career change to line supervisor at the box factory.
Looking at the prospect of coveting some 70+ working S3 units tests by hand was obviously getting me down a little. It took me a good three or four days of rather mindless hacking and re-running just to to the 'request' tests.
November was the quietest month for me. I would give credit to the book Why We Sleep, gifted by Neil Bowers. I haven't finished reading the book yet but whatever I read so far made a big difference. A very big THANK YOU to Neil. I no longer do late nights, technically that means no work after midnight for me. However I do wake up early on weekends and finish the pending work. One more change, I noticed that I don't visit MetaCPAN very often. Earlier I used to checkout every 30 minutes during the day. But now I do it once every couple of days. Having done 160 Pull Requests in October, then doing only 51 Pull Requests in November feels so light. In fact I reached my monthly target of 50+ Pull Requests in the third week of November. Last one week was relaxing, I made conscious efforts not to look for Pull Request.
You want to get to know your data, questions like,
can they be broken down into a simple set of classes.
You don't know what these classes might be, so your
task is clustering and you reach for one of the
oldest clustering algorithms around k-means.
k-means is popular because it's simple to understand,
converges fast, works in higher dimensions
and gives you an answer.
It's also usually the wrong choice unless you've
already got nicely clustered data just waiting for you
to guess k, the most appropriate number of clusters
to answer your question. But it is a decent warm up
exercise in becoming friends with your data set.