This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
2686
Archived fixes / Re: Database column type 'decimal' ignored
« on October 7th, 2012, 02:45 AM »
Ah, you clearly don't read TheDailyWTF, because you'd know the answer straight away ;) :P
There is one simple rule when dealing with data like this and it is in the form of a yes/no question. Do you ever need to do manipulation on it as if it is a number? If the answer to this question is yes, find a suitable numeric column. If the answer to this question is no, make it a string and be done with it.[1]
Just because something takes the form of a number does not inherently mean you should store it as one. Seems to me that you're really recording data from Google Maps that just happens to be in the form of a number, and that you don't need to perform any maths on it (e.g. distance location) in which case the correct type would be a string.
Making it a string has other advantages - you never have a loss of precision. What column size would you have used for example? (Off the top of my head, I seem to recall you'd have to make it DECIMAL(13, 10) - but that's great until Google changes the resolution at which they're tracking)
There is one simple rule when dealing with data like this and it is in the form of a yes/no question. Do you ever need to do manipulation on it as if it is a number? If the answer to this question is yes, find a suitable numeric column. If the answer to this question is no, make it a string and be done with it.[1]
Just because something takes the form of a number does not inherently mean you should store it as one. Seems to me that you're really recording data from Google Maps that just happens to be in the form of a number, and that you don't need to perform any maths on it (e.g. distance location) in which case the correct type would be a string.
Making it a string has other advantages - you never have a loss of precision. What column size would you have used for example? (Off the top of my head, I seem to recall you'd have to make it DECIMAL(13, 10) - but that's great until Google changes the resolution at which they're tracking)
| 1. | The canonical examples that TDWTF brings up are things like 5-digit PIN numbers or phone numbers, just because they look numeric... |
2687
Archived fixes / Re: Database column type 'decimal' ignored
« on October 7th, 2012, 02:23 AM »
Better question: what are you trying to do?
2688
Archived fixes / Re: Database column type 'decimal' ignored
« on October 7th, 2012, 02:12 AM »
Who uses the bastardised format that is decimal? (Or, numeric, as it is also known)
I don't want to support it because I saw absolutely no good reason to extend everything in all the relevant places to extend a datatype that is not even consistent between MySQL versions, but if that weren't enough, it isn't even necessarily consistent between the same version of MySQL on different operating systems, and in some cases even between different table types on the same system.
If you are using it, the chances are you're really using the wrong data type and should be using something else.
I don't want to support it because I saw absolutely no good reason to extend everything in all the relevant places to extend a datatype that is not even consistent between MySQL versions, but if that weren't enough, it isn't even necessarily consistent between the same version of MySQL on different operating systems, and in some cases even between different table types on the same system.
If you are using it, the chances are you're really using the wrong data type and should be using something else.
2689
The Pub / Re: topic_info
« on October 7th, 2012, 01:59 AM »
I think it's a bit deeper than that, especially since remember that Post2() can and will call Post()...
2690
The Pub / Re: topic_info
« on October 7th, 2012, 01:00 AM »
Aside from the fact that it would just be unnecessary database queries in most cases to do that?
2691
The Pub / Re: topic_info
« on October 6th, 2012, 03:17 PM »
Given how volatile that is, you're almost better off just getting it yourself.
And isn't it global anyway meaning you're free to pull it whenever?
And isn't it global anyway meaning you're free to pull it whenever?
2692
Archived fixes / Re: Shortcode text is wrong in Firefox
« on October 6th, 2012, 03:33 AM »
Great, another thing FF changes based on versions, since it wasn't that before.
2693
The Pub / Re: topic_info
« on October 6th, 2012, 03:32 AM »
That's the way SMF always did it... IIRC, Post() populates $topicinfo with other stuff, just to be awkward.
Either way, this is not logic we've introduced at any point, if we had there would have been a reason for it that I'd be able to tell you :P
Either way, this is not logic we've introduced at any point, if we had there would have been a reason for it that I'd be able to tell you :P
2694
Features / Re: New revs - Public comments
« on October 5th, 2012, 03:25 PM »
I like the new tweaks, it looks nice :)
Yes, I agree that the installer test should be done like that - but let's go one better. If it doesn't pass for whatever reason, automatically disable the option.Quote Well, doing this is easy enough; wetem can have control over it. The one thing that it would mean is that it would be... difficult to inject the SVN version number the way you currently have it in the footer, though in theory if you can get to $txt['copyright'] before it gets inserted into wetem (or wherever, but principally wetem), you can fudge it by inserting something on the end.
This is essentially the problem: whatever method we leave in for ourselves to use here will be exploitable elsewhere. But I think that's a compromise we can live with ;)
Yes, I agree that the installer test should be done like that - but let's go one better. If it doesn't pass for whatever reason, automatically disable the option.
So, let's sort it out: instead of trusting modders not to add links carelessly in the footer, we should prevent them from doing so at all. This goes through the use of private vars. We could possibly even test for the length of outputted strings, and if it's too long or its base64 version or whatever doesn't have a specific bit of string in it we can reset it, blah blah blah... (I'm trying to stick to trusting people, but I guess we can go either way eh..? :^^;:)
This is essentially the problem: whatever method we leave in for ourselves to use here will be exploitable elsewhere. But I think that's a compromise we can live with ;)
2695
Off-topic / Re: Happy birthday, Arantor!
« on October 4th, 2012, 10:41 PM »
My ascendant sign is Sagittarius, and to quote the one site I just pulled up to help me figure it out...Quote I think that's entirely fair.
Your psychological nature is extroverted and independent, oriented towards expansion and sociability. You have the soul of a leader, energetic and active. Your charisma and your drive are fully integrated in the collective life. Indeed, as an action-oriented fire sign, you challenge yourself and succeed in accomplishing the task straight away. Sagittarius is hard to follow because his spirit and his independent mind constantly lead him to go further and higher.
With this Ascendant, you come across as charismatic, fiery, energetic, likeable, benevolent, tidy, jovial, optimistic, extraverted, amusing, straightforward, demonstrative, charming, independent, adventurous, straightforward, bold, exuberant, freedom-loving.
But you may also be irascible, selfish, authoritarian, inconsistent, unfaithful, brutal, unreliable, reckless, tactless or disagreeable.
2696
Off-topic / Re: Happy birthday, Arantor!
« on October 4th, 2012, 06:30 PM »
That explains so much.
2697
Archived fixes / Modify group does not show correct UI for board access
« on October 4th, 2012, 06:10 PM »
Some time ago I modified the way board access is handled, so that it is possible to exclude people from boards, as well as separating board visibility from board access.
I also updated the UI in manage boards to cover this, but the reverse option - setting what boards a given group can see - has not yet been updated, mostly because I haven't figured out a nice way to display it given the way board hierarchy can be handled and thus you need the ability to provide indentation and stuff...
I also updated the UI in manage boards to cover this, but the reverse option - setting what boards a given group can see - has not yet been updated, mostly because I haven't figured out a nice way to display it given the way board hierarchy can be handled and thus you need the ability to provide indentation and stuff...
2698
Bug reports / Double space bug in thoughts + others
« on October 4th, 2012, 06:06 PM »
As mentioned in the thoughts recently, documenting this bug so it can be fixed at some point.
preparsecode converts a double space to a single space followed by an nbsp entity, so that the usual collapsing of spaces does not occur. Trouble is, that extra entity is being escaped at some point between being saved and redisplayed.
Now, the two branches of the front page in SVN (the Home and Welcome templates, of which Welcome is the default) do not exhibit this bug.
They do have other bugs, however, where the AJAX return is inserted without values being injected into the return, plus neither of them is as functional as the master template is here.
There also really should be some kind of entry box on the front page for thoughts - in case folks do what I do and have the sidebar at the bottom, and it would also mean that the thoughts subtemplate should not be removed from the front page if the users have some ability to post.
(Also on that note: thoughts need some permissions adding!)
preparsecode converts a double space to a single space followed by an nbsp entity, so that the usual collapsing of spaces does not occur. Trouble is, that extra entity is being escaped at some point between being saved and redisplayed.
Now, the two branches of the front page in SVN (the Home and Welcome templates, of which Welcome is the default) do not exhibit this bug.
They do have other bugs, however, where the AJAX return is inserted without values being injected into the return, plus neither of them is as functional as the master template is here.
There also really should be some kind of entry box on the front page for thoughts - in case folks do what I do and have the sidebar at the bottom, and it would also mean that the thoughts subtemplate should not be removed from the front page if the users have some ability to post.
(Also on that note: thoughts need some permissions adding!)
2699
Archived fixes / Re: Error message on search
« on October 4th, 2012, 06:02 PM »
Fantastic.
In case anyone was wondering what the hell was going on, boardsAllowedTo operates in two ways.
If you give it a string, naming a permission, you get an array of boards back where the user has that permission in (except admins get an array containing board id 0 back, for every board)
If you give it an array of names of permissions, you get an array back, the keys being the permission names and the contents of each of those being the same as above.
Except I hadn't actually told boardsAllowedTo that it was an array, it thought it was getting a string, but the rest of the plugin expected the contents as if boardsAllowedTo had had an array >_< Subtle but awkward.
In case anyone was wondering what the hell was going on, boardsAllowedTo operates in two ways.
If you give it a string, naming a permission, you get an array of boards back where the user has that permission in (except admins get an array containing board id 0 back, for every board)
If you give it an array of names of permissions, you get an array back, the keys being the permission names and the contents of each of those being the same as above.
Except I hadn't actually told boardsAllowedTo that it was an array, it thought it was getting a string, but the rest of the plugin expected the contents as if boardsAllowedTo had had an array >_< Subtle but awkward.
2700
Features / Re: New revs - Public comments
« on October 4th, 2012, 05:59 PM »- I'm okay with adding a $context var next to $txt['copyright'] or whatever.
Doing it this way means it cannot be tampered with - putting it in $context means it can be tampered with.
- I'm just not confident enough with plugin writing to even be able to do something as simple as hooking into that variable...
Eh, just commit it and let the deities of computing sort it out :lol: