josedasilva @ 16:51

Qua, 20/09/06

Pois é, o uso detse tipo de técnicas, onde não temos o total controlo sobre a velocidade e ordem de recepção de pedidos leva por vezes a histórias destas, aliás é por isso mesmo se chama assíncrono.

Num dos testes de laboratório que tanto gosto de efectuar, estive a testar multiplos pedidos simulâneos assincronos, o que me levou à descoberta de um possível problema, quando não temos em mente que dois pedidos assíncronos, efectuados no mesmo momento, podem ter tempos de resposta variáveis.

Imaginemos a seguinte iteracção:

1. Click num qualquer botão leva ás seguintes acções:

1. Envio de pedido para alterar o estado de um registo na base de dados e actualização da "div" actual
2. Envio de pedido de actualização de uma segunda "div" com o registo editado anteriomente já actualizado

A ideia é simples, imaginem-se duas listas, onde numa se listam registos activos e na outra se listam registos inactivos. Imagine-se que se deseja inactivar um registo, a estratégia passa por actualizar o registo na base de dados como inactivo e actualizar ambas as listas de modo a que o registo passe a constar imediatamente da lista certa.



  1. function deleteRecord() {

  2. doAjaxTODeleteRecordAndUpdateDeletedRecordList() ;

  3. doAjaxTOUpdateActiveRecordsList();

  4. }



O problema ocorre quando o pedido assíncrono de edição do registo para estado inactivo é executado após o pedido de actualização das listas. No meu caso o registo de edição era efectuado antes da actualização das listas, umas vezes e noutras nem por isso.

A solução poderia passar por:



  1. function deleteRecord() {

  2. doAjaxTODeleteRecordAndUpdateDeletedRecordList();

  3. setTimeout(doAjaxTOUpdateActiveRecordsList(),1000);

  4. }



A solução pode passar por obrigar o segundo pedido a ter um delay de alguns micro segundos, não garante que é tratado antes, mas garante que existem infimas probabilidades de não o ser. Ou então executar apenas o segundo pedido quando recebermos a resposta do primeiro.
UPDATE [21 Set 2006]
O Marco, do Webaserio, apresentou uma outra solução para o problema, basicamente a alternativa dele seria actualizar as duas listas na mesma chamada assíncrona, eliminando assim uma das chamadas e conseguindo garantir a ordem das respostas. Outra das soluções falada, em conversa com ele, era a da possibilidade de efectuar a actualização das listas apenas com javascript, e esta seria a solução mais eficaz, que sonsistia em mudar os elementos de lista usando javascript, directamente no DOM.Existem diversas formas de efectuar o mesmo procedimento, vamos ter de optar pela mais correcta dado o problema.

Tags:

spvdnjmvVKpnWksxcsj @ 11:08

Qua, 26/11/14

 

ranbaxy pharmacueticals, ethionamide avelox (http://www.looduspere.ee/ForumRetrieve.aspx?ForumID=1285&TopicID=184947&NoTemplate=False), [url="http://www.looduspere.ee/ForumRetrieve.aspx?ForumID=1285&TopicID=184947&NoTemplate=False"]ethionamide avelox[/url], http://www.looduspere.ee/ForumRetrieve.aspx?ForumID=1285&TopicID=184947&NoTemplate=False ethionamide avelox, qqdc, cefuroxime sulfamethoxazole (http://support.itechnologies.ae/entries/40805349-Where-To-Order-SMZ-TMP-400mg-in-Lansing-bactrim-ds-800-16), [url="http://support.itechnologies.ae/entries/40805349-Where-To-Order-SMZ-TMP-400mg-in-Lansing-bactrim-ds-800-16"]cefuroxime sulfamethoxazole[/url], http://support.itechnologies.ae/entries/40805349-Where-To-Order-SMZ-TMP-400mg-in-Lansing-bactrim-ds-800-16 cefuroxime sulfamethoxazole, uec, how much does avodart cost with insurance (http://projchibarpass.webpin.com/blog_364474_Generic-Dutasteride-0-5mg-Over-The-Counter-Online-No-Prescription-avodart-flomax-combination-drug.html), [url="http://projchibarpass.webpin.com/blog_364474_Generic-Dutasteride-0-5mg-Over-The-Counter-Online-No-Prescription-avodart-flomax-combination-drug.html"]how much does avodart cost with insurance[/url], http://projchibarpass.webpin.com/blog_364474_Generic-Dutasteride-0-5mg-Over-The-Counter-Online-No-Prescription-avodart-flomax-combination-drug.html how much does avodart cost with insurance, 2072,

gXyePBfAbJKpWfbpd @ 17:40

Qua, 26/11/14

 

pharmacy shadowing, ampicillin drug book (https://archive.org/details/WithMasterCardOnlineGenericSalbutamol4mgInCopenhagen), [url="https://archive.org/details/WithMasterCardOnlineGenericSalbutamol4mgInCopenhagen"]ampicillin drug book[/url], https://archive.org/details/WithMasterCardOnlineGenericSalbutamol4mgInCopenhagen ampicillin drug book, kqve, ampicillin sulbactam atc code (http://support.turnkeyactivator.com/entries/90593766-Purchase-Online-Generic-Principen-250mg-in-Gainesville-ampicillin-trihydrate-bronchitis), [url="http://support.turnkeyactivator.com/entries/90593766-Purchase-Online-Generic-Principen-250mg-in-Gainesville-ampicillin-trihydrate-bronchitis"]ampicillin sulbactam atc code[/url], http://support.turnkeyactivator.com/entries/90593766-Purchase-Online-Generic-Principen-250mg-in-Gainesville-ampicillin-trihydrate-bronchitis ampicillin sulbactam atc code, 8-OO, ampicillin gas (https://jkes.zendesk.com/entries/87930006-Where-Can-I-Order-Generic-Ampicillin-in-Mobile-difference-between-ampicillin-augmentin), [url="https://jkes.zendesk.com/entries/87930006-Where-Can-I-Order-Generic-Ampicillin-in-Mobile-difference-between-ampicillin-augmentin"]ampicillin gas[/url], https://jkes.zendesk.com/entries/87930006-Where-Can-I-Order-Generic-Ampicillin-in-Mobile-difference-between-ampicillin-augmentin ampicillin gas, :(((, buy viagra with priligy (https://offerssupport.groovv.com/entries/89216443-Online-No-Prescription-No-Membership-Generic-Dapoxetine-in-Glendale-dapoxetine-available-canada-news), [url="https://offerssupport.groovv.com/entries/89216443-Online-No-Prescription-No-Membership-Generic-Dapoxetine-in-Glendale-dapoxetine-available-canada-news"]buy viagra with priligy[/url], https://offerssupport.groovv.com/entries/89216443-Online-No-Prescription-No-Membership-Generic-Dapoxetine-in-Glendale-dapoxetine-available-canada-news buy viagra with priligy, npztjs,

HChKtzSvlokzrPeN @ 00:14

Qui, 27/11/14

 

willis st pharmacy, ciloxan conjunctivitis (http://help.enewhope.org/entries/89397066-Where-To-Buy-Online-Cetraxal-in-Dallas-gutt-ciloxan), [url="http://help.enewhope.org/entries/89397066-Where-To-Buy-Online-Cetraxal-in-Dallas-gutt-ciloxan"]ciloxan conjunctivitis[/url], http://help.enewhope.org/entries/89397066-Where-To-Buy-Online-Cetraxal-in-Dallas-gutt-ciloxan ciloxan conjunctivitis, 869908,

PXyMqUtkxdXhnKEd @ 06:34

Qui, 27/11/14

 

peter riebel dsm pharma chemicals, ciloxan how to use (http://support.impelconsulting.com/entries/37195415-Where-To-Order-Cheap-Generic-Ciprofloxacin-With-MasterCard-Online-No-Prescription-in-Naperville-cilo), [url="http://support.impelconsulting.com/entries/37195415-Where-To-Order-Cheap-Generic-Ciprofloxacin-With-MasterCard-Online-No-Prescription-in-Naperville-cilo"]ciloxan how to use[/url], http://support.impelconsulting.com/entries/37195415-Where-To-Order-Cheap-Generic-Ciprofloxacin-With-MasterCard-Online-No-Prescription-in-Naperville-cilo ciloxan how to use, 9860, buy cheap cialis usa visa (https://bmr.zendesk.com/entries/92818066-Where-Can-I-Buy-Cialis-Soft-20mg-With-Visa-Online-No-Membership-in-Waco-generic-cialis-tadalafil), [url="https://bmr.zendesk.com/entries/92818066-Where-Can-I-Buy-Cialis-Soft-20mg-With-Visa-Online-No-Membership-in-Waco-generic-cialis-tadalafil"]buy cheap cialis usa visa[/url], https://bmr.zendesk.com/entries/92818066-Where-Can-I-Buy-Cialis-Soft-20mg-With-Visa-Online-No-Membership-in-Waco-generic-cialis-tadalafil buy cheap cialis usa visa, 967195, viagra levitra and cialis side effects (http://natepekin.webpin.com/blog_311802_Generic-Tadapox--Cialis-Super-Force-Tadalafil-20mg---Dapoxetine-60mg--Online-No-Prescription-No-Membership-differenze-tra-viagra-cialis-levitra.html), [url="http://natepekin.webpin.com/blog_311802_Generic-Tadapox--Cialis-Super-Force-Tadalafil-20mg---Dapoxetine-60mg--Online-No-Prescription-No-Membership-differenze-tra-viagra-cialis-levitra.html"]viagra levitra and cialis side effects[/url], http://natepekin.webpin.com/blog_311802_Generic-Tadapox--Cialis-Super-Force-Tadalafil-20mg---Dapoxetine-60mg--Online-No-Prescription-No-Membership-differenze-tra-viagra-cialis-levitra.html viagra levitra and cialis side effects, :DDD, cialis tem efeito colateral (http://starborjati.soup.io/post/447878515/Generic-Tadapox-Over-The-Counter-With-MasterCard), [url="http://starborjati.soup.io/post/447878515/Generic-Tadapox-Over-The-Counter-With-MasterCard"]cialis tem efeito colateral[/url], http://starborjati.soup.io/post/447878515/Generic-Tadapox-Over-The-Counter-With-MasterCard cialis tem efeito colateral, pwxy,

dlcrVQOOvMHmCux @ 13:35

Qui, 27/11/14

 

doyle's pharmacy, zithromax 200 mg 5ml susp (http://hoopdog.zendesk.com/entries/88067696-With-MasterCard-Online-No-Prescription-Generic-Zithromax-in-Thornton-azithromycin-and-metabolism), [url="http://hoopdog.zendesk.com/entries/88067696-With-MasterCard-Online-No-Prescription-Generic-Zithromax-in-Thornton-azithromycin-and-metabolism"]zithromax 200 mg 5ml susp[/url], http://hoopdog.zendesk.com/entries/88067696-With-MasterCard-Online-No-Prescription-Generic-Zithromax-in-Thornton-azithromycin-and-metabolism zithromax 200 mg 5ml susp, 2773, can i take a cold medicine with zithromax (http://decutamus.soup.io/post/447585095/Where-Can-I-Buy-Generic-AzaSite-250mg), [url="http://decutamus.soup.io/post/447585095/Where-Can-I-Buy-Generic-AzaSite-250mg"]can i take a cold medicine with zithromax[/url], http://decutamus.soup.io/post/447585095/Where-Can-I-Buy-Generic-AzaSite-250mg can i take a cold medicine with zithromax, yabi, is azithromycin stronger (http://desckaslical.webpin.com/blog_345296_Without-Prescription-FDA-Approved-Zmax-250mg-in-Alexandria-lipitor-and-zithromax.html), [url="http://desckaslical.webpin.com/blog_345296_Without-Prescription-FDA-Approved-Zmax-250mg-in-Alexandria-lipitor-and-zithromax.html"]is azithromycin stronger[/url], http://desckaslical.webpin.com/blog_345296_Without-Prescription-FDA-Approved-Zmax-250mg-in-Alexandria-lipitor-and-zithromax.html is azithromycin stronger, orrmq,

bsfsdWOCuYyrsNUQhY @ 01:51

Sex, 28/11/14

 

challenges in the pharmaceutical industry, when can i drink alcohol after taking metronidazole (http://grosiramle.soup.io/post/447240578/Over-The-Counter-With-MasterCard-Online-No), [url="http://grosiramle.soup.io/post/447240578/Over-The-Counter-With-MasterCard-Online-No"]when can i drink alcohol after taking metronidazole[/url], http://grosiramle.soup.io/post/447240578/Over-The-Counter-With-MasterCard-Online-No when can i drink alcohol after taking metronidazole, 174, flagyl for dog side effects (https://nurseadvice.zendesk.com/entries/89695643-Generic-Metizol-Over-The-Counter-With-Visa-Online-No-Membership-flagyl-for-inflammatory-bowel-diseas), [url="https://nurseadvice.zendesk.com/entries/89695643-Generic-Metizol-Over-The-Counter-With-Visa-Online-No-Membership-flagyl-for-inflammatory-bowel-diseas"]flagyl for dog side effects[/url], https://nurseadvice.zendesk.com/entries/89695643-Generic-Metizol-Over-The-Counter-With-Visa-Online-No-Membership-flagyl-for-inflammatory-bowel-diseas flagyl for dog side effects, :-]], ppi clarithromycin metronidazole (http://nnanrecppilta.webpin.com/blog_410959_FDA-Approved-Metro-200mg-Without-Rx-in-Buffalo-metronidazole-darkened-urine.html), [url="http://nnanrecppilta.webpin.com/blog_410959_FDA-Approved-Metro-200mg-Without-Rx-in-Buffalo-metronidazole-darkened-urine.html"]ppi clarithromycin metronidazole[/url], http://nnanrecppilta.webpin.com/blog_410959_FDA-Approved-Metro-200mg-Without-Rx-in-Buffalo-metronidazole-darkened-urine.html ppi clarithromycin metronidazole, iym,

yjTuVeMsj @ 07:58

Sex, 28/11/14

 

american pharmaceutical institute, indications for clindamycin (http://techsummit.businesscatalyst.com/ForumRetrieve.aspx?ForumID=317&TopicID=821707&NoTemplate=False), [url="http://techsummit.businesscatalyst.com/ForumRetrieve.aspx?ForumID=317&TopicID=821707&NoTemplate=False"]indications for clindamycin[/url], http://techsummit.businesscatalyst.com/ForumRetrieve.aspx?ForumID=317&TopicID=821707&NoTemplate=False indications for clindamycin, qllsi, ciprofloxacin fda label (http://snk.to/E6DF), [url="http://snk.to/E6DF"]ciprofloxacin fda label[/url], http://snk.to/E6DF ciprofloxacin fda label, 74519,

cprRpKyJpIBjmgln @ 14:06

Sex, 28/11/14

 

headhunters pharmaceutical biotech hospital sales, clindamycin phosphate gel usp clear gel (http://support.indigo-group.co.uk/entries/88070153-Generic-Clindets-150mg-With-Free-Shipping-clindamycin-dosage-po), [url="http://support.indigo-group.co.uk/entries/88070153-Generic-Clindets-150mg-With-Free-Shipping-clindamycin-dosage-po"]clindamycin phosphate gel usp clear gel[/url], http://support.indigo-group.co.uk/entries/88070153-Generic-Clindets-150mg-With-Free-Shipping-clindamycin-dosage-po clindamycin phosphate gel usp clear gel, yeifk, cipro nord pleiadi (http://www.relevatesupport.com/entries/93006383-With-Visa-Online-No-Membership-Generic-Cifran-in-Killamarsh-ciprofloxacin-erythrasma), [url="http://www.relevatesupport.com/entries/93006383-With-Visa-Online-No-Membership-Generic-Cifran-in-Killamarsh-ciprofloxacin-erythrasma"]cipro nord pleiadi[/url], http://www.relevatesupport.com/entries/93006383-With-Visa-Online-No-Membership-Generic-Cifran-in-Killamarsh-ciprofloxacin-erythrasma cipro nord pleiadi, 469352,

YVsWJnZlSHBQ @ 20:10

Sex, 28/11/14

 

arkansas pharmacy association 2008 convention, viagra umsatz 2009 (https://archive.org/details/PurchaseOnlineGenericOrlistatInBolton), [url="https://archive.org/details/PurchaseOnlineGenericOrlistatInBolton"]viagra umsatz 2009[/url], https://archive.org/details/PurchaseOnlineGenericOrlistatInBolton viagra umsatz 2009, qzl, santa viagra (http://customerservices.inclarity.co.uk/entries/87872673-Purchase-Generic-Fildena-150mg-With-Visa-Online-No-Prescription-in-Dudley-cost-of-viagra-from-boots), [url="http://customerservices.inclarity.co.uk/entries/87872673-Purchase-Generic-Fildena-150mg-With-Visa-Online-No-Prescription-in-Dudley-cost-of-viagra-from-boots"]santa viagra[/url], http://customerservices.inclarity.co.uk/entries/87872673-Purchase-Generic-Fildena-150mg-With-Visa-Online-No-Prescription-in-Dudley-cost-of-viagra-from-boots santa viagra, 799,

wfzKMYaEtlQZE @ 02:42

Sab, 29/11/14

 

pain pharmacological reference molecules, precio viagra lima peru (http://www.sherrihaab.com/ForumRetrieve.aspx?ForumID=4531&TopicID=869210&NoTemplate=False), [url="http://www.sherrihaab.com/ForumRetrieve.aspx?ForumID=4531&TopicID=869210&NoTemplate=False"]precio viagra lima peru[/url], http://www.sherrihaab.com/ForumRetrieve.aspx?ForumID=4531&TopicID=869210&NoTemplate=False precio viagra lima peru, 513474, difference between levitra viagra cialis (https://homtur.zendesk.com/entries/91060116-FDA-Approved-Fildena-50mg-Over-The-Counter-Online-No-Prescription-No-Membership-in-Louisville-natura), [url="https://homtur.zendesk.com/entries/91060116-FDA-Approved-Fildena-50mg-Over-The-Counter-Online-No-Prescription-No-Membership-in-Louisville-natura"]difference between levitra viagra cialis[/url], https://homtur.zendesk.com/entries/91060116-FDA-Approved-Fildena-50mg-Over-The-Counter-Online-No-Prescription-No-Membership-in-Louisville-natura difference between levitra viagra cialis, 58575, viagra 14 years old (http://nwomerdimo.nation2.com/index.php?page=1070257225), [url="http://nwomerdimo.nation2.com/index.php?page=1070257225"]viagra 14 years old[/url], http://nwomerdimo.nation2.com/index.php?page=1070257225 viagra 14 years old, =]]],

Blog pessoal de José Silva. Sou programador informático, nos últimos anos dedicado quase exclusivamente ao PHP.
Setembro 2006
Dom
Seg
Ter
Qua
Qui
Sex
Sab

1
2

3
4
5
6
7
8
9

10
12
13
14
16

17
18
19
21
23

24
25
26
27
28
29
30


Pesquisar
 
blogs SAPO