Skip to content

Instantly share code, notes, and snippets.

View Vistritium's full-sized avatar

Maciej Nowicki Vistritium

View GitHub Profile
Server Error in '/' Application.
A potentially dangerous Request.Form value was detected from the client (name="Firepluk's copied co").
Description: ASP.NET has detected data in the request that is potentially dangerous because it might include HTML markup or script. The data might represent an attempt to compromise the security of your application, such as a cross-site scripting attack. If this type of input is appropriate in your application, you can include code in a web page to explicitly allow it. For more information, see http://go.microsoft.com/fwlink/?LinkID=212874.
Exception Details: System.Web.HttpRequestValidationException: A potentially dangerous Request.Form value was detected from the client (name="Firepluk's copied co").
Source Error:
object Foo {
def bar(f: () => ()): Unit = f()
}
object Foo {
def bar(f: () => ()): Unit = f()
}
case class Foo(a: Int, b: String, c: Float)
object Main {
Foo(a = 1, c = 3, b = "lol")
}
case class Foo(a: Int, b: String, c: Float)
object Main {
val foo = Foo(a = 1, c = 3, b = "lol")
val str = Foo.unapply(foo) match {
case Some((a, b, c)) => s"$a $b $c"
}
2018-04-04 22:45:59.513 Error d.c.d.Dapplication:HandleDispatcherException(201) - System.ArgumentException: An item with the same key has already been added.
at void System.Collections.Generic.Dictionary<TKey, TValue>.Insert(TKey key, TValue value, bool add)
at void Caliburn.Micro.EnumerableExtensions.Apply<T>(IEnumerable<T> enumerable, Action<T> action)
at void Caliburn.Micro.AssemblySourceCache.Install()+(object s, NotifyCollectionChangedEventArgs e) => { } [0]
at void System.Collections.ObjectModel.ObservableCollection<T>.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
at void Caliburn.Micro.BindableCollection<T>.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
at void Caliburn.Micro.BindableCollection<T>.OnUIThread(Action action)
at void Caliburn.Micro.BootstrapperBase.StartRuntime()
at void Caliburn.Micro.BootstrapperBase.Initialize()
at async void Dapplo.CaliburnMicro.Dapp.Dapplication.OnStartup(StartupEventArgs e) in C:/projects/dapplo-caliburnmicro/src/Dapplo.
package vistritium.utils
import akka.NotUsed
import akka.actor.ActorSystem
import akka.stream.Materializer
import akka.stream.scaladsl.{Flow, Sink, Source, StreamConverters}
import akka.util.ByteString
import java.io.{BufferedInputStream, InputStream}
import scala.concurrent.Await
package vistritium.utils
import akka.NotUsed
import akka.actor.ActorSystem
import akka.stream.Materializer
import akka.stream.scaladsl.{Flow, Sink, Source, StreamConverters}
import akka.util.ByteString
import java.io.{FilterInputStream, InputStream}
import scala.concurrent.Await
def pipeThroughInputStream(pipeThrough: InputStream => InputStream)(implicit mat: Materializer): Flow[ByteString, ByteString, NotUsed] = {
Flow.lazyFlow { () =>
val sink = StreamConverters.asInputStream(5.minutes)
val (is, matSink) = sink.preMaterialize()
val source = StreamConverters.fromInputStream(() => pipeThrough(is))
Flow.fromSinkAndSource(matSink, source)
}.mapMaterializedValue(f =>
f.onComplete {
case Failure(exception) => logger.error("error", exception)
case Success(value) =>