News for hackers. Stuff that matters.
Re:Left-pad as a service by c4n4rd on Thursday March 24, 2016 @08:49AM (#11352315)
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.

Re:Left-pad as a service by jameshart on Thursday March 24, 2016 @09:11AM (#11352427)
Best 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).

Re:Left-pad as a service by paulclinger on Thursday March 24, 2016 @01:48PM (#11354817)
You should be using emptystring.io instead of the "magic string" or a "null, null" hack.
Re:Left-pad as a service by rkuykendall-com on Thursday March 24, 2016 @02:45PM (#11355279)
Re:Left-pad as a service by capitalsigma on Thursday March 24, 2016 @11:22AM (#11353491)
oh god it's too real
Re:Left-pad as a service by lucastx on Thursday March 24, 2016 @10:14PM (#11358074)
Poe's law for programming culture extremists
Re:Left-pad as a service by pajop on Monday March 28, 2016 @11:58PM (#11379390)
if you put 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! :)

Re:Left-pad as a service by kdma on Thursday March 24, 2016 @05:59PM (#11356823)
Shouldn't it be leftpad(leftpad (str,pad,n/2),leftpad("",pad,n/2),1)?
Re:Left-pad as a service by michaelwww on Thursday March 24, 2016 @04:31PM (#11356171)
You can get right-pad today by using starboard-pad, which is heavily optimized for marine applications and comes with an open seas license.
Re:Left-pad as a service by RandomBK on Thursday March 24, 2016 @04:10PM (#11356026)
Can 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.
Re:Left-pad as a service by richerlariviere on Thursday March 24, 2016 @01:44PM (#11354770)
This is why I love Hacker News
Re:Left-pad as a service by robodale on Friday March 25, 2016 @02:31PM (#11361802)
I really hope I can get this as a NuGet package. This new LPaaS is the wave of the future!!!1