1
vote
0answers
18 views

Complex LINQ query, revise for best performance

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: ...
3
votes
2answers
29 views

Generating character permutations

I want to generate a 'dictionary' containing all 8 character permutations of upper-case letters such that the output file looks like: ...
2
votes
4answers
78 views

Is it possible to write reusable method that only some of its parameters are different?

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 ...
4
votes
2answers
115 views

Javascript condition optimization

Can the following condition be optimized/simplified ? ...
-1
votes
0answers
18 views

are there any test cases whose answer comes out to be wrong for following code? [on hold]

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 ...
3
votes
4answers
111 views

Get the environment variable's value

I've written a function which can get the environment variable's value. The input parameter would one of the following: ${machine}/bin ...
0
votes
0answers
14 views

How to “adapt” DOM (which read XML file) to a Jtree (which display parserized XML file) using Adapter Pattern [on hold]

'm making an exercize using Adapter Pattern and I would to adapt Jtree interface to a DOM class. Here there is my DOM class (Target): ...
3
votes
1answer
14 views

An atexit for Bash

I wrote the following atexit implementation for Bash ...
7
votes
3answers
253 views

Print Student Names from CSV

Description Print all student names from a CSV file. CSV file does not contain string delimited by double quotes. Code csvread.pl ...
2
votes
0answers
17 views

Binary Search Tree in Ruby

Binary Search Tree, with preorder traverse. What other methods should I add? How can I improve it? ...
2
votes
1answer
12 views

Making empty cells in Underscore template

From the back-end, I am receiving 8 data. The client requires showing that the row per data is 7, so I have 1 data in balance. I have created empty data and made the empty cells, which works fine. But ...
1
vote
0answers
12 views

Bloom filter implementation in ruby

I am following the wikipedia definition of the Bloom filter. My implementation uses the BitArray I created in Bit Array in Ruby using integer as a storage. ...
-1
votes
0answers
13 views

Binary tree search algorithm [on hold]

I think there is something I am not understanding with an algorithm I'm working with. I have a binary tree where "*" is the root, "C" is on the left, "+" is on the right and + has "a" to the left and ...
0
votes
0answers
7 views

why is the private member function accessible outside the class [migrated]

I expect he below code to give an error but Compiles ok ...
6
votes
3answers
429 views

Concatenate two strings

I am learning C and wrote a function to concatenate two strings in C. Please let help me improve it. ...
22
votes
2answers
598 views

Quicksort implementation seems too slow with large data

I've written a program to compare different sorting algorithms with the array size being 10, 1,000, 100,000, 1,000,000 and 10,000,000. I, of course, expect Insertion to win out on 10 and merge heap ...
8
votes
5answers
1k views

Cola Machine #1

I have been working on the code listed here. I am working on Problem #2, 0 stars. Here's what I have to do: Write a program that presents the user w/ a choice of your 5 favorite beverages (Coke, ...
1
vote
0answers
27 views

Generic class for displaying UIAlertView / UIAlertController on iOS

To address backwards compatibility for UIAlertView, I have come up with an interface that would seem to work for both iOS ...
2
votes
2answers
33 views

Adding markers to a Google Maps map from a source

I've been using JS for a while but I've never had the need to make anything robust and my knowledge has been limited to simple DOM manipulations and other basic web front-end tasks. I decided to ...
3
votes
1answer
40 views

Bit Array in Ruby using integer as a storage

Ruby's Fixnum & Bignum can hold very large integers and automatically handle overflow. I decided to implement BitArray using an integer as storage. Please let me know what you think about code and ...
5
votes
3answers
70 views

Monitoring params via JMX

A task for hiring on a new job (I failed it with reason "very bad code"). Write a program, which will be monitoring the params via JMX. Param should have name, type and observabale value. Why my ...
3
votes
1answer
38 views

Eurovision voting order

Part of the Eurovision Song Contest is the voting process to determine the winner of the contest. Each country gives between 1 and 12 points to its 10 most favorite songs. When all the points have ...
5
votes
1answer
32 views

Converting decimal integers to a string representation in an arbitrary base between 2 and 26

This code takes an integer and returns a string representing the value in a different base. The value for the base can range between 2 and 26. I have had someone already look over this code and they ...
2
votes
1answer
11 views

Sorting of nested categories inside a Common Table Expression

I have a PostgreSQL database which contains (among other things) the following table definition: ...
0
votes
1answer
25 views

Summing all parameters, except the last, which should be subtracted instead [on hold]

Working on some python koans and got one which states: ...
6
votes
0answers
55 views

Easy Bit IO. Very simple interface works up to N == 64

After reading this question Easy bitset I/O. I wanted to see if there was a simpler way of doing it. This is how I would define a way of outputting ...
1
vote
0answers
56 views

Using basic methods to make a high/low game [on hold]

This is my first big project with using methods. My prompt is to: Write a Java program that plays the dice game High-Low. In this game a player places a bet on whether the sum of two dice ...
2
votes
0answers
48 views

Parsing small sets of data from a large XML using XMLReader [on hold]

Suppose I have a lot of large XMLs I want to parse data from and each of these can range in size from 10MB to well over 300MB. Now, I only need a small sub-set of data from a few specific keys. For ...
-2
votes
0answers
9 views

correcting user input to meet a specific requirement [on hold]

i need help with some code in python. i need the user input to only equal 1 character but there is a bug in the code that lets me enter more than one character at a time i need to be able to prompt ...
0
votes
0answers
25 views

How to add lives to the programme C# [on hold]

We created this is my university lecture, however i'm just wondering how this can be adapted to add lives into the programme and will say end the game after the 3 lives are up. Program.cs ...
-1
votes
0answers
11 views

Can't display json object from servlet and data from mysql [on hold]

I'm a beginner and i'm trying to make a simple app to display a table from mysql using JavaScript and jquery, json object. This is not giving me any error and but i'm lost as to how to proceed. Please ...
6
votes
4answers
243 views

Basic XML Writer in C++

This is an XML Writer in C++. It doesn't do much but the basics, and I've tested it, so it should hold up well enough. I hope in the near future, I can bring you an XML Reader. I kinda built the ...
0
votes
0answers
9 views

Filter by a transformed list, then untransform the result

Both exercises have a common pattern of "filter by a transformed list, then untransform the result". See skip and localMaxima. ...
2
votes
2answers
122 views

Function that takes an array of integers and returns that array rotated by N positions

Example: if \$N=2\$, given the input array \${[1, 2, 3, 4, 5, 6]}\$ the function should return \${[5, 6, 1, 2, 3, 4]}\$ ...
4
votes
2answers
123 views

Showing a list of plugins to filter

How can I refactor this function? I show a list of plugins in JSF, and I should filter them. I added function filterPlugins but I have some questions: Should we ...
6
votes
3answers
412 views

Simple password encryption / decryption

I'm working on a simple data storing program for my senior year (Secondary School / Grade 12), and there is a user sign-in functionality I've decided to implement. The way I've done this is by storing ...
1
vote
2answers
35 views

Small CLI note manager and publisher

This is my first attempt at trying to make a CLI note manager, than can be easily published on the web. I have made one note and you can see it live here. I have added some comments, and placed the ...
-1
votes
0answers
13 views

Python Tkinter controlling flow using classes [on hold]

I have recently started learning Tkinter, which is my first experience of GUI programming. For my first project, I am trying to write a 'scrabble scorer' that I have already created as a console app ...
0
votes
1answer
25 views

Pythonic way to find index of a list using the sum of the list elements [on hold]

I'm trying to make a function that returns the index of the smallest element whose sum along all the elements to its left is bigger than a number x. How can I do ...
1
vote
1answer
29 views

Rotating contents of a matrix (vector<string>) to the left or right

Each vector element is a row. Each character is a column. Assume the matrix is square (N*N) and N is < 10. I got some code to do it but doesn't look great and would love some feedback on how to ...
3
votes
2answers
39 views

Managing FutureTask and ExecutorService

I have many unrelated tasks to execute and I have to get the result of the task so I use the FutureTask. I submit all the task to the thread pool and use a map to ...
2
votes
3answers
237 views

Parsing a string to get the values of certain attributes

I have written a small method that extracts certain information from a string. An example of such a string is ...
0
votes
2answers
37 views

deleting values from std::vector of different types

I need to make a vector of different types and be able to delete the values (please ignore anything else but deleting the values for now). Is the next code safe to delete the values? ...
3
votes
1answer
28 views

Displaying a row of buttons

There must be a better way to display this code. Does anyone have any ideas? What the code does is displays a row of buttons and when you click on a button it changes the session so you can see if ...
0
votes
1answer
33 views

Creating objects from parsed file [on hold]

I'm newbie in Python but I want to know some tricks to make my code look cute. I know that syntax of Python allows to do this, but I don't know how. Suppose I have file with lines of format "x y z" ...
9
votes
1answer
660 views

Memory-Test for Soldiers

I am solving the following problem on code chef: \$N\$ Soldiers are lined up for a memory test. They are numbered from 0 to N-1 from left to right. In the test, there are \$M\$ rounds. In each ...
1
vote
1answer
48 views

Least suprising extension methods for DateTime to NATO date-time group

I have the following code to get a NATO date-time group for a DateTime. I usually need Zulu-Time or from a specific time zone. Is it clear what those methods are providing? If want to parse a NATO dtg ...
4
votes
1answer
59 views

Flood game implementation

There is the implementation of flood game on my GitHub. The app.coffee is the main part of project: ...

15 30 50 per page