instruction stringlengths 71 71.9k |
|---|
I have a school assignment to allow a user to enter a GTIN and then validate that it is correct.
I have finished the code, but my teacher has told me I will get more marks if I can make it more efficient. I realise I could use a loop in lines 5-12, but am not completely sure how. Any feedback is welcome, but I'm real... |
It is my first program in Clojure. It read RSS feed's list from text file, get each feed and store result into sqlite database.
project.clj:
(defproject cowl "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://... |
I made a particle simulation in vanilla JavaScript. It can currently handle around 10000 particles (staying 58-60 fps on my machine).
For testing, controls are MB1, MB2, R, Z.
How can I make this more efficient?
var width, height;
var head = [];
var hcount = parseInt(prompt("PARTICLE COUNT? <Default: 10000>")) || 100... |
I need to implement a queue of requests which can be populated from multiple threads. When this queue becomes larger than 1000 completed requests, these requests should be stored into a database.
public class RequestQueue
{
private static BlockingCollection<VerificationRequest> _queue = new BlockingCollection<Verif... |
This is my solution to the common 'Array Rotation' algorithm. As I am currently practicing for coding interviews, I want to make sure that my code in fact valid for coding interview scenarios. Would I lose points for using JavaScript's built-in shift and push array methods?
function main() {
var n_temp = readLine().spl... |
I am trying to write a simple program that allows to encrypt a string of plaintext so that it can be transmitted via an "insecure channel" by which I mean a "regular chat"; be it Skype, Facebook, or even email or something similar. This is what I came up with:
At first, one user, Alice, will generate a cryptographicall... |
The code below extracts data from one web page - I emulate search, select all results from the list and when the list appears (42000 items) I loop through these items.
I get an id value from their href to create a proper link (example href is href="javascript:NeuFenster('rb_id=570964&land_abk=bw', so I don't want any J... |
I wrote the following prefix tree data structure for this Leet code challenge.
Implement a trie with insert, search, and startsWith methods.
Note:
You may assume that all inputs are consist of lowercase letters a-z.
However it keeps timing out on the long input. As far as I know the insert, search and startsWith ... |
I am new to "modern" C++ and decided to learn about smart pointers by implementing a doubly linked list.
I have a few problems with this code: Should the tail pointer be a weak pointer? Should the head pointer be a unique pointer (If yes, then the node after head will have a weak_ptr to the head node, causing a unique_... |
The goal of this function is to open a menu with a CSS class (animation is done through CSS transition), call an overlay on top of content and prevent scrolling at the same time. Also, since the designer didn't add any hamburger icon, I created a class (.header.isG_navSemiOpen) to add an in-between transition to tell t... |
Can you please provide some improvement advice for the following function?
It is working OK now, but as I have zero experience with PHP I guess there is a lot of room for improvement.
function addNewUser($ES_Client, $username, $password, $fullname, $email, $function, $department, $access){
auditLog($ES_Client, "Cre... |
I made a program that uses the Adafruit pressure sensor, and the DHT22 temperature and humidity sensor to log pressure, temperature and humidity every 30 minutes. I left it outside my house overnight yesterday in the hopes that it would have logged all the data overnight but it had logged only once. I'm guessing it dra... |
I'm displaying a conflict marker for each actor for each day, if the current day is in their conflicts:
<li v-for="date in next_three_months">
<template v-for="actor in cast">
<template v-for="conflict in actor.conflicts">
<i v-if="date.datestamp==conflict.datestamp" class="is-conflict"></i>
</template>... |
Here's my script:
def index(seq, item):
"""Returns the index of an item in an increasingly-sorted
sequence (if exists) otherwise returns the index where
it would be inserted, using binary search.
seq: a sequence.
precondition: seq is sorted increasingly.
"""
# Updates the se... |
I had read about quicksort in some articles. Is this is a correct implementation of quicksort?
function quicksort() {
// Setup data to sort
$data = array();
for ($i=0; $i < 500; $i++) {
$data[] = rand(0, 515);
}
// Begin looping
for ($x=0; $x < count($data); $x++) {
for ($y=$x; $y < count($data); $y++) {
... |
This is my first ever program written in Rust (after reading the book). It is small tool to sort all lines from stdin according to two criteria. First one is time when given log line was generated - in my case files contain logs from many applications which all uses same time source. The second is related to the fact t... |
I've written a small CLI node program to list the contents of a directory with an output similar to that provided by npm ls but listing both files and directories, not just directories. I wrote this for two reasons:
Personal interest: practice recursion
Frequently I want see the contents of a directory without having ... |
Question: Find the largest in a list that list is stored as two sections, one in ascending order and the other in descending order. Elements are distinct.
E.g: Input [2 3 4 5 6 7 10 9 8 7]
Output: 10
My solution is below. Works on my unit-tests. Want to know if there any improvements from the coding point of vie... |
I am new to Javascript and jQuery. I made a calculator by looking at other calculators, codes. I don't know so much Javascript methods, so I stick to eval method because I have no idea to produce answer in another way. I didn't create any function. Instead I lock buttons with Booleans changed by pushing buttons.
I ... |
I was using early bind to reference the dictionary and realised that some users might not be willing to manually add the reference to use it and just consider the macro to be 'broken'.
I looked at programmatically enabling the reference but that would still require the user to go through several steps to change their m... |
The goal of the code review by order of importance (i.e. What I hope to hear from you):
I've verified correctness using a straightforward matrix multiply function though I am open to those who want to verify correctness.
I'm just starting to learn about the benefits and challenges posed by coding things in SSE, while ... |
Using Python 2.7 and here is my code to calculate ROC/AUC and I compare my results of tpr/fpr with threshold, it is the same result of whay scikit-learn returns.
My questions, (1) any ideas for improvements (especially for performance in my existing code) (2) any smart ideas to calculate of AUC?
import numpy as np
from... |
I was given an assignment to create an implementation of a tokenizer object (by object, I mean a struct with associated functions that operate on instances of the struct). This tokenizer retrieves tokens from an input string given the following rules:
The input string cannot be changed
Tokens can only contain digits ... |
I came up with the following for a blocking and non-blocking queue implementation. Please suggest any changes/improvements/gotchas.
Blocking queue:
public class BlockingQueue<T> {
List<T> buffer;
private static final int MAX_QUEUE_SIZE = 100;
public BlockingQueue() {
buffer = new ArrayList<T>();
... |
Where I currently work I'm tasked with writing a good encryption and decryption code which will have DEK as well as KEK. Haven't started on KEK yet. I have already told them, that we need expert help, but I don't think I am going to get any. Any tips on KEK how to generate them and where to store them? (HSM ?) would be... |
I have done my first PHP-MySQL project with MySQLi connection. Please review this and inform me about security and performance issues.
dbconnect.php
$DBhost = "localhost";
$DBuser = "root";
$DBpass = "";
$DBname = "mysqli_login1";
$DBcon = new MySQLi($DBhost,$DBuser,$DBpass,$DBname);
if ($DBc... |
I am trying to make a simple model that returns the conditional expectation of a target with respect to the value observed for another variable.
Basically, given a feature \$F\$, a level of this feature \$f\$, and a target \$y\$, the predicted value is:
$$p=\mathbb{E}[y|F=f]$$
As much as possible, I tried to follow sk-... |
(See the previous iteration.)
Now, I have defined an iterator for dumping contents of a sequence such that the last element is not followed by the separator string.
main.cpp:
#include <algorithm>
#include <iostream>
#include <iterator>
#include <sstream>
#include <string>
#include <vector>
using std::cout;
using std::... |
I want to send mail which will have day to day report. I have setup action mailer like this
class ReportMailer < ApplicationMailer
...
def send_stats(hash)
@emails = ["my@email.com"]
@stat = hash
mail(:to => @emails.join(","), :subject => "Daily Count of tasks")
end
end
The send_stats method will ... |
I want to create a function that splits an image into many separate blocks that when put together look like the image as a whole, often called a Rasterbator. Given the number of tiles for height and length I want and the image to Rasterbate I want the function to draw the split up image with a little padding in between... |
I've been trying to reduce the indentation from a method in my code. The solution will probably be unrelated to the language, in this case python, although it may rely on some python specific libraries e.g. itertools.
The code below is part of this implementation of Kruskal's algorithm.
def generate_diff(self, ndarr, ... |
I recovered some spaghetti code and I have to refactor it. I do not want a method with over 200 lines, for me it is not object oriented programming. I am trying to ponder on the question and would like to have your suggestions.
private static IQueryable<Trade> BuildTradeQuery(IRepositoryFactory repository, SearchCriter... |
I've had a go at the following challenge (from codewars):
Interesting car mileages are 3-or-more digit numbers that meet one or more of the following criteria:
Any digit followed by all zeros: 100, 90000
Every digit is the same number: 1111
The digits are sequential, incementing†: 1234
The digits are sequential, decr... |
1) This a follow-up question to Example of PyQt5 simple turn-based game code
2) After improvement I edited original code to create snake clone game, which is real-time (or pseudo real-time) and it is more simple, than existing turn-based game.
Still my example is a bit over-complicated because I use blocks instead of b... |
I managed to finish this game I am sure you have encountered before. If you run it there are instructions on what to do. Any code suggestions / improvements?
import pygame,random,math
from time import sleep
pygame.init()
#window resolution
screen_width = 800
screen_height = 800
screen = pygame.display.set_mode( ( sc... |
I am doing a problem my buddy gave to me and I have my solution which works but needs to be optimised. I have tried to optimise it as much as I can with my knowledge but it seems there is still room for improvement. I am trying to improve my ruby. Here is the challenge:
Divisors of 42 are : 1, 2, 3, 6, 7, 14, 21, 42. T... |
I recently posted Spaces To Tabs Converter but it had lots of bugs, so I rewrote the code. I wanted to ask, is it good code? I didn't find any bugs.
#include <stdio.h>
#define TABVALUE 4
#define ARRAYSIZE 3
void emptyArray(int *a);
int main(void) {
int c, d, s;
int savedChars[ARRAYSIZE];
c = s = d = 0;
... |
I hope this is the right board for this. I am a novice programmer and I am trying to learn how to write better code. I have a visualforce page with a very long Javascript script in the middle of it to display a Google Map. The code is entirely inside of a single function, but I cannot figure out a cleaner way to break ... |
I tried to write a program in Prolog and describe a family tree:
parents(uranus, gaia, rhea).
parents(uranus, gaia, cronus).
parents(cronus, rhea, zeus).
parents(cronus, rhea, hera).
parents(cronus, rhea, demeter).
parents(zeus, leto, artemis).
parents(zeus, leto, apollo).
parents(zeus, demeter, persephone).
man(uranu... |
I've written a short program for one of my first exercise in C++.... I would like to get better suggestions to solve it, so hope you can help me :) And I hope this is the right session to ask...:)
Exercise:
Input: Pieces and price per piece. If pieces > 10, its 5% discount. If pieces>50, 10% discount
Output: total pr... |
I will build a system in C# and I want to use the three layers architecture is next:
Entity Layer
namespace EntitiesLayer
{
public class ECategoria
{
private int _idcategoria;
private string categoria;
private string descripcion;
public int Idcategoria
{
get { return _i... |
A problem I come across very often is what to do with branching classes. The class below is one example of a class that can turn ugly very fast.
The requirements of the class is that if the address is in Alabama use an external service, but all other states should use a database. The switch statements filter down which... |
I am solving https://codefights.com/challenge/Qjts7cukDvYpDW4Bc/main
My approach is simple.
Get all subsequences by combination.
Simple loop over combinations.
Find minimum.
closestSequence2 <- function(a, b) {
LA = length(a);
LB = length(b);
minimum = Inf;
indexes = utils::combn(1:LB, LA);
for(i in 1:ncol(indexes)... |
My assignment is to to create two threads running functions (called vow and cons). The threads take turns printing the respective words of the phrase supplied from a text file. The main thread shouldn't post anything (only cons and vow functions should print). I can't use synchronization primitives such as mutexes for ... |
For homework I had to do the following:
Give a list of all the teachers that don't have a classroom assigned to them.
It involves the following 2 tables:
Code inside Groups table would be the classroom in this case and TeacherId matches the Id inside Teachers table.
My solution to the problem is the following query... |
I just started studying algorithms and since I'm most familiar with Python decided to use it to actually put the algorithms I've been learning to use. How is my implementation of Bubble Sort? Does it make sense, is it efficient, too many variables, can you understand it without comments, any other tips for me?
"""
Bubb... |
I have implemented some methods to make the creation of multithreaded programs easier for me in the future
The requirement was:
Be able to add as many Tasks as I need to the pool
Be able to restrict the amount of concurrently running threads
Be able to set the thread creation speed
Be able to cancel the thread creatio... |
In my program I am deleting subprojects using LINQ. It's incredibly slow. There is a lot of cascade on delete's here so I am deleting from multiple tables. Any help and tips would be appreciated.
Here is an overview of the code
When you delete a subProject you must delete
Activities
which you must delete
ActivityDocu... |
This is the Google Foobar puzzle "Prepare the Bunnies' Escape":
You have maps of parts of the space station, each starting at a prison
exit and ending at the door to an escape pod. The map is represented
as a matrix of 0s and 1s, where 0s are passable space and 1s are
impassable walls. The door out of the prison is at... |
I've created a game (basically an Agar.io clone), where a human player is placed against AI controlled bots powered by a genetic algorithm and neural networks.
The problem is that I think that my algorithm isn't efficient. I have 10 bots ranked by their fitness function, which is time survived. Their gene consists of r... |
Given a string find the length of longest repeating non-overlapping substring in it. In other words, find 2 identical substrings of maximum length which do not overlap.
Examples:
Input : str = "aabaabaaba"
Output : 4(aaba)
Input : str = "aaaaaaaaaaa"
Output : 5(aaaaa)
Input : str = "banana"
Output : 2(an or na)
I have ... |
Are there any corner cases missing here?
class Node
{
int data;
Node next;
Node prev;
}
Node reverseDLL(Node head)
{
if(head == null || head.next == null)
return head;
Node previousNode = head.prev;
Node currentNode = head;
Node nextNode;
while(currentNode!=null)
{
... |
As I wrapped the VBIDE API, I encountered a number of "collection types" (Windows, CodePanes, VBComponents, VBProjects, References, etc.) - these types implement the non-generic IEnumerable interface, so if I wanted to be able to iterate my wrappers like this for example:
using (var projects = _vbe.VBProjects)
{
f... |
Game of life is the simplest example of zero player game for cellular automata and it was proposed by mathematician John Conway. I have tried to re implement Nicolas P. Rougier's tutorial for python code with arrays for game of life in C.
#include<stdio.h>
#define clear() printf("\033[H\033[J")
void compute(int N[... |
I'm working with parameters right now in Java, and my colleague told me that this code of mine is redundant, and I see his point. The for loops do look redundant, but I have no idea how to go about changing this. My code is functional, but I wish to improve it.
public static void printLine(int length)
{
for (int i... |
I have written a program in Ruby which calculates the median of a streaming set of numbers dynamically. For each number that arrives, the median is calculated for all the numbers that have arrived so far.
The issue I am facing is that the program times out on some inputs, and, most likely, the reason is that I return a... |
I'm learning F# by doing various small projects. One of them is a problem where the program reads Poker hands and rates them. It's Texas Hold'Em, so for each player it tries every five card selection from seven cards.
When it's time for scoring I have made a set of functions that each evaluate a hand and produces an Sc... |
We are doing an e-commerce project in a PHP-MySQL combination. Here is the code with PDO we wrote for login and register. I've heard that writing less code is better, so how we can reduce the lines of code?
connection.php
<?php
// database Connection variables
define('HOST', 'localhost'); // Database host name ex. loc... |
I've just come across these day with the multithreading subject in Python. I remembered @200_success's answer and I thought of making that multithreaded as it follows:
one thread to check that each column contains the digits 1-9 only once
one thread to check that each row contains the digits 1-9 only once
another nine... |
I'm learning web services using Java. I just don't know which method has what advantage over another, like which one is more secure? Which one will be more faster?
POST resource is as follows:
@POST
@Path("postactivity")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public String createAct... |
Here is my code to add a progress bar on every HTTP request. Can someone please point out to me whether I am doing it right or not?
Template for loader:
<div class="loader" ng-class="!loaderState ? 'hidden' : ''">
<div class="parentLoader">
<div class="loaderContainer">
<div class="logo"></div>
... |
I want to know if these encryption functions are ok for a live production application. Based on resources here and here and here I have put together these three functions.
Purpose
This code is for a encryption and decryption system that allows a user to encrypt certain data. The encrypted data is stored, while the keys... |
I have an object that is fairly expensive to create and has a tendency to get created multiple times because each distinct user may have one or many instances of this object. This object can expire as its internal authentication becomes stale and no longer valid.
Because of this, I want need to keep a dictionary so I c... |
I am coming from C# and I am learning how to use Python more seriously.
So I decided to try a little side project to help me see how much I earn (or lose) from my trades on the stock market.
I would like some advice about how I structured my project, in C# I am used to put each class in its own file, but I read that in... |
There is a big number with N digits and Q questions.
In each question, find if the number formed by the string between
indices Li and Ri is divisible by 7 or not.
Input: First line contains the number consisting of N digits. Next line contains Q, denoting the number of questions. Each of the next Q
lines contains... |
I just filled in the first assignment on course which involves learning Python. The assignment was to make vector class which supports scalar multiplication through operator overloading.
The instructions included these constains:
There will be one class called MyVector
Nothing will be imported in file within that fil... |
I am writing the code for A*, Uniform cost search and Greedy best first search algorithms in Java. I have finished the code which is working fine but I have used a bit different design strategy while writing this code and I want this code to be as efficient and as clean as possible so I could really use your help.
The ... |
This is now an iterative review. The next iteration can be found here.
Yep. Fizzbuzz in Python.
I've been coding in Python for all of 90 minutes.
Thoughts?
Program Flow
Take a start_num and an end_num as user input
Ask for divisor/value pairs until user inputs a response that is not y
Iterate over the specified ra... |
I am creating an application that deals with cars and orders.
A order contains a car and other information (BUYER, OWNER, ...), which constructs an orderObject.
A car has around 80 different attributes (TYP_WHEEL, TYP_DOOR, QUANTITY_WHEELS, ...) for the different car-parts.
I get the car-attributes and their values fr... |
I know that using try catch is not appreciated by many developers and not by myself, especially when it comes to parsing or checking a certain value.
In the code I have, if some exception happens is that it is good (so true), otherwise it is not good (false).
My request is not to recode this, but just explain to me if ... |
While I'm a rather experienced .NET developer, I just had a first crack at a PowerShell script. I'm not entirely new to it, but never written anything so involved.
Script description and goals
At our company, the root of each SVN branch or trunk has 3 folders that have the property svn:externals set with a list of exte... |
I got inspired by this C# question. It asks to write a program to output all possible words (included in a dictionary) which fit a string of letters obtained by swiping the finger over the keyboard, as is often done with mobile keyboards.
Description
Software like Swype and SwiftKey lets smartphone users enter text by... |
I have a $scope.users that I use to show a table and I need to apply a filter with multiple options,
Here is the $scope.users object:
[
{
"login": "andres.un1@mail.com",
"merchant": {
"merchantId": 500095,
"status": "ENABLED",
"defaultAccountId": null,
"accounts": {
"500092": ... |
This will determine if a string is unique or not using quicksort, so that it should take \$O(nlogn)\$ time and not \$O(n^2)\$ time.
I will call the test function code from main.
This runs successfully, but when I try to write a randomized partition, it will fail. I have written that code separately.
FindUniqueCharInStr... |
Is this the most efficient solution or can the performance be improved? Just opens a file and prints random words (lines with newlines stripped out).
import random
filename = "20k.txt"
def main(filename):
words_file = open(filename, 'r')
words = words_file.read().split("\n")
temp_words = []
for word ... |
I have a database filled with predictions of soccer matches. I need a solution to calculate the rankings from the database. There are 2 rankings: one for the entire season (playday=0) and one for each matchday (called playday in the code).
I have 3 tables:
matches
predictions
predictions_points
To give you a better... |
(See the next iteration.)
This question is a slight improvement over A telephone book command line program in ANSI C
I have incorporated almost all points stated by Toby Speight.
Now I have this:
telephone_book.h
#ifndef TELEPHONE_BOOK_H
#define TELEPHONE_BOOK_H
/****************************************************... |
I have a usual Django application with a single MySQL database. The purpose of this shell script is to backup a MySQL database every midnight by crontab and check that everything goes right.
The server has mysql and mysqldump executables. The connection to the database is stored with the help of django-dotenv, which is... |
I am using the following class to retrieve a http response, which contains data for my Android App. Everything works fine, but there is a performance issue. I get the following warning when requesting this class:
Skipped 36 frames! The application may be doing too much work on its main thread.
I used an AsyncTask to... |
I have the following method and I would like to understand how it could be reorganized to be more unit-testable.
I think the section about binding to Active Directory could go to its own method, making this method more about either returning bytes or not.
public byte[] getThumbnail(String username) {
SimpleBindReq... |
I am writing simple program to reverse its input and output the reversed version. I came up with this code. So how can I improve it? Something tells me that int lengthSoFar is bad in both printArray and reverse functions.
#include <stdio.h>
#include <string.h>
#define ARRSIZE 1000
//function declarations...
char *re... |
The following plays and replays CSS animations on load and scroll.
It works but I'm wondering if there is a better way to write this, so it's cleaner and performs better.
<script>
var invoiceAnim = document.getElementsByClassName('mod-anim__invoice')[0],
invoiceBgLoading = document.getElementsByClassName('mod-a... |
This is just a simple PvP tic tac toe program, I'm learning and just looking for maybe some feedback on how to improve it?
There are mainly two things I can see improvement for, the action listener where I could do something like; "a button has been pressed, get the name of the button, pass the name of the button, and... |
Attempted to use strtol() to parse a string into an integer and to output any appropriate error messages for failed conversions. How did I do? How could/should it be done? Code works as intended if I did not miss anything.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <limits.h>... |
I'm trying to create an API middleware which will react to every 401 response from the API. I've tried to search for possible solutions, but I'm kinda lost here.
I have created a special 401 response on server-side, which returns me a proper JSON with 401 status code and I basically process it in the middleware and alw... |
Here is the code.
# Collatz.py - The Collatz conjecture
initiate = True
while True:
if initiate == True:
initiate = False
try:
number = float(input('Enter a number: '))
except:
print('Error! Please try again.')
number = 1
if number % 2 == 0:
nu... |
This is my implementation of Kosaraju's algorithm for detecting strongly connected components, post here for advice. Some special areas looking for advice,
Not sure if my current implementation for adjacent table of graph is efficient?
Any better ideas to reverse the graph to make it more efficient?
I use preVisited a... |
I'm currently experimenting with async loading of JavaScript and came up with the following trick to detect when jQuery loads:
var jQueryPromise = new Promise(function(resolve) {
Object.defineProperty(window, '$', {
get: function() {
return this.jQuery;
},
set: function(value) {
if (typeof val... |
I have created a bit of code that plots data for a project (XY Line Chart). It works. But it isn't what I'd consider good. I am looking to improve it in two ways:
Make it more generic, so that I can just feed in a dataset of series and it spit out a chart. This might become useful in later assignments.
I'd like to und... |
In a previous code review, it was strongly suggested that I start using PHP Frameworks to improve security for my websites. I tried Laravel and got stuck due to the steep learning curve. Then I tried CodeIgniter and found it to be a good fit. I did a CodeIgniter tutorial and was able to pick up the basics right away, s... |
I have a function which accepts four parameters, which are all optional. Once they're received, it validates using if(!empty).
$subject = (empty($params['subject'])) ? '' : addslashes(trim(strip_tags($params['subject'])));
$message = (empty($params['message'])) ? '' : addslashes(htmlentities($params['message']));
$user... |
This was mostly made for fun, so I don't see it having any real world purpose any time soon.
<?php
namespace Junky\Components\Cookie;
use Symfony\Component\Yaml\Exception\ParseException;
use Symfony\Component\Yaml\Yaml;
/**
* Class Cookie
*
* @package Junky\Components\Cookie
*/
class Cookie
{
/**
* The ... |
This is my first network programming codes writing for a client who has the following requirement:
My Server has to run 24*7*365 for multiple clients at the same time (concurrency).
Their Client (Software running on client machine) has some bugs which makes it to crash sometimes.
When the software crashes, Server shou... |
I've been coding for about two months, and I recently attempted my first game. I'd appreciate any advice or feedback on how to improve my coding. For instance, I don't think the organisation is the best -- how should I have split this up into classes? Should I have made a Snake class and perhaps a Graphics class?
#incl... |
By "Pseudo-Enum" classes I mean cases where someone's used a class with public static properties to emulate enum behaviour; e.g. as described here.
Per the example below, this is useful for classes such as [System.Management.Automation.VerbsCommon], where there is a list of values we're interested in, but no "Get All V... |
Here is a test task from a company, where I'd like to work eventually. I solved all they wanted to me to do, however failed to get an interview. I do not know what is wrong with my solution, because it IS working fine and fast.
I do not have any real experience in programming, and will be very grateful if some java-ve... |
I am extracting exons details from a GTF file using command line in Unix like cut, awk, grep or sed.
input file.gtf:
chrI ce11_ws245Genes CDS 8378308 8378427 0.000000 - 0 gene_id "T19A6.1a.2"; transcript_id "T19A6.1a.2";
chrI ce11_ws245Genes exon 8377602 8378427 0.000000 - . gene_id "T19A6.1a.2"... |
I've created this function to grab the MSI ProductCode from the MSI file itself. i couldn't find any native method for it. So I've implemented it the following way:
public static string GetMSIProductCode(string msiFile)
{
string _result = null;
string productCodeQuery = "SELECT * FROM Property WHERE Property = ... |
Input:
The first line contains N denoting the length of Target String. This
line is followed by the Target String. The Target String is followed
by an integer Q denoting the number of queries asked. After this Q
lines follow each line containing a Query String.
Output:
For each query output the total number of d... |
I have written the following code for finding out the prime numbers less than or equal to n. When I enter the input n = 10^7, my program crashes. So I was wondering whether my code can be further optimised.
def sieve(n):
array = []
for i in range(1, n):
array.append(True)
for i in range(0, n-1):
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.