Friends Stalker! (Updated)

Правка en2, от suspicious_wow, 2015-11-04 21:40:11

Hi guys! I have modified the script and fixed some bugs of 'Friends Stalker!' and if you have the old one, please replace the code with new one.

For those who missed the last blog, 'Friends Stalker!' script will help you to know (**in real time**):

  • if your friend has submitted a code on codeforces, along with its verdict and problem name through an alert on your screen.This works on contest time too, so that you won't have to open 'friends standings' page to know how many problems your friends have successfully solved or attempted!
  • You won't have to check for system test results in every 2 minutes. You can leave script running in background and it will let you know the result of your submissions along with your friends in no delay!!
  • If you are participating in a team but team members are at different locations, you will know quickly your teammate's submissions and results.
  • You will have a record on your terminal/ command prompt of the last submissions of your friends.

So lets go quickly to installation:

  1. Make sure you have python2.7 or higher installed. Script is written python. If you write python in your terminal/cmd, it should give you the information about the python version and your OS. (take note if you have 32 or 64 bit OS).

  2. Make a folder named tool anywhere you like.

  3. Inside tool folder, make a file named codeforces.py and copy the code from here .(Since ideone screws up the code and alters it, I used a random problem to submit the code, I hope noone will mind it).

  4. Inside tool folder make a text file named friends.txt . Inside this file, copy-paste the handles of your friends separated by spaces .Make sure you paste correct spelling of handles as codeforces!!

  5. Through terminal/cmd, go to the tool directory and run python codeforces.py friends.txt .

  6. Voila!! You are good to go and will recieve a alert whenever your friend submits code.

Possible errors :

You might recieve an error telling easygui module is not found! So you need to install this module with command

  • Linux based users : sudo pip install easygui

  • Windows users : open cmd with administrator privilages (run as administrator). and type pip install easygui

If you still get an error telling something like 'pip not found' then :

  • Linux based users try this link

  • Windows users can try this youtube video i found link .It's an easy walkthrough to install pip.

Now install 'easygui' module! Done!!

Now if you are OK with canceling the alert through pressing enter key whenever it appears, everything is completed for you! Enjoy the script :)

But the users who have a 'lot' of friends may find annoying to cancel each alert by pressing enter! So HellKitsune suggested me to implement a massanger type notification which appears at corner and goes away automatically! I was able to find a way to implement this but unfortunately it is working for Linux based users only. (Since python-notify module is not available in windows!). I have written a script for windows too but I don't know if it is working since I have ubuntu machine. I will post the windows script also but someone has to tell me if it is working or not! So lets go to scripts for automatic close notification feature!!

  • For LINUX based OS users :(very easy!)
  1. just run the command sudo apt-get install python-notify .

  2. replace the code inside codeforces.py with code in this link

  3. run command python codeforces.py friends.txt

  4. done!! now you dont have to close alert everytime it appear.

  • For Windows users — (may or may not be working)
  1. You have to download pywin32 library from here. Make sure you choose the right python version and OS (32 or 64bit) file. Installing is pretty easy since the user has given instruction below the page very clearly!!

  2. replace the code inside codeforces.py with code in this link

  3. run command python codeforces.py friends.txt.

  4. tell me if it worked or not :D (I am grateful and you are a big contributor :) )

Inside codeforces.py : (known as readme.txt, please read)

There are few changes you would want to make according to you preferences like :

  • I have left flag = True at start so that it will be easy to know if notifications are successfully coming. After checkin first time,set flag = False so that you wont have to cancel bunch of pop-ups everytime you run script!

  • I have checked last 15 solutions of a user in script. You may wanna increase or decrease this.

  • I have set the script to check CF every 3 minutes. You can increase or (please don't) decrease this count. Less count will check codeforces more often and it can cause site run slow if lot of users set this less. I had set 3 minutes for testing purposes.

So with thats all done, you might have just one more question, "what happened to your last blog?"

Answer is I deleted that mistakenly ;_; I thought like comments a blog can't be deleted permanently too and will discard the current change. I am very sad about it (That blog had 80-85 upvotes!!). Well whats done is done.

Now if you find bugs or want to suggest new features, please comment me. If you want to add a new feature yourself, feel free. I have commented almost everything in the code so it is very easy to understand. If you have any trouble in installing please comment below but try googling your error first. If you have found an error but fixed it yourself, then tell others too and save them from some trouble!! I am sure this script will save some time for you.

Last but not the least, thanks to Mike and other codeforces admins for providing free API. Thank you awoo for all you help, many bugs i fixed by his help :)

Cheers!!

UPD :

FIX_1 : I have used submission id as the primary factor to distinguish between submissions (like primary key) which will fail at cases when :

pretest-passed -> Hacked (same submission id)

pretest-passed -> WA ,TLE , RTE or any wrong verdict (same submission id)

pretest-passed -> Accepted (same submission id)

I have already fixed this bug. Now I will use [Submission_id + Submission_verdict] as primary key and it wont cause anymore error! (correct me if i am wrong please).

So please don't rely on script for system case checking for now! I will update the script tomorrow after some more testing. I apologize for the inconvenience caused.

FIX_2 : GOOD NEWS!!! I have fixed the automatic-notification code for windows users. And it is working properly now!! This script will be posted tomorrow as well after some more testing. Now windows users won't have to press enter endlessly as well :)

After the next update the script will be totally bug-free (as i think for now). I suggest you guys to keep an eye on this blog because after next update the platform dependencies won't be an issue anymore and I will be adding more awesome features very quickly. Thanks and have a nice time! :)

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en3 Английский suspicious_wow 2015-11-05 07:57:05 984 Tiny change: 'ugs.Thanks[user:Past' -
en2 Английский suspicious_wow 2015-11-04 21:40:11 1259 Tiny change: 'e checking! I will u' -
en1 Английский suspicious_wow 2015-11-04 15:00:27 6307 Initial revision (published)