So here's one thing I would really like to be able to do, if any C# people are around...
I'd like to make a function or something like that where it can be called from within Management Studio in SQL code, and does actual RegEx. Is that possible?
Take a look this TSQL example
USE [XXX] GO SET ANSI_NULLS OFF GO SET QUOTED_IDENTIFIER OFF GO CREATE PROCEDURE [dbo].[Testing_XXX]
@broadcastId [int],
@XXXTemplateHtml [nvarchar](max),
@XXXTemplateText [nvarchar](max),
@XXXTemplateSubject [nvarchar](max),
@XXXTemplateEmailHeaders [nvarchar](max...
@Phrancis That's a good way to put it. The value is represented by the value of the variable. It's the same reason why you write var name = 'josh' and not var josh = 'josh'
I thought of writing a utility class where I can implement patterns that are useful for day-to-day parsing of strings, without having to to import java.util.regex everywhere. So I wrote this simple class as a model.
Right now I only added two patterns, with the intention of adding more as the n...
And for things like var count when looping, you could say that they are properties of the state machine you're creating. But that's getting too pedantic.
Time for bed now. Long day with a dinner date at the local turk makes a man sleepy
I think I solved the following problem. However, I was wondering if there was a faster or more efficient way to solve this.
I believe the the runtime is O(n) and space is O(1) (O(256) assuming ASCII)
# Longest substring with at most 2 distinct characters
#
# Given a string S, find the length o...
Recently needed to swap keys with a colleague on the other side of the country.
This script encrypts a file using the other persons public key that is stored on github. It outputs a script that will re-generate the original message (if you have the private key).
#!/bin/bash
#
# Usage:
# ./crypt
Unfortunately, unless you have a particular problem you're trying to solve, I don't think this question is appropriate for this site. If you do want help making your program better, the Code Review stack exchange does that sort of thing. — cantido48 secs ago
I'm voting to close this question as off-topic because it's a code review question and there's no clear problem. — Szymon38 secs ago
This question could be suitable for Code Review, as long as (a) your code works as intended, (b) your code is real code, rather than example code, and (c) your code is included in the body of the question. If you wish for a peer review to improve all aspects of your code, please post it on Code Review. — Phrancis58 secs ago
I wanted to take on the challenge of the classic Robot Path's problem but solve it using Pascal's triangle. The approach was generate pascal's triangle, then grab the middle element from the row. I saw the following pattern:
//where combos are on pascal's triangle:
// 1x1 grid on the 1st line ===>
I've written this Wack-a-mole like game on my iPad in the app Pythonista. Keeping that in mind, it uses a different graphic interface from the one I have usually seen used, Tkinter. I'm a beginner and this is my first major project, so any tips on how to code more efficiently and improve this pro...
when I declare functions with type hinting (and often default parameters), I am ending up with really long function definitions (despite having only a few parameters).
I can't find any definitive way to style my parameters, but I'm curious if you guys know of anything in PEP
If you can get your code into a working state you might get a lot of good advice by posting it on codereview.stackexchange.com. Honestly I see a huge problem here with the sheer number of variables you have. You really should look for a way to use lists here as opposed to a whole heap of individual variables for each cell of the table. — shuttle8738 secs ago
our application structure is multi-tenant with database. each customer has their own database. i have store all tenant information in separate database. when user request api i need connect specific database. how to implement in spring boot. i am using mysql database. Now my api ready with single...
This is my simple jQuery form validation/submit logic and it is working perfectly fine. But still I am posting this to see if someone check the logic and suggest me if there is any other simple way to get the same results.
More, in my form I put all input boxes and select into .valid1 class, all...
Here is our C++ Video Game Beginning/Character Creation, give us feedback, ideas, and suggestions.`
//Seasons Divided
#include <iostream>
#include <string>
#include <iomanip>
#include <stdlib.h>
using namespace std;
void LegalStuff();
void CompanyIntro();
void TitleScreen();
void intro();
int G...
Please help me find my mistakes.
public static void main(String[] args) {
int[][] grid = new int[10][10];
int i, j, steps;
boolean loop = true;
Scanner Input = new Scanner(System.in);
//prompt user for info
System.out.print("Please enter a list of (i, j) pairs for popu...
I am busy rewriting a large section of code that has multiple lambda expressions in that vary in complexity.
My question is regarding the naming of the parameters in these expressions.
We often see
MyList.Select (x => SomeConverter.Convert(x));
as one of the more simple options. Now my quest...
I have a situation in which I need to get the Closest road to a DbGeography Point.
This takes 5 - 8 seconds to run in some cases.
I have a Spatial_Index on the Column and I re-organised it, so it is not fragmented.
This Query is quite heavy, sometimes the CPU usage raises to 100% because of ...
@200_success I just want something to work on since I no longer have any assignments left in my C programming course. It's hard for me to just think up something I guess
I've got a program here which asks for initial ball bounce index (initial height divided by how far the ball bounces back up) and tells you the distance traveled from the first drop, until the ball is inert.
def main():
init_height = eval(input("Enter initial ball height: "))
while ini...
This (working) code is supposed to return a new array that consits of elements of both arrays that were not marked as duplicates (find duplicates in both arrys, remove such elements from both arrays and create an array from the leftovers, if any)
Is there a way to simplify this function?
functi...
I think this code has far to many if else clauses and not enough abstraction via functions. I would like to break the code down into a series of small functions, or methods if i decide to go OOP, but I'm not sure of the best way to do so. If you brilliant Pythonista's could guide me in the write ...
hi, trying my hand at the Codility tests/lessons and I've got a question...
I've written a function for one of the tests. it passes 100% but the evaluation says that the time-complexity is O(n) or O(n * log(n)) but I don't see how it is the latter...
// Write a function that, given a zero-indexed array A, returns 1 if array A is a permutation and 0 if it is not.
int solution02_02(vector<int> &A) {
size_t size = A.size();
vector<bool> found = vector<bool>(size, false);
size_t N = 0;
for (size_t i = 0; i < size; i++) {
size_t val = A[i]-1;
if (val >= size) return 0; // beyond length
if (found[val] == true) return 0; // duplicate
found[val] = true;
N++;
}
return (N == size) ? 1 : 0;
}
The limitation is there so we don't have to go through 10000 lines of css. Paste here only the relevant parts of your code - we're not supposed to go through a code review of your full css file. — vard42 secs ago
Does it work for you? If it does not, then please post particular case when it does not work. Otherwise, you might want to post it at codereview stackexchange — Petr29 secs ago
function uniques(array) {
var result = [], val, ridx;
outer:
for (var i = 0, length = array.length; i < length; i++) {
val = array[i];
ridx = result.length;
while (ridx--) {
if (val === result[ridx]) continue outer;
}
result.push(val);...
I'm aware that there's already stuff here regarding this but I'm just posting to check if my logic lines up with my code (if I'm thinking about this whole infix Postfix thing the way I should be).
The code I've seen regarding this topic on this site look a little different from mine. I'm kind of...
I am having a simple foreach where I add objects to list:
List<SoonestDrawDateModel> soonestDrawDateModel = new List<SoonestDrawDateModel>();
foreach (var item in drawDates)
{
SoonestDrawDateModel sdModel = new SoonestDrawDateModel();
sdModel.DrawDay = item;
...
Ok, now I see you say that "it's not working as it should". Note than the first part of my comment: it it does not work as it should, then just post a particular case when it does not work. I suggested codereview only if the code does work for you. — Petr19 secs ago
My task was to write a server class, which uses select(), for a student projet.
It was working, but i'm now willing to improve it a lot, and be able to use it in other personnal projects, so any critique and improvement idea is welcomed !
Here is the main.cpp :
// example packet
typedef str...
I am looking for the way to speed up my script. It is working fine, I mean, the final output is as required, but it is clunky and really slow. It is slow because of the double 'for..in..' loops, I know. So, how to make it smoother a bit?
What my script do: - it is updating existing feature classe...
My regex takes the form of the following:
/(\w{3}, \d{2} \w{3} \d{4} \d{2}:\d{2}:\d{2} GMT)/
And it matches all date strings with the format:
Thu, 19 Nov 2015 17:57:44 GMT
But it seems very convoluted. Is there a better / more concise regex for achieving this?
Thanks in advance!
I work as android developer we work in application selling vouchers
we have some api , one of them to check if voucher is valid or not
second to validate this voucher
here is my situation , I ask web developer to make both response the same when I check and validate voucher.
second I ask hi...
Yeah, I wonde rhow long he sits there thinking about units, before posting. Today happens to be sunny and 4C ... which is close enough to 38C, but really, who cares about those temperatures.... it's the -452 that irritates me.... is that zero-K or warmer?
Firstly... read my first comment, then read the comment in reply, the solution has been achieved, but @Vamsi wants a more effecient way. Which is why I gave the codereview SE. — DickieBoy28 secs ago
I've taken the Codility Tape Equilibrium (like here) and I've put my code with writes to stdout:
import java.util.Arrays;
class Solution {
public int solution(int[] A) {
System.out.println("A " + Arrays.toString(A));
long minDiff = Integer.MAX_VALUE;
long[] leftSum...
@JeroenVannevel I know that's what he's referring to. But he simply points the OP our way with a question which (as written) is completely inappropriate
In grammar, a tautology (from Greek tauto, "the same" and logos, "word/idea") is an unnecessary repetition of meaning, using more than one word effectively to say the same thing (often originally from different languages). It is considered a fault of style and was defined by A Dictionary of Modern English Usage (Fowler) as "saying the same thing twice", when it is not apparently necessary to repeat the entire meaning of a phrase. "Fatal murder" is an example of a tautology. If a part of the meaning is repeated in such a way that it appears as unintentional, or clumsy, then it may be described as...
I've got a function that returns its value through a callback but I need to use that value inside my string.replace() call. If it's asynchronous the replacement happens with value 'undefined' because the callback hasn't finished yet. How do I wait for that callback?
I work as android developer in application selling vouchers. We have some APIs and one of them checks if a voucher is valid or not and another to validate this voucher.
I asked a web developer to make the responses from both functions the same. I also asked him to make json easier to read, and h...
I made my own realization of merge sort and I have two questions:
Is this code correct implementation of Merge sort algorithm
Is there a way to make this code better.
(defn rsort[a]
(cond
(<= (count a) 1) a
:else
(let [half (/ (count a) 2)
[lh rh] (split-at half ...
It's borderline in two ways, because it's someone else's JSON format that they have to use for an app. So not actually their own code. But even at that what in particular is it closeable for?
Yeah, in effect they just want to ask about best JSON practices to check that the web dev is correct.
> Note that the API is entire asynchronous. To get data back from the server, you'll need to use a callback. The return value from most of the API is a backpressure indicator.
thank you for answer , I know this , but there are structure of json , that I want you to review and advise my web developer to make changes — Mina Fawzy2 mins ago
The profile of that user is hilarious.
This Mina I am working as Android & iOS developer for more than two years , I love help people , challenge myself
fell free to contact me at:
His grammar is a bit iffy for someone who likes to challenge himself.
I work as android developer in application selling vouchers. We have some APIs and one of them checks if a voucher is valid or not and another to validate this voucher.
I asked a web developer to make the responses from both functions the same. I also asked him to make json easier to read, and h...
LOL. I think I coined a new term: Now we could call fucktions to functions that not pass on Code Reviews and should be refactored. Not that I have ever read the std::find_end implementation and thought it would be classified as a fucktion. I will not change the spelling on my post just to not make this comment out-of-date. Thanks for the observation. — sergiol48 secs ago
First one is standard, second one uses generators.
You need a third party library for the second example to work properly as generators don't usually wait for promises, but a 3rd party library can be added to fix that and you essentially end up with async/await.
I think this Questions belongs to the progammers stack exchange, since it's about code review instead of an programming problem — KhorneHoly31 secs ago
Problem (Tape Equilibrium):
A non-empty zero-indexed array A consisting of N integers is given.
Array A represents numbers on a tape. Any integer P, such that 0 < P < N,
splits this tape into two non−empty parts:
A[0], A[1], ..., A[P − 1] and A[P], A[P + 1], ..., A[N − 1].
The d...
Hello Butthoarders, I figured out that code I was trying to get help on, but was rudely denied assistance and I present it for your all-mighty review!
gotoxy() - allows you to place the blinking text wherever you want. I wasn't able to get it to behave the way I wanted, so you will notice I had ...
gotoxy() - allows you to place the blinking text wherever you want. I wasn't able to get it to behave the way I wanted, so you will notice I had to insert a bunch of spaces in the cout portion of the blink function. Obviously this could be refined.
blink() - I put a "/r" to set the cursor back t...
Just rolled back a troll edit from OP. If he edits one more time in similar fashion I'll request a lock.
@Mast Good lord! I had no idea I was so out of line. Forgive me my trespasses. As you see, I have edited out any fluff and will stick to a strict format of serious and relevant commentary on the provided code. — Rubix24 secs ago