rosetta-stone

get month name from month number and vise versa

I start with c# syntax to get month name from month number, System.Globalization.DateTimeFormatInfo mfi = new System.Globalization.DateTimeFormatInfo(); string strMonthName = mfi.GetMonthName(8); and for abbrevated month name i use string strMonthName = mfi.GetAbbreviatedMonthNa...

Code Golf: Playing Tetris

The basics: Consider the following tetrominoes and empty playing field: 0123456789 I O Z T L S J [ ] [ ] # ## ## ### # ## # [ ] # ## ## # # ## # ...

Nested(deep) iteration for loops ? Good or Bad Practice?

Hi All, I wanted to ask, If writing nested(deep) iteration loops (as shown in example) a bad practice (in OOPs)? For example : If i want to zip all files that in all Workspaces. Given example classes are Workspace, Project , File please ignore avoid syntax errors for each Workspace workspace in WorkSpaces { Pro...

Code Golf: Morris Sequence

The Challenge The shortest code by character count that will output the Morris Number Sequence. The Morris Number Sequence, also known as the Look-and-say sequence is a sequence of numbers that starts as follows: 1, 11, 21, 1211, 111221, 312211, ... You can generate the sequence infinitely (i.e, you don't have to generate a specific n...

Code Golf: DNA Sequences

Let's give the GMO guys something to cry about: Goal: Generate a sequence of DNA base pairs (A, T, G or C), 78 pairs long (not a big gene...), terminated by a newline, and print it. Rules: The lines must be exactly 78 characters long with a terminating newline, and while the program can give the same result if invoked twice in a row, i...