This is a problem on Free Code Camp that I'm trying to solve but no one can help me on the help box there, it seems. The problem is something that should be very straightforward but I just cannot see what the problem is.
I'm doing the Random Quote Generator challenge and decided to create my own .json file on my own web space to get the quotes from. Such test files can be found here:
http://www.deanius.co.uk/json/cats.json
http://www.deanius.co.uk/json/RandomQuoteGenerator.json
http://www.deanius.co.uk/json/RandomQuoteGenerator_original.json
I thought the easy way to test whether or not this data (which is parsed correctly) can be obtained would be to change the path in the Free Code Camp lesson called "Get JSON with the jQuery getJSON Method", which can be found at https://www.freecodecamp.com/challenges/get-json-with-the-jquery-getjson-method ... thinking the simple solution is add the code on the left where it says ("Only change code below this line") and change the /json/cats.json to one of the paths above.
But... even when I change the path to just the http://www.deanius.co.uk/json/cats.json one (which is the exact same data as /json/cats.json) it does nothing. I thought this could be a limitation of FCC's testing abilities so took the JS and HTML from the lesson and stuck them in their respective boxes in Codepen, with the jQuery.min.js external script added. It still does nothing.
There's got to be a very simple answer to this. Does anybody know what it is?
Thanks
Related
Intro
Hi, I was looking for answer in the whole Internet (in some way I kind of feel that I know every question in Stack Overflow), but the answers were never appropriate to what I'm looking for. I was trying to avoid posting question here, but situation forced me to do this.
Sorry if the answer is simpler than I think.
I'm in the middle of building my first app in Electron using JavaScript. I think that I should describe it in few words, so flam:ngo™ (which is projects name) should work like this:
User will upload two files:
file with tables (like XLSX or DOC)
file with data and blank spaces (which will be used as a template)
App will import from tables.
Now app should let user choose which rows he's interested in and where in uploaded file he wants them to be placed.
flam:ngo save document in PDF (or DOC).
Clue
Right now I need solutions just for myself and in little simpler form. For now I need flam:ngo just to work with one specify XLSX and with one DOC template, but I stuck. I know which rows in document I will always need, but I don't know what should I write to specify in JS's code that I need exactly this ones (like hey, app, pick only this one, this one and maybe this one) while JS is reading file and I don't know how to create new DOC (or PDF) file, how to write data in specified blank spaces and then at the end: how to save it in direction which I should choose for every time I'm using an app - everything in one, maybe two, processes.
Ending
Could you, please, help me: for now I have implemented file uploader which is importing file in XLSX and which is saving it as CSV, XML oraz HTML. What should I do to keep moving forward?
I really appreciate your help!
PS. For better explanation:
For now this should look like this:
1. "template.docx" is uploaded in the core
2. user uploads .xlsx
3. app reads tables and select rows chosen in code
4. app puts data from chosen rows in specify places
5. app saves file > new life of the app :)
Ok, so it's been a while and app has been already written by me. Maybe this will help someone in the future:
Solution
Packages that helps me with this issue was:
js-xlsx which converts my file to simple HTML file, where cells from my XLSX template file have always the same ID (which was important for me to work with document templates).
officegen which helps me write brand new document based on earlier prepared template.
Rest of it was just Vanilla JS.
Using the following Angular JS directive: https://github.com/danialfarid/ng-file-upload
Wondering if there's a simplified way to pass in the relative path to a file object.
I have checked the following issue: https://github.com/danialfarid/ng-file-upload/issues/285
From it, I discovered that I can create a field file._relativePath, but it seems like this variable does not work by itself and I would have to receive it from chrome like this.
This is less an issue with the project than a question of my experience but I'm wondering how would you be able to combine the two together to get the path for each file in relativePath? Any example or link that explains things beyond 285 to make this easier would really be appreciated.
Apologies if the question is not strong enough or is very similar to another one that's answered. New to asking on Stack Overflow. Constructive feedback is welcome!
file.path should be used to retrieve the relative path instead of file.relativePath. Check this link for more information.
I want generate a development tool that I can input code (Such as HTML, CSS and JS) and it will create a preview/result window (like JSFiddle). I will be using it for tutorials in school and need a unique site to do this from (I would love to use CodePen, JS Fiddle or Codecademy... But I can't).
I am able to generate a form that can be processed and shown in an iframe (through PHP where it simply echos the information into a new html file that is shown in the iframe). But this came with problems; I only have a cheap server and won't want to put too much pressure on it so need todo this through JS/jQuery.
Firstly is this possible? And how would I go about doing it (code examples would be great!)?
Thanks in advance (I appologise if I haven't given enough detail but I'm fairly new to this and may just be asking a pointless question (I'm only 15 :/ ) )
Cheers :)
There is a rather impressive project called php.js that will let you parse and execute a subset of PHP code in the browser.
If you want to do it complete on a client/ in browser like jsfiddel do, then you need 2 or more frames.
One is for your code and one is for the output.
If you click on "run", then need to apply your code to the frame. You can do this by accessing the document object of the frame. If you got it, you´ll need to inject your code there. There many examples in the web on how to access a child document object from an frame/iframe.
I am using Dreamweaver CS6 (and most recently, CC).
We have a javascript file that is included in every page, but its dynamically included through nested layers of PHP includes, so when I type in a function name, DW does not know it is part of the page, and therefore does not give me the code hints (vs if I am actually in that js file, code hinting works like a charm).
I am looking for a way to have DW pick up that file and/or give me code hints for any functions and namespaces I place in there, but so far, have come up empty.
Has anyone had any success with doing this?
I have been searching for this answer for far too long, and I think I've found it! It has to do with "site-specific code hinting". Take a look at this link: https://www.inkling.com/read/dreamweaver-cs6-missing-manual-david-sawyer-mcfarland-1st/chapter-22/php-code-hints
It worked for me. I am now able to see all variables from nested includes.
I currently am working on a little app that requests user info from my server and displays them using a special template.
At first, I just hardcoded the little snippet in jQuery:
$("<li><div class='outer'><table><tr><td rowspan=2 class='imgcontainer'><img class='thumb'/></td><td><span class='username'/></td></tr><tr><td><span class='name'/></td></tr></table></div></li>")
I clone it several times.
It's ugly and I want it to have syntax highlighting and whatnot, so it would be better for me to have it in the HTML file itself.
Also, it will make merges easier so somebody can just change a line or two.
Is there a pattern for this? Am I OK putting it in the HTML file that I include this JS in (there's only one), and making it hidden using CSS.
The third option I thought of is just creating a separate HTML file and having jQuery request that from the server to keep it separate. Is this technique used much?
Also, is there any term I can use to describe what I'm doing? (It's harder to ask a question for a concept I don't know the name for)
I gave a similar answer on SO earlier today. What you are looking for is called micro-templates. John Resig posted this on his blog. Essentially you can get a json dataset and apply a template to the data to create html and update the DOM.