Hacker Newsnew | past | comments | ask | show | jobs | submit | venuzr's commentslogin

Is there a way to extend a running javascript app without restart. Say I have a Single Page APP (built on React if that matters) and I want to allow third party developers to add Components / modules/ themes/ plugins to a registry. I want to be able to allow end users to choose third party plugins from the registry to extend the capabilities of the SPA.

Is this possible? If so, is there any guidance on how to achieve this?

Thanks


Sure it's possible. As an example, Odoo is a full Python webapp "platform", with a core upon which the user can choose and load plugins to add features (from a simple contact list to a full-blown ERP/CRM/accouting/CMS) and extensions to those features.

On the frontend side, when you install a module, it loads the .js file (using a regular <script> tag) which contains a single function. The Odoo core passes its main JS object (the base of the core API) to that function, which then initializes the whole module and uses the Odoo API to configure stuff, setup hooks, etc.

There's no security, though: by design, a module is trusted and can do anything on the platform. I'm not sure if and how one could contain them.

(Disclaimer: I'm a developer working for an Odoo partner, we write modules and host it as a SaaS.)


I don't speak Python, but on the client modules could run in web workers.


I notice that you have a bunch of showcase websites on your site. Do you have any examples/data to show how you either save time and money for the client company / reduce friction?


As someone new to React, I wonder

a) How is this different from getting a custom starter kit/generator from Yeoman. Searching in yeoman, I see several for "React" with the top one having over 9.5k stars http://yeoman.io/generators/

b) Is Facebook planning to maintain and keep this generator current? Why don't they just contribute/recommend an existing generator


This is not a generator. It is a dependency, which means that we can (and intend to!) update the underlying tools without any work on your part.

Additionally, unlike a generator, it doesn’t expose you to any configs so you can focus on your code. However you can “eject” if you really want to.


Are there any patterns / recommended practices for unit testing Typescript. I recently joined a project which uses Angular1 + Typescript and had to introduce unit testing to the code base and it has been painful. A lot of backend API calls (wrapped in services) are being (chained and) invoked in the constructor. Any initialization is being squashed into the constructor. This makes setup of karma tests extremely painful/brittle without a complete refactor for each component. However wrapping initialization code in public methods feel strange to me. Any suggestions?


I don't know exactly what your code looks like, but a major reason for using Dependency Injection, like AngularJS does, is to allow your tests to "mock" the injected services. Then, you verify the behaviour (but not the implementation), by checking that each mock is invoked with the expected arguments, and set it to return a particular value.

On the server side, I've used TypeMoq, which is pretty nice. I have only used it to mock imported modules; for AngularJS 1, you'd need to invoke the "inject" service, to insert your mocks into the controller.

Further reading:

https://en.wikipedia.org/wiki/Mock_object


I have found Angular 1 to be an untestable hot mess, especially on projects with a lot of technical debt. This is largely unrelated to TypeScript (and probably unrelated to Angular 1's shortcomings too).

My only suggestion is start migrating to Angular 2 immediately.


Basic question(s) as I am not a data scientist but have just taken a machine learning course (https://www.coursera.org/learn/machine-learning/ )

Won't trying different combinations of hyper parameters/lambda (over a small range) help us arrive better instead of manually tuning it? Or is that what the author meant by manual tuning?


I'm not a data scientist per se, but I've been working with some (boss and co-worker) to get some stuff operationalized and into production, so I've been responsible for generating inputs, helping analyze/visualize outputs, and building linear optimization models, so I've got some very basic experience.

As I understand it, one of the pitfalls of automatic tuning is that it becomes hard to account for seasonality and you will likely end up with useless parameters - for instance a customer ID is rarely a good parameter to optimize on, even as a categorical variable, except in very specific cases. It is probably a proxy variable for one or more other ones that you need to tease out of the rest of the data.

(warning, potentially me talking nonsense coming up) Automatic tuning is no substitute for a talented analyst who knows the data well and understands the goal. But if you've got hundreds to millions of parameters, you may not have another choice really.


Depends what you're tuning. If it's something like the number of trees in a random forest, definitely do that automatically. If it's the number of clusters in a clustering problem, that's where you'd be asking an expert something like "how many distinct groups of customers do you think we should try to split them into?" and go from there. But even in that scenario, the expert's opinion might just be your starting point for automatic tuning.


Author here: whether the hyperparameter tuning is done automatically or manually is not as important for what I was trying to say here. But yes, any of {grid-search, random-search, bayesian-optimization, etc} is likely to be more effective than manually tuning to squeeze out those last ounces of performance.


Doesn't have to work that way. I am Indian myself but my wife is from a different country (which does not wait times). So the green card was mutually beneficial. Was employment based through my work but was able to use her country of origin.

Just food for thought though not suggesting any course of action. We married for love and found out about about this little pleasant twist later.


Time off is not the only consideration. In a good economy, companies might be queueing up to transfer your H1 visa. In a bad economy (post 2001/2008 recession), if you are looking for a new job, the pickings would be very slim indeed.


I find his drive and his parent's support commendable. Being someone who has not been homeschooled and does not know anyone who has, I am extremely curious about it.

-How does one go about replicating this kind of success? Or even moderate success. In typical schools, you have some measure of whether your child is "succeeding". How does one go about doing the same for home-schooled children.

-How do you go about providing the structure that schools provides towards increasingly complex material which will keep the child engaged and learning at the same time.

Not having children myself but watching my brother's children, I can see that the structure provided for children is extremely important, even for simple things like when to have food, go to bed, practice music etc.

Are there any good resources for raising home schooled children and providing structure?


Extremely important in what sense? What are the specific benefits you see to having a rigid structure? I have a little sister who is in my estimation smart, but spends every waking moment (when not in school or finishing up homework) on her iPad playing video games and watching Youtube videos. I sometimes wonder if a little bit of prodding on the part of my parents would help her find other hobbies.

I personally feel like I suffered from my parent's laissez faire attitude.


Yes. The parent's visa can be transferred, for up to a max of 6 years in length. However, the employer needs to be willing to transfer the visa. Lots of employers are willing to transfer the H1B during a good economy but rare to find an employer who would be willing to do so in a bad economy.

Also, if H1B worker wants long term stability and wants to stay in the US beyond the 6 yr period, then the employer needs to apply for Permanent Residency (Green Card). The H1B worker needs to employed for that employer for the entire duration of that GC process. The icing on the cake is that the H1B worker needs to find new employment within a month of being terminated or leave the US. Again, possible in a good economy but near impossible in a bad one.

All in all, this creates the perfect hostage scenario with H1B workers pursuing stability till they get their green card.


Any tips on how to integrate this with FE frameworks like Angular? Unit/e2e testing?

Thanks for making this.


Cofounder of Streak and helped write a lot of the InboxSDK. I can't give a definitive answer right now because we don't use Angular and thus don't have much experience with it. If you're able to specify a DOM node as the root of an Angular instance then you should be able to make it work.

If you try to make the top html tag as your root you'll probably run into a bad time particularly if other extensions make the same assumption. One major difference between writing an app for Gmail vs your own app is that multiple apps can and usually are running at the same time. This was one of the main motivations behind the SDK since many of our bug reports were a result from extension compatibility issues.

We do e2e testing with selenium/webdriver - so it's definitely doable. Tip for e2e testing is to pay for some extra Google Apps accounts so you can run your tests in parallel.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: