I want to make php Application standalone [duplicate] - javascript

This question already has answers here:
Convert a PHP script into a stand-alone windows executable
(7 answers)
Closed 9 years ago.
I want to make windows standalone app with php, even i want to use database, javascript in that application.
Note : i don't want to give source code to user.
I should be like exe file which user can run.

If going with Windows, try WinBinder. It allows you to develop native Windows applications using PHP.
It also supports SQLite, so you don't need a database server
Also this answer will help you

I use phc to create .exe files out of my PHP source code. It works quite well, but it's mostly good for console applications rather than full webpages.
However, you could have your PHP script include a basic "server" that allows the browser to communicate with it - I have done this in the past too, and while it might seem daunting the results were very rewarding.

Related

Open a local xml file using javascript [duplicate]

This question already has answers here:
XMLHttpRequest cannot load file:///C:/Users/hamma/Desktop/rao.html
(2 answers)
Closed 5 years ago.
I'm trying to open a .xml storared on my own PC using javascript and do some stuff,just for knowledge, in order to do that, I've
found a example on site
https://www.w3schools.com/js/js_ajax_xmlfile.asp which uses AJAX and the object XMLHttpRequest, but, it does not work like the example showed in the site, I understand that the problem is that AJAX uses a server, so, I wonder if there is another solution to do that without a server, I just want to work with the file on my own pc or on a shared network like for example when we uses a shared workbook on excel.
Thanks in advance.
The security model for Javascript in browsers does not allow you to open local files. If you are wanting to do something like this using Javascript, you would need to look into installing something that runs outside the browser like Node.js.
https://nodejs.org/

Debugging client side code from Google Apps Script [duplicate]

This question already has answers here:
How to go about debugging JavaScript in the HtmlService in Google Scripts
(2 answers)
Closed 5 months ago.
I have issues with my client-side code (who doesn't, with any code they write in any language, at one point or another in the development process?) Problem is that I'm writing this code in Google Apps Script, and can't find the js code I am trying to debug/examine for errors. I remember being able to enter a function name, and then click on the returned code to go straight to the code file, and the function in it, but that, for some reason, isn't working here. I try it and this is what I get taken to:
(I think Caja might have something to do with this...)
I think it's in some VM**** file, but I don't know much about that. How to access that JavaScript code to set some breakpoints?!
From answer to how can I debug client side javascript (in html pages) in google appscripts
Unfortunately, there is no other good way to debug client side web UI other than with console logs. As you noted the JavaScript/DOM is re-written so you can't use standard Chrome debug tools.
Because of the above, consider using the approach suggested by Mogsdad on Did you know? (You can log to a spreadsheet from client JavaScript!): Write debugging logs to a spreadsheet.
what about 'debugger'?Write it in the code

Difference between using local JS and JS from CDN [duplicate]

This question already has answers here:
What are the advantages and disadvantages of using a content delivery network (CDN)? [closed]
(4 answers)
Closed 7 years ago.
I am trying to write a JavaScript script to populate HTML using jQuery and Bootstrap. In many tutorials on the internet, tutors mention to using files from a Content Delivery Network(CDN) instead of calling those files locally.
But I am unable to foresee any advantage making a call to js or CSS over a network, instead of loading it locally, which should prove good enough.
I am eager to know, what is the difference in terms of network and machine resources as well as the load on a page.
Pros using CDN:
* cache for the library in the client side.
Cons using CDN:
* If the cdn's site is down, your site will not get the files.
* Cdn file changes frequently and therefore your production site will work with the newest files that you didn't checked them(this can be very dangerous).
Now you can think if this suitable for your site.

How to hide javascript file of your website? [duplicate]

This question already has answers here:
How can I obfuscate (protect) JavaScript? [closed]
(22 answers)
Closed 8 years ago.
I have written a lot of functions which use ajax to call PHP functions in my main.js file. The problem is that anyone can see my logic and internally called php file names of website by viewing the page source. How should I prevent the people from viewing my javascript file?
Javascript can be obfuscated, but there's nothing that's going to prevent a client from
seeing the URL strings in your code, or
simply inspecting the HTTP requests themselves to determine what URLs are being hit.
This re-enforces the importance of making sure you write solid and secure server-side code. You also want to make sure your web server is configured and secured properly, so that (for example) clients are unable to download the PHP source directly.
You can't stop people from viewing your javascript file, because the readable javascript code is required to correctly execute that code on your page. You can obfuscate the function names and minify the javascript to make it harder to read, but if someone wants to read the file, this will not stop them from doing so.
Instead, you should assume that everyone knows everything about your javascript file, and that everyone is able to alter your javascript file. You shouldn't put any validation solely in your javascript file and in every php page you should somehow check if the request that is made is valid (e.g. was the user allowed to do an ajax request to a certain page at a certain time?).
You can't able to hide the Javascript in browser, If you did that, your javascript related operations won't run.
you cannot hide javascript files. but you can minify the code so that, it will be very difficult for a man to read and understand your logic and all.
something like this
http://code.jquery.com/jquery-1.10.1.min.js

Call python from javascript [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Calling Python from JavaScript
I have a test.py and test.js.
I want to be able to run my test.py by opening test.js. I don't know how to create an api because it's not a web app, it's just 2 files sitting on my linux mint desktop.
I don't want to use npapi, because it's just a simple task, i don't want to use pyjamas because it's too hard to install the pyjamas desktop, so how to do it?
please note that i can use php, ajax, jquery instead of javascript, if it could be done with these languages. I am also able to use C++ or C instead of python. I just want to know a simple way to do it.
I know this can be done if i use java instead of python, but i want to know if i can do it with python, C or C++.
If you put your test.py file where ever you put your cgi files, (I think it's /usr/lib/cgi-bin by default for apache on ubuntu linux), you should be able to run the python file just by making a request to it's address.
If you just want to run the python file, and not use its output in the browser afterward,
you could probably get away with something like:
document.write('<img src="http://localhost/cgi-bin/test.py" />');
if you want to use the output in the browser, you will probably be best served by using jQuery or some other library to do an easy ajax call.
something like:
jQuery.get('/cgi-bin/test.py', function(data) {
//do stuff with the data
})
would probably do you just fine.
the second method would require that you also use apache, or equivalent, to serve the test.js file from localhost because jQuery ajax generally requires requests to go to the same domain that the script is running on.

Categories