Angular-translator not working ( useStaticFilesLoader ) - meanjs

I am using Angular-translate (PascalPrecht module) with StaticFilesLoader in mean.js. But getting the error in browser console as ,
http://localhost:1234/app/languages/es.json 404 (Not Found)
and the translation is not working.
I tried all the options in other sites but my issue still persists. Can anybody suggest how to set path to json file in mean.js
This is my code
public/module/user/config.js
$translateProvider.useStaticFilesLoader({
prefix: 'app/languages/',
suffix: '.json'
});
$translateProvider.preferredLanguage('es');
and i set my json file in app/languages/es.json
{ "TITLE": "Hello", "SUBJECT": "this is it" }

This is difficult to know for sure without seeing your whole app structure. Where is your directory "app" located? If you try to open http://localhost:1234/app/languages/es.json in your browser address bar, does it work? What is the URL for config.js? If it's: http://localhost:1234/module/user/config.js then I believe you just need to move the app/languages tree under 'public'.

Related

JQuery append to IMG URL, this works, but Developer Console reports 404 errors. How to stop those errors?

The images are from a markdown template and the SRC once parsed is just the filename only, no complete URL. I append the URL with the JQuery below, and the image is loaded as expected. The issue isn't that the image file doesn't exist, it does, but the developer console reports the file not found. And because of this, the browser fails to load other dependencies, such as the RRSSB plugin, for example.
Anyone got any suggestions please? Here is the JQuery below:
$(".markdown").find("img").each(function()
{
$(this).addClass("markdown");
$(this).attr("src", function(i, value)
{
return "{{ config("website.aws.s3") }}" + value;
});
});
As I said, the actual image itself is loaded without any problems. I just need the console not to report the 404 error, that's all.

How can I make VS code read both Django and html in a .html file? Whenever I install the django extension on vs code it stops reading html

I have tried putting this in my settings.json file-
{
"emmet.triggerExpansionOnTab": true,
"emmet.includeLanguages": {"django-html": "html"},
"files.associations": {
"**/templates/*.html": "django-html",
"**/templates/*": "django-txt",
"**/requirements{/**,*}.{txt,in}": "pip-requirements",
"*.html": "html"
}}
But it makes no changes vs code still only reads Django and not html. I am unable to get closing tags or autocomplete for html. I have tried every solution available on the internet but none works. Although every time I uninstall the django extension from vs code it starts reading html code again. I have tried all methods available on the internet but none work, sometimes it only read html and sometimes only django. Please help
According to Django Extension (I suppose you are using this one), below Usage section the appropriate settings to set are:
"files.associations": {
"**/*.html": "html",
"**/templates/**/*.html": "django-html",
"**/templates/**/*": "django-txt",
"**/requirements{/**,*}.{txt,in}": "pip-requirements"
},
Note: Copy and replace the code above with yours (which I think is the cause to your problem).
If you wanna take advantage of emmet, you should add the line below to your settings.json:
"emmet.includeLanguages": {"django-html": "html"},
Note: I don't think setting "emmet.triggerExpansionOnTab" to true is doing anything in your case.
Besides, django-html documents doesn't seem to get formatted properly with prettier formatter, so I suggest using the settings bellow to format django-html using beautify:
"beautify.language": {
"html": [
"django-html"
]
},

How can you set the browser homepage using the extension manifest?

I'm making an extension which replaces the users new tab page, and i would also like it to replace the users start up homepage. Right now in my manifest I'm using:
"chrome_settings_overrides" : {
"homepage": "givr/index.html"
},
But when i try to install the extension I get the error stating it's not a valid value:
"ErrorInvalid value for overriding homepage url: '[givr/index.html]'."
Any ideas?
Try something like this, it worked for me:
"chrome_settings_overrides" : {
"homepage": "https://own.intra.site/index.html"
}

web2py site is not loading the usual css, just plain ugly html

I'm moving my web2py powered site from one server to another. After fighting a permissions problem with /tmp/fcgi.sock default file location for weeks I finally understood that is was better put it under /srv/http/ on Arch Linux on any other place owned by the user who runs the http server (in my case http) as indicated here. Now I'm trying to figure out what is happening with the look and feel of the site because web2py is loading plain ugly html instead of the usual bootstrap twitter theme. I remember having this problem before, and solved it with the proper permissions, but I have tested several permissions on the web2py's folder and all of them give me the same ugly results. Any pointer to a solution?
Ok, here was the problem: My combination was lighttpd + web2py on Arch Linux, and lighhtpd have not the proper mimetype assignation for css, so the server was treating css files as ocstream. The solution is to add ".css" => "text/css" to the mime type section of the lighttpd.conf for example:
mimetype.assign = (
".html" => "text/html",
".txt" => "text/plain",
".jpg" => "image/jpeg",
".png" => "image/png",
".css" => "text/css",
"" => "application/octet-stream"
)
For details see on: Styles (CSS) not working properly on the Arch Wiki.
Thanks to #neoecos for helping with this on twitter.

Google Chrome Extensions Manifest 2 update

I'm just wondering if there is a new way in manifest 2 to rewrite a sample app like this one.
http://developer.chrome.com/extensions/samples.html#4e35caa9742fb82dbd628892d23a781614f6eff6
I started to convert this into a manifest 2 app and ran into some issues.
bgPage.oauth.authorize(function() {
Uncaught TypeError: Cannot call method 'authorize' of undefined
if (!bgPage.docs.length) {
gdocs.getDocumentList();
} else {
gdocs.renderDocList();
}
util.scheduleRequest();
});
bgPage.oauth.sendSignedRequest(url, gdocs.processDocListResults, params);
For some reason in manifest2 the bgPad.oauth call is not valid anymore.
Is there a way to make this work again?
I ran into this same problem when I converted my own app to manifest version 2. Firstly, I just want to make sure you're aware that you need to remove all inline code, and place it inside separate script includes. For example, popup.html has a whole lot of inline code; I moved it inside a popup.js and put that where the inline code was. (This must be done on background.html, popup.html, and chrome_ex_oauth.html
Secondly, due to Google's further tightening of permissions allowed within apps and extensions, you'll need to add this in your manifest:
"web_accessible_resources": [
"chrome_ex_oauth.html"
]
I've zipped up my modified version of the extension for your edification:
https://dl.dropbox.com/u/73603348/gdocs.zip