I have tested the following code and it works perfectly, yet the Hackerearth tells that it is wrong for 3 inputs,
You are given two integer numbers: the base a (number of digits d, such that 1<=d<=1000) and the index b (0 <= b <= 922*10^15). You have to find the last digit of a^b.
`
Sample Inpu...
I saw a chair that looked like this at the dentists office yesterday, and the pattern caught my interest, as the light patterns emulated thin film interference fringes formed by an object that has a radius of curvature (the spacing between the successive fringes approaches zero (not really here.....
Can the following condition be optimized/simplified ?
if (!this.properties.width ||
this.properties.width <= 0 ||
!this.properties.height ||
this.properties.height <= 0)
return;
So basically if properties does not have a width or height property or the width or height property...
<?php
/*This section is the code used to test input data and
// add a new member some code is commented out so that I can
// look into it at a later date.
*/
// include db connection to members db
include_once($_SERVER['DOCUMENT_ROOT'] . '/includefolder/database.inc.php');
// data sent fro...
So I am currently attempting to remove an element from the array 'zombie_horde' as well as remove the child from the stage. My aimed result, a movie clip that is part of an array israndomly played and when finished playing, the frame changes to a gameover frame.
This is my code:
part of the big ...
I understand that, but, even though it worked before, what you are looking for is someone to debug your code, not make the code fail more elegantly. Code reviews happen when the code works. Debugging happens before it works. — rolfl ♦27 secs ago
@Pimgd - This, by the way: Then there's people saying that birds have a waterproof coating... but that's a bit contradictory with me not seeing birds when it rains.
You don't see where birds go when it rains, because, when it rains, you are either inside, or looking down.
You never go outside when it's raining, and look up.
I have the method below but I am going to have more methods similar to this one that all they differ in is the last parameters being passed to the method, the first three parameters will always be there
and then in the while loop with && conditions, I am going to use the same params that I am pas...
I want to generate a 'dictionary' containing all 8 character combinations of upper-case letters such that the output file looks like:
AAAAAAAA
AAAAAAAB
AAAAAAAC
...
ZZZZZZZZ
I came up with this solution that uses the product method of itertools:
from itertools import product
per = product('A...
A reader shouldn't really need to be skipped I don't think, you could use a loop to go through the nodes in the document. if this gets reopened I will post an answer — Malachi9 secs ago
someone please ping me if that question gets reopened
Inspired by Nested for-loop ASCII art, I looked at building a more complicated ASCII art than just the normal 'diamond' and 'triangle' variations that crop up occasionally here.
The challenge: Produce the following rocket
/**\
//**\\
///**\\\
////**\\\\
/////**\\\\\
+=*=*=*=*=*=*...
you can follow it on GitHub, I think I have a repo set up there
they are setting up a technical review of my skills at the place that is trying to recruit me, should I inform my current employer that I am being recruited?
I have a LINQ query which works fine, I am however very interested to understand if this can be written in a more optimum way...
Here is my query:
var query = (from r in Results.All.AsEnumerable()
where r.RequestType.Id == Id &&
r.DateFrom >= ...
Many of you have already seen announcements both on main and on meta announcing this site's graduation. At the request of a few of you who were skeptical (or perhaps merely in shocked disbelief), I'm here to confirm that yes, the Community Team has indeed decided that Code Review should graduate....
on the other hand, funny story: at a job interview on Friday I was asked if I'm familiar with the term "Code Review" ($#!@#). Although their HR contacted me through careers, I suppose my CV either hasn't reached the technical interviewer, or he overlooked my dozen or so references to CR. Not the first time this happens either. I get contacted from time to time, through Careers, and interviewers seem utterly unaware of my CR/SO/GitHub/blog/GooglePlay activities
In one of my recent projects I faced the problem of transforming an abstract class into another abstract class. The classes were structured like this:
abstract class AbstractEntity { /* shared implementation for all entities */ }
class EntityA extends AbstractEntity { /* specific members for th...
The following code is developed around a mysql database where the posts table has 3 columns: post_ID, date and title.
config.php holds the values for $dsn, $username, $password, $options.
the content for each post is held in a directory format:
year/month/day/(database column)title/content.txt
...
Return an object with WebAPI by proving some data
using MWM.Database.Model;
using MWM.Entity.API;
using MWM.Repository;
using MWM.Services;
using System.Net;
using System.Net.Http;
using System.Web.Http;
namespace MWM.Web.Controllers
{
public class JobController : ApiController
{
...
This converts a "numerical number" to a text representation. Eg:
convert 1234 --> "One Thousand, Two Hundred Thirty Four"
I'd like general feedback on how it could be make more readable or idiomatic.
There are a few specific points I'd like improved as well. The word lookup functions are a litt...
You probably can get a whole load of complicated things done with it easily, if you manage to understand 1) Haskell, 2) what you are doing and 3) what others are doing
Honestly, unless you have your head 'in the right place', functional programming is impossible to grok. Do you know how it works? If you have any doubt, then going to a conference will just be a bunch of people speaking klingon.
On the other hand, if you understand the basic concepts, and then can apply them in creative ways, and understand how others apply them, then a conference would be great.
Having said that, everyone should try to learn a functional language... they are good mental exercise.
I'm familiar with "basic" functional-style programming concepts, but some of it is Greek to me, like tuples and such. I've been known to pass functions as arguments in .NET, but I feel like there is probably more to it than that. It's hard to wrap my mind around why you would use a method that takes a function as one of it's method parameters vs. an interface. They seem similar in principle: abstracting away implementation detail.
@xDaevax The "problem" with that is that it's functional programming in OOP-languages... Sure it is the start of functional programming, but functional languages are really different
Sounds like an interesting challenge. I'll probably do some investigation then before the conference so I can retain more of the information. Thanks for the helpful nudge.
In your opinion, would they both equally contribute to my understanding of functional concepts, or is one better for one reason or another to start with?
I think there's understanding functional concepts, and understanding code written in a language that only supports functional programming and nothing else
Today I decided to learn some basic Haskell, and for starters I made a program for calculating the checksum of a Swedish personal identification number. It uses the Luhn-algorithm, aka. IBM MOD-10.
Explanation of this code can be found on Swedish Wikipedia and English Wikipedia
Here's a descrip...
In one of my recent projects I faced the problem of transforming an abstract class into another abstract class. The classes were structured like this and are part of an api for questionnaires:
abstract class AnswerConstraint { /* shared implementation for all entities */ }
class LengthConstrain...
I had an argument with someone on a different StackExchange site, and he harrased me and got banned from chatting. He then went on to downvote every single question/answer I had and he got on his alt and did the same. He is also the 11th user with the most rep on that site, and 4 days have passed and the serial downvoting has not been reversed. What do I do? I really stopped participating in that StackExchange site, such a bad feel.
@Vogel612 Anyways, me and Semaphore (since it's no longer secret) had an argument and he serially downvoted every single one of my answers and questions, and also he abused his ability to automatically edit posts so he could un-upvote everything I said.
@skiwi It's an array of strings that don't have to ever be modified. So my reasoning is that they could be evaluated as constants at compile time using constexpr, but the compiler whines at me for some reason
Description
Print all student names from a CSV file.
CSV Format:
CSV file does not contain string delimited by double quotes.
None of the cells has "," character or "\"" character.
There are exactly two columns.
No empty cells.
Code
csvread.pl
#!/usr/bin/perl
use strict;
use warnings;
...
Meh, perl is a glue language. it binds things together, it provides easy ways to translate and manipulate, and allows you to track, and control.
In the unix philosophy of each command doing one thing, and doing it well, you often need something to bind them together that is more than just a pipe.
3
Anytime you are there, you use perl. Python is not as good in that space as perl is.
Question: Should I ask a question on CR (that is a complete working example) that in order for the question to be answerable, it's necessary for me to post all ~500 lines of code (which I'm okay with)? Is that too much?
@JaDogg You could declare that the first comma of each line is a delimiter, and all subsequent commas are literal characters in the name. Use split '', $line, 2.
My friend keeps whining about "losing n reputation points" on Stack Exchange. My instinctive interpretation is that some of the votes he had earned were reversed due to vote fraud. What he really means, though, is that he hit the daily reputation limit, but can't take advantage of upvotes that ...
I am in the process of diving a bit deeper into JavaScript development and am looking at some common language patterns (module, and factory in particular). In this code, my aim is to create a re-usable framework for creating custom field validators in JS that can be easily extended. In addition...
I agree that error-handling is the most generic and others should be synonyms of it. I actually tried to propose that synonym this morning, but exception-handling has more questions and the system wouldn't let me. (That's what brought me to meta actually.) For simplicity's sake, I see no issue wi...
I am in the process of diving a bit deeper into JavaScript development and am looking at some common language patterns (module, and factory in particular). In this code, my aim is to create a re-usable framework for creating custom field validators in JS that can be easily extended. In addition...
You have lot of unnecessary comments. You do not need to over-comment your code.
} // end if
} // end if
} // end for loop
If peppering your code with lots of comments is good, then having
zillions of comments in your code must be great, right? Not quite.
Excess ...
I have two matrices, the first one is mat 2000*500, the second one is 6000*500 tep
I did this code for some analysis to get another matrix that has a specific elements.
Problem is :
This code is very very slow, I need it more faster any suggestion please thanks..
mat=matrix(sample(c(0,1,2),200,...
I wrote some code for an application that uses the following pattern:
function _getData() {
return new Promise(function(resolve, reject) {
if(_hasDataTypeA()) {
SomeBackendAccessObject.getTypeAData().then(resolve, reject);
} else {
SomeBackendAccessObj...
I am making a game that uses a text map to draw obstacles and courses for the player to navigate. However, I am concerned that my method of looping through the text map to draw objects on the screen isn't as efficient as it could be.
Here is my code dealing with the text map:
var platforms = [];...
Several hours ago I posted this question about Generating character permutations in Python.
User roflf said that my main problem was not using the right tool for the job, as Python is interpreted it will be much slower than a compiled solution. So I tried to write this in C. I thought it would ...