Have [SBT plugin][sbt-plugin] installed
- [Create a new project][create-project] in IDEA ( File > New Project ...)
- Make sure you select a maven module
using System.Linq; | |
using System; | |
using ServiceStack; | |
using ServiceStack.Text; | |
public enum Foo | |
{ | |
None, | |
Test, | |
Bar |
Create an application that: | |
1. Loops 100 times | |
2. Pauses for 200ms each loop | |
3. Writes 'Fizz' to the console when loop count is divisable by 2 | |
4. Writes 'Buzz' to the console when loop count is divisable by 5 | |
5. Writes 'FizzBuzz' to the console when loop count is divisable by both | |
Extra | |
Setup project to write a unit test using NUnit, walk through project steps you need to enable this. |
import solcast | |
# Fetch latest PV power forecast | |
pv_power_resp = solcast.get_pv_power_forecasts(-35, 149, capacity=2000, tilt=23, azimuth=0, api_key='INSERTYOURAPIKEYHERE') | |
# Print soonest PV power forecast | |
print(pv_power_resp.forecasts[0]['pv_estimate']) |
using ServiceStack; | |
using ServiceStack.Text; | |
using ServiceStack.OrmLite; | |
using ServiceStack.OrmLite.Sqlite; | |
using ServiceStack.DataAnnotations; | |
var dbFactory = new OrmLiteConnectionFactory(":memory:", SqliteDialect.Provider); | |
var db = dbFactory.Open(); // Open ADO.NET DB Connection | |
public class Foo |
#!/bin/sh | |
export PATH=/usr/local/bin:$PATH; | |
yum update | |
yum install docker -y | |
service docker start | |
# Docker login notes: | |
# - For no email, just put one blank space. | |
# - Also the private repo protocol and version are needed for docker | |
# to properly setup the .dockercfg file to work with compose |
using System; | |
using ServiceStack; | |
using ServiceStack.Text; | |
public class GetPersonResponse | |
{ | |
public string FirstName { get;set; } | |
public string LastName { get;set; } | |
public int Age { get;set; } | |
public string PostCode { get;set; } |
using System; | |
using ServiceStack; | |
using ServiceStack.Text; | |
public class GetPersonResponse | |
{ | |
public string FirstName { get;set; } | |
public string LastName { get;set; } | |
public int Age { get;set; } | |
} |
Auto mapping it a helpful utility in ServiceStack that allows you to easy populate different classes with the same structure allowing you to keep appropriate separations whilst reducing lines of code.
For example, it's common in ServiceStack to keep your request and response DTO classes separate from others like your OrmLite model classes or other logic classes even thought they might share the same structure.
public class GetPersonResponse
{
public string FirstName { get;set; }
using System.Linq; | |
using ServiceStack; | |
using ServiceStack.Text; | |
using ServiceStack.Redis; | |
var redisManagerPool = new RedisManagerPool("localhost:6379"); | |
using(var client = redisManagerPool.GetClient()) | |
{ | |
client.Info.PrintDump(); |