I'm learning C++ and thought I would try my hand at writing a basic program in modern C++. I'm always looking for ways to reduce my code to STL algorithms and simplifying areas that would require refactoring. I'm also trying to make my code as readable as possible.
Limitation
I can't modify t...
In my company I follow the following workflow ( I think it can be defined a kind of 'Continuous Integration' )
Workflow:
We have 3 fixed branches ( staging/master/production)
Every push to staging or production automatically deploy to staging/production server.
We use git in the followin...
Given a graph \$G = (V,E)\$ with a unique labeling of each vertex, let the transposition \$(i,j)\$ (where \$i,j\$ are the labels on adjacent vertices) represent selecting an edge and swapping the labels \$i\$ and \$j\$.
I would like to take a list of edges in a graph (a cube in this code), and d...
I've literally been looking for an hour now, stumbled on this site, tried a bunch of different solutions from other topics and haven't gotten anywhere. If anyone can help me out, you would be my personal hero!!!!
//HTML
<!doctype html>
<html>
<link href="CSSCODE.css" rel="stylesheet"...
Given an integer, write a function to determine if it is a power of two. I saw a version of solution as below:
public boolean isPowerOfTwo(int n) {
if (n <= 0){
return false;
}
else if ((n & (n - 1)) == 0){
return true;
}
else {
return false;
}
}
...
So far everything seems to be working as it should..! For facebook I used 'Facebook module loader' instead of the async plugin, after reading some posts comparing the two, it seemed like a better solution. Once I finish I will update my post/code about this on codereview, perhaps it could be helpful to someone. — dimk13 secs ago
i am trying to find the similarity between the two movies using pearson correlation coefficient. the programs is working good for small inputs but for large inputs(like 100000 lines) it takes forever time. my professor said it would take few minutes. but my program is executing forever.
the input...
I borrowed some code trying to implement a function to calculate the running median for a ton of data. The current one is too slow for me. Below is the code:
from itertools import islice
from collections import deque
from bisect import bisect_left,insort
def median(s):
sp = [nz for nz in s ...
I'm a security engineer at Facebook and this is my fault. We're testing this for some users to see if it can slow down some attacks where users are tricked into pasting (malicious) JavaScript code into the browser console.
Just to be clear: trying to block hackers client-side is a bad idea in ge...
> I'm a security engineer at Facebook and this is my fault.
lol
So this is the kind of thing I'll be screwing around with at Riot then? :p
@Quill It's Security Engineering, so, it's pretty varied
one of the key interests I have in Riot though is that they generally say "Within reason, you have total ownership of the code: you can use whatever you want to get the job done"
I mean, I know they have some codebases of C++, Erlang, and the new client is obviously written in HTML5 (that's common knowledge)... basically everything
We are steering a model according to drivebehaviors, the return value of each drivebehavior is the next drivebehavior.
Additionally the model has events that can be thrown, that should do a different drive behavior. For this we have a queue that saves the event till the next execution cycle.
p...
I have code that runs in ViewContainer. We made a button that when the button is pressed it open a new screen. This is the code of the Action:
DialpadManager.sharedInstance.showPadFrom(self, type: DialpadManagerPads.incoming, number: "123456")
In order to open the UI I made a static fu...
The following - working correctly - first python class is used in one of my current project and is a totally different approach to how I normally would take things. Before I refactored the class into the above I was not declaring instance-properties/variables. Instead the whole update procedure t...
So the first thing you should realize when writing a language like that is that it's not about the amount of lines but about the amount of (and impact of) operations.
IANAL, and this isn't an official answer, but I've done both in the past and haven't been sued yet. — Undoyesterday
@overactor Because, assuming you already wrote your code as well as you could, then you'll have nothing useful to add to a review, because if you knew how to improve it, you would have already.
@overactor Python is a bit of a unique case because part of the style of the code (in particular, indentation) replaces more traditional constructs like braces and such. PEP8 is a tool that makes it easier to write code that works and doesn't look too bad
I recently wrote a function and some associated code that acts as a sort of switch expression (which worked as expected) and posted it to CodeReview.SE
I have since started to try and improve my own code and seem to have hit a wall, as it seems that my code makes the playground hang up and won't...
Does anyone know any other fonts similar to Helvetica Neue (free for commercial use)?
I'm working on a big website project where 'Helvetica Neue' is used heavily. I need a font that looks almost the same, is free for personal and commercial use, and looks good even when used with copytext (e.g....
Recently I asked a question on ProgrammingSE about public vs private methods fo unit testing, which generated a lot of interesting responses.
I only posted a skeleton of the code there, as it was a question about structure and not about the code itself. However, several respondants queried wheth...
This is a much simplified version of my SQL Query architecture. I intend to write future proof code that complies with SOLID principles.
interface QueryExpressionInterface {
public function getArguments(): array;
public function express(): string;
}
interface QueryExpressionFactoryInte...
@Phrancis Of-course Python has multi-line print. You can even simply put a \n halfway in your string and it will figure it out.
template = '''\
%i %s on the %s
%i %s
Take one down, pass it around
%i %s on the %s
'''
for n in range(n, 0, -1):
print template % (n, x, y, n, x, n-1, x, y)
template = '''\
{idx} {x} on the {y}
{idx} {x}
Take one down, pass it around
{prev} {x} on the {y}
'''
for n in range(n, 0, -1):
print(template.format(idx=n, prev=n-1, x=x, y=y))
Probably the most risky post I ever posted on AU, nevertheless need to get it of my chest...
Don't ask me how I got the impression, nor whom it involves, but there seems to be a tendency lately that people "exchange" favours.
No one on AU has any objection to an occasional sympathizing vote, n...
we pimp stuff here (usually not our own stuff) to get more exposure and eyes on it. if those eyes say it's good, then they're entitled to the right to upvote. we don't have negative intentions