Page Index Toggle Pages: 1 2 [3] 4  ReplyAdd Poll Send Topic
Very Hot Topic (More than 25 Replies) Re: Looking toward 2.6.1 (Read 30030 times)
 
Paste Member Name in Quick Reply Box Monni
Language
***
Offline


Min izāmō

Posts: 413
Location: Kaarina, Finland
Joined: Jul 16th, 2014
Gender: Male
Mood: Frustrated
Zodiac sign: Pisces
Re: Looking toward 2.6.1
Reply #30 - Aug 26th, 2014 at 3:55pm
Mark & QuoteQuote  
Dandello wrote on Aug 26th, 2014 at 3:42pm:
According to http://www.perlmonks.org/?node_id=653404 ||= should evaluate as false undefined, empty string and 0 values. Where we may still have some glitches are those places where '0' and empty are a valid values.


The reason why I said || and ||= are bad is that it overwrites the original value even when it shouldn't... empty is valid value for variables that are strings by default, "0" is valid value for variables that are numeric by default... Perl doesn't differentiate between numeric 0 or string "0" when it does simple binary logic (for example true/false).

There is cases when empty or undefined means feature is disabled, but 0 means the check used in the feature has no limit (for example width/height variable pairs).
  
Back to top
IP Logged
 
Paste Member Name in Quick Reply Box Dandello
Forum Administrator
YaBB Modder
*****
Offline


I love YaBB 2.7!

Posts: 2234
Location: The Land of YaBB
Joined: Feb 12th, 2014
Gender: Female
Mood: Annoyed
Zodiac sign: Virgo
Re: Looking toward 2.6.1
Reply #31 - Aug 26th, 2014 at 4:08pm
Mark & QuoteQuote  
Monni wrote on Aug 26th, 2014 at 3:55pm:
There is cases when empty or undefined means feature is disabled, but 0 means the check used in the feature has no limit (for example width/height variable pairs).
                     

Exactly.

I'll look at adding a 'isempty' sub to make things neater. (When we start on 2.6.2 I think we'll need to establish Perl 5.010 or even a bit higher as the Perl requirement so we can use newer and better shortcuts. ModuleChecker now has a Perl Version readout so telling people they need a newer version shouldn't be that hard.)


  

Perfection is not possible. Excellence, however, is excellent.
Back to top
WWW  
IP Logged
 
Paste Member Name in Quick Reply Box Monni
Language
***
Offline


Min izāmō

Posts: 413
Location: Kaarina, Finland
Joined: Jul 16th, 2014
Gender: Male
Mood: Frustrated
Zodiac sign: Pisces
Re: Looking toward 2.6.1
Reply #32 - Aug 26th, 2014 at 4:18pm
Mark & QuoteQuote  
Dandello wrote on Aug 26th, 2014 at 4:08pm:
Monni wrote on Aug 26th, 2014 at 3:55pm:
There is cases when empty or undefined means feature is disabled, but 0 means the check used in the feature has no limit (for example width/height variable pairs).
                   

Exactly.

I'll look at adding a 'isempty' sub to make things neater. (When we start on 2.6.2 I think we'll need to establish Perl 5.010 or even a bit higher as the Perl requirement so we can use newer and better shortcuts. ModuleChecker now has a Perl Version readout so telling people they need a newer version shouldn't be that hard.)




I know pretty much in how many places we need to recheck the logic, but honestly it is way beyond my coding skills to figure out which of the alternatives is the best fix, or should we just leave it like it was in 2.6.0 ...

In 2.6.2 we only need to change the "defined $x ? $x : $y" tests as "$x // $y"... Rest can stay as it is now or will be in 2.6.1 ...
  
Back to top
IP Logged
 
Paste Member Name in Quick Reply Box Monni
Language
***
Offline


Min izāmō

Posts: 413
Location: Kaarina, Finland
Joined: Jul 16th, 2014
Gender: Male
Mood: Frustrated
Zodiac sign: Pisces
Re: Looking toward 2.6.1
Reply #33 - Aug 27th, 2014 at 10:11am
Mark & QuoteQuote  
One thing I know for sure is that whenever the check involves a setting read from user vars file or forum settings file, we need to use isempty... because plain undefined check can cause Perl to crash.
  
Back to top
IP Logged
 
Paste Member Name in Quick Reply Box XTC
Global Moderator
*****
Offline


YaBB 2.6.0/1/11 Mods

Posts: 174
Location: @ustria
Joined: Feb 12th, 2014
Gender: Male
Mood: Freaky
Zodiac sign: Aquarius
Re: Looking toward 2.6.1
Reply #34 - Aug 27th, 2014 at 11:38am
Mark & QuoteQuote  
Hello

Monni wrote on Aug 25th, 2014 at 7:13pm:
This is the version I have now... Looks good with both Chrome and IE with constant 1 pixel padding...

Works for me in SlimBrowser  Wink

lg XTC
  

Back to top
 
IP Logged
 
Paste Member Name in Quick Reply Box Dandello
Forum Administrator
*****
Offline


I love YaBB 2.7!

Posts: 2234
Location: The Land of YaBB
Joined: Feb 12th, 2014
Gender: Female
Mood: Annoyed
Zodiac sign: Virgo
Re: Looking toward 2.6.1
Reply #35 - Aug 27th, 2014 at 2:22pm
Mark & QuoteQuote  
Monni wrote on Aug 27th, 2014 at 10:11am:
because plain undefined check can cause Perl to crash


This is one of the things I'm testing
Code (Perl)
Select All
sub isempty {
     my ($x, $y) = @_;
     if ( defined $x && $x ne q{} ) {
         $y = $x;
     }
     return $y;
 } 



Not using it on things like vars or boards that are loaded in Load (Those are both fed into hashes so those things need to be checked in Load and I haven't gotten there yet. )

Where I'm using the new sub is in the spots where the result should be 'something', including a '0', but not a 'nothing'. In Settings we have some spots where 'nothing' is allowed but should be a 0 and some spots where it could be a 0 but 'nothing' should be something else. (Like the image sizes.)

I went though all the '||='s, checked on what the possible good results were and decided if it should be a '||=' or a ' = isempty'.

I need to do more testing but should have it in the SVN later today.

(Also converted the '||' related to the fopen function to 'or' - it's lower precidence and it what's usually used for system call errors anyway. Also makes for fewer '||' to check.  :Smiley)
  

Perfection is not possible. Excellence, however, is excellent.
Back to top
WWW  
IP Logged
 
Paste Member Name in Quick Reply Box Monni
Language
***
Offline


Min izāmō

Posts: 413
Location: Kaarina, Finland
Joined: Jul 16th, 2014
Gender: Male
Mood: Frustrated
Zodiac sign: Pisces
Re: Looking toward 2.6.1
Reply #36 - Aug 27th, 2014 at 3:08pm
Mark & QuoteQuote  
Dandello wrote on Aug 27th, 2014 at 2:22pm:
This is one of the things I'm testing
Code (Perl)
Select All
sub isempty {
     my ($x, $y) = @_;
     if ( defined $x && $x ne q{} ) {
         $y = $x;
     }
     return $y;
 } 


That code really doesn't make any sense to me... It looks like it sets $y to be equal to $x if $x is empty... but... isn't $y a local variable? For most of the times we only need it to return true or false, not the result as we already know it can also be invalid.
  
Back to top
IP Logged
 
Paste Member Name in Quick Reply Box Dandello
Forum Administrator
*****
Offline


I love YaBB 2.7!

Posts: 2234
Location: The Land of YaBB
Joined: Feb 12th, 2014
Gender: Female
Mood: Annoyed
Zodiac sign: Virgo
Re: Looking toward 2.6.1
Reply #37 - Aug 27th, 2014 at 3:19pm
Mark & QuoteQuote  
$y isn't a local, $y is the alternate value.
Code (Perl)
Select All
$myval = isempty($x, $y); 



if $x isn't empty, it should return $x (even if $x == 0), otherwise it should return $y. (Kind of halfway between $x //= $y; and $x ||= $y;)

Where I'm currently using it is in places where there's a hard-coded good value for $y or in spots where if $y is a bad value, there's a subsequent catcher or it goes to a string like 'ex-member'.
  

Perfection is not possible. Excellence, however, is excellent.
Back to top
WWW  
IP Logged
 
Paste Member Name in Quick Reply Box Monni
Language
***
Offline


Min izāmō

Posts: 413
Location: Kaarina, Finland
Joined: Jul 16th, 2014
Gender: Male
Mood: Frustrated
Zodiac sign: Pisces
Re: Looking toward 2.6.1
Reply #38 - Aug 27th, 2014 at 3:22pm
Mark & QuoteQuote  
Dandello wrote on Aug 27th, 2014 at 3:19pm:
$y isn't a local, $y is the alternate value.
Code (Perl)
Select All
$myval = isempty($x, $y); 



if $x isn't empty, it should return $x (even if $x == 0), otherwise it should return $y. (Kind of halfway between $x //= $y; and $x ||= $y;)

I'm not joking... but we really need $z...
  
Back to top
IP Logged
 
Paste Member Name in Quick Reply Box Dandello
Forum Administrator
*****
Offline


I love YaBB 2.7!

Posts: 2234
Location: The Land of YaBB
Joined: Feb 12th, 2014
Gender: Female
Mood: Annoyed
Zodiac sign: Virgo
Re: Looking toward 2.6.1
Reply #39 - Aug 27th, 2014 at 3:40pm
Mark & QuoteQuote  
There's one spot I can think of offhand where $z might be useful. (And I can't find it at the moment.  Huh  - it had to do with sorting.)
  

Perfection is not possible. Excellence, however, is excellent.
Back to top
WWW  
IP Logged
 
Paste Member Name in Quick Reply Box Monni
Language
***
Offline


Min izāmō

Posts: 413
Location: Kaarina, Finland
Joined: Jul 16th, 2014
Gender: Male
Mood: Frustrated
Zodiac sign: Pisces
Re: Looking toward 2.6.1
Reply #40 - Aug 27th, 2014 at 3:44pm
Mark & QuoteQuote  
Dandello wrote on Aug 27th, 2014 at 3:40pm:
There's one spot I can think of offhand where $z might be useful. (And I can't find it at the moment.  Huh  - it had to do with sorting.)


There is a lot of places that use $FORM{'foo'} and $INFO{'foo'} and third value... also... every place where it uses user's real name...
  
Back to top
IP Logged
 
Paste Member Name in Quick Reply Box Dandello
Forum Administrator
*****
Offline


I love YaBB 2.7!

Posts: 2234
Location: The Land of YaBB
Joined: Feb 12th, 2014
Gender: Female
Mood: Annoyed
Zodiac sign: Virgo
Re: Looking toward 2.6.1
Reply #41 - Aug 27th, 2014 at 3:54pm
Mark & QuoteQuote  
Monni wrote on Aug 27th, 2014 at 3:44pm:
every place where it uses user's real name...


The only time that should be an issue is if someone is using ancient vars files and didn't process them through one of the Convert utilites on upgrading - in that case they've got more problems than just missing user display names.  :Smiley  (YaBB Forum is still has messed up vars files because it didn't get run through Convert - EVER! on any upgrade! EVER!)

I'll track down the multiple Form, Info, whatever calls.
  

Perfection is not possible. Excellence, however, is excellent.
Back to top
WWW  
IP Logged
 
Paste Member Name in Quick Reply Box Monni
Language
***
Offline


Min izāmō

Posts: 413
Location: Kaarina, Finland
Joined: Jul 16th, 2014
Gender: Male
Mood: Frustrated
Zodiac sign: Pisces
Re: Looking toward 2.6.1
Reply #42 - Aug 27th, 2014 at 4:03pm
Mark & QuoteQuote  
Dandello wrote on Aug 27th, 2014 at 3:54pm:
Monni wrote on Aug 27th, 2014 at 3:44pm:
every place where it uses user's real name...


The only time that should be an issue is if someone is using ancient vars files and didn't process them through one of the Convert utilites on upgrading - in that case they've got more problems than just missing user display names.  :Smiley  (YaBB Forum is still has messed up vars files because it didn't get run through Convert - EVER! on any upgrade! EVER!)

I'll track down the multiple Form, Info, whatever calls.


Today morning was the last time I have seen forum with totally messed up vars files and that was a forum I did upgrade... had to do some serious hacking to get it even log people in... Seriously... the Converter in original 2.6.0 zip file is totally busted... It leaves some fields empty when empty value is invalid. That was one of the first reasons I started digging up all the wrong uses of ||, because those just masquerade the real problem. Some users complained that some calculations were off by 2 or 3 because it reverted back to 0 when it shouldn't.
  
Back to top
IP Logged
 
Paste Member Name in Quick Reply Box Dandello
Forum Administrator
*****
Offline


I love YaBB 2.7!

Posts: 2234
Location: The Land of YaBB
Joined: Feb 12th, 2014
Gender: Female
Mood: Annoyed
Zodiac sign: Virgo
Re: Looking toward 2.6.1
Reply #43 - Aug 27th, 2014 at 4:20pm
Mark & QuoteQuote  
Ah hah - off to check the converters after I get more coffee.
  

Perfection is not possible. Excellence, however, is excellent.
Back to top
WWW  
IP Logged
 
Paste Member Name in Quick Reply Box Monni
Language
***
Offline


Min izāmō

Posts: 413
Location: Kaarina, Finland
Joined: Jul 16th, 2014
Gender: Male
Mood: Frustrated
Zodiac sign: Pisces
Re: Looking toward 2.6.1
Reply #44 - Aug 27th, 2014 at 4:27pm
Mark & QuoteQuote  
Dandello wrote on Aug 27th, 2014 at 4:20pm:
Ah hah - off to check the converters after I get more coffee.


First thing I noticed after upgrading to 2.6.0 was that default_tz and user_tz didn't work as expected... In the clock at top of forum, when user_tz was empty string, it didn't use default_tz for already registered users, but did use for guests.
  
Back to top
IP Logged
 
Page Index Toggle Pages: 1 2 [3] 4 
ReplyAdd Poll Send Topic
Bookmarks: del.icio.us Digg Facebook Google LinkedIn reddit Twitter Yahoo
Re: Looking toward 2.6.1

Please type the characters exactly as they appear in the image,
without the first 2 and last 2 characters.
The characters must be typed in the same order,
and they are case-sensitive.
Open Preview Preview

You can resize the textbox by dragging the right or bottom border.
Off Topic Comment Insert Spoiler
Insert Hyperlink Insert FTP Link Insert Image Insert E-mail Insert Media Insert Table Insert Table Row Insert Table Column Insert Horizontal Rule Insert Teletype Insert Code Insert Quote Edited Superscript Subscript Insert List /me - my name Insert Marquee Insert Timestamp No Parse
Bold Italicized Underline Insert Strikethrough Highlight
                       
Change Text Color
Insert Preformatted Text Left Align Centered Right Align
resize_wb
resize_hb







Max 5000 characters. Remaining characters:
Text size: %
More Smilies
View All Smilies
Collapse additional features Collapse/Expand additional features Smiley Wink Cheesy Grin Angry Sad Shocked Cool Huh Roll Eyes Tongue Embarrassed Lips Sealed Undecided Kiss Cry