w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Calling MATLAB through Python but through Linux Command Terminal
You need to quote the string properly. Try: os.system('matlab -nojvm -nodisplay -nosplash -r "ReadFates5mm;quit"') OR os.system("matlab -nojvm -nodisplay -nosplash -r 'ReadFates5mm;quit'") Alternately, you can escape the nested double quotes. os.system("matlab -nojvm -nodisplay -nosplash -r "ReadFates5mm;quit"") Explanation: In your code, os.system("matlab -nojvm -nodisplay -nosplash -r "ReadFates5mm;quit"") 1 1' 22' The double quote started at marker 1 ends at the market 1' & the quote started at 2 ends at 2'. Basically, you need to escape the " at 1' & 2, using ". Alternately, you can use other quote character, '. For more details, search for "string quoting & escape characters". http://en.wikip

Categories : Python

Wanting to POST a Javascript Variable (From Client Side) to PHP File (Server Side) with AJAX JQUERY call
There could be many different things going wrong here. First, I think your jQuery's $.post snippet is wrong (you're missing a matching curvy bracket and a semicolon at the end) so I find it weird that your server informs you about a successful POST. I'd change this: function() { jQuery.post( 'packed_data.php', {'packed_dat': packed_dat}, function() { alert('Write OK!'); }) Into this: $.post('packed_data.php', { packed_dat: packed_dat }, function (data) { alert('Write OK!'); }); And then, in your packed_data.php script, give $uid a default value so in case $_POST['packed_dat'] isn't set, it still creates a file or not (and from that distinguish whether the problem is in the server side or in the client side).

Categories : PHP

How to handle timeouts in a REST Client when calling methods with side-effect
This will be application specific. You need to decide what makes the most sense in your usage case. Perhaps start with a timeout similar to that of the the default PHP session of 24 minutes. Adjust as necessary based on testing. Do you have server and client mixed up here? If so the server cannot tell if the client times out other than reaching the end of a session. The client can always query the server for a progress update. This one is a little general to provide an answer for.

Categories : Rest

Is there a JavaScript (client-side) JSON library that integrates well with JSON.NET (server-side) and supports the "preserve references" feature?
There are few options: Douglas Crockford's original JSON library has plugin called cycle.js that resolved circular references. Also see this answer which has enhanced version of method to resolve references: Resolve circular references from JSON object. Cereal which handles circular references and object graphs better. CircularJSON which is very small and does exactly what it says. Having said that, I would probably refactor my design to avoid circular references because JSON is usually core component and you probably want to use mainstream libraries which is very well tested and supported. One way to avoid circular references is just to create lightweight shim objects and serialize them instead. Alternatively implement custom interface (if you have access to class) that overrides seri

Categories : Json

asp.net/javascript creating cookies, advantages creating client side or server side?
Are there any alternatives creating the cookie via server side code or via javascript? No. Actually my server side is a asp.net rest service so probably this isn't a good idea? REST services usually do not deal or know about cookies. They could but it's not a common practice. REST services are using different techniques of authentication, such as sending some value in the Authorization HTTP request header. Are there any advantages or disadvantages in using either method? It would really depend on your scenario and what kind of information you are attempting to store. For example with a server side script you could create an HttpOnly cookie which is not accessible by client scripts, only by server side scripts. In any case you should not be storing sensitive information in

Categories : Javascript

Permissions/ACL in a JavaScript Client Side App
To make elements hidden/visible on the screen I do inline checks in my template, something like: <% if (user.isInRole('ADMIN', 'MNGR')) { %> <li <% page == "store" ? print('class="active"') :'' %>> </li> <% } %> and added the following helper function inside my user model to check for the permissions: isInRole: function (rr) { var self = this; $.each(rr, function(i) { if (rr[i] === self.currentRole) { alert('pass'); } }); } I assume this is secure-enough, since the actual check for required permission happens again on the server side. By hiding some controls I'm just guiding the user through the application and not letting him to be confused him with actions for he/she doesn't have the required privileges.

Categories : Javascript

Enabling Client Side Javascript
If something is disabled or not available, then by definition you cannot turn it on or make it available. Then there would be no point in turning it off in the first place. Which is a long winded way to say: no, it's not possible. Do show some message when Javascript is disabled, you use the <noscript> tag.

Categories : Javascript

What is client side MVC and how is it implemented in JavaScript?
Client side MVC means that a MVC framework is built entirely on the client side. So the server only delivers data to the application. The binding of the data to the models happens client side. An example of a framework that implements this principle is AngularJs Another one is Ember. Node on the server side has nothing to do with client side MVC. The data delivered to the webapp could be delivered by any technology capable of doing that. Nodejs is often used to run client side development tools and run tests. For example, the development server that comes with the AngularJs tutorial is build on node.

Categories : Javascript

javascript client-side-only loading notification
The browser page will act like a single threaded application where at a time there will be only one task running like running a script/updating the UI/reacting to user events etc In your case soon after calling show() the next scripts are running which takes some time thus the browser does not get any time to update the UI to show the element. The solution here is to use a setTimeout after showing the element so that the browser will get freed to show the element and then execute the next scripts function sortData(obj){ $('#sorting').show(); setTimeout($.proxy(function(){ sortableList = []; $('.data-row').each(function(){ var rowData = {}; var sortKey = obj.attr('id'); var i = obj.index(); var val = $(this).find('t

Categories : Javascript

Javascript Dynamic Breadcrumbs - Client Side
See if this helps you out document.getElementById('ID').innerHTML = '<span>' + part[i] + '</span>'; Where the ID is above replace with a ID of a element within your rendered page. Ie: something along the lines of <div id='breadcrumbs'></div>

Categories : Javascript

javascript client side validation loop
You could give jQuery validation a try: http://jqueryvalidation.org/documentation/ It will relieve you of many validation headaches...

Categories : Javascript

How to include javascript on client side of node.js?
Your handler is hardcoded to always return the content of /index.html. You need to pay attention to the resource that is being requested and return the right one. (i.e. if the browser asks for simple.js then you need to give it simple.js instead of index.html).

Categories : Javascript

Client Side JavaScript and database interaction
Correct me if I am wrong, but it seem to me that you think that javascript directly access the database. For that I see, Javascript is only used to manage the UI, and to contact (with Ajax ?) the server to update/create/delete entities. It isn't insecure, but developers must ensure that the requested user's action is permitted (on server side). Example : For a DELETE requested URL like https://myServer/myApp/Person/1, an user can modify this URL like https://myServer/myApp/Person/6 or https://myServer/myApp/Work/1. So it must be verify that the user can delete a Person with id=6, or a Work with id=1.

Categories : Javascript

How many way we can emit javascript from controller at client side
You shouldn't be emitting JavaScript from the controller. JavaScript is a UI-bound concept from the server's perspective and belongs in the view. You can put it directly in the view itself, or in separate .js files which are referenced by the view. (Or the layout, if it should be on many views.) Emitting JavaScript from the controller tightly couples the controller to the view, and one of the main reasons to use the ASP.NET MVC Framework (or the MVC pattern in general, really) is to reduce the coupling between code and presentation. I would even go so far as to say that RegisterStartupScript in WebForms is more often than not a poor design choice in the first place. Even in WebForms, the client-side UI-bound concerns belong on the pages or on resource files (.js files in this case) r

Categories : Asp Net Mvc

Calling a javascript function asynchronosly from server side in c#
Ok, Http is request/response protocol. But you want send do multiple responses for single request. I see two ways for you. In both, you will have to run your long running process in separate thread. Then 1) use ajax, to ask server about progress every N seconds, and display result. Client's will track progress with some delay 2) web sockets(SignalR is great for such purposes). In this way you will be able to display progress in real time, but i think it's harder to implement

Categories : C#

Creation of a text file from Javascript (or any other way) on the client side?
With a String of whatever text you want var str = 'Hello world!'; 1. Create a Blob with MIME type of text/plain var b = new Blob([str], {type: 'text/plain'}); 2. Generate a URL from your Blob var fileURL = URL.createObjectURL(b); 3. Point your user to it in your favourite way, e.g. window.open(fileURL, '_blank'); OR, if you want to download this var a = document.createElement('a'), e = document.createEvent("MouseEvents"); // simulated click e.initMouseEvent("click", true, false, self, 0, 0, 0, 0, 0, false, false, false, false, 0, null); a.setAttribute('href', fileURL); a.setAttribute('target', '_blank'); // fallback behaviour a.setAttribute('download', 'myTextFile.txt'); // file name a.dispatchEvent(e); // download

Categories : Javascript

uglifyjs on client-side javascript ? (or an alternative parser)
UglifyJS works in both the browser and NodeJS, like Esprima does (best to double check the browser compatibility specs though for each). In fact you can play around with UglifyJS in the browser (Chrome preferred) by going to the UglifyJS site and opening your inspector console and typing: var ast = UglifyJS.parse("var foo= 1") Then you can explore the AST data. For example to get the name of the variable declaration use: ast.body[0].definitions[0].name.name // returns "foo" If you want to modify the AST tree then study the structure and generate your own AST nodes to extend the tree. The UglifyJS documentation is ok, and the format to study the structure is a little hand-rolled (pop-up dialogs get a little annoying, I had to write my own documentation parser to create docs I could en

Categories : Javascript

HMAC in client side JavaScript and identity spoofing
JavaScript now has WebRTC where two clients can communicate peer-to-peer, this would be a scenario where clients can generate and use their own "secret". There are some cases where client -> server could be usable as well. If your server was "dynamically" serving the JavaScript then it could insert a "secret" based on the clients current session/login. Assuming you are using HTTPS (if not there could be a man in the middle slurping up the "secret") then it's not unreasonable to assume that communication to the server signed with that specific "secret" (even over unsecured HTTP) belongs to only that client.

Categories : Javascript

Initialize JavaScript app with large client-side data?
"JSON" is the right answer; "file" is not. Have a serverside script generate your JSON from the database. (Actually, you could even pregenerate it, in which case it really would be a file, if the data is static enough.) Dumping a database into JSON is a trivial exercise. Even better, if the data is huge enough, and if not all of it is needed at once, chunk it: send it in several JSON requests, so the user can start getting some feedback as soon as possible.

Categories : Javascript

Add javascript/Jquery & client side code in Vaadin 7
I am not expert of Vaadin Framework... I can tell you that your Question No.3 is to run JavaScript commands through that.. You can also run jQuery command through that.. But for that you must have jQuery included in the page.. for Question 1: I can say it is possible, as Vaadin have the functionality that overrides function.. JavaScript.getCurrent().addFunction("com.example.foo.myfunc", new JavaScriptFunction() { @Override public void call(JSONArray arguments) throws JSONException { Notification.show("Received call"); } }); Link link = new Link("Send Message", new ExternalResource( "javascript:com.example.foo.myfunc()")); Now in absence of supporting code, you must identify the actual plugin's function that is making c

Categories : Java

normalize command before calling exec/spawn on windows?
This is just half an answer: welcome to anyone to modify it and expand it. Here is the result of my digging in the source code: The exec method does a small check of the platform (taken from the source): if (process.platform === 'win32') { file = 'cmd.exe'; args = ['/s', '/c', '"' + command + '"']; options = util._extend({}, options); options.windowsVerbatimArguments = true; } else { file = '/bin/sh'; args = ['-c', command]; } I don't know how you have added ffmpeg to your PATH on Windows, so it really depends on your setup. In any case, simply pass to exec the command as if you would be running it from the cmd.exe shell. I however could not find something similar for spawn.

Categories : Node Js

Prevent client-side caching of javascript within a static file
use a dom script adder instead of document.write: function addScript(u,d){(d=document).getElementsByTagName('head')[0].appendChild(d.createElement('script')).src=u} addScript("test.js?rnd="+Math.random());

Categories : Javascript

Client-side JavaScript CSV file generation and email attachment
I've written a light-weight client-side CSV generator library that might come in handy. Check it out on http://atornblad.se/github/ (scroll down to the headline saying Client-side CSV file generator) When in place, you simply generate and email CSV files on the fly using the getFileContents method and either window.open or location.href = ..., like this: var propertyOrder = ["name", "age", "height"]; var csv = new Csv(propertyOrder); csv.add({ name : "Anders", age : 38, height : "178cm" }); csv.add({ name : "John Doe", age : 50, height : "184cm" }); var fileContents = csv.getFileContents; var link = "mailto:" + emailAddress + "?subject=CSV&body=" + fileContents; // This action should open the default email app: window.location.href = link;

Categories : Javascript

Sender object ID in aspx client side event (javascript)
I don't think you have assigned anything to the ID of the ASPxEdit. It is null by default. You have to explicitly assign an ID. The ID property is inherited from System.Web.Control. See the MSDN documentation.

Categories : Javascript

Mysql AES_ENCRYPT => client side JavaScript Aes.Ctr.decrypt issue
The MySQL docs you linked mention that the encryption mode that is used in MySQL is ECB, yet, you're using CTR in your decryption code. You might want to switch to ECB. Big, Fat, Warning: Don't use ECB ECB is a very unsafe encryption mode, you should not use ECB to encrypt any sensitive data. Consider encrypting in your server-side code, not in MySQL, so as to use a more reliable encryption mode (I'd recommend CBC or CTR for simplicity).

Categories : Javascript

Open a text file from server on the Client-side using Javascript
I believe this page should help you out with your problem. http://www.htmlgoodies.com/beyond/javascript/read-text-files-using-the-javascript-filereader.html#fbid=YhNukIHynD3

Categories : Javascript

How to server side push data to client using jquery or javascript?
Take a look at the "long polling" strategy. It is a working solution. Though this is an ajax call it still reduces the server load. Websockets are another option, but this does not always work reliable, so you'd need a fallback anyway.

Categories : Java

VAB of Enterprise Library 6.0 Client Side validation(Jquery/Javascript)
It is possible, so says this link, but i have been unable to get past the problems with multiple validators being adding to the page with the same name.

Categories : Asp Net Mvc

Google's SNAPPY algorithm implementation in javascript (client side)
You might use Emscripten, the C/C++ to JS compiler on https://github.com/andikleen/snappy-c or http://code.google.com/p/snappy/ itself

Categories : Javascript

In client side JavaScript, can any element besides window get a resize event?
After digging around a bit it appears that they can have resize events just not quite in the way you want. You can add a resize event like this $('#content').resize( function(){ //stuff to do } or $('#content').on('resize', function(){ //stuff to do } which you are already doing, but these just don't fire when the elements are resized by javascript code or anything like that. the only way to trigger it this way is with $('#content').trigger('resize'); which you can really do with any string. This does propagate up through the dom tree. Say you had the #content inside of a body with a 'resize' event on both of them. If you trigger the #content it will also trigger the body. However, if you trigger the event with body it will not trigger the #content. However it seems you

Categories : Javascript

Converting WAV to any compressed audio format in client-side JavaScript
What you really want is the mediaStream "Recording API", which is currently being worked on. Until that's available, I advise using emscriptem on C/C++ source, and consider running it in a webworker to avoid blocking the UI and other tabs.

Categories : Javascript

Send html snapshot to server using client side javascript
Using jQuery, this should do that for you: $("html").html() And if you really need the HTML tags: function getPageHTML() { return "<html>" + $("html").html() + "</html>"; } Even: $('html')[0].outerHTML

Categories : Javascript

Get visitors language & country code with javascript (client-side)
navigator.language isn't reliable as one of your linked questions states. The reason this is asked a lot, but you're still searching says something about the problem. That language detection purely on the client side is not anything close to reliable. First of all language preferences should only be used to detect language preferences - i.e. not location. My browser is set to en_US, because I wanted the English version. But I'm in the UK, so would have to alter this to en_GB to have my country detected via my browser settings. As the 'customer' that's not my problem. That's fine for language, but no good if all the prices on your site are in $USD. To detect language you really do need access to a server side script. If you're not a back end dev and want to do as much as possible on the

Categories : Javascript

How to export a html page to pdf in client side using JavaScript or jQuery?
It is possible indeed with pdf.js plugin pdf.js is an HTML5 experiment that explores building a faithful and efficient PDF renderer without native code assistance. Online Demo Github Link JSFIDDLE DEMO

Categories : Javascript

How can I call a javascript function on client browser from NodeJS server side?
Socket.IO will allow you to establish persistent communication between node.js and front-end JS. You can emit messages and subscribe to any other messages from both sides. As it is bidirectional communication, you dont need any request/response stuff, just emit from any side, and it will be cached by callback on another side.

Categories : Node Js

How to create an in memory file and upload to server using client side javascript?
I think a post would be the better way to do this. Dealing with escaped data is a much easier, more established problem then in-memory files and pushing files to the server with client side javascript. Moreover, escaping data is done for a reason. What you're trying to do is going to welcome a lot of security vulnerabilities. Try doing something like this. Snippet taken from Write javascript output to file on server var data = "...";// this is your data that you want to pass to the server (could be json) //next you would initiate a XMLHTTPRequest as following (could be more advanced): var url = "get_data.php";//your url to the server side file that will receive the data. http.open("POST", url, true); //Send the proper header information along with the request http.setRequestHeader("C

Categories : Javascript

Async JavaScript Function on Client Side( how to write call back)
You wont have access to the DOM Parser in a WebWorker, so this method is not applicable. You will need to run portions of the code on a timer event. Here is a library that may be able to help with running code against a timer -> https://github.com/jameswestgate/taskjs

Categories : Javascript

how to write/modify a xml file in SharePoint using a client side language(JavaScript)
What you are looking for is the SharePoint JavaScript object model. This is a sharepoint library that allows you to manipulate sharepoint objects using javascript. SharePoint does allow you to share documents too, so you could upload an xml document to a SharePoint library. But if you are building a SharePoint site, there are probably a lot better methods to customize it, like a SharePoint list, than using an xml file in a SharePoint document library.

Categories : C#

Javascript client-side framework not conflict with django template language
Have you and a look at anything that Toran https://github.com/toranb is doing with django and ember? He is great and a wonderful teacher. Here is a link to a django ember example https://github.com/toranb/ember-django-rest. Here is a video about ember with a django backend. http://toranbillups.com/blog/archive/2013/01/03/Intro-to-ember-js-and-the-new-router-api/ I hope this is helpful. Cheers Dave

Categories : Angularjs

How to execute a shell command on the server side within javascript?
I don't believe this is possible with client-side JavaScript. Althought it's not really your question, you could do it if you were using NodeJS server-side (http://nodejs.org/api/all.html#all_child_process_exec_command_options_callback).

Categories : Javascript



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.