This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class RabbitMQEventNotifier(host:String, exchange:String, routingKey:String, username:String, password:String, virtualHost:String) | |
| extends EventNotifier with Serializable { | |
| private def createChannel () = { | |
| val factory = new ConnectionFactory() | |
| factory.setUsername(username) | |
| factory.setPassword(password) | |
| factory.setVirtualHost(virtualHost) | |
| factory.setHost(host) | |
| val connection = factory.newConnection() | |
| connection.createChannel() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using Contra; | |
| namespace ConsoleApplication8 | |
| { | |
| public interface Envelope<out T> {T Message { get; } } | |
| public class MessageEnvelope<T> : Envelope<T> | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ``` | |
| get_some_data(paramThingy) = | |
| SomeActor ! {self(), {get_stuff, paramThingy}, | |
| receive | |
| {From, Res} -> Res | |
| end. | |
| ``` | |
| %% client code deals with interface paramThingy -> resultType. Simple / complicated / hierarchical / fault tolerant processing via messages is done underneath. But client code can deal with the api without knowing all messaging nitty - gritty. Since it's all async, and Erlang does selective receive, this "blocking" (it's really non-blocking async) code isn't problematic. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var person = function(opt) { | |
| var obj = {} | |
| obj.name = opt.name || "NA"; | |
| obj.age = opt.age || "NA"; | |
| obj.getDescription = function(){ | |
| return this.name + " " + this.age; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Threading.Tasks; | |
| namespace NDSandbox | |
| { | |
| class Program | |
| { | |
| static void Main(string[] args) | |
| { | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Tried: | |
| Distros: Ubuntu 15.10, Linux Mint, Arch. | |
| 1. With BIOS SATA Operation = Raid: Nothing booted. Live USB boot for ubuntu started, but then stalled. | |
| 2. With SATA Operation = AHCI: | |
| Ubuntu: Booted "Try Install" with nomodeset in grub. Installation started, and never finishes. Gets quite far. | |
| Arch: Won't boot. | |
| Linux Mint: Try mode installer boots, but can't see hard drive, and no network to get drivers. | |
| 3. With SATA Operation = Disabled: | |
| Ubuntu installs. Synaptics touchpad doesn't work. Machine runs hot, and 81Wh battery depletes in under three hours. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 1. Large array (yes, allocate. unmanaged mem can work even better, but ok with managed). | |
| 2. Have a "marker" for each writer and each reader. | |
| 3. Treat array as a circular buffer. Writers write messages and progress write marker. Up to the point where array size isn't filled. | |
| 4. Readers read till there are messages. | |
| 5. Have a reader for each handler. Each handler reads all written messages, but processes those that match criterion (type code, clr type, whatever). | |
| 6. Array entries can be cache aligned (i.e. struct with layout padding to 64B). | |
| Easiest to get running is single producer, multi consumer. Should get 100s of millions per sec on moderately powerfull hardware. | |
| 1PMC can be done pretty much lock free. For multi producers, there are ways to make it lock free (i.e. allocate sections of stretches for |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| E:\dev\Trash\sbtSand2> sbt compile | |
| Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0 | |
| [info] Loading project definition from E:\dev\Trash\sbtSand2\project | |
| [info] Set current project to sbtSand (in build file:/E:/dev/Trash/sbtSand2/) | |
| [info] Updating {file:/E:/dev/Trash/sbtSand2/}sbtsand2... | |
| [info] Resolving org.apache.hadoop#hadoop-mapreduce-client-app;2.2.0 ... | |
| [warn] Host repo1.maven.org not found. url=https://repo1.maven.org/maven2/org/apache/hadoop/hadoop-mapreduce-client-app/2.2.0/hadoop-mapreduce-client-app-2.2.0.pom | |
| [info] You probably access the destination server through a proxy server that is not well configured. | |
| [warn] module not found: org.apache.hadoop#hadoop-mapreduce-client-app;2.2.0 | |
| [warn] ==== local: tried |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #/bin/bash | |
| echo "installing jdk 8.........................." | |
| add-apt-repository ppa:webupd8team/java | |
| apt-get update | |
| echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | sudo /usr/bin/debconf-set-selections | |
| apt-get install oracle-java8-installer -y | |
| apt-get install oracle-java8-set-default -y | |
| echo "..........................jdk 8 installed." | |
| apt-get install libjna-java | |
| echo "..........................jna setup complete." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.time.OffsetDateTime | |
| import Model._ | |
| import cats.{Id, ~>} | |
| import cats.free.Free | |
| object Model { | |
| case class Property(id:Int, title: String) | |
| sealed trait AppAction[A] { |