I have a requirement where i have a config file which has a bunch of properties. The user has to download the property file from the server using a browser. Some of these properties have to be changed based on the user's input and then the file has to be downloaded. This basically fits the perfect description of having templates and then at run time generating a file by replacing the properties provided by the user. How can i achieve this using node js. Any pointer will be deeply appreciated. Please pardon my limited knowledge of MEAN stack.
Template engines are a common thing and it's quite easy to use one with express.
I suggest you start with the docs on using template engines with express. They also have a wiki entry with a list of available engines.
Most template engines are meant to generate HTML, if you want to output something else (even plaintext) it can be a bit tricky sometimes.
Otherwise the choice mainly depends on what your familiar with. I can recommend Mozilla Nunjucks.
Related
I want to create a website which consists of videos which will be uploaded by the admin and many useful information which all will be uploaded by an admin.
I have got the domain name, remote LAMP server.
I have gone through many tutorials and I tired creating using Drupal 8. Website was fine but while creating a new existing module the whole thing got crashed and I don't want to goback and recover it since it is a big mess.
So I want to try from first keeping it very simple.
Kindly guide me to achieve this. I will put all my effort to learn it.
Any help any documents which will help me to create will be greatly accepted.
I am beginner in C++, html. Can you guys let me know how can I achieve in creating a website.
You can find your answer here on your own:
So there are various languages that are being used in the web that perform various purposed and hence you can choose what functionality do you need in your website and according to that you can write the code in that language.
Lets take a quick look at some of the most widely used languages of the web:
1: HTML
This is a Markup Language which can be used basically just for writing the content and displaying on your webpage. You can create too many pages and link them to form a website.
2: CSS
This language helps you design your webpage and thus makes your webpage look way too better. A site only written in html in not preferrable.
3: JavaScript
This language is a scripting language that helps you do various cool stuff like handling input events (like click, hover,etc), change the content of your webpage dynamically, bring popups , etc.
4: PHP
This scripting language is also being widely used as this lets you work with the forms and submit to a database. In fact, if you learn this language you can write the logic behind your own facebook and you can give it a face using HTML, CSS.
Once you are done learning all these languages, you can now learn some of the cool libraries like:
Bootstrap (for css, js)
Jquery (Javascript)
Is there any library that can parse and generate a PNG from a Doc, Docx and PDF file?
We're implementing a training system using Node, Sails.js, Express and SQL and would like to generate some PNG image tiles for training modules based on a file upload.
I've done some searching and found some libraries in C# that can do all 3, as well as a just PDF impementation for Node but can't find anything that does more than that.
A point towards any 3rd party libraries or standard implementations of this method would be great.
Thanks
You can do that sort of stuff with C# (probably only on Windows) because C# is from MS stables, the same stable that churns out doc and docx. I am not sure whether the same implementation would work on Linux or Mac (even with Mono).
If you want to achieve this in NodeJS, just create the app in C#, wrap it in a ReSTful cover and call this ReSTful service in NodeJS (via Kue or something similar).
Honestly, converting file formats is a compute intensive process process. I wouldn't recommend it doing it the same main thread any way. If you're anyway gonna spawn a worker, you might as well do it in C# where it's perhaps faster.
Not necessarily an exact match for your requirement, but since you mentioned training purpose, I would recommend Watson Developer Cloud - it has document conversion among many other features which may be relevant and useful for your objective as a whole.
Speaking of the current problem, please see Document conversion overview to see how we can convert a PDF into a desired format such as HTML. Then you could actually get the PNG files from the HTML resource bundle.
Hope this helps.
YUI user guides are really nice, please visit http://yuilibrary.com/yui/docs/event/ for example,I just wanna write documents like that. My question is: these documents were generated by some tools like Dockbook,Sphix or written by hand?
The YUI User Guides are generated from Mustache templates using a tool called Selleck. Selleck is a Node.js tool that generates pages from different templates based on the information provided in a component.json file and a predefined folder structure. One of the coolest features of this tool is that it has a --server mode which runs a local web server in which you can see the changes you made live by just refreshing the page.
You can check it out at http://yui.github.com/selleck/.
I am looking into the simplest way to integrate Wikipedia into a node.js app.
The requirements are to be able to search for entries and find entities in each entry.
Any known existing libs/methods for that?
Thanks
There's a newly available open source parser for wiki text (http://sweble.org/) that might be useful to you if you roll your own solution. Of course that would require you downloading the wikipedia data dump, parsing, and storing entities in a db.
You could also look at dbpedia (http://dbpedia.org/About), though that would require integrating the rdf stack into your app (either running a local rdf repository or communicating with the often flaky online version via sparql).
One easy approach is to use a search engine api and restrict to site:wikipedia.org - e.g:
http://www.google.com/search?q=node.js+site%3Awikipedia.org
I've found that can work really well.
Spider for scraping using jquery is fantastic:
https://github.com/mikeal/spider
Mikeal is the man
Presumably you'd be using this for a side (personal) project though. Not sure how kosher it is to run wild on wikipedia with a scraper.
We have a medium sized .js file that we include in our web framework that I am porting over to SharePoint. However, I'm not sure how to go about this or what the best practice is. This is for a framework solution that will be used by other client projects, so it's best for it to be self contained and deploy-able, rather than requiring manually deploying files to the webserver.
My current thinking to put the JavaScript into an embedded resource and then use the script manager to write out the file. Does this seem reasonable? Or does anyone have any other recommendations?
Embeded resource is the best way and you don't need to use the ScriptManager to render it out (as AJAX is not configured OoB on SharePoint), you can just render it as any other client script resource (through the ClientScriptManager).
Best idea is the have an if ContainsScriptManager else UsClientScriptManager style.
That way you get the best of both worlds
You could just toss it into a doc library.
If you are packaging your web part into a sharepoint solution, you could include it as a Module (VSEWSS item). Your manifest file would get something like:
<TemplateFiles>
<TemplateFile Location="LAYOUTS\somescript.js" />
</TemplateFiles>
Theres lots of info on how to do this on the web. I've liked the doc library option for images, css, and javascript because I don't have to rebuild and wait for for SP to JIT compile for 30 seconds each time I do a minor tweak to some style or script. I just edit these things in SPDesigner right out of the doc library.
Create resource mapped folder in your project and put the js file there and give the referene of the js file as _layout/jsfilename.js and this js file will be deployed with your project where ever you will deploy it.