I've tried to set up Simogeo's FileManager but I can only get half of it working.
My plan is to set it to a specific folder (../imgs/gallery) and allow the client to upload, download, rename, remove files - basically change the ones displayed on a specific page (../gallery.html).
Right now though, I can't get the FileManager to work properly. In it's absolutely simplest form (that is, uploading the extracted files to my /www/ root and duplicating filemanager.config.js.default to filemanager.config.js) it will allow me to create a folder and upload files but the second I do that, it'll just keep 'loading' something. Nothing shows, nothing is usable and a refresh will completely remove it from view.
The files are being created/uploaded in the ../userfiles/ folder which I can change in the future but it's just not working even in a pure setting.
(also, the instructions request changing a file ../connectors/php/filemanager.config.php, which for the life of me, I cannot find. ../connectors/php/default.config.php exists but doesn't follow the instructions very well if I was to substitute that.)
EDIT: I tried the 0.8 version, having no problems. It's a shame the up-to-date one doesn't work for me.
Are you sure permissions are set correctly on your folder ?
You could try :
chmod -R 0777 /path/to/filemanager/userfiles/
or (asserting you're running apache with www-data user :
chown -R www-data:www-data /path/to/filemanager/
You may also have a look to the configuration wiki page and sample page.
(also, the instructions request changing a file ../connectors/php/filemanager.config.php, which for the life of me, I cannot find. ../connectors/php/default.config.php exists but doesn't follow the instructions very well if I was to substitute that.)
Thanks for pointing this out. It is updated.
In my case the problem arose when migrating a site from dedicated hosting with PHP 5.3 to shared hosting with PHP 5.4, all of a sudden the file manager started behaving as described by the original poster. I updated to the latest FileManger version (2.0.0-dev) but still the same.
A look at the server error log showed a fatal error in connectors/php/filemanager.class.php on line #1312 where require_once('./inc/vendor/wideimage/lib/WideImage.php') failed to open the file. Checking the path there is no "vendor" directory so I removed that from the path and the server error went away. But still the same loading graphic.
I then considered that PHP 5.4.x wants to have the TimeZone set and depending on the server configuration may throw warnings or errors, even fatal ones in the background. So I added date_default_timezone_set ('America/Toronto'); at the top of the file connectors/php/filemanager.php and after that everything worked perfect. This may not be the optimal solution but it worked for me. If you try it of course change the TimeZone to your own.
This one had me pulling my hair out for a while, hope it helps someone.
Related
The problem
This is a very hard and weird problem because it's also very hard to explain.
I start from the beginning:
I started a new application using this boilerplate:
https://github.com/flexdinesh/react-redux-boilerplate
Everything worked fine until the owner of the repo made some small changes (look at the latest commit "Add prettier config; Upgrade deps; Remove immutable").
Since I don't like immutable I thought it would be great to also remove it. So I went into this projects commit and did exactly the same as he did. I also installed the same dep's versions as in his package.json.
Now the app is starting and when I load the page I see just a blank page with some errors in the devtools.
The errors can be found here: https://imgur.com/a/ilNGj2b
One "bigger" change he also did is moving from react-router-redux to connected-react-router.
Also in the injectReducer and injectSaga files under app/utils he made some changes mainly importing ReactReduxContext.
I'm specifically mentioning this because I think it has something to do with these changes.
What have I tried
I throw in some debugger statements in specific files and found out following:
injectReducer file runs and gets the correct props
injectSaga file doesn't run at all, I think because it's crashing before it get's executed. But I can't find out where and why.
I know this is hard to solve because it's a very big boilerplate code but you are my last hope (I already created an issue here: https://github.com/flexdinesh/react-redux-boilerplate/issues/38).
Maybe one of you that has way more experience can find out what the problem might be (maybe from the differences between last version of this repo and the current commit, or the error messages).
I really don't have much more "specific to the problem" code to give, since it could be really anything.
If anyone wants to help me out here is the current repo with the same structure as this boilerplate, but with my own code: https://github.com/SelfDevTV/forum-creator/tree/noImmutable
The master branch is working, that was before I "migrated" to the new version without immmutable and the other changes.
The noImmutable branch is the "problem child".
Oh my god that feels so great.
I just diffed my repo with the boilerplate repo like this:
git remote add -f b path/to/repo_b.git
git remote update
git diff noImmutable:app/utils remotes/b/master:app/utils
git remote rm b
And I found out I made a single letter typo in the injectSaga.js file.
I typed: static contextTypes = ReactReduxContext instead of static contextType = ReactReduxContext (so an 's' too much :D)
After I fixed that everything is back to normal and works perfectly.
Man moments like this are why I love coding and Git <3
So, I'm trying to use a web worker in my project to run a long-running process that is currently tying up the UI. I've been to I don't know how many sites trying to get a worker to work, but to no avail.
All of my javascript is kept in separate files and referenced in the HTML file. As a test to get my feet wet, I created a test.js file and put the following code in it:
self.addEventListener('message', function(e) {
self.postMessage('return');},false);
Then, in the UI page's javascript file I placed this code in a function triggered by a button click event:
var w = new Worker('test.js');
w.addEventListener('message',function(e){
alert(e.data);},false);
w.postMessage('hi');
The code is derived from:
html5rocks.com/en/tutorials/workers/basics
Other websites I visited provided similar instructions on how to set up a worker.
For the life of me, I cannot get this to work. When I execute it does absolutely nothing and I seemingly get no errors. Stepping through the code, it appears to create the worker, but I don't see any evidence of the event listener being created and the 'postMessage' event doesn't do anything. I've tried IE11 and Chrome with the same results.
In my research, I came across a part of Chrome's developer tools that revealed the test.js file couldn't be found. Yet, the file is in the same folder as the page's js file. So, I tried adding in the relative directory information as I do in the page's HTML section. That didn't work either.
I then found claims that for security reasons you couldn't have one js file reference another js in the code. It's unclear whether this is a Chrome-only feature or part of some spec.
So, now I'm in a quandary. The worker requires a reference to a separate js file for the code to be executed, yet, the browser isn't allowed to reference another file? How is the worker supposed to work if you aren't allowed to do what it requires to work?
To now, I've successfully pissed away two days trying to get this one seemingly simple function to work. To say I'm mildly frustrated would be an understatement. Being a fairly novice programmer and not understanding every last little nuance about web programming I'm clearly missing a key part of this whole thing.
How the heck is one supposed to make web workers work?
Turns out browsers won't allow local files to be fetched via javascript. Because that means a website can read your personal files! So you need to develop and test your project using a web server. The easiest way to do this for me was to install:
docker-compose
and make sure it works. Then create a file named:
docker-compose.yml
inside root folder of my project with index.html file. Then put this inside the docker-compose.yml file:
version: '3'
services:
nginx:
image: nginx:alpine
volumes:
- .:/usr/share/nginx/html
ports:
- "80:80"
Then inside the root folder of my project run:
docker-compose up
And then in the browser go to:
http://localhost/
And it worked!
I appear to have found a solution, though it escapes me why.
If I use:
var w = new Worker('js\test.js');
the worker doesn't work.
But, if I use:
var w = new Worker('js/test.js');
the worker does work.
I characteristically use the back slash throughout the project to delineate paths without issue. Why the forward slash must be used to set the worker's file location is a mystery. I have seen nothing in any documentation that even remotely addresses that tiny, yet seemingly critical detail.
Thank you, Mr. Starke, for your help!
Before staging the change
After staging the change
This strange issue causes me big trouble on saving the changes. Git thus always displays everything changed.
I tried to remove and create a new branch, but it doesn't work.
I also tried the ans from:
Stackoverflow question: diff returning entire file for identical files.
(Though I am quite sure I didn't use unix to edit this file.)
However, the same situation still occurs.
Any suggestion to fix it?
I cloned a git repo but have been unable to run the program due to the runtime error "Cassette.AssetReferenceException: Server Error in '/' Application. Reference error in "~/Scripts/this.js", line 1. Cannot find "~/Scripts/jquery-1.7.1.js". "
At line 1 in this.js I have: /// reference path = "~/Scripts/jquery-1.7.1" / (the opening and closing brackets are included but if I add them here, it deletes my reference path)
I have Typscript for VS installed, the correct Cassette version, jquery-1.7.1 IS in the scripts folder. I've tried uninstalling and reinstalling VS.... I have no compiling errors in VS. I've recloned the repo a hundred times. I KNOW this repo is good because it works on another persons computer. So its definitely something with my setup and cassette. If I delete all the cassette references, my page loads (not properly, but I don't get anymore errors.)
I'm a little lost here. Has anyone ran into this before?
After hours of looking I figured it out.
2 things:
Even after I uninstalled and reinstalled Cassette, for some reason, only the references for Cassette and Cassette.View were loading in my project. I had to manually brows for and add the reference for Cassette.Web.
Second thing is that in the _layout.cshtml file, I had to reference my jquery file like this:
#{ Bundles.Reference("Scripts/jquery-1.7.1.js"); }
INSTEAD OF
#{ Bundles.Reference("Scripts"); }
IDK why but it works now. someone else mentioned they had to something like that, too.
I'm working on a dart thing. Everything works flawlessly when I test it in Dartium. But when I Pub Build the project and run the .html file in the build/web folder, everything that's dart gets completely ignored.
I thought the problem might be in my code, but this does not seem to be the case since I don't even need to write any. It's enough if I just create a new project from the 'Web application' template and keep the template code in there (you know, the one with a "Click me!" text that reverses if you click it).
I get no errors while building the project. I build the project by right-clicking on pubspec.yaml and choosing the 'Pub Build (generates JS)' - Is this the right way of doing it, or am I doing something wrong?
Indeed, it was caused by the missing dart.js in the "packages/browser"
Running the 'pub cache repair' command was sufficient in bringing the missing file back and now everything works.