Show Posts

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.

Topics - Nao
61
Off-topic / Welcome to modern times.
« on June 2nd, 2013, 08:38 PM »
So, recently I had a heavy hard drive failure of a 1TB unit, which hits hard... No 'critical' data on it, but still, plenty of data I'd rather not have lost... So I decided I'd finally go NAS.

I bought a Synology 413j, and after 24 hours of fighting with it and its cables and the fact that my secondary network port died on me without my knowledge and I had to buy a PCIe card just to provide a new port (-_-)[1], I'm relatively up and running at this point, but whatever. I still have concerns...

Maybe some of you have a NAS, and already went through the same questions.

- Is it possible to have two volumes, one of which would be in Hybrid RAID (3 available hard drives, + a backup one), and another which would use the remainder of the hard drives, but with a 2-drive fail safe (i.e. all data on it is safe until at least 2 of the drives are dead). I would think that it's technically possible, but I don't really know. It would be nice -- a place to keep my all-important data, and a place to keep my collection of holiday movies and so on. If it's not possible to do that, I'm actually, err... Considering doing a setup where I have 2 drives for fail safe. That only leaves me with 5.4TB of available space, though... Not that much. Well, that's enough to put my current data into the NAS, but not enough for a 'couple more', I guess...

- How rare is it for 2 drives to fail at the same time, actually..? Well, they could even fail one day apart, since you have to rebuild the RAID, and if another drive fails in that time, the RAID setup is dead, I guess... :(

I had something else to ask, but I forgot, so it'll be for a next time, or never... ;)

(BTW, the web UI for Synology rocks... They actually emulated a proper graphical OS in JavaScript and CSS, or something. Inspiring work...)
Posted: June 2nd, 2013, 07:22 PM

Apparently I can do multiple volumes with varying types of RAID on each... :)

http://www.synology.com/support/tutorials_show.php?q_id=558
 1. Then realizing that I probably should have directly bought a switch, so I'd have been able to share my data on my LAN, uh...
62
Features / Silly menu experiment...
« on May 26th, 2013, 01:03 PM »
Set #main_menu to display: inline-block
Then, add this in the DOMContentReady portion of Wedge's script.js file:

Code: [Select]
if ($('#main_menu').height() > 50 || $('#main_menu').width() > $(window).width() * 0.75)
$('#main_menu').append('<li><span id="m_more"></span><h4>' + $txt['more'] + '</h4><ul></ul></li>');

while ($('#main_menu').height() > 50 || $('#main_menu').width() > $(window).width() * 0.75)
$('#main_menu > li:last').prev().prependTo($('#main_menu > li:last > ul')).find('h4').contents().unwrap().parent().find('>span').remove();

This has the amusing effect of ensuring that the main menu only takes one line, and each entry beyond that will be moved to a dynamic menu entry at the end. Basically, it behaves like phpMyAdmin and a couple other scripts. I wrote the code myself though, dunno how they 'do it', but since their CSS is probably very different, it doesn't matter...
Anyway, I thought it was cool that I managed to do it in only 4 lines (2 of which compressing as one...), and of course it executes pretty quickly, but I'm not super-happy with the 'more' menu though...
- Main menu doesn't support icons in its entries; well, it does, but it doesn't look pretty... So I removed the icons for consistency, but it could be fixed by CSS.
- Need to add a 'subsection' class to all child LI's, so that we get a horizontal arrow...
- I've set the maximum width to 75% of the window size, so that we can see the sub-menus entirely. Ideally, thought, I should rewrite my main menu code to show the drop-down on the left of its parent, rather than its right, when its width extends beyond the window bounds... I already did that a few weeks ago for the select box rewrite, didn't I..?
- Probably should wrap this into a resize event, so it gets updated when the window is resized, but that also means adding more code to move the submenus to the top, and... MEH.

What do you think of this?

Here's what it looks like:
63
Archived fixes / Board search
« on May 6th, 2013, 10:05 PM »
Hmm, I'd qualify this as a bug, but YMMV...

Go to Public Area board.
In Search box, type 'plugin revs'. Click Search.
Doesn't return the 'Plugin Revs' topic, which is located in a sub-board of Public Area, i.e. Features.

I think that board search should also include children, or at least offer an option to do so..?
64
Bug reports / Infraction bugs
« on May 6th, 2013, 09:23 PM »
So, it's up... I disabled all plugins, installed the stuff, re-enabled all plugins; I also updated the database structure manually before, using the same code as in install.sql.

Here's a first one... Click on a profile link, get this:

Code: [Select]
Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation 'ifnull'
File: /Sources/ManageInfractions.php
Line: 587

I don't know if it's a bug due to my version of phpmyadmin and how it handled my addition, but it's still something I think needs to be pointed out.
Posted: May 6th, 2013, 09:17 PM

Fixed manually through phpMyAdmin; declaration by declaration... Arghh -_-
Did wedge_infractions, while I was at it, even though I didn't get any errors for that one.
65
Archived fixes / Funny bug...
« on May 6th, 2013, 07:25 AM »
http://wedge.org/pub/6271/logo-madness/1080/

View HTML.
Read meta topic description.

Think again :lol:

Meta description should probably hold consistent data within the topic, e.g. text from the first post in the topic, but there's no point in retrieving it again for a non-blog situation, for sure... :-/
Perhaps, at least, in a topic with a poll, maybe we should show the poll question instead..? Although, SEO-wise, it's already well visible...
66
Off-topic / The hardships of being a perfectionist?
« on April 23rd, 2013, 07:43 PM »
No; he happened to post on the elk forums yesterday, so it would be surprising that for some reason, he couldn't make it to his own forum on the same day, I would say...
This isn't the first time he's done this. He'll come back. I'd just appreciate if he could tell me what's upset him, instead of leaving without a word... But I can't change people, can I? Can i..?

:edit: Fixed topic name...
67
Archived fixes / Member recount
« on April 20th, 2013, 05:28 PM »
I was trying to recount members on my local install, which has the Wedge.org member database, but without any posts.
It turns out that, from looking at the source code, it first gets a list of members, then counts how many posts they have in the message table, then updates their counts.
However, if a user has no message at all in the table, their account will simply be ignored...

Two possible solutions:

- Set all members to 0 posts at the start of the process. Would make sense... Especially since this is already there as a 'fallback' for a strange reason.
- Load all message count entries into the member list, i.e. $members = array(member 1 => 65 posts, 2 => awaiting count, ...), and then after we're done counting, update all members one by one.

I would fix that myself, but as I know that @Arantor rewrote this a while ago, I'm wary of breaking anything.

Hmmm... Nice bug in mentions... I just typed @Arantor, and it showed me a loooong list of 'Arantor' names in the list... It's possibly due to Ajax being slow for me here, so it's getting multiple requests sent before even receiving them.
68
Features / Choosing useless images to remove...
« on April 20th, 2013, 03:35 PM »
In the last couple of years, Pete and I removed a lot of images from the theme folder, that we considered to be useless.

I'd like to centralize discussion on icons we can/could/should remove from the package.

Starting with notify.gif... This is the icon next to the 'Notify' link in /do/recent/ (list of recent posts), as well as profile contributions, and search results.

I, FWIW, never, ever, ever, ever, ever clicked that button when outside of a topic display. I don't see *any* point in offering users to ability to subscribe to a topic when they're only seeing one post of it... Usually, people will want to click the message, read it in context, and decide whether or not they click Notify on the topic page...

I think no one would ever notice it if I decided to remove that icon, and the associated link. Only the link in Display should remain, and these buttons don't use icons.
What do you think..?
69
Archived fixes / IE 6/7 + mini-menus = headache
« on April 16th, 2013, 11:33 PM »
Okay, here's an example of what I'm seeing with IE10 in IE7 compatibility mode... That's awful.
This is supposed to be a mini-menu in the thoughts area.

What's happening then?
Here's the simplified structure of a mini-menu top-level entry:

<span>
   menu caption
   <ul>
    <li>contents...
   </ul>
</span>

'span' is set to position: relative
'ul' is set to position: absolute, so that for instance, setting top: 100% on it will position it right below the span text itself.

This works perfectly in all browsers, including IE8+.

In IE 6/7, and you can test on wedge.org if you'd like, the mini-menu is shown BEHIND the menu captions ("Action") for all other mini-menus. Not only that, but if you hover it, the mini-menu will close because it gives priority to the Action button that's supposed to be hidden behind it.

What's the reason for this..? Well, the span's position: relative is the culprit. If you remove it, then the mini-menu will never be overwritten, it will retain priority.
Only problem is, if I wanted to get rid of position: relative, I'll have to manually set (via JavaScript) the position for my mini-menu. Honestly, I'd rather not do that...!

Now, here's the thing: I spent the better part of the day LOOKING for examples of this IE bug online, but so far, I've found NOT EVEN a single description of the problem. It sounds as if the problem is ONLY on wedge.org, and/or ONLY on my PC.
Considering my IE6 copy is running in VirtualPC XP Mode, I can safely say it's the "real thing", and it's not a quirk of browser emulation, like broken filters in IETester + IE6.

I discovered the bug when I was trying to 'make things work' in IE 6/7 with regards to my main menu rewrite. I ended up giving up and reverting much of my changes, because I couldn't afford to drop compatibility with both IE 6/7 when it comes to the main menu.

I doubt anyone will be able to help, but it doesn't cost anything to ask. Can anyone reproduce this bug? And if yes, do you have any frigging idea what's happening..? Thanks!
70
Features / Mail entities and stuff.
« on April 10th, 2013, 11:17 AM »
I'm stupid.
I have stupid ideas.

But sometimes, even though they're stupid simple, they're just like, "uh? why didn't I think of that before..?!"

In this case, I just received a notification e-mail (after subscribing to the stuff), and noticed that it had <URL> in it. Woops... Okay, I should be careful about sending notification data by e-mail, replacing <URL> manually instead of through the output buffer handler, because it's never called on these...

And then it struck me.
What prevents us from adding this at the beginning of the sendmail() function..? Uh?

Code: [Select]
$message = ob_sessrewrite($message);

Duh.
Then it just... gets converted like a normal web page would. We could even automatically convert things to entities on the fly, too. Every time a mail is sent, it's passed through sendmail(). Then why bother doing 'special e-mail handling' inside $txt in this situation...?

There's probably a reason... But I can't find any. I told you -- I'm stupid.
71
As mentioned in another topic... Let's see my uncommitted files one by one.
This topic is mainly to satisfy Pete's curiosity, if it exists. Also evaluate whether we'll have conflicts, and for anyone to give me their opinion on some topic when I'm unsure which way I should fix something...

It may also give you an insight into a genius madman's mind... :lol:

- Class-CSS: just disables can_flex manually... It's a hack. For testing.  I still don't know what's best anyway.

- Class-DB: another file I've had in this state for months... It simply removes the return false on __clone(), and moves __construct() to the getInstance() code. I was planning to modify all files to do simpler things like that, but then I realized I really wasn't the guy to do the proper OO code optimizations, and I left it hanging... I'm guessing I'll leave it that way for another couple of years. Until I'm bored disabling the file's commit status, and remove my code. Maybe you want to do this kind of thing yourself...? Or maybe you think it's pointless..? I just don't think __construct() and getInstance() should both be in a class, as they have the same purpose really.

- Class-Notification: minor and short optimizations... Planning to commit this along with the rest of my notification changes.

- Feed: uhh... Just a spacinazi. But I'm not committing it, as it's a reminder that I should change all <' . '? strings to just have <?, since it's not going to change anything, and only ?> needs to be escaped... (Unless I'm wrong? In which case, there are plenty of files we need to fix!)

- JSEditor: part of my AJAX rewrite (i.e. remove Xml.template.php, and move everything to use returnAjax)

- JSModify: part of my AJAX rewrite

- Notifications: part of my Notifications rewrite

- QuoteFast: part of my AJAX  rewrite

- Subs-Cache: this one has two changes:
   - part of my quote escaping rewrite in JSE (code related to $txt handling inside JS files),
   - and a stand-alone change that optimizes CSS filesize for Chrome and Firefox, by using a magic trick. It's actually been in use at Wedge.org for a few weeks, but I can't decide whether to commit or not, because (1) it's not a free hack, it takes time to run, (2) it only saves about 100 bytes... :(, (3) there's an alternative solution that involves moving my code to CSS files and only have a fallback implemented in Subs-Cache, it'd be more solid, but also more confusing to CSS developers...

- Subs-Template: has three changes...
   - part of my Prism implementation; i.e. better syntax highlighter. Never finished that, as it doesn't play well with... flexbox. Ah.
   - a one-liner that converts underscores to dashes in classes and ID's, at runtime. Only keeping it in there as a reminder that, well... It actually compresses worse :(
   - part of my quote escaping rewrite in JSE (restore quotes after moving inline events.)

- Subs:
    - my returnAjax hacks...
    - my quote escaping rewrite in JSE -- not finishing it yet, because of issues with Wess.

- Suggest: part of my AJAX rewrite

- Home.template: a playground to see how I can easily vertically align embedded icons next to text, instead of having to use vertical-align. Well, although it does work, it also implies a site-wide rewrite, which I'm not excited about... So I'm leaving this as a reminder, again.

- index.template: part of my Notifications rewrite (moved the main skeleton's block there, for logical reasons.)

- ManagePermissions.template: part of my quote escaping rewrite in JSE.

- Notifications.template: part of my Notifications rewrite

- editor.js: I actually got rid of the iframe, in Wysiwyg mode... But couldn't figure out how to fix focus when clicking buttons.

- moved notifications.js to script.js, and heavily rewrote it.

- sbox.js: an IE hack that I never committed, for some reason... Probably because it works without the hack, but 'officially' I should be using the hack, so... This one has been in the file for at least a year. Every time I've committed sbox.js, I've ensured I didn't commit that single line change... I'm silly.

- topic.js: my flexbox fallback. It doesn't work in Firefox, so I'm not committing...

- editor.css: part of the Wysiwyg iframe rewrite. Saves 400 bytes of text, mostly comments...

- index.css: part of my Notifications rewrite

- sections.css: part of my flexbox hack. Uncommittable...

- Wine/extra.css: fixes some issues, but adds more issues in Warm -- and as I can't fix-commit Warm, I'm leaving this here.

- Warm/extra.css: quite a visible overhaul of the Warm skin... Only, I like the current one BETTER. Don't ask me... I should post screenshots, and ask for opinions. Generally speaking anyway, I'm thinking of tearing the skin apart and making it a Web 2.0-style skin.

- Xml.template.php: will eventually go away, part of my AJAX rewrite...

So, there you go. We've got about 4-5 main features I'm working on at the same time, none of which are ready for primetime (except maybe notifications).
72
Plugins / Hook parameters...
« on April 5th, 2013, 09:55 AM »
I'm stumped, Pete...
I tested some pass-by-ref stuff on my plugin, and it looks like it's doing exactly the reverse of what you said:

call_hook('receiving', array(&$var)) associated with either receiving($var) or receiving(&$var) WORK.

call_hook('receiving', array($var)) associated with either receiving($var) or receiving(&$var) DO NOT WORK.

You said that technically, the second solution is the right one, as long as &$var is used in receiving().
My concern stems from the fact that the call_hook function sends an ARRAY of variables, i.e. their VALUES. From the moment you send an array, the call_hook function can no longer access the array values as references, so it can't pass them as refs either...

It makes no sense to me.
Heck, I think we can also easily do away with the arrays.

Anyone knows anything about these? This is the first time I'm looking into plugins, really, and never used call_hook before for any reason whatsoever... ;)
73
Features / JavaScriptEscape headaches
« on March 21st, 2013, 11:48 AM »
So, I don't know why, but today I decided to tackle JSE quirks...
If you'll remember (or not), six months ago I mentioned in rev 1767 that I was looking for a volunteer to go through the codebase with on[a-z]+="[^"]*JavaScriptEscape and ensure these calls are properly escaped.

Well, six months ago I didn't know about grepWin, which is a great tool (I would gladly replace my other search'n'replace tool if it supported both a history of previous searches, and a quick preview of matches 'in context'), and most importantly, supports multi-line regex searches.

So there are about 75 matches across Wedge + plugins (without counting some special cases like 'onclick' => 'return something' which I didn't test for), that's a lot but it's doable.
Now I'd like to discuss the JSE function itself, and the situations in which it can cause problems.

As $txt protections inside .js files

Nothing to say... It works well. JS files use single quotes everywhere, so it's well optimized, too. One has to remember, though, not to use a $txt inside a double-quoted string. No reason to do that, though..?

Inside an inline event

Ah, this...
echo 'onclick="return', JavaScriptEscape('I say "Hello!" and you say "Get lost!"...'), ';"'; isn't gonna work, because you can't escape a double-quote properly inside an inline event... So, that's why I added an extra bool param to JSE to tell the engine that we're within a HTML param, and that we need to turn any double quotes to "...

That's good.
Especially since I (somehow foolishly, but I stand by my decision) turned all quot entities to double-quotes in language files, to make them more readable. (I think the upside is better than the downside here.)

Now, the thing that REALLY matters, is that Wedge doesn't leave inline events as they are... You know that. It loads jQuery at the end of the page, so it moves inline events to the end, too. I was thinking, it's pretty silly to bother with that...?!
I can very, very easily allow for escaped double-quotes (\") in inline events. They'll just get moved out of the HTML anyway... But, does that mean I should escape all double-quotes inside JSE without distinction..? I don't think so. Outside of an inline event, the double-quotes will remain escaped, and I don't like the idea.
And yes, I need to escape double quotes, there's no other realistic option.
So, do I need to use the bool in every use of JSE inside an inline event..?

Inside footer JS

I think that's the last possibility..?!
This is where I've been looking today. Fact is, in a Wedge HTML page, all tag params are surrounded by double quotes. There are tons of double-quotes in every page. There are very little single quotes. So I did a quick test, and instead of JSE returning 'string', it returned "string', and guess what? I saved about 10 gzipped bytes just by doing that on the home page. It's not MUCH, and certainly not enough to warrant this topic, but... It's my hobby, after all.

Where is JSE used the most, then..?

Here's a solution I was thinking of... It's crazy, at least as much as I can be.
In JSE, return the string surrounded by chr(15) (or whatever unused character in the invisible ASCII range), and escape double-quotes in the string with chr(16) or whatever.
Then, at ob_sessrewrite time, once the event delaying process is completed, turn back chr(15) to double-quotes, and turn chr(16) to double-quotes only if they're not inside a string, otherwise turn them to " entities. I'm thinking of this as I'm typing, so it probably doesn't make a lot of sense... But I'd love being able to solve the need for the 'escape double quotes' boolean param. I think I'll do that *at least* for chr(16)...

Also, I think we could use double-quotes by default in JSE, and only use single-quotes when called within $txt protection code in JS files.

Okay, that's it... The proverbial headache is coming up. I can feel it.
74
Features / Icon alignment
« on March 12th, 2013, 01:13 PM »
I was looking into more layout-related code, and couldn't remember why .inline-block forces a vertical-align: middle.
Which got me into looking at inline blocks again... Been a very long time, really.

One of the things I never liked in my code, is that inline blocks are never properly aligned with any text content beside them.
It particularly shows in cat/title blocks, where I have to assign some kind of vertical-align hardcoded pixel value to align the icon next to the title, only the number differs on every browser... Originally I did all of my calculations on Opera, but now that I'm using Chrome on a daily basis, I keep seeing icons that are off by a pixel or two. Most people won't mind, but I do.

The thing with inline blocks, is that their height is the same as the text next to them. By default. So, I did a few tests and... It's really easy to align icons. Just remove any vertical-align crap, any hardcoded height, and then include the icon with background: url(...) no-repeat center. The 'center' is really what does it.

While there's a definite advantage to simplifying our icon code (and believe me, it will), there are also three drawbacks to this method, and this is why I'm not going to implement it without feedback.

1/ There are tons of icons, and it requires changing their HTML one by one, manually. It's okay... I can handle it. But it's not pretty.

2/ Sprited images.
- Obviously, can't set a 'center' on them, because they'll show something else on the side. So... Do we get rid of sprites for any icons that inherits .inline-block?
- Pete likes them (true enough, the sort.gif image is 90 bytes, as opposed to 146 bytes for sort_down+sort_up). However, the magic of gzip ensures that small images may sometimes compress very well through Wess. In this case, I tried doing the same code with the two separate images, and went from 29085 bytes to 29096... That's an extra 11 bytes. With a bit of CSS simplification, I went down to 29090. Only 5 more bytes... The 143 bytes in sort_down+sort_up are compressed to exactly 84 bytes, while the 90 bytes in sort.gif are compressed to 79. (And they said base64+gzip wasn't helpful to compress images... :P Well, that's probably due to the fact that there are other GIF files in our CSS, and they share similar, if not identical, headers and palettes.)

3/ If the icon is taller than the current text, it won't resize to fit. So, the icon will be partially hidden. I can't think of many situations where this is desirable.

So... What do you think..?
75
Features / Flexible box model. It's easy, until it gets hard.
« on February 26th, 2013, 10:28 PM »
So... I've already spent two days on this. After implementing support for flex in Wedge, I was going to commit this, but stopped at the last minute.
I wanted it to be a surprise, but it just can't. I can't commit until it's fixed. And I can't seem to fix it... So I might as well ask for opinions.

My idea was to reset the message layout to what we had in SMF 1.1, i.e. a 100% table-like layout. In CSS, display:table works quite well, but it doesn't support rowspan and colspan. This 'oversight' was fixed by the W3C in the form of flexbox, where you can precisely force an element to take all of the available height.

All right.

So, I set display:flex on the post wrapper. This works just fine.
Then I set display:flex on the postarea class, with a width set to 100% (otherwise the child divs don't fill the postarea width, whatver!) Again, works normally... Then I'll set flex:1 on the .post class, meaning it gets priority on whatever fills the space.
As a result, the first post in the screenshot shows that the action bar is at the BOTTOM of the post, with extra space in between. This is what I wanted. I was so happy when I got to that point...

Except that right before committing, I noticed a problem with some posts. See second post in screenshot...

So, what is it due to..? Very simple. Just do "code { display: none }" or equivalent, and it starts working again.
To be clear: the post with the code block acts like if postarea was 'wrapped' on line two (flex-direction: column on the post wrapper), then it gets reset to the desired position (on the right of the poster area), but it keeps the same dimensions.
This is 'fixed' by forcing .post width to 70%, but the first post will then show a postarea that's 70% of the expected width... i.e. whatever I do, the body that contains the code block, will always be ~30% wider than the body with regular text.

I've always hated code blocks and their silly devilish implementation (WTF really?! Just look at the bbc PHP for it...), but this is not just that... Any item that would usually get overflow:hidden like a gallery preview, will now overflow:visible out of the post div, and extend their post width just the same, so that postheader overflows as well.

This is with Chrome... Even if it works in Opera 12 and Firefox 21 (haven't tested), there's no point in keeping that tech around if it's going to fuck up like this on a whim. I mean, it's actually worse than using floats at this point...

Who got this wonderful idea, already, that only tabular content should use table tags..?!