Anyone have luck with the microsoft translator api. I feel like I followed everything, and have used the same url in the example from the actual site, but I am getting an error.
this is the url I am using for a get req:
https://api.microsofttranslator.com/V2/Http.svc/Translate?text="hi"&from="en"&to="es"
this is the response I am getting back:
<html>
<body>
<h1>Argument Exception</h1>
<p>Method: Translate()</p>
<p>Parameter: from</p>
<p>Message: 'from' must be a valid language
Parameter name: from</p>
<code></code>
<p>message id=1230.V2_Rest.Translate.5368F73A</p>
</body>
</html>
Not sure what I am doing wrong. Pretty sure english and spanish are both actual languages lol.
:| figured it out. Cant have quotes around the language haha. Incase anyone runs in to this issue.
Related
I followed a youtube tutorial on webpack and got a linter error in my HTML stating:
escaping malformed URI reference
for this image tag:
<img class="img-responsive" src=<%=require('./images/tech-town-showcase-students.JPG') %> alt="students meeting with tech business owner"/>
What does "escaping" mean here? The code still seems to run just fine. What do I need to do differently to avoid the linter error?
Try wrapping your ASP embedded code in double quotations like this:
src="<%=require('./images/tech-town-showcase-students.JPG') %>"
Leaving them out causes me headaches to no end. It rarely breaks anything, but the html validators act as though you've tried to escape the tag you're embedding ASP in early by omitting the quotes. At least, in my experience.
I'm developing an ASP code that read a external websites and parse it via HTMLDocument interface Object ( "HTMLFILE" Object) to navigate contents via DOM structure. But there are some pages that throw an error :
'htmlfile error 80070057 Invalid Argument.'
After doing a lot of research, I've discovered that there are some HTML tags that, i don't know why, are not rendered or managed correctly by HTMLFILE object giving me that error.
Because ASP is too old and there isn't much content available today to be probing, I'm convinced that I have to parse it before send to HTMLFILE Object, and the best way that I have figured is to do via RegEx.
But I'm facing some problems (and because i don't have much practice).
I have to successfully locate HTML Tag Blocks that 'HTMLFILE' do not accept to be able to remove them.
For Example:
<head>
<script> ....... </script>
<style> ....... </style>
</head>
<body>
<iframe> ........ </iframe>
<div> ..... </div>
<table>.....</table>
I have to match full script block, style and iframe, leaving the rest of document intact.
From last days i've doing some research and have almost done it:
<(?:script|embed|object|frameset|frame|iframe|meta|style).+(.|\s)*?>$
I've tried to match single line tag (for example '<BR>') but I'm totally confused now and there are some inconsistencies on it, for example, some of lines that close some tags are improperly selected.
I Know that the best way is discover why HTMLFILE is throwing me on error, but there is no more information on error to debug it.
Thank for all the time and patience.
Here is the regex candidate:
<(script|meta|style|embed|object|frameset|frame|iframe)[\s\S]*?<\/(script|meta|style|embed|object|frameset|frame|iframe)>
DEMO with explanation
EDIT
Update with lazy match for [\s\S]*?
Regex is not best tool for that, take a look here, but if you really want, I think in simple cases you can also use one regex for all tags, also nested:
(?=(<([^>]+)>([\s\S]*?)<\/\2>))
DEMO
the 1st groups shows whole captured part, 2nd groups capture just tag, and 3rd group capture content of tag. It doesn't actually match text, only capture some fragments. However you probably can get start/end index of match, and use in as you want.
Still I think you should reconsider using regex, however suntex used above is quite useful, so it is worth to know how to use it.
I can't figure out what's going on, here is my HTML. The validator gives me errors, but I'm completely new to this so I have no clue how to fix it. Been trying for hours now. I don't get what most of the validators message implies, some say open elements or errors - but I can't find them.
This all stems from your unclosed <class="contact"> "element" which should be an attribute of another element, not its own element. Most likely what you want is:
<div class="contact">Prime Properties</div>
In the future please post your code as text, not as an image.
The error messages are self explanatory. #Doelleri already spotted the <class="contact"> wierd tag...
In addition, your tag is missing a .
Ex:email
http://validator.w3.org/check?uri=http%3A%2F%2Fthenozzle.net%2F&charset=%28detect+automatically%29&doctype=Inline&group=0&user-agent=W3C_Validator%2F1.2
Theres my W3C validation. Is it bad that I've got 12 error and 10 warnings? Is this normal?
If so, what am I doing wrong with the Doctype?
I'm using mordernizr.js v2. My fear is that it isn't working and causing validation errors with my doctype. But I'm not sure what the errors mean. Do they mean my site is BROKEN? Or are these so called 'errors' really just warnings.
Here's my site:
http://thenozzle.net/login
username: admin1
pass: admin1
Thanks in advance!
~ Jackson
You have:
<script type="text/javascript">
window.location = "http://thenozzle.net/oops"
</script>
Outside of your head
Remember, the validator is not logged in.
Take a look at http://www.w3.org/QA/2002/04/valid-dtd-list.html Since you're using the W3 validator those are recommended by W3.
Thanks to #petah for the answer...
#jackson, errors don't really matter, as long as you cross browser test your pages in all the target browsers and it looks fine.
just a quick question to hopefully get pointed in the right direction. I took over for another developer and I'm flying by the seat of my (now ripped LOL!) pants.
I have a webpage that has the JSON included and I simply need to render it to HTML.
Now for the gory details... I'm building a help page (using Catalyst/Template Toolkit and Dojo). I have succeeded far enough to build the page with the tabs and including the JSON chunk. YAY! for me (Really you have no idea how good I feel for being able to do just THAT!)
This is more of a question of where to go next and any pointers would be appreciated.
Is it best to get dojo to read the JSON and write it out to a div somehow? Any hint as to how I would go about that? When Googling "JSON to HTML" I get plenty of suggestions for third party products and I'm not that greatly familiar with DOJO yet and even less so with AJAX.
Any advice would be greatly appreciated... Janie
This page from the Dojo documentation might be helpful. It refers to the library's function dojo.fromJson to convert a string of JSON-formatted text to a JavaScript object. You could then access the properties of the object and insert them with HTML into a div tag.
With Firebug:
console.log('myVar: ', myVar);
Here a function JSON to string: http://scriptnode.com/article/javascript-print_r-or-var_dump-equivalent/
It can be improved a lot, but hope can help you.
https://jsfiddle.net/VixedS/vz9L4c83/
var object= {xHtml:[{'tag':'input','placeholder':'name:','size':12},{'tag':'br'},{'tag':'textarea','style':'color:#FFF;background:blue;','content':'Hello world '}]};
$.each(object.xHtml,function(key,val){
var el=$('<'+this.tag+' />');
$.each(this,function(key,val){
console.log(key,val);
if (!(key=='content') || !(key=='tag'))
el.attr(key,val)
});
$('body').append(el.append(this.content))
})