Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/29/14 in all areas

  1. Salutare, vreau ma sa perfectionez in acest capitol si daca tot fac asta macar sa va fac si voua niste prezentari. Deci daca aveti un site sau produs si nu aveti o prezentare video, o sa imi faca placerea sa va ajut. Desigur ca puteti sa alegeti versiunea de mai jos sau imi puteti da voi i ideie despre cum doriti sa arate. Minim 1+ rep. Exemplu de prezentare: https://www.youtube.com/watch?v=dNvFHBfXFxQ&feature=youtu.be O sa dureze unpic pana primiti prezentarile. EDIT: Ma opresc aici deocamdata, am primit 30 de cereri
    2 points
  2. Fa-mi o posa cu cash-ul cand ii scoti! Daca vrei iti pot da si eu GayCoins in valoare de 5k$
    1 point
  3. Cu ajutorul Acestui program urmarind tutorialul facut de @io.kent si cu ajutorul configului facut de mine, poti face rost de conturi de feisbuc
    1 point
  4. setsockopt(iResult, SOL_SOCKET, SO_RCVTIMEO, (char *)&tv, sizeof(tv)); setsockopt(iResult, SOL_SOCKET, SO_SNDTIMEO, (char *)&tv, sizeof(tv)); in loc de IResult trebuie sa pui conn, care este socketul tau. daca faci socketul non-blocking nu mai folosesti setsockopt, intrucat timeoutul il setezi cu select mai jos ti-am facut un exemplu, s-ar putea sa aiba erori, nu l-am testat. fd_set readme; int result, ret; char reply[10]; struct timeval timeout; timeout.tv_sec = 3; /* Cate secunde? */ timeout.tv_usec = 0; /* Daca nu setam aici e posibil sa avem belele. */ ioctlsocket(conn, FIONBIO, 1); /* setam non-blocking */ FD_ZERO(&readme); FD_SET(conn, &readme); result = connect(conn, (struct sockaddr*)(&server), sizeof(struct sockaddr_in)); if (result == -1) { if (errno == WSAEISCONN) /* pe win trebuie cu WSAGetLastError */ { result = select(conn + 1, &readme, NULL, NULL, &timeout); /* si aici if (result) daca result < 0 am esuat*/ if(result) ret = recv(conn, reply, 10, 0); /* incercam sa vedem daca primim 10 bytes*/ /* restul e can-can, ret o sa-ti returneze numarul de bytes, daca ret <= 0 am esuat */ } } else { result = select(conn + 1, &readme, NULL, NULL, &timeout); /* si aici if (result) daca result < 0 am esuat*/ if(result) ret = recv(conn, reply, 10, 0); /* incercam sa vedem daca primim 10 bytes*/ /* restul e can-can, ret o sa-ti returneze numarul de bytes, daca ret <= 0 am esuat */ } totodata, cand folosesti non-blocking, trebuie sa fii atent la errcode pe care ti-l returneaza conexiunea. Pe linux este EISCONN care sugereaza succes. pe windows este WSAEISCONN. samd. Sunt mai multe cazuri, ti-am dat doar un exemplu prin care trebuie sa faci error handling. chiar nu am windows la indemana si te ajut din amintiri. oricum, tinand cont de cunostintele tale cu sockets, iti recomand sa folosesti setsockopt si nu mai pune socketul in non-blocking ptr. ca nu este cazul. Asa ca iti propun modificarile astea: sterge astea, ti-am zis ori folosesti setsockopt ori non-blocking cu select. nu amandoua. iResult = ioctlsocket(conn, FIONBIO, &iMode); if (iResult != NO_ERROR) printf("ioctlsocket failed with error: %ld\n", iResult); aici asa trebuie: if (server.sin_addr.s_addr != -1) { bzero(&(server.sin_zero), 8); setsockopt(conn, SOL_SOCKET, SO_RCVTIMEO, (char *)&tv, sizeof(tv)); setsockopt(conn, SOL_SOCKET, SO_SNDTIMEO, (char *)&tv, sizeof(tv)); error = connect(conn, (struct sockaddr *) &server, sizeof (struct sockaddr)); if (error) return conn; //succes else { wprintf(L"bind failed with error %u\n", WSAGetLastError()); closesocket(conn); WSACleanup(); return NULL; } } tu te conectezi de doua ori pe acelasi socket. un potential motiv pentru eroarea care-ti apare.
    1 point
  5. Asta si-a batut maciuca de voi sa vada care-s nolife-rii care iau chatul in serios.Ca parca nu se vedea pe forum care e de la 7 dimineata pana la 23
    -1 points
  6. si concluzia care este? in afara de faptul ca ai dat un cp. plus ca dai reputatie negativa ca te intreb care e concluzia post-ului tau? to async or not? well? to async or not?
    -1 points
  7. This article tries to create a clear understanding on making synchronous and asynchronous ajax calls through jQuery ajax method. After going through it you can have a clear idea on how and when to do asynchronous ajax calls. Introduction Ajax(Asynchronous Javascript + XML) is a new approach now a days very popular in web development. Ajax taken our classic web development to a different level. It is a new approach to create fast and dynamic web pages.It toally removed the reloading part from the classical web development. Background There are many Ajax methods provided by jQuery library to accomplish ajax calls as listed below :- get post getScript getJSON ajax These all ajax methods can be used as per requirements you are having but, if you need extensive configurability and want to handle errors by yourself then '.ajax()' method is the best. To work with the jQuery ajax method we need to set the options available for it properly, from which 'async' is an important setting about which we are going to discuss here as setting its value will have a major impact in getting response properly. As async is an boolean property, we can set either TRUE or FALSE value for it. Here i will explain various scenarios on setting each values for the particular property(async) and to help you understanding its importance and usability by situation. Using the code Here i am explaining simple examples how and when to make your choice in between asynchronous or synchronous ajax calls using jQuery. Both methods independent of each other :- There will be no impact on result if both are independent whether it is a asynchronous or synchronous ajax calls $(function () { // When both the method are independent & async=false GetData1(false); GetData2(false); // When both the method are independent & async=true GetData1(true); GetData2(true); }); First Method function GetData1(isAsync) { $.ajax({ type: "POST", url: "../WebMethods/WebService.asmx/GetData1", data: "{}", contentType: "application/json; charset=utf-8", dataType: "json", async: isAsync, success: function (response) { var result = JSON.parse(response.d); }, error: function (XMLHttpRequest, textStatus, errorThrown) { alert(errorThrown); } }); } Second Method function GetData2(isAsync) { $.ajax({ type: "POST", url: "../WebMethods/WebService.asmx/GetData2", data: "{}", contentType: "application/json; charset=utf-8", dataType: "json", async: isAsync, success: function (response) { var result = JSON.parse(response.d); }, error: function (XMLHttpRequest, textStatus, errorThrown) { alert(errorThrown); } }); } Second method dependent on first one :- But when second method is dependent on result supplied from first method it will definitely have impact $(function(){ // When second method depends on result of the first method & async=false // If it is a synchronous call then you can get the result from first method before the second method call var result = GetData3(false); // proper result can be found GetData4(false, result); // When second method depends on result of the first method & async=true // If it is an asynchronous call then both the calls will happen asynchrously/simultaneously and you will not // get the result from first method before call of second method as happens in below example var result = GetData3(true); // result will be null here GetData4(true, result); }); First Method function GetData3(isAsync) { var result = null; $.ajax({ type: "POST", url: "../WebMethods/WebService.asmx/GetData3", data: "{}", contentType: "application/json; charset=utf-8", dataType: "json", async: isAsync, success: function (response) { result = JSON.parse(response.d); }, error: function (XMLHttpRequest, textStatus, errorThrown) { alert(errorThrown); } }); return result; } Second Method : Takes an extra argument which is the result of first method. function GetData4(isAsync, result) { $.ajax({ type: "POST", url: "../WebMethods/WebService.asmx/GetData4", data: "{}", contentType: "application/json; charset=utf-8", dataType: "json", async: isAsync, success: function (response) { if (result.id == 1) { var result = JSON.parse(response.d); // do your operation here } else alert('No operation required..'); }, error: function (XMLHttpRequest, textStatus, errorThrown) { alert(errorThrown); } }); } Points of Interest This will definitely of help to the developers who started working on jQuery Ajax method. There are many scenarios and requirements, we need to understand the fundamentals so that we can make right choice one at right place. Source
    -1 points
  8. Felicitari ba @Kronzy uite inca unu E ala de la nume?
    -1 points
×
×
  • Create New...