Looking for a Pythonian solution, this better be tagged python - I'd drop pseudocode. You already "rebased" your arrays from 1 to 0: consider representing ranges/slices including [from, to) excluded. The "association" of anno and align via "label" looks slight. - You need to specify allowed overlap or gaps between genes, if any. Keeping genes in annos ordered should help - specify! 8&9 may be too detailed. Educated guess: depending on representation, 13 is about half of your complexity - expand. (Once you got code and still see issues, consider presenting this at CODE REVIEW.) — greybeard14 secs ago
I tried implement the following algorithm to find out the value of (a*a*a...b times) % m when m is a very large number.
( (a % m) * ( b % m ) ) % m=( a * b ) % m.
The compiler shows stack overflow error on the line calc=calculate(a,b,m).I can't figure out why.Please help.
import java.util.Scan...
I have php function that compares two different database table. Any suggestion on improving it.
public function comparePartyTableCandidates()
{
$electionCandidates = ElectionCandidate::all();
foreach($electionCandidates as $electionCandidate )
{
$candidateName...
I have a class Foo that creates instances of other classes A, B, and C in its constructor. A, B, and C share the same constructor parameter and are used in other parts of the codebase, not just in Foo. A, B, and C access an outside resource configured by the passed parameter. In unit tests, A, B,...
Having been informed that sp_MSforeachdb is undocumented and unsupported, I have been working on creating a replacement stored procedure based off the work done here.
Is it ok as it is? I'm concerned about
Using cursors
That the error raising may not iterate through stored procedures or when e...
I have a method in which I am accepting a String clientId and that has below requirements:
clientId can be a positive number greater than zero. But if it is negative number or zero, then throw IllegalArgumentException with a message.
clientId cannot be null or empty string. But if it is, then t...
> We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.
Simon's Guide for posting a good question
There are a lot of questions that appear on Code Review, and all questions are fighting for reviewer attention. This is a non-exhaustive list of items that I am looking for in a Code Review question when determining whether or not I should review it and ...
@Digi, I would start with the help section, so that you have a good idea what we are all about here. every time you visit a new site on the StackExchange it will have a similar help section to get you acquainted with the site.
Well there are a few issues I wanted to get fixed, and i currently posted it on github. I think its a pretty common program to from what i have seen. It's an adaption from code academy battleship project.
Two Words. Version. Control.
Even VBA has an addin for .git integration these days. Version control is awesome for the following reasons:
Complete, comprehensive record of changes to your codebase, complete with explanations and descriptions of each revision (so long as you provide them).
Ab...
I'm creating my first webpage (GitHub link) which is a copy of Google's homepage.
So far, so good. Things are looking pretty decent...and then I resized my browser window and I have things flying all over the page! The things that are flying around, I believe, are due to the CSS I used. Specifi...
If you have a given list of lists what's the best way to sort them proportionally? Is there a better way to do this?
The idea is that in a case of web scraping, you would want to avoid hitting google all the time and want to distribute calls so that they are as even as possible.
Is this a thing...
I guess I'm just new here, and I don't know the rules. I asked a question and provided the code that I am working with and asked how to improve it. I thought that was what I was supposed to do. — Andrew Martin25 secs ago
I am writing an app that has a chat screen. The user can input a message and also select an image which is then displayed on the screen.
I am storing the image on cloudinary with my own unique public_id which works fine. I am then setting the value of a text field to the value of the public_id s...
Crap. Done all this work to get this data set reconciled so I can fix a SQL problem, now I try to insert the rows I need to insert and now a unique index is getting in my way... probably there for a reason though
Ok, it was trivial: at some place I had a tweak so that std::greater<std::string> could be passed to a function. I removed that one so that only std::greater<> is handled. It's terser and has no default, so let's force users to use it.
The library doesn't compile when the compiler doesn't implement std::greater<> anyway.
This may be a good question for Code Review, so long as: (A)the code works, and (B)it's not hypothetical or incomplete in any way. Please read the on-topic guide before posting, if you choose to go to Code Review. If you have any questions or concerns, join us at our CR Help Desk. — Phrancis59 secs ago
I think this is a great example of someone tackling a syntax they aren't too familiar with and presenting ideas that are common across syntaxes. — Raystafarian1 hour ago
> I get the warning in the console that a long-running operation is being executed on the main thread. When I check instruments, the lag is 2999MS on the main thread. I would greatly appreciate any help!
I have pinpointed the problem down to this line of code: PFUser * user = object[@"User"]; [user fetchIfNeeded]; — Diplomatic Medic21 mins ago
Well I have no control over the mail server itself. Hopefully they pulled the culprit code out of production, but I can't really tell either because it's still pulling in emails from overnight and very early this morning
This question:
'Basic' compiler design for a toy C-like programming language called "Lupe"
Is more of a design review rather than a code review.
I have plenty of valid feedback that could be applied to the question but its currently marked as off topic.
So the question becomes is it really off...
the problem in 2 sentences is that the question contains "code" (or rather a grammar), but is asking about the design to build a compiler from that grammar
As a c++ question, I'd deem it off-topic, too.
But if we consider a grammar definition as reviewable source code, the grammar itself would be reviewable, given that it produces the desired results.
The problem is that it's not asking for a review of the grammar, but OP's question is really:
...
@Vogel612 how about @Duga detects a question linked on a meta question tagged with specific-question, and posts something like "FYI, [this question](link) seems to be the subject of a meta discussion [here](meta-link)." right here in the 2nd?
@Vogel612 I do disagree and think it would be nice if @Duga could do it, but considering all the other stuff I have to do, it will take a while before it would be implemented anyway.
@Duga You (@Phrancis) come across as a bot, and in my honest opinion, these comments are a bit annoying. There isn't anything in that question that suggests that the code is broken, hypothetical, or incomplete.
@Mat'sMug Indeed there isn't, I made my guide for posting a good CR question a generic comment, but I always find myself writing or wanting to write "In particular, for this question it would help if you improved X, Y and Z".
Have one user reply to the comments on Stack Overflow, not five users.
This answer is not intended to address whether or not you should keep the chatroom or not. What is important is that we shouldn't "gang up" on SO users. Even though we don't intend to do that, here is what I often see happen:...
@jamesP111 I recommend that you delete this question on Stack Overflow and repost it on Code Review with a title like "VBA script to underline certain rows in Excel". — 200_success49 secs ago
For development I'm using timer classes that are based on Win32 functions like QueryPerformanceCounter() or the time stamp counter of Intel-compatible CPUs. However, for self-contained test programs that can be posted here (or put in a place like PasteBin and linked) I'm looking for a replacement...
I recently started with object oriented programming in PHP and I am wondering if my database class is on the right track.
Am I doing something wrong? If so, how can I improve it?
Here is the class:
<?php
class PDOC extends PDO{
private $myselhost;
private $dbname;
...
This is one of the strangest where clauses I've written... it works though :)
where
_Type = 'Sold-To'
and not exists (
select 1 from SUPPLY_VENDORS_SERVICELINES_BRANCHES as innerSvslb
where innerSvslb.svslb_branchcode = ids.branch_code
and innerSvslb.svslb_slid = case acc._Value
when 'Home Health Agency' then 1
when 'Hospice' then 2
else 3 end
)
I recently learned about Linked Lists. Here is my first try to write one in C. I know it's a lot of code, but I hope someone takes a look :)
SinglyLinkedList.h
#ifndef SINGLYLINKEDLIST_
#define SINGLYLINKEDLIST_
#include <stdlib.h>
#include <stdio.h>
typedef struct SLNode SLNode;
typedef stru...
Is there a better way to check whether a number is a power of 10? This is what I've implemented:
public class PowersOfTen {
public static boolean isPowerOfTen(long input) {
if (input % 10 != 0 || input == 0) {
return false;
}
if (input == 10) {
...
You could also just list them out as there aren't that many in range of the long datatype.
public static boolean isPowerOfTen(long input) {
return
input == 1L
|| input == 10L
|| input == 100L
|| input == 1000L
|| input == 10000L
|| input == 100000L
|| input == 1000000L
|| in...
@Duga I don't know why some people do this... post a question and a selfie-answer right away... If you already know the answer, just go fix your code and go on with your life (unless it's a very obscure or interesting issue that you feel others will benefit from and hasn't been asked before)
I created a Tic-Tac-Toe in python, that have to game options - Player VS player and player VS computer.
The player VS player option works perfectly, but something in my player VS computer option doesn't work well and I don't understand why.
The problem is in the function enter_pc_game_loop():
1....
declare @cutoff datetime
set @cutoff = '2016-01-20 7:00:00AM'
select * from dwf.CutJobTracking where _DateInserted > @cutoff
select * from dwf.CutJobUnits where _DateInserted > @cutoff
select * from dwf.CutJobs where _DateInserted > @cutoff
select * from dwf.GarmentComponentTracking where _DateInserted > @cutoff
select * from dwf.GarmentComponents where _DateInserted > @cutoff
select * from dwf.InvoiceDetails where _DateInserted > @cutoff
select * from dwf.Garments where _DateInserted > @cutoff