instruction
stringlengths
71
39k
I wrote a parser for the IRC RFC 2812 spec and would like input on my use of the strategy pattern for this. I created an IrcMessage class that is responsible for taking the server response string from the (examples below) and parsing it. The server response format is: :<Prefix> <Command> <Space Separated Args> :Optiona...
This is a coupon collector code to analyze the running time. I need some suggestions on improving the running times of this code. I have used the data structure dictionary, but is there any other data structure that will perform faster? import random import numpy as np import matplotlib.pyplot as plt from array import...
In GUI that provided with the right username and password lets you open up an address book like GUI where you have crud like operations. I'm still very inexperienced with swing facilities especially with layout managers and placing my components on a panel/frame. I'd like some feedback about how to properly structure t...
I was hoping to receive some criticism on this block of code. I wrote it to write the contents of a dictionary to excel range in VSTO. It works well. I am interested to see how people could improve it. What would you do differently to make it more expressive, efficient? public static void WriteToRange(this Dictionary<...
I am trying to send daily mail alert to users based on some timer values. For that I've used Addhandler to call the sendmail() function on timer Tick. In this scenario I faced a problem and I am unable to pass arguments to the function through AddressOf. What I wanted was to use my function, which took these parameters...
I changed my mind. I don't want to implement 200-some Node classes. Instead, I'll be working directly with the ANTLR generated classes, to implement the Rubberduck code inspections, unit test method discovery, the "Code Explorer" tree view, and everything else Rubberduck might need a parse tree for. The Node derived cl...
I created my first java game in LibGDX and it's working fine but I'm 100% sure a lot of my code can be written shorter than now. Does anyone have tips how I can make this code better? Like the Gdx.input.getX(), if I run this on Android, it's fine, but when I run this on PC, you just have to hover over your screen to ch...
I have reimplemented the quicksort algorithms that takes a list and sorts it in non-decreasing order: void qsort(int* l, int len) { if(len <= 1) return; int pivot=0; for(int i = 0; i<len; i++) { if(l[i]<l[pivot]) { swap(l+i, l+pivot...
This is a follow up to: Validating individual properties and whole items I have a custom class I've written which allows me to validate individual properties of items, without firing validation errors on other properties. This allows me to individually validate what my users are editing without flinging up a lot...
I use Project Euler to teach me programming and not to submit any results. As such I look up the expected return values to double check my solutions. To organise my files I use the following folder structure: main.py \euler # The problem files __init__.py # empty e001.py e002.py ... \input # Additi...
I have the following function: def save_to_file(data, columns_order, save_filename): """ Saves data to file :param data: data to be saved :param columns_order: the order of columns if needed to rearrange else put "" :param save_filename: the filename (...
I'm working off a specification that says a bunch of fields within a record (one record being one line) must be blank. For example, it says that chars 6-14 must be blank. I am building a class hierarchy structure that represents the layout of the file, and within this class hierarchy I'm including every field for each ...
I wrote a function to get a 2-digit random number for each day, but it should be retrievable. For example, today's random number is 72, but later I can provide "day and month" and get this 72 again. function ranDay($day,$month){ $pow1 = round(pow($day,$day))*$month; $pow2 = round(pow($day,$day))+$month; ...
Given a string and a non-negative int n, we'll say that the front of the string is the first 3 chars, or whatever is there if the string is less than length 3. Return n copies of the front: frontTimes("Chocolate", 2) → "ChoCho" frontTimes("Chocolate", 3) → "ChoChoCho" frontTimes("Abc", 3) → "AbcAbcAbc" frontTimes("X",...
I'm still working on a parser that can parse log entries from a game called HearthStone, the overall idea is that it will read the log file live when the game is running, parses the log file and show interesting and useful data in real time. For the question the focus is on the API I have created to parse log entries. ...
I found this question in an old exam in computer science. I solved it in a good way, but I'm not convinced that my solution is the best solution. I believe that there's a better way to solve it. Given N Columns that are lined up, The horizontal distance between two adjacent columns (The lower edges) is exactly 1 met...
I recently came to write a regex to parse URLs. Now I wonder, did I miss something? Did I make a mistake or could I have written it cleaner? That's why I'm here. In order to write the regex, I took this paper as a reference (together with some Wikipedia articles about URIs/URLs). //According to http://www.ietf.org/rfc...
I've been working on implementing Google Code Prettify and finally got it to work correctly. You can see my test file here to see what it looks like. I worked from a template and tried to improve it. There is a lot of HTML boilerplate code that apparently is needed (mostly JavaScript links). I tried to remove some of t...
I'm not sure if this site has the right audience for anyone to be able to respond to this, but I wrote a header only scheduler which schedules a task to be run in the future on another thread: #pragma once #include <thread> #include <mutex> #include <condition_variable> #include <future> #include <functional> #include ...
I am new to this Immutability concept and I have some coding experience in JAVA. Recently as a part of internship program, they gave me a 5-day task, which was to implement Immutable Queue. After some research I came with a solution which was given below. Can some review the code. [Technically your are not helping me i...
Here is a pure Python script that saves an HTML page without CSS but with all images on it and replaces all hrefs with a path of an image on the hard drive. I know that there are great libraries like BeautifulSoup and others but I would like to try myself with pure Python. Actually there is no practical usage of this s...
I have a record type which holds a list of table rows. Each row is also a list. The first row is assumed to be the header row. In addition the type optionally defines a filter - a list of columns (the actual string value of the column header). Then the type have a member property FilteredRows. If no filter is defined, ...
Resurrecting my C++ saga, I was given this project for my CS2 class: This problem considers several ways to compute \$ x^n \$ for some \$ n \ge 0 \$. Write an iterative function power1 to compute \$ x^n \$. Write a recursive function power2 to compute \$ x^n \$ using the following recursive definition: $$ x^n...
I have the following code, though I'm not sure it is efficient as it could be. $(window).scroll(function() { var scrollT = $(document).scrollTop(); if (scrollT >= 180) { $("#primary-nav-wrapper").addClass("scroll"); $("#primary-nav-wrapper li.front").addClass("active"); $("#primary-na...
I made a simple C++ snake game, and I want some advice from you: what is good, what I have to improve. One main problem is that flipping (which you'll notice if you play it). #include <conio.h> #include <ctime> #include <iostream> #include "windows.h" const int width = 60; const int height = 15; double diff=0.5; clas...
I am working an a more meaningful way to print objects in VBA. The desired result should look something like this. Console.PrintLine List.Create(1, 2, 3) List(1, 2, 3) The concept is that objects implementing an IPrintable interface are printed as their ToString property. Primitive data types are printed as is Conso...
I wrote this function for my next learning project (cfg parser). What do you think about it? char readline(FILE *fp, char **line, size_t *size) { *size = 0; size_t cpos = ftell(fp); int c; while ((c = fgetc(fp)) != '\n' && c != EOF) (*size)++; if (*size == 0 && c == EOF) { *line = NULL; ...
I'm learning Haskell using the University of Pennsylvania's online materials. I'm a few lessons in and was looking for some feedback about whether I'm thinking functionally enough or porting over my Python background inappropriately. Below are my answers to the problems set out in lesson three (these were someone's hom...
Here is some code I wrote to surface Mint.com transactions that occur at monthly intervals, in order to identify subscriptions I may be paying for without realizing it. I'd like to have some friends try this out as well, but Pandas is not a very common package for non-Python users, and it's requirement is keeping a lot...
Any suggestions for improvement are welcome. public static int[] concatArrays(int[] a1, int[] a2) { int n1 = a1.length; int n2 = a2.length; if(n1 == 0) return a2; if(n2 == 0) return a1; int n = n1 + n2; int counter = 0; int[] result = new int[n]; for(; counter < n1; counter++) { ...
Which one of these are better for the memory? protected static List<Line> CreateBolt(Vector2 source, Vector2 dest, float thickness) { //... for (int i = 1; i < positions.Count; i++) { float pos = positions[i]; float scale = (length * Jaggedness) * (pos - positions[i - 1]); float env...
I was inspired by Stas Kurlin's Nim game to write my own. I'm new to Haskell, and quite unfamiliar with monads, do notation, and -- in general -- functional design patterns. In the game of nim, two players begin with a number of sized piles, e.g. piles of stones. Each player moves by taking a (non-zero) number of stone...
I'm writing a chat application. I would like to know if there are problems in this code. This function sends message: function sendMessage() { var text = $('#messageBox').val(); $('#messageBox').val(''); if($('.context').scrollTop() + $('.context').innerHeight() >= $('.context')[0].scrollHeight) { ...
Now I am doing Project Euler number 1: If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Find the sum of all the multiples of 3 or 5 below 1000. This is my code, which runs in 0 milliseconds: static void Main(string[] args) { Stopwatc...
I want my Python decorators to have optional arguments and not be called when not necessary. The accepted answer in here doesn't accept named arguments, and I don't want to add boilerplate code inside decorators, so I came up with an alternative decorator: import inspect def decorator_defaults(**defined_defaults): ...
A small project I recently started. The program must sum all the numbers the user input. You must first specify how many numbers there will be. Sumaster.c #include <stdio.h> int main(void) { unsigned short int num = 0; while(num <= 0 || num >= 256) { printf("Enter number of values to sum: "); ...
I created a class called QuickBitmap to quickly get/set pixels in a Bitmap object. Using intertops I'm able to safely lock/unlock the bits of the Bitmap and with the use of methods like SaveBits, LoadBits, UpdateUnderlayingBitmap, GetPixel and SetPixel. I can quickly and easily manipulate the image. The problem: One of...
I have written a code for basic array creation and printing it's values in C. I would appreciate comments on how it can be improved, and the industry standards. One issue I'm encountering is having no way to tell printArr() what the size of the array is. Some questions: Can I use arr[i] anywhere in the functions inst...
I have written the following Tampermonkey/Greasemonkey script. I am trying to obtain a list of all CSS rules for a page; across all stylesheets. As of now, I am just iterating over everything. Is there a faster way to obtain the rules? Also, I feel that there is a more efficient way of converting the CSS text to an obj...
I am trying to create a class for serial port using Node.js, but I want to know if there is a better way to write my data class code. In my sample code below, in the getPortName prototype in the forEach loop, I declare a port object to store the serial port information before pushing into an array. Is this a good way o...
This question pulls content and ideas from a good many of my other questions and their answers, and pulls a lot of things together. I am quite satisfied with my approach here, but seeing as I'm refactoring my app, I might as well ask about my practices and get suggestions for improvements. This is my search method (th...
I am learning Tree Data Structures and came up with this code for implementing basic Tree Node using class and performing various Tree based operations like Traversals and others. The code works perfectly but the structure is bothering me a lot, such as this line of code here: print(tree.size(tree)) How can I improve ...
This is a makefile I wrote to compile a simple OpenGL test project which is going to use the libraries GLFW and the C library glad.c. CC = gcc CXX = g++ COMPILE_FLAGS = -Wall -ggdb -O3 LINK_FLAGS = -lglfw3 -lopengl32 -lglu32 -lgdi32 glfw = d:/external/glfw-3.1 glfw_inc = $(glfw)/include glfw_lib = $(glfw)/lib64 glad...
Here's my code for a consise node.js HTTP server. It does work as intended, but I'd like to ask if there's any glitch or to be improved. var httpServer = function(dir) { var component = require('http') .createServer(function(req, res) { var fs = require('fs'); var path =...
Please help me to refactor. I have two models, conversion & statistic. Methods sales_today, revenue_today, profit_today in conversion model only gets specific info from db. Statistic model class Statistic < ActiveRecord::Base class << self def create_and_update_today(agregate_name, value, network) today = find_or_...
Is there a way I can make the code compact and with fewer ifs? theData = GetData(); if (theData.Rows.Count > 0) { MyModel = new CustomModel(); dataSetRow = theData.Rows[0]; if (theData.Columns.Contains("Column1")) { if ((!object.ReferenceEquals(dataSetRow["Column1"], DBNull.Value))) { ...
I've got a goal and that goal is to become an Angular expert. So what better way of learning than to create an online store for pies, right? I've just finished the registration part and would like some feedback on it. The registration process happens via Firebase's AngularFire, I decided to use Firebase because I've h...
I have a model such as this below that acts as a base model. Several other models inherit from this one since they will all share common properties. Would an approach like this fit best practices or would it be better to go another route. I'm aware that composition is always considered a best practice. public class Bas...
I am doing some coding exercise, and I am not sure if I have met the requirement. Can someone help me to figure it out? How would you design a stack which, in addition to push and pop, also has a function min which returns the minimum element? Push, pop and min should all operate in O(1) time. public class Question { p...
I have an object created by a JSON data. I need to retrieve the id for an object, I would like to know if a faster way exist, considering I am using for ..in loop. var test = { id: 0, cnt: [ { id: 1, cnt: [ { id: 2, cnt: [ {...
I have developed this simple TCP Server/Client communication program, and am looking for ways of lowering the code footprint where possible.Side note, Both Classes are Main as they run independently, though interact. TCPClient package socketUse; import java.io.BufferedReader; import java.io.DataOutputStream; import jav...
I created a configuration View. so it binds a lot of properties in Viewmodel. But I have a another class People and I want to assign properties of viewmodel to class People. class Viewmodel { public string name {get;set;} public int age {get;set;} public string nationality {get;set;} public string hobby {g...
I have a Back function, and it is growing. I also think this is terrible, but I don't seem to get how it can be improved: public void GoBack() { NavButtonUsed = true; Forward.Insert(0, Back[0]); Back.RemoveAt(0); if (Back[0].Title.StartsWith(" ") && CurrentItem.Menu != Back[0].Menu) { swi...
I've built this EF for storing data for web scraping. Any ideas? What am I missing? namespace Identity.Core { [Table("Entities")] [Description("Entities Common Information")] public class Entities { //Entities //123123-123123-123123123-123123 [Entity.EntityUniqueId] //John E ...
I tried to implement the Repository pattern for my project: MemberController.php -- this one is a bit too long and has repetitive code <?php class MemberController extends \BaseController { private $repo; public function __construct(MemberRepository $repo) { $this->repo = $repo; } //////...
I am working to complete this even further, but here's what I've got thus far... (See my other post for the definition.) protected override void Seed(Identity.Console.IdentityDBContext context) { //Add Country and States... context.Countries.AddOrUpdate(x => x.Alpha2, new Entitie...
The objective of this program is to call enqueue sequentially with multiple URLs, and never block, fetching the URLs asynchronously, but on the order they were entered. In other words: keep calling enqueue to add urls to a buffered channel (queue) (possibly with a specific callback), and consume one by one in the order...
The code below grabs the contents of a .txt file, and scans each character of it, using that data to create a tile set. My main concern, is that for each loop, I am opening and closing a file each time, and that is obviously performance-intensive. I want to create an array of images, based on the files, but I'm not sur...
I have now written a simple square root calculator using the division method: static void Main(string[] args) { double num, sqrt = 0; int currentDecimal = 0, decimalAccuracyLevel, intAccuracyLevel = 5; do { Console.Write("Enter your number: "); } while (!double.TryParse(Console.ReadLine(), ...
This is my first project I've written totally from scratch. It hasn't been styled yet so it's pretty ugly and it's missing some features but the core functionality works. I would love to get feedback on things I can improve on and any bad practices that I should work on correcting now while I'm still learning. Demo So...
I am fairly new to javascript and I would like to write my code on a more readable and efficient way. Any critique of what I've written would be greatly appreciated, especially the section of hexValues.first = changeHex... Also, should I have two files going for this code? And if so, how should I best split it up? (fun...
I've written what I believe is a valid dynamic programming solution to a variation of the rod cutting problem. In this problem, the goal is to make as few cuts as possible on a rod of length n. I have two questions: Is this a valid dynamic programming solution? How can it be improved? (This is not a school assignment...
I'm modelling the core entities in a callcenter-related system that deals with Operators and groups ("pools") of them. While I've written some Python before, this is my first time building a larger project in it from scratch, and I'd like to know if my approach and code is pythonic enough or will get me into trouble la...
First of all, this code will ask for a number (first) on how many test the user would like to have. Then the user will input the strings depending on how the number entered. Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim input As String = txtInput.Text Dim inputArr As Stri...
So I received a comment on my previous question that suggested creating a Dictionary of my menus to store the data in. So that got me thinking, all I am doing is going back to the first instance of MenuItem in the ItemList that has a Menu of Back[0].Menu. So why not just iterate through there and open the menu when I...
Since I am new to Java, I wanted to see if there were better ways of answering the same question. Are parts of my code redundant or maybe there's an easier way to get the same result? Problem J4: Big Bang Secrets The encoding algorithm is a Caesar cipher with a shift (\$S\$) that depends on a parameter (\$K\$) and its ...
Please critique my implementation of a tail-recursive method for generating the Fibonacci sequence: def fib(n: Int): Option[Int] = { @tailrec def go(count: Int, prev: Int, acc: Int): Option[Int] = { if (count == n) Some( acc ) else go(count+1, acc, acc + prev) } if ( ...
Challenge: Reverse the digits of a number and add it to the original until the number is a palindrome Specifications: Your program should accept as its first argument a path to a filename. Each line in this file is one test case containing an integer n < 10,000. Assume each test case will always have an answer a...
Is this example the correct way of writing an Async controller end point in Scala using Play 2.3? def submitResponse(qkey:String) = CorsAction.async(parse.json){ req => val json = req.body val channel = json.\("section").as[String] val currentQuestionKey = Cache.getAs[String](channel).getOrElse("...
There are 2 arrays. One that consists of Categories and one of Products. Each product pertains to its specific category. I want to join each product to its right category (a category can have multiple products). Each product that 'finds' its category will go in this category's products array. for ($i = 0; $i < count($p...
I'm trying to get a better grip on the new functional possibilities of Java 8. As an example, I took this very elegant Haskell snippet: nqueens :: Int -> [[(Int,Int)]] nqueens n = foldr qu [[]] [1..n] where qu k qss = [ ((j,k):qs) | qs <- qss, j <- [1..n], all (safe (j,k)) qs ] safe (j,k) (l,m) = j /= l...
Following is the code I am using to find a separate count for alphabets and numeric characters in a given alphanumeric string: Public Sub alphaNumeric(ByVal input As String) 'alphaNumeric("asd23fdg4556g67gh678zxc3xxx") 'input.Count(Char.IsLetterOrDigit) Dim alphaCount As Integer = 0 '<-- init...
I have a system which reads in a clause in the form of a prolog "fact", i.e. 'is'('a sentence', 'this').. I want to generalize this up into higher-order classes and types, rather than just single words. At this juncture, one things I'm going to try out, as a sort of initial step, is the just generate all the hypernyms ...
I'm working on getting switch and if statements down and I came up with this. It works well and I don't have any problems with it running properly. I was wondering if I could get some feedback on how I put it together. If there are things I am doing wrong or could do better, I'm very open to suggestions! public stat...
I have an UserControl where I declare two DependencyProperties int? Level; CardBase SelectedCardBase; A non-null CardBase object will always have 2 read-only integers: MinLevel and MaxLevel. The UserControl allows the user to change as he desires both DPs, and the internal logic must ensure that both DPs have valid va...
I have been working on my Pong game and I added some nice new things to it. You can now select the difficulty on the start screen and I also added a pause screen. Also I gave the Pong ball a tail just like in Snake. The game is running fine on Windows but on Android, each 1/2 sec, I'm getting small FPS drops. I was won...
I'm fairly new to JavaScript. I would like some feedback on the naming and grouping of the following code. Is there any change that will make it more readable? Template.documentPage.events({ 'click .hint-text': function(e) { e.preventDefault() var currentHintId = $(e.target).attr('id') Session.set('curre...
Does it make any sense and how to modify the JavaScript/jQuery code below to increase the performance? The working code is: var rightTr = $(".superBlock div.right tr:visible"); $(".superBlock div.left tr:visible").each(function(i){ if ($(this).height() != rightTr.eq(i).height()){ if ($(this).height() > rig...
Goal Design a representation of a mage character from the World of Darkness RPG, as well their associated spells. Here is a visual representation of the schema. You can see it more closely on LucidChart if you like. You can also see my draft here and on YUML I have already made an attempt at laying out the models, ...
I wrote this short, plain Ruby lib to handle email address validation inside and outside of Rails applications, and I would like to know what you think. require "i18n" class EmailAddress VALID_EMAIL_ADDRESS_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i def self.malformed?(email) email !~ VALID_EMAIL_ADDRESS_RE...
I've created a simple Perlin noise generator in JavaScript and am trying to find ways to optimize it. It lives inside a webpage and generates an image using nothing more than random number generator and a lot of arrays and algebra. The end result is kind of slow. Not unusable, but a lot slower than a Java applet woul...
Problem Statement : Design a class for three operations for given set of integers : int getOrder(int data) /* order meaning rank in list */ int getData(int order) void updateData(int oldData, int newData) /* [Most used operation] */ My solution class App { Set<Integer> appData; public App(List<Integer> data...
I want to print the following triangle: 1 1 2 1 2 3 1 2 3 4 1 2 3 4 5 1 2 3 4 1 2 3 1 2 1 I tried to do but I cannot avoid two for loops. Is it possible to achieve the result in a single for loop? static void printtriangle() { for (int i = 1; i <= 5; i++) { for (int j = 1; j <= i; j+...
I am trying to parse the command line arguments using argparse, and if the user specifies a yaml file for the config-file, add those arguments to the args from argparse import argparse import yaml from pprint import pprint class CLI(object): def execute(self): self.create_parser() self.options = ...
I need to calculate at which year a school class has started, given the year they currently are in. For example a class of 2nd graders have started school in 2013, if I pass 2 to the function it should return 2013. So, I need to take x years and 6 months out of a date, I was wondering which is the better way to do it. ...
I'm building an angular application using AngularJS and AngularFire. As this is the second part of this "series" it might be a good idea to also check out part 1 to gain an even better overview of the register/login process. I have a few concerns here: It feels like I shouldn't need to have a $scope.loggedIn variable ...
This question is a follow-up to: High-Low Guessing Game Now with shiny new graphics in JavaFX. You now have the awesome ability to choose which numbers to guess between. Now with Git Repository! Main.java package sample; import javafx.application.Application; import javafx.fxml.FXMLLoader; import javafx.scene.Parent...
I use it in a number of embedded devices. It loads the query parameters from an HTTP GET/POST request and prints them to stdout in FORM_key=value format which then get set as an environment variable. Source: char * FP_strdup (char *string) { char *result; if (string == NULL) return NULL; if ((result = (char...
I'm trying to create a read-write-execute permissions system for items using user-group-world system. I already have the user/group system set up, just not the permissions. This is what I wrote: /** @param $requestedPerm the permission being requested: read write or execute - 4, 2, or 1 respectively * @param $level ...
I made an algorithm to calculate when the user has to purchase material adjusting the date in which the order has to be made, I'm using datagridviews to make it work, but I was wondering if there is a better way using a DataTable. private void Suggestion() { for (int i = 1; i < dataGridView9.RowCount; i++) {...
I'm attempting to speed up my genetic algorithm that modifies images. After searching, I've found that my fitness function is the bottleneck, taking sometimes up to 11 seconds to complete. The fitness function accepts two images and returns a float representing the total difference between the images' corresponding pix...
Print the first 10 lines of a file, if it has less than 10 lines, print the whole file. Any suggestions on any kind of improvement are welcome. package je3.io; import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; /** * Created by IDEA on 29/01/15. */ public class Head { public s...
I was hoping that some more experienced programmers could help me make my implementation of Dijkstra's algorithm more efficient. So far, I think that the most susceptible part is how I am looping through everything in X and everything in graph[v]. My graph is formatted as: g = {0:{1:2}, 1:{0:2, 2:6}, 2:{1:6}} This is ...
Any advice would be great. I watched a few videos over the last 3 weeks and made a program up; what do you think? The program is a business ideal for a few computers in a shop, some computers with training and the rest of the computers without. (for gaming, etc.) import java.util.Scanner; public class n_com { pu...
We're doing a website for Cardshifter, and now I've converted the plain html files and css into a Spring MVC web application. Here is the typical configuration classes that I used in most of the project I work with. package com.cardshifter.io.web.config; import org.springframework.context.annotation.Bean; import org....
I'm trying to produce a 3D point cloud from a depth image and some camera intrinsics. The image is 640x480, and is a NumPy array of bytes. The output is a (rows * columns) x 3 array of points. I've gotten the function to work perfectly, but it's way too slow! (takes like 2 seconds per image to process). I'm wondering i...
I wrote the following code to integrate the product of four functions. Two of the functions are hypergeometric functions and the other two are incomplete gamma functions. I have written each function as an infinite series, one per nested loop. The first loop (variable k) is for time. y1 = 0; for k = 1:L-1 for i = 0...
This is an extension of my Attributes system I wrote about in these questions: Lvl 1 upgradeable attributes Lvl2 upgradeable attributes It is unrelated to the core functionality under review in those questions, but I present them for reference. I wrote a banded interpolator. This takes a set of input ranges mapped to...
I need a method that clean up a string considering these few rules: Remove or not Spaces Remove or not Special Chars Remove or not Numbers Descaptalize or not the string (this is don't really needed but I included it anyway). I did some google if exists something that already do this, but found nothing, so I came up...
Print the tail of a file, if the file has less than 10 lines, then everything available is printed. Any suggestions for improvement are welcome. package je3.io; import java.io.IOException; import java.io.RandomAccessFile; /** * Created by IDEA on 29/01/15. */ public class Tail { public static String[] tailLines...