If you want someone to review your code, codereview.stackexchange.com is down the hall, last door on your left. stackoverflow.com is for asking specific question on specific topics. At the bare minimum you need to attempt to implement your own attempt at initializing RevDigit, determine if the results are right, and if they're not and you can't figure out why they're not, then that would be a valid question. — Sam Varshavchikjust now
I have a simple angular application, it lists some objects requests from a backend, and then allows the users to click once to edit the item, and then click again to update the object in the backend.
Here's a codepen demostration:
http://codepen.io/kiwideejay/pen/NAwymJ?editors=1111
nb. I've...
Good, been away for a couple of days it's good to be back home! How are you?
The consensus on burninating conditions seems uncontested. Do we need a mod to initiate the burnination process? I don't quite recall. Here is the meta post.
TASK:
This function searches given null terminated string pStr by given subset of
regular expression pMatch.
Return value is matched string appeared in pStr.
If nothing has matched, return value is empty string.
The subset of regular expression grammar is defined as follows.
- A string is set ...
Sometimes it might be ok to use ifs and switches to create proper object (it's better than checking the type while using it for sure). I'd post the code (factory & created data types examples) in codereview. Maybe it can be simplified or resolved differently. — shudder24 secs ago
Was fiddling with java-8; trying to write a program for getting all Armstrong Numbers between 1 and 10_000_000.
Following is my working solution:
public class ArmstrongNumbers {
public static void main(String[] args) {
IntStream.range(1, 10_000_000)
.filter((n) ->...
> We use the bits of the binary expansion of n + 1, starting at the leftmost bit, to determine which terms in the U sequence need to be computed. For example, if n + 1 = 44 (= 101100 in binary), we compute U1, U2, U4, U5, U10, U11, U22, and U44.
^ I really do not understand how they came up with that computation. I see that they are able to make 44. However how they used the binary expansion to see which term should be doubled is still unclear
> We use the bits of the binary expansion of n + 1, starting at the leftmost bit, to determine which terms in the U sequence need to be computed. For example, if n + 1 = 44 (= 101100 in binary), we compute U1, U2, U4, U5, U10, U11, U22, and U44.
@Kaiido not exactly I tried the suggested solution but it doesn't work in my case, possibly due to very large number of images per row. Theoretically it should work but it doesn't, here you can see the example. — CodeYogijust now
Probably more interesting than most of the questions on there, though
Trying to match audio cord adapters is the pits. My 1/8" earbuds are broken, so I was trying to find a way to hook my 1/4" earphones to work with the PS4
Try as I might, I was not able to find any combination of adapters that would work
I have been trying to implement the Baillie-PSW primality test for a few days, and have ran into some problems. Sepcifically when trying to use the Lucas probable prime test. My question is not about Baile, but on how to generate the correct Lucas sequence modulo some number
For the first two ps...
However I have not been able to generate \$U_{n+1}\$ correctly. There is a faster way to do it binary. However both my standard implementation and the one running in log n time, break :p
@Phrancis Here is an explanation. Think I will swim in the pool a bit, cool my head off. After that I can probably find my mistake, or have the embarrassing mistake pointed out by SO.
> Easy as Fibonacci they said, it will be fun they said.
How this code is working ?
public class Mix4 {
int counter = 0;
public static void main(String[] args) {
int count =0;
Mix4 [] m4a = new Mix4 [20];
int x =0;
while (x < 9){
m4a[x] = new Mix4();
m4a[x].counter = m4a[x].counter + 1;
count = count +1;
...
everyone. This will be my last question for awhile. Thanks for your interest in my take on splicing enumerables together, object instantiation in constructors via illumination, and of course, my 100% accurate but considerably slow prime number computer.
For this last post, I ask that you consi...
Consider fixing the code anyway, then posting it on CodeReview instead. That site's entire purpose is to make working code better. — skrrgwasme55 secs ago
Triggered by an interview question (I didn't answer during the interview) I wrote a Java program to reverse a linked list. I went with a loop-based approach instead of recursion. I would like to know:
Is the reverse() method is efficient as it is or can be improved?
Is the documentation clear o...
I'm writing a package where I need to have PHP objects that represent MySQL data types.
For example, I have classes for IntType, VarCharType, BlobType, etc. And I need to be able to construct these types from the results of the query, SHOW FULL COLUMNS FROM tbl;
So this is my current factory m...
I'm developing a Java 8 + JSF application, where all the view classes extend from an abstract class called Navegable.
All the methods called from the view and intended to modify the DB in any way, have to add an information message if everything goes OK or an error message otherwise. This invol...
Recently I started programming with python.
Today I was trying to make a stone, paper, scissor game. After so scratching my head long time, Finally I got a working code.
from random import choice
def play_again():
print "Do you want to play again:- Choose 'yay' or 'nay'"
user_ag...
In my ongoing effort in learning advanced javascript I tried to develop the traditionnal rock paper scissors game by using the famous revealing module pattern. I'm not comfortable yet with what has to be Private/Public. In my solution, I decided to have a single public function, Game, which uses ...
I have to read some data from xml file and then need to store the converted json in the database. The class DtoProcedureXml mapped with xml attributes.
public class ProcedureManager
{
#region Declaration
private DtoProcedureXml procedure;
private ProcedureDataManager procedureDataMan...
I have a Xml which is stored in the String. I need to encrypt it using a session key (AES and 256bit)
I am using following code to generate the key
public byte[] generateSessionKey() throws NoSuchAlgorithmException, NoSuchProviderException
{
KeyGenerator kgen = KeyGenerator....
For future reference, questions like this are better posted on codereview.stackexchange.com -- as you already have a solution to the problem, but are only seeking opinions on code quality. — Tom Lord23 secs ago
Work have reaffirmed that they want to build a bespoke back-office system in-house. Meaning me ^^ (and probably another guy we know who's got a lot of experience building web-based systems for companies).
@OlzhasZhumabek He certainly could, but we'd want him more for his general experience with these kind of projects and for experience building websites/portals/I don't really know what I'm talking about.
@OlzhasZhumabek Well, we may be about to buy another company who work out of an office 50 miles away, so we're going to need some kind of internet connection to whatever we end up building.
@Mast Maybe. But file this under "I have no idea what I'm doing or even where to begin, so having someone more experienced to work with/ learn from is worth hiring for a couple of months"
Yup. Just saying you shouldn't re-invent the wheel.
There's prefab solutions for this readily available if you don't like messing around yourself. Get the expert to set it up, since it's a company and all.
@DejanRainsavijevic your intentions are good, but this is not the CodeReview, and you should say your answer did not solve the issue. — Mario Alexandro Santini54 secs ago
I am new to C++. I made the class (MFC lib) to write a log files.Now I want to implement this code into thread safe way!
Log.h
#pragma once
class CLog
{
public:
CLog();
~CLog();
int CLog::Log(CString log);
void CLog::TWriteAllToLog();
};
Log.cpp
#include "stdafx.h"
#include "...
Previous Question: Armstrong numbers in a given range using Java 8
Updated program for getting all Armstrong Numbers between 1 and 10_000_000 as per the suggestions in this answer.
public class ArmstrongNumbers {
public static void main(String[] args) {
IntStream.range(1, 10_000_00...
@CaptainObvious Wrote an answer, but I see it has gathered close votes. I didn't run it, but is it indeed broken? Empty constructors and destructors are not enough indication.
Last time I had a problem with that @Mat'sMug came in, swooped every off-topic statement under the rug and declared it fit for the site.
Should I do the same here?
You're asking for feature requests in your comments. That's not what we do. We can review the given code, but expect the code as-is to be working as intended. Please take a look at the help center. — Mast37 secs ago
I thought perhaps naming all variables containing pointers with a "Ptr" suffix can improve readability:
int counter = 10;
int *counterPtr = &counter;
int *counterPtr = new int(10);
Texture *texture0Ptr = new Texture("image.png");
Texture &texture0 = *(new Texture("image.png"));
float *numbers ...
> The anti-gay Westboro Baptist Church in the US is the location of a gym in the game, and players planted a pink "Clefairy" Pokemon called Love is Love there. The church has responded with a series of social media posts calling the Pokemon a sodomite.
In hindsight I'm not going to touch the OP's comments since that would basically vandalize the code. But I cut some of the remarks around the code blocks to make it look better.
(strict null checking = when a type could be null or undefined but you access it without checking before hand, basically possible null reference exceptions)
@Mast I do this all the time. Gradually my life is deteriorating into a mass of unpalletable portions. Which is probably why I'm such a grump. I assume at a certain age the process will become "remove broken code gradually" :)
@Vogel612 probably. Hence the older you get the grumpier you get, until eventually you're so old that you start going the other way, the older you get the more you forget.
Code Review is the stackexchange site for improving working code. You can try posting it there, but calculating md5sums is a pretty known algorithm, it is unlikely that you can speed that part up. — Gerald Schneider1 min ago
I really think JS is going in the right direction, esp with the adoption of structural typing..
JS is really not that bad any more, the main issue with JS isn't to do with JS but to do with adoption
If everyone used ES6 JS would be much, much better
but that's what happens when you have users who refuse to upgrade because their laptop bought in 2004 still works and does the job for them, they just have to do a rain dance to get it working
@Gareth Worth noting that a lot of the "other" browsers is also versions of chrome/IE. I think market share of all chrome browsers is about 45% of desktop these days.
I'm trying to compare several files using md5 hash with powershell 2.0. The code works, the problem is that it's to slow. It takes longer in step 3. It's about 500 files to compare. Can you see a way to get it faster, like, don't do the step 3 every time?
write-host "1"
$COMP_ORI=$LOCAL_HOME...
I am having a serial port communication application using 3 serial ports DMX (m_port,m_port1,m_port2) which will run 24 *7 , so i just need to ensure memory usage doesn't go above limit with using(), Idisposable and minimize use of global variables.
Start method to start sending hex data continu...
@Vogel612 i need to. little hard though when your working 40 hours a week, volunteering 10 hours a week, and working on a senior thesis to graduate college :P
I am attempting to put my new OOP skills to the test and am eventually going to build a simple OOP login/registration system.
However as I am making use of OOP I have decided to make my own simple MVC.
Is this a correct way to have the directory structure? Or can I make improvements?
root-dire...
/**
* executeEmail
* Public-facing method to send an email to a database of users if they are a valid recipient.
*
* @param array $emailSettings Host, port, username, and password variables for the mail server
* @param string $emailTemplate Pa...
My personal Venn diagram is roughly: Geek = "obsession" Film geek, Sports Geek, Maths Geek etc. Nerd = Above, but with strong academic connotations. Often with connotations of social ineptitude attached as well.