SocialEngine staticBaseUrl is not working in production mode - plesk

I am using socialengine as content management system, when i change the socialengine site to production mode it did not load the css file, I figured out that my $staticBaseUrl function is not returning the website name.
I manually added the path in default layout to load the css file, it works but a font family (centurygothic) is not loads. I am using SocialEngine's 4.2.4 version, please help.
I am using plesk panel for as hosting server.

If you use paths in your css file (theme_name/main.css or Modulename/externals/styles/main.css), you can use following way of indicating path:
~/application/..., where ~ will be automatically parsed and replaced by staticbaseurl.

Firstly no need to manually adjust the $staticBaseUrl in the layout. There is a setting in the admin panel (general settings) where you just specify what the URL is. This is commonly used to set the CDN URL.
Secondly, most of the CSS files in production get minimized and appended to each other, so you will only see one query similar to this: /application/css.php?request=application/themes/default/theme.css
Thirdly, if there is still an issue there may be a number of reasons. For example, are you using the http://example.com/home or http://example.com/index.php/home URL format?

Related

How to show Image from local drive in Angular JS [duplicate]

I'm trying to retrieve a picture from my file system after a good storage,(instead of putting it in the database I copy it to the disc and i put the path to the db)
I had store the picture to c:\images\ folder and supposing that the name the complete path is c:\images\mypic.jpg
when I try to retrieve it a set the img src attribute to <img src="c:\images\mypic.jps"> by using some java code
in the browser console I found this error Not allowed to load local resource: file:///C://images//mypic.jpg
Question: how to fix these path problem ? where Should I store the pictures ? and from where should I retrieve them ?
sending tag <img src="c:\images\mypic.jpg"> would cause user browser to access image from his filesystem.
if you have to store images in folder located in c:\images i would suggest to create an servlet like images.jsp, that as a parameter takes name of a file, then sets servlet response content to an image/jpg and then loads bytes of image from server location and put it to a response.
But what you use to create your application? is it pure servlet? Spring? JSF?
Here you can find some info about, how to do it.
In Chrome, you are supposed to be able to allow this capability with a runtime flag --allow-file-access-from-files
However, it looks like there is a problem with current versions of Chrome (37, 38) where this doesn't work unless you also pass the runtime flag --disable-web-security
That's an unacceptable solution, except perhaps as a short-term workaround, but it has been identified as an issue:
https://code.google.com/p/chromium/issues/detail?id=379206
You have Two alternatives :
First one is to create a ServletImageLoader that would take as a parameter an identifier of your image (the path of the image or a hash) that you will use inside the Servlet to handle your image, and it will print to the response stream the loaded image from the server.
Second one is to create a folder inside your application's ROOT folder and just save the relative path to your images.
Many browsers have changed their security policies to no longer allow reading data directly from file shares or even local resources. You need to either place the files somewhere that your tomcat instance can serve them up and put a "regular" http url in the html you generate. This can be accomplished by either providing a servlet which reads and provides the file putting the file into a directory where tomcat will serve it up as "static" content.
The concept of http location and disk location is different. What you need to do is:
for uploaded file summer.jpg
move that under a known (to the application) location to disk, e.g c:\images\summer.jpg
insert into db record representing the image with text summer.jpg
to display it use plain <img src="images/summer.jpg" />
you need something (e.g apache) that will serve c:\images\ under your application's /images. If you cannot do this then in step #2 you need to save somewhere under your web root, e.g c:\my-applications\demo-app\build\images
This error means you can not directly load data from file system because there are security issues behind this. The only solution that I know is create a web service to serve load files.
Here is a simple expressjs solution if you just want to run this app locally and security is not a concern:
On your server.js or app.js file, add the following:
app.use('/local-files', express.static('/'));
That will serve your ENTIRE root directory under /local-files. Needless to say this is a really bad idea if you're planning to deploy this app anywhere other than your local machine.
Now, you can simply do:
<img src="/local-files/images/mypic.jps"/>
note: I'm running macOS. If you're using Windows you may have to search and remove 'C:\' from the path string
Do not use ABSOLUTE PATH to refer to the name of the image for example: C:/xamp/www/Archivos/images/templatemo_image_02_opt_20160401-1244.jpg. You must use the reference to its location within webserver. For example using ../../Archivos/images/templatemo_image_02_opt_20160401-1244.jpg depending on where your process is running.

Office Add-ins Caching my HTML file

For god knows what reason, Office Add-ins on my local word client is Caching a html file that I dynamically load in (through angular) and refuses to give me a way to remove it from the cache. My only solution is to rename the file and force it to look for a new one.
I know it's a caching issue and not a code issue because when I load the app up inside the web-client it always gets the new version and not the old version.
Please help, renaming files every time I change them is stupid and time consuming
I had the same, not with Angular but JS add office add ins, cut off my webserver and still was able to load the HTML!
For me what worked was the "Clear" button under Trust Centre -> Trusted Add-in catalogues.
Perhaps this is HTML5 - something to do with you manifest, something like this in your HTML, or the equivalent automatically occurring?
`<html.... manifest="/manifest.appcache">
There are loads of suggestion for how to prevent this I haven't tried it yet, but this looks like it contains reasonable examples to test - if imparted in an unusual manner!
http://alistapart.com/article/application-cache-is-a-douchebag
Second option which is now working a treat for me!
In internet Explorer go to Internet Options -> General tab -> Settings -> Temporary Internet files -> tick "Every time I visit the webpage". Naturally this only works for locally hosted sideloading apps.
Oddly enough IE seems to be the object loaded in Office 2016, not Edge, although I have had an Edge message appear in my side-load space, I'll try and grab a shot of it next time I see it (it was during an error it appeared!).
There are a few tricks that might work like this:
What does appending "?v=1" to CSS and Javascript URLs in link and script tags do?
Or in CSS like this:
https://css-tricks.com/can-we-prevent-css-caching/
Today (Win 10 1903 and newest Office 2016) Office AddIns are using Edge as WebViewHost. The WebViewHost seems to store the cached files here:
dir /s %LOCALAPPDATA%\Packages\Microsoft.Win32WebViewHost_cw5n1h2txyewy\AC\#!123\INetCache\
In our case we are using Azure App Service (IIS) as backend for our Office AddIn.
And we added the following web.config setting to let the client re-validate all cached files on each access:
...
<system.webServer>
<staticContent>
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="0.00:00:00" cacheControlCustom="must-revalidate" />
</staticContent>
...
Of course, the cacheControlMaxAge may be adjusted to your needs.
Hitting Ctrl + Shift + F5 helped for me.
An easy workaround for this would be to append some random query string at the end of the url, thus making sure your browser has a cache miss.
For example, instead of getting the file http://myaddin/myfile.html, append a big enough random query string parameter so that you instead query for http://myaddin/myfile.html?cache=s98sj398nf03984jf3498n.

Can't change css files in Drupal 7?

I need to alter another developer's theme, currently installed on Drupal 7. I need to change simple css, but cannot get the css to update. I have changed literally every reference to a particular #id in the css throughout the entire codebase, yet the chrome web inspector shows me those files as if they had never been changed.
Things I've tried:
Clearing the cache
Disabling/re-enabling the theme
Restarting apache
Violently shaking fists
Yet I cannot, for the life of me, get that css file to change in the downloaded file.
Try this:
Check the code of the HTML of your Drupal page.
Locate your CSS file in the code and open it in the browser.
Press F5 to refresh your browser cache.
Check if the file reflects your changes.
If not, you are editing the wrong file.
Remember that clearing CSS caches will append a different string to every CSS every time, so, if you are editing the correct file it must reflect the changes.
In the worst case you have issues with CSS :/

correct way to add js in sencha architect (ExtJS)?

This thread works well in a mobile app but in a desktop app it would seem I cant add the reference to the external JS in an extjs desktop app.
The instructions from Sencha somehow don't correspond or it doesn't work for me when I try and follow them. So, I am selecting Resources->Library and can see the attribute Include JavaScript (ticked) and Library Base Path:/ext.
The JS file I am using I use in a phone app and its fine - I added it to the app.json in that and compiling the app copies the file over to the target and defers the loading.
In this case with SA I am not seeing the file copied to the target - nor can I follow the instructions with SA 3 that are documented. The only way I can add an external JS is by dropping it onto the filesystem into the ext folder manually. Again, it doesn't appear in the target and certainly errors when I run the app with
Uncaught ReferenceError: hex_sha512 is not defined
This JS has been used in other apps, is proved and tested but just relates to SA or my wrong use of SA.
The proper way to add a resource in Sencha Architect, regardless of framework, is to add it as a JS resource.
This is most easily done by hitting ctrl-t (or cmd-t on a mac) and typing "js resource" (or some shortened string thereof to get autocompletion)...
Alternatively, you can use the toolbox, click "Resources", and drag out or double click "JS Resource"
These are just different user interfaces to accomplish the same task.
Once you've added your JS resource using one of the above methods, you need to set the URL in the config pane (at bottom right unless you've configured Architect to swap the left and right panes)...
The URL is to be set relative to your project folder. If you copy the JS file into your project root under a folder called "lib" for example, then you'd set the url config to "lib/foo.js" - where foo.js is the filename, of course.
Hope that helps!
My lack of understanding of the instructions or they are not clear:
It would seem the way to do it is take eyes up to the top right of SA and spot the + button as shown in the image.
Add the JS resource and scroll up because it may be hidden behind the property inspector.
On setting the url field under properties, the source of the JS appears in the main editing window.
Certainly works fine after the app is built.

Deploying AngularJS Seed application in WebStorm

I recently started to learn about AngularJS and came across WebStorm and the AngularJS plugin by John Lindquist. Started by creating a new project using the angular-seed project and imported to WebStorm using File -> Open Directory. My directory structure looks like this
Now when I try to Debug it I get a 404 error. If I move the file app/index.html to the root folder and adjust all URL's to begin with app then it works fine. Is there a way to keep the default folder structure without moving the index.html to the root folder and also make it work with WebStorm?
I am using WebStorm 6.0.2.
I use WebStorm 7, so there might be some discrepancy in comparison with version 6 that you're using, but the over-all functionality is the same.
Quick solution:
Open the file in the editor and right click in the code to access the context menu. Choose the "Debug" option, which should start a debug session pointing to the current page.
Configuration solution:
WebStorm supports configurations for setting up different debugging scenarios. From the "Run" menu, choose the "Configurations" option. Add a JavaScript debug configuration, and add the URL you want in the designated field within the dialog presented.
Then, when you initialize a debugging session (a general one, not one for a specific page), you're presented a small dialog that allows you to choose a debug configuration.
Maybe there are more options or ways to accomplish the same thing as well, but I've never really given it more thought. I hope this is a working solution for you, but if not there's alway the documentation. If you need further clarification with regard to my answer, just give me a comment.

Resources