Why use Mongrel2?

If you could only name one thing then it would be that Mongrel2 is build around ZeroMQ which means that scaling your web server has never been easier. If a request comes in, Mongrel2 receives it (nothing unusual here, same as for NginX and any other httpd). Next thing that happens is that Mongrel2 distributes … Read more

How can I create a secure Lua sandbox?

You can set the function environment that you run the untrusted code in via setfenv(). Here’s an outline: local env = {ipairs} setfenv(user_script, env) pcall(user_script) The user_script function can only access what is in its environment. So you can then explicitly add in the functions that you want the untrusted code to have access to … Read more

How to check if matching text is found in a string in Lua?

There are 2 options to find matching text; string.match or string.find. Both of these perform a regex search on the string to find matches. string.find() string.find(subject string, pattern string, optional start position, optional plain flag) Returns the startIndex & endIndex of the substring found. The plain flag allows for the pattern to be ignored and … Read more

How to fix “NSURLErrorDomain error code -999” in iOS

The error has been documented on the Mac Developer Library(iOS docs) The concerned segment from the documentation will be: URL Loading System Error Codes These values are returned as the error code property of an NSError object with the domain “NSURLErrorDomain”. enum { NSURLErrorUnknown = -1, NSURLErrorCancelled = -999, NSURLErrorBadURL = -1000, NSURLErrorTimedOut = -1001, … Read more