instruction stringlengths 71 71.9k |
|---|
I have made a class for some Netapi32.dll functions in C#. I would like to know if there are any big problems with it or if there is some other function needed in general.
Functions:
NetFileEnum
NetShareEnum
NetFileClose
NetSessionEnum
NetApiBufferFree
Here is the class:
using System;
using System.Collections.Generic... |
This is codeEval challenge to count the number of chains possible to make with beads holding numbers. Constraint is sum of the consecutive beads of chain should be a prime number.
The standard algorithm std::next_permutation is very resource oriented in this case, so dropped the idea to use that one.
I created a simple... |
For the following question, the function
• should mutate the original list
• should NOT create any new lists
• should NOT return anything
Functions that do not create new lists are said to be ”in place.” Such functions are often desirable because they do not require extra memory to operate.
Implement the function map_... |
I am working on a Roman numerals calculator. For an input validity test I'm using this function:
bool isValidRomanNumeral(string& roman){
// no test for one-digit Roman numeral
if (roman.size() == 1) return true;
for(size_t i=0; i<roman.size()-1; i++){
// each more significant digit is either >=... |
Project Euler, problem #50:
The prime 41, can be written as the sum of six consecutive primes:
41 = 2 + 3 + 5 + 7 + 11 + 13 This is the longest sum of consecutive
primes that adds to a prime below one-hundred.
The longest sum of consecutive primes below one-thousand that adds to
a prime, contains 21 terms, and is ... |
I'm looking for feedback on functionality, PEP8, advice, etc as a learning tool. I'm not sure how to tell if this program should be broken into separate functions or combined as one.
While hand editing files for an organization I work for, I made this code having seen an opportunity to simplify "How to Integrate Excel... |
I have the following sample code running unit tests:
#!/usr/bin/env python3
import sys
import unittest
import argparse
class ParentTest(unittest.TestCase):
None
class Test1(ParentTest):
def test_if_verbose(self):
import __main__ # FIXME
print("Success!") if __main__.args.verbose else "" # FIX... |
I have the following code:
#!/usr/bin/env python3
import os, argparse
if __name__ == '__main__':
# Parse arguments.
parser = argparse.ArgumentParser()
parser.add_argument("-v", "--verbose", action="store_true", dest="verbose")
args = parser.parse_args()
try:
verbose = bool(os.environ['VER... |
I am working with Youtube OAuth for the first time and I am not that great when it comes to security. I got the following code and would like to hear if you guys can find any security issue:
$code = $_GET['code'];
$url = 'https://accounts.google.com/o/oauth2/token';
$params = array(
"code" => $cod... |
Back in my calculator post, janos suggested I either find a better way to read a double from a StreamReader or else go the whole way and build a double from scratch. I looked through a few streams, but the only one I found that supported reading a double was the BinaryReader. This, unfortunately, reads exactly 8 byte... |
Given the problem:
You are given a 2-Dimensional array with M rows and N columns. You are
initially positioned at (0,0) which is the top-left cell in the array.
You are allowed to move either right or downwards. The array is filled
with 1's and 0's. A 1 indicates that you can move through that cell, a
0 indica... |
I got asked at an interview to write a program that, given a NxM matrix with zeros and ones, prints out the list of clusters of 1s. The clusters are defined as patches of 1s connected horizontally, vertically or diagonally.
Here's the code I submitted but I'm wondering if there is a better way, e.g. a well-known algori... |
This is done in the style of a single class, that should work like any other io-based object in Python. Help is much appreciated with anything regarding performance, documentation, or anything else.
import io,win32file,win32pipe, win32api
import msvcrt as ms # for fd magic
class pipe(io.IOBase):
def __init__(self, ... |
I am looking for better ways to write this code. At the moment it grabs a list of all navigation items and places them into an array (using PDO).
However, as you can see, it is using two foreach loops to grab the subnavigation items under each parent. Is there a better way that this code can be written?
<ul id="nav">
... |
I wrote this little page to calculate the least weight and/or optimum gold amounts for DnD for 4th and 5th editions.
I think I've managed to refactor it to its best, but I have little experience with JavaScript so I would like a critical review of what I have done so far.
Public version to try
<html>
<head... |
This piece of Angular code is used to add/remove an item to a favourite array and display it on page load. Firstly I check if I have an array and then create one if not. It also checks the localStorage on page load.
How can this be improved?
$scope.favourites = $localStorage.favourites;
$scope.addExerciseToFavourites ... |
For the following question, the function
• should mutate the original list
• should NOT create any new lists
• should NOT return anything
Functions that do not create new lists are said to be ”in place.” Such functions are often desirable because they do not require extra memory to operate.
Define shift_left, a functi... |
The problem is :
The sequence of triangle numbers is generated by adding the natural numbers. So the 7th triangle number would be 1 + 2 + 3 + 4 + 5 + 6 + 7 = 28. The first ten terms would be:
1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ...
Let us list the factors of the first seven triangle numbers:
1: 1
3: 1,3
6: 1,2,3,6
10... |
I've written a ruby implementation for Sieve of Eratosthenes algorithm, however benchmarking it against the Ruby's Prime module I have still a far slower algorithm - and I am struggling to understand why.
require 'set'
def numbers_with_multiples_less_than n
(2...(Math.sqrt(n)).ceil)
end
def primes_till n
possible... |
I'm trying to implement my own API. This code excerpt should show the basic working routines. The storage is temporary an in-memory-array and the only HTTP method for now is POST.
I outsourced the parsing into ParseRecordRequest(), because I use the code twice for POST and PUT requests and will extend it with further c... |
I'm trying it out just to see if I could solve it. It would be great if I could receive tips on how to improve it.
//input
var decimal = prompt("Please enter a decimal number");
if (decimal >= 1 && decimal < 1000000000) {
//convert to binary
var binConvert = parseInt(decimal, 10).toString(2);
//reverse bin... |
When sorting by multiple keys, I need the second key to alternate between standard and reverse sorting. This is to minimize the change in the second key. For example, if I have a list of dictionaries, I want the first sort (group key) to be sorted and then the second sort (sort key) to alternate. This should produce... |
I'm solving "mastermind game" problem from CIS haskell course. Here is the link to assignment pdf if someone is interested.
List of possible colors is defined like this:
data Peg = Red | Green | Blue | Yellow | Orange | Purple
deriving (Show, Eq, Ord)
type Code = [Peg]
colors :: [Peg]
colors = [Red, Green, Blue, Y... |
I'm adding some functionality to an existing library of data structures in Common Lisp, with a view to asking the original author if I can take over maintenance and development of it. While the original code is very well-organized, one of the features it didn't have was a way to iterate over the contents of a tree, suc... |
I am serializing and de-serializing a class object within the class which is then sent over the network like this:
class data
public name as string
public cmd as Commands
public message as String
Public Sub New(ByVal byteData As Byte())
Try
' convert byte array to memory stream
... |
This code gives me info of a movie and the movies directed/acted by corresponding director and actors. It is working as the way I expected but I included lots of try and except statements and as a result my code is slow. Is there anyway to speed this up?
from imdb import IMDb
def rating(name):
p1 = ia.get_movie(i... |
I started reading a Clean Code book and some other articles on the Internet about OOD and design patterns and I'm a little confused. I've started to code a little string to integer parser which currently parses a first integer in string larger than 0 or returns -1.
Could you look and give me some idea if this is writte... |
I've created a fairly simple word search generator/solver. I'm looking to improve on picking the right algorithm to tackle problems like this, so any criticisms on my code would be greatly appreciated :)
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<ctype.h>
#include<time.h> //for stop watch
#includ... |
I'm getting three inputs and based on those three inputs, I'm returning. Input items may vary, so I used CASE WHEN statements here.
Is this code correct? If so, how can I make it more optimized?
ALTER Procedure [dbo].[WP_GetAllItems]
@IsActive bit,
@OrderMode bit,
@OrderBy varchar(75)
as
Begin ... |
I don't have formal training in coding, so I would like some input in my code. It is working really well, without any issues. I just wanted to see if I can somehow improve my code. I divided the major things into separate function.
Here is a working demo.
(function($) {
// Use _ to template the resultsTemplating de... |
I have written the following code for my personal website, in Jade and Stylus. Can anyone review this code? Are there any tips that you can give me on how to make it better?
GitHub
main-page.jade:
doctype html
html(lang="en")
head
title Darcey Mckelvey
link(rel="stylesheet" href="/css/main.css")
body
he... |
This is something that I am proud of and would like to have people dissect and tell me where my faults are in. I feel that if I open my best for criticism then maybe it will reveal the deep seeded bad habits in my coding.
I know about the null format for the frame in the main class is not kosher. So, please skip over t... |
For the following question, the function
• should mutate the original list
• should NOT create any new lists
• should NOT return anything
Function that do not create new lists are said to be ”in place.” Such functions are often desirable because they do not require extra memory to operate.
Define "filter_mut", which t... |
.data
D0: .byte 0x04; first number
D1: .byte 0x03; second number
.bss
R0: .space 2;result
.txt
_main: ..
..
CALL mySUB
..
mySUB: ...
....
return
.end
Given above, write a program that would read the numbers (in D0 and D1) and call a subroutine, mySUB, that adds the t... |
Follow up of this question.
Things altered:
Put logging (debug level) for creating and starting thread.
A separate thread for starting the different threads.
Locking object and synchronise for starting the threadIncreaser.
Changed the while condition of the while loop of threadIncreaser so getting the size of the que... |
I'm currently writing a small asset tracking system.
The implementation should meet the following requirements:
The system; scans the transfers every 15 minutes. If the transfer is
accepted by the receiver by the specified transfer time, realizes the
transfer. When a transfer is realized, assets are assigned to th... |
I decided to write a sieving prime-finding programme and make it fast. It works correctly but counting the primes below 10**9 takes 36 times as primesieve downloaded from http://primesieve.org/.
Now I understand that they have a World Record so they better be fast, but we all know that a compiler is much better than a ... |
#ifndef ANY_H
#define ANY_H
#include <typeinfo>
namespace _notYourNp
{
struct BaseHolder
{
BaseHolder()
{}
virtual ~BaseHolder()
{}
virtual BaseHolder* clone() = 0;
};
template <class T>
struct Holder : BaseHolder
{
Holder(const T& type)
... |
I have an action that does two things:
It sends a chain of commands, and gets the response from an external API that we call wrapper.
It logs the chain of commands and the tunnel (look at tunnels as different machines) the command was sent to.
My problem is the contents of the if statement. The two things (sending th... |
I've written this and it works great. Is there any shorter or simpler way to achieve the same result without distinguish between cases?
Node* recursive_ordered_insert(Node* head, int val)
{
//special case: first elem is null
if (!head)
{
head = create_node(val);
return head;
}
//sp... |
EDIT: This question is followed up by this question.
I'm in the process of filtering some very(!) large files (100gb+): I can't download files with a lower granularity. This is a followup from this question.
The problem is as follows: I need to filter large files that look like the following (3b+ rows).
TIC, Date, Ti... |
One day, I was thinking:
Wouldn't it be nice to set a class and have all the styles defined?
And that is exactly what I did: a PHP file that generates CSS with pre-defined styles. So, for fun, I built the following:
<?php
if( @is_file($file = basename(__FILE__, '.css.php') . '-config.php' ) )
{
$conf... |
In honor of Star Wars day, I've put together this small Python program I'm calling JediScript. JediScript is essentially a scrapped-down version of BrainFuck without input or looping. Here are the commands in JediScript.
SlashWithSaber: Move forward on the tape.
ParryBladeWithSaber: Move backward on the tape.
StabWith... |
I am saving (image) files to PostgreSQL database in my Node.js and Express server application. The code is used to upload user images to server (at the moment it is not restricted to image files in any way though, but that's not the point). The files are sent as multipart requests and they are parsed using Busboy. Thes... |
I'm building a program to scrape data about hockey games in order to compile statistics. One of the run modes will process all of the games in a single season (1230). Processing a single game consists of scraping, parsing, calculating and persisting gathered data and needs to be performed synchronously, but multiple ga... |
My function is supposed to go through a given List<Integer> and find integers of same value, but only count them if the integers between them is <= the the integers that are equal:
public static int findPairs(List<Integer> arr) {
int total = 0;
for(int i = 0; i < arr.size(); i++) {
for(int ... |
To give a little context before showing the problem:
I am creating a RESTful web application. A User can have multiple addresses, emails, phones and projects. Each of these is represented similar to the following object model, (Address in this case).
public class Address {
String type; //home or work etc.
Strin... |
Is it reasonable to mix Control.Lens operations with the ones provided by the "standard library"?
Consider the following fragment using qualified Data.Map as Map:
getUniqueIdent :: String -> State (Map.Map String Int) (Maybe String)
getUniqueIdent typeName = do indices <- StM.get
let identi... |
I'm just hoping if there's a way to simplify this recursive code that takes 2 sorted lists and combines the two together in a sorted manner (without actually having to re-sort them).
def merge (l1,l2):
if len(l1) == 0 and len(l2) == 0:
return []
if len(l1) == 0:
return l2
if len(l2) == 0:
... |
3 string trimming functions:
Trim whitespace from the beginning of a string.
Trim whitespace from the end of a string.
Trim whitespace from both ends of a string.
Looking to improve code for:
Correctness (tested code - but so far no holes) - especially overlapping src/dest cases.
Design
Portability (3 tried: ... |
I'm looking for some general tips on code practices, doing things properly in idiomatic pythonic way. But mostly I want to know if this was build correctly. I tried making neural nets in the past, but failed horrible, but this one seems to be working fine.
The backpropagation method is still not developed because I sti... |
This code exists in my home repo and in general nobody else has really touched it. Living in such a vacuum has left me kind of uncertain of the actual code quality and correctness which is why I am approaching this site hopeful for a second set of eyes.
This is implemented and working, however what I am interested in i... |
I made a simple Question "system":
Answer
Stores an answer (string) and a boolean value to check if the answer is correct or not.
public class Answer {
private String answer;
private boolean isCorrect;
public Answer(String answer, boolean isCorrect) {
this.answer = answer;
this.isCorrect =... |
This is the first PHP script I have written. It downloads and installs a plugin called "anti-spam" by using the WordPress API. It also provides an option to either delete all comments or delete the comments, which are unapproved or marked as SPAM.
<html>
<head>
<title>SPAM tool</title>
<style>
f... |
I've written a Sudoku puzzle generator. It currently runs through each line of the 9x9 grid and places numbers randomly if they're valid. It loops over all the numbers from 1-9 and then if it finds itself trapped in a corner with no valid answers it throws out the whole board and restarts.
I tested it by making 1000 pu... |
I was said to post this as a new question. I improved my code from:
Little part of the string to integer parser vs Clean Code
However I think that it break SRP as it parses, iterates through string and checks if letters are numeric. Could someone involved in OOP say what does he think of it? I agree that wrapping Index... |
I have 5 different forms where I am disabling the submit button when a valid form is submitted so the form can only be submitted once. I am using a hidden field on each form to get the form Id.
function OnSubmit(buttonId) {
var disableButton = false;
if ($('#formType').val() == 1) {
if ($('#CreateEntityName').val(... |
This code asks the user to enter a message containing the lower case characters a-z, it then encrypts it into a Vigenere Cipher and also decrypts the cipher to prove the reverse lookup works.
package com.testing;
import java.util.Scanner;
/**
* A Vigenere Square or Vigenere table consists of the alphabet written out... |
An error in a live environment was detected when trying to convert string geo coordinates into a double.
The current culture (hu-HU) uses comma instead of point for the decimals and that produced an exception when trying to parse Double.Parse(47,545874)
That's why I'm using CultureInfo.InvariantCulture and the reason ... |
The following function appends a tuple to two Maybe [a]'s.
tupleToMaybeList :: (a, a) -> Maybe [a] -> Maybe [a] -> Maybe [a]
tupleToMaybeList (a, b) cs ds = do
x <- return a
y <- return b
xs <- cs
ys <- ds
return ((x : y : xs) ++ ys)
Please critique it for idiomatic Haskell-ness.
|
Is the algorithm correct? It seems to work.
print("Multiple sequence longest common subsequence implementation in Python.\nFor example a naive algorithm would perfom c*128^128 elementary operations on a problem set of 128 sequences of length 128 elements.")
print(" That is: ", 128**128, "operations.")
from collections... |
I'm learning about Gauss-Jordan Elimination, and decided to write a program to automate the process to help solidify my understanding. Along with the algorithm itself, I wrote a Matrix class that has methods for the 2 required row operations (Adding a row to a row, and multiplying a row by a constant). My main concerns... |
I'm in the process of filtering some very(!) large files (100gb+): I can't download files with a lower granularity. This is a followup from this question.
The problem is as follows: I need to filter large files that look like the following (3b+ rows).
TIC, Date, Time, Bid, Offer
AAPL, 20090901, 09:45, 145, 145.5
AAP... |
I need to append some query parameters to my API URL. The consumer of my API would pass me this optional structure called as APIParameters, which contain 5 optionals, one array of strings and rest strings
Lets assume the following:
let baseURL = "baseURL"
let path = "path"
This is the final URL structure
//assuming s... |
I feel I have overcomplicated the process. What can I do to improve the following code?
ids = []
File.open(filePath, "r").each_line do |line|
i += 1
parts = line.split(',')
parts[1] = parts[1].to_i
parts[2] = parts[2].to_i
# If the id doesn't exist in our ids array then create it and add the
# second id... |
I have written the following script that is pointed at a CSV through it's file name and then splits the file into "drops" (for mailings) and does a couple of operations on it. As of now it works, but seems fairly slow when I use it on any significant number of records (>5000). Also there is a section in there where I n... |
public class ArrayUtil {
/**
* Field INPUT_LESS_THAN_TWO. (value is 2)
*/
private static final int INPUT_LESS_THAN_TWO = 2;
/**
* Method removeDuplicateElement. Given a sorted array of integers, this
* method removes the duplicate elements. Input array is sorted array and
* can ha... |
I know that I'm not suppose to alter a Set as I iterate through it. But, in the deleteRow(String counter, String reading) method below, doing just that will make the code much more readable and clean.
Because there is so little going on in each iteration:
Is there risk?
Would a respectable coder look at that and c... |
This is a probe request packet sniffer using python/scapy. It sniffs Dot11ProbeReq packets and display the ssid, MAC of device and manufacturer name from the probe requests. Can also output the data to a log file if desired. Right now I feel the script is a bit slow and I can see it slow down from the first time I wrot... |
The following code is from a utility I've written for myself.
It takes a file in this format:
[SOME_CODE]
Some following text
[SOME_OTHER_CODE]
Some following multi-line
text
And then outputs a C header file containing some #defines with the strings encoded.
The bottom function, convert, is the one I'm scratchi... |
Here's an implementation of a class which is similar to std::map, but it's not a complete/identical implementation.
I know C pretty well, but am a beginner with C++, so it took me some time to figure out a couple of things, e.g. how to implement an iterator. For now, the iterator only goes forward, because I didn't fig... |
For a bioinformatic problem, I found myself wanting to create a list of strings within Hamming distance "k" of a reference sequence. I wanted to do so quickly and pythonically. I've implemented it in pure python and in cython, with and without type declarations. The time performance has been identical. (I also compared... |
Title says it all. I'm basically initializing a two-dimensional array and changing the fields one at a time.
It might be a good idea to do this OO.
A Grid class seems right, perhaps as a subclass of Array. So far I haven't been able to successfully port it. Pointers would probably be a good idea as well.
Note this is k... |
So, back in this question, I built a set of settings. Now, I am trying to clean the entire system up.
This is the abstract base class:
public class SettingChangedEventArgs : EventArgs
{
public int NewSetting { get; private set; }
public SettingChangedEventArgs(int newSetting)
{
NewSetting = newSet... |
I made a snake game with /some/ code from thenewboston's tutorials when I had just started Python. I think it wasn't a good idea to start game development right away since I didn't even know if what I did was correctly coded.
I didn't use classes and objects since I didn't know how to use them. I'm sure this needs a l... |
My app will be running on an iPad with A7. I pass in 3 JSON arrays and right now do some simple filtering, in the future the operation will be much more complicated. I realize the if statement is slowing down the process, but how can I avoid it? Is there a way to have this loop on one CPU and run the GUI on the other... |
Please review my implementation of Fermat's Factorization.
fermat :: Int -> Maybe (Int, Int)
fermat n = odd' n >> (go $ ceiling $ sqrt (fromIntegral n))
where go a = case (try n a) of j @ (Just _) -> j
Nothing -> go (a + 1)
odd' :: Int -> Maybe Int
odd' x = if (odd x) then J... |
This function is used for <iframe> HTML element unwrapping. Most of the lines are repeated. How can I simplify this function?
<span id="pc1430828456801" class="optins">new insert text</span><span id="pc1430828456801" class="optdel">perturbative</span>
I have the same ID for both classes. I want to remove tag and inner... |
I have a library which is running in different datacenters in production. I have three datacenters in production:
DHP, SLP, LTR
Depending on which datacenter code is running, I need to return two string one is LOCAL_STRING and other is REMOTE_STRING.
Our machine name is like this in production and it is also possible ... |
I've created a form to choose the settings. These settings are automatically saved in a file from the game client in this form:
["Setting"] = {
["track"] = "Water Shield",
["duration"] = {
["minimum"] = {
["enabled"] = 1,
["value"] = 50,
},
["maximum"] = {
... |
A page contains a table of links, each link contains a table relevant to the link (a subject). Create a list of these links to pass to the function called scrapeTable which then takes the table and stores it in a CSV file. A directory of files are created for each subject which are then merged into one master file.
I'm... |
I have a class that receives an Object object as a parameter. Then, I want to write two functions to serialize, and deserialize the given object respectively.
public class ObjectWrapper implements Serializable {
private static final long serialVersionUID = 1L;
private byte[] bytes;
private Object object;
... |
It's big, it's ugly, but it should work. My question is: how could I have implemented the "typeselection" function so it is less repetitive? Any tips on other improvements in coding style are welcomed as well.
import math
import turtle
class Triang:
#MATHS FUNCTIONS; THESE GET CALLED WHEN PROGRAM HAS DECIDED ON TRIANG... |
I am new with Rx.net and tried to do a folder watcher that could send a notification when a new file is done being uploaded. Each instance check one and only one folder.
Here are the steps to achieve that:
Must check folder content each x Seconds.
Clear the "already sent" list of files that are no more in the folder... |
I've been building an MMO in Java for a game that will have clients built with libGDX. I have already built clients for the browser, desktop, iOS, and Android. To accommodate multiple platforms, websockets are used, and all messages sent back and forth are in the form of strings.
The purpose of the scheduled refreshA... |
I began working on a Java library that receives a boolean expression such as not A and (B or not C), compiles it to a circuit of logical gates \$\mathcal{C}\$, minimizes \$\mathcal{C}\$, and converts back to a (possibly shorter) boolean expression. Now, first things first: I need to be able to tokenize each input expre... |
Below is a PHP script which dynamically finds and process all of the form elements such as inputs, textareas, dropdowns etc... then organize them into a table as shown in the image below when sending the recipient.
I am new to PHP and what I have put together below is made of many snippets from across the web with som... |
I'd like a code review of the following simple implementation of the classic game Hunt the Wumpus
I'm trying to use JavaScript in the most "functional" way. To help me, I'm using lodash and ES6.
const _ = require('lodash'),
ROOMS = 20,
ROOMS_TUNNELS = 3,
BATS = 2,
PITS ... |
I will start by explaining the situation and then show some code. I have an app that has an array of "default" settings to display on a user's dashboard. The user can modify these settings to enable or disable certain items that appear on their dashboard.
I want to be able to update the "default" settings and if I add... |
Using Bootstrap 3 and PHP, I create my navigation bars in the following way:
<?php
$page_url = $_SERVER['REQUEST_URI'];
$active1 = (strpos($page_url, "one.php") !== false ? " class=\"active\"" : "");
$active2 = (strpos($page_url, "two.php") !== false ? " class=\"active\"" : "");
$active3 = (strpos($page_url, "three.php... |
I have a bit of jQuery that does one thing on mobile, and a different thing on desktop.
On mobile it toggles a class on a div that shares a common class with the link, on desktop it does the same, except on hover.
It all works, but I found that when I had it on mobile and clicked the links a few times in quick successi... |
I would like some advice which relates to the "fat model skinny controller" concept in Rails.
See my show action in the Micropost controller
def show
@micropost = Micropost.find(params[:id])
@tags = @micropost.tag_counts_on(:tags)
@responses = @micropost.responses
@response = current_user.respons... |
I just wrote my first Nim module and was hoping someone with some experience with Nim or similar languages could take a look. In particular I was hoping someone could speak if the use of template is idiomatic (or if they'd be better as a proc) as I have no experience using them in any other programming language.
I was ... |
I have a Python script for doing "safe" file copying.
There are a couple of rules for this copy function:
Existing files should never be overwritten. So if I try to copy $file1 to $location, and there is already $file2 at $location, then $file2 will not be overwritten.
Exact filenames are not important. So if I try to... |
IMetadata
public interface IMetadata
{
String ObjectFullName { get; set; }
String PropertyName { get; set; }
String DisplayName { get; set; }
String DisplayFormat { get; set; }
Int32 DisplayOrder { get; set; }
}
public static class IMetadataExtensions
{
public static String GetFullyQualifiedPr... |
I'm concerned about how much time my application could be spending during garbage collection so I'm trying to figure out how to add some code to instrument this.
Based on some examples:
https://msdn.microsoft.com/en-us/library/cc713687(v=vs.110).aspx
http://www.codeproject.com/Articles/101136/Garbage-Collection-Notifi... |
For a seminar with problems from programming contests I have to implement an algorithm to find the longest path in a graph. Here is a short summary of what I want to solve/achieve:
In this problem we are having a look at tasks which have a number of time units needed to finish the task and a list of dependencies. A ta... |
I have the following optimization problem:
Given two np.arrays X,Y and a function K I would like to compute as fast as possible the matrix incidence gram_matrix where the (i,j)-th element is computed as K(X[i],Y[j]).
Here is an implementation using nested for-loops, which are acknowledged to be the slowest to solve ... |
Is it OK to do that ?
for example, I have my log out service
logout: function() {
var defer = $q.defer();
this.getCustomer().then(function(credentials) {
$http.post(CONSTANT_VARS.BACKEND_URL + '/auth/logout',
{username: credentials.username, customer: credentials.customer}
).success(function(... |
I have the following ajax call and if it errors, I have a default error message stored in a constant which I'll use if the response doesn't contain a custom message. When I look at this, I keep thinking it could be done better. Can anyone suggest how I can do it better?
function requestService(){
$.ajax(... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.