5 ms·
This is really exciting!!! I was a bit disappointed that the right-pad will be out only in 2017. I am looking forward to that release because there is a high de
by c4n4rd 11y ago
This is really exciting!!! I was a bit disappointed that the right-pad will be out only in 2017. I am looking forward to that release because there is a high demand for it now.
What kind of load balancing is being used on the back-end?
I called leftpad(str, ch, len) with the length I needed and noticed that is not very scalable because it is blocking.
A better approach I would recommend to those using it is to call the API in a for loop. In my tests, it had performance very close to those I see in C or assembly.
I was a bit turned off that the free version can only handle strings up to 1024 in length. I know you need to make some money, but it is big turn off for a lot of my projects.
Edit: I finally signed up for it but still noticed that I am only allowed to use 1024. I called your customer support line and they said I was calling the API from multiple IP addresses and for that I need an enterprise license. Please help me with this issue, it is very crucial at this point as my project is in a complete stop because of this.
- jameshart 11y agoBest practice for performance for large left-pad jobs is to call the service recursively using mapreduce. Remember that left-pad(str,pad,n) is equal to left-pad(left-pad(str,pad,n/2),left-pad("",pad,n/2),n). This should run in logarithmic time and is highly parallelizable. If you don't like the "" magic string in there you could replace it with a call to left-pad(null, null,0).
- capitalsigma 11y agooh god it's too real
- lucastx 11y agoPoe's law for programming culture extremists
- pajop 11y agoif you put https://api.left-pad.io/?len=1017 https://api.left-pad.io/?len=1017 or anything higher than 1016 it says: {"errorMessage":"len exceeds 1007 characters. Contact a left-pad.io sales engineer for an enterprise license","errorType":"Error","stackTrace":["exports.handler (/var/task/index.js:33:22)"]} wow. they even have an enterprise sales engineer! :)
- paulclinger 11y agoYou should be using emptystring.io instead of the "magic string" or a "null, null" hack.
- rkuykendall-com 11y agoHere you go: https://api.left-pad.io/?len=0 https://api.left-pad.io/?len=0
- kdma 11y agoShouldn't it be leftpad(leftpad (str,pad,n/2),leftpad("",pad,n/2),1)?
- richerlariviere 11y agoThis is why I love Hacker News
- RandomBK 11y agoCan we also get a containerized on-premise version of this service? We'd like the ability to spin up a couple of these behind a load balancer to let us achieve web-scale.
- michaelwww 11y agoYou can get right-pad today by using starboard-pad, which is heavily optimized for marine applications and comes with an open seas license.
- robodale 11y agoI really hope I can get this as a NuGet package. This new LPaaS is the wave of the future!!!1