I'm an elixir beginner. I'm doing the word count exercise of exercism website. The word count exercise returns a map with the word as the key and the number of instances as value. The exercise excludes special characters, and ignores underscores. My code works, but I'm sure there is a way to m...
I'm a newbie to Python. I'm trying to conduct machine learning on a csv dataset, using sklearns. My problem is that I cant read my data, since opening my csv file and reading it with pandas renders it a tuple, which target attribution will not work on. support vector classification works fine on ...
I'm actually thinking of creating a few schemas also, instead of putting everything in dbo, though it will be a very small database so that may just be unnecessary
A few weeks ago I recall a HackerNews story (found it again: "I Don't Want to Hire You If You Can't Reverse a Binary Tree") about reversing a binary tree (with, as I remember it, the end goal being to test for symmetry by testing the reverse for equality with the original).
I started hacking th...
I was asked a pretty basic question in a recent interview. Given a integer string , reverse the integers that are divisible by 3. Here is an example.
"1234567890" becomes "1204597863"
I was rejected with "poor code quality" as feedback. I would really appreciate reviews to improve my code below...
Summary: I am wondering if my code is needlessly redundant. I noticed, when looking over my code that I had a unnecessary variable and if statement. Both Fire() methods achieve the desired result without error (from what I have seen). To me the Redundant Fire Method reads allot nicer and is my pr...
Emmental is an interesting esoteric programming language based almost entirely on rewriting its interpreter. The language provides a very basic set of standard computing operators, and an eval operator, ?. The ! operator is the language's defining feature: it pops a symbol from the stack, pops sy...
Looking for input, advice, criticism. This is my first help class. While use of mailto URLs should most often be trivial, I have a real world need to send to multiple recipients and with a body of text something more than just a one liner. Doing so gets sticky and there are some pitfalls with res...
I've created a project on Khan Academy as part of the Natural Simulations course on random walks.
This project is in JavaScript, using the Processing.JS library, slightly modified by Khan Academy.
(In the main, the inclusion of the Processing.JS library offers a few functions for drawing on a c...
Solution:
public class RemoveDuplicateInString {
public void removeDuplicate(String s){
System.out.println("Before::"+s);
int len = s.length();
for(int i=0;i<len-1;i++){
char c = s.charAt(i);
String preString = s.substring(0,i+1);
...
I have this sort of a web crawler that asks for two (English) Wikipedia article titles (the source and the target), and proceeds to compute the shortest path between the two. My code is as follows:
package net.coderodde.wikipedia.sp;
import com.google.gson.JsonArray;
import com.google.gson.Json...
Problem Statement
In a School, Chocolate bars have to be distributed to children waiting in a queue. Each Chocolate bar is rectangular in shape. Consider its side lengths are integer values.
The distribution procedure is as follows:-
If bar is not square in shape, then the largest possible ...
I guess it depends on your team setup. If all clone one central repo to their local computer, they need to push into their own feature-branches for code-review and backup purposes. If all have their own central clone (like github forks) I don't see as big benefit, as all can push into their own central repo from which you make code reviews. — Mattias Åslund39 secs ago
I'm voting to close this question as off-topic because it contains working code that he wants to improve. It therefore belongs on the Code Review Stack Exchange. — Jens36 secs ago
It is a thought I have had, I've used web.config transformations, and then slow cheetah, so I do understand the purpose . I am pretty sure this group that I'm temporarily with is not going to be fond of it as they have their methodologies and with a code review they asked me to use their way of using connection strings ( problem is they are not using dbcontext / ef , and i also do not know how they are managing the proper environment) — MillRunner20 secs ago
I have been learning common lisp and am a newbie, using the great book Practical Common Lisp. There is a once-only macro in the book that I spent a lot of time figuring out how it works. Even after I figured out how it works, I still have to look at it and think for a while every time I come acro...
I'm trying to insert an element into a skip list. While I think that my search function does what it's supposed to, I don't seem to be able to wrap my mind around how I'd go about inserting an element. I search for the element that I want to insert. If it's not there, I move down to the bottom la...
I have two views in my app and a bunch of buttons that show or hide them. I thought about using the sender.tag of the buttons that are passed to the function to hide or show the views:
@IBAction func showOrHideView(sender: AnyObject) {
UIView.animateWithDuration(0.5, animations: {
sw...
Number from 1 to 999999999.
public class ConvertIntegertoEnglish {
private String getCountSuffix(int value){
String word = "";
switch(value){
case 3:
word = "Hundred "; return word;
case 4:
word = "Thousand "; return word;
case 5:
word = "Thousand "; ...
Whether based on MVar or TVar, async implementation are always based on operation on some underlying monad IO and STM.
Making Async a monad on its own i na naive way, as in F# async computation builder, require littering with unsafePerformIO which does not feel very haskellish.
module Async2(As...
@CaptainObvious sidenote: while this needs an explanation it uses the indian numeral system of Lacs and Crores, which is Hundred-Thousands and Ten-Millions IIRC
Welcome to Code Review! I improve the quality of your posts and increase the chance of a high-value answer, please take a look at our How to ask a good question on meta. — Mast8 secs ago
That's probably not close on second thought with Google Maps
My mental model still consists of Germany's border lining up with the Dutch border and assuming that south for Germany means south for The Netherlands too
This solution works, and I like having all the logic after the return.
Main purpose I wrote this function was for use with other functions to return file list:
outside <exclusion list>
grandparent directory in <inclusion list> and
base filename in <inclusion list>
So I end up using this + a...
In Rust, pointers can never be null, so in case where you actually need null, such as a linked list, you use the Option type:
struct element {
value: int,
next: Option<~element>,
}
How much overhead is involved in this (in terms of memory allocation and steps to dereference compared to...
That's quite interesting, though it doesn't list the size of Vec<Option<i32>>
Though Vec<Option<i32>> should be twice as big as Vec<i32> due to Option<i32> being twice as big as i32, yet Rust does not perform less than C++ is said
And for example an iterator from Vec<i32> returns Vec<Option<i32>> with its next() method
@CrazyNinja Code Review is explicitly for code that already works as intended. Please don't suggest people migrate broken code over here, it just causes a bad experience for everyone involved. — Zak46 secs ago
Maybe a query to get the average amount of upvotes per question in every month and then select the percentage of questions that pass that quotum could give a sense of quality
And there's an std::io::Error and std::num::ParseIntError, but because the function has to specify its error type you need to convert it to a String, that feels wrong
A brief aside: I am a beginner in Python and I wanted to see if I could get some feedback on my simple Rock, Paper, Scissors game. I do have previous
experience in programming, as I started learning a few years ago but got happy feet and moved through the "basics" for a lot of different languages...
I want to forward every mail with a specific subject to an e-mail. To the content of the original mail, a specific content ("geprüft") should be added.
I have the code now, but it doesn't work properly. It sends the last E-Mail clicked on :(.
Sub Test(oMail As MailItem) Dim MyItem As Outloo...
Started learning C++ a few days ago, and this is my first full program. It takes in words until an end-of-file character prompt is given, and then outputs which of those words are palindromes and the longest palindrome of those words.
I want to know if my evaluation for whether each string is a...
Many implementations of Sieve of Eratosthenes (used to find prime numbers up to a given n) use a temporary mutable array to keep track of which numbers are composites. I'm looking to write a purely functional version that has the same runtime complexity:
(define (primes-up-to n)
(cons 2 (unfol...
Since I've never done any performance programming (Aside from the better choices such as array vs list etc. The real basics.), I should probably read up on it. But I had to start somewhere, so, someone I know - that is a much better programmer than I am - tasked me with making this.
This code wo...
I'm working on a project where I need to cache objects from the database that are infrequently updated. How is this as far as synchronicity goes? Could I run into a race condition due to promises, if the view snippet is rendered inside of a promise? Is this acceptable practice, and does this real...
I have created an Electron Application with a JavaScript/NodeJS Backdoor and a Ruby command-line listener.
I created this program for remote administration of my home computer securely, without using something insecure such as VNC or using Antivirus flagged software such as the Metasploit framew...
I am working on a Ruby gem to pull data from the Wikidata API. The data is deeply nested, as it contains a lot of repetition.
I have written a piece of Ruby (sans Rails) code that enables an array of hashes to be merged together, with any duplicate key-value pairs being stored as an Array under...
> "One reads," notes Bernice Kite, "how lawyers are sometimes disbarred and ministers defrocked." "Would it not be in line," she continues, "if those in other walks of life should have equally magnificent terms for getting fired? Far Eastern diplomats, for instance, might be disoriented, electricians delighted, cashiers distilled, equestrians dismounted, piano tuners unstrung, mediums dispirited, cowboys deranged, guides detoured, statisticians disfigured, and teachers degraded."
What is your question? What does this do that it shouldn't? What doesn't it do that it should? If you're just looking for feedback on the code itself, CodeReview.SE may be a better place to post this. — Jonathan Lonowski18 secs ago
I'm trying to get my performance skills (none existent) up to par but ran into a problem with writing out a formula into code. This is the formula I'm trying to - quote unquote - "convert" to code.
Consider a sequence u where u is defined as follows:
The number u(0) = 1 is the first one ...
Main Calling from Web API :
public virtual async Task GetLookups(string types)
{
if (!String.IsNullOrEmpty(types))
{
var lookupTypes = types.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
if (lookupTypes.Any())
{
...
Argyria or argyrosis (from Ancient Greek: ἄργυρος argyros silver) is a condition caused by inappropriate exposure to chemical compounds of the element silver, or to silver dust. The most dramatic symptom of argyria is that the skin turns blue or bluish-grey. It may take the form of generalized argyria or local argyria. Generalized argyria affects large areas over much of the visible surface of the body. Local argyria shows in limited regions of the body, such as patches of skin, parts of the mucous membrane or the conjunctiva.
The terms argyria and argyrosis have long been used interchangeably...