instruction stringlengths 71 95.1k |
|---|
My code in MS project VBA, in theory, doesn't do anything major.
It compares the tasks with each other, but it runs super slow.
One run through Temp lasts 15 secs. Try that with 1500-2000 tasks and the macro takes hours.
Sub Laczona()
Application.Calculation = xlManual
Application.ScreenUpdating = False
Dim Temp, Tem... |
I am working on an implementation of the minimalist compression method.
The method is based on context modeling, followed by a simple entropy coder (Golomb-Rice coder).
The context model uses a single previous byte in the uncompressed symbol stream to predict the next byte.
At the moment, my implementation works quite ... |
This program finds the 100th member of the "look and say" sequence:
1
11 (one 1)
21 (two 1's)
1211 (one 2 and one 1)
111221 (one 1, one 2, two 1's)
312211 etc.
from itertools import groupby, chain
def _look_and_say(seq: str):
return ''.join(f"{len(list(g))}{k}" for k, g in groupby(seq))
a = '1'
for i in ran... |
I have implemented a function mcollect which is effectively mconcat only for applicative monoids:
mcollect
:: Applicative f
=> Monoid (f a)
=> [a]
-> f a
mcollect = mconcat . fmap pure
However I am not overly keen on the name mcollect, an alternative name in the spirit of mconcat is amconcat which I am not kee... |
Challenge
An integer is provided as an input. In each step, we have to subtract
a number from the input which already exists as a digit of the input.
In this way, we have to make the input equal to zero(0). The problem
is to output the minimum number of such steps.
Code
n=int(input())
count=0
while n:
l=li... |
My (simple) game engine has one big fragment shader for the whole scene.
Right now, with multiple objects, collision detection and bloom post-processing (4 linear passes) I get frame times of ~18ms at 1080p on my AMD RX550 (2GB) - which is quite okay for me.
But I think that I can squeeze more fps out of my setup.
Sin... |
Since I haven't really used Python's new async features yet, I took some older code of mine, which took all of my answers here on Code Review and generated a word cloud from them, and updated it to fetch the pages in an asynchronous way.
This script uses the py-stackexchange package for the API (don't forget to get you... |
For a course I following and my code is approved I had to make some code that finds the person with the biggest loss where the input is a string[]
The string arrray looks like this :
{ "Tom, 1, 3, -1", "Gillie, 2, 3, 1", "Thor, 1000, 1001, 1002" };
I solved it this way but it's not a clean way. I must say we were no... |
I know you can calculate if an element is overlapping another by comparing the top|bottom|right|left properties within the getBoundingClientRect method. However, you need to loop through the elements to do so. I'm curious to know what is the performant way of checking to see if an element is overlapping any other eleme... |
I was struggling with this question for many times,
and I have solved it every time, because I understand the concept.
but I can never get to a good concise solution which is easy to follow.
In a coding interview I always choke when I see this question.
This is the best solution I was able to come up with.
Can the code... |
I decided it would be fun to implement Conway's Game of Life (CGOL) in Emacs Lisp as my first elisp script.
My goals for the implementation were pretty simple
Transform current buffer into the next generation of CGOL
Just use max height/width of the current buffer (don't worry about overflowing the space, keep it boun... |
Last year I tried to implement a micro service architecture in Rust. It was asked as a homework question in an employment interview process to be completed in a few days. The imagined use case was a small izakaya-shop where digital orders could be given to the kitchen tracked or deleted.
Looking for feedback both on my... |
I'm working on a feature for work that requires me to combine a set number of memory streams based on specific conditions.
Previous Code
Before based on documentation/examples online. In order to create a PDF to print, you have to create a Memory Stream and save that document into a Memory Stream. Here lies my old code... |
I made a prototype for a task processing systems.
Architecture
Worker - is a entity that is processing one-by-one tasks for the same processor.
Processor - (also: executable, app) executable file (language agnostic) that getting input from STDIN
and returning result to STDOUT with optional logs to STDERR. Return cod... |
Edit
If there is a better way to ask this question to avoid negative votes, please let me know.
I have looked into https://codereview.stackexchange.com/help/how-to-ask
How would I implement a class dedicated to returning html strings for a list of products/cart items?
Written as part of an interview assignment.
Simp... |
I got this problem on a HackerRank challenge and this was the best I could come up with. It's basically just using DFS to find connected components (in this case, friend circles). I was having a tough time figuring out how to track unvisited nodes. Please let me know how I can improve this code. It appears to work, but... |
Here I have a class where I'm checking if model_id exists in the table models_web_tbl.
Everything works like a charm but I just want to know if I'm on the right path.
class test extends dbh{
public function modelExist($model_id) {
$sql = "SELECT * FROM models_web_tbl WHERE model_id = ?";
$stmt = $this->connect()... |
I am currently working on writing a library for use with LIFX light bulbs over their UDP API. I have written the code for creating the packet headers, but I'm unsure whether it is the most idiomatic approach, as I am new to Clojure. Please tell me what you think about the following code.
(ns lifx-lib.packet.header
(:... |
I'm looking to find what security flaws this code might have. I believe it's immune to time attacks, passwords are stored encrypted, and I'm using sessions to store local data.
Let's assume the following:
All traffic is over SSL
Users have to re-authenticate after 30 minutes of inactivity
Login page:
{% block body %... |
Consider a struct with a name two Int values :
struct StructWithNameAndTwoInts {
let name: String
let from: Int
let to: Int
}
Now I want to compare two structs based on the values of from and to. There are three possibilities:
Not equal: from and to from both structs are different.
Half equal: Both froms ... |
In the start of one of my methods I have a section of code that needs to get three sub-lists of grouped dictionaries from a list of grouped dictionaries. This is a big list and I'm optimizing it a little by only looking at a smaller sub-list generated from a communal attribute.
Is there a faster a way to generate these... |
Since I'm new at this site I will try to start with something very simple.
I'm making an "Automatic insert" in a Excel Spreadsheet and my code is working correctly, but I'm not so sure about my way of coding. Does the code follow good VBA programming practices?
Here is my code:
Option Explicit
Sub inserisciAutomatico(... |
Please review for performance. and also naming convention
https://leetcode.com/problems/binary-tree-level-order-traversal/
Given a binary tree, return the level order traversal of its nodes'
values. (ie, from left to right, level by level).
For example:
Given binary tree [3,9,20,null,null,15,7],
3
/ \
9 20... |
Motivation
I want to run some compute heavy tasks on a separate process, so that they don't hog the GIL and I can make effective use of a multi-core machine.
Where those tasks are pure functions, I'd just use the provided multiprocessing.Pool. That, however, doesn't work as well for tasks that hold state. I'll assume ... |
I am a novice of Python and I am trying to understand how to use OOP paradigm to improve my scripts. My scripts usually read some data from a formatted csv file and perform some numerical analysis. Here is a short example:
SIMPLY SUPPORTED BEAM
NNODES <NNnodes><Node,X,Y>
2
1,0,0
2,1,0
This input is for a script for s... |
Here is my very first code which fetch data and add it to MySql. Please review my code and let me know if I'm on the right path. Is there anything I can improve?
postsData class = fetch and add data blog posts
categoriesData class = fetch and add data for categories of my blog. Ex: bmw, nissan, opel, ford, etc
connect... |
I have 2 maps. First map consists of order in which a specific set of services is executed. Second map contains execution time each service took. I need to display this information.
Following is my piece of code. How can this be improved by performance and syntax?
public static String getAllExecTimes(MasterVO masterVO... |
In Java, I use a LoadingCache which offers weakKeys
and I need something similar in Typescript, so I wrote the following:
function loadingWeakCache<K extends object, V>(loader: (k: K) => V) : ((k: K) => V) {
const cache = new WeakMap<K, V>();
return function(k: K) : V {
let v = cache.get(k);
if... |
My goal is to get a list of related statementIds in order of most repeated.
In my database I have stems(Words):
+---------+-----------------+
| Stem | StatementId |
+---------+-----------------+
| Hello | [2,46,62] |
| Good | [1,123,45] |
| Morning | [23,2436,12312] |
+---------+-----------------... |
How would you in a pythonic manner write a function that returns the common substring found at the beginning of a set of strings? This is my ugly attempt:
def common_start(s):
l = len(s)
if l == 0: return None
elif l == 1: return next(iter(s))
else:
i = iter(s)
start = next(i)
while start != ... |
I was working to upgrade some code to C# 8.0 and came across an interesting pattern with default parameters and non-nullable reference types. I'm working if it's clear enough to the caller.
Given this pre C# 8.0 code,
Task FooAsync(
Bar bar = null,
CancellationToken ct = default)
{
bar = bar ?? new Bar(); // ... |
Here is a custom Random<T> class which could be used as:
Random<int> random = Random<int>(10);
int zeroToTen = random.Next();
I also made it seedable through the ambient context, so the following is observed allowing to potentially have Seed anywhere above in the call stack to simplify unit testing:
Random<int> Number... |
Here is my solution to Grading Students courtesy of HackerRank. My code passes all tests in the testing suite but I feel like there could be a better implementation of it. But nonetheless, what are some pros/cons of my current implementation?
Thank you for answering.
def gradingStudents(grades):
rounded_grades = [... |
I have devised a novel sorting algorithm, named Oracle Sort, which I believe is far superior to all currently known sorting algorithms (under certain assumptions). It utilizes an oracle to achieve a constant time complexity with regard to both the length of the input sequence and the number of distinct elements in the ... |
check_prime.cpp
Description: Accepts user input to check if the user entered a prime number.
Notes: If any text inputted after an integer will be ignored.
For example: 1234.5678 and 98abc will be interpreted as 1234 and 98, respectively.
Please provide any feedback (positive or negative).
// check_prime.cpp
// Autho... |
This is a playable 15 puzzle game in Python and Curses. It consists of 2 files, a backend called fifteen.py and a frontend called curses_frontend.py. The idea is that different frontends could be built for different purposes.
fifteen.py:
from enum import Enum
from collections import namedtuple
import random
Coordinat... |
So I based my "algorithm" on the poke method defined by Persi Diaconis. You start with the card at the bottom of a given deck and then poke the top card into a random position in the deck. At first the probability of this happening is 1/52 but once a card is below the bottom most card it increases to 2/52 since there i... |
Just curious if someone could review my design, and implementation of the following requirements below. I am a mid level dev, and this is for a new job. I am looking for ways to improve, and your overall thoughts if you were the interviewer.
Code Test Instructions:
Write a simple application/service that accepts two i... |
I'm trying to set up some code to first test if the Vanilla JavaScript .animate() API is Supported, then if it's not check if requestAnimationFrame is supported and if it's not fallback to either setTimeout, setInterval or setImmediate.
I've been reading this e-book on google Smashing Webkit, which says that its always... |
I'm trying to solve a programming challenge where I have to find the median of given subarrays of an array. I have used std::vector's n_th element for this. But the evaluator fails some test cases as "time limit exceeded".
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
/*
In
6
2 4 5 3 1 6
3
1 6
2 4... |
I am going to undergo a code review shortly at work. I feel that my code is too verbose, could log more sensibly, and I feel that my if/else statements are somewhat duplicative/repetitive and can be done better. But I can't seem to be able to put my finger on what I am missing. How would you clean this up such that the... |
Recently got rejected in a code challenge that was a very simple WebService with 3 endpoins:
POST /transactions to add transactions with an ammount and timestamp.
GET /statistics to query the statistics of the transactions of the last minute.
DELETE /transactions.
I just pasted below Service object because the API ... |
For practicing purposes, I had the idea of making a sorting algorithm in Python.
My approach to it was to iterate through a given unsorted list to find the shortest number in it, add the number to a second list, remove shortest number from unsorted list, do that until the unsorted list is empty and return the sorted li... |
I have a little dilema with such if statement, I have tried optimizing it in order to remove some checks, but could not think of how to make this code part cleaner. Can someone please make a review, and tell if it's possible to optimize such statement of maybe there is some law for this? Thank you
//letter = 'E' or 'R'... |
I am working through the K&R and just finished exercise 1-12 and below is my solution.
Exercise1-12: Write a program that prints input one word per line.
#include <stdio.h>
main()
{
int c;
while((c = getchar()) != EOF)
{
if(c == ' ' || c == '\t' || c == '\n')
{
putchar('\n');... |
Tic-tac-toe is small enough to be solved completely but since I have a slow computer and this is an interesting exercise, I want to build the fastest possible minimax tic-tac-toe implementation in CPython.
I welcome any comments on style, performance and cleaning up code. Here are some points I'm particularly unsure ab... |
Given two input arrays [-1, 8, 3] and [3, 7, 2] your function will return true if any two of the numbers in the first array add up to the any numbers in the second array.
\$-1 + 3 = 2 \therefore \text{True}\$
My algorithm simply takes all the pairs from the first input and check if they exist in second array set which ... |
I am quite a novice. The below code does what I require but I was hoping you could help me speeding it up and simplifying it please. I know should start with basics when learning VBA..but it's just so exciting.
Probably it would be faster if I applied For i to x, next i method
Could you please help or guide me to a bet... |
I segmented an image into N superpixels and constructed a graph based on that in which each superpixel is considered as a node. The information about neighbor superpixels is stored in glcms array. The weight between each pair of neighboring superpixels is stored in matrix W.
Finally, I want to compute geodesic distanc... |
I am trying to create a list based on some data, but the code I am using is very slow when I run it on large data. So I suspect I am not using all of the Python power for this task. Is there a more efficient and faster way of doing this in Python?
Here an explanantion of the code:
You can think of this problem as a li... |
What is the best way to move _add and _preorder methods in class Node to add_node and preorder methods in class BinaryTree such that they have the below class structure:
class Node:
__init__
__repr__
class BinaryTree:
__init__
add_node
preorder
Complete Code::
class Node(object):
def __init__... |
I have been teaching myself python in my spare time and so far I think I have figured out the basics. However, I am fairly certain that my code is extremely unprofessional and the way I write it is incorrect. So far, I have been going on a "If it works don't screw with it" philosophy but I would like to learn how to ac... |
Here's an example how to construct an external sorting algorithm from the Quicksort. The method may be applicable to other known internal comparison sort algorithms. I have checked that it shows N*logN time complexity when fed with random file, and almost exactly 0.5 N square when input is already sorted. But I am not ... |
How may this code be improved upon, the user inputs array of specified length and replaces each element that is smaller than the mean of the first and last element with the mean.
Is there a better way to pass the array to the function (ref/ptr, etc.), or more efficient way to manage memory (when handling array)?
I know... |
Is there a more idiomatic way to handle the following scenario? I'm open to lodash, etc. if needed. This does what I want, but I feel that there is probably a shortcut I'm missing:
const migrateValues = (obj, srcKey, destKey, value) => {
updatedSrc = [];
obj[srcKey].forEach(x => {
if (x !== value) {
... |
Often when I find myself working with magic number enum values and I want to know what they represent, so I create an array of strings in order to print out their label.
This macro automates that process.
//#define DEBUG
#define GENERATE_ENUM(ENUM) ENUM,
#define GENERATE_STRING(STRING) #STRING,
#define GENERATE_ENUM_LI... |
I made this so I can feed it integers and return an array with all the divisors of that integer. I put checks in in case the integer is less than 2. Order of integers in the array must be smallest to largest. The code works. What I need is to optimize this code to be as fast as possible. Right now on an online IDE... |
I have this jQuery handled buttons. But I think I overdid it with the if else statements.
I am wondering if the code can be more efficient in some way than what I have. It's mainly voting up and down. So what is does is toggle buttons and inserts HTML.
function handleVote(commentid, voted, type){
$.ajax({
url... |
I am writing code to write a C template file; the executable takes two arguments (main) <file name> and <no of questions> and outputs a file with a file named argv[1] and inside which there are n no of functions with n+1 switch cases in main() calling those functions; where n = argv[2].
Problem
My problem is with the ... |
Please take a review of my simple .ini config loader / saver:
//
// value wrapper
//
class IniEntry {
public:
//
// default ctor
IniEntry() {
}
//
// copy ctor
IniEntry(const IniEntry& rhs) : _Data(rhs._Data) {
}
//
// move ctor
IniEntry(IniEntry&& rhs) noexcept : _Data(... |
I was recently in a situation where I had to use vanilla js (no es6 and no http libraries, so I came up with this simple wrapper for get calls :
var Http = (function() {
function Http() {
this.xhr = new XMLHttpRequest();
}
Http.prototype.get = function(url, onload) {
this.xhr.onreadystatecha... |
I have the following table in a PostgreSQL DB (simplified for the question), where I want to select only the rows marked with *:
uuid | status | info1 | info2
-------------------------------
1234 | CONF | - | 10
1234 | START | abc | 10
1234 | FIN | abc | 10 *
-------------------------------
7890 | CONF ... |
The following method is used to add objects to a polymorphic ArrayList from a file.
It reads lines from the file, and based on a specific line which denotes the category of the product object, it uses the loadFromFile() method of the specific class, before moving onto the next. We are taught to build programs in such a... |
I'm trying to create a sorted array based on the below input data:
Input:
[{"title": "100_baz"}, {"title": "01_foo"}, {"title": "05_bar"}]
function indexSort (input) {
let output = [];
input.forEach(value => {
if (value.title && value.title.indexOf('_') !== -1) {
let targetIndex = pa... |
I'm new to programming; I started about a week ago and started learning python.
Currently, I only know some basic arithmetic operations in addition to some basic knowledge about lists, dictionaries, strings, etc.
I tried testing what I learnt so far. I made this prime number checker, which works except when the numbers... |
I've been writing code to get the frequencies of elements of an array. The code works, but it uses a lot of "old style" C constructs, some of which I feel should be changed to more C++-like features, but I don't know exactly which way would be best. In general, I feel that a lot of the code could be improved to be more... |
I have implemented Visitor and Decorator Pattern in python. I am much used to java design pattern style and hence thought would try in python as well. Could anyone tell me if this is the correct way to do in Python.
Is there any better way to do this?
I have made coffee class and decorating it with Sugar and Milk. I h... |
The challenge is to find the maximum product of a subset of a given array. Here's the problem:
Write a function solution(xs) that takes a list of integers
representing the power output levels of each panel in an array, and
returns the maximum product of some non-empty subset of those numbers.
So for example, if ... |
I have this specific scenario where I'm going to get a JSON that could have multiple Objects. From the Multiple Objects I will create a new Json that can have nested arrays growing by n amount depending on some json object values.
I hoping there is a better way to do this. Maybe my example below is the best way? I took... |
So I want to create a very basic constantly changing text bvariable with a counter function. I created it, and it is working well, but once I press the "countdown" button, the GUI freezes, and the only way to close the window is from PyCharm.
Any suggestons about what causes the freeze and how to fix it?
The program un... |
I have the following function which has the required functionality. Is there any way that I can reduce the code but have the same functionality?
addClickEventListeners = () => {
let multipleChoiceQuestionButtons = document.querySelectorAll('[name="multiple_choice"]');
let trueFalseQuestionButtons = document.querySe... |
I was assigned an university project where I had to parse directed graph files coming from SNAP and then convert them into CSR (Compressed Sparse Row) format. Then the client must have the ability to perform connection queries between any 2 vertices by using Bidirectional BFS.
Here is my implementation:
Main.java
publi... |
Suggestions to better understand when and how is convenient to use OPP.
This question is a follow-up question on this post.
I have a script that reads an input file. In time, the script may be modified to account for new elements, that are directly added in the same input file. I would like to better understand how OOP... |
what is proper way to save all lines from text file to objects. I have .txt file something like this
0001Marcus Aurelius 20021122160 21311
0002William Shakespeare 19940822332 11092
0003Albert Camus 20010715180 01232
From this file I know position of each data that is written in file, an... |
My goal was to create a portfolio site for my motion design work. The website should be modern and intuitive, yet pose a good gallery. Please also comment on the dark mode functionality and responsiveness.
The full website is hosted under timlwsk.bplaced.net (good domain coming soon). The contact form isn't working yet... |
I've found an explanation on Wikipedia on how to validate an IBAN. Since the number generated from the transformation can cause overflow with all data types available in VBA, I've worked with String.
I'd like to have someone else review. Thanks in advance!
From Wikipedia:
Check that the total IBAN length is correct as... |
I have a working solution to my problem, but I'm less than satisfied with the result, both when it comes to style and performance.
In short, I need to be able to shift 256 bits of data, say an array of 4 64 bit integer, by n bit, right and left. If other type are easier to work with for some reason, it's really all the... |
I'm a beginner programmer and I came upon this problem which is to find the nth number in the Fibonacci series.
I used to solve the problem using a for loop; today I learned about recursion but there is a problem: when I pass 40 or 41 to the recursive function, it takes a bit of time to calculate it, while in the iter... |
I am mapping a complex JSON response to two JPA Entity model classes using Jackson.
The classes are CxExport and Mention, Mention has a Many to one relationship with CxExport I.e. Many mentions belong to one CxExport.
The HTTP Response returns a List of mentions
2. The JPA model is a flattened instance of one of the li... |
I have the following relationship in EF Core 3.1.1 (Many-To-Many):
public partial class Movie
{
public Movie()
{
Directors = new HashSet<MovieDirector>();
}
public int Id { get; set; }
public string Title { get; set; }
public virtual ICollection<MovieDirector> Directors { get; set; }
}... |
I've been studying Java for some days and I'm just now starting to make some simple programs, I'd like to know if there's any 'noob' mistakes or habits that I could avoid.
In other words: how could my code be more streamlined to Java?
My code:
import java.util.Scanner;
public class Main
{
private static String rev... |
I am trying to implement a greedy zip method in Haskell where it does not drop the elements, instead, it will use some default value. I appreciate any feedback to make it more compact.
zip' [-1] [] r = r
zip' [] [-1] r = r
zip' [] b r = zip' [-1] b r
zip' a [] r = zip' a [-1] r
zip' a b r = (xa, xb) : (zip' xsa xs... |
I have a list [5,2,7,4,3,2,0,8, 9,100,99,98,97,93,92]
i need out [100,99,98,97]
but i am getting 4, 3, 2, 100, 99, 98, 97, 93, 92
`arr=[5,2,7,4,3,2,0,8, 9,100,99,98,97,93,92]
z=[]
l=[]
for i in range(len(arr)-1):
if(arr[i]==arr[i+1]+1):
if(arr[i] not in z):
z.append(arr[i])
... |
Below is code for handling events in SFML. It works by reading a text file containing a sequence of functions to be called when a given event is detected:
EventManager.hpp
#pragma once
#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>
#include <vector>
#include <unordered_map>
#include <functional>
#include <fst... |
My solution to the LeetCode's Subtree of Another Tree passes all the test cases, but the code feels and looks ugly. Would appreciate an advice on how to improve it.
The problem:
Given two non-empty binary trees s and t, check whether tree t has exactly the same structure and node values with a subtree of s. A subtree ... |
Is the code below safe to create unique ids for objects?
I will create new yoga classes and need to have a unique id for each class. I made this small piece of code to generate the id numbers.
Regarding specifically the uniqueIdCreatorHandler method, would this solution incur in bad performance, or is it just far from ... |
So I have a method that, after validation, generates a random password based on the length and characters provided. The UI uses check boxes to select using between lowercase and/or uppercase letters, numbers and special characters to populate the characters parameter. as well as the length of the password and the spaci... |
Why am I fighting the compiler? - Wrote this, which works, but I feel like I'm breaking every rule in the book:
#[macro_use]
extern crate lazy_static;
use std::ffi::OsString;
use std::path::PathBuf;
use std::str::FromStr;
use actix_rt;
use actix_web::client::Client;
use async_std::fs::File;
use async_std::prelude::*... |
Given the models below:
class Structure(Model):
...
class StructureComponent(Model):
...
structure = ForeignKey(Structure)
parent_component = ForeignKey('self', null=True, ...)
Developer should synchronize with the database a list of trees:
The sample of request data:
{
'trees': [
{
... |
I want to improve quality of this symfony rest endpoint (solid principle, Kiss, best practice...) Can you review my code please?
Symfony controllController function that return json list of product
/**
* @Route("/api/products/my_list/{number}", methods={"GET"})
* @param Security $security
* @param BeamyAPI $beamyAPI... |
I'm trying to learn Javascript and I've set up a bill calculator. Most of the lines in the code are to deal with rounding. It has four main components:
Allows you to enter the bill amount and tip percentage.
Calculates the total bill divided by the number of guests.
Calculates the total tip.
Splits the bill by the num... |
I have done a clustering algorithm and represented the results in a pie chart as shown below.
fig, ax = plt.subplots(figsize=(20, 10), subplot_kw=dict(aspect="equal"))
contents = []
for k,v in clusters.items():
indi= str(len(clusters[k])) + " users " + "Cluster_"+ str(k)
contents.append(indi)
#contents = ... |
So I'm writing a game emulator and would like some advice after finishing the networking. It is designed to accept multiple connections, and process messages from all of them.
Here is just a brief introduction to the packets and how they are structured. [lengthOfString:short][stringEncodedInUtf8:Byte[]]
Let's start wit... |
I'm working on a little endian machine and in my program I need to convert 2,3,4,5 or 8 bytes into network order before transmitting them over the network. I've written the following function which basically just reverses the bytes. I just wanted to make sure if it's logic is correct.
void convertLittleToBig(const uin... |
An abstract base class which derives from the ObservableObject (MvvmLight), implementing the INotifyDataErrorInfo interface.
The model (exposed via the ViewModel) binds directly to the view, to avoid duplication of properties.
A couple of notes:
a) I chose the HashSet<string>> to avoid duplicate errors, e.g. "The numb... |
Recently, I've received negative feedback of interview's test. They say that they need somebody with higher technical level, the quality of the task was not good enough.
I upload it here, to request your knowledge and teach me how to improve it to improve my development skills around Google Maps and Marker placing.
The... |
I have two classes ExceptionLog and DebugLog
public class ExceptionLog {
public static String StackTrace {get; set;}
public static String ClassName {get; set;}
public static String MethodName {get; set;}
public static String LogType {get;set;}
public static Exception ex {get;set;}
public Static... |
I had a 50 GB text file (about 45 million lines) and needed to extract about 1500 lines from it. I knew their indices, that is, line numbers. Those 1500 lines were spread across the whole file up to the very end. To accomplish this, I wrote a simple Perl script. It worked and was quite fast: it finished in about 4-5 mi... |
I'm looking to speed up an Rcpp function I have written.
The function takes in a string called vcfield, which takes the format od x:y:z. This string has 3 fields if you separate it by the :. It takes an int DSfield which tells us the index (0 based) field from vcfield which is the dosage. Dosage is always one double v... |
I have small (<250 bytes) chunk of binary data, where I know that almost always, the first nibble is going to be zero 0. For example, in hex:
01 02 03 04 0A 0B 0C 0D
I want to do some simple compression on this data. What I've decided to do is run length encoding, but I first need to get the data such that all the e... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.