HNHacker News
TopNewBestAskShowJobs

jotto

1,306 karma · joined March 25, 2007

https://headless-render-api.com/
submissionscomments
jotto··on URL to PDF Microservice
By default: if Headless Chrome hits a redirect to a file:// it returns: net::ERR_UNSAFE_REDIRECT

window.location.href = 'file:///' will return console error: "Not allowed to load local resource"

jotto··on URL to PDF Microservice
We've been dealing with scale for over a year at https://www.prerender.cloud/docs/api if you want to try a hosted service:

https://service.prerender.cloud/screenshot/https://google.co...

https://service.prerender.cloud/pdf/https://google.com

jotto··on Rendertron – a dockerized, headless Chrome rendering solution
I've been working on a similar project - if you want a similar solution with a little less setup, navigate to your build/dist directory and:

  npm install -g prerendercloud-server
  prerendercloud-server .
If you want to run your own rendertron instance as opposed to service.prerender.cloud, you can use that same package with an environment variable:

  PRERENDER_SERVICE_URL=http://localhost:8080 prerendercloud-server .
https://www.prerender.cloud/docs
jotto··on Vue.js vs. React

  <div id='root'></div>

  <script src='https://cdnjs.cloudflare.com/ajax/libs/react/15.6.1/react.js'></script>
  <script src='https://cdnjs.cloudflare.com/ajax/libs/react/15.6.1/react-dom.js'></script>
  <script src='https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.38/browser.min.js'></script>

  <script type='text/babel'>
    const App = () => <div>Hello World</div>;
    ReactDOM.render(<App />, document.getElementById('root'))
  </script>
jotto··on Puppeteer: Headless Chrome Node API
> Crawl a SPA and generate pre-rendered content (i.e. "SSR").

I've been maintaining (thanks to this team and Headless Chrome) a convenience API based on this feature. Some additional features:

  * React checksums for v14 and v15 (v16 no longer uses checksums)
  * preboot integration for clean Angular server->client transition
  * support for Webpack code splitting
  * automatic caching of XHR content
https://www.prerender.cloud/

and for the crawling or to delegate your single-page app hosting and server-side rendering entirely https://www.roast.io/

jotto··on Show HN: Chromeless – Headless Chrome Automation on AWS Lambda
(Shameless promoting): for an API version of the prerendering functionality, with no warm-up latency, we're running a large cluster of Chrome headless instances here: https://www.prerender.cloud/
jotto··on Chrome 59 with TurboFan is Sometimes Slower than 58
You could indeed do that, it's just more work. The beauty of server-side rendering a React app in a headless browser is that since the environment is the same as what the app was originally designed for (a browser), things _just work_.

For example: you load the app in your headless browser and let it load as would in any browser. The browser fires some events and XHR/WebSocket requests and you can cleanly wait for them to finish as opposed to doing something like this: https://techbrunch.gousto.co.uk/2016/10/10/isomorphic-react-... which requires you to do some extra configuration in your app to help support a Node environment.

TL;DR: ReactDOMServer.renderToString won't wait for your async requests to finish, you need them to execute and finish before you call renderToString

jotto··on Chrome 59 with TurboFan is Sometimes Slower than 58
Because rendering in a Node process is more complicated when async state is involved - using a browser eliminates that complexity. For simpler apps without any async state (AJAX or WebSockets), a Node process may suffice.
jotto··on Chrome 59 has cross-platform headless support
I've been successfully using Chrome headless in a 500MB Docker container for dumping the DOM for https://www.prerender.cloud/ for months (rendering a large variety of sites without restarts for weeks at a time)

Run it with:

  --js-flags="--max_old_space_size=500"
to force the VM to keep it GC'd below 500

Chrome v55 was a 30% memory savings, before that I used 1GB containers.

It's not perfect, but I am definitely pushing high volume (multiple tabs, concurrent activity) and I am not having any significant stability issues and I am pushing diverse sets of webpages.

jotto··on PhantomJS 2.5.0 beta
shameless plug: I'm already using headless Chrome for https://www.prerender.cloud/ and it's amazing (just building it from source https://docs.google.com/document/d/1a9cdsljKxCSreR2LDE3KErJh...)
jotto··on Ask HN: Are there any solid arguments against SPAs in 2017?
The SPA frameworks and web APIs available to us now are pretty good - browserHistory as you mention, is available via `window.history.pushstate` and abstracted away for you in most SPA frameworks.

> If built poorly, all of the browser features you've come to rely on break

Alternatively phrased: "you may have to learn some new APIs"

But the SEO can be an issue (Google is not consistently executing AJAX) and render performance is definitely an issue.

I made https://www.prerender.cloud/ to address the SEO and rendering performance but that still doesn't make SPA the obvious choice.

Do you need a rich client experience? ( a UI that continuously updates to reflect the state of a data store, or more generally, a complicated UI that doesn't do a hard page refresh ) If yes, then SPA is the better solution.

If you just need a non-interactive set of pages (a blog), then a SPA probably isn't the answer.

> If not, 10MB of the hottest new JS framework may not be for you...

What hot new JS framework is 10MB? React is ~60kb gzipped

The auth frameworks (auth0.com or AWS Cognito) are large though, ~150KB gzipped. But with code splitting you can eliminate that from your main page. Or you can move the auth part of your app to a subdomain (app.example.com) and keep example.com lightweight w/out auth0/cognito)

jotto··on Does Google execute JavaScript?
If you don't want the deal with the ambiguity of whether your AJAX will run or not, I'll shamelessly suggest https://www.prerender.cloud/ which is helping a few sites who couldn't get Google to execute their AJAX.
jotto··on Lambda@Edge – Preview
For anyone needing a minimal effort prerendering solution (server side render for most JS frameworks), i.e. the use case described by Jeff - I made https://www.prerender.cloud/

(you could use the prerendercloud npm middleware from the lambda edge)

jotto··on Show HN: StockDroids.com – A curated list of near-stock Android devices
I made https://www.prerender.cloud/ and it _might_ be useful here - that is, solving that initial 3.3mb loading penalty for the JS. But it may require removing your loading screen so the screen doesn't flash to loading after the initial prerendered payload comes down.
jotto··on Ask HN: What simple tools or products are you most proud of making?
After making a React app for a hackathon in August, I was surprised I couldn't paste a link on Twitter and see a URL preview, thus began https://www.prerender.cloud/ - middleware that runs your single page app through a chromium browser to generate the HTML markup and return it along with the original JavaScript to the client (so the first browser paint happens quickly from the HTML, then JavaScript takes over after it finishes parsing)
jotto··on Ask HN: What is your goto resource for learning about big data, ML, AI etc?
similar question was just asked 2 weeks ago:

    Ask HN: How to get started with machine learning?
https://news.ycombinator.com/item?id=12713056
jotto··on AWS Lambda vs. EC2 Latency (API Gateway is very slow)
(almost instead of completely useless) because there's still a ~50ms Lambda penalty
jotto··on AWS Lambda vs. EC2 Latency (API Gateway is very slow)
You're right, and I agree it isn't apples to apples. I am still looking for ways to break the 150ms TLS handshake barrier (let me know if you have)

My intention was merely to point out the difference between bare/raw HTTP on ec2 vs API Gateway (which is only HTTPS).

But this comparison is in fact almost useless because the world is moving to HTTPS everywhere.

jotto··on Response from Google Tech Lead, Re: “Google May Be Stealing Your Mobile Traffic”
The problem is that if you don't play by their "standard box" rules, you may not end up in the truck at all.

The users browsing the AMP results may never feel compelled to scroll down to see non AMP results.

So a publisher's choice isn't: "standard size for faster delivery", it's: "use AMP or receive less traffic than you're currently receiving"

jotto··on React.Js: Achieving 20ms server response time with Server Side Rendering
Not supported, as in, the react-devtools that rely on it could break at any moment? Or just that you don't officially document the API?
jotto··on React.Js: Achieving 20ms server response time with Server Side Rendering
> After peeling through the React codebase

Except you don't have to peel through their code base or intercept any calls, they expose a clean interface for this: https://github.com/facebook/react-devtools

You can capture it like this:

  window.__REACT_DEVTOOLS_GLOBAL_HOOK__.inject = function(obj) {
    // obj.Mount
  }
Which is how we're doing SSR at https://www.prerender.cloud/ for compatibility across React versions.
jotto··on Ask HN: How to get started with machine learning?
Yes, you can use TensorFlow directly and not know much, here are more examples https://github.com/aymericdamien/TensorFlow-Examples

It's OK to jump in and try it without having background information. See how far you get and start researching when you hit a wall or find sudden interest.

jotto··on Ask HN: How to get started with machine learning?
If you want to jump right in with "hello world" type TensorFlow (a tool for machine learning), see https://news.ycombinator.com/item?id=12465935 (how to fit a straight line using TensorFlow)

If you like to study/read: the famous Coursera Andrew Ng machine learning course: https://www.coursera.org/learn/machine-learning

If you just want course materials from UC Berkeley, here's their 101 course: https://news.ycombinator.com/item?id=11897766

If you want a web based intro to a "simpler" machine learning approach, "decision trees": https://news.ycombinator.com/item?id=12609822

Here's a list of top "deep learning" projects on Github and great HN commentary on some tips on getting started: https://news.ycombinator.com/item?id=12266623

If you just want a high level overview: https://medium.com/@ageitgey/machine-learning-is-fun-80ea3ec...

jotto··on Reid Hoffman at Startup School [video]
Altman keeps the dialogue focused and Hoffman actually gave candid answers. The two of them together run through the pillars of starting a company (having a hypothesis, testing it, MVP, distribution and strategizing about funding)

My favorite part is Hoffman suggesting to know when to quit or look a reason to stop/quit and pivot or move on. Altman however, presents himself as he is well known for, and as PG has corroborated: tenacious/persistent. Hoffman responds to this with with what he calls "flexible persistence" - when founders have conviction with their own theory/vision but still the ability and willingness to listen to guidance. More specifically he suggests re-evaluating the original hypotheses and proposing slight alterations.

jotto··on Cable news
see DanielBMarkham's comment from yesterday regarding Facebook's trending news: https://news.ycombinator.com/item?id=12700183
jotto··on Baby Steps into Genetic Programming (2011)
Previous discussion: https://news.ycombinator.com/item?id=2116156
jotto··on Going Serverless: Migrating an Express App to AWS API Gateway and AWS Lambda
The "0 to 1" workflow right out of AWS could not be easier, they have an in-browser code editor with a hello world already written for you.

But that workflow doesn't make sense for real dev teams. So there's https://github.com/serverless/serverless . It's driven by a yaml file and is intuitive.

The only thing I'm bothered by is lack of environment variables (have to hard code them) and terrible API Gateway latency - see https://news.ycombinator.com/item?id=12681926 further down the page

jotto··on Going Serverless: Migrating an Express App to AWS API Gateway and AWS Lambda
Actually I was making the point that they are not "relatively quick" even when hot: close to 300ms, almost entirely due to the API Gateway. (I even measured API Gateway on top of bare ec2 and the same penalty applies).

Lambda itself is fairly quick (~75ms), but API Gateway needs some work.

jotto··on Going Serverless: Migrating an Express App to AWS API Gateway and AWS Lambda
I measured the actual latency over the weekend [0] [1]

Bare ec2: 15ms

Lambda via API Gateway: 276ms

[0]: http://prerender.cloud/lambda-latency [1]: https://news.ycombinator.com/item?id=12678011

jotto··on AWS Lambda vs. EC2 Latency (API Gateway is very slow)
This was in response to TJ Holowaychuk's blog post: "Blueprints for up" https://medium.com/@tjholowaychuk/blueprints-for-up-1-5f8197... (running express/connect as a child process of Lambda)

and curiosity as to how far Lambda is from being used for anything latency sensitive - but it turns out Lambda isn't the slow part - it's API Gateway.

← PreviousPage 3 of 7Next →