2,159 karma · joined May 12, 2011
[ my public key: https://keybase.io/mark242; my proof: https://keybase.io/mark242/sigs/nJ2IAh2nEXLlnolJOnWEDYJT48SvfBE0w9dqQoQ4d0Q ]
The phone you're reading this post on has nearly as many CPU cycles available to run code as the web server that generated the html. Why on earth would you not want to distribute the overall application load.
https://github.com/jquery/jquery/blob/2d4f53416e5f74fa98e0c1...
...only with a ton of wrapper code around it in order to support IE9 and below. If you don't have to support ancient browsers, there's no reason you can't write QSA code.
var nodes = document.querySelectorAll("li"); for(var i=0; i<nodes.length; i++) { nodes[i].classList.add("foo"); }
Yes it's slightly more code. It's also going to run a hell of a lot faster on, eg, a mobile device.
edit: Okay, it's 800 new connections per second, per the ELB pricing page, under "LCU details". The cost for 80k connections in an hour is effectively constrained by the bandwidth, eg if there's very low bandwidth it's $0.006/hour or $4.32/month.
End-to-end encryption is the system whereby the moment the message leaves the sender's hands (phone, desktop, whatever) it's encrypted until it gets into the receiver's hands. This is your OpenPGP/etc. You could think of that as "Signal for email". This is apparently not what Magma is doing.
Here's the relevant line from Github:
https://github.com/lavabit/magma/blob/develop/src/providers/...
You can see that Magma is writing the email message to a file and instructing ClamAV to scan the file. This is actually worse than writing to a clamd socket, since (imho) it would be easier for someone to monitor a directory in a filesystem on a compromised Magma server.
Compare this to how SpamAssassin communicates with ClamAV-- it streams to either the port or socket:
It is far, far easier to add nodes to a Cloudant/Couch2 cluster, set up realtime replication from db1 -> db2, then once the replication has caught up, at your leisure you switch your database connection in your app.
I just now ran a Carfax report and found no fewer than 7 electric Ford Focus cars within 50 miles of my zipcode for less than $15k used. Two of them are less than $10k. Not sure what "affluent" means to you.
This may be practical from a storage standpoint but string-based indexes on an SSD are pretty damned efficient.
It's a one-dimensional value, make it a one-dimensional control. Slider. Done.
val myOptionalVar: Option[String] = functionThatReturnsOption()
myOptionalVar match {
case Some(str) if str.length > 10 => System.out.println("This is a long string.")
case Some(str) => System.out.println("This is a short string.")
case None => System.out.println("This code would be fifteen lines of null checking in Java.")
} functionThatReturnsAnyVal match {
case i: Int if i > 2 => System.out.println("Greater than 2")
case i: Int => System.out.println("Less than or equal to 2")
case s: String => System.out.println("Hello, " + s)
case _ =>
}https://github.com/verekia/js-stack-from-scratch/blob/master...
...in order to replicate dispatchEvent and addEventListener?
If the author is concerned, the way to express this to be more expressive could be something like this:
val uidOpt: Option[Long] = request.cookies.get("uid") map {
case Some(uidStr) if uidStr.toLong > 0 => Some(uidStr.toLong)
case _ => None
}Yes, because if you're typing the word null in your Scala code you're doing something wrong. Any Java library that might return null should always be wrapped in an Option, so that you're dealing with Some or None, and you never get an NPE.
Option(myJavaLibraryFactoryMethodUsers()).flatMap(_.sortBy(- _.age).headOption)
...will get you an Option[User] of the oldest user. People who have written Scala for more than six months can immediately recognize what this line of code does, and it eliminates around 20 lines of equivalent Java (or Go?) code. This kind of thing rarely needs to be refactored.https://developer.apple.com/library/content/samplecode/SMJob...
Step 2 and 7 are fairly standard behavior for an application that is meant to be running at all times, eg a persistent chat app. Even something like GPG installs files into /Library/LaunchAgents. The location of the directories in question shouldn't set off a warning flag about whether an app is "shady" or not.
In Scala, the debate between using fold on an Option or using map and getOrElse is almost as old as the language. The method signature for this is:
def fold[B](ifEmpty: => B)(f: (A) => B): B
That is to say, fold always returns type B, and takes two arguments. The first takes a function returning type B if the option is "empty" (None) and the second takes a function that is called with the contents of the Some. As you can see, it's syntactic sugar for map and getOrElse. def map[B](f: (A) => B): B
def getOrElse[B](f: => B): B