w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
REST API and clients - removing previously seen items - client-side or server-side?
First off, if the requirement is to not show a user products they've seen before on any device/platform (for example if they used the app on their iphone then ipad/ipod) then you'd definitely have to do it server side (as the app cannot know what the user has seen on other devices unless you are storing it on the server). Assuming, it is a device specific requirement, I would think your goal would be to minimize (potentially unreliable or slow) network traffic to optimize the iphone experience. Syncing back and forth with the server will require extra network traffic, which may fail at times. Which would lead to a conclusion of client side storage. Unless your users are going to be seeing some huge number of products that would chew up disk space, but I assume the amount of data you store

Categories : IOS

Crop and upload image on client-side without server-side code involve
The solution i used: First I use a 3rd party javascript library to select the crop area like jCrop. Once i got the coordinates (x1,x2,y1,y2), i draw a copy of an image to a canvas. var canvas = document.getElementById('drawcanvas'); var context = canvas.getContext('2d'); canvas.width = canvas.width; // clear canvas var imageObj = new Image(); imageObj.onload = function() { // draw cropped image // ... context.drawImage(imageObj, sourceX, sourceY, sourceWidth, sourceHeight, destX, destY, sourceWidth, sourceHeight); var dataURL = canvas.toDataURL(); }; imageObj.src = // image url After i drew the canvas, i converted the canvas to a DataURL which is in base64 format. On

Categories : Javascript

Does MVC Razor generate HTML for the template in the view on client side or server side?
I want to understand where the Razor View Engine actually generates the HTML from the templates that we create in the view It happens on the web server. Once the HTML is fully created on the web server, this HTML is sent to the client browser.

Categories : HTML

Ember user authentication (Client side and Server Side completely separated)
Ember-auth isn't necessarily just for apps. You can configure the endpoints like signInEndPoint and signOutEndPoint to point to the urls that need to be hit on your server to do authentication. Also there isn't any reason to bundle the client-side and server-side in the same repository here. The demo does this because the asset pipeline support in rails is very convenient for demoing, typically for avoiding a front-end build step. You can treat it as just a library file that you include alongside ember.

Categories : Ember Js

Timer, timezone, server side time, client side countdown
You can use php DateTime for this. The current time The midday time The midnight time Here is an example. $now = new DateTime; $morning = new DateTime('08:00'); $night = new DateTime('22:00'); // next time is night if( $now > $morning && $now < $night ) { $time = $now->diff($night); } // next time is day else { $time = $now->diff($morning); } $target = $time->format('%h:%i:%s'); // returns a string.

Categories : PHP

Parsing Google Maps API GeoCode - server side or client side?
Is this a website or an application that you need to hit geocoding servers on every request? If so, you should use client-side. If you have some predefined latLng values then you can use server side geocoding and cache the results for a couple of hours. This way, you probably won't need to worry about quota. From Google Developers' site: When to Use Client-Side Geocoding The basic answer is "almost always." As geocoding limits are per user session, there is no risk that your application will reach a global limit as your userbase grows. Client-side geocoding will not face a quota limit unless you perform a batch of geocoding requests within a user session. Therefore, running client-side geocoding, you generally don't have to worry about your quota. See here

Categories : Google Maps

How to get data from client side(android) to server side(ROR) in create action(post method)?
The request made from the client side is somewhat similar to this if I'm right: The post data from your client side is of the form: &content=valueIWantToSend In the ROR application, in the def create method, params[:content] will equal valueIWantToSend. Either change params[:post] to params[:content] on the server-side or change content to post on the client-side (Inside the try block)

Categories : Ruby On Rails

How to make client side click event handler to request a server side method
Use can do like this : $('a').click(function () { var data = { userName: $(this).attr("id") }; var dataVal = JSON.stringify(data); $.ajax({ type: "POST", url: "Default.aspx/loadNewPage", contentType: "application/json; charset=utf-8", data: dataVal, dataType: "json", success: function (id) { alert("loaded"); } }); }); [WebMethod] public static void loadNewPage(int id) { // do the loading of the new HTML, etc. } You can know more about Jquery AJAX call over here.

Categories : C#

Performing both client side and server side functions on button click - Specific Scenario
ASPX: <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <script src="js/jquery-1.10.2.min.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function () { $('#lblCheck').hide(); $('#btnProceed').click(function () { var $this = $('#chkTerms') if ($this.is(':checked')) { $('#lblCheck').hide(); return true; } else { $('#lblCheck').show();

Categories : C#

Sending from server-side to client-side multiple PartialViews asynchronously with an undefined delay
Use SignalR is one option but if you wanna do yourself instead of inherit your controllers class from Controller, inherit it from AsyncController. Controllers that inherit from AsyncController can process asynchronous requests, and they can still service synchronous action methods. public class HomeController : AsyncController { public void ExtensiveTaskActionAsync() { AsyncManager.OutstandingOperations.Increment(); Task.Factory.StartNew(() => DoExtensiveTask()); } private void DoExtensiveTask() { Thread.Sleep(5000); // some task that could be extensive AsyncManager.Parameters["message"] = "hello world"; AsyncManager.OutstandingOperations.Decrement(); }

Categories : C#

php's server side associative arrays to html's client side
You haven't mentioned jQuery in your tags, but that is what I would look at. Specifically, the jQueryUI library, which runs on top of jQuery. jQuery is a javascript library that is more efficient (less typing, do more with less code) than classic javascript. See the jQueryUI sortable widget, here. For jQuery tutorials: Alex Garret's jQuery tutorials at the thenewboston.com Alex Garret's website with many more tutorials.

Categories : PHP

Send gridview data from client side to server side at once
You should add loader for this kind of functionality. I hope you should be using update panel. You can add update progress control for the time request is processing on server side. It will hint the user to wait. You can also use ajax request by jquery to do similar kind of work.

Categories : Javascript

Pass a user geolocation from client side to server side
You have to add callbacks for success / error to trigger an event when the user accepts to share their location: navigator.geolocation.getCurrentPosition(success, error); function success(position){ var lat = position.coords.latitude; var lon = position.coords.longitude; document.getElementById('location').value = lat + ',' + lon; } function error() { // do something with the error message }

Categories : Javascript

call server-side function from client-side in mvc3
You have to modify you method public ActionResult Media() { //do some stuff here return View(); } to something like public JsonResult Media() { //do some stuff here return Json(new { myData = RenderPartialViewToString("ViewName", optionalModel), errorMessage = error }); } Add following method with reference to ASP.NET MVC Razor: How to render a Razor Partial View's HTML inside the controller action protected string RenderPartialViewToString(string viewName, object model) { if (string.IsNullOrEmpty(viewName)) viewName = ControllerContext.RouteData.GetRequiredString("action"); ViewData.Model = model; using (StringWriter sw = new StringWriter()) { ViewEngineRe

Categories : Javascript

How to invoke server-side function from client-side using socket.io?
Client.js <script src="/socket.io/socket.io.js"></script> <script> var socket = io.connect('http://localhost'); $("#urAnchorTagId").click(function(){ socket.emit('urEvent','urData'); }); </script> Server.js var app = express(); var server = http.createServer(app); var io = require('socket.io').listen(server); server.listen(8080); io.sockets.on('connection', function (socket) { socket.on('urEvent', function (data) { function init(){ //ur task }; }); });

Categories : Node Js

connect server-side computing with client-side visualization
First of all, I would suggest JSON rather than XML to be used for exchange format, it is much easier to parse JSON at the javascript side. Then, speaking about the architecture of your app, I think that it is better to write a server web application in Python to generate JSON content on the fly than to modify and serve static files (at least that is how such things are done usually). So, that gives us three components of your system: A client app (javascript). A web application (it does not matter what framework or library you prefer: django, gevent, even Twisted will work fine, as well as some others). What it should do is, firstly, giving the state of the points to the client app when it requests, and, secondly, accepting updates of the points' state from the next app and storing the

Categories : Javascript

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

Grails - Client Side vs Server Side Templating
I believe people start using client side frameworks to manage growing client side needs (Starting with backbone, ending with Angular/Ember). If your needs are not so severe then you might want to use client side temples like handlebars or mustache or underscore You might have one gsp file filled with various client templates included on page, then just use javascript to paint these templates on page using sample data or data from server. I do not agree that gsp templates lose in this case unless you are building fully dynamic experience or single page app which is usually not the case with grails. EDIT: I have just had a project when I had to consider if I need to move to client side templates all together, was using backbone. And there was one case when having server-side templates w

Categories : Grails

client side and server side page generation
From my experience, there are two scenarios in which you'd want to render client-side: You are building a pure client-side JS application. You want to serve the data for different platforms (web, desktop, mobile native). Unless you identify your page with one of the previous scenarios (which I assume you don't), I recommend you to render in server side. Although the response is going to be bigger (server side computing time is negligible), the perceived speed compared to client side rendering is going to be faster. If you need to serve a very big page, note that you could autoload chunks of HTML via AJAX whenever the user reaches the bottom of the page without the need of client side templates.

Categories : Javascript

Accessing Client-Side arrays on Server Side ASP.Net
A valid approach would be to serialize them and assign it to a runat="server" hidden field. You'll be able then to access the array deserializing Value property. You can easily handle serialization with json format or comma separated values.

Categories : C#

Server-side internationalization vs client-side?
Doing clientside i18n is growing - as implementing clientside applications in web gets more mature. you might get inspired by http://i18next.com/pages/doc_templates.html

Categories : Javascript

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

Client side MVC instead of server side MVC
Was to long for a comment I guess the tricky part is indeed the point you mentioned f we link each other, they will perfectly look like a complex web app. Because each MVC framework uses a different approach to tackle usual problems you have in modern web-apps, like routing, data binding, application state and rendering DOM elements, so I think you would end up having multiple frameworks doing tasks that overlap substantially, thus forcing you to deactivate or disable some of the built-in functionality of one or the other framework making your frankenstein-app :) very difficult to maintain. A good example is jQuery-mobile & ember.js, both have a routing system, jQuery uses the DOM to hold state ember.js holds it's state completely in javascript which is much faster. I had a s

Categories : Ruby On Rails

Yahoo authentication by OAuth without any redirection(client-side). Is it possible?
You can use popup UI for this purpose. Yahoo supports it. This post will help you: Yahoo and Popup UI for OpenID See the demo. Check out these too: A simple YUI 3 module for adding Yahoo! login to a page and yahoo-oauth-popup.

Categories : Javascript

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

Implementing FCSubscribe on client side
For those looking to add onFCSubscribe support, here's a couple links that helped me. First, ensure that your rtmp stream plays by checking it here: http://support.akamai.com/flash/index.html?autostart=true&url=rtmp://REPLACE-WITH-YOUR-RTMP-STREAM-URL More to your point, I found these two resources helpful: Hacking FCSubscribe Support Around OSMF Internap FCSubscribe example You use the onFCSubscribe and onFCUnsubscribe to open and close the netStream public var hostName:String = "rtmp://client.flash.internapcdn.net/client/live_1"; public var streamName:String = "thestream"; public var netConnection:NetConnection; public var netStream:NetStream; public var video:Video; public function BasicLiveVideo() { video = new Video(); this.addChild(video); netConnection = new

Categories : Actionscript

CSS 100% divs side by side, Horizontal flow
Quick Example: http://jsfiddle.net/DTTnB/ You can fine-tune this how you want I took off overflow-x: hidden so you can see that they lie horizontally . you were on the right track Key differences: I made each of the containers only a proportion of their wrapping container: .checkout: width : 20%; Their wrapping container I made it wide enough to accommodate all containers so that each container would take up at least the page width. checkoutContainer: width : 1000%; you can fine tune this

Categories : CSS

Twitter Bootstrap: How to layout multiple input-prepend's side-by-side on one row
I think what you want is a combination of input prepend with form-inline, rather than using spans. http://twitter.github.io/bootstrap/2.3.2/base-css.html#forms I've just had a quick go on JSFiddle. Give this a try and see if it works for you: http://jsfiddle.net/6jAhe/ <!-- CULPRIT START --> <div class="row-fluid"> <div class="span12"> <div class="control-group form-inline"> <label for="ActualDoorSizeHeight" class="control-label">Actual Door Size:</label> <div class="input-prepend"> <span class="add-on">H</span><input id="ActualDoorSizeHeight" class="" type="text" data-bind="value: vm.ActualDoorSizeHeight" /> </div> <div class="input-prepend"

Categories : HTML

Devexpress mvc extensions. Whether these extensions are server side or client side?
That depends on what you mean by "are server side or client side". It is not a pure Javascript library. They use features of the MVC framework in order to do their magic, so I'd say they are both (but not just one side). More specifically, they implement custom controls that you include in your views. The controls have settings and such that you set on server side. However, the code generated relies on Javascript so they run on the client (using ajax calls when necessary). See documentation and examples here: link

Categories : Asp Net Mvc

Implementing Referenceable objects client-side with Twisted Perspective Broker
The simplest way to do this is to take the client-side object that the server needs to use and pass it to the server. Almost any solution I can think of has this at its core. Change your client's got_obj method to be something more like this: def got_obj(self, rootsrvobj): print "Got root server obj:", rootsrvobj self.server = rootsrvobj def2 = self.server.callRemote("SomeFunc", self, SomeData) And change the implementation of remote_SomeFunc to be something more like this: def remote_SomeFunc(self, client, SomeData): self.DataOut = hash(SomeData) print "Now sending reply..." client.callRemote("client_print", "Here is your reply") You might want to investigate Twisted Cred as a more structured way to manage references to your client object - but cred is just

Categories : Python

Is it possible to implement Oauth 1.0 through just javascript without any server side script?
No it is not possible. This is one of the reasons OAuth 2.0 was born. https://blog.apigee.com/detail/oauth_differences For instance, OAuth 2.0 also clearly lays out how to use OAuth entirely inside a browser using JavaScript that has no way to securely store a token, and it explains at a high level how to use it on a mobile phone or even on a device that has no web browser at all.

Categories : Javascript

Issues in implementing server side authorization to google drive
if you try to have offline access, first of all you must get authorization code which may be redeemed for an access token and a refresh token. 1) Enable Google Drive Services from Google APIs console 2) Create Client ID for web applications then , get authorization code, for instance: https://accounts.google.com/o/oauth2/auth?access_type=offline &approval_prompt=auto &client_id=[your id] &redirect_uri=[url] &response_type=code &scope=[access scopes] &state=/profile after that, you can call exchangeCode() , and its parameter will be your authorization code that was retrieved before.

Categories : Java

In client side MVC, who should handle client-server communication?
The model layer should be interacting with data source. In case of client-server setup where you have two separate and independent triads, the data source for client's model layer would be server's presentation layer. Basically, your client-side's model layer becomes the user of server-side.

Categories : Web Services

Get specific twitter user timeline without server side coding
Use GET to retrieve the Json from the following URL and then parse it to get the required JSON attribute using javascript https://api.twitter.com/1.1/statuses/user_timeline.json? user_id : The ID of the user for whom to return results for.

Categories : Javascript

Implementing a form validation plugin with AngularJS with Django REST at the server side
Here you could find my attempt to handle server side validation errors with the directive https://github.com/9ci/angle-grinder/blob/c0211c885c561f8ec820b38d506135f4fb8b6dfb/app/scripts/modules/forms.coffee#L321 I hope it would be useful for you.

Categories : Javascript

Is there a client+server-side MVC JS framework
rendr (backbone with server-side support) meteor (very real-time oriented)

Categories : Javascript

client and server side validation
You could use intval to convert the string size into an integer, for example intval('12 inch') will return 12.

Categories : PHP

Should I send user tweet from browser side or server side?
To answer my own question after a bit of investigation: For a web application, the Oauth token is generally preserved on the server, and REST APIs are also called from server side. The calls can be made synchronously, so task queue is not necessarily needed. For a native app, Oauth is generally handled within the app. A webview is used to load the authenciation URI, and when it redirects, the access code is captured in the URL. The access code is used by the app to obtain the access token. For native apps, there is another authentication method generally referred to as SSO. It switches to the service provider's native app, and let user grant acces there, then switching back to your app. This is more convenient for the user, as the native client is almost always in logged-in state, savin

Categories : Javascript

how to download a pdf file stored in a server in client side in node.js server
Send the correct mime-type, and then the content of the pdf. fs.readFile('temp/xml/user/username.pdf',function(error,data){ if(error){ res.json({'status':'error',msg:err}); }else{ res.writeHead(200, {"Content-Type": "application/pdf"}); res.write(data); res.end(); } }); I'm assuming res is your response object. Ah but you are using Express. Use Jonathan's answer instead.

Categories : Node Js

Mixing Client-/Server-Side Tests
I wouldn't mix these two types of tests at all. You have several different concerns here. You can still get full test coverage without having to combine tests like you are describing. Client side unit tests (using Karma, Mocha, etc.) validate that the JavaScript code is behaving as expected. Server side unit tests (using JUnit or whatever unit testing framework exists for your back end) validate that the server code is behaving as expected. Integration or end-to-end tests (using Selenium) validate generally validate that multiple components are working together correctly. You can use a mock back-end for these if necessary. You can create Karma/Mocha unit tests to verify the details of whatever processing may exist for that file upload action. Here, you should be testing edge cases of t

Categories : Javascript



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