-
syncWXremix and Dial-up
From
KenDB3@VERT/KD3NET to
Digital Man on Wed Jan 6 22:23:46 2016
Re: Re: Sync Weather App - syncWXremixã DM> By: KenDB3 to tbirdsradio on Fri Jan 01 2016 08:11 amãã >> Re: Re: Sync Weather App - syncWXremixã >> By: tbirdsradio to KenDB3 on Thu Dec 31 2015 09:34 amãã > tb>> Once again i got ahead of myself. Dial up user phoned in andã > tb>> received this error:ãã > tb>> "Error in weather.js api.underground.com returned aã > tb>> 'querynotfound' error with this description. 'No cities match yourãsearch query'." ã > tb>> Do i have the above right?ãã >> That's all correct. I just didn't account for dial-up users. Mainlyã >> because I don't have any dial-up access, it didn't really dawn on me.ãã >> Can anyone shed some light on how I might test for this scenario? I'mã >> guessing the user's IP comes up as undefined in this case?ãã DM> Assuming the BBS is using SEXPOTS, the user's IP address should be the IPã DM> address of the BBS computer, or possibly 127.0.0.1 (I forget which). Youã DM> can programatically detect a SEXPOTS/dial-up connection by checking ifã DM> user.connection is a number (e.g. "28800") rather than a protocol stringã DM> (e.g. "Telnet").ãã DM> Something like this:ã DM> var dialup = (parseInt(user.connection) > 0);ãã DM> At least, I think would work (without actually trying it). Let me know howã DM> it works for you,ããDM, I was hoping you might be able to help point me in the right direction on
this. tbirdsradio had a chance to try out the new version from GitHub that used
this bit of code (but had no luck):ããvar dialup = (parseInt(user.connection) > 0); ããfunction getQuerySuffix() {ãvar qs;ãif (dialup === 'true')ã {ã if (fallback_type == 'nonip') {ã qs = fallback + '.json';ã } else {ã qs = 'autoip.json?geo_ip=' + resolve_ip(system.inet_addr);ã }ã } else if (user.ip_address.search(ã/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]
\.)|(^169\.254\.)|(^::1$)|(^[fF][cCdD])/ã) > -1ã) {ã if (fallback_type == 'nonip') {ã qs = fallback + '.json';ã } else {ã if (client.protocol === 'Telnet') {ã qs = wstsGetIPAddress();ã } else if (bbs.sys_status&SS_RLOGIN) {ã qs = wsrsGetIPAddress();ã }ã if (typeof qs === 'undefined') qs = resolve_ip(system.inet_addr);ã qs = 'autoip.json?geo_ip=' + qs;ã }ã} else {ã qs = 'autoip.json?geo_ip=' + user.ip_address;ã}ãreturn qs;ã}ããvar wungrndQuery = getQuerySuffix();ãã**********ããHowever, tbird is still seeing an error when the app is launched at Logon and
also as a Door/External for his dial-up user. ããDEBUG for weather.js API call looked like this at the time of error:ã
http://api.wunderground.com/api/XXXXXXXXXXXXXXXX/conditions/forecast/astronomy/
alerts/q/autoip.json?geo_ip=812XXXXXXXãã(Blocked out API and last 7 of phone number).ããAny thoughts as to why I am missing catching this scenario? It's got me boggled
and I can't really see it. ããThanks for any help you can lend (and sorry for the long post).ãã~KenDB3ãã---ã þ Synchronet þ KD3net-Rhode Island's only BBS about nothing.
http://bbs.kd3.usã
-
From
echicken@VERT/ECBBS to
KenDB3 on Wed Jan 6 23:33:28 2016
Re: syncWXremix and Dial-upã By: KenDB3 to Digital Man on Wed Jan 06 2016 22:23:46ãã Ke> var dialup = (parseInt(user.connection) > 0); ãã Ke> However, tbird is still seeing an error when the app is launched at Logonã Ke> and also as a Door/External for his dial-up user. ããparseInt() is probably the wrong thing for this particular case, because itãtries to pull a number out of a string that may contain non-digit characters.ããparseInt('192.168.1.1'); // returns 192ãparseInt('4162737230'); // returns 4162737230ããAssuming that phone numbers will always be strings of digits, you could do:ããif(user.connection.search(/[^\d]/) < 0) {ã // Probably a phone numberã} else {ã // Probably not a phone numberã}ãã---ãechickenãelectronic chicken bbs - bbs.electronicchicken.com - 416-273-7230ã þ Synchronet þ electronic chicken bbs - bbs.electronicchicken.comã
-
From
Digital Man@VERT to
echicken on Wed Jan 6 22:06:46 2016
Re: syncWXremix and Dial-upã By: echicken to KenDB3 on Wed Jan 06 2016 11:33 pmãã > Re: syncWXremix and Dial-upã > By: KenDB3 to Digital Man on Wed Jan 06 2016 22:23:46ã >ã > Ke> var dialup = (parseInt(user.connection) > 0);ã >ã > Ke> However, tbird is still seeing an error when the app is launched atã > Ke> Logon and also as a Door/External for his dial-up user.ã >ã > parseInt() is probably the wrong thing for this particular case, because itã > tries to pull a number out of a string that may contain non-digitã > characters.ã >ã > parseInt('192.168.1.1'); // returns 192ã > parseInt('4162737230'); // returns 4162737230ã >ã > Assuming that phone numbers will always be strings of digits, you could do:ã >ã > if(user.connection.search(/[^\d]/) < 0) {ã > // Probably a phone numberã > } else {ã > // Probably not a phone numberã > }ããHe's using parseInt() on the user.connection property, which should either be aãterminal-protocol string (e.g. "Telnet", "Rlogin", "SSH") or a modem DCEã(connect) rate (e.g. "28800"). There should not ever be an IP address or aãphone number in the user.connection property.ããOr maybe I missed this other use of parseInt()?ãã digital manããSynchronet "Real Fact" #42:ãSynchronet added Baja/PCMS support with v2.00a (1994).ãNorco, CA WX: 47.9øF, 91.0% humidity, 3 mph WNW wind, 0.60 inches rain/24hrsã---ã þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.netã
-
From
KenDB3@VERT/KD3NET to
echicken on Thu Jan 7 01:11:30 2016
Re: syncWXremix and Dial-upã By: echicken to KenDB3 on Wed Jan 06 2016 11:33 pmãã ec> Re: syncWXremix and Dial-upã ec> By: KenDB3 to Digital Man on Wed Jan 06 2016 22:23:46ãã Ke>> var dialup = (parseInt(user.connection) > 0); ãã Ke>> However, tbird is still seeing an error when the app is launched atã Ke>> Logon and also as a Door/External for his dial-up user. ãã ec> parseInt() is probably the wrong thing for this particular case, becauseã ec> it tries to pull a number out of a string that may contain non-digitã ec> characters. ãã ec> parseInt('192.168.1.1'); // returns 192ã ec> parseInt('4162737230'); // returns 4162737230ãã ec> Assuming that phone numbers will always be strings of digits, you couldã ec> do: ãã ec> if(user.connection.search(/[^\d]/) < 0) {ã ec> // Probably a phone numberã ec> } else {ã ec> // Probably not a phone numberã ec> }ããAccording to DM, user.connection should return a connection speed for a dialupãuser (e.g. "28800") rather than a protocol string (e.g. "Telnet"). So the > 0ãmade sense. I gave it some mock data, and it returned "true" if I fed it 28800,ãand "false" if I fed it the word Telnet. ããI don't know SEXPOTS (or any dialup to telnet bridge) well enough to know ifãthe Caller ID was going to come back with 10-digit (4162737230), 11-digitã(14162737230), +1 format, or even the short 7-digit pattern. So, I was avoidingãtesting the user.ip_address field even though the phone number was ending upãthere. I'm not sure if that behavior is predictable across the board. If theãsysop had dialup but not Caller ID from thier telco, what does SEXPOTS dropãinto the user.ip_address? Does it work in Europe? Tricky tricky. :-/ããQuick question, do I have too many "=" when trying to match if "dialup" isã"true"? I suddenly thought of it 30 minutes ago. (Maybe go from === to ==)ãã~KenDB3ãã---ã þ Synchronet þ KD3net-Rhode Island's only BBS about nothing.
http://bbs.kd3.usã
-
From
Digital Man@VERT to
KenDB3 on Wed Jan 6 22:12:59 2016
Re: syncWXremix and Dial-upã By: KenDB3 to Digital Man on Wed Jan 06 2016 10:23 pmãã > DM> Re: Re: Sync Weather App - syncWXremixã > DM> By: KenDB3 to tbirdsradio on Fri Jan 01 2016 08:11 amã >ã > >> Re: Re: Sync Weather App - syncWXremixã > >> By: tbirdsradio to KenDB3 on Thu Dec 31 2015 09:34 amã >ã > > tb>> Once again i got ahead of myself. Dial up user phoned in andã > > tb>> received this error:ã >ã > > tb>> "Error in weather.js api.underground.com returned aã > > tb>> 'querynotfound' error with this description. 'No cities match yourã > search query'."ã > > tb>> Do i have the above right?ã >ã > >> That's all correct. I just didn't account for dial-up users. Mainlyã > >> because I don't have any dial-up access, it didn't really dawn on me.ã >ã > >> Can anyone shed some light on how I might test for this scenario? I'mã > >> guessing the user's IP comes up as undefined in this case?ã >ã > DM> Assuming the BBS is using SEXPOTS, the user's IP address should be theã > DM> IP address of the BBS computer, or possibly 127.0.0.1 (I forget which).ã > DM> You can programatically detect a SEXPOTS/dial-up connection by checkingã > DM> if user.connection is a number (e.g. "28800") rather than a protocolã > DM> string (e.g. "Telnet").ã >ã > DM> Something like this:ã > DM> var dialup = (parseInt(user.connection) > 0);ã >ã > DM> At least, I think would work (without actually trying it). Let me knowã > DM> how it works for you,ã >ã > DM, I was hoping you might be able to help point me in the right directionã > on this. tbirdsradio had a chance to try out the new version from GitHubã > that usedã > this bit of code (but had no luck):ã >ã > var dialup = (parseInt(user.connection) > 0);ã >ã > function getQuerySuffix() {ã > var qs;ã > if (dialup === 'true')ã > {ã > if (fallback_type == 'nonip') {ã > qs = fallback + '.json';ã > } else {ã > qs = 'autoip.json?geo_ip=' + resolve_ip(system.inet_addr);ã > }ã > } else if (user.ip_address.search( /(^127\.)|(^192\.168\.)|(^10\.)|(^172ã > \.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]ã > \.)|(^169\.254\.)|(^::1$)|(^[fF][cCdD])/ã > ) > -1ã > ) {ã > if (fallback_type == 'nonip') {ã > qs = fallback + '.json';ã > } else {ã > if (client.protocol === 'Telnet') {ã > qs = wstsGetIPAddress();ã > } else if (bbs.sys_status&SS_RLOGIN) {ã > qs = wsrsGetIPAddress();ã > }ã > if (typeof qs === 'undefined') qs = resolve_ip(system.inet_addr);ã > qs = 'autoip.json?geo_ip=' + qs;ã > }ã > } else {ã > qs = 'autoip.json?geo_ip=' + user.ip_address;ã > }ã > return qs;ã > }ã >ã > var wungrndQuery = getQuerySuffix();ã >ã > **********ã >ã > However, tbird is still seeing an error when the app is launched at Logonã > and also as a Door/External for his dial-up user.ã >ã > DEBUG for weather.js API call looked like this at the time of error:
http://ã > api.wunderground.com/api/XXXXXXXXXXXXXXXX/conditions/forecast/astronomy/ã > alerts/q/autoip.json?geo_ip=812XXXXXXXã >ã > (Blocked out API and last 7 of phone number).ã >ã > Any thoughts as to why I am missing catching this scenario? It's got meã > boggledã > and I can't really see it.ã >ã > Thanks for any help you can lend (and sorry for the long post).ããFor a dial-up connection (via SEXPOTS), the user.ip_address property couldãeither the caller-ID information (if provided by the modem) or the IP addressãof the SEXPOTS proxy (e.g. 127.0.0.1).ããIs dialup not being set to true (in your code) for the dial-up connection?ããSome more debug-level log output could help identify exactly what's happeningãhere.ãã digital manããSynchronet "Real Fact" #66:ãSEXYZ is as a 32-bit replacement for [F]DSZ, CE-XYZ and other protocol drivers.ãNorco, CA WX: 48.0øF, 92.0% humidity, 0 mph WNW wind, 0.60 inches rain/24hrsã---ã þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.netã
-
From
KenDB3@VERT/KD3NET to
Digital Man on Thu Jan 7 01:22:43 2016
Re: syncWXremix and Dial-upã By: Digital Man to KenDB3 on Wed Jan 06 2016 10:12 pmãã DM> Re: syncWXremix and Dial-upã DM> By: KenDB3 to Digital Man on Wed Jan 06 2016 10:23 pmãã > DM>> Re: Re: Sync Weather App - syncWXremixã > DM>> By: KenDB3 to tbirdsradio on Fri Jan 01 2016 08:11 amãã > >>> Re: Re: Sync Weather App - syncWXremixã > >>> By: tbirdsradio to KenDB3 on Thu Dec 31 2015 09:34 amãã > > tb>>> Once again i got ahead of myself. Dial up user phoned in andã > > tb>>> received this error:ãã > > tb>>> "Error in weather.js api.underground.com returned aã > > tb>>> 'querynotfound' error with this description. 'No cities matchã > > tb>>> your ã >> search query'."ã > > tb>>> Do i have the above right?ãã > >>> That's all correct. I just didn't account for dial-up users. Mainlyã > >>> because I don't have any dial-up access, it didn't really dawn onãme. ã > >>> Can anyone shed some light on how I might test for this scenario?ã > >>> I'm guessing the user's IP comes up as undefined in this case?ãã > DM>> Assuming the BBS is using SEXPOTS, the user's IP address should beã > DM>> the IP address of the BBS computer, or possibly 127.0.0.1 (Iã > DM>> forget which). You can programatically detect a SEXPOTS/dial-upã > DM>> connection by checking if user.connection is a number (e.g.ã > DM>> "28800") rather than a protocol string (e.g. "Telnet").ãã > DM>> Something like this:ã > DM>> var dialup = (parseInt(user.connection) > 0);ãã > DM>> At least, I think would work (without actually trying it). Let meã > DM>> know how it works for you,ãã >> DM, I was hoping you might be able to help point me in the rightã >> direction on this. tbirdsradio had a chance to try out the newã >> version from GitHub that usedã >> this bit of code (but had no luck):ãã >> var dialup = (parseInt(user.connection) > 0);ãã >> function getQuerySuffix() {ã >> var qs;ã >> if (dialup === 'true')ã >> {ã >> if (fallback_type == 'nonip') {ã >> qs = fallback + '.json';ã >> } else {ã >> qs = 'autoip.json?geo_ip=' + resolve_ip(system.inet_addr);ã >> }ã >> } else if (user.ip_address.search(ã >> /(^127\.)|(^192\.168\.)|(^10\.)|(^172ã >> \.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]ã >> \.)|(^169\.254\.)|(^::1$)|(^[fF][cCdD])/ ) > -1ã >> ) {ã >> if (fallback_type == 'nonip') {ã >> qs = fallback + '.json';ã >> } else {ã >> if (client.protocol === 'Telnet') {ã >> qs = wstsGetIPAddress();ã >> } else if (bbs.sys_status&SS_RLOGIN) {ã >> qs = wsrsGetIPAddress();ã >> }ã >> if (typeof qs === 'undefined') qs = resolve_ip(system.inet_addr);ã >> qs = 'autoip.json?geo_ip=' + qs;ã >> }ã >> } else {ã >> qs = 'autoip.json?geo_ip=' + user.ip_address;ã >> }ã >> return qs;ã >> }ãã >> var wungrndQuery = getQuerySuffix();ãã >> **********ãã >> However, tbird is still seeing an error when the app is launched atã >> Logon and also as a Door/External for his dial-up user.ãã >> DEBUG for weather.js API call looked like this at the time of error:ã >>
http://ã >> api.wunderground.com/api/XXXXXXXXXXXXXXXX/conditions/forecast/astronomãy/ alerts/q/autoip.json?geo_ip=812XXXXXXX ã >> (Blocked out API and last 7 of phone number).ãã >> Any thoughts as to why I am missing catching this scenario? It's gotã >> me boggledã >> and I can't really see it.ãã >> Thanks for any help you can lend (and sorry for the long post).ãã DM> For a dial-up connection (via SEXPOTS), the user.ip_address property couldã DM> either the caller-ID information (if provided by the modem) or the IPã DM> address of the SEXPOTS proxy (e.g. 127.0.0.1).ãã DM> Is dialup not being set to true (in your code) for the dial-up connection?ãã DM> Some more debug-level log output could help identify exactly what'sã DM> happening here.ããGood point, I don't know what's happening to "dialup" during this process. Iãdo know that the phone number is being dropped into user.ip_address and that'sãwhere the query string is failing. I'm just not catching it. I'll add someãDEBUG to grab "dialup" and I think user.connection as well. ããThanks DM!ãã~KenDB3ãã---ã þ Synchronet þ KD3net-Rhode Island's only BBS about nothing.
http://bbs.kd3.usã
-
From
echicken@VERT/ECBBS to
Digital Man on Thu Jan 7 01:37:53 2016
Re: syncWXremix and Dial-upã By: Digital Man to echicken on Wed Jan 06 2016 22:06:46ãã DM> He's using parseInt() on the user.connection property, which should eitherã DM> be a terminal-protocol string (e.g. "Telnet", "Rlogin", "SSH") or a modemã DM> DCE (connect) rate (e.g. "28800"). There should not ever be an IP addressã DM> or a phone number in the user.connection property.ãã DM> Or maybe I missed this other use of parseInt()?ããNah, I just wasn't paying close enough attention.ãã---ãechickenãelectronic chicken bbs - bbs.electronicchicken.com - 416-273-7230ã þ Synchronet þ electronic chicken bbs - bbs.electronicchicken.comã
-
From
echicken@VERT/ECBBS to
KenDB3 on Thu Jan 7 01:42:39 2016
Re: syncWXremix and Dial-upã By: KenDB3 to echicken on Thu Jan 07 2016 01:11:30ãã Ke> According to DM, user.connection should return a connection speed for aã Ke> dialup user (e.g. "28800") rather than a protocol string (e.g. "Telnet").ã Ke> So the > 0 made sense. I gave it some mock data, and it returned "true" ifã Ke> I fed it 28800, and "false" if I fed it the word Telnet. ããYes - I was wrong, and that makes sense.ãã Ke> I don't know SEXPOTS (or any dialup to telnet bridge) well enough to knowã Ke> if the Caller ID was going to come back with 10-digit (4162737230),ã Ke> 11-digit (14162737230), +1 format, or even the short 7-digit pattern. So,ããIt depends entirely on what caller-ID data the modem gives to the BBS, if any. ãThere may also be international numbers, which would be entirely different. ãNot worth trying to do a pattern-match, I wouldn't think.ãã Ke> I was avoiding testing the user.ip_address field even though the phoneã Ke> number was ending up there. I'm not sure if that behavior is predictableããI think that's where I got confused (I forgot you were using user.connection.) ãã Ke> across the board. If the sysop had dialup but not Caller ID from thierã Ke> telco, what does SEXPOTS drop into the user.ip_address? Does it work inããI think that DM mentioned that the fallback user.ip_address for SEXPOTSãconnections lacking caller-ID info would be the SEXPOTS proxy's IP address. ãThis won't always be on the local network - in my case, I run SEXPOTS at home,ãbut my BBS is elsewhere.ãã---ãechickenãelectronic chicken bbs - bbs.electronicchicken.com - 416-273-7230ã þ Synchronet þ electronic chicken bbs - bbs.electronicchicken.comã
-
From
KenDB3@VERT/KD3NET to
Digital Man on Thu Jan 7 11:33:47 2016
Re: syncWXremix and Dial-upã By: KenDB3 to Digital Man on Thu Jan 07 2016 01:22 amãã >>> var dialup = (parseInt(user.connection) > 0);ãã >>> function getQuerySuffix() {ã >>> var qs;ã >>> if (dialup === 'true')ã >>> {ã >>> if (fallback_type == 'nonip') {ã >>> qs = fallback + '.json';ã >>> } else {ã >>> qs = 'autoip.json?geo_ip=' + resolve_ip(system.inet_addr);ã >>> }ã >>> } else if (user.ip_address.search(ã >>> /(^127\.)|(^192\.168\.)|(^10\.)|(^172ã >>> \.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]ã >>> \.)|(^169\.254\.)|(^::1$)|(^[fF][cCdD])/ ) > -1ã >>> ) {ã >>> if (fallback_type == 'nonip') {ã >>> qs = fallback + '.json';ã >>> } else {ã >>> if (client.protocol === 'Telnet') {ã >>> qs = wstsGetIPAddress();ã >>> } else if (bbs.sys_status&SS_RLOGIN) {ã >>> qs = wsrsGetIPAddress();ã >>> }ã >>> if (typeof qs === 'undefined') qs = resolve_ip(system.inet_addr);ã >>> qs = 'autoip.json?geo_ip=' + qs;ã >>> }ã >>> } else {ã >>> qs = 'autoip.json?geo_ip=' + user.ip_address;ã >>> }ã >>> return qs;ã >>> }ãã >>> var wungrndQuery = getQuerySuffix();ãã >>> **********ãã >>> However, tbird is still seeing an error when the app is launched atã >>> Logon and also as a Door/External for his dial-up user.ãã >>> DEBUG for weather.js API call looked like this at the time of error:ã >>>
http://ã >>> api.wunderground.com/api/XXXXXXXXXXXXXXXX/conditions/forecast/astronoã >>> m ã Ke> y/ alerts/q/autoip.json?geo_ip=812XXXXXXX ã >>> (Blocked out API and last 7 of phone number).ãã >>> Any thoughts as to why I am missing catching this scenario? It's gotã >>> me boggledã >>> and I can't really see it.ãã >>> Thanks for any help you can lend (and sorry for the long post).ãã DM>> For a dial-up connection (via SEXPOTS), the user.ip_address propertyã DM>> could either the caller-ID information (if provided by the modem) orã DM>> the IP address of the SEXPOTS proxy (e.g. 127.0.0.1).ãã DM>> Is dialup not being set to true (in your code) for the dial-upãconnection? ã DM>> Some more debug-level log output could help identify exactly what'sã DM>> happening here.ãã Ke> Good point, I don't know what's happening to "dialup" during this process.ã Ke> I do know that the phone number is being dropped into user.ip_address andã Ke> that's where the query string is failing. I'm just not catching it. I'llã Ke> add some DEBUG to grab "dialup" and I think user.connection as well. ããI started using some mock data (since I don't have dialup to test with). Iãthink I figured this out.ããfunction getQuerySuffix() {ãvar qs;ãif (dialup === 'true')ãã...should be...ããfunction getQuerySuffix() {ãvar qs;ãif (dialup === true)ããThis makes it through the function by grabbing the correct fallback lookup.ããTriple Equals works... At some point I tried Double Equals instead (stilãworks). Should I stick with Triple? I read up on the difference, but not sureãif one might be better than the other in this particular case.ããThank you so much for the help (DM and EC)! More Debug was certainly theãdifference this time.ãã~KenDB3ãã---ã þ Synchronet þ KD3net-Rhode Island's only BBS about nothing.
http://bbs.kd3.usã
-
From
echicken@VERT/ECBBS to
KenDB3 on Thu Jan 7 13:31:40 2016
Re: syncWXremix and Dial-upã By: KenDB3 to Digital Man on Thu Jan 07 2016 11:33:47ãã >>>> var dialup = (parseInt(user.connection) > 0);ãã Ke> if (dialup === 'true')ã Ke> ...should be...ã Ke> if (dialup === true)ãã Ke> Triple Equals works... At some point I tried Double Equals instead (stilã Ke> works). Should I stick with Triple? I read up on the difference, but notã Ke> sure if one might be better than the other in this particular case.ããThe difference between == and === can be pretty big in some situations. Seeãhere for a lot of info:ãã
http://tinyurl.com/paz96feããBut ultimately you can just do this:ããif (dialup) {ã // If dialup is true, then this happensã} else {ã // Otherwise this happensã}ããI'd still recommend reading up on == vs. ===, because using both withoutãknowing the difference would probably lead to much confusion.ãã---ãechickenãelectronic chicken bbs - bbs.electronicchicken.com - 416-273-7230ã þ Synchronet þ electronic chicken bbs - bbs.electronicchicken.comã
-
From
KenDB3@VERT/KD3NET to
echicken on Thu Jan 7 13:54:59 2016
Re: syncWXremix and Dial-upã By: echicken to KenDB3 on Thu Jan 07 2016 01:31 pmãã >>>>> var dialup = (parseInt(user.connection) > 0);ãã Ke>> if (dialup === 'true')ã Ke>> ...should be...ã Ke>> if (dialup === true)ãã Ke>> Triple Equals works... At some point I tried Double Equals insteadã Ke>> (stil works). Should I stick with Triple? I read up on theã Ke>> difference, but not sure if one might be better than the other inã Ke>> this particular case. ãã ec> The difference between == and === can be pretty big in some situations.ã ec> See here for a lot of info:ãã ec>
http://tinyurl.com/paz96feãã ec> But ultimately you can just do this:ãã ec> if (dialup) {ã ec> // If dialup is true, then this happensã ec> } else {ã ec> // Otherwise this happensã ec> }ãã ec> I'd still recommend reading up on == vs. ===, because using both withoutã ec> knowing the difference would probably lead to much confusion.ããThat link is incredibly helpful, and I'll read through it more in depth. Iãappreciate it, thank you! I tested with your suggestion, works like a champ.ãI'm curious to see tbirdsradio try out the new code.ãã~KenDB3ãã---ã þ Synchronet þ KD3net-Rhode Island's only BBS about nothing.
http://bbs.kd3.usã
-
From
Nightfox@VERT/DIGDIST to
KenDB3 on Thu Jan 7 12:52:43 2016
I started using some mock data (since I don't have dialup to test with). Iã > think I figured this out.ãã > function getQuerySuffix() {ã > var qs;ã > if (dialup === 'true')ãã > ...should be...ãã > function getQuerySuffix() {ã > var qs;ã > if (dialup === true)ãã > This makes it through the function by grabbing the correct fallback lookup.ãã > Triple Equals works... At some point I tried Double Equals instead (stilã > works). Should I stick with Triple? I read up on the difference, but notã > sure if one might be better than the other in this particular case.ããIsn't the "=== true" redundant? Saying "if (dialup)" should be enough, andãit's just as clear as saying "if (dialup === true)", since that has the sameãmeaning.ããNightfoxãã---ã þ Synchronet þ Digital Distortion: digitaldistortionbbs.comã
-
From
KenDB3@VERT/KD3NET to
Nightfox on Thu Jan 7 23:39:01 2016
Re: syncWXremix and Dial-upã By: Nightfox to KenDB3 on Thu Jan 07 2016 12:52 pmãã >> I started using some mock data (since I don't have dialup to testã >> with). I think I figured this out.ãã >> function getQuerySuffix() {ã >> var qs;ã >> if (dialup === 'true')ãã >> ...should be...ãã >> function getQuerySuffix() {ã >> var qs;ã >> if (dialup === true)ãã >> This makes it through the function by grabbing the correct fallbackã >> lookup. ã >> Triple Equals works... At some point I tried Double Equals insteadã >> (stil works). Should I stick with Triple? I read up on the difference,ã >> but not sure if one might be better than the other in this particularã >> case. ãã Ni> Isn't the "=== true" redundant? Saying "if (dialup)" should be enough, andã Ni> it's just as clear as saying "if (dialup === true)", since that has theã Ni> same meaning.ããThanks Nightfox, that is what echicken suggested too, and I think I get theãconcept a bit more now. That is what I ended up using in the code. ããAfter I hear back on if it fixed the issue with tbirdsradio, who has a dialupãuser, I'll know if I've covered my bases a bit better now. I'll probablyãpackage whats on GitHub right now as the next iteration at that point.ãã~KenDB3ãã---ã þ Synchronet þ KD3net-Rhode Island's only BBS about nothing.
http://bbs.kd3.usã
-
From
Deuce@VERT/SYNCNIX to
Nightfox on Fri Jan 8 13:05:43 2016
Re: syncWXremix and Dial-upã By: Nightfox to KenDB3 on Thu Jan 07 2016 12:52 pmãã > Isn't the "=== true" redundant? Saying "if (dialup)" should be enough, andã > it's just as clear as saying "if (dialup === true)", since that has the sameã > meaning.ããNo, they're different meanings.ããdialup = "Yes"ãif (dialup)ã print("Yessir!")ãif (dialip===true)ã print("Fosho!");ããWould only print "Yessir!".ãã---ã
http://DuckDuckGo.com/ a better search engine that respects your privacy.ãMro is an idiot. Please ignore him, we keep hoping he'll go away.ã þ Synchronet þ My Brand-New BBS (All the cool SysOps run STOCK!)ã
-
From
Digital Man@VERT to
Nightfox on Sat Jan 9 19:59:22 2016
Re: syncWXremix and Dial-upã By: Nightfox to KenDB3 on Thu Jan 07 2016 12:52 pmãã > > I started using some mock data (since I don't have dialup to test with).ã > > I think I figured this out.ã >ã > > function getQuerySuffix() {ã > > var qs;ã > > if (dialup === 'true')ã >ã > > ...should be...ã >ã > > function getQuerySuffix() {ã > > var qs;ã > > if (dialup === true)ã >ã > > This makes it through the function by grabbing the correct fallbackã > > lookup.ã >ã > > Triple Equals works... At some point I tried Double Equals instead (stilã > > works). Should I stick with Triple? I read up on the difference, but notã > > sure if one might be better than the other in this particular case.ã >ã > Isn't the "=== true" redundant? Saying "if (dialup)" should be enough, andã > it's just as clear as saying "if (dialup === true)", since that has the sameã > meaning.ããUsually, and in the case of this particular script, if(dialup) and if(dialup ==ãtrue) and if(dialup === true) are all functionally equivalent.ããHowever, technically if(dialup) is the equivalent of: if(dialup != false),ãbecause if dialup = 2, let's say, then if(dialup == true) or if(dialup ===ãtrue) would not execute the if-block while if(dialup) would still execute theãif-block. if(Boolean(dialup) == true) is the equivalent of if(dialup). :-)ãã digital manããSynchronet "Real Fact" #82:ãDonations to the Synchronet project are welcome @
http://wiki.synchro.net/donateãNorco, CA WX: 51.8øF, 81.0% humidity, 1 mph SSE wind, 0.00 inches rain/24hrsã---ã þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.netã
-
From
Nightfox@VERT/DIGDIST to
Digital Man on Sat Jan 9 21:27:20 2016
Re: syncWXremix and Dial-upã By: Digital Man to Nightfox on Sat Jan 09 2016 19:59:22ãã >> Isn't the "=== true" redundant? Saying "if (dialup)" should beã >> enough, and it's just as clear as saying "if (dialup === true)", sinceã >> that has the same meaning.ãã DM> Usually, and in the case of this particular script, if(dialup) andã DM> if(dialup == true) and if(dialup === true) are all functionallyã DM> equivalent. ãã DM> However, technically if(dialup) is the equivalent of: if(dialup != false),ã DM> because if dialup = 2, let's say, then if(dialup == true) or if(dialup ===ã DM> true) would not execute the if-block while if(dialup) would still executeã DM> the if-block. if(Boolean(dialup) == true) is the equivalent of if(dialup).ã DM> :-) ãã:) Makes sense. I'm still getting to know all the cases of how variablesãbehave in JavaScript. Logically, though, it seemed redundant to check forãequivalence to true in an if check. :)ããNightfoxãã---ã þ Synchronet þ Digital Distortion: digitaldistortionbbs.comã
-
From
KenDB3@VERT/KD3NET to
Digital Man on Sun Jan 10 15:06:19 2016
This makes it through the function by grabbing the correct fallbackã > > > lookup.ãã > > > Triple Equals works... At some point I tried Double Equals insteadã > > > (stil works). Should I stick with Triple? I read up on the difference,ã > > > but not sure if one might be better than the other in this particularã > > > case.ãã > > Isn't the "=== true" redundant? Saying "if (dialup)" should be enough,ã > > and it's just as clear as saying "if (dialup === true)", since that hasã > > the same meaning.ãã > Usually, and in the case of this particular script, if(dialup) and if(dialupã > == true) and if(dialup === true) are all functionally equivalent.ãã > However, technically if(dialup) is the equivalent of: if(dialup != false),ã > because if dialup = 2, let's say, then if(dialup == true) or if(dialup ===ã > true) would not execute the if-block while if(dialup) would still executeã > the if-block. if(Boolean(dialup) == true) is the equivalent of if(dialup).ã > :-)ãã > digital manããReally great and helpful explanation. +1 ;-)ãã~KenDB3ãã---ã þ Synchronet þ KD3net-Rhode Island's only BBS about nothing. http://bbs.kd3.usã
-
From
tracker1@VERT/TRNTEST to
Deuce on Sun Jan 10 15:14:52 2016
dialup = "Yes"ã> if (dialup)ã> print("Yessir!")ã> if (dialip===true)ã> print("Fosho!");ãã> Would only print "Yessir!".ããThe following values evaluate as false in JS:ã 0, undefined, mull, NaN, false, empty stringããEverything else is true.ã-- ãMichael J. Ryanãtracker1(at)gmail.comã+o Roughneck BBSãã---ã þ Synchronet þ RoughneckBBS - http://www.roughneckbbs.com/ã
-
From
Digital Man@VERT to
tracker1 on Sun Jan 10 14:54:39 2016
Re: Re: syncWXremix and Dial-upã By: tracker1 to Deuce on Sun Jan 10 2016 03:14 pmãã > > dialup = "Yes"ã > > if (dialup)ã > > print("Yessir!")ã > > if (dialip===true)ã > > print("Fosho!");ã >ã > > Would only print "Yessir!".ã >ã > The following values evaluate as false in JS:ã > 0, undefined, mull, NaN, false, empty stringã >ã > Everything else is true.ããNot when testing for equality (and that was the original question). Forãexample: print(2==true), prints 'false'.ãã digital manããSynchronet "Real Fact" #40:ãSynchronet's cross-platform library is called XPDEV (named before Windows XP).ãNorco, CA WX: 58.8øF, 65.0% humidity, 1 mph E wind, 0.00 inches rain/24hrsã---ã þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.netã
-
From
Deuce@VERT/SYNCNIX to
tracker1 on Sun Jan 10 17:59:39 2016
Re: Re: syncWXremix and Dial-upã By: tracker1 to Deuce on Sun Jan 10 2016 03:14 pmãã > The following values evaluate as false in JS:ã > 0, undefined, mull, NaN, false, empty stringã >ã > Everything else is true.ããTo expand that... all of the above would == false, but only false would ===ãfalse.ãã---ã
http://DuckDuckGo.com/ a better search engine that respects your privacy.ãMro is an idiot. Please ignore him, we keep hoping he'll go away.ã þ Synchronet þ My Brand-New BBS (All the cool SysOps run STOCK!)ã
-
From
Deuce@VERT/SYNCNIX to
Digital Man on Sun Jan 10 18:14:49 2016
Re: Re: syncWXremix and Dial-upã By: Digital Man to tracker1 on Sun Jan 10 2016 02:54 pmãã > > The following values evaluate as false in JS:ã > > 0, undefined, mull, NaN, false, empty stringã >ã > > Everything else is true.ã >ã > Not when testing for equality (and that was the original question). Forã > example: print(2==true), prints 'false'.ããBut print('0x01'==true) prints 'true'.ããSo here's a super-duper example...ã[1, '1', '0x01', 2, '2', "true", true].forEach(function (x)ã{ã print("X="+x+' '+(typeof x));ã if (x)ã print("Is");ã if (x==true)ã print("True");ã if (x===true)ã print("Truth");ã print('');ã});ããWhich results in:ãX=1 numberãIsãTrueããX=1 stringãIsãTrueããX=0x01 stringãIsãTrueããX=2 numberãIsããX=2 stringãIsããX=true stringãIsããX=true booleanãIsãTrueãTruthããã---ã
http://DuckDuckGo.com/ a better search engine that respects your privacy.ãMro is an idiot. Please ignore him, we keep hoping he'll go away.ã þ Synchronet þ My Brand-New BBS (All the cool SysOps run STOCK!)ã