instruction
stringlengths
71
71.9k
I usually write function-only Python programs, but have decided on an OOP approach (my first thereof) for my current program, a web-scraper. Here is the working code I wrote which I am looking to have critiqued: import csv import urllib2 NO_VACANCIES = ['no vacancies', 'not hiring'] class Page(object): def __init...
Purpose This question comes from a HackerRank problem called Fibonacci Modified. I think I have coded a valid solution, but would like feedback about my approach, implementation, and of course, any errors / edge cases that I may have missed. Task Implementation public class FibonacciModifiedImpl implements FibonacciMo...
I'm trying to learn F# by creating a little web scraper that will do custom scraping based on the url domain. For this, I need to create and select the correct kind of scraper. I figure I would use a Factory that would determine the correct kind of scraper for me. So here is the interface for my scraper type IExtractor...
I'm working on a program that is supposed to use alpha beta pruning to find the best move for a game. The game is basically a binary tree of degree of 40 and each node will have a different float value. The moves are only true or false. The goal is to score a positive score at the end. The professor gave us the Main an...
I am creating a chat API for Android developers, but it's slow -- the chat app is getting messages a little bit late. How can I improve the performance of my code? <?php require_once('config.php'); $sender_id = $_GET['sender_id']; $receive_id = $_GET['receive_id']; $response = array(); if($sender_id && $receive_id) {...
I decided to try out some named tuples by implementing Dijkstra's algorithm to find the cheapest routes in a file like this (where each line represents node_a is connected with node_b with a cost of n): 1 6 14 1 2 7 1 3 9 2 3 1 2 4 15 3 6 2 3 4 11 4 5 6 5 6 9 However, something that caught my attention is that some ...
Here's the code I'm planning to use to power meta description tags for a site in header.php in the template. Is anything missing / incorrect / could be done better? <?php if (is_front_page() || is_home()) { $description = get_bloginfo('description'); } else { $description = get_post_meta(get_the_ID(), 'descrip...
I wrote the following piece of code and want to hear your opinion, in this snippet I have a vector called aggregateFeaturesForML which has elements of Class with 3 fields: sourceip, key, value. what I want is to collect all the key-value pairs that have the same sourceip and form a nice histogram (for each IP the keys ...
I've been writing JavaScript for a couple years but nobody's ever really looked at my code. This is a small library I wrote to check code modularity, w/ input like avg-lines . -name '*.js' (the arguments are passed straight to find) you might get: Checked 20 files (1615 LOC): 80% of files contain > 137 LOC 20% of f...
I've been working on an app based on the MEAN Framework. I have got the app working but I just wasnt sure whether my coding structure and standard was good enough, meaning does it adhere to the programming standards in terms of structure, security etc. So I'll explain my app: A very simple app, it consists of a MongoDB...
This video should explain how the game works, but in simple form, it's a game where you enter a number between 1 and 3, This number is than removed from 12, in doing so the computer will then pick a number between 1-3 based on what number you have picked, if you choose to remove 1 marble it should say that it has remov...
I'm writing a 2d top down game where I perform a lot of "closest" searches between one point and all the rest of the points. In this example, "me" wants to search for the closest visible house (Home) that I haven't visited yet, and if it is not found, return null. protected Home getClosestUnvisitedVisibleHome(Person me...
I am working on a PowerShell script which will loop through a directory containing SQL Server database backup .bak files; move the files to a different location; restore each of those files to the local SQL instance using OSQL.exe; output the SQL output to a log file. This works OK, but I am willing to improve it. $s...
I've written a Universal Windows Application which allows you to select a folder and shows the icon and name of a random executable from anywhere in that folder. The intent is to be a Game Roulette, where if you install all your games in a certain folder, it will tell you what game to play. MainPage.xaml: <Page x:C...
I've created a simplified event system for C++14. The code is commented, so it shouldn't be hard to read. There's also a simple usage scenario below. It is still a work in progress and uses some not-so-best practices. For example any consumer, that has an access to the event can fire it. Also you will notice, that the ...
I've created a brief UserScript (GitHub repository) for TamperMonkey to stop Google from hijacking Search results URLs for tracking purposes when you click them: // ==UserScript== // @include http*://www.google.*/* // @run-at document-start // ==/UserScript== (function () { 'use strict'; function handl...
I pursued an according algorithm with an absolute best performance, the following class embodies the solution. Any comment is welcome. class TextCompressor { private const char Seperator = '\x20'; private StringBuilder builder; public TextCompressor() { this.builder = new StringBuilder(); ...
I am parsing the responses from our Varnish load balancers in order to monitor the status of various nodes. One of the responses we get is text consisting of multiple blocks of data, one for each server in the load balancer. This is one such block: Backend web05 is Healthy Current states good: 10 threshold: 8 window...
On a shared host, I'd like to setup a cron which scans folders recursively for some base64 malware strings. Therefore, I've written the following script: #!/bin/bash if [ $# -ne 1 ]; then echo $0: usage: ./findone folder_to_start_with exit 1 fi folder=$1 IFS=$'\n' searchfiles=($(grep -r -F -n -f malware-stri...
This is a port of a C# cache manager we use to F#. This is my first F# code, and I've tried to make it as idiomatic as possible. I would appreciate input on style, performance considerations,correctness, anything at all. The goal is to learn more about F# and functional programming. The purpose of the code is to abstra...
This picture inspired a contest between a few of my friends to rewrite this code in more proper OO style. This is what I have come up with. Any thoughts: public enum CoffeeKind { Black = 1, Cappuccino, Espresso } public class Coffee { //Measured in celcius public int Temprature { get; set; } = 30...
I am trying to get an Auth ticket from a 3rd party server. I am using FutureTask to perform the task. However, if I don't get response from the server after 10 seconds, I want to timeout the call. At the same time, I want to kill the Thread which was busy in fetching the Auth Ticket from 3rd party, but got stuck becaus...
I would like to know if someone can think about a better solution for doing this stuff. I have an array of raw bitmap data in 32bit format (RGBA). I need to transform and transpose this array into a 24bit format by eliminating the alpha component. Additionally I need to transform the data by aligning the red component ...
This is my attempt to implement the Pascal Triangle in C#. It is meant to calculate and return a pascal triangle of size n (which it takes is through the parameter rows). static List<List<int>> GetPascalTriangle(int rows) { List<List<int>> result = new List<List<int>>(); for (int x = 0; x <= rows - 1; x++) ...
This is a rags-to-riches of some recent "search word in multiple files" questions, such as this deleted question and this. The idea here is to do a case-insensitive word (complete, not partial) search that can also report the line and 'column' number of the search result. For example, if the word is found as the first ...
Imagine I have connection in which I have to write numbers, represented by this contract: interface ISocket { Task WriteAsync(Byte[], Int32 offset, Int32 count, CancellationToken cancel); } There is one single thread calling this WriteAsync method. Till now each caller to ISocket was buffering independently and kn...
I need to show article's content based on this logic: if article's content has to be truncated (e.g for preview) if there's [read more] substring in the content replace first [read more] with link to the article truncate content to the first occurence of [read more] else truncate content to the first 500 chara...
The following class is used for handling sessions: class DBHandler implements SessionHandlerInterface { protected $exists; public function open($save_path, $name) { try { DBCxn::get(); return true; } catch(PDOException $e) { return false; } } ...
I'm making a card game and I found useful to include a 60 second countdown timer. Here is my approach: import java.util.Timer; import java.util.TimerTask; public class SecondTimer { private Timer timer; private int countDown; private int secondsLeft; public SecondTimer() { timer = new Timer()...
Could this code possibly be shortened, or even better be rewritten in the fewest lines of code possible? import csv import random import math import operator as op name=input("What is your name: ") print("Hello there",name,"Welcome to the math quiz, you will be asked 10 random questions on Addition, Multiplication ...
I have a website which only needs to support IE11. It is a single page application, which has about 200 table rows and each table row has 5 child rows. There is a pulsing function that updates the table as records come in. Table rows are skipped over if no update comes in. However, when receiving large updates (which s...
It's my first exercise involving the well-known binary search. The problem goes as follows: we are given a sequence of n numbers and we have to answer to t questions, each of which is: “How many numbers in the specified sequence are greater than the i-th element of the sequence?” For example, we have n = 3 and t = 3. O...
I have a form component with multiple refs pointing to form inputs. On submit, those inputs' values need to be passed the into form callback, structured as an object. Currently, it's achieved like this: class MyComponent extends React.Component { render() { return ( <form onSubmit={() => this.on...
In an RPG game I'm developing, after building a base Weapon class, instead of having many subclasses of Weapon, I want the weapons to be built upon dictionary parameters. Many of them will be simple static information (weight, value, etc.), but others will have conditionally defined parameters, with not only numeric/te...
I'm making a scraper/web crawler using Kivy when I run the code it works but I'm not sure if what I'm doing is Pythonic because all the language I can find is about using the Kivy library. I'm unsure about putting the functions to bind the widgets to inside the build method. Is there a better way? class MainApp(App): ...
I needed a caching decorator, that could be used with methods and functions, that could take typed args and kwargs, and that was Python 2.7 compatible. Therefore I started with a backport of the lru_cache from Python 3.3. However, I also needed the ability to incorporate a shared cache (I am doing this currently via ...
I find that I often have to maintain a singleton primarily to hold an array that is sometimes persisted between user sessions, that should have only one class of items, and that sometimes needs to be ordered. I got tired of writing the same boilerplate over and over so came up with this. I'd welcome critiques (particul...
I made some games in Pygame, but I am still new to making games. I made this RPG game, and this code is just a part of the game. The game executes different Pygame files for different levels of the game as it can be seen in this part of the code (this is for random battles): if (mainCharacterCoordinates.colliderect(b...
I wanted to make a button that goes to the top of the page but only appears when you're not at the top. There are probably libraries that already do this, but I wanted to make it myself and after some tinkering the following is what I came up with. There is an occasional annoyance from quickly scrolling up & down with ...
I inherited an application that uses some stored procedures. Here is a sample of one of the stored procedures used to insert or modify user data. would like to get the group's opinion on the code. The SQL Server version is Microsoft SQL Server 2014 - 12.0.4100.1 (X64). USE [MyDataBase] GO /****** Object: StoredProcedu...
This query took 6 seconds to complete. How can I optimize it? Total records in table is 166803. SELECT ltrim(rtrim(CAST(cageID as nvarchar(max))))+ltrim(rtrim(CAST(trayNo as nvarchar(max)))) as _unique,* from lf_transit_cage where ltrim(rtrim(CAST(cageID as nvarchar(max))))+ltrim(rtrim(CAST(trayNo as nvarchar(max)))) ...
I've been designing a dynamic graph to improve my understanding of C++11. The dynamic aspect means that it could represent the hyperlink structure of a chunk of the internet, with node deletion corresponding to removing dead links. I'd be grateful for a review of coding style/design patterns/optimization. The main conc...
Purpose I came across this relatively simple question on HackerRank regarding finding missing values across two Lists. I took a fairly straight-forward approach, but is there a "better" / "slicker" way of implementing a solution? Task Strategy Iterate throughList with complete data. If Integer is in List with incompl...
Rags. Introduction All too often I find myself wanting to allow only a certain list of characters to be written to stdin, and only recently did I actually bother to implement it. In Python, of all languages! Essentially, this module provides a few APIs that allow a very tailored approach to reading characters from a t...
My goal is to iterate over a datamatrix, calculate mean, standard error of the mean, and then have a bar plot representing the 2 groups of my data matrix in R. My code below works as a for loop. However, my initial goal was to output each 8 plots in one .png file. To that end, I posted the question here. One of the 'c...
Previous topic: Large table updates using AJAX in Internet Explorer 11 For the functions included here, I have taken the advice of the previous answer and incorporated it in the restructure, but am still experiencing huge latency of about 2 seconds per computer record. I am lead to believe that this is more an issue wi...
I'm creating my own application exception types so I could catch them higher in the call stack and take specific action. I'm looking to get feedback on the latest exception I've written for two reasons: I'm using the Exception snippet from Visual Studio 2013, and am wondering if it is any good and/or has potential pro...
For following input string: "VISITOR_INFO1_LIVE=USv90B-7CzI; LOGIN_INFO=e486e37a395be3f0e3b3237d090a6829c1oAAAB7IjQiOiAiREVMRUdBVEVEIiwgIjciOiAwLCAiMSI6IDEsICIzIjogMjAxMTk0MTMwNiwgIjgiOiA2MDgwMTg0NTEzNjQsICIxMCI6IDIzOTYyMTEyODczNH0=; PREF=f5=30;HSID=AHuJQBOVR0lQoRt_3; APISID=QaParXGsQcEPCzKg/A1smCfYrfMjxvfEPT; YSC=Vm3A...
I'm a Java guy in a JavaScript world, and I'm used to certain things about Java Strings that just aren't there for in JavaScript. Some of this I can accept, for example Strings are freaking everywhere for some reason. Now I realize this could be simply implemented with return this.indexOf(needle) === 0; (or, even more...
The statement is as follows : 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...
[ This app is now on github !! ] This is a small program I wrote to hide/show different windows on my Windows PC. This is named LifeSaver because it did save my life several times, whenever someone stormed into my room unexpectedly. It does have some cool uses and some naughty uses, for all people. Its structure is lik...
I have written a small plugin for nagios to check a WebDAV server. It is supposed to connect using a username and password and upload & delete a test file This is my code: #!/bin/bash #Exit codes STATE_OK=0 STATE_WARNING=1 STATE_CRITICAL=2 STATE_UNKNOWN=3 FILENAME=/tmp/test_monitor FILE=test_monitor HOSTNAME=$1 USERNA...
I'm displaying JSON data in a tabular format on a html page using jQuery. In the function I'm looping the resp.DATA once to get the key names so it can be displayed as the headings in the table, and a second time to get the values of the keys for all customers. Can this be done in a way that I only have to loop the re...
This is a Unity3D script I wrote for my game to control a character. I don't consider myself a highly-skilled coder, so I come here to ask for suggestions. Is my code clean enough? How can I improve my coding style and pattern? using UnityEngine; public enum OnWallStatus { None = 0, OnLeft = 1, OnRight = 2...
Inspired by this question, I decided to rewrite this code in Scheme, as I'm working through SICP right now. Any feedback welcome. #lang racket ;assume cup, is-empty?, refill and drink are operations understood by the environment (define (coffee cup) (if (is-empty? cup) (coffee (refill cup)) (d...
I've got a service that loads data from a databasr and it performs almost the same operations in all methods. private async Task GetProvenances() { try { var result = await commonRepository.GetProvenances(); if (result != null) { provenanceConta...
I have a function which sets the text to a label displaying current active "products" and current active pages. The label displays "X products, Y pages/page" depending on the amount of products active in the template. Products is the same as rows really, the client wants to call it products. The template consists of a ...
I am working on an algorithm question in which I need to find out pair of number out of 2 sorted arrays which sum up to the given number. I need to print out the indexes of those pairs rather than number itself. I have written an algorithm which does work but I am wondering is it the best solution or is there any bett...
I am searching for some improvements, particularly in the regex, in the way I highlight specific words in a string. I have keywords into my database stored without any diacritrics The user comes with a string with diacritrics I find the matches between the keywords and my string modified so that it does not contain an...
I have a view which displays a list of items, in each row I'm going to have a link, a link in each row points to different location So base upon a property called CertificationType I have to generate an address, for example if the type equals to 'BirthCertificate' I need to fetch the address from a table called BirthCe...
This code will copy data from a workbook and copy it to an existing (and open) workbook. At the beginning of the month this copy/paste works very quickly, but as the month goes on and the data also grows, this process slows down to a couple of minutes. Once we start hitting 200 rows of data, we see the performance slow...
I'm working on some code right now where the goal is to take in a byte stream and grab the data from the body of a message. The data is 10 bytes long and is meant to be translated into hex. Specifically, the 10 bytes coming in look like 01000200030004000500 or 01010201030104010501 (with implied 0x in front of each). Th...
I wonder if I should divide this class into two, since it contains two "ifs" with different messages. Would breaking it down be in keeping with the "S" of SOLID? internal class ValidDateApuration : IBusineeOfValidation<DtoFormGnre> { public MessageValidation Validar(DtoFormGnre obj) { var paymentDate = ...
I have a slice with ~2.1 million log message strings in it that I am parsing for regular expression matches. For any matches, I add it to a local slice and then return said slice. func Search(re *regexp.Regexp, logs []string) []string { var lwg sync.WaitGroup var lresults = make([]string, 0) NumCPU := runti...
I've written a programme to find Chen primes. A Chen prime p is a prime number where (p + 2) is either also a prime number or has two prime factors. I've got it working to the best of my knowledge: the first few values are correct. def isprime(n): for m in range(2, int(n**0.5)+1): if not n%m: return Fals...
I am trying to solve a problem on Hacker Rank and the question is as follows: Jesse loves cookies. He wants the sweetness of all his cookies to be greater than value \$K\$. To do this, Jesse repeatedly mixes two cookies with the least sweetness. He creates a special combined cookie with: sweetness =(1× Least sweet coo...
I created this snippet to "split" my full-album videos into its individual songs without the need of actually splitting the video file. I personally created this snippet because I enjoy reading all musics from a directory in shuffle mode and stumbling upon a full album kinda ruins the point. #!/usr/bin/python3 # -*- co...
I have recently finished my first iteration of a template method implementation for a JavaScript canvas animation of the snake game. However, I would love for the community to critique this code and inform me where I am going wrong? In my opinion, a bad smell for me is the number of times this is used throughout. Furth...
I am a graphics programmer and was wondering about my code quality. I selected these three examples: Game engine, which uses OpenGL and has a lot of other non-graphics code A 3D software renderer, uses the basic X11 libraries for drawing A WebGL framework (found under felipetavares/webgl.js) Here is the code for the ...
I am looking for any feedback on my connection pool implementation (I removed the documentation so this post isn't so bloated). The pool times-out idle connections after a certain timeout interval and cleans itself after every 5 seconds (given that a method is called on it). There are no limits on pooled connections...
I'm a Perl beginner, I really love this language, and I was wondering if it was possible to reduce the size of this code, just for fun and so as to learn Perl specificities: chomp($n=<STDIN>); if (!$n) { print 0; } else { @t=split/ /,<STDIN>; foreach $i(0..$n-1) { $m=$t[$i]if(!$m)||(abs($t[$i])<abs($m...
I am trying to solve the following problem at HackerRank: XOR-Sequence An array, \$A\$, is defined as follows: \$A_0 = 0\$ \$A_x = A_{x-1} \oplus x\$ for \$x>0\$, where \$\oplus\$ is the symbol for XOR You must answer \$Q\$ questions. Each \$i^{th}\$ question is in the form \$L_i\ R_i\$, and the answer is \$A_{L_i} ...
Problem There was an interesting problem on the dailyprogrammer subreddit: A number of sailors (let's call it N) are stranded on an island with a huge pile of coconuts and a monkey. During the night, each sailor (in turn) does the following without the others knowing: He takes one N'th (e.g. if N=5, one fifth) of...
I recently reviewed some data structure concepts, so I implemented my own templated linked list. I am very interested about the code efficient and performance. LinkedList class package linkedlist; public class Linkedlist<T> { protected Node<T> head; protected Node<T> tail; protected int size; public Linkedlist() { ...
I'm working on this school project and was wondering if there was any way of storing this information better, faster, more professionally. I'm also restricted to only using an array; don't ask me we are not allowed to use ArrayLists yet. My Code: public void loadTweets(String fileName){ try { File file = n...
I'm trying to implement Dijkstra algorithm in F# for finding the shortest path in a undirected tree using a heap. I've used the type PriorityQueue found here and the code can be found here. ///////////////// preparing the data //////////////////// open System open System.Collections.Generic open System.IO open MSDN.F...
I have two txt files. Both contain 60k+ words in a list. I put together some code to loop through each file and concatenate the strings import hashlib with open('1.txt') as f: a= [line.rstrip() for line in f] with open('2.txt') as f: b= [line.rstrip() for line in f] for y in a: for z in b: if hashl...
The system is pretty simple. Here is how the database looks: table users: +----------+-------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +----------+-------------+------+-----+---------+----------------+ | userid | int(11) | N...
I'm currently working on a intranet application. It shall have a GUI on which you can choose a weekday and a positive / negative integer. The integer stands for weeks. So let's say someone chooses the Wednesday and (-7) then it shall display the date of the Wednesday seven weeks ago. Tuesday and 3 => Tuesday in three ...
I am looping through an array and want to do something different on the last iteration. Currently, I have: var arr= ["a","b","c"]; for (var i = 0; i < arr.length; i++) { if (i < (arr.length-1)) { alert("if"); } else{ alert("else"); } } I have also considered: var arr = ["a","b","c"]; for (var i = 0; ...
In order to solve this challenge: Challenge Description By starting at the top of the triangle and moving to adjacent numbers on the row below, the maximum total from top to bottom is 27. 5 9 6 4 6 8 0 7 1 5 5 + 9 + 6 + 7 = 27 Input sample Your program should accept as its first argument a path to a filenam...
I'm new at scripting, but I thought it would be handy to have a script that would change the extensions of selected files in Finder. I run this script from an automator service so that batch changing extensions in Finder is always just a right click away. So far, it has worked as I expect, but since this is one of my ...
Binary heap construction and maintenance boil down to the two basic operations: sift up and sift down. Following are generic template implementations of the two operations. Any comments are welcome. I'm preparing for an interview, and I hope my code will appeal to the interviewer :-) /// Compile with `-std=c++14`. #inc...
I was writing a program that had a list of e-mail messages. It needed to group them into batches, with the condition that each batch must have at max 20 messages, and be maximally 50k in size (no individual message is bigger than 50k). Obviously itertools.groupby() is a candidate for this, but I really didn't want to k...
Original post: nagios plugin webdav check According to the good advice I have received I've made some modifications to the code: #!/bin/bash # # check a WebDAV server # connect using a username and password and upload & delete a test file #Exit codes STATE_OK=0 STATE_WARNING=1 STATE_CRITICAL=2 STATE_UNKNOWN=3 FILENAM...
(See the next iteration.) Given a positive \$N\$, the following class generates all possible non-empty sets \$A \in \mathcal{P}(\{0, 1, \dots, N - 1\})\$ in lexicographic order. Also, it provides a method that can be used to copy a combination to a list. I am seeking primarily guidance regarding the API design of the c...
I have created a small game to learn more about Android. So the game is you start with a single gray square, and you try to take over neighboring squares. You can only attack 1 color per move, but each move takes any neighboring squares of that color and also turns them gray. Turn the whole field gray to win. My ...
I have this really really long controller action and would like someone to help me break it down. def index @credit_unions = Company.parent_with_branches @loan_officers = [] @loan_requests = LoanRequest.includes(:dealer, :loan_officer, :branch => :parent) if params[:query].present? results = @...
I need a function that takes a numpy array and a row number as inputs and returns the array (or copy of the array) excluding the given row. I want to do this as efficiently as possible. # Test array x = np.repeat(range(10),2).reshape([10,2]) Indexing by slices is very fast in numpy, but as far as I can tell this can o...
I have written my own memcmp() function for learning purposes: bool memcmp( byte* _bufA, byte* _bufB, uint n ) { while ( n > 4 ) { if ( (int)*_bufA != (int)*_bufB ) return false; _bufA += 4, _bufB += 4; n -= 4;; } while( --n ) { if ( *_bufA != *_bufB ) ...
I recently took a self-assessment question to assess my Python ability for an online class. The problem was to return the frequency of a word occurring, as part of a tuple. Implement a function count_words() in Python that takes as input a string word_string and a number number_of_words, and returns the n most frequ...
#!/bin/bash set -ue # use AWS CLI to launch a cluster create_cluster_response=$(aws emr create-cluster \ --release-label emr-4.3.0 \ --region us-east-1 \ --etc) # many more arguments; see http://docs.aws.amazon.com/cli/latest/reference/emr/create-cluster.html # use jq to parse and display result cluster_id=$(ec...
I'm packaging data for use in a JavaScript charting library that expects a somewhat odd structure of data in which there is an array of labels and an array of dataItems where each data item has a label and an array of data that corresponds to the array of labels. I'm creating the dataItems from a list of objects in wh...
I have been asked to make a registration form that will add a users details to a database, create a registration code, then email the registrant and client the details including the registration code. I am quite new to PHP but have put together something that works for me, however, I don't have the experience to know i...
I wanted to bind a single hot key to open and close gnome-terminal in a way similar to terminal emulators such as tilda or guake. I use Ubuntu, and have configured this script to be executed when I press the key F1 The script will focus or minimize the first gnome-terminal window that is running. If no gnome-terminal i...
Here is my next Java assignment: create a Matrix class that can add and multiply two matrices together. I was given some code as a skeleton and then fleshed it out a bit. Is there any way I could cut back on the amount of code present, or increase the performance of the multiplication method? And any other notes abou...
I keep getting a time limit exceeded for this solution to SPOJ Prime1. I need to print all primes within a given interval (with intervals as large as 105, and numbers as large as 109). I've tried everything I could think of to get this code to be faster but nothing works. What can I do? #include <iostream> bool ispri...
The code connects multiple clients to a server using TCP sockets asynchronously. I have added code to attach a digital signature to the outgoing messages from the server, to authenticate the message the signature is verified on the client and the message is displayed. The signing and verifying of the digital signature ...
I have a macroscript which reads a query string for search term parameters, and then does a multiple word GroupedOr search through UmbracoExamine / Lucene.NET. Because this is a full site search, I have hard-coded an array of about 100 fields across the site to allow the user to search against pretty much anything on ...
I'm interested in determining the best way to check a paginated website for new entries. I want to be able to scrape pages 1, 2, 3, ... as necessary to get all updates. However the scraping is fairly network intensive (e.g. I have to recurse into links to get data) so I only want to scrape what is necessary. Performing...