You already know exactly what your viewDidLoad method should look like... you just didn't write it how you know it should look. It should look like this:
override func viewDidLoad() {
super.viewDidLoad()
setUpCoreLocationManager()
setUpMap()
}
If you've got a block of code and it...
Is it common practice to solve layout issues in a similar way? Speaking professionally... absolutely not. However, it's hard to show you the correct way without a complete description of the layout you expect to see across all devices. Can you update this question with some information describing exactly how the layout should look? Major bonus points for screenshots. — nhgrif8 secs ago
I've just written a ping application in Go. I'm proud of the logic, but I want some help to refactor it. The program has too much code in main, and pulling functions out of it requires a lot of variables (see cleanUpAndExit).
package main
import (
"fmt"
"golang.org/x/net/icmp"
"gola...
This program generates 6 random numbers between 0 and 45 and the numbers cannot be reapeated. Can this code be improved?
$numbers = [];
$i = 1;
while($i <= 6)
{
$number = mt_rand(0, 45);
if(!in_array($number, $numbers))
{
array_push($numbers, $number);
$i++;
}
...
If you have a question, please be specific about what behavior you are seeing, and what behavior you expect to see. If your code works and you just want some constructive criticism, please look at the posting guidelines for codereview.stackexchange.com. — chepner53 secs ago
I am implementing a simulation of colliding disks (ideal 2D billiard balls) in JavaScript.
I follow an event-driven algorithm that avoids discretizing time; the algorithm goes as follows at each step:
Compute the moment of the next collision (with walls or between two disks)
Translate the sphe...
For a class, I was given an assignment to code a simple TCP connection between a server and a client. Once the TCP handshake is done, the client sends inquiries to the server. It's a 2 second conversation, if that.
I need some feedback on my code. Please keep in mind that I am new to Python. The ...
select *
from
(
select
Id
,Name
,OptionalFieldName
,OptionalFieldValue
from #tmp
) d
pivot
(
max(OptionalFieldValue)
for OptionalFieldName in (Field1, Field2, Field3)
) piv
You could use a CTE instead of that subquery, right?
I pretty often find myself putting together ad-hoc queries for stuff to send a customer or colleague who just needs a data set looking a certain way, this may be good
For example:
1) In statistics, this attribute will always either be 0% or 100%, never in-between.
2) The boundary is either safe or destroyed, because there is never a state where it is only 'slightly leaking'.
3) The rash either itches or does not. It can't itch a little. That woul...
I find it interesting that it has come to a world where it is less effort to paste the question than even google for a solution when this question has been asked in the past few days on this site. Example — KevinOjust now
I'm relatively new to assembly language and I'm having some trouble trying to convert this code:
int sum = 0;
for (int i = 10; i >=0; i--) {
sum+=i;
}
into emu8086. I'm not too sure on how to start, but the way I was think was starting with a counter controlled loop that subtracts for the CX...
I want to create if statements testing for which device the app is running on. For example, if the app is running on an iPhone 5s, change node positioning. Does anyone know how to create these statements? Thanks.
I want to test for the screen size.
EDIT:
I've found the answer. I download the S...
Create a program that will do the following:
1. Ask user to enter number 1 to 100.
2. The system returns error if the entered value is out of range and terminates the program.
3. The system stores the number in array memo that can collects at maximum of 10 numbers.
4. The system repeats process 1...
This is my parentheses balanced program. I didn't attach stack.c and stack.h. I already checked this program to my TA and I got a comment like this.
Your stack is supposed to grow and shrink dynamically to accommodate
any number of characters. DO NOT USE scanf for %s, this is risky
behavi...
i'm currently working on a tic tac toe game with a MiniMax implementation. i've been trying to make it work for the past tow 2 days without luck, the problem is that the minimax function isn't getting down the tree for all the possible moves.
Every piece of advice might come useful as i'm new to ...
I have an Ajax request which in turn on completion make another ajax request.
Is this good? How can it be improved?
$.ajax({
url: '<?php echo BASE_URL.'Dashboard/GetMyTrackList' ?>',
type: 'GET',
success: function (response) {
var list = JSON.parse(re...
while I personally enjoy this kind of questions (and it did provoke some good answers) sadly those are not really a good fit for SO - see you don't really have a problem, you are asking for advice or and code review and I think the codereview site on StackExchange might indeed be a better place for those — Carsten27 secs ago
There is a code that takes all files from input of multiple files, gets base64 for each of them, packs to array and jsonifies it. How to simplify and improve quality of code?
text = $('#input-' + id).val();
var files = document.querySelector('#files' + id + ' > input[type=file]').files;
if (text...
doesn't really solve your question, but if you want a little code for start/stoppable background jobs, see [here](codereview.stackexchange.com/questions/122159/a-two-method-program-for-running-background-jobs) — max pleaner38 secs ago
What is the best way to format a date using JavaScript,covert a date into MySQL stranded date format.
I have used the below JavaScript code/function that i found.
function formatDate(date) {
var d = new Date(date),
month = '' + (d.getMonth() + 1),
day = '' + d.getDate()...
@DanPantry Not exactly any different here. And it's not a monopoly per se. Yes, you have to buy through a dealership, but you're more than welcome to pick and choose which dealr you go to.
We have a couple of questions about this code. We are studying Algorithms and Data Structure at Uni and this is the first time that We are using Python 3. So please be gentle with your answers :)
Ok, let's start. Please check the whole code in the bottom.
First, we run the program calling main(...
We have a question closure rate of ~30%. That's a significant burden on moderators and users who help triage the questions.
While some questions can indeed be very difficult to triage, there are also many many incoming questions that are obviously bad just from a split-second glance. Stack Exc...
@Kaz I guess that's not what I meant to imply. Yes, all (or at least most) cars come from a dealer, but you don't need to go to a dealer to get one. You can get one from another person as well.
@Mast Because there's actually space to breathe in and the cost of living is lower (health insurance not included). Though if Drumpf gets the presidency I'd probably reconsider
and what is the question? debug/clean up my code? that is off topic here. If you have specific problem in code that is relevant here but not that you put whole code here with vague description not explaining what and how it do what it do or should (unless it is something trivial). This may be better for codereview.stackexchange.com Also do not use graphic tag if you are not solving graphic problems. To mark graphic.h usage use BGI and WinBGI tags instead. — Spektre45 secs ago
The title and body heuristics are probably even more predictive if we consider Rev 1 rather than the latest Rev. I should revise the SEDE queries for that.
I have made the algorithm that split text into n-grmas (collocations) and it counts probabilities and other statistics of this collocations. When file is more then 50 megabytes it takes long time to count maybe some one will help to improve it.
import math
import re
import csv
from itertools imp...
My goal was to use the NHibernate Session and to create a UnitOfWork class that I could use thoughout my project.
My goals are:
Calling Commit should commit everything including un-flushed state (was mostly out of the box I believe)
Rollback should roll back everything including whatever was ...
I'm having a program (a client side program only which cannot use npm modules) that are getting HTML as string and need to change to content of it and return HTML string back (with modified content).
An Example:
Input:
This is the HTML content which is coming via input to my method
<!DOCTYPE ...
I made a simple text based console game in C++ for my assignment. I was just wondering if you guys had any initial feedback.
You can find the files here https://github.com/MattJumpertz/Simple-RPG-Game/tree/master/Assignment. The main file is PlayGame.cpp.
Thanks
I've read the Clean Architecture by Uncle Bob and been trying to implement it based on my understanding.
My program is a simple RSS reader where users can read news and subscribe topics for customising their news feeds.
According to the article, I had four basic layers in my architecture:
Ent...
My Scenario:
#TmpDistinctFolderIds table contains one or many FolderId.
fnGetAllParentFolderIds function receives the input as FolderId and return it's all possible parent folder ids (a parent folder can have N number of sub folders).
I'm using the below block to get each folder's all possible...
Part of my standard modules deal with my company's employees and linking them to/from various data sets.
The following are a series of enums/functions to handle peoples' names. Namely:
An Enum for advisers and functions to:
Provide a collection of names associated to each adviser (E.G. their ...
I just started to maintain a Symfony2 application, and stumbled upon this code (I removed all the unneeded lines)
class Conversation
{
/**
* @ORM\ManyToOne(targetEntity="User")
* @ORM\JoinColumn(onDelete="CASCADE")
*/
protected $user_0;
/**
* @ORM\ManyToOne(targe...
I'm building a Tic Tac toe game... but I can't figure it out how to use the function addEventListener and if that is the only problem in there. I've seen some tutorial, and mostly of them use onclick on the markup but I would like tu use addEventListener, so I can call it once for every box that ...
It's a non sense, but well, ok, the next time I'll start my message with "I just written this code and am wondering if it is correct..." and nobody will knows... Sometimes I like the Stack* strictness, but in this case it seems a little inappropriate to me (just my opinion). Have a nice day, i'll search by myself :) — ByScripts1 min ago
Not only is it amazing that a TCP server is apparently a very easy program to write, I am thoroughly floored at the fact that it's getting golfed for fun. I'll just go back to struggling with FizzBuzz like an imbecile. — MonkeyZeus15 hours ago
I have been trying to do a graph search for a problem from Hackerrank (ref: https://www.hackerrank.com/challenges/bfsshortreach). Lastly, I have come up with
#include <cstdio>
#include <list>
using namespace std;
void bfs(list<int> adjacencyList[], int start, int countVertices) {
// initial...
@tac Yeah, there's a whole slew of .close() and .dispose() methods we're not calling here that would cause people on Code Review to have a fit. — TimmyDyesterday
Luckily PPCG answers aren't often posted here.
@CaptainObvious Segfault.
@SimonForsberg @Duga This question doesn't have an accepted answer yet. If the current answers aren't any good, you could consider adding a bounty to it. Duga would earn a slew of badges in the process.
I have a project I am working on, and I would like some, or all of it
reviewed, how can I ask for this review on Code Review in a way that
produces the best possible value?
This is not about a question being on-topic, or off topic. Rather, this is about making on-topic questions great qu...
I've read the Clean Architecture by Uncle Bob and been trying to implement it based on my understanding.
My program is a simple RSS reader where users can read news and subscribe topics for customising their news feeds.
According to the article, I had four basic layers in my architecture:
Ent...
I broke this up a little to browse in bulk. It looks like this code is very much incomplete. If you get rid of the Use Cases & Interface adapter, we could review your entities, but otherwise, you're asking us to review a bunch of stub code (importantly, the 2nd & 3rd sections wouldn't even compile). — nhgrif39 secs ago
I have User a table with clientIPs. Second table stores IPs and third table Country has needed CountryId which I will update in User table (CountryIp is null in user table). This is workaround at the moment, because we don't fill CountryIp yet.
Now my query which works is this(quote messy):
dec...
hey I am trying to get my score up on jquery anyone want to help out? link to my answers. please only upvote if you think the answer is deserving. if I have something to learn, tell me please.