Back to OpenSource Participation forum
UPD this project was successfully created by YetAnotherMinion - thanks a lot!
It was suggested by MoffSerge long ago in this topic - we may have small profile banners with user's name and his stats (and probably some picture).
I still did not collect enough moral powers to work on this - but this could be a nice exercise for anyone :)
So if there are passionate Python or Java coder, we can cooperate in the manner like following:
Flask
or pure CGI
(or Servlets
in Java)
suitable for deploing to Google App Engine (so we can host it for free);moffserge
) will in turn
request CodeAbbey to get user's stats;Here is a GitHub project (Python) - you can download these files and deploy
them to google-app-engine to start with.
And the GitHub project (java version) (now removed).
Of course there could be enough things to research and consider still... And surely I'm ready to help with any of these steps (though of course if may lead to doing whole stuff myself, ha-ha).
What do you think?
I like the idea! I feel that I personally am too much of a noobie to contribute significantly, but I'm willing to learn if no experienced programmers hop on it :P
> I feel that I personally am too much of a noobie
I feel just the same when starting CodeAbbey... Well, I still feel the same :)
Do I understand correctly that you are going to use Java
? If you are unaware of making
web-applications with it, I can upload blank web-project with which you can play a bit
(for example solving our 5 basic problems of web-programming) and tell if you are in the
mood to continue. Does it make sense?
UPD here is a link for the mentioned 5 basic problems
UPD2 added link to blank Java-project to the post above (along with short instructions to deploy it).
I am interested in trying to hack around on this. I have never written any web applications, but this is a good cause to try for. It will be fun. Is there an API for requesting the data? Or can we scrape the data from the user's page?
I will try and put together an example flask banner generator on Github and upload link tomorrow so everyone can play around with it and get the formatting the way they like it.
Edit forked the demo project and it is now running on my local machine. Yay tutorials! Have not changed any thing yet though
There was no API, but as we have the developer at hand...
Here it is! Try the URL's like
http://www.codeabbey.com/index/api_user/another-minion
the last part should be user url, the same as for profile page (it is going to be passed to the intended service when requesting the image)... Will this be Ok?
Just woke up, that is perfect!
Edit Are you using ISO 3166-1 country codes for the users?
>Just woke up,
Sounds as if you are somewhere at the western part of US - almost half a day difference with us :)
>Are you using ISO 3166-1 country codes for the users?
I think yes, though I've borrowed them from some list long ago.
I downloaded all of the coutry pictures so I could use them test with them locally.
Right now here is what I am thinking mainly based off of the rankings page and the project Euler:
build a reponse image using
- CodeAbbey.com text, possible to use green color that appears to be "signature" style of site
- their user name colored just like on the site
- rank in number
- problems solved
- user picture if they have one, using PIL to resize it
- country flag
if username is invalid, return just the 400 response code
Yes, this sounds quite sane and detailed enough!
As about country pictures - if you meant ones at the codeabbey site itself - they are rather small - I'm myself thinking of changing them to some larger...
As about rank-colors - you can peek at them in the main CSS file, however note that after rank of bishop they are accompanied by small images. Probably we'll be able to create dedicated images for banners (starting with the lowest rank) - but anyway all this could be added later.
Be sure that it is quite Ok to make a first "prototype" version without certain details - as the phrase goes "Let there be at least bones - the flesh will grow around them!"
If you'll need any change or addition to the data returned by api_user
- just tell.
I have implemented part of the badge generator. See it live at:
http://code-abbey-banner.appspot.com/banner/your_username
refresh this post to see new generated profile image
Right now I randomly generate a profile image and dynamically resize long names to fit in postion similar behavior to CSS rules. The country flags are correct, and if there is not a valid flag then it does not write one
What is left to do for bare bones before we start to determine style
The project is live on https://github.com/YetAnotherMinion/Banners and should include everything, just change the app.yaml to use correct application tag for your own app engine account
I'll finish the rest tomorrow and make a Pull request.
Edit Fonts are easily configurable, I just chose an free license font from BitStream that was different than my system font so I could see the if configuration was correct
Edit2 Can you add to the API the link to the user's profile image?
It seems to me that CodeAbbey logo needs to move to a different location, either right justify on top or move to bottom and shift data up. What do you guys think? Where should it go?
Hi! Great job! Really! :)
Though I myself usually have no problem starting any web-project, I always become hesitant when it comes to manipulations with images and text on them.
>Can you add to the API the link to the user's profile image?
Yes I can, but do you think we need them? It seems that most people do not use profile images. And ProjectEuler instead inserts here some pictures describing the level or rank.
If you agree that would be better, I'll try to compose myself and create such images. Just say what size you prefer.
>It seems to me that CodeAbbey logo needs to move to a different location
Yes, I believe it should not be on top of all :) It is quite safe to move it to the right
lower corner, and perhaps remove CodeAbbey logo (since we have not very sexy one for small
resolution) - instead just small inscription like www.codeabbey.com
should be enough
and comprehensible. What do you think?
BTW I think we should try to summon MoffSerge who initally lobbied this feature, perhaps he can express his opinion on design or even lend a hand with coding if necessary. I'll try now.
Could we please stick to 200*60
size? I believe people are going to use banners in their signatures at other
posts and probably larger banners will make admins there bit nervous... :)
Optionally we can have (later) banners of several sizes, of course, served by different urls.
Though I understand that it could be tricky for you to put the text onto smaller banner - isn't it so?
As about layout, when I look at design proposed by MoffSerge - probably we can make it similar? E.g. like this:
Here it is possible to simplify your work:
solved
is) remains.What is your opinion of this?
Note: I've added your pictures to current profile pages (leading directly to your project url for now) so that you can see whether the load is tolerable (if sensible) - and can watch your work "live" :)
The text in smaller banners is no problem. The banner code is quite general and already dynamically resizes the font to make a really long username fit in the size. I made the banner a class that you instantiate with a bunch of different properties. I just randomly picked a size. I made the banner a class and all of the data is added by setters for easier unittesting of the code, which I will also add.
The default image is a great idea. I was thinking that solved and rank fields should be in same place, so that can save even more time when creating the image by including the words "solved" and "rank" unless you think we should change the font color of those, maybe? All very easy to do.
I was thinking that we could then create a default banner for each rank. This can be easily bootstrapped from existing project, the given default image can be set as default, then we just create one of each different rank, save them, and use them as the new defaults. These images are so small I don't think we will impact the memory for the sever instance much. Right now I am only using ~40 MB of app engine memory.
The candle looks really good, does MoffSerge have any others in mind?
Does the API send unicode characters in the name? I tried to leave unicode support for the names, but I do not know if it works outside of ASCII char set. I do not know if I am decoding the response correctly or not, I believe that names using unicode characters after that will work but that has not been tested.
Edit Really long usernames are really packed in there tight like this guy below
Edit2 Fixed
What are your thoughts on how to address this?
Hi!
BTW, perhaps if you enable issues
in your project, we can communicate there at github if it would be more convenient.
Now to our questions :)
solved
and rank
to default background - it is not necessary if they will be printed with the
same font as the remaining characters in the line. I.e. you do textout "solved % rank %" % (...)
and
that's all - but if they are "hardcoded" you'll have a headache to put the digits into correct places, I think...I enabled issues, will post there.
Please have a look at my pull request with pictures.
Probably not all of them are ingenious, but we'll be able to change / improve them later anyway.
I think some twiddling on the fonts for the solved and rank is needed. Possibly the numbers should be bolded or a larger size. I left plenty of room for expansion of the site. The rankings can accomodate 1e100 people before it breaks down and just returns ">1e100". Here's to reaching that user count ;)
EDIT
I made a pull request with all of my changes. Only the app.yaml name will have to be changed for the specific project, since it is set to mine right now.
Well. To say the truth what I see looks really wonderful at the least. Thank you a lot! :)
You know this feature was discussed for more than year - and here you've done it in two days.
As about "twiddling the fonts", you may safely leave that as is for now, as most of users are guys who are less sensitive to minor effects of design and style. After some time there will arise some set of requests for improvements of pictures and fonts - and then we'll be able to make necessary improvements at once.
I think we need to create special type of certificate - for contributing the code - though I'll need to ask some friend of my to create the design, so this may take time...
Hi. The badges looks good, but not enough.
Using uniform font-size
and sans serif
strong font for username should looks more clean.
Don't use rank color for username, only for rank name.
Yellow text on white background looks bad, may be add some shadow for one.
The project url should be more contrast, but solved and rank substring could be a more gray.
Can project url be drawn at pencil-style with oak leafs? Ascetic style differs Code Abbey from other projects.
Or we can use some Gothic font for project url.
Ahaha, I was correct that:
After some time there will arise some set of requests for improvements of pictures and fonts
though I did not think it is going to be so soon :)
Sergey, thanks a lot for your suggestions - you probably are the only person among us with good designer's sight. BTW, could you explain bit more about "pencil-style and oak leaves"?
As about gothic font - I'm afraid letters with lots of features could not be well rendered inside the small space. Though probably I do not know all fonts well...
I actually ment to change the font for username but forgot. Change is live now.
The font will probably change again, this one is rather wide and trucates to many characters
EDIT I tweaked the yellow. I am strongly motivated to make my own username fit inside the width. Right now the code uses a san-seriff 14 as default for those of you with usernames less than about 12 characters and then switches to a condensed version of that font if it does not fit, only then trying to resize, and even then only shrinks font by ~15% before giving up and truncating. My username just barely fits, and I am happy ;)
I'm not a designer. Try to apply some ideas:
I've made an icon a bit smaller. Decrease spacer between username and results. And apply a Gothic font to url.
Can you add a link to an opensource font file for your gothic font, or you can add it to the github project font folder directly. I agree about moving the rank line up, it is kind of imbalanced as is. I cannot really make the font for that line larger without shrinking the fields. Right now there are 4 characters for the number solved and 6 characters available for rank before it switches over to scientific notation. We could make the banner wider to solve these problems though.
I believe you resized the fanatic image and moved the text, would you be willing to take a look at the default templates and make image touchup changes in a pull request? They are here
There are several images that could be edited in a similar fashion as above, then we can deploy them.
Example template images
Hi Colleagues!
I'm ready to take care of the updating images with the gothic inscription proposed by Sergey!
Though to be honest now I understand why I initially wanted single background 200*60
picture
and separate tumbnails for every of 12
levels - ha-ha :)
Thanks for moving the middle line - I see it is done already!
>Can you add a link to an opensource font file for your gothic font, or you can add it to the github project font folder directly
Do we want to use them everywhere besides "codeabbey" inscription? If no then we need not separate font, I think...
UPD I've updated them and created new PR to your branch...
UPD2 I've just realized I used Sergey's version of inscription, not yours which is a bit smaller. Feel free to reject PR if the size do not fit, I'll be able to change it!
Well, looks like short enough names fit well enough...
Now it looks unbalanced.
Sergey, Hi!
Thanks for your remarks!
Really it seems I shifted the text a bit to the left and it is misaligned with the rest now
- (fixed it now)... :(
As about icons - I hope I'll be able to make them smaller when I get ready to redraw them.
(For now probably we can allow the first line with flag slightly overlap with image since
images usually do not have anything in the upper-left corner)...
UPD to YetAnotherMinion
: I've made changes to separate background image from rank images (so rank images now are 62*56
)
and updated the code respectively (see pull-request) - had a hard time with Python, ha-ha.
I also deployed it to initial google project - not only to apply changes, but also to see the load stats (I hope you will not be disappointed with it) - if you tell me your gmail I would be glad to add you to this project so you can watch and deploy it too!
Regarding the flag, the reason they overlap right now is because in the first version I hada separate image for each rank that was applied to the background, and left over from that code is the expected width, which currently is set to 45 pixels. I then forgot to change this value. This width is used to compute the allowable width for the username field. Then the flag is offset from the end of the username using the actual width of the username field. When I change the width variable , called self.tb_sz which stands for thumbnail_size, to the correct value of 62, then we see that we do not run over the image but unfortunately it then truncates my username :( The padding is somewhat generous in this line though, so perhaps reducing some of the padding can help make up the difference. The load stats were quite mild, I think over the two days I use like 0.0032% of free quota.
I am glad that you were able to deploy it successfully to a more permanent home.
I would be happy to help with updating and fixing things on the live project.
my gmail is secretly removed by admin
:)
===================================================================
On a side note, have any of you considered using regex to find the hidden emails on contact forms these days? I have been looking at all of the obfuscated emails on contact forms, and I think to myself that a good regex might be able to parse a great deal of these. And yet here I go, putting my email out in the same manner... :)
I removed your email from the previous post after sending an invitation to you!
As about findinfg the hidden emails to be honest I never thought of this probably for the lack of obvious reason for me - though I like regexps and all other cunning text processing tools :)
As about the load - right now appengine dashboard shows me for last half a day (since deployed):
Frontend Instance Hours 38% 10.78 of 28.00 Instance Hours
I'm not very well acquainted with these stats, though I read it is because once instance is started it do not stop for about 15 minutes. Though I do not think it is going to be a great problem - or, well, I will think about some caching etc...
The instance hours are just how many hours the service is running. If it is on and accepting requests then it is using instance hours. It should not run more than 24 hours a day unless the Google Load Balancer deals with traffic surge and kicks on another instance. I don't think that will be a problem unless someone decides to DDOS the banner generation server. At that extreme situation the worst that happens is some people don't have banners for a few hours until we mitigate. That we are opposite sides of world makes it easy for 24hrs response to problems. I considered caching the images, but time to generate the images is only about 20-40ms , the rest of the latency is the time required to query the API. Knowing nothing about how the app engine is configured, I do not know how the app responds to concurrent requests. I hope it spawns a new thread for each process but I do not know.
My biggest concern was bandwidth, to the point I looked into setting cookies and returning 304 not modified, but it would require quite a bit more effort to implement data layer to keep track of request cookies send out and expiration date because you can never trust data from client. But it looks like the bandwidth usage is only ~9kB per image and only a thousand or so requests per day.