Niharika Kohli

Read this first

A C++ speed-me-up trick

After a couple of months of wondering how to wrap up this blog, I decided to keep it anyway. I’ll use it for posting random tricks/tutorials whenever I get time.

I recently got my toes back into competitive programming, something I hadn’t touched for over a year, and realized how much I’d missed it. Here’s an interesting problem I came across. It’s pretty simple from the programming perspective, needing you to know simple combinatorics (not even that, actually). Anyway, I coded it up pretty quickly and hit submit but, voila, it exceeded time constraints. I was quite sure I had the right algo, it is an O(n) solution after all. But nothing seemed to make it work, I gave up after hacking on it for a couple of days.

Today I went back to the Practice section, dug up my old code and added this to it:

ios_base::sync_with_stdio(0);

The program ran almost 4x as fast as earlier, on my own...

Continue reading →


17 Aug ‘14

I updated my PR according to Tim’s directions. Also finished my GSoC final report, almost. I’ll put it up on Docs tomorrow morning.

View →


16 Aug ‘14

Things I did today:

  • Did a LOT of styling improvements
  • Updated documentation (more to be done on this)
  • Completed my part of work on the streaming-system repo and opened a PR
  • Corrected minor bugs in the bugtracker repo
  • Started writing my final report for GSoC

View →


15 Aug ‘14

Things I did today:

  • Setup streaming system properly; instructions from skay helped here.
  • Understood the structure of the app better and wrote a function to capture and send video format and quality variables as GET parameters.
  • Made a new JS file for the function and added it to all templates.

Tasks for tomorrow:

  • Update database model to store video format and quality and perform migration to the database
  • Capture the GET parameters in views.py and save them in database
  • Update the table rendering to display video format and quality parameters.

View →


14 Aug ‘14

Tried setting up the streaming system, but ran into a very unhelpful error message. Skay could replicate the issue on her system. She figured out a way to make the server work though, and I’ll try and make it work tomorrow on my system,

View →


12 Aug ‘14

Today I worked on adding a link in the streaming-system website frontend. I assumed it to be a straightforward task, which it should have been, but I’ve messed up my git repo somewhat. Doing a ‘make serve’ for the streaming system turns up a series of errors. I’ve setup the stream before, so I think I can resolve it. That’s my first task for tomorrow.

View →


11 Aug ‘14

Things I did today:

  • Resolved logging out issue. Refactored some code and used the login_decorator.
  • Added a Logout button.
  • Added a Search button to turn up relevant records.
  • Some more styling improvements.

View →


10 Aug ‘14

Hi. I was away to my grandparent’s place yesterday and most part of today owing to an Indian festival. I spent some time trying to wrap my head around how decorators work in Django. I think I’ve isolated the due to which the user is repeatedly logged out. I’ll code it up tomorrow and hope that it works as I think it should.

View →


8 Aug ‘14

  • I improved the styling. Changing some internal structure and hiding some unnecessary fields.
  • Resolved the IP address issue. Hadn’t installed app in virtualenv. Skay helped.
  • Looked into permission decorators.

Tasks for tomorrow:

  • Try to use permission decorators for resolving issue of being repeatedly logged out.
  • Figure out how to connect to streaming system now.

View →


7 Aug ‘14

The app is fully up. I still need to fix the IP address error, which I don’t have any idea what’s causing it. Authorization for admin backend is done using Django auth system for now. Bugs getting saved in database and edit and delete functions working fine. Need to improve the UI though.

View →