examples

ScalaCheck custom generator examples alvin February 8, 2019 - 5:48pm
Table of Contents1 - Custom generators2 - Built-in ScalaCheck generators3 - How to use ScalaCheck generators4 - More ScalaCheck generators

Writing custom generators for ScalaCheck can be one of the more difficult and/or time-consuming parts of using it. As a result I thought I’d start putting together a list of generators that I have written or seen elsewhere. Unfortunately I can’t credit all the ones I’ve seen in other places because I google’d and copied them many moons ago, but I’ll give credit/attribution to all the ones I can.

Back to top

Custom generators

This is a combination of generators I wrote, and some that I copied from other places and may have modified a little:

Kotlin collections methods: examples and syntax alvin November 14, 2018 - 10:23am

As a quick note today, if you ever need some examples of how the Kotlin collections methods work, I hope these examples are helpful.

Sample data

First, here’s some sample data:

val a = listOf(10, 20, 30, 40, 10)
val names = listOf("joel", "ed", "chris", "maurice")
Scala while and do/while loops (syntax, examples) alvin July 26, 2018 - 1:17pm

Once I got into functional programming I generally quit using while loops and do/while loops in Scala, but the language has both of them. Here’s the general syntax:

A gallery of 130+ Gimp filters/effects examples

There are times when I work on images a lot with Gimp, and then there are times when I don’t work with Gimp for a month or two. When I don’t work with Gimp a lot, I tend to forget about all of the different things I can do with. Therefore, I have created this page as a “Gimp special effects cheat sheet” page to help remind me of all the cool things I can do with Gimp effects.

Play Framework: Anorm SQL query syntax and examples

Table of Contents1 - Anorm2 - More background ...3 - A note about my coding style4 - SQL SELECT queries5 - A brief intermission6 - SQL INSERT with primary key (auto increment)7 - SQL INSERT with no primary key8 - SQL UPDATE9 - SQL DELETE10 - Complete example methods11 - A complete class12 - More information

In general the online Play Framework documentation is excellent, but one area where I needed more help was in seeing more examples of the Anorm syntax. To that end, here are some Anorm query examples, taken from a Play Framework application I worked on recently. But first, a little background about Anorm.

Scala number, date, and formatting examples alvin February 27, 2018 - 10:15pm

This short blog post contains a collection of Scala number and date examples. I created most of these in the process of writing the Scala Cookbook. Unlike the Cookbook, I don’t describe the examples here much at all, I just show the examples, mostly as a reference for myself (and anyone else that can benefit from them).

Scala numeric types

Scala has these numeric types:

Scaladoc syntax examples (Scaladoc tags, wiki markup) alvin January 18, 2018 - 8:08pm
Table of Contents1 - An example of Scaladoc tags and wiki formatting2 - Sample Scaladoc output3 - Common tags4 - Scaladoc “wiki” character formatting tags5 - Scaladoc “wiki” paragraph formatting tags6 - Generating Scaladoc documentation with SBT7 - See Also8 - The Scala Cookbook

In this article I share some examples of Scala’s Scaladoc syntax, including common Scaladoc tags, and the wiki-style of markup that Scaladoc supports.

 

(this space left open to make room for the table of contents over there -->)

 

Back to top

An example of Scaladoc tags and wiki formatting

You can mark up your source code using Scaladoc tags as well as a wiki-like syntax. The following code shows many of the Scaladoc tags and a few of the wiki-style markup tags:

Added a few more lessons to “Hello, Scala” alvin December 21, 2017 - 5:41pm

Just added a few more lessons to “Hello, Scala” including tuples, Scala + Swing, and a complete little OOP example. Also started a Github repo for it.

Hello, Scala (Scala tutorial website) alvin December 17, 2017 - 7:34pm

It’s still a work in progress, but I’m creating a Hello, Scala website as a simple, quick introduction for those interested in learning Scala.