News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Aeva 6.9.99 and earlier (old)

Started by karlbenson, October 14, 2007, 06:22:33 PM

Previous topic - Next topic

Nao 尚

Another busy day -- in real life this time... Haven't had time to work on anything so far.
Just wanted to drop a quick note about bbcode -- I don't see how adding tags afterwards is an issue at all. The whole point is to allow n00bs to post direct links, isn't it? What do n00bs do after that? They don't want to edit their messages. They may not even know they can. Tags are added at posting time, and are there to allow any power user to fine-tune their video/audio presentation to their liking. This is what I have in mind -- among other ideas, of course. I have yet to start my Aeva to-do-list, so I'll really need to make one very soon, so that I can start asking users their opinions, vote on what they prefer, etc...

Also, this one is for you Karl -- I don't see how bbcode is "so 20th century"... Let's have an example: many SMG users asked me to implement the ability to show their gallery pictures inside their posts. I thought of two ways of doing it: either posting the URL to their item page, and embedding it just like Aeva does, or using a [smg] tag with the picture ID. Of course, the [smg] tag has an advantage over a possible [aeva] tag because there's already a sample tag given on every item page, for implementation, and there's even a "?" icon next to it with a full page of help. But the tag really has many advantages. I can control thumbnail position, thumbnail size, embed audio/video/images, add a caption and/or a link under the picture, etc, etc...
I can't do all of this with an [aeva] tag, but I still can offer a small subset of it, and a small subset is better than nothing at all. One of the things that worries me the most in Aeva is that one can't choose to put two Youtube videos next to each other. I want to allow users to do this, just by editing their tags to say [aeva align=left] on both embeds. This should be easy enough... What do you think? Of course, I don't know where I'll put the help page, if there's any at all. But it's better to have ambition than to just do small-time additions. That's why you built Aevac 4.0 in the first place, isn't it?
I will not make any deals with you. I've resigned. I will not be pushed, filed, stamped, indexed, briefed, debriefed or numbered.

Aeva Media rocks your life.

Akyhne

I think if you want to add a lot of options via a BBC code, you should do it this way:
Add  button called AEVA next to the "Inset Image" button (or whatever).
When people click the button, a popup window with settings will open where you can specify width, height, HQ/LQ (for those sites that suopoort it), left align, right align, etc, and of course the embed video.  A huge job for you, but the ultimate solution.
If that is to much, just add the BBC tag [AEVA][/AEVA] but still keep the options (hidden) so that those who know the options can use them, like:

[AEVA height=480;width=640;align=left]somevideolink[/AEVA].... or similar.

Nao 尚

I'll try to make sure I don't answer EVERYTHING ;)

Quote from: regularexpression on December 02, 2008, 01:49:06 PM
Correct. The embedding/matching is done at runtime.
It would be faster to pre-embed them into the post/using bbcode or another reference.
Sure.
Now that would be even faster... ;)
Either by putting the exact embed url in the code, or by adding an aeva table, storing all references in it (url -> embed url), and doing a match at the end of the page, to turn them into videos... (Okay, have I been hacking PrettyURLs too much??)

Quotea) the whole intention of the mod was to embed media WITHOUT bbcode.
- I (and others who I spoke to about it), agreed that it would compromise the mod. If I wanted bbcode I would have used the Streaming3 mod.
So, do you think I shouldn't use bbc in Aeva?

Quoteb) I didn't want the mod to leave a load of dead tags behind when the mod was uninstalled.
(and I didn't want to have to write a removal).  I just wanted them to be straight links.
That's when you thought it wouldn't be popular... Now, who would think of uninstalling Aeva? ;D

QuoteOverall, I don't see that it really needs any speed improvements.
On a normal board, sure, I totally agree with you. But there are many boards where people only post embedded vids. On these boards, video thumbnails would be welcome (to put even more "visual" links in pages), as well as faster embedding.

QuoteAevac is called in parse_bbc AFTER bbcode has been converted.
HOWEVER, in order to protect quotes from being embedded, the script pre-protects quotes BEFORE bbc is converted.
It isn't possible to protect afterwards because in SMF 1.x, quote bbcode gets replaced by a div. And it was impossible to write a regular expression to match divs when other bbcode also use div tags.
Yes, I also had the same problem, which is why I moved the smg tag code before the parse_bbc array stuff. Although I think now I could solve this by matching with (?!string)... But I had a complicated mess of dealing with both versions (<blockquote> and the div), so I thought it would be faster to just do it before tags are converted.

Quote(remember its not just matching <div> </div> its can be nested quotes in various shapes).
(NOTE: however late in smf 2.x development, div tags on the quotes were switched to blockquote (if memory serves me correct), which would be easier to protect from being converted).
Yes. But I have to deal with SMF 1 too, for now ;)

QuoteNote, the recursive expression that I wrote for protection of quotes is actually a god of regexs
Yes, you actually wrote it several times in your comments eheh ;) And I kept the name. To me, it really "is" the god of all regexps -- it's short and it's still ultra-powerful.

Quoteas it can actually deal with nested bbcode. (It took me 12 months to get one to work/ask around/searching).
I found some variations via Google... They were all made for dealing with nested html tags, which isn't surprising :)

QuoteThe mods raison d'etre was to make it as user-friendly as possible. That meant no bbcode, no fiddly settings.
It could still be the best of both worlds, couldn't it? I mean, powerful software is software that doesn't require any prior experience, and still allows you to hack it when you get to know the song.

QuoteFor example I hate it when positioning attachments in posts to have to set type/size etc
[attachment type=image height=63 value=filename.png]
(Thats nasty with other forum softwares).
I used to do a simple [attach id=1] tag on Noisen.com... I don't remember if it's still enabled though, since it's now replaced with SMG ;)

QuoteIIRC For loops are faster. In the context I was using them I wasn't always going to use every row, so using for with a count was better.
It's just that foreach() is about 10% faster, I'll have a closer look when I have spare time ;)

QuoteIt is LESS likely that cUrl will be available when fetch_web_data() won't work. I believe thats why smf developed it.
Hmm, not on all servers I guess... When I wrote my functions, I had a beta tester for whom it wouldn't work. He gave me access to his ftp, so I made a few tries, and... the curl library was installed. I guess his host wanted to give an alternative to their users after they activated php safe mode...

QuoteIMO, it would be a good idea to use cUrl as a backup. if smf's functions don't work, then try searching for cUrl.
I will reimplement a copy of SMF's function, if only because it doesn't support 30x return codes.

Quote from: Nao 尚 on December 02, 2008, 10:26:54 AM
You don't have to stick my stupid naming conventions (aka my old Automatically Email Inactive Ordinary Users, which I named AEIOU. I added ordinary, just so that it had every english vowel letter in the acronym)
Well, that one is definitely funny ;) But isn't Y a vowel, too?
Automatically Email You Inactive Ordinary Users would have been a good alternative :D

QuoteOne link that I had in my browser was
http://www.oembed.com/
Really nice... :)
I will not make any deals with you. I've resigned. I will not be pushed, filed, stamped, indexed, briefed, debriefed or numbered.

Aeva Media rocks your life.

Nao 尚

@akyhne> Either [aeva width=500 align=left]embed_url[/aeva] (if only width or height is provided - the other member is found via the default aspect ratio), or [aeva url=embed_url width=500 align=left] (just like the SMG tag... self-closing is cool.)

Quote from: regularexpression on December 02, 2008, 02:27:49 PM
Seriously, never quote Alexa. Even with recent improvements, its about as accurate as measuring a fart in a windtunnel on full belt. :P
Yeah sure (I wouldn't trust it for anything above a million), but I'm sure an Alexa rank of 1,000 makes it very likely the website is popular... It's just a matter of how many users with the Alexa toolbar visit that website...
If you know of any better measuring benchmark, be my guest... ;)

QuoteDon't use .*  it can lead to pulling more information + eating memory.
Well as long as I put the sacred "?" sign after it, it shouldn't be much of an issue...

QuoteThis was my mistake on early versions.
I tend to use [^"]*?
But there aren't double quotes in the strings that are parsed here... Are there?

QuoteIts not the file id/name that is loose, for example. It might be easier to match all subdomains of youtube with [a-z]{1,3} rather than listing each one individually.
Sure, in case they add any countries to the list... I thought of that, too.

QuoteCan't see the video tag taking off anytime soon
Yeah, me neither... :(
I think a recent version of Firefox supports it... Safari also supports it... IIRC Opera will follow suit in v10... But if IE8 doesn't support it, we're screwed. (Oh my...)

QuoteSwfobject is a pain in the ass, and only masquerades w3c compliance issues.
Yeah but it has the benefit of not requiring the user to click on the item... (I know Firefox doesn't require that, and recent IE7 versions neither because MS ended up purchasing the Eolas license, but Opera is still under watch.... And probably Safari, too.)

QuotePlus it would mean that it wouldn't embed for the increasing no. of users with javascript disabled.
I could add a fallback..... Hmm.... Okay, I know where this is going...

QuoteWith regards to &nbsp bug. No it was a v3 bug that should have been fixed in v4 (after I spoke to you about it and my use of $bbcode variable. I went back to use the smf version, and re-modified it.
Hmm... So basically you're telling me I broke Aeva instead of fixing it? ;)
Nah, I just checked -- it really was broken in v4.x... AFAIK!
I will not make any deals with you. I've resigned. I will not be pushed, filed, stamped, indexed, briefed, debriefed or numbered.

Aeva Media rocks your life.

karlbenson

Not going to comment on everything.




I'm not sure whether SMF's bbcode system would be as faster as replacing my tags.
Thats because preg_replace_callback, should be faster than what smf uses.

It was something that I was trying to get smf to switch too.  (IIRC even the subs.php file has a comment about, it could be faster or something).

Personally yes, I would never have added options for centering.
(for the most part, you can't really have two youtube videos side by side due to width constraints).
So for that I couldn't see the point.

But sure for height/width i could see a point. (obviously if you do, remember to set max-min limits, then defaulting if the user exceeds them [like my old youtube mod does] to prevent a user going too large or too big.



I'm not sure what a video thumbnail is.  Is it an image?  If its a flash object I can't see the point of those as they are almost as bad for crashing browsers as full ones are.




Quote
Don't use .*  it can lead to pulling more information + eating memory.
Well as long as I put the sacred "?" sign after it, it shouldn't be much of an issue...

For short-ish strings, using .*? can be useful sometimes. (This probably isn't news to you, but just in case).
However for larger strings (especially messages), AND/OR especially when using the m regex modifier for multiline, even using .*? can lead to unintended behavior. (which could include, using excessive memory, reaching php/preg limits on side/no. of matches, crashing, and potentially a vulnerability.

This was my mistake on early versions of the Aevac mod.

See my example below.

Quote

I tend to use [^"]*?
But there aren't double quotes in the strings that are parsed here... Are there?

Here is why the double quotes bit was necessary. (after parse_bbc is ran, the post might look like).

My post links to <a href="http://www.youtube.com">Youtube.com</a><br />
<br />And here<br />
<br /><a href="http://www.youtube.com/watch?v=1234567911">Youtube.com</a><br />

If you ran the following regex
'~http://(?:www\.)?youtube\.com/(.*?)v=([a-z0-9-_]{11})~imu'
then even with the ?., you would actually match

http://www.youtube.com">Youtube.com</a><br />
<br />And here<br />
<br /><a href="http://www.youtube.com/watch?v=1234567911


The reason I use the double quotes is to PREVENT the regex from going any further than need be.
eg
'~<a href="http://(?:www\.)?youtube\.com/([^"\<\>]*?)v=([a-z0-9-_]{11})"~imu'

That way it will never go past the " in the href.
This is simplied example, aevac itself uses a more complex one which also pulls any other paramters on the url, and then between the <a> to </a>

Nao 尚

Quote from: regularexpression on December 03, 2008, 03:16:50 PM
I'm not sure whether SMF's bbcode system would be as faster as replacing my tags.
Thats because preg_replace_callback, should be faster than what smf uses.
Yeah, it's rather fast... I use it on my SMG string splitter (I remove entities from the string, then I shorten the string, then I reinsert entities through the callback function. It's probably faster than relying on a foreach and str_replace, although it might not be the case.)

Still, it would require a few benchmarks.
Regarding the aeva tag, I need to point out that the [smg] tag is entirely handled by a function in Subs-MGallery.php -- I don't trust SMF and its many bugs when parsing BBC, so I did it all by myself, which also me to have a self-closing tag with self-validating parameters. (SMF doesn't have this as an option. It can be hacked into their code, but it's ugly and still slower I guess.)

QuoteIt was something that I was trying to get smf to switch too.  (IIRC even the subs.php file has a comment about, it could be faster or something).
Yeah, I think so...

QuotePersonally yes, I would never have added options for centering.
(for the most part, you can't really have two youtube videos side by side due to width constraints).
I beg to differ ;)

QuoteBut sure for height/width i could see a point. (obviously if you do, remember to set max-min limits, then defaulting if the user exceeds them [like my old youtube mod does] to prevent a user going too large or too big.
Don't worry about that :)

QuoteI'm not sure what a video thumbnail is.  Is it an image?  If its a flash object I can't see the point of those as they are almost as bad for crashing browsers as full ones are.
Yes, it's an image. Just these little thumbnails Youtube shows that you click to get to their video items... I think showing them instead of links is quite a good thing. (Also -- this could be a per-user setting -- show thumbnails instead of video player for all videos when available. But this would force me to actually store the thumbnail URLs in the database. Hmm.)

QuoteHowever for larger strings (especially messages), AND/OR especially when using the m regex modifier for multiline, even using .*? can lead to unintended behavior. (which could include, using excessive memory, reaching php/preg limits on side/no. of matches, crashing, and potentially a vulnerability.
I never used the m modifier, which is probably something I should work on eh...

QuoteHere is why the double quotes bit was necessary. (after parse_bbc is ran, the post might look like).
Oh... Thanks for the explanation ;)
Yes, I should probably test what the code looks like after every step. Would help me get it...

QuoteThe reason I use the double quotes is to PREVENT the regex from going any further than need be.
I really thought it didn't preg_match through anything else than the URL itself...
I will not make any deals with you. I've resigned. I will not be pushed, filed, stamped, indexed, briefed, debriefed or numbered.

Aeva Media rocks your life.

weightman

QuoteYes, it's an image. Just these little thumbnails Youtube shows that you click to get to their video items... I think showing them instead of links is quite a good thing. (Also -- this could be a per-user setting -- show thumbnails instead of video player for all videos when available. But this would force me to actually store the thumbnail URLs in the database. Hmm.)

Wouldn't using the image defeat most of the purpose of the mod? I mean, you would still have to leave the page you are one and load another site to view the video. I suppose it is more attractive to have an image instead of a link but what I like about this mod is that my viewers don't have to leave my site to see the videos.

karlbenson

Nao, the aevac mod doesn't just match a url, it matches the <a> tag with it.
(thats why links need to be active to be embedded).

As for slowness.  Your own bbcode replacement may in fact be faster than smfs. No need to make an apology for that.

IMO, you should want to stay clear of adding any queries from the 'viewing' of the page.
Otherwise you can quickly end up using several queries that puts the no. of queries over 15-20.
I'd take more processing at runtime over queries any day.

A lookup table is a neat idea in theory. But in practice its a pain, unworkable, and adds to many queries.
Thats something I learnt with my EbaumsWorld bbcode mod which did something similar.

mark7144

I won't be upgrading to any Aeva version that adds just a single extra query to page views.

Mikeric

www.Streetfire.net stopped working for me, it used to embed  fine now it wont.

Nao 尚

@mark> Well that's your loss...
@Mikeric> And?

Quote from: regularexpression on December 03, 2008, 05:39:35 PM
Nao, the aevac mod doesn't just match a url, it matches the <a> tag with it.
(thats why links need to be active to be embedded).
I would find it more logical to simply match the URL itself, within [url] tags (so before the rest is handled).

QuoteAs for slowness.  Your own bbcode replacement may in fact be faster than smfs. No need to make an apology for that.
I wasn't apologizing, I think ;)

QuoteIMO, you should want to stay clear of adding any queries from the 'viewing' of the page.
Otherwise you can quickly end up using several queries that puts the no. of queries over 15-20.
I'd take more processing at runtime over queries any day.
I never said I'd do that. I thought about it for a second and then I added that I could do it the way Dannii & I did when I worked on PrettyURLs -- a single query at the end of the page generation, to replace all entries in the page. That would make it a hell of a lot faster than going through parse_bbc and protecting quotes etc etc... I mean, it would be like one giant parse_bbc ;)

QuoteA lookup table is a neat idea in theory. But in practice its a pain, unworkable, and adds to many queries.
Unworkable? I'm sure it isn't. As we say here, "Impossible n'est pas français."
I will not make any deals with you. I've resigned. I will not be pushed, filed, stamped, indexed, briefed, debriefed or numbered.

Aeva Media rocks your life.

mark7144

#2211
Quote from: Nao 尚 on December 04, 2008, 01:07:59 PM
@mark> Well that's your loss...
Can you at least make any future features that add on queries opional in the CP?

1 extra query for page views can make things tough for really big forums.

ragdoll

I installed 5.0 on my forum and now none of the sub-forums that have pictures, videos, or any other embeded media will open.  Holy crap!

I uninstalled it and reinstalled the 3.12 and still the same thing.  I uninstalled THAT one then, still... junk

Being that it's a forum centralized around photography, I'm pretty much screwed.

H E L P !

ragdoll

Fatal error: post2() [function.require]: Failed opening required '/home/retar0/public_html/forum/Sources/Subs-AEVAC.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/retar0/public_html/forum/Sources/Post.php on line 1074


ragdoll

So looking at the code I posted above it looks like the 5.0 version removed the Subs-AEVAC.php from that location.  And it looks like, for whatever reason, that file is now REQUIRED in order to veiw any pages/forums with ANY media in them.

So I FTP'd that file back up to that location at my hosting site and it's working again.

Holy cow!  5.0 is dangerous.

RustyBarnacle

All beta code comes with risks.

It works fine for me but I backed up files and db before install just in case.

weightman

As I said, it sounds to me like the mod didn't fully install or uninstall. There must be leftover code. Did you install other mods between the time you installed this one and uninstalled it?

Nao 尚

Quote from: mark7144 on December 04, 2008, 02:11:37 PM
Can you at least make any future features that add on queries opional in the CP?

1 extra query for page views can make things tough for really big forums.
Since there'd be first a preg_match_all to retrieve all [aeva] tags, if none is found, no query will take place.

@ragdoll> How do you expect me to help you if you call my work "junk" and "dangerous", eh?
I renamed the mod, so it's only logical that I renamed the files as well... If you have a problem, just reinstall v4. Complain to the mod author who made the file mandatory or something.

Anyway, I don't see where the problem is, really. The error message is self-explained. Just open Post.php, go to line 1074 and replace AEVAC with Aeva -- poof, error gone!
I will not make any deals with you. I've resigned. I will not be pushed, filed, stamped, indexed, briefed, debriefed or numbered.

Aeva Media rocks your life.

weightman

Playlists no longer work in V5. The first video in the playlist embeds as a single unit and the navigation tools at the end don't show up.

Advertisement: