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.

Messages - Nao
7456
Features / Re: Template skeleton!
« on October 11th, 2011, 12:53 AM »
Totally unrelated (again)... Would post in the 'These two bytes won't matter to you' topic, but I have a post to answer over there and if I post this, I'll forget about the other one ;)

I tried running minification processes on inline JavaScript. I took the media homepage as an example.

Running nothing: about .08s to execute the page
Running JSMin on the whole page: about 0.17s
Running Packer on the whole page: about 0.38s

Additionally, Packer tends to crash the page in some situations...
So JSMin is definitely the winner here.

However, it still doubles the time needed to generate the page... Which would be fine if it saved a lot of data, but it isn't the case.

Full page: 33759 bytes
Compressed: 32107 bytes

So it saves about 1.6kb...

Which is reduced to about 400 bytes after zipping the files.
About 4% saved on the full size.

I'm not exactly sure it's worth it... Sure, it's good for bandwidth (that's 400 bytes saved on *each* page load), but if it makes page generation twice more expensive... Not sure it's worth it.

Does anyone know of a PHP script that can compress JavaScript on the fly VERY quickly? And I mean, VERY?
I don't mind if it isn't optimized for size... I need something that optimizes for speed!
7457
Features / Re: Template skeleton!
« on October 11th, 2011, 12:47 AM »
Profile comments and Media comments = less used, less likely to have lots of items, less likely to be a pain in the ass to maintain, IMHO.
7458
The Pub / Re: Spell checker
« on October 11th, 2011, 12:36 AM »
Hey, I knew about these too :P
Actually, the only reason I enabled the spellchecker on my server back in 2008 was to have that cool "maybe you meant..." at the top of the page.

Only problem -- 90% of the time, it suggests a totally stupid alternative to my perfectly working search term ;)
7459
Features / Re: Template skeleton!
« on October 10th, 2011, 11:32 PM »
Hmm. And if we only created dummy topic Ids each time a comment is posted on a profile or album or item?
we could associate these dummy Ids with the real element Id in a new table... Dunno.
7460
Features / Re: New revs
« on October 10th, 2011, 10:54 PM »
rev 1091
(17 files, 18kb)

* Layers used to have _above and _below functions. These have now been renamed to _before and _after, for simplicity. Please note that due to the peculiarity of layers, you can override or overload these two special functions, unlike the _before and _after that are attached to any block. See example in Welcome template. (Reports.php, Subs-Template.php, Welcome.php, TEMPLATES: Display, index, InfoCenter, ManageAttachments, ManageMedia, Media, PersonalMessage, PrintPage, Profile, Reports, Welcome, Wireless)

! Reports was using a layer with the same name as its contained block. Although technically it worked, it's bad practice. I should probably refuse adding blocks when a layer of the same name already exists... (Reports.php, Reports.template.php)

- A colon was stored in the language files when other strings on the same page stored it in the template itself. (Profile.language.php, Profile.template.php)

@ Note: I'm open to suggestions regarding a way to clarify the fact that template_layer_before() can be overloaded with template_layer_before_before() or _after(), while template_block_before() can't... :P
7461
Features / Re: Template skeleton!
« on October 10th, 2011, 10:43 PM »
Quote from Arantor on October 10th, 2011, 10:05 PM
Quote
...which, again, means we can't have both a topic=1.0 and a media album with ID #1. Creating a first album when topic=1.0 already exists will set the album ID to 2. And that's precisely one of the major blockers for me...
Wait, what?

The boards and albums table will be left alone, because they're foreign keys to the source-type/source-id item.
But if id_topic is the primary index, then it's unique as well, isn't it..? So we can't hold two different items with id_topic = 1 in the topic table... (Can we?)
Quote
The first topic to be created is topic id 1 (source type: board, source id 1, as it's in board 1). Then we upload a media item... it's media item 1 (in album 1), but it consumes topic id 2 (source type: album, source id 1)
Then we can't have a topic=2.0... Same problem. No?
Or do you mean to store the actual topic IDs in a different place than {db_prefix}topics...?

(Also, FWIW, I've updated the demo site to the latest SVN... Except I haven't updated the database, so it's bound to crash on the missing items.)
7462
Features / Re: Template skeleton!
« on October 10th, 2011, 09:59 PM »
Quote from Arantor on October 10th, 2011, 09:17 PM
Nope, wasn't meant as one. There simply haven't been any bad ideas.
You can always try, but you'll have a hard time trying to offend me, given that I'm convinced that whenever you criticize me, it's because I deserve it, not because you want to offend me ;)
Quote
You'd make id_topic remain the PK,
...which, again, means we can't have both a topic=1.0 and a media album with ID #1. Creating a first album when topic=1.0 already exists will set the album ID to 2. And that's precisely one of the major blockers for me...
Quote
Heh. Well, just seems to me that add (or better, merge) is the right verb to describe the operation being carried out.
Right now I'm staying at ::load(), waiting for feedback.
Quote
Quote
::load(array('layer' => array('block')), 'default', 'replace')

Okay, what do you do with this...?
This says to me to replace the current contents of default with a new layer (with that new block in it)
Exactly... Except if you replace $blocks with array('layer' => array('block'), 'block2'), it's exactly the same except that we want to add another block right after the layer... So, technically, should Wedge behave completely differently (i.e. replace the contents of the layer rather than the layer itself) just because I added a block to the list...?

Working on replacing _above and _below with _before and _after... It's quite odd. Oh, and there's an even stranger one -- Reports.php has both a 'print' layer and a 'print' block. UH!
7463
Features / Re: New revs
« on October 10th, 2011, 09:26 PM »
rev 1090
(14 files, 11kb)

! Forgot to rename hideChrome() to wetem::hide(). (unittest/index.php, CoppaForm.php, Help.php, ManageBans.php, ManageErrors.php, ManagePlugins.php, Aeva-Gallery.php, ModerationCenter.php, Packages.php, PrintPage.php, Reports.php, Spellcheck.php, VerificationCode.php, ViewRemote.php)
7464
Features / Re: New revs
« on October 10th, 2011, 09:23 PM »
rev 1089
(4 files, 12kb)

+ wetem::load() can now process multidimensional arrays where sub-arrays are layers. New child layers should be properly indexed, too. (Boards.php, Display.php, Subs-Template.php, Welcome.php)

* Renamed a few ::layer options. 'replace' to 'rename' (because it's ultimately what it does), 'erase' to 'replace' (makes more sense), 'firstchild' to 'first' and 'lastchild' to 'add' (for consistency with ::load). Considering whether we should remove some of these options in favor of the use of ::load()... (Subs-Template.php)
7465
The Pub / [Archive] Re: Logo Madness
« on October 10th, 2011, 07:57 PM »
Like... This?!

@Pete> Blender had the single work UI ever for 3D, back when I used it... But it was still more usable than 3DSMax, Maya and other bloated powerhouses... :^^;:
7466
Features / Re: Template skeleton!
« on October 10th, 2011, 07:45 PM »
Quote from Arantor on October 10th, 2011, 05:55 PM
It's not the worst idea you had this week. I'm not sure what is, but this wasn't it.
I think I should feel offended... :lol:
Quote
No, essentially what is needed is adding something to the topic - not the message - to define where it is. That takes care of content management internally.
Then that's exactly the original definition of floating topics...
Quote
All you do, much like I talked about for media items, is convert the board id into half of two columns: you have 'topic type' and 'topic context'; the type refers to board, or media item or whatever, and context is the board id or album id.
Which also means we can't have both a topic ID of #1 and an album ID of #1. Or we have to ditch the id_topic key in favor of an (id_topic, board_type) key. Which I'm not sure would be as fast...?
Quote
Displaying that content is another matter entirely,
Definitely. I was still referring simply to the storing of data itself.
Quote
Then it doesn't really need to belong to the class, though there's no reason why it *can't*. It is sort of between the two, go with whatever makes more sense.
A shorter wetem is what I'm looking at for now.
Quote
Quote
Nope... load('block', 'default') will replace the 'main' block. load('block', 'sidebar') will add to the current blocks.
I think we already went through that...
So you're merging then? :P Consider array_merge. It replaces elements in the first source with those from the second, and is quite content to add things on the end as well under the right circumstances...
Don't confuse me... :whistle:

I'm already confused enough with the merging (ahah) of ::load and ::layer... And actually I shouldn't do it, really. I think.

Take an example...

::load(array('layer' => array('block')), 'default', 'replace')

Okay, what do you do with this...?

- loadBlock() would do this: take the 'default' layer, empty it, except for its child layers. Then add the contents of the array to it. i.e. we would have <wrapper><default><layer><block /></layer></default></wrapper>.

- loadLayer() would do this: take the 'default' layer, and REPLACE it with the 'layer' layer. We would have this: <wrapper><layer></layer></wrapper>.

So, I went ahead and added a 'rename' value for ::load() not to get confused, but what to do in our example, where I'm providing contents for the layer? Should I also empty out the original layer and add data to it? Or should I just rename the layer, and don't bother with the provided contents...?
So much fun for me...

I guess I'll just keep the ::layer method for easy addition of container layers, like used to be done in SMF.
And I'll consider calls to ::load to be, well... Just a series of blocks.
7467
The Pub / [Archive] Re: Logo Madness
« on October 10th, 2011, 06:13 PM »
3D's a bitch... It requires full attention. And it's not particularly fun to do, especially after a while...
7468
The Pub / [Archive] Re: Logo Madness
« on October 10th, 2011, 05:57 PM »
Ah, it reminds me of the days when I would manually enter coordinates to generate my 3D objects in OpenGL for Kyodai Mahjongg... Was fun :P
Then I started generating my meshes with procedural methods. Just because I was unable to find a 'rounded corners cube' mesh on the Interwebs... Heck, I'm sure there are thousands of this online by now... But it wasn't commando-style!
7469
Features / Re: New revs
« on October 10th, 2011, 05:54 PM »
rev 1088
(35 files, 23kb)

* Commenazi - renamed all 'sub template' (without a dash) to 'block'. (SendTopic.template.php, Themes.template.php, and 33 source files.)
7470
Features / Re: New revs
« on October 10th, 2011, 05:50 PM »
rev 1087
(4 files, 8kb)

* Sorted the wetem methods to put the public ones at the front. Turned wetem into a final class and converted variables to private. Until we find a good reason to make wetem inheritable, it should remain locked from view. (Subs-Template.php)

* Commenazi. (Errors.php, Themes.php, Subs-Template.php, index.template.php)