Tag Archives: Code Review

Laravel controller for a commenting system

Can someone review my Controller? I should follow these guidelines: Code should be written with MVC pattern and to use OOP. The code now works fine, but I need to improve it. Also, should I use more Ajax Model? This code is used to receive data from a jQuery script and send it back. Almost… Read More »

Filtering queries based on the current user state

I have a Symfony2 project. I have an Entity Asset which can have relations with Category. I store a categoryCount-field within the Asset to determine if an asset has one, to select those fast via a DQL-query depending on the current user state. Now found myself writing something along the lines of this in my… Read More »

Issue in fetching full data from API

I am working on a app by which I need to fetch DAILY FUEL PRICE. I tried these API: http://fuelpriceindia.herokuapp.com/ https://market.mashape.com/navii/daily-fuel-price-india But, none of these is providing full data. I am not sure either I am doing something wrong or these APIs are not providing full data. Please suggest any API or any way to… Read More »

Very basic Calculator

My calculator is complete but I realized my teacher asked for this one last thing. ‘After the first operation is completed, the program will read another operator and uses the result of the previous operation as the first value for the next operation.’ This is my code so far. I just want to know how… Read More »

Maintainable networking layer architecture

There are so many different solutions and examples on how to build a proper networking layer, but every app has different constraints, and design decisions are made based off trade-offs, leaving me uncertain about the quality of code I’ve written. If there are any anti-patterns, redundancies, or flat out really bad solutions within my code… Read More »

Sovle Time Limit Exceeded for list in c++

The input begins with an integer $q, 1 leq q leq 10^5$, the number of queries. The next $q$ lines each gives a query. A query is $text{“a x”}, 1 leq x leq 10^9$ Print the result of each query on a single line. For each a query, print the last integer in the queue… Read More »

Passing arguments to a function, vs using instance variables in the same function [on hold]

I am trying to figure out whether I am following best practices while passing arguments to functions. I will give a simplified example directly from the project I am working on to describe my conflict. Say I have the following class definition class PatternA(): def __init__(self): self.my_var2=1 self.my_var3=2 def move_data_to_database(self): self.my_var_vA=self.clean_data_vA(self.my_var2, self.my_var3) self.clean_data_vB() def clean_data_vA(self,… Read More »

Having trouble assembling basic codepen scripts to play with offline on desktop sandbox static site [on hold]

How to move codepen project to desktop folder? This is really simple and basic, but all JS websites let you practice the code online, but I want to download and play with the code offline. I realize I need 3 files for most examples. index.html xxxx.css xxxx.js Let’s say for example this pen: https://codepen.io/Satearn/pen/YeQBPL How… Read More »