All Questions

4
answers

Error message in datetime field

I have a field in my application in mvc asp.net c # to put start date and end date. [Required(ErrorMessage = "A data de início é obrigatória")] [DisplayFormat(DataFormatString = "{0:dd/MM/yyyy}", ApplyFormatInEditMode = true)] publ...
asked on 02.07.2014 / 18:19
2
answers

___ ___ erkimt What are the data transfer forms available to JavaScript? ______ qstntxt ___

It is common to find questions, answers and tutorials talking about AJAX, which is nothing more than %code% , as a way of transferring data between two computers.

I would like to know if there are other forms , whether standard or proprietary, limited in some condition or open to any user and site. An example of a limited form, if any, would be an API restricted to extensions.

In particular, but not restricting, I'm looking for a way to transfer data - something between 10 and 30 bytes - in the fastest way possible between two computers within the same network. Peer-to-Peer would be ideal, but I do not know if JS supports it. I have already tried testing services such as Firebase , which allowed a minimum response time, however, using a server out of network and with occasional loss of data.

Knowing other ways I wanted to find one that would fit better with what I'm developing. It does not look like the answer will be anything big: the options seem to be quite limited, since it looks like only AJAX is used.

    
______ azszpr8188 ___

There are several APIs that will allow you to transport data via Javascript.

Some will only allow you to receive data, others will allow you to send and receive.

The ones that allow you to send and receive data are:

  • %code%
    • Requests via HTTP protocol
  • %code%
    • It is a cross-compatible HTTP protocol focused on message exchanges lighter and faster than request, but it does not have a state resolution as efficient as %code%
    • W3C Specification
  • %code%
    • Peer-to-peer data exchange protocol was created to solve the problem of video and audio transmissions between browsers.
    • W3C Specification

If the data transmission needs to be p2p, the ideal is to use WebRTC, but it is still rather complex to create a server that will make the handshake between two browsers and start communication.

A simpler solution is to use WebSockets , but all information will go through a server that will receive data from one client and send it to another or other clients. But the websocket has the constraint of working with UTF-8, however it is possible to use data converters to convert binary data to UTF-8 before being transmitted and back to the original format when received, there are several ways, one of them is using the %code% .

    
______ azszpr8194 ___

I suggest using Socket IO, a javascript extension already adapted for use in cross-browser and that has an extra advantage, it chooses the most efficient way to carry data between the technologies below (which are the answer to your question) :

1) WebSocket;
2) Adobe Flash Socket;
3) AJAX long polling;
4) AJAX multipart streaming;
5) Forever iframe;
6) JSONP Polling.

Still, this extension has excellent compatibility: IE 5.5+; Safari 3+; Chrome 4+; Firefox 3+; Opera 10.61+; Iphone / Ipad Safari; Android Webkit and Webkits Webkit.

link

I have had excellent experiences with this extension. When you opt for a path where fallbacks are already included, everything gets easier!

Good Luck!

    
___

It is common to find questions, answers and tutorials talking about AJAX, which is nothing more than XMLHttpRequest , as a way of transferring data between two computers. I would like to know if there are other forms , whether standard...
asked on 06.03.2014 / 01:30
2
answers

Find Element tr of a certain content

I'd like to know how to find a particular <tr> element in a numbered table. For example: In a table where each <tr> line has its <td> cells numbered 1-5, containing 4 lines <tr> , if I pass the...
asked on 30.03.2015 / 17:09
3
answers

What's the difference between System.Web.Http and System.Web.Mvc?

I have a MVC project and I will have regular controls and controls providing services via webservices ( Controller and ApiController ). And I do not know which one to use because I do not know which one is best.     
asked on 25.06.2016 / 15:48
4
answers

How to extract digits from a string in Python and add them together?

I need to decompose a string into Python, separating letter and numbers, and perform the sum of these numbers. For example: string ="96h11k" From this string I need to extract the numbers 9, 6, 1, 1 and add them: 9 + 6 + 1 + 1 = 17. Act...
asked on 28.11.2014 / 18:19
3
answers

How to write a pseudocode?

I was reading about algorithms, but all the algorithms I read, were written in some unknown language or not invented, but somehow I could understand what was written there. I read about Portugol , a "language" written in Portuguese that was...
asked on 03.08.2017 / 07:38
4
answers

Add rownames as column using dplyr

I would like to do something that is fairly simple using the common syntax of R, but using the dplyr package. The task is basically to add the row.names of a data.frame object as a column to that same object. Using mtc...
asked on 01.10.2014 / 20:11
5
answers

Check if day exists in the month

I need to check / validate if a (numeric) day exists in a given month. For example: I have day 31 , and since it does not exist in the month of February the condition will fail. I think a simple if will solve the problem, wher...
asked on 07.02.2014 / 16:47
3
answers

When to use asynchronous or synchronous methods?

When should I use asynchronous or synchronous methods in controllers (Index, search, delete, create) ASP.NET MVC applications? Can I lose performance? In which situations should I use one or the other, could you give examples? If I have...
asked on 03.05.2017 / 03:33
4
answers

What is the difference between i ++ and ++ i?

I found a piece of code in an application that I'm giving continuity that I had not seen yet (or had never noticed). I casually always used i++ in a loop of repetition, for example, however in this section it was ++i and I did not...
asked on 04.10.2017 / 08:10