I'm totally new in datebases.
I was wonder if somebody could explain my how should I use this Apache couchDB.
How to add my database to Javascript file.
How to run commends in cmd form javascript file to nagivate ( add/delete) thru json file.
If it possible to explain it as easy as it is possible :)
Related
I'm making a game in JS with Phaser.io and using Web2Executable to run it on desktops. I'm making a lot of test files during development and every time I add a file or remove one I have to manually add/remove code. Is there a way I can just get a list of all the files in my working directory/subfolders? I can then load them up by file extension no problem... but I've been googling for half an hour and I can't work out how to get a filelist without making everything crazy complicated.
Client-side Javascript cannot read the contents of a directory.
I think is the best form to read directory is a back-end language like php and return a object json then you acess this page with ajax and get this object
I would like to know if exists any form to let AngularJS read, create or write into a file (could be a txt file or a json file).
And obviously delete this file just when i want. (don't let the browser delete or angular delete it)
Can anybody give and advise, how start?
Writing and read has nothing to do with AngularJS. Java script comes with File read and write capability. js-xlsx is a useful file parser which you can use.
https://github.com/SheetJS/js-xlsx
The way I have it right now is that I use JavaScript to read a file, providing a hard coded path. I tell it to look it /public. I'm going to generate a file in the tmp directory with Rails, and I want to read it with JavaScript. How can I do this? What is the tmp directory of Rails?
I've tried putting the file into /tmp and hard coding JavaScript to read from /tmp, but it doesn't load the file.
I might be wrong but I think browser can access only files inside public folder unless it goes through Rails route. So, you can either change the location of tmp folder or you can create a method in a controller that will read that JS file and send it back to browser (sort of like proxy).
I'm looking to use a scoped configuration file in an Alfresco javascript webscript. I started with this wiki page, and it got me mostly there.
This jira page told me I needed to create a file spring-webscripts-config-custom.xml and place it in a META-INF folder i.e. in /shared/classes/META-INF/spring-webscripts-config-custom.xml. Fine. Got that working. I can load the file, and browse the configuration using the methods listed in the Jira page.
But those methods are a pain to use (childrenMap and getChild), and I'd rather use E4X to parse and query the XML configuration file. To do so, I'd need to get the configuration file as a string and pass it to
var conf = new XML( configStr );
Any ideas on how I can do this?
And a good E4X tutorial page
There's IMHO no way to achieve what you describe with a JS backed webscript. You would need to implement a Java controller to get access to the configuration file and send it back to the client.
That said, exposing their content to the outside world it's not really what the Alfresco configuration files are designed for. If you could disclose more details of you are trying to achieve it would be easier to suggest some proper ways to expose configuration data to the client.
EDIT
After the scope has been clarified, my suggestion is to provide your web script with a dedicated XML configuration file containing all the mapping between error codes and messages. As explained in the docs, let's suppose your web script is defined in myscript.get.desc.xml. Then you can create a file named myscript.get.config.xml that contains e.g.:
<messages>
<message>
<id>1</id>
<desc>A long description here</desc>
</message>
</messages>
You can then parse such configuration in the JS controller myscript.get.js:
var myconfig = new XML(config.script);
This is a fairly simple problem, I'm just not sure exactly how to approach it.
A friend of mine has an open directory on his webserver, and he asked me to make a simple webpage for him which would just display all of the file names, rather than the dates/file sizes/etc. The page would also update when a new file is added into the directory.
So, I guess I'm just looking to be pointed in the right direction on this one. My first guess was just to throw a simple HTML/Javascript page together which would extract all of the file names from the directory with Javascript, then display them on the webpage while linking to the file. Or am I going able this all wrong?
Thanks,
aqzman
JavaScript is a client-side language and really has no way of enumerating files and directories on a web server, without the aid of a server-side script anyway. You need to look into server-side scripting languages such as Python, PHP, and ASP.NET (Windows Server only), to name a few.
These languages are processed on the server and make changes to (or even create from scratch) a page before it is sent to the client/browser.
You could use Apache's built-in directory listing feature. With javascript this can't really be done (exception: there's a pattern within the filenames that would let you send HEAD requests to see if files exist - see this site where I had to use this technique).
You can do this pretty easily with PHP -
$files = scandir($_GET['dir']);
foreach ($files as $file) {
if (is_dir($_GET['dir']))
echo ''.$file.'<br />';
else
echo ''.$file.'<br />';
}