instruction
stringlengths
71
71.9k
Is there a more elegant way than the following to check if two numbers have the same sign? bool sameSign(int num1, int num2) { if (num1 > 0 && num2 < 0) return false; if (num1 < 0 && num2 > 0) return false; return true; } It could also be written as the not case...
I wanted to learn about Iterable and Iterators and hence thought about getting my hands dirty rather than reading theory and forgetting it. I am curious how I can improve readability and error handling of my code. I also thought to practice and include test cases. class foo_range(object): """ Custom range iterator ...
I've previously posted some code that deals with making Cartesian co-ordinates safe at compile time. I've been doing a bit more thinking about this in a more general setting, as it is a problem that I quite consistently run into in code bases (all quantities are just declared as double and then forgotten about; or at b...
This is a follow-up from my previous question! I cleaned up the code and added all the notes from the answers. I have also updated the code on github LinkedList.h #ifndef LINKEDLIST_H #define LINKEDLIST_H #ifdef __cplusplus extern "C" { #endif typedef struct LinkedListNode LinkedListNode; typedef struct L...
I have a Model that looks like this: public class Item { public Item() { FilePaths = new List<ItemFilePath>(); } public int Id { get; set; } public virtual ICollection<ItemFilePath> FilePaths { get; set; } } public class ItemFilePath { public int Id { get; set; } public virtual I...
The first number will be dynamically selected and remaining array should be sorted ascending int[] array = {1,1,0,1,2,2,0,0}; int firstNumber = 0;// dynamic can be 0 or 1 or 2 int numberOfOccurances = 0; //Basic sort functionality for(int i = 0 ; i< array.length; ++i) { if(array[i] == ...
I would like to develop a kind of template or canonical implementation for a concurrent subclass of NSOperation in Swift. See here for my previous request which is implemented in Objective-C. In that previous solution, there are still issues when the operation will be cancelled while it has not yet been started. There ...
i am currently working on a project that involves me creating a worksheet for storing student test scores and grades. i wrote a script that retrieves users information and presents it in form of a worksheet. If changes are made to this document it saved the program stores or updates the database. I need reviews and op...
I know there is a more elegant way to write this. The logic is solid and doing what I want it to, but I feel like when written like this, it is awfully cumbersome to have these many if statements essentially doing the same thing. if (forward) { if (counter == listEnd) { counter = 0; } else { ...
(EDIT: here is the follow up qusetion) Using this program to test for the smallest number where its permutations or itself is divisible by 10 or less numbers is twice as slow as the fastest program I found doing this (I don't have the source code). How can this program be twice as slow, what optimizations can I do with...
I have a DB with a master table called "facturas" and another detail table "facturas_detalle." I would like to insert to them, so this is a "Database-First". I need some guidance or advise of best practice here. I've read some examples that are outdated versions of Entity Framework and ASP with no MVC approach. **fact...
I'm working on a database migration script written in python, which will take data from a MySQL database and insert them into a PostgreSQL database with a different Schema (different table structures, different datatypes and so on). Performances does matter, since I will have to handle with sizable databases. I use mys...
Edit: My initial idea was to use numpy to solve efficiently this problem but after trying without results, someone comment on stackoverflow: "Numpy can speed things up a lot IF your problem is essential parallel in nature" I realize that numpy is not the best tool in this case and tried using cython. I have defined ...
I am trying to create a horizontal accordion using jQuery. The code works fine, but I just want to know if my approach is correct and if there are any improvements I could make to the existing code. $(document).ready(function () { $("ul li").children(".Acc_Content").animate({ width: '0px' },{ duration: 1000, queue: f...
This small application is used to approximate conflicts in a schedule. Using a minimal time span of 30 minutes in my example, the application should be able to figure if there's a conflict in +/- 30 minutes range. To compute my approximation, I based my code on this SO's question. The idea is to use bitwise manipulatio...
In order to implement the Observer pattern in C#, one of the ways to go (at least, the one I chose) is to make classes that implement the IObservable<T> for the observable objects and the IObserver<T> for the observers. In a project of mine I created a base class from which every observable inherits: public class Obser...
Looking at my code, I feel like it is not instantly clear for someone who did not write it. I feel like readability will be important for me in the future, if I'm ever to write code on an enterprise, or open source project. Do you have any advice as to how I can make this and future C more readable? #include "datatypes...
I am creating a GUI library to better learn C++ and wanted to see if there is anything to improve/simplify. And I also wanted to be able to call an event of a parent and then for it to iterate all its children and those children to iterate their children and so forth, but I did not want to have a foreach loop in every ...
This is a C# programme to convert Brainfuck to C#, then convert that C# to a .exe. So basically, it's a Brainfuck to Windows exe file converter/compiler. This requires any of: .NET 2.0 in C:\Windows\Microsoft.NET\Framework\v2.0.50727 .NET 3.5 in C:\Windows\Microsoft.NET\Framework\v3.5 .NET 4.0 in C:\Windows\Microsoft....
What I was trying to do here was create a Python script that would generate passwords with 16 characters with uppercase and lowercase letters, and numbers. The generated password would then write itself to a file. Let me know what you think because I know they say the point of Python is to be able to write powerful scr...
The following method retrieves a list of users and the subscriptions for each user, from my database. That said, it works, but it runs pretty dang slow. I'd like to improve the speed on it. Currently, it fetches a mere 90 records, and takes nearly 20 seconds to do so, partly because, for every record of final output, i...
This is really a follow on from a question I asked earlier this year on Stack Overflow. I received a great answer to the following problem: I'm trying to code up something simple and pythonic to identify combinations of values from a list which sum to a defined value, within some tolerance. For example: if A=[0.4,...
I wrote this script as an NYC-specific-API for file upload for a mobile app. Users upload a video file and also their geographic coordinates. I then use an external API to get the corresponding borough in NYC (since the iOS reverse geocoding SDK labels everything as New York, NY regardless of user location within NYC)...
I have a method (C#, .NET framework 4.0) to check overlapping ranges between two prices. I have a process, which will have one or more price(s). A price has one or more range(s), like height, length, width, etc. Each range has a min and max value. How can I further optimize this code? Or is there a better way of doin...
I created a Tic_Tac_Toe class to play the game Tic Tac Toe. Is there a better way of coding a game like this? I started learning python 5 days ago and my knowledge is limited. class Tic_Tac_Toe: x1 = x2 = x3 = x4 = x5 = x6 = x7 = x8 = x9 = '' l = '|' a1 = a3 = b1 = b3 = c1 = c3 = a4 = a6 = b4 = b6 = c4 = c6...
I've tried to implement the access function DBLookup() in VB6 for a project I'm doing. Does anyone have comments on how well done it is and what could be improved? Take note that the Database connection object cn is only valid for a single query, and it's being initialized whenever you call the other public function, d...
I need an external application that helps deployment of the web application. The application should create the aspnetdb database on the dedicated SQL server. Then it creates the wanted roles for the web application, and it defines the initial users, assigns their roles and properties. The code below works, but it proba...
Is there a way to speed-up the following R code? actionVec<-NULL for(iii in 1:length(resultTable$V1)){ actionVec[iii]<- sum(browse$V2==resultTable$V1[iii] & browse$V4 == i & browse$V5 == ii)} this is a loop to form a vector for each record (row) in resultTable, containing the number of entries that match the condition...
I have a very basic method at the moment that fills text boxes with data relevant to the selected company. I load the data into a DataGrid using this method; CompanyDataService namespace SdcDatabase.Controller { class CompanyDataService { public DataTable GetCompanyList() { string co...
This question is a follow-up question to this one. I wrote a small JavaScript library for material design toasts (notifications). I'd like to know what are my mistakes and how can I correct them? Code works correctly and was linted with jshint but I'd like to get notes on readability and performance. Here are the GitHu...
I was wondering if it's possible to move these add remove methods into a single method: public void AddToVipGroup(int companyID, string userID, string auditTrailUrl) { string userName = "", groupName = ""; GetUserAndGroupNames(companyID, userID, out userName, out groupName); GroupUtilities.AddUserToGroup(us...
Using VB.NET, I have created an AddIn for Autodesk Inventor and the customer has a bunch of drawing number strings which follow this sort of scheme: P01867-13-TP09-001-4950-1775-1175-895-1125-835 P01867-13-TP09-002-4950-1775-1045-895-1035 P01867-13-TP02-019-L-1137-275-852-102 P01867-13-TP02-019-L-1137-275-852-102 P0...
I have a DbContext with a SoftDelete implementation inside it. To make it more clear and maintainable, I wanted to extract it to separate class and use as a component of DbContext or something similar. After first try, it looks it is more complicated than I expected. I also don't want to make it more complex. The probl...
I need to open and read several files for a project. Some of them are plain text files, and I just want a standard File.open to read from. One of them is an XML file, and I want it automatically loaded into Nokogiri in the following way: xml = File.open("#{LOCATION}/#{filename}.xml"){|f| Nokogiri::XML(f){|config| confi...
Is there a more concise way of doing this? const string TOTAL_COUNT_KEY = "totalCount"; private int TotalCount { get { int safeInt = 0; if (ViewState[TOTAL_COUNT_KEY] != null) safeInt = (int)ViewState[TOTAL_COUNT_KEY]; return safeInt; } set { ViewState[TOTAL_COUNT_KEY...
I have a 'Membership' model that keeps track of a Member's membership. A membership can be updated by an admin (admin_add), or by the user (update). This code is working great, but I'd love some feedback on how it looks, sections that could be improved, etc. Membership Model: class Membership extends AppModel { ...
For the Harvard cs50x MOOC I have completed an assignment in which a C server framework that functions like a barebones apache server is provided, to be finished by the student. The below code will launch a server on the host IP with the root server folder pointed to by whatever is pointed to in the launch arguments. ...
I have implemented this algorithm, but I would like to get ride of the variable res, which is outside the Solution class, could anyone help me with this? """ Definition of TreeNode: class TreeNode: def __init__(self, val): self.val = val self.left, self.right = None, None """ res = [] class Solution...
Intro Yesterday I posted this question. Since then, I've updated my code to incorporate these suggestions. I've also removed the dependence on C++11. Finally, I've made the following changes that get me closer to my overall goal: Rather than iterate over different values for dt within my script, I have dt specified...
I'm working on a project which simulates (very simple/watered down) a network. The basis of this is to learn how to implement a Queue. I understand there are many ways to go about this, but I ultimately went with a LinkedList mainly because of it's nature (FIFO) which makes it easy to utilize in a Queue. I would apprec...
This is a function I made for a timer that counts down and performs a callback at the end. It seems to work fine, but I think the code is not very clean and has some unnecessary bits; also I would like some notes on readability. The code: //timer object function function Timer (element, callback) { var ac, minutes,...
I previously discussed the performance concerns about different GCD algorithms. I wrote a simple Java class that implements the Binary GCD algorithm. It is a really tiny class that has only two easy-to-use methods. See for yourself: GCD.java package math; /** * This is a utility class that provides the functionality ...
Is this an efficient and clean implementation? function BST(items) { this.tree = {}; if (items) items.forEach(this.add, this); } BST.prototype.add = function(item) { if (!this.tree.value) { this.tree.value = item; return item; } var currNode = this.tree; var inserted = false; ...
I have the following javascript code that creates a github issue viewer. Can anyone give me some advice on how to improve the code? ;(function (global, $) { var currentPage = 1, configSettings= { 'base_url': 'https://api.github.com/repos/', 'repo': 'npm', 'repo_user': 'npm', ...
I have been practicing backtracking and I wanted to know how I can improve my code. For eg, I don't want to use global. Also, I am not sure if my code will work for all the cases. # Given two words of equal length that are in a dictionary, write a method to transform one word into another word by changing only # one le...
I created a function that will return 2 dates that depend on an input parameter. When the parameter is: 1 - return start date of current week and end date of current week 2 - return start date of last week and end date of last week 3 - return start date of current month and end date of current month 4 - return sta...
I have an action on four buttons. I need to make a down (checked) button if it's pressed and other buttons up (unchecked). My button is TToolButton and the property Style is set to tbsCheck. Could you please suggest improvements? LButtonName := (Sender as TAction).ActionComponent.Name; if LButtonName.Equals('btnVori...
I know that exists a lot of solutions about how to create an OUTER JOIN between two DataTables. I created the following code in C#: DataTable vDT1 = new DataTable(); vDT1.Columns.Add("Key"); vDT1.Columns.Add("Key2"); vDT1.Columns.Add("Data1"); vDT1.Columns.Add("Data2"); vDT1.Rows.Add(new object[] { "01", "ZZ", "DATA1_...
I just started learning reactive streams with RxJava. After reading a couple of books and a lot of articles our there I am still having trouble understanding how to coordinate multiple threads. I would appreciate a critique of the following code, particularly if anyone knows a better way to do it. I basically want to e...
I'm new to Python and wrote this code for collecting all files in an m3u (playlist) file and copying them into a directory. import shutil import os import sys args = sys.argv #check for m3u file if len(args) > 1 : m3ufile = args[1] else : print "m3u file must be set" sys.exit() #check for destination ...
This code works perfectly, but it bothers me. Having a labeled, nested for loop, with a true condition, a break statement, and a continue label...it really bothers me. But I couldn't figure out any other way to arrange the flow control here without sacrificing the efficiency. Any ideas? private static ArrayList<Inte...
I am trying to build a multi page form widget with React for a website inspired by this. Since quite some time has passed since I last touched JavaScript, I'm directly adapting to ES6/7 and tried to port the concept of Tommy Marshall (link above). I'm on a good way so far, thinking about using Redux Form for the actual...
I wrote this to learn JavaFX, and as an excuse to re-make the Game of Life. This is the most complex GUI I've ever written, so I'd like feedback mainly on it, but I'll welcome any criticism! My version differs from the original in that cells inherit their neighbour's color when they're born, which leads to interesting ...
The goal of this function is to an invert an income tax function. That is, given the tax paid and the financial year, the function should return the taxable income for that year. I would prefer to invert the income tax function rather than create a new function (so that changes to the income tax function will not requi...
I'm very new to programming and am admittedly embarrassed sharing my code for critique. This code works and produces the correct answer to the Project Euler Problem 17, which asks how many letters there are when the numbers from one to one thousand are written out in words (excluding spaces and punctuation). I was hopi...
It works by finding 2n+1 with n from 1 to k, but not where 2n+1 would be divisible by one of the already known primes. I'd like to know if the program can find every prime, and if so, how it compares to the efficiency of other algorithms. n=1 k=input() primes=[2] def f(n): b, a = 1, 1 for i in primes: a=((2...
Does it allocates something that hasn't freed? Something that remains in memory? Except result byte array, ofc. private unsafe byte[] ToByteArray(SecureString secureString, Encoding encoding = null) { if (secureString == null) throw new ArgumentNullException(nameof(secureString)); if (encoding == null) ...
I have a set of domain objects which try to find a solution to a problem. The top level object has an algorithm which splits up the problem and delegates it to lower level objects, which in turn do the same. I want the top level algorithm to throw an exception if it did not find any solutions, giving a breakdown of po...
I'm currently writing a game and want to encode everything that happens (GameObject has moved, hp changed, was created/destroyed, got/lost a component, ...) in Events that look like this: class HpChangedEvent : IEvent { public int GameObjectId; public int NewHp; } I hope that will make it easier to network the...
I need to create a commandword to be send to hardware and I'd like to make is as efficient as possible (without going to Assembler or similar). The command is 16Bit long and has to be passed as an array of two bytes to the hardware interfacing library I use (wiringpi). The first four Bit are configuration Bits and the...
Situation So I have made a list of PictureBoxes on my form that looks as follows: All images have a panel behind them that is 4px lager (2xp all around the picture box). The images are named x1, x2, xn.. respectively. The panels behind the images are named y1, y2, yn.. respectively. I want this to happen smoothly when...
The new version of the code can be reviewed in Simple multi-dimensional Array class in C++11 - follow-up. The following code implements a simple multi-dimensional array class (hyper_array::array). I modeled most (if not all) the feature on the orca_array.hpp header by Pramod Gupta after watching his talk at this year'...
I just started learning Java about a month ago. I'm wondering, what would an experienced developer do differently in the code below? As I learn to code, what direction should I be pushing myself? I wanted this program to output large versions of digits that the user enters. Any characters entered that are not digits sh...
I'm trying to write terse Perl code to calculate the average of each column in a file. The file can have >= 1 columns. use strict; use warnings; use List::Util qw/sum/; my @aoc = (); while (<DATA>) { my $c = 0; push @{ $aoc[$c++] }, $_ foreach (split); } print join (" ", map { sum(@$_)/@$_ } @aoc), $/; #output: 2...
This code seems to be working. I am allocating matrices on the stack and passing them to functions to modify in place. Is this a standard practice, or am I doing it wrong? Header: #ifndef _MATRIX_H #define _MATRIX_H typedef enum {MT_OK, MT_INVAL} MT_RESULT; typedef float mat4[4][4]; typedef float vec4[4]; MT_RESULT ...
This is an interpreter that takes in a slightly altered Befunge-93 (no input from the user, no limits on size and division by zero defaults to zero). I'm currently looking at the state monad and how it could be integrated into what I wrote. It seems to change quite a bit in the way I have to think about my interpreter ...
Using my previous function as a base I've come up the following: create function dbo.Totp ( @key varbinary(8000) , @timeStep int = 90 ) returns table with schemabinding as return ( select [Pin].s as Pin from dbo.GetUnixTime() UnixEpoch cross apply dbo.Hmac(@key, Cast(Floor(1. * UnixEpoch.n / @timeStep...
This is the function I coded, obviously used to get the system name: const char* os(){ OSVERSIONINFO os; ZeroMemory(&os, sizeof(OSVERSIONINFO)); os.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); GetVersionEx(&os); std::string ret = "Windows "; if (os.dwMajorVersion == 10) ...
I'm trying to convert a string (here after called input) into a vector of key-value pairs, all in C++03 (cannot use C++11, cannot use Boost libs). The string in question can contain whitespaces. A comma (,) delimits key-value pairs and the equals sign (=) separates the key from the value. A sample string (also in the c...
I took the basic layout manipulation from a jQuery plugin called flexImages. The idea is to use the directive tag and encapsulate a piece of code that will be transcluded to make up the container cells of each row. Unlike the jQuery plugin I didn't want to force defining the initial width and height of the container ce...
I was fiddling with the source code of Quake-2 today and at some point wanted to extract files from the .pak archives used by the game. Since I couldn't find any tool to do that on my Operating System, I coded this quick-'n-dirty command line extractor for Quake-2 PAKs: #include <stdio.h> #include <stdlib.h> #include <...
The Knuth–Morris–Pratt string search algorithm is described in the paper Fast Pattern Matching in Strings (SIAM J. Computing vol. 6 no. 2, June 1977). The initial step of the algorithm is to compute the next table, defined as follows: The pattern-matching process will run efficiently if we have an auxiliary table that...
I wanted to make sure that my code is properly converting between the two endians. Here is the code where I read in an integer: System.out.println("Please enter the integer:"); int number = input.nextInt(); System.out.println("At what word address would you like to store the da...
I have upgraded my code. In the old code I had two functions: display_maker_success() and display_maker_fail(): function display_maker_success($link, $userid){ $status="closed"; $result="completed"; $html = ''; $sql = "select start, name from wuuk where tasker_id ='$userid' and status ='$status' and re...
My friend and I are making a node.js game, and we have been testing CPU. After profiling, it was determined that this process called zlib is sucking most of the CPU/RAM. 3 clients connected to a game is fine, but when 12~13 players are connected it uses 58% where zlib is using about 30% of this CPU. inclusive sel...
I have an assignment to write a knights tour backtracking program in Java where the professor says to: Eliminate backtracking time by: Find the knights with the least possible moves Sort those moves from knight with least moves to greatest moves Backtrack if that path fails I have done that with and attempted some ot...
I'm kinda new to javascript and have question about it. Now my practical project is growing a bit bigger. I got the following if else statement. Is it possible to refactor this ? Should i use an use case or are there other options or will this decrease the loading speed of the application. (function () { 'use stric...
I'm happy to hear thoughts and ideas on structure/performance/testing/whatever and multi-threading, which I haven't gotten into yet with Python. Full code here. Assignment file and a test file included in the folder. Excerpt: import unittest import sys def Merge_and_CountSplitInv(A,start_index,len_1st,len_2nd): ""...
I've written a little (imperative) java program that basically prints out all french written numbers from 1 to 1000. (I'm learning how to write them) Based on the first numbers (1-16) and the tens and hundreds, It chains the words of the next number together and writes them into an one dimensional array. The French c...
On click on a div, a form replace this div. When the user clicks outside the form, the form is hidden and the div is re-show. For this, I implemented this process and I want your feedback, please. function showForm(){ hide the div show the form, and set value of a form textarea textarea.focus(); } function...
I decided to write an ATM program in my favourite programming language, C#. Tested with a few numbers and I am confident it will give correct output for any valid input: class Program { const int MIN_WITHDRAW = 20; const int MAX_WITHDRAW = 1000; const int INVALID_WITHDRAW = 30; const int TWENTIES = 0; ...
I need to build a bar graph that illustrate a distribution of pseudorandom numbers that determined by linear congruential method $$X_n+1 = (a X_n + c) \mod m$$ $$U = X/m$$ on the interval [0,1] For example: Interval Frequency [0;0,1] 0,05 [0,1;0,2] 0,15 [0,2;0,3] 0,1 [0,3;0,...
I have programmed this simple Stock Control System using JavaFX for GUI and PostgreSQL for a database. Please go through my code and point out flaws, inefficiencies, and better ways of doing things. I'd also like to be made aware of best practices which I am not following. The last two files are external links because ...
Led by the recently read premise "Lean controllers and fat models" I've come to the conclusion that my controller might be too fat at the moment. Basically, what I'm trying to achieve is simple Edit (POST) function where I'm trying to update heavily nested entities. What can be found here is a ViewModel (VM in the cod...
I'm working on a project where I pull data (JSON) from an API. I would like to manipulate this data and store this as useful information in my DB (MySQL). My code is working if I would like to make, for example 2000 requests. My script step by step: Get IDS from DB, store them in array urls. Take a chunk Set and exe...
As I mentioned at the end of my Round 2 answer, I've needed to expand my code in order to produce faithfully the data needed for Figure 1 of this paper. Unfortunately, the updates have made my script extremely slow, to the point that it doesn't finish within an amount of time I'm willing to wait. Why is the script so s...
I made a simple application to test your own website security for DDoSes in Python. Any suggestion is welcome. import random import socket import threading import time userAgents = ["Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2049.0 Safari/537.36", "Mozill...
I'm making a game in Java 7, and I have this block of logic when handling an update from the server. public void handleNewPlayer(Player newPlayer, Player[] otherPlayers) { boolean done = false; for (Player otherPlayer : otherPlayers) { if (newPlayer.id == otherPlayer.id) { updatePlayer(other...
Simple Playlist Modifier This program is a search and replace program for text based files. The main goal of the program is to replace directory paths to music files. The idea is to have the program read files from input and then validate the given parameters (a file path in this case). The Source M3U Contains -- creat...
I have developed some Python code which revolves around two custom classes - a 'Library' class (Lib) which contains a Python list of several objects based on a 'Cas' class. I've not posted the code for either of these classes here, but all you really need to know to understand my question is that the 'Library' object c...
I am looking for general feedback on this small, simple program I wrote. It works perfectly, but I am striving for readable, clean code. I also have specific questions: Is the switch statement the most efficient/logical way to write this class? Is my main method too large? Should I break it into smaller methods? Ho...
(Here is the follow up question) I had another go at trying to speed up my program described in my previous question. JS1's answer was particulary helpful and now my code is only about 20% slower than the fastest program in the programming challange (it runs in 0,13 s and my code runs in 0,16 s). I ran the code with d...
The script below should open a file, read and reverse every line, then overwrite the source file. #include <stdio.h> #include <fcntl.h> #include <unistd.h> #include <stdlib.h> #include <string.h> #include <sys/stat.h> // reverses the order of characters in every line of SRC file void validate_cmdline_args(int argc, c...
I wrote my first script for google apps, but I am just learning how this all works. The script works fine, but I am sure there are things that are not done properly. Any advice is appreciated. The code creates awards from a Google Sheet where a column of names (last name, first name) is separated and text is replaced...
NaryHeap as a generalization of binary heap. Each node has up to N children. A template specialization for N = 2 (BinaryHeap) is given too. Though apparently not standard, I've also defined removing a node other than the root, and removing a node by value. #include <iostream> #include <functional> #include <algori...
High Level Explanation of Code's Purpose I wrote a class to create sectioned reports, where each section has a subtotal. It allows these reports to be nested within each other, to create multiple levels of subtotals. An example will help clarify the idea before getting to the real code.... Consider this sample data: ...
I have this code for reading Twitter users from a text file represented by integers in the format "int (space) int", where the first int is the ID of the user doing the following and the second int is the user being followed. It works for small files but takes a really long time with larger files. What can I do to make...
Well, it really isn't a big pain: but I fear of security risks (if that is even possible). Background: I decided to (sort of) abandon my Sudoku project (because I accidentally deleted it from disk), and was given the idea of a JavaFX Helper Library. I started with the LoginPane, as I find I use login popups quite often...
Inspired by reading "How-to write a password-safe class?", I tried some clever (or dumb-fool) hack to create a widely-useable secure string using the std::basic_string-template, which does not need to be explicitly securely erased itself. At least gcc and clang seem not to choke on it (coliru): #include <string> namesp...
I tried implementing visitor patter and have questions about my usage of is and as keywords. Is there a big performance hit when using them? class Program { static void Main(string[] args) { List<IVisitor> visitors = new List<IVisitor>(); visitors.AddRange(new List<IVisitor>() { ...