I am stuck at a problem I can't seem to figure out a "right" way.
I am uploading files directly to S3 from client side (using Plupload and sprightlysoft class). The server sets the policy document and all; however when uploading large files the session seems to expire and access to bucket would be denied (or at least that's what I think the problem is); the weird thing is that the uploader shows successful upload whilst javascript debugging shows 403 access denied. Any thought or idea on what could be done here? Is there a way to expand the session lifetime while the uploader is still uploading? or maybe another suitable approach?
Well, in case of use Ruby on Rails and carrierwave_direct, a mistake in this lines cause my problem:
def move_to_cache
true
end
def move_to_store
true
end
I returned false in move_to_cache, and didn't have move_to_store
This lines are usefull when uploading large files
Related
As per here:
Can't upload file attachments to phpBB3 forum on IIS
I'm having a problem with the plupload implementation in phpBB3.
I find that I get through
phpbb.plupload.uploader.bind('FilesAdded', function(up, files)
but never get to
phpbb.plupload.uploader.bind('FileUploaded', function(up, file, response)
unless my file is very small (< 5 KB). Is this simply down to reponses from the server (or lack thereof)? Any tips on figuring out the actual problem? So I can stop trying out a bunch of random crap?
EDIT:
Fiddler shows that the upload simply doesn't get any response from my server. Using the un-minified plupload files I can see that (I think) everything for the XMLHttpRequest is properly constructed. I essentially get through uploadChunk to xhr.send, but never get to xhr.onload.
How do I debug the server side problem?
It turns out this was a problem with a generic reverse proxy rule on our firewall. Adding a rule to specifically transfer HTTP(s) traffic directly to our webserver (rather than through the reverse proxy table) fixed things.
So, I'm trying to use Cocos2d-JS to create a simple game embedded into one of my rails view.
The thing is that cocos requires a farly simple project.json file with some config data in it to run correctly, here's the internal code:
if(!txt){
txt = cc.loader._loadTxtSync("project.json");
}
data = JSON.parse(txt);
Nonetheless even though I have this JSON file besides the cocos2d-JS .js file, I get always the same error running the rails server on development which is:
GET http://127.0.0.1:3000/project.json 404 (Not Found)
What have I tried so far and haven't worked:
Change the path on the js file to use a relative one, doesn't work.
Putting the JSON file in an aws bucket and try loading it from there, I get a non-authorized access error.
Renaming the cocos2d.js file to cocos2d.js.erb and lad the json with <%= asset_path 'project.json' %>, this breaks cocos2d itself...
How to bypass in case I can't get an answer:
I would try fixing the aws non authorized access issue, I'm a bit seasoned in Ruby and Rails, but don't fully understand the asset pipeline in order to find an alternative...
So my question is: Is this something related to the asset pipeline? How can I load this .json file into my js?
Thanks a lot!
Fixed!
Just modified the CORS policy on aws to allow access from my web app and everything's done
I have a webpage, which displays plots/info using .csv files. New files are added over time, and some go away. I need the webpage to change dynamically according to which files exist.
$.get('dir/'+myvar[1]+'.csv').done(function() {$('#Option1').show()});
$.get('dir/'+myvar[2]+'.csv').done(function() {$('#Option2').show()});
Then once the option is clicked on/selected, the $.get request is fired again and the file is actually used.
The issue is, there are a LOT options, hence alot of these requests over time. Each one throws a 404 error if the option wasn't available, and eventually I think it's slowing the webpage response down.
I was thinking of creating a .js file, which would effectively be a list of all viable options/files. The process creating the files can build the .js file each time a file is added/removed. Load the .js file on $(document).ready avoiding needless $.get requests and 404's.
The big question is, is this a viable/best practice solution, and is there an obviously better way to achieve this than I know? I am genuinely sorry if this question is too vague. Thanks.
Receiving a 404 for an ajax request should not slow down the webpage.
However, building a file that lists the available CSVs makes a lot of sense. I would consider using a JSON file (.json) instead of a Javascript file (.js).
Depending on your webserver, this functionality might be build in. For NGINX it is: http://nginx.org/en/docs/http/ngx_http_autoindex_module.html.
I need to have the functionality in the server side in order to hide the implementetion to the final user.
I didn't find a topic with this kind of solution.
I have a .js file with functions I use within the html5 file.
The js files are "called" in the html by using the script tag, but through the url the user can track them and see the .js file content. I don't want this to happen.
$getScript() does the job, but again the url can be cathched, thus the file content too. Much the same with $ajax function.
Everything work ok, but I want to hide the js content.
The .js file is something like this:
var x, x,....
function A(){...}
function B(){...}
and so on, I use A(), B() functions in the html.
Which is the best approach to get the content file from the server without doing the url visible?
Server: nodejs. (I send some json files through socket.io correctly, but I don't know how to achieve this other issue.
Thanks in advance, best!
If you are sending sensitive information to the client then you are doing it wrong. No matter if the client has the URL to the script, they will still be able to find it if they are determined as long as it is sent to their computer.
Find a different way to accomplish what you are trying to do without sending sensitive information to the client. It is not safe.
again. I'm making a PL/SQL generated HTML5 web page. It's running a Oracle 10g XE server. Okay, now when the setup is clear, my problem - I need to include a Java Script file in the page. Simply
HTP.P('<script type="text/javascript" src="js/ScriptFileName.js"></script>');
Doesn't work of course. So i created a folder object and granted read,write to PUBLIC. Then changed the string to match the newly created object, instead of path. Still doesn't work. I know, i can write
HTP.P(<script type="text/javascript"> MY JAVA SCRIPT HERE</script>);
And i've done so with other scripts(Even had to write CSS this way). But this time this will not work. Reason being - the JavaScript i'm trying to run was normalized(or rather unnormalized), so it's written all in one line. And there is a lot of it too. I tried to reverse it to normal, but faild many a time.
So, I went online and searched for a solution. Found one. It seem's that this include should go not to the page, but to server config. Makes sense, since PL/SQL is server sided. But when i went looking for the usual httpd.conf, it's nowhere to be found in Database directory.So i went online again, result - NOT A WORD OF WHERE THE HELL ARE HTTP SERVER CONFIGS IN 10gXE IN ANY ORACLE MANUALS. Searched some forums - exactly 1 person asked where httpd.conf in XE is, and didn't get an answer. Please, help. I'm desperate.
P.S. I don't use APEX. I don't get that mumbo-jumbo. So i write in Notepad and run the scripts in SQL line.
Firstly, XE has its own built in HTTP server called the 'Embedded PL/SQL Gateway' or EPG. But you don't HAVE to use that. You can use an Oracle HTTP Server with the mod_plsql plugin. Or you can use the Apex listener.
The question is on what server is "ScriptFileName.js" ?
Is it a flat file on the database server ? If so, you'll need to use the Oracle HTTP Server (or Apache or similar) to serve it. The database is pretty much unaware of files on its server and the EPG can't deliver them. [At least not in any practical sense, you could do weird things with chicken entrails and UTL_FILE, but you don't want to go there.]
Is it a file stored in the database ? That sounds exotic, but it is pretty much how all the CSS, images etc are served up through the EPG. The best explanation on how to get files in and out of there is by Dietmar
Is it a file stored on a separate machine ? Often the best answer. The "src=" directive will be read by the end users browser. That will do an HTTP get to the URL. It doesn't have to be a URL on the same domain/host as the rest of the page.