either you are a hellishly good vb programmer (like mat, ducky and the elite) or you aren't a programmer at all (like the accountant in our company that made the time-tracking excelsheet)
Ok, I'm not saying... "Let me have you chat code." I'm asking if its an open source project. I love the design of chat and well the entire interface in general. I'd love to incorporate a like client into my own project, but I'd have to do some adapt work and add some features that this site reall...
I want to find the length of the longest distinct characters subsequence. If the logic is correct is there any way to make it more optimized? What would be the limit on the size of the string up till which it will work?
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java...
they are ordering a C# book for me and an MVC book for me as well here at work.
2
my first game is going to be done in masterpages and then I will progress from there, I hope to have several games from different genres of Text based Browser games, and also have different types of Browser games as well... so ...... yeah
I'm trying to increment duplicate values from csv while inserting in database.
The problem is that the incrementation stops at 1 and all duplicated values are like: val, val_1, val_1, val_1.
The values should be : val, val_1, val_2, val_3.
How to fix this ?
if ( $request->get( $_POST["act...
I have used that extensively, and it is sooo intuitive to just call server methods by name from JS and JS methods, by name from server code. Couple it with an MVVM framework like KnockoutJS that automatically binds to the DOM and reads the JSON built by SignalR, and you will feel like you have been injected with awesome.
I have below piece of method, I feel like there is a code smell in it. Can someone help me to redactor/optimize it?
protected TimeZone resolveTimeZone() {
IUserPreferences preferences = userProfileService.getCurrentUserPreferences();
if (preferences != null) {
String timeZone = p...
I've made a simple game for testing math facts (think practice for elementary school-age kids). It displays a random addition, subtraction, multiplication, or division problem, and feedback on if the right answer was entered.
For now it works interacts with the user via prompt(), but I plan to a...
I've added the code for an abstract thread class and 2 sub-classes. The structure and job of the threads (sub-classes) is identical except one difference: ONE of the sub-classes, RefreshData does not need the client parameter. I've overloaded the constructor in the sub-class but I'm not sure if t...
I want to find the length of the longest distinct characters subsequence. If the logic is correct is there any way to make it more optimized? What would be the limit on the size of the string up till which it will work?
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java...
One UI control that has always been mysteriously missing from Xcode's interface builder is some sort of checkbox. UISwitch is available, but this isn't always quite the feel you might want. It's particularly mysterious that any sort of check box is missing given that there are check boxes used ...
I'm trying to run the method below against a very large corpus and I need to optimize/reduce the run time for this method as it already takes up about 6 seconds to execute.
Requirements:
Check the word only consist of alphabets, hyphen and apostrophe
First character of word must be alphabet
La...
The Ten Days' Campaign (Dutch: Tiendaagse Veldtocht, French: Campagne des Dix-Jours) was a failed attempt to suppress the Belgian revolution by the Dutch king William I between 2 and 12 August 1831. The Dutch army invaded Belgium on 2 August, and over the course of the next few days defeated Belgian forces several times in battle and advanced deep into Belgian territory. However, on 8 August, the Belgian government appealed to France for support. Faced with an advancing French army, under Étienne Gérard, the Dutch withdrew.
== Background ==
When the Belgian Revolution began in August 1830, the...
Air France Flight 8969 was an Air France flight that was hijacked on 24 December 1994 by the Armed Islamic Group (GIA) at Houari Boumedienne Airport, Algiers, Algeria, where they killed three passengers, with the intention to blow up the plane over the Eiffel Tower in Paris. When the aircraft reached Marseille, the GIGN, an intervention group of the French National Gendarmerie, stormed the plane and killed all four hijackers.
== The flight ==
Algeria was in a state of civil war at the time of the hijacking. Aircraft flying to Algiers faced the possibility of missile attacks. As a result, Air France...
For some reason the param field "name" is not getting initialized during Spring Junit mock testing. Due to this test is getting failed.
Following is the code and error:
I am executing following Junit test/class:
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "class...
Given the code below, I'm curious to know if you'd have better naming suggestions for types:
PresentersWithLongNameFactory
PresenterWithLongNameFactory
It bothers me a bit that their names only differ by a single character ('s'), and that this character is located in the middle of the name.
...
Perhaps it would help if we knew a little more about exactly what the class is doing. Please include your real code. As it stands this looks like stub or hypothetical code, which is off-topic on this site. Naming depends a LOT on context; you've come to the best place to ask, but please show us your real code! — Mat's Mug7 secs ago
asks for naming advice, and yet gives us a PresentersWithLongNameFactory to review...
I know my question sounds strange but I have a situation in which I have Parent Data which can have 'N' Childs and each child can further have N-Childs and so on.
So its Like.
Parent
a. Child
i. Child
ii. Child
b. Child
i.Child
I hope I've made myself Clear. So here is a s...
I have below javascript funtion which checks if the format has 'yyyy' and replaces 'yy' with 'y'
below is my function
function validateDateFormat(format) {
if(format.indexOf("yyyy") != -1)
return format.replace(/yy/g, 'y');
else return format;
}
I feel like it can be simplifie...
I'm hesitating to post real code, since it's proprietary code that belongs to one of my clients. I could put some make-up on my code snippet, but it wouldn't be my real code...
I was thinking that someone might have a solution to the more general problem of naming factories without needing real code. I trimmed most of the code out in order to bring sample code to its most general form.
Also, I'm curious on why my question gets rejected when a question with Vegetables is accepted: codereview.stackexchange.com/questions/8467/…. We can all agree that this is probably not real code either...
The fine distinction is that the Vegetables tries to solve a problem (there is a design pattern question), whereas WithLongName is just asking for opinions about naming.
@Phrancis My team has no answer to my particular question, unfortunately :( And it's not the first team some members of my team encounter this naming problem. That's why I thought this might have been a general naming problem that could have been illustrated by a simple, fictive example.
You could ask again with realistic details, but fictitious names, like how news reporters sometimes make up names but keep the details of the story intact.
@200_success So you're saying that my naming problem is not a real problem? I'm not trying to be rude or anything, I'm just trying to grasp what a real problem is, as seen by the Code Review community. I'm certainly not the first dev in my close circle who has come across this problem, so I thought that my problem might have been valid.
So I figured this morning that I wanted to learn how to use SASS, so I decided to rewrite an existing project's CSS using SASS. The project itself isn't complete so this is just a rough draft of the final code.
What I'm looking for here is to know what I'm doing well and what I'm doing wrong. I...
I currently am making a small application where a user will enter their ID which needs to be in a certain format. When entered in the wrong format, different output errors are produced. I currently output errors like this:
public void errorLogger(string error)
{
errors += ...
@200_success Indeed we introduced collaborators for testings. Because in the real use case the factory does a little more than that (It actually sorts the widgets in the required order); it would just make it easier to mock things out.
int* findLargest(int *a, int *b, int *c)
{
int val = std::max(*a, std::max(*b, *c));
return &val;
}
int main()
{
int a = 5;
int b = 7;
int c = 91;
int *largest = findLargest(&a, &b, &c);
std::cout << *largest << std::endl;
}
This should result in undefined behavior, correct?
int* findLargest(int *a, int *b, int *c)
{
int *val = new int(std::max(*a, std::max(*b, *c)));
return val;
}
int main()
{
int a = 5;
int b = 7;
int c = 91;
int *largest = findLargest(&a, &b, &c);
std::cout << *largest << std::endl;
}
This wont be released publicly, but that doesn't mean I want to have bad coding habits. I am not too far into this before realizing I could make it better.. One of my main concerns is finding alternative to the if statement halfway down. The toast message is temporary I was having trouble with so...
std::max can take a list of values: std::max({1, 5, 8, 7, 9, 2}) == 9
But it also has an optional parameter: a comparison function object.
Basically, you tell to std::max "you compare two values this way, now give me the greater value of this list taking into account the comparison function I gave you".
@Simon-Pierre @Pacane I'm still not entirely happy with the question, but I do appreciate your effort to try to make it good, and it does look a bit better than before. I've decided to reopen it anyway — we'll see what code reviewers have to say.
I have a 2D rendering system that's working (for the most part). I want start making use of shaders to implement transformation, rotation, scale, etc., and I want to do it using the latest version of OpenGL that I have access to (4.1). The problem is, I don't have access to a compatibility profil...
But if your teachers know as much of C++ as mine did, they simply won't understand will call it a "hacky" solution while I would say it is an "elegant solution" :/
As elegant a solution can be to solve a problem with dumb restrictions.
Sure. Revealing it is unlikely to be a source of competitive advantage to any other company. (But only you can decide whether posting it is advisable under your company's policies.) I'm suggesting that it would make a better question if you included it, since factory-for-a-factory seems like a code smell.
Then I realized I should just migrate it to Stack Overflow.... ;-)
But seriously, my head is so confounded... I am engrossed at work, then move in to Code Review 'head space', and get distracted on tot GitHub issues... too many things to manage.
I don't know whether this sort of thing exists (yet) outside of Xcode/ObjC/Swift... but if it doesn't already, surely it will soon.
But with Xcode 6, we can set up classes as "IBDesignable" and give them "IBInspectable" properties. The result is, when we make a element on the interface builder ...
You give this function a pointer and how many bytes you want to extract as a decimal and it returns it.
long long
byte_extract
(void * source, size_t bytes)
{
long long num = 0, m = 1;
size_t i;
for(i = 0; i != bytes; i++)
{
num += (((unsigned char*)source)[i]*m);
m
I don't know whether this sort of thing exists (yet) outside of Xcode/ObjC/Swift... but if it doesn't already, surely it will soon.
But with Xcode 6, we can set up classes as "IBDesignable" and give them "IBInspectable" properties. The result is, when we make a element on the interface builder ...
> "[...] the pair cherrypick tropes from a number of bleak traditions: reverb-drenched industrial beats; doom-metal sludge; shoegaze drones conjured from effects pedals; post-punk bass chuggery; a plaintive piano+static post-rock crescendo." Tiny Mix Tapes also wrote that the band hold this genre palette together "by matching its compositional ambitions with idiosyncratic recording and production techniques."
@janos I wasn't able to complete it, but that would've taken more time anyway. A majority of the class was having trouble with this one (it's individual work). I think I still got most of it done, and it does compile.
@janos It's okay, but kinda annoying at times. I've never had to deal with different ends (front and back) and having them interact. That's the biggest part I haven't finished, though.
In playing around with this, I noticed three things I didn't particularly like:
This picture represents the first problem. Setting the background color fills in the entire rectangle, but should probably only fill in the circle. We can fix this as such:
Add a private variable to hold the v...
The following information relates to sites that are in the process of, or recently have, gradudated.
Announcement is when the site was notified that graduation was going to happen.
DesignMeta ... many times, sites are contacted to say *"Hey, we have started looking at the colors for the site, a...
Basically, I have a set of views and view models in my project. There is a one-to-one mapping of views and view models, so each view requires a particular view model. I'd like to instantiate a series of views given a collection of view models.
Here's what I've come up with:
public class Overlay...