Thanks for you read my question.
I know the define of Client script and Server script.
[Client script]
Contains JavaScript that the browser’s JavaScript engine runs.
[Server script]
Contains JavaScript that a JavaScript engine on the App Maker server runs.
But I have no idea to know a function will run on browser’s JavaScript engine or on App Maker server.
Are there some effective and obvious methods to distinguish a function is client script or server script?
Thanks a lot.
Related
We need to check the technical feasibility to call a Asp.NET web api from korn shell script.
The purpose is to log the start and successful or error end of the script via Web API in a log table. As a bigger picture all the jobs will be using the web API to log the start and end with status. We are creating a Web API to facilitate this.
Can anyone please suggest can this web application be executed or called from Korn shell script. If yes then what command shall be used.
You may use netcat (nc) in order to establish a TCP connection with the web server.
How does a meteor application deal with server-side methods for inserting and updating? especially:
if an application is temporarily offline (available through appCache-package) and a call to a server-side
method happens: is optimistic-ui possible? how does it work?
do i
need to define the (usually server-side) methods in /libs
directory instead of /server?
Thank you
You should put your collections under libs and use Collection.allowand Collection.deny to control the permission on both server and client side.
In meteor, most of the time you're dealing with client side data, Meteor will save them to the Minimongo and synchronize your update to server when available.
Regarding to method definition, it really depends on where you want to use it, only a few things you'll put on server, e,g, authentication logic, encryption salt
Need to write a AutoSys script to invoke a REST service e.g. http://example.com/api/job/test-job and then setup a AutoSys Job.
AutoSys script supports REST service? If yes, will it support only anonymous REST service or it can support secured service as well?
Also, can it record HTTP response code? if yes, can it record HTTP response 200 OK as success and rest as failure when job runs?
There is no such thing as an "Autosys script". Autosys is just a scheduling software, such as crontab is. You cannot create a script with it.
If you can create a script (using bash, ksh, python, perl,...) or a binary file that does the API call you need, then Autosys will be here to start it and give you back the log (if any) and the return code.
See this link - https://support.ca.com/cadocs/0/CA%20Workload%20Automation%20System%20Agent%20r11%203-ENU/Bookshelf_Files/HTML/WebServicesCLIUser_11_3_1/index.htm
CA seems to support an Automation Agent using CLI through which you may invoke HTTP/HTTPS Web Services although there is no information provided on the response codes.
Also if FileWatcher can trigger HTTP requests, then some sort of REST interface to the pertinent web app functionality might work. There does not seem to be any way for AutoSys to directly invoke and record response for a REST service though.
As an alternative you can always interface with the web service using another platform (such as Java) and calling the same via AutoSys.
Having watched Meteor Framework screencast. I noticed that changing the database seamlessly changes the data in browser. Usually AJAX, just reloads a part of page every few seconds but here I didn't noticed browser reloading. How did they achieve that in Meteor? Is it Node.js dependent?
UPDATE: Toby Catlin poses another interesting question. How does Meteor handle different browsers?
They use both Session and Meteor.autosubscribe (from Meteor API) to ensure that changes are reflected on the clients.
These Meteor APIs use XHR (XMLHttpRequest) by SockJS. SockJS is WebSocket emulation utility. So when something changes on the server, SockJS ensures that an XHR is sent, and the changed data is in the JSON response.
Yes, Meteor is fully dependent on Node.js. From the Meteor docs:
A Meteor application is a mix of JavaScript that runs inside a client web browser, JavaScript that runs on the Meteor server inside a Node.js container, and all the supporting HTML fragments, CSS rules, and static assets. Meteor automates the packaging and transmission of these different components. And, it is quite flexible about how you choose to structure those components in your file tree.
The only server asset is JavaScript. Meteor gathers all your JavaScript files, excluding anything under the client and public subdirectories, and loads them into a Node.js server instance inside a fiber. In Meteor, your server code runs in a single thread per request, not in the asynchronous callback style typical of Node. We find the linear execution model a better fit for the typical server code in a Meteor application.
Sources: http://docs.meteor.com/ and https://github.com/meteor/meteor
There are a few techniques that allow the server to push data into the browser without the browser needing to request it. The term for such technology is Comet [wikipedia.org] and most techniques are related to AJAX (there was a bleach called Comet and a cleaning product called Ajax). There are a number of connection types: long polling, streaming XHR, forever frame, server-send-events and websockets. Socket.IO is a nice library that provides connection types to streaming servers.
You do need a server that will support Comet connections. You can google for current ones but off the top of my head: node.js, tornado, cometd, orbited, Jetty streaming
I would guess that Metor would use different connection types depending of the capabilities of the browser, eg websocket for Chrome and long polling for IE. If anyone can give a more specific answer i would be interested
Other than using a web service, is there anyway to call a method in a web app from a windows application? Both run on the same machine.
I basically want to schedule a job to run a windows app which updates some file (for a bayesian spam filter), then I want to notify the web app to reload that file.
I know this can be done in other ways but I'm curious to know whether it's possible anyway.
You can make your windows app connect to the web app and do a GET in a page that responds by reloading your file, I don't think it is strictly necessary to use a web service. This way you can also make it happen from a web browser.
A Web Service is the "right" way if you want them to communicate directly. However, I've found it easier in some situations to coordinate via database records. For example, my web app has bulk email capability. To make it work, the web app just leaves a database record behind specifying the email to be sent. The WinApp scans periodically for these records and, when it finds one with an "unprocessed" status, it takes the appropriate action. This works like a charm for me in a very high volume environment.
You cannot quite do this in the other direction only because web apps don't generally sit around in a timing loop (there are ways around this but they aren't worth the effort). Thus, you'll require some type of initiating action to let the web app know when to reload the file. To do this, you could use the following code to do a GET on a page:
WebRequest wrContent = WebRequest.Create("http://www.yourUrl.com/yourpage.aspx");
Stream objStream = wrContent.GetResponse().GetResponseStream();
// I don't think you'll need the stream Reader but I include it for completeness
StreamReader objStreamReader = new StreamReader(objStream);
You'll then reload the file in the PageLoad method whenever this page is opened.
How is the web application loading the file? If you were using a dependency on the Cache object, then simply updating the file will invalidate the Cache entry, causing your code to reload that entry when it is found to be null (or based on the "invalidated" event).
Otherwise, I don't know how you would notify the application to update the file.
An ASP.NET application only exists as an instance to serve a request. This is why web services are an easy way to handle this - the application has been instantiated to serve the service request. If you could be sure the instance existed and got a handle to it, you could use remoting. But without having a concrete handle to an instance of the application, you can't invoke the method directly.
There's plenty of other ways to communicate. You could use a database or some other kind of list which both applications poll and update periodically. There are plenty of asynchronous MQ solutions out there.
So you'll create a page in your webapp specifically for this purpose. Use a Get request and pass in a url parameter. Then in the page_load event check for this paremter. if it exists then do your processing. By passing in the parameter you'll prevent accidental page loads that will cause the file to be uploaded and processed when you don't want it to be.
From the windows app make the url Get request by using the .Net HttpWebRequest. Example here: http://www.codeproject.com/KB/webservices/HttpWebRequest_Response.aspx