NATION

PASSWORD

NationStates++ | Extension for NationStates

Bug reports, general help, ideas for improvements, and questions about how things are meant to work.

Advertisement

Remove ads

User avatar
Tlik
Ambassador
 
Posts: 1253
Founded: Jan 31, 2009
Ex-Nation

Postby Tlik » Mon Sep 02, 2013 12:57 am

Afforess wrote:
Bodobol wrote:I liekz the happenings feed.

It gets really crazy to watch around the update times. Thousands of happenings.

How are you doing that, by the way? How often do you check each nation page for the happenings?

User avatar
Afforess
Ambassador
 
Posts: 1105
Founded: Jun 22, 2009
Ex-Nation

Postby Afforess » Mon Sep 02, 2013 1:28 am

Tlik wrote:
Afforess wrote:It gets really crazy to watch around the update times. Thousands of happenings.

How are you doing that, by the way? How often do you check each nation page for the happenings?

It's pretty ingenious - it doesn't use the NS API, it scrapes the site. A players dossier can hold 2500 nations at once. Your reports page shows the happenings for all of those nations. I can clear the dossier with 1 request and use the advanced upload post form to cycle the next 2500 nations, rinse repeat. So i can upload 2500 nations to the dossier, scrap the reports page, then clear the dossier in 3 requests. I can collect happenings on all of NS in 43 batches and under 15 min.

The one downside is that I don't get exact time stamps, I have to parse and make a best guess. In fact the reports pages are so large it takes several seconds to parse and update happenings on my tiny server. Good thing the HTML site rate limit is roughly the same length of time.

I have 1.6M happenings stored already, adding ~70k a day. I have plans to begin to open up and document my backend server so other people can use it. I already use CORS/JSON for everything.

I think it's a pretty clever solution if I so say so myself.
Last edited by Afforess on Mon Sep 02, 2013 1:53 am, edited 5 times in total.
Minister of the Interior, Capitalist Paradise

The reasonable man adapts himself to the world: the unreasonable one persists in trying to adapt the world to himself. Therefore all progress depends on the unreasonable man.

User avatar
Tlik
Ambassador
 
Posts: 1253
Founded: Jan 31, 2009
Ex-Nation

Postby Tlik » Mon Sep 02, 2013 4:01 am

Afforess wrote:
Tlik wrote:How are you doing that, by the way? How often do you check each nation page for the happenings?

It's pretty ingenious - it doesn't use the NS API, it scrapes the site. A players dossier can hold 2500 nations at once. Your reports page shows the happenings for all of those nations. I can clear the dossier with 1 request and use the advanced upload post form to cycle the next 2500 nations, rinse repeat. So i can upload 2500 nations to the dossier, scrap the reports page, then clear the dossier in 3 requests. I can collect happenings on all of NS in 43 batches and under 15 min.

The one downside is that I don't get exact time stamps, I have to parse and make a best guess. In fact the reports pages are so large it takes several seconds to parse and update happenings on my tiny server. Good thing the HTML site rate limit is roughly the same length of time.

I have 1.6M happenings stored already, adding ~70k a day. I have plans to begin to open up and document my backend server so other people can use it. I already use CORS/JSON for everything.

I think it's a pretty clever solution if I so say so myself.

Have you thought about using multiple nations, each with a portion of the total dossier? It would be harder to programatically ensure that each nation exists and add new nations, but it might save on the upload parts. I'm not sure how much of a saving you'd get, though, it depends how differently NS 'feels' logging into a new nation vs uploading a new dossier.

User avatar
TaQud
Post Marshal
 
Posts: 15959
Founded: Apr 01, 2010
Ex-Nation

Postby TaQud » Mon Sep 02, 2013 4:59 am

i like the gameplay news :)
CENTRIST Economic Left/Right: 0.62 Social Libertarian/Authoritarian: -0.46
List Your Sexuality, nickname(s), NSG Family and Friends, your NS Boyfriend or Girlfriend, gender, favorite quotes and anything else that shows your ego here.
(Because I couldn't live without knowing who was part of NSG Family or what your nickname was. I was panicking for days! I couldn't eat, I couldn't sleep I was so worried that I'd would never know and have to live without knowing this! /sarcasm)
2013 Best signature Award

User avatar
Corporation de Apple
Diplomat
 
Posts: 609
Founded: Nov 05, 2010
Ex-Nation

Postby Corporation de Apple » Mon Sep 02, 2013 10:29 am

TaQud wrote:i like the gameplay news :)

*Gamplay

Tyops, there are everywhere. Apart from that, it looks awesome.
In nationstates.js, Line 8 (per Notepad++)
Code: Select all
$("<li id='ns_newspaper'><a id='ns_newspaper_link' href='http://www.nationstates.net/page=news/?ns_newspaper=true'>GAMPLAY NEWS</a></li>").insertAfter($("#live_happenings_feed"));


Becooomes...
Code: Select all
$("<li id='ns_newspaper'><a id='ns_newspaper_link' href='http://www.nationstates.net/page=news/?ns_newspaper=true'>GAMEPLAY NEWS</a></li>").insertAfter($("#live_happenings_feed"));
Last edited by Corporation de Apple on Mon Sep 02, 2013 10:39 am, edited 2 times in total.
The Hand of Thrawnn
Former things in Osiris
Frisbeeteria wrote:
Albul wrote:Everyone has said what they needed and now no one is saying anything relevant to the topic.

That describes pretty much every topic ever posted in NSG.
.

User avatar
Usual People In Life
Diplomat
 
Posts: 554
Founded: Jul 03, 2009
Inoffensive Centrist Democracy

Postby Usual People In Life » Mon Sep 02, 2013 11:05 am

Looks nice, I'll download the Chrome version next time I use my laptop!

I don't suppose you could make a Nintendo 3DS flavour of this extension (the browser uses the NetFront engine)? :rofl:
When is a nation not a nation? When it's a region!

User avatar
The Cosmos
Ambassador
 
Posts: 1427
Founded: Feb 22, 2012
Ex-Nation

Postby The Cosmos » Mon Sep 02, 2013 11:47 am

Gameplay News is awesome! However, I noticed that you misspelled Gameplay as "Gamplay" :p
Proud to be the last poster on the Flaming Wombat. The last words were:
"Relegate the potate"
I support thermonuclear warfare. Do you?
Olthar wrote:Awesome. From now on, I'll wear only thin leather straps covering my nipples and undercarriage.

New Maldorainia wrote:Alcohol, tobacco and firearms should be a store, not a government agency.

Thafoo wrote:
Merconitonitopia wrote:~First world problems - waking up.

~Third world problems - not waking up.

Uieurnthlaal wrote:Oh, I see, he's asexual but likes riding bisexuals. I meant bicycles.

User avatar
Afforess
Ambassador
 
Posts: 1105
Founded: Jun 22, 2009
Ex-Nation

Postby Afforess » Mon Sep 02, 2013 11:50 am

Tlik wrote:
Afforess wrote:It's pretty ingenious - it doesn't use the NS API, it scrapes the site. A players dossier can hold 2500 nations at once. Your reports page shows the happenings for all of those nations. I can clear the dossier with 1 request and use the advanced upload post form to cycle the next 2500 nations, rinse repeat. So i can upload 2500 nations to the dossier, scrap the reports page, then clear the dossier in 3 requests. I can collect happenings on all of NS in 43 batches and under 15 min.

The one downside is that I don't get exact time stamps, I have to parse and make a best guess. In fact the reports pages are so large it takes several seconds to parse and update happenings on my tiny server. Good thing the HTML site rate limit is roughly the same length of time.

I have 1.6M happenings stored already, adding ~70k a day. I have plans to begin to open up and document my backend server so other people can use it. I already use CORS/JSON for everything.

I think it's a pretty clever solution if I so say so myself.

Have you thought about using multiple nations, each with a portion of the total dossier? It would be harder to programatically ensure that each nation exists and add new nations, but it might save on the upload parts. I'm not sure how much of a saving you'd get, though, it depends how differently NS 'feels' logging into a new nation vs uploading a new dossier.


It wouldn't be worth the extra complexity, considering that I would have to still manage the 43 puppets and keep their dossiers up to date (with regards to new nations and dead ones).

The Cosmos wrote:Gameplay News is awesome! However, I noticed that you misspelled Gameplay as "Gamplay" :p


Oops. It was 3am and I was tired.
Minister of the Interior, Capitalist Paradise

The reasonable man adapts himself to the world: the unreasonable one persists in trying to adapt the world to himself. Therefore all progress depends on the unreasonable man.

User avatar
The Republic of Lanos
Post Marshal
 
Posts: 17727
Founded: Apr 17, 2009
Ex-Nation

Postby The Republic of Lanos » Mon Sep 02, 2013 2:37 pm

Is there a way to disable the gameplay and happening feeds?

User avatar
Afforess
Ambassador
 
Posts: 1105
Founded: Jun 22, 2009
Ex-Nation

Postby Afforess » Mon Sep 02, 2013 3:21 pm

The Republic of Lanos wrote:Is there a way to disable the gameplay and happening feeds?

There is now. Check your settings.
Minister of the Interior, Capitalist Paradise

The reasonable man adapts himself to the world: the unreasonable one persists in trying to adapt the world to himself. Therefore all progress depends on the unreasonable man.

User avatar
Libetarian Republics
Diplomat
 
Posts: 842
Founded: Oct 02, 2008
Left-wing Utopia

Postby Libetarian Republics » Mon Sep 02, 2013 3:53 pm

You sir are amazing. :bow:

User avatar
Glen-Rhodes
Powerbroker
 
Posts: 9027
Founded: Jun 25, 2008
Ex-Nation

Postby Glen-Rhodes » Tue Sep 03, 2013 9:45 am

Please check your changes with the Antiquity theme. The Happenings Feed link is going crazy with that exclamation point.

User avatar
[violet]
Executive Director
 
Posts: 16205
Founded: Antiquity

Postby [violet] » Tue Sep 03, 2013 4:50 pm

Afforess wrote:
Tlik wrote:How are you doing that, by the way? How often do you check each nation page for the happenings?

It's pretty ingenious - it doesn't use the NS API, it scrapes the site. A players dossier can hold 2500 nations at once. Your reports page shows the happenings for all of those nations. I can clear the dossier with 1 request and use the advanced upload post form to cycle the next 2500 nations, rinse repeat. So i can upload 2500 nations to the dossier, scrap the reports page, then clear the dossier in 3 requests. I can collect happenings on all of NS in 43 batches and under 15 min.

Unfortunately, this is ridiculously load-generating for us. The only reason dossiers can hold 2500 nations is because few people ever exercise that limit. We can't actually support generating real-time reports on 2,500 nations on a regular basis. (Which is why it's not part of the API.)

I don't want to lower everyone's dossier limit, but I will have to do that or something like it if it's used in this way.

Edit: Oh, is this just you, scraping to a central server? I was thinking every NS++ user would be doing it. That's not so awful.
Last edited by [violet] on Tue Sep 03, 2013 5:03 pm, edited 1 time in total.

User avatar
[violet]
Executive Director
 
Posts: 16205
Founded: Antiquity

Postby [violet] » Tue Sep 03, 2013 5:07 pm

LOVE Gameplay News, by the way, and Live Happenings are super-interesting to watch.

User avatar
Afforess
Ambassador
 
Posts: 1105
Founded: Jun 22, 2009
Ex-Nation

Postby Afforess » Tue Sep 03, 2013 5:36 pm

[violet] wrote:
Afforess wrote:It's pretty ingenious - it doesn't use the NS API, it scrapes the site. A players dossier can hold 2500 nations at once. Your reports page shows the happenings for all of those nations. I can clear the dossier with 1 request and use the advanced upload post form to cycle the next 2500 nations, rinse repeat. So i can upload 2500 nations to the dossier, scrap the reports page, then clear the dossier in 3 requests. I can collect happenings on all of NS in 43 batches and under 15 min.

Unfortunately, this is ridiculously load-generating for us. The only reason dossiers can hold 2500 nations is because few people ever exercise that limit. We can't actually support generating real-time reports on 2,500 nations on a regular basis. (Which is why it's not part of the API.)

I don't want to lower everyone's dossier limit, but I will have to do that or something like it if it's used in this way.

Edit: Oh, is this just you, scraping to a central server? I was thinking every NS++ user would be doing it. That's not so awful.

It's just one central server. I store all the happenings in a database, and then fetch them from there. All NS++ users query my server and retrieve the database records, so only 1 account is scraping, it's Capitalist Paradise Free Press. If it becomes a problem, I imagine you could simply lock out that account, which would stop the scraping. I also am trying to observe the regular site rate limits too - so it shouldn't be occurring too frequently.

You know what would be awesome? If all happenings in nationstates included the exact timestamp in a <span> element attribute. Right now I have to do guesswork, but I know NS has the exact times. You could simple change the "3 minutes ago: bla bla bla" into "<span time='_some_exact_timestamp'>3 minutes ago</span>: bla bla bla". Users wouldn't see any difference, but it would mean I could stop polling the NS region/nation/world happenings every 30s for timestamp updates. I am already doing this for the live happenings feed - if you check out the html I generate, it has the timestamp in the html, and then I can use that to update the html description as needed.
Last edited by Afforess on Tue Sep 03, 2013 5:42 pm, edited 6 times in total.
Minister of the Interior, Capitalist Paradise

The reasonable man adapts himself to the world: the unreasonable one persists in trying to adapt the world to himself. Therefore all progress depends on the unreasonable man.

User avatar
Afforess
Ambassador
 
Posts: 1105
Founded: Jun 22, 2009
Ex-Nation

Postby Afforess » Tue Sep 03, 2013 5:37 pm

[violet] wrote:LOVE Gameplay News, by the way, and Live Happenings are super-interesting to watch.

I honestly threw threw the gameplay news together in under 20 minutes. I plan on revisiting it and improving the design. It's just an iframe with a google doc link.
Last edited by Afforess on Tue Sep 03, 2013 5:43 pm, edited 1 time in total.
Minister of the Interior, Capitalist Paradise

The reasonable man adapts himself to the world: the unreasonable one persists in trying to adapt the world to himself. Therefore all progress depends on the unreasonable man.

User avatar
Afforess
Ambassador
 
Posts: 1105
Founded: Jun 22, 2009
Ex-Nation

Postby Afforess » Tue Sep 03, 2013 5:47 pm

Corporation de Apple wrote:
TaQud wrote:i like the gameplay news :)

*Gamplay

Tyops, there are everywhere. Apart from that, it looks awesome.
In nationstates.js, Line 8 (per Notepad++)
Code: Select all
$("<li id='ns_newspaper'><a id='ns_newspaper_link' href='http://www.nationstates.net/page=news/?ns_newspaper=true'>GAMPLAY NEWS</a></li>").insertAfter($("#live_happenings_feed"));


Becooomes...
Code: Select all
$("<li id='ns_newspaper'><a id='ns_newspaper_link' href='http://www.nationstates.net/page=news/?ns_newspaper=true'>GAMEPLAY NEWS</a></li>").insertAfter($("#live_happenings_feed"));

I'm amazed people honestly check out the code. Sometimes I think I am the only one who sees it. :meh:

Glen-Rhodes wrote:Please check your changes with the Antiquity theme. The Happenings Feed link is going crazy with that exclamation point.


The Aniquity theme is the bane of my existence. It does everything in a slightly different and confusing to handle way from the default & dark theme. Thanks for the report... and don't think I am chastising you... do keep reporting bugs. I'll go patch this one up.

Edit: Oh if it wasn't clear, the "!" is supposed to occur when a very large amount of happenings are being created, generally during major and minor game updates. I can't imagine a situation outside of those that would generate enough happenings in a short enough timespan to trigger it. If you have no idea what I am talking about, watch the sidebar around an update.
Last edited by Afforess on Tue Sep 03, 2013 5:55 pm, edited 3 times in total.
Minister of the Interior, Capitalist Paradise

The reasonable man adapts himself to the world: the unreasonable one persists in trying to adapt the world to himself. Therefore all progress depends on the unreasonable man.

User avatar
Avalon
Spokesperson
 
Posts: 144
Founded: Apr 01, 2013
New York Times Democracy

Postby Avalon » Wed Sep 04, 2013 1:02 am

Man, I love this app, this thread and this community. Admins trying to help, users coming up with ideas. This is what NS is all about after all.

Thanks again Afforess and all
Read our Factbook, listen to our Anthem. "In serving each other, we become free"
-------
Canarian/Canary Islander, secessionist, moderate leftist and an Anglophile IRL.

User avatar
[violet]
Executive Director
 
Posts: 16205
Founded: Antiquity

Re: NationStates++ | Extension for NationStates

Postby [violet] » Wed Sep 04, 2013 3:17 am

Okay, I'm doing it: I will make real-time Happenings available. It's just too embarrassing to watch you have to jump through these hoops to make something cool.

So what we should have sometime next week is something with proper timestamps that you can query as often as you like.

User avatar
Glen-Rhodes
Powerbroker
 
Posts: 9027
Founded: Jun 25, 2008
Ex-Nation

Postby Glen-Rhodes » Wed Sep 04, 2013 7:01 am

Afforess wrote:The Aniquity theme is the bane of my existence. It does everything in a slightly different and confusing to handle way from the default & dark theme. Thanks for the report... and don't think I am chastising you... do keep reporting bugs. I'll go patch this one up.

I know how you feel. When I was still doing this kind of stuff, it was always a pain to make special changes for the Antiquity theme. But I refuse to join the rest of NS in using these newfangled themes. Unfortunately, I have to point out that the Jennifer Government logo is right in the middle of the Gameplay News page. :|

User avatar
Afforess
Ambassador
 
Posts: 1105
Founded: Jun 22, 2009
Ex-Nation

Postby Afforess » Wed Sep 04, 2013 8:22 am

[violet] wrote:Okay, I'm doing it: I will make real-time Happenings available. It's just too embarrassing to watch you have to jump through these hoops to make something cool.

So what we should have sometime next week is something with proper timestamps that you can query as often as you like.

Yesss!
Minister of the Interior, Capitalist Paradise

The reasonable man adapts himself to the world: the unreasonable one persists in trying to adapt the world to himself. Therefore all progress depends on the unreasonable man.

User avatar
Afforess
Ambassador
 
Posts: 1105
Founded: Jun 22, 2009
Ex-Nation

Postby Afforess » Wed Sep 04, 2013 8:25 am

Glen-Rhodes wrote:
Afforess wrote:The Aniquity theme is the bane of my existence. It does everything in a slightly different and confusing to handle way from the default & dark theme. Thanks for the report... and don't think I am chastising you... do keep reporting bugs. I'll go patch this one up.

I know how you feel. When I was still doing this kind of stuff, it was always a pain to make special changes for the Antiquity theme. But I refuse to join the rest of NS in using these newfangled themes. Unfortunately, I have to point out that the Jennifer Government logo is right in the middle of the Gameplay News page. :|

Fixed.
Minister of the Interior, Capitalist Paradise

The reasonable man adapts himself to the world: the unreasonable one persists in trying to adapt the world to himself. Therefore all progress depends on the unreasonable man.

User avatar
[violet]
Executive Director
 
Posts: 16205
Founded: Antiquity

Postby [violet] » Wed Sep 04, 2013 4:56 pm

I swear Antiquity adds 10% to the development time of every new feature. It's a pain in the butt.

But it is nice to be able to view the site in its original form.

User avatar
Afforess
Ambassador
 
Posts: 1105
Founded: Jun 22, 2009
Ex-Nation

Postby Afforess » Wed Sep 04, 2013 6:43 pm

[violet] wrote:I swear Antiquity adds 10% to the development time of every new feature. It's a pain in the butt.

But it is nice to be able to view the site in its original form.

Speaking of bugs, an admin should check out my dossier. I somehow have duplicate nations in it. I'll not clear it so you can check it out.
Minister of the Interior, Capitalist Paradise

The reasonable man adapts himself to the world: the unreasonable one persists in trying to adapt the world to himself. Therefore all progress depends on the unreasonable man.

User avatar
Nightkill the Emperor
Post Kaiser
 
Posts: 88776
Founded: Dec 28, 2009
Ex-Nation

Postby Nightkill the Emperor » Wed Sep 04, 2013 6:49 pm

Is there any way to allow us to see what subforum we've posted most in (General, II, P2TM) and what topic?

I remember that was briefly a feature we had in the game, but was gone for some reason after a week.
Hi! I'm Khan, your local misanthropic Indian.
I wear teal, blue & pink for Swith.
P2TM RP Discussion Thread
If you want a good rp, read this shit.
Tiami is cool.
Nat: Night's always in some bizarre state somewhere between "intoxicated enough to kill a hair metal lead singer" and "annoying Mormon missionary sober".

Swith: It's because you're so awesome. God himself refreshes the screen before he types just to see if Nightkill has written anything while he was off somewhere else.

Monfrox wrote:
The balkens wrote:
# went there....

It's Nightkill. He's been there so long he rents out rooms to other people at a flat rate, but demands cash up front.

PreviousNext

Advertisement

Remove ads

Return to Technical

Who is online

Users browsing this forum: Bagong Timog Mindanao, Cyptopir, Ebrein, Ezaekia, Merulla, Orange Creek, Pravoslavi, Radicalania, Republic of Madovia, Unknown24, Wing Como

Advertisement

Remove ads