So I'm programming a coin flip in C, however it seems the random part of it isn't working because it just keeps showing the same answer again and again. Here's the code:
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a,b = rand() % 100;
again:
printf("Start program?\n1:Yes\...
We are using Mediatr, so that affects our structure some.
We have a P... project that is our DB model. We are using EF with explicit migrations.
That project has a bunch of stuff that shouldn't be in it, but we are getting it cleaned up.
That project is in a folder with two other projects. E.BusinessLogic.Messages (E.BL.Messages [E isn't the full name]) and E.BL.MessageHandlers
E.BL.Messages has the DTOs and the Mediator messages. E.BL.MessageHandlers has the message handlers.
So, the message handlers ctor-inject the relevant DB tables with a custom IGenericRepository<T> and transforms them into the appropriate DTO.
We have mapper classes that are helpful here too.
Then, we have our UI project G...
And equivalent G.BL.Messages and G.BL.MessageHandlers projects.
G.BL.Messages has the ViewModels and more messages, and G.BL.MessageHandlers has the message handlers.
These message handlers usually use Mediator to get the DTO object from the table, then map the DTO to the VM, which is customized to the view; most of the time, it is just identical to the DTO.
And the DTO is mostly just the same as the table, but has everything loaded into memory.
So, if I want a FooVM, I do _mediator.Send(new FooMessage()).Result.
That calls FooMessageHandlers `Handle method in G.BL.MessageHandlers, which is roughly:
public TResult Handle(TMessage)
{
var dto = _mediator.Send(new FooDTOMessage());
// map dto to vm and return
}
Then FooDTOMessageHandler, we would do the same, except from the DBO to the DTO.
Then, this provides data for a third side that gives our client's employees points that are worth money they buy from us.
Then, they can redeem them for things.
There aren't any tests for the main widget or that. The whole thing is unmaintainable.
And it is our biggest widget, and we are getting more feature requests left and right because it is mainly used by our biggest client.
Most of the people there are impressed with how well-rounded my skills are.
They basically hired me to do back-end work. I got assigned to this widget, and I'm getting tons of front-end work, plus UI design, plus testing above and beyond my own work.
I learned the core EF stuff pretty well. That is, migrations and creating tables and stuff.
Learning SQL. I know the core commands, but queries I can't do in Linq are harder.
Like, I had to write a query to find a user that might be the 16k'th user and rank them based on all the other users.
Their main SQL guy had to help me get the core stuff down, and we ended up creating a bunch of temp tables and using a cursor.
Linq was too slow because we had to return all the users to the server and do the iteration there because TakeWhile doesn't work in Linq-to-Entities, nor do assignments.
I have a board game with four players: Anton, Rony, Young, Gabe. Each of them has four pieces and this function will handle the move of the pawns on the board. I need help to improve my way of implementing this method.
My game board consists of 24 places(from 1-24)(numeral values) and four place...
I have a game that consists of multiple countries and each of them has several choices.
For instance, First Country(France) has multiple choices, Choice 1, Choice 2, Choice 3, .......etc
And the idea of the code is that if France gets number 6(the diceĀ“result) it gets one (choice)soldier of its...
Oddly though, I think it's the same problem in most of academics. I'm following a course in genomic data science and they keep skipping the important parts that make the difference between hasty research and solid research.
I've looked at the programming syllabi for some of the local universities, and at least at that level they look fairly solid, but as you note, you can't cram everything into a single semester.
What's your interest in genomic data science? Sounds interesting!
@devak23 That heavily depends on your code. For starters, I find it odd to have wait groups as global vars the first place. But without your code, it is hard to say what to do. Maybe you can post it on codereview.stackexchange.com and we can find out what to do. — Markus W Mahlberg58 secs ago
Oh, right, I was trying to get my exact version info and got a whole lot of text instead.
Which is kind of stupid in it's own right, since Python will tell you what version it is anyway when starting.
$ python
Python 2.7.12 (default, Nov 19 2016, 06:48:10)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
However python -c "import sys;print (sys.version)" is better, it prints 3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 17:54:52) [MSC v.1900 32 bit (Intel)] for me
This code is predicated on the notion that when sorting (or using a sorted collection of items, such as with std::lower_bound) you're usually comparing a single field in each object being sorted/searched.
So a typical sort might look something like:
// Sort by age
std::sort(people.begin(), peop...
@Edward I don't like to promote it here: it looks clean, but it's bloated under the hood, slow to compile, and has a few quircks that make it too dangerous for production :/
@Morwenn Definitely. One of my peers is working with undergraduate students to build a virtual reality training simulation. He claims it's a serious project, but we all know he just wants to play with toys.
If you asking for code quality and best approach, please post this question in codereview stackechange. If you want to test your request body, please validator component in it, thanks. — Ankit Rana42 secs ago
About the same. I ended up with a job where I spent more time reviewing code than writing it. New job, new stack, and finally a bit of extra time and motivation to come back.
This question is a bad fit for Stack Overflow, but you may have better luck at Code Review. Make sure to read their guidelines first. — vaultah6 secs ago
The point was that 20-30 years ago the standard library was actually worse than hand-written libraries, so they wrote their own standard library, so we need to use that
We do have MSVC 2012 though, and in the future (probably after we release our next major later in the room) we're switching to MSVC 2017, so we have all the new features :D
For a while now I have been working to construct a program to calculate a lot of mathematical constants. Before I explain, here's the code:
Code
#include <boost/math/constants/constants.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/math/special_functions.hpp>
#include <...
In a current project I have implemented a small non-intrusive serialization framework based on type traits. The generic trait template looks like this:
template<typename T>
class Serializable
{
public:
static const bool isSerializableToString = false;
static QString toString(const T &t)...
I have a board game with four players: Anton, Rony, Young, Gabe. Each of them has four pieces and this function will detect if amove is possible for a pawn.
My game board consists of 24 places (from 1-24)(numeral values) and four places for each team as home so all together are 40 places. AntonĀ“...
Wrote my first HTML5/CSS page. I would like to get feedback on it. I know there are hundreds of different ways to do something.
I am looking to get feedback especially semantics. Any feedback is appreciated.
jsfiddle.net/g97o9ej1/5
I'd like to share a methodology I've been using when faced with a classification
problem. This particular example is designed to classify time data as Date/Time/DateTime. Though I believe it could easily be adapted to many other problems
The basic idea is:
Create a list of regular expression...
there is a calculator on the WSOP website @ http://www.wsop.com/2017/poy/. from viewing the source, the code for the calculator shows:
<script>
function rounder(v, p) { var m = Math.pow(10, p || 0); return (Math.round(v * m) / m).toString(); }
function POYclr() { $('#iBuyin').val(""); $(...
Got this question in a technical interview and here is my solution:
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
if (!in.hasNextInt()) {
System.out.println("not a number!");
}
int number = in.nextInt();
System....
I wrote some function which should take an array of items:Array<Object> and array of excludes:Array<Object> with keys which values can't be present in items. and should return an array of filtered items.
Is there some way to improve it? Is complexity of that function equal O(n + k)?
const i...
I have a board game with four players: Anton, Rony, Young, Gabe. Each of them has four pieces and this function will handle the move of the pawns on the board. I need help to improve my way of implementing this method.
My game board consists of 24 places(from 1-24)(numeral values) and four place...
Here is a problem statement given (I am not pasting here as it is a long problem) which I am trying to solve using Arraylist which I have solved like this. But it is not working. Can anyone point my mistakes?
import java.io.*;
import java.util.*;
public class Arraylist {
public static void ...
here is another basic interview question that I had:
Armstrong Numbers
public class ArmstrongCheck {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
if (!in.hasNextInt()) {
System.out.println("error");
}
int number = in.nextInt();
a...
First line contains 't' denoting the number of test cases.
Next t lines contain 4 integers denoting n, a, b and c separated by spaces.
sample input
1
15 2 3 5
output
11
import java.io.IOException;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.HashSe...
This is a question about the quality of the approach. I am attempting to get better at writing nicer code, however I can't tell if certain things are good to do / bad to do sometimes.
Here is the project I am currently working on. I can't post the whole thing as it is kinda big, however I'll pos...
I started learning kotlin recently,with some background in java.
So I wrote a merge sort algorithm in kotlin.
I am looking for best practices in kotlin and looking for this code review.
I also wanted to know about its efficiency and ways to increase it.
Thanks
fun merge(list: List<Int>,lo: In...
This is a simple game of Hangman, and my first program. Would love some feedback on my code. Be ruthless.
Any suggestions on how I can improve this code in terms of making it more efficient and cleaner looking.
(It's asking me for more details, however im not sure what else to post)(It's askin...
I have tried to design the parking lot problem. Here is the problem statement.
Design a parking lot system where
Admin can look up all the available spots for parking,
He should be able to choose both randomly as well as orderly
Using the register number and the type of the vehicle he should be ...
I've written some code in vba to scrape names and phone numbers from a webpage that has spread across some pages I don't wish to know of. The main interesting thing with this scraper is that It only needs to know the first page number then it traverse across all the pages and fetch the informatio...
I need help to implement classes into my fully functioning fotboll point system, where the code mainly does use the file Premier_League.txt, as it asks about hometeam/awayteam and what the score was, it enters into the file that specific teams (played matches, matches won, losses, ties, let in go...
a few month ago i wrote several basic sort algorithm for educational purposes as generic as possible in c++. In a few days time i want to present some of that stuff in my class but before that i thought i show my implementation to you and listen to your comments of what do you find confusing or v...
For a while now we've had "Clippy", which among other things has support for detecting when there's a lot of code posted but not a lot of description.
The feature is nice and comes with good intentions but a lot of users have had problems with this. They've encountered this restriction so they a...
For a while now we've had "Clippy", which among other things has support for detecting when there's a lot of code posted but not a lot of description.
The feature is nice and comes with good intentions but a lot of users have had problems with this. They've encountered this restriction so they a...
It was originally posted on Stackoverflow, but someone said it's better if you post here.
I'm trying to write a function that will get content from input element and try to format numbers entered in input box in MM/YY. Following is a solution that I've, I want to reduce numbers of lines it has. ...
Today I accomplished creating an activity that retrieves all the restaraunts from self created rest endpoints. The searched text is passed on from an EditText that is from the previous activity. Is there anything I did wrong? Or any suggestions?
@Override
protected void onCreate(Bundle savedIn...
I'd suggest looking at codereview.stackexchange.com to see if maybe that's a valid venue for your question. But if you do post there, please include your code in your question - not a link. — David Makogon28 secs ago
Given a list of Movie show timings with start and end timings, I need to find the best schedule of Movie shows - with the maximum number of shows.
For Eg:
Movie 1: Starts on 7th Jul at 08:00, Ends at 10:00
Movie 2: Starts on 7th Jul at 09:00, Ends at 11:00
Movie 3: Starts on 7th Jul at 12:30,...