Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,153,211 members, 7,818,717 topics. Date: Sunday, 05 May 2024 at 10:40 PM

How Does The Mentions Feature Of Nairaland Work? - Webmasters - Nairaland

Nairaland Forum / Science/Technology / Webmasters / How Does The Mentions Feature Of Nairaland Work? (3013 Views)

Server Error On Nairaland Mentions / Nairalander Receives Award On Behalf Of Nairaland (photos) / A Throwback Pic Of Nairaland Wayback 2005 (2) (3) (4)

(1) (2) (Reply) (Go Down)

How Does The Mentions Feature Of Nairaland Work? by Nobody: 6:06pm On Jan 13, 2016
Who can explain how the mentions feature work? Does it mean that when someone submits a post the server will have to scan every word of the post against the 1 million usernames on Nairaland to find a match before sending you a notification? Wouldn't the process be bulky?
Re: How Does The Mentions Feature Of Nairaland Work? by Nobody: 6:21pm On Jan 13, 2016
Ontarget:
Who can explain how the mentions feature work?
When your username is mentioned anywhere on the forum, it gets counted and listed as your mentions.
Re: How Does The Mentions Feature Of Nairaland Work? by Nobody: 6:24pm On Jan 13, 2016
Ontarget:
Who can explain how the mentions feature work?
1.if u create a post and someone quote u,u will be notify thru d mention feature.
2.if someone mention ur username(which is ontarget),u will also be notify thru dis feature.
you will c dat u have been notify thru dis feature due to ur post i quoted and ur name i mentioned,is it clear?
Re: How Does The Mentions Feature Of Nairaland Work? by henryobinna(m): 6:27pm On Jan 13, 2016
To be honest the Nairaland mention is 'weak' it makes use of their search feature.


once you click on 'mentions' it automatically inputs your name in the search field and search, then it produces the most recent result as your mention.


so so weak.


Guys you can use same method to get any Nairalander's mention that's why I say its weak.

in that search box, input your preferred NDler's Username and search

1 Like

Re: How Does The Mentions Feature Of Nairaland Work? by Nobody: 6:49pm On Jan 13, 2016
muafrika:

When your username is mentioned anywhere on the forum, it gets counted and listed as your mentions.

tundexweb:

1.if u create a post and someone quote u,u will be notify thru d mention feature.
2.if someone mention ur username(which is ontarget),u will also be notify thru dis feature.
you will c dat u have been notify thru dis feature due to ur post i quoted and ur name i mentioned,is it clear?

Yeah I know. I was asking how it was implemented. Does it mean that when someone submits a post the server will have to scan every word of the post against the 1 million usernames on Nairaland to find a match before sending you a notification? Wouldn't the process be bulky?
You understand what I am saying?
Re: How Does The Mentions Feature Of Nairaland Work? by Nobody: 6:53pm On Jan 13, 2016
Ontarget:




Yeah I know. I was asking how it was implemented. Does it mean that when someone submits a post the server will have to scan every word of the post against the 1 million usernames on Nairaland to find a match before sending you a notification? Wouldn't the process be bulky?
You understand what I am saying?
Oh. You need a scientific answer.
Re: How Does The Mentions Feature Of Nairaland Work? by Nobody: 7:20pm On Jan 13, 2016
Ontarget:




Yeah I know. I was asking how it was implemented. Does it mean that when someone submits a post the server will have to scan every word of the post against the 1 million usernames on Nairaland to find a match before sending you a notification? Wouldn't the process be bulky?
You understand what I am saying?

since no token like @ is being used to pick up a username, that (your thoughts) is most likely the way it is being implemented - considering the fact that the mentions feature is even kinda shitty and you do not even get notified all the time - .
Re: How Does The Mentions Feature Of Nairaland Work? by onyengbu: 7:45pm On Jan 13, 2016
Ontarget:




Yeah I know. I was asking how it was implemented. Does it mean that when someone submits a post the server will have to scan every word of the post against the 1 million usernames on Nairaland to find a match before sending you a notification? Wouldn't the process be bulky?
You understand what I am saying?
Yes that's exactly how it works.
It is not bulky because its a computer that is doing it. If it were bad you woulda noticed it yourself when you post.
Even if nairaland is to have 1 billion users today, a good dedicated host server will still perform the action fraction of a second.
Re: How Does The Mentions Feature Of Nairaland Work? by onyengbu: 7:49pm On Jan 13, 2016
Jregz:


since no token like @ is being used to pick up a username, that (your thoughts) is most likely the way it is being implemented - considering the fact that the mentions feature is even kinda shitty and you do not even get notified all the time - .
Even if the @ token is used, it will be implemented by a preg match function when you run the "mentions" page.
The OP is more concerned about the notification which is done only when a user submits a post. Almost like realtime.
Re: How Does The Mentions Feature Of Nairaland Work? by Nobody: 8:05pm On Jan 13, 2016
onyengbu:

Yes that's exactly how it works.
It is not bulky because its a computer that is doing it. If it were bad you woulda noticed it yourself when you post.
Even if nairaland is to have 1 billion users today, a good dedicated host server will still perform the action fraction of a second.
Interesting. So if someone sends a post containing about 1000 usernames the sever will perform a match and notification action for each username in the post 1000 times. And if a lengthy post contains 1500 words it means the server will loop through the 1500 words testing each of them against the entire usrnames of Nairaland. You can imagine how many posts that are sent per second. The server will repeat this action several times continuously each second.
That's some serious computing power.
Re: How Does The Mentions Feature Of Nairaland Work? by Nobody: 11:17pm On Jan 13, 2016
onyengbu:

Yes that's exactly how it works.
It is not bulky because its a computer that is doing it. If it were bad you woulda noticed it yourself when you post.
Even if nairaland is to have 1 billion users today, a good dedicated host server will still perform the action fraction of a second.

Throwing hardware at the problem is not always the solution, I believe......

2 Likes

Re: How Does The Mentions Feature Of Nairaland Work? by onyengbu: 11:51pm On Jan 13, 2016
Jregz:


Throwing hardware at the problem is not always the solution, I believe......
What would you throw at this one.
Tell me.
Re: How Does The Mentions Feature Of Nairaland Work? by Nobody: 12:06am On Jan 14, 2016
dis is interesting.wat i can simply say about d mention feature is dat,it is an installed feature and works automatically.
Re: How Does The Mentions Feature Of Nairaland Work? by Nobody: 4:06pm On Jan 18, 2016
onyengbu:

What would you throw at this one.
Tell me.

Sorry for the late reply, i have not been on nairaland this days

During optimization of web apps, two things are brought up : scalabilty and speed. Adding servers is scalability solution while reducing HTTP requests, aggressively caching assets, optimizing db queries are examples of solving speed issues.

Lets talk scaling.

Nairaland clearly does not have problems with scaling if it runs a check against 1.4 million rows in the db with every posted stuff and there's a lot of folks posting at the same time.

How do i know that ?

Take for instance, i post only two words "igir derrf". Those words are definitely not mentions for users but nairaland still checks against 1.4 million records(according to what we concluded on the other thread).No, not once but depending on the length of the post, so if we have a 100 word post, there would be a check for each of the words against 1.4 million records.... Holy cow, that is an unneccessary db trip.

Which brings us to the other issue ; SPEED . The above tells us something, that which is Nairaland doesn't have scalability problems but SPEED issues, like the site could be faster if it HITS THE DATABASE ONLY WHEN IT NEEDS TO. That said, the site is pretty much fast but i am trying to make a point here.

The low hanging fruit here is optimizing database queries. From the previous example, the trip to the database would never be made if there was an identifier or token for mentions - like the ubiquitous @ -, yes they would need regex to check and other stuffs but that, to me sounds a better idea than going to the database everytime a post is made.

If more servers are added, the site would get faster like, computers like crazy work but should that have been the solution ? .

So to answer your question, what should they do if not get an extra server ?

They should fix their code architecture, the current model of doing the "mentions" stuff - if our guesses are correct - is to fix the sloppy architecture behind the feature. It is sloppy since most of the time we get mentions for stuffs that aren't supposed to be mentions (you get that right ? ). Example, you have the word "crazy" in your username. It is pretty much common to find posts like ; That guy is crazy, the song is banging crazy or others along that line. Believe me you, the guy with crazy in his username would find his way down to that thread. Was he mentioned ? hell no.

Mentions don't and should not work in such a weird way.

1 Like

Re: How Does The Mentions Feature Of Nairaland Work? by onyengbu: 4:25pm On Jan 18, 2016
Jregz:


Sorry for the late reply, i have not been on nairaland this days

During optimization of web apps, two things are brought up : scalabilty and speed. Adding servers is scalability solution while reducing HTTP requests, aggressively caching assets, optimizing db queries are examples of solving speed issues.

Lets talk scaling.

Nairaland clearly does not have problems with scaling if it runs a check against 1.4 million rows in the db with every posted stuff and there's a lot of folks posting at the same time.

How do i know that ?

Take for instance, i post only two words "igir derrf". Those words are definitely not mentions for users but nairaland still checks against 1.4 million records(according to what we concluded on the other thread).No, not once but depending on the length of the post, so if we have a 100 word post, there would be a check for each of the words against 1.4 million records.... Holy cow, that is an unneccessary db trip.

Which brings us to the other issue ; SPEED . The above tells us something, that which is Nairaland doesn't have scalability problems but SPEED issues, like the site could be faster if it HITS THE DATABASE ONLY WHEN IT NEEDS TO. That said, the site is pretty much fast but i am trying to make a point here.

The low hanging fruit here is optimizing database queries. From the previous example, the trip to the database would never be made if there was an identifier or token for mentions - like the ubiquitous @ -, yes they would need regex to check and other stuffs but that, to me sounds a better idea than going to the database everytime a post is made.

If more servers are added, the site would get faster like, computers like crazy work but should that have been the solution ? .

So to answer your question, what should they do if not get an extra server ?

They should fix their code architecture, the current model of doing the "mentions" stuff - if our guesses are correct - is to fix the sloppy architecture behind the feature. It is sloppy since most of the time we get mentions for stuffs that aren't supposed to be mentions (you get that right ? ). Example, you have the word "crazy" in your username. It is pretty much common to find posts like ; That guy is crazy, the song is banging crazy or others along that line. Believe me you, the guy with crazy in his username would find his way down to that thread. Was he mentioned ? hell no.

Mentions don't and should not work in such a weird way.
Oga tanx for all the beautiful scalability lectures. I quite appreciate.

You however still failed to tell me "what", in clear code terms, that "you" will throw at this problem of "realtime" mentions notifications.

If the notifications doesn't have to come in realtime, there are at least one other solution on my mind but in this scenario, I am out of ideas.
Re: How Does The Mentions Feature Of Nairaland Work? by 0luwatope(m): 8:48am On Jan 19, 2016
Ontarget:
Who can explain how the mentions feature work? Does it mean that when someone submits a post the server will have to scan every word of the post against the 1 million usernames on Nairaland to find a match before sending you a notification? Wouldn't the process be bulky?

As long a you gat a good host that has good CPU and server, the rest na story..... My website scans a whole dictionary for a single word any time a word is submitted and I think it doesn't take ip to 2 second... 2 second too much self buh I hope you gat moi point
Re: How Does The Mentions Feature Of Nairaland Work? by 0luwatope(m): 8:54am On Jan 19, 2016
henryobinna:
To be honest the Nairaland mention is 'weak' it makes use of their search feature.


once you click on 'mentions' it automatically inputs your name in the search field and search, then it produces the most recent result as your mention.


so so weak.


Guys you can use same method to get any Nairalander's mention that's why I say its weak.

in that search box, input your preferred NDler's Username and search

Guy take am easy nah.... I understand and I can see that it can't be corrected or can u correct it ?
Re: How Does The Mentions Feature Of Nairaland Work? by henryobinna(m): 9:03am On Jan 19, 2016
0luwatope:


Guy take am easy nah.... I understand and I can see that it can't be corrected or can u correct it ?
Actually it can, infact the whole of Nairaland can be rebuilt. so a little function can also be rebuilt.

maybe the founder/management believes it'll cost them time or money and probably say it does not worth it.

1 Like

Re: How Does The Mentions Feature Of Nairaland Work? by 0luwatope(m): 9:09am On Jan 19, 2016
Ok lemme use moi brain, I might be wrong tho because am still in year 2.....

Let's say $u = username // from the welcome, $u(m), or db you get your username.

If One guy posted and the word 'username' was in his post // nothing happens yet

When I login... It reads the database or topics (not users) I.e "SELECT * FROM topics WHERE post LIKE %@$u%" // this might be wrong tho buh I hope you grab that. The topics is the table name while the post is where all posts are stored.... The number of returned mysql_num_rols will give you how many mentions you get,

Note that Its searching @username instead of username

Then when you click mentions.php it searches for @username in every post.... Over 2million posts.... Note that some people have mention you b4, let's say like 20 times.....
You got the old_mention in your users db to be '20'

So if a new user mentions you.... Your total mention will be 21(mysql_num_rols)... Subtract your old_mention from new_mention and it will give u 1 new mention

@the end of mentions.php it will save your old_mentions to be '21'

And to validate users from getting unnecessary mentions I.e if your username is 'hot'
and in a post, someone said, 'am hot'..... There will be @$u // @username as the recognised mention so when you type only username, it won't recognise this as a username but when you type @username, it will recognise this.... So when its searching for username in posts it will search for $u = "@$username"; // I.e @username


Please I hope a better webmaster will explain better, am not good @ explanations and I'm not sure if I got the algorithm right
Re: How Does The Mentions Feature Of Nairaland Work? by onyengbu: 2:03pm On Jan 19, 2016
A nice approach @0luwatope. However, your query won't get the correct number of mentions because it is counting table rows and not actual number of mentions that exist within posts. One row can contain more than one mention you know?
That aside, we are still talking about realtime notifications. The much I can follow your script is concerned about looking for mentions during log in. That won't do it for a realtime approach.
Re: How Does The Mentions Feature Of Nairaland Work? by directonpc(m): 7:20pm On Jan 19, 2016
onyengbu:
A nice approach @0luwatope. However, your query won't get the correct number of mentions because it is counting table rows and not actual number of mentions that exist within posts. One row can contain more than one mention you know?
That aside, we are still talking about realtime notifications. The much I can follow your script is concerned about looking for mentions during log in. That won't do it for a realtime approach.
Are you sure nairaland notifies you of 2 mentions when you name appears twice in a single post?
Re: How Does The Mentions Feature Of Nairaland Work? by onyengbu: 7:37pm On Jan 19, 2016
directonpc:

Are you sure nairaland notifies you of 2 mentions when you name appears twice in a single post?
Actually I am not certain of that.
Re: How Does The Mentions Feature Of Nairaland Work? by directonpc(m): 7:41pm On Jan 19, 2016
onyengbu:
Actually I am not certain of that.
Can you type directonpc 3 times in a reply let's test.
Re: How Does The Mentions Feature Of Nairaland Work? by onyengbu: 7:43pm On Jan 19, 2016
directonpc

directonpc

directonpc
Re: How Does The Mentions Feature Of Nairaland Work? by directonpc(m): 8:35pm On Jan 19, 2016
onyengbu:
directonpc

directonpc

directonpc
I guess I saved the say! It showed only 1 mention.
So we can agree with that guy's answer.

In other stories you can try this social android app I developed. http://7rl.in/png12

1 Share

Re: How Does The Mentions Feature Of Nairaland Work? by onyengbu: 8:45pm On Jan 19, 2016
directonpc:

I guess I saved the say! It showed only 1 mention.
So we can agree with that guy's answer.

In other stories you can try this social android app I developed. http://7rl.in/png12
No it didn't. Have you been reading my posts?
What your little experiment resolved is the number of mentions notifications count to display and NOT how or when they are displayed.
Re: How Does The Mentions Feature Of Nairaland Work? by directonpc(m): 8:50pm On Jan 19, 2016
onyengbu:

No it didn't. Have you been reading my posts?
What your little experiment resolved is the number of mentions notifications count to display and NOT how or when they are displayed.
NL doesn't scan every username in your post body when you submit. It selects posts with your username in them... Bla bla bla. With as low as 7000 naira I can code nl prototype mention system for anybody that might be interested in it.
Re: How Does The Mentions Feature Of Nairaland Work? by onyengbu: 8:58pm On Jan 19, 2016
directonpc:

NL doesn't scan every username in your post body when you submit. It selects posts with your username in them... Bla bla bla. With as low as 7000 naira I can code nl prototype mention system for anybody that might be interested in it.
You still don't get what is being debated and as usual you jumped in to advertise your Android app and 7000 naira coding skills.
Read the OP again.

Good luck with that.
Re: How Does The Mentions Feature Of Nairaland Work? by directonpc(m): 9:09pm On Jan 19, 2016
onyengbu:

You still don't get what is being debated and as usual you jumped in to advertise your Android app and 7000 naira coding skills.
Read the OP again.

Good luck with that.
Lol. 7k coding skill? Lol. The guy you quoted before me got the logic behind the system. I agree with him and answered your question with a practical demonstration. Any other work around might be too wasteful.
About real-time, in some systems like nairaland real-time sometimes is an illusion.

And forget my app and 7k skills if you are not interested. Good luck with finding the magical solution to the problem.
Re: How Does The Mentions Feature Of Nairaland Work? by 0luwatope(m): 11:14am On Jan 20, 2016
Am getting better buh am not yet ready to code a website #yippie

Am feeling fly.... The gods of php codes likes the program I wrote grin
Re: How Does The Mentions Feature Of Nairaland Work? by Franklin24: 5:42pm On Mar 25, 2017
.

(1) (2) (Reply)

Is Auto-blogging Against Adsense Policy / Google Adsense Running On My Wapka Site What Did You Think Webmaster / Google Adsense Is Not Working In Africa

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 69
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.