Hello Daniweb Community, I'm wanting to slice a square image into 9 pieces like below ![Image_Grid_Expected.png](/attachments/small/3/92037daf6101645e42f7718c3f4ccf65.png "align-center") the code I'm currently using is this Private Function CropBitmap(ByRef bmp As Bitmap, ByVal cropX As Integer, ByVal cropY As Integer, ByVal cropWidth As Integer, ByVal cropHeight As Integer) As Bitmap Dim rect As New Rectangle(cropX, cropY, cropWidth, cropHeight) Dim cropped As Bitmap = bmp.Clone(rect, bmp.PixelFormat) Return cropped End Function Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click PictureBox1.Image = CropBitmap(New Bitmap(PictureBox2.Image), 0, 0, 21, 21) PictureBox3.Image = CropBitmap(New Bitmap(PictureBox2.Image), 0, 21, 21, 22) PictureBox4.Image = CropBitmap(New Bitmap(PictureBox2.Image), 0, 43, 21, … +0 Code Snippet Minimum number of bills or coins in change (golang) This Go snippet calculates the minimum number of bills or coins needed for a given amount of money (change) requested. The program also gives the denomination and number. US curency is used in this example, but can be changed to another currency. +1 Code Snippet A slice of prime numbers (golang) Another translation of one of my Python snippets. This function will return a slice of consecutive prime numbers from 2 to a given value limit. In Go the 'int' type (int32) will go as high as 2147483647, but you can replace 'int' with 'uint64' and go as high as 18446744073709551615. +1 Code Snippet A slice of structures (golang) Another little adventure into Go coding. This time a slice (a Go open ended array) of structures is used as a record for some data processing. For those who miss the ; at the end of a line of code, you can use them, but the lexer of the compiler will put them in for you. Go slices are simpler to work with and faster than traditional arrays, even though they use arrays as a backbone. Go was written for efficiency and speed of compilation in mind, it is intolerant of unused imports and unused variables. The reason you will … +1 Code Snippet Denary number to roman numerals (golang) Use Google's modern Go language (aka. golang) to convert a denary number (base 10) to a roman numeral. Just a good exercise to explore Go's map, slice, sort and for loop features. Note that in Go the **:=** is shorthand for assigning a type (by inference) and a value to a variable. A slice is like an array that can grow, and a map is a key indexed list. Go has only the for loop, but the syntax is very flexible and can accomplish all the usual loop duties. +2 Code Snippet Decepticon C# challenge, dates, in Python I did code for challenge that I saw posted for C# by deceptikon: http://www.daniweb.com/software-development/csharp/threads/479304/coding-challenge-string-to-date Here it is. Of course normally the code would be without prints and put in function, but this is enough for now for me. There could also be normalization from '/' separated form not producing ambiguous form, checking for single digit month/day. Notice that reversed order of slice assignement is a must as well as variable holding the original length or that length's format! +1 To continue[ my quiz series](http://www.daniweb.com/search/query/0?q=%22quiz+of+the%22+pytony#gsc.tab=0&gsc.q=%22quiz%20of%20the%22%20pytony&gsc.page=1), explain what happens with this code (how you would name this action and is there other way to get same result), why, and what is actually the value of `a` at end. a = ['a', 'b','e'] a[2:2] = ['c', 'd'] +0 I'm trying to write a program that takes a string and prints one letter per line. I need to use a while loop based on string length. I googled, so sorry for the newbie question. Thanks! +0 I thought to post some not quite so trivial as it looks quiz for Python, to test if your brain has Python installed OK ;) Try to figure out what interpreter answers (#? lines), then check with your Python interpreter of choice: [CODE]>>> a = list(range(10)) >>> a[1:1] #? >>> a[1:1] = a[-2::-1] >>> a #? >>> [/CODE] +2 Code Snippet Text slice and split made easy. Two litle functions to help on text slice and spliting. The code comments say it all. [CODE]# Slicer takes as arguments a tuple containing the string before, # the string after and the string to truncate. It returns the string # between the two given strings Slicer = lambda((b, a, t)): t.partition(b)[2].partition(a)[0][/CODE] [CODE]# Spliter takes as arguments a tuple containing the string before, # the string after and the string to truncate. It returns a tuple # containing the string before, the string between and the string # after the given strings Spliter = lambda((b, a, t)): ((t.partition(b)[0]),) + t.partition(b)[2].partition(a)[0::2][/CODE] … +1

The End.