instruction
stringlengths
71
71.9k
I have tried to solve the following problem on SPOJ.com: You are given a sequence A[1], A[2], ..., A[N] . ( |A[i]| ≤ 15007 , 1 ≤ N ≤ 50000 ) A query is defined as follows: Query(x,y) = Max { a[i]+a[i+1]+...+a[j] ; x ≤ i ≤ j ≤ y } Given M queries, your program must output the results of these queries. When I run it,...
I've decided to write my first project in Python. I would like to hear some opinion from you. Description of the script: Generate Trivago URLs for 5 star hotels in specified city. Scrape these URLs to get prices. Save results as SQL queries in text file Execute queries from text file to upload results to database. Se...
This is a follow-up to Recursive binary search tree changes: Used raw pointers rather than std::unique_ptr const correctness Made variable names more beautiful implemented at() How can I improve this code? template<typename K, typename V> class binarySearchTree { struct Node { K key; V val; ...
I am trying to read a dynamic record length binary file, which has data like this: field1field2field3field4vector1vector2 Here, field3 defines the occurrence of vectors. For example, field3 is 2, then vector1&2 would be present and if the value is 3 then vector1,2&3 would be present. Let's say field1-4 is fixed, the l...
In my WP8 application I need to show a couple of radio buttons to let the user select a value out of an enum. I don't want to hardcode either the value or the text (description) showed to the user. I would like my Model/ViewModel drive them for me. As of now, this is what I have: //enum defined in model public enum Un...
This checks the intersection between a Ray and a Plane and between a Ray and a Quad (in 3D): import Linear data Ray a = Ray {rayPos :: V3 a, rayDir :: V3 a} data Plane a = Plane {planePos :: V3 a, planeNorm :: V3 a} type Quad a = V4 (V3 a) hitPlane :: (Num a, Fractional a) => Ray a -> Plane a -> V3 a hitPlane (Ray...
How can I improve the performance (in terms of computation time) of this code? # Settings const nbloci = 100 # length of the genome const N = 100 # Number individuals in the population const nbgenerations = 100 # number of generations const mu = 1/10^5 # mutation rate const s = 0.01 ...
This module allows to parse indented text file into Map from node to child nodes identified by Coordinate. This module seems way too complex - mainly because of managing stack that allows to "jump back" with decreasing indentation. How can I redesign it? sample input: a b c d e f produces: *Parse> parse tree f...
Write a function (in Haskell) which makes a list of strings representing all of the ways you can balance N pairs of parentheses: Example: balancedParens 0 [""] balancedParens 1 ["()"] balancedParens 2 ["()()","(())"] balancedParens 3 ["()()()","(())()","()(())","(()())","((()))"] My code produces the right answer ...
This seems to be working fine. I am pretty sure there is a better way to do it. How can my code be improved performance-wise? The main thing bothering me is the nested for-loop. function arithGeo (arr) { var isGeometric = false; var isArithmetic = false; var diff = arr[2] - arr[1]; var ratio = arr[2] / ...
I am a beginner, and I believe I made a simple and efficient program to do it in. I can add more methods for more detail for future updates, but it's a workable bit. import java.util.Random; import java.util.Scanner; public class TownGenerator { private static Scanner k; public static void main (String [] args) { ...
I have a MessageTree class that represents a binary tree of negative/positive. I'm looking to improve my walkTree method and make it more functional and succinct. Right now the try/catch is kind of ugly. The goal is to feed an array of "steps" (Array[Boolean]) that indicate whether to walk right or left through each no...
I am trying to solve the RIVALS problem on SPOJ: Starting from (0, 0), how many paths are there to reach point (X, Y), only taking one-unit steps moving to the right or up? Constraints: 0 ≤ X ≤ 106, 0 ≤ Y ≤ 106, answer is to be given modulo (109 + 7). I am facing a performance issue with accessing elements of a list. ...
I have set alert dialog on textview's onclicklistener, and there I have added some items using array adapter. Now what I want to do is check if the user selects an item from the alert dialog and clicks on submit. It should submit, otherwise not. But as per my if I select or not it displays message fill the details. bo...
I have about 1000 .xml files in different sub directories under one root folder. My root directory contains the below structure: RootDir\172\00ad8dc-bff\25.0.xml RootDir- The root directory for all my .xml files. 172- The sub directory of the "RootDir" directory. There are many such directories (I gave 172 as an examp...
Is there a better way to refactor the join and fetch the required attributes or is there any better option here? #student.rb class Student < ActiveRecord::Base has_many :subjects end #subject.rb Class Subject < ActiveRecord::Base belongs_to :student def self.get_all_subjects_and_student_info protocol_s...
I have the following function: def dnd_return(number,my_timeout): try: r =requests.get("https://dndcheck.p.mashape.com/index.php?mobilenos= {}".format(number), timeout =my_timeout) except (requests.exceptions.Timeout, requests.exceptions.ConnectionError) as err: return "Error fetching DND info" ...
What are your opinions on my JavaScript function? Can my code below be refactored? var updatePrice = function () { var goPrice; var returnPrice; if (typeof scope.selectedGo !== 'undefined' && typeof scope.selectedReturn !== 'undefined') { for (var go in scope.gooffers) { if (scope.gooffe...
I am 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 this question I focus on the module that provides an API for the actual log ent...
I am wondering which method code is more "Pythonic": def load_job(self, identifier, job_name): i = 5 ex = None while i: try: for ep in iter_entry_points(group='core.account', name=identifier): self.modules[identifier] = ep # load_entry_point(ep.dist, 'core.acc...
In groovy I have a list of files A and also another list of files B. I want to remove all the files from A that have a filename that also occurs in the list of files B. I wrote the following code: List<File> removeByName(final List<File> files, final List<File> removalFiles) { final Set<String> removalNames = remov...
I have a configuration file which holds several file paths. If these paths are relative, I want them to be relative to the path of the configuration file (and not to the path of the user working directory ("user.dir")). Since it's not possible to change the working directory with Java, I've written this method: public ...
I got this requirement recently: Write some code that prints out the following for a contiguous range of numbers: the number 'fizz' for numbers that are multiples of 3 'buzz' for numbers that are multiples of 5 'fizzbuzz' for numbers that are multiples of 15 e.g. if I run the program over a range from 1-20 I should ...
I have the following code. Providing two objects cmd and this.xxx.properties, script detects the only property changed and mutate the input object (cmd). Script works fine but I would like to know if I could optimize or improve my code for speed. _deltaProperties: function (cmd) { var dataBefore = this.xxx...
Basically, I need to regroup keys by values from an object to an array An example worth a thousand words in my case, as I don't know how to clearly explain my problem. Here is my input object: { "Data 1": 0, "Data 2": 1, "Data 3": 3, "Data 4": 0 } What I should output: [ ["Data 1", "Data 4"], // da...
I'm new to Groovy, and coming from PHP it's been a rough transition. The code below works. However, I would appreciate feedback on how better to write it and follow good practice with Groovy. I anticipate doing a lot of Excel work in the future, and so tried to make this program reusable for more than just FizzBuzz. /*...
I'm new to Matlab and I would like to know tips in order to reduce the processing time of such program. The scheme of the actual code is very similar to typical C++ code and I would like to vectorize the for and if loops in order to decrease the processing time. The code is added just to make you know the overall idea ...
My insight here is that it's usually not useful to distinguish between null and empty strings. Sometimes it is, but usually not. Usually I like to assign my strings as empty if they would have been null. var lastName = Request.Params["lastName"] ?? "" Thus I had the idea of a struct which would wrap a real string, inte...
I'm a Java developer, I'm new to Ruby and I'm worried that I'm forcing or not-so-well using the goodness of the Ruby syntax. What do you think about the Exception catching and how to print it in error messages? What about the code block (closure?) I'm passing to the "until" method? Is it ok to implicitly rely on what...
I have the following requirement for valid usernames: Only alphanumeric characters and - Must not start with a - I wrote this regex (on Rubular): /^[^a-zA-Z0-9]|[^a-zA-Z0-9-]+/ Is there a better to test this requirement other than to iterate through all the possible scenarios? I'm doing something like this. # Ther...
During Winter Bash 2014, the Naruto hat was awarded to users who gave an answer that got accepted but hasn't received votes for 12 hours. It was a weird thing, really: why would someone ever accept a question but not upvote it? I haven't yet experienced a situation where this would be reasonable. Accepted answers witho...
I have this basic question about the efficient way to sort user-defined object. It can be done in many ways, but most of sorting algorithms at best cases is \$O(N)\$. I have come up with a fair approach to get \$O(N*log(size() + N))\$ by using std::set. Is it a good choice in such a case? #include <iostream> #include <...
I'm new to coding and I am self-taught up to this point, so my scope for creativity is quite limited. As such I'm doing something in particular that I suspect isn't the "best" way of achieving this very simple task. Basically, all I'm trying to do is remove a message notification which pops up after ajax has been perf...
I managed to create a Sudoku generator but I'll just go ahead and say that it generates 1 out of 500 tries on average. I'd say that's pretty inefficient and I'd like to ask you for advice on improvements. Basically what I figured is if I had defined a range of numbers that are possible for each cell, then started selec...
I'm building a search for Magento. Magento API doesn't provide an easy way to look up a customer using a phone number so I created a custom solution. My MySQL/PHP OOP skills are limited. Did I miss anything or is there a better way to do this? <?php DEFINE ('DB_HOST', 'localhost'); DEFINE ('DB_USER', ...
I have been running a program to read a file having 6 million rows and validate each line and write the string containing the validation message to an output file. I am using spring integration to achieve that as well as invoking spring batch from spring integration using spring batch-integration adapters. Spring batch...
I am quite new to C#, currently working through a number of pluralSight courses. I've written a few small things here and there, but never anything that performed an entire purpose/function from start to finish, until now, with this app. The app lists all the JPEG photos in an import folder and collects the takenDate f...
I have written my first regex: static void Main(string[] args) { string phoneNumber= Console.ReadLine(); Regex pattern = new Regex("(1-)?\\p{N}{3}-\\p{N}{3}-\\p{N}{4}\\b"); MatchCollection collection = pattern.Matches(phoneNumber); Console.WriteLine(phoneNumber + " is " + (collection.Count == 1 && co...
Based on these guidelines I optimised Bresenhams line algorithm, it now fits for all kinds of line cases like images a, b, c, d, e, f, g, h show in those guidelines. This is my test.txt input file for all line cases: x1 y1 x2 y2 10 10 50 10 10 20 50 20 60 10 60 50 70 60 70 10 80 30 100 50 100 60 80 40 110 60 130 40 1...
We have another team who is going to expose class packages for use to scan and pickup details from. If they should add some new packages or rename old ones I don't want to have to recode a thing. I am trying to get some input on the best way to accomplish that For the sake of maintainability we only want the code for ...
Details Can anyone instruct me on a more optimised way of querying this statistics of registered users? I currently lack the knowledge to create a better query. Right now it works fine, but I want to learn more about other ways to do the same thing and improve on it, this way I can expand my knowledge on MySQL, and st...
I have made a simple C# script that will find the largest palindrome made by the product of two numbers. These numbers will be between a minimum and maximum value, inputted by int.Parse(Console.ReadLine()). Is there a way to make this better? It is brute force, however I tried to make it use fewer numbers if one combin...
The problem is to count all possible sub-sequences of "welcome to code jam" in a given input string (and only return the last 4 digits of the count). Here is the link to the problem for reference. I've implemented a solution in Haskell that worked fine on the examples and small datasets but failed on the large data se...
Problem: Write a function that takes a String document and a String[] keywords and returns the smallest substring of document that contains all of the strings in keywords. Notes: document will contain at least 1 word document will separate words by a single space A word can only contain [a-z] and can appear multiple ...
Problem: dynamically calculate status in MLM only based on a structure. It works correctly but it's so slow. Only test processing takes about 20 seconds. I tried to replace some lists by generators, but it was bad solution, because they have to be changed during runtime. I have no more ideas of enhancements but I'm sur...
I have written code for scanning an N x M matrix in spiral order using a recursive function. It uses 5 parameters - including 2 extra variables: call to keep track of the no. of current call counter to keep track of no. of elements already printed Example: For matrix: 1 2 3 4 5 6 7 8 9 For call = 0: Output: 1 2 3 6 ...
I created the most simple though still quite flexible jQuery slider ever! Or at least, I hope so. var slider = $(".slider-ul"); slider.each(function () { var e = $(this), images = e.find("li"), current = null; slide(); function slide() { images.each(function() { var...
I'm building a RESTful API in PHP using the Phalcon framework. The API will consist of multiple modules (e.g. api.example.com/mail/users, api.example.com/web/users, etc). So I want to put all module specific logic at one place as much as possible. I have a lot of programming experience but PHP is all pretty new to me. ...
I am using this for in loop to loop through a JSON object and to assign the JSON object's value to my own object in a KnockoutJS setup. The JSON object looks like this: [ { categoryId: "013", categoryName: "Toys", id: 2328, name: "Megatron", summary: "", price: 120, extraInfo: { ...
Find the LCA in binary tree, where a node is also its own ancestor. This question is attributed to GeeksForGeeks. I'm looking for code review, optimizations and best practices. public class LeastCommonAncestor { private TreeNode root; /** * Constructs a binary tree in order of elements in an array. ...
Basically, I wish to have 3 printers to print in error state, success state or info state which means nothing but different colors. class ColorCode{ private static $options = [ "dark_gray" => "1;30", "light_gray" => "0;37", "blue" => "0;34", "...
Yes, yet another challenge on CodeEval! This one has the purpose of finding the major element of a sequence: the element which appears in a sequence of size L more than L/2 times. I have this: import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.util.Arr...
I have implemented a LinkedList in C#. What would you change/make better? What naming conventions are misused? What would you add? Some of my ideas are to make it thread-safe. using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; n...
Below is my code for a simple console base car game. Is this a good approach or am I missing anything? CarG.h #ifndef CARG_H #define CARG_H class CarG { private: int sleep; int points; int n, n1; char cash, keyp; public: CarG(); void gotoxy(int x, int y); ...
I created a function to test whether a single word string can be a rearranged into a palindrome (doesn't have to be a real word). My logic was if the string has an even number of letters, then each letter must occur twice. If the string has an odd number of letters, each letter must occur twice except for one. functio...
I've been designing a game engine for the past few months with little issues. However, one main goal with this project is to put it on my portfolio/résumé so naturally I want the code to be as good as possible. With that in mind, I got a little worried today because I designed a fair amount of my engine around using ...
My code goes from a class to DataTable, and back again. It populates the class's public properties, or creates DataColumns whose names and types match that of the the class's public properties. It also has methods that allow the developer to go from a query to a populated class, or from a class to an SQL script or SQL ...
The below code is for a simple password encryption/decryption program. The code is working perfectly, but the only thing I want to know from you is if this is good logic. PEND.h #ifndef PEND_H #define PEND_H class PEND { private: char UString[30]; char Password[70]; int key; int ra...
I'm developing an application to manage a player card-library from an online game. Each card has an image that is stored on disk with a numeric code, for example, the card with ID=1234 has his image stored as 1234.png and all the images are stored on the same folder. As of now there are more than 3500 images for a tota...
I'm new to writing VBA and having spent most of the day writing some code, I have finally got it working but it looks horrible. I'm hoping that someone can help me tidy it up. The code simply copies certain cells from one sheet into another. If a particular cell in the source sheet contains the word "Accepted". Columns...
I've written two functions: is_integer(), which tries to get a positive or a negative integer as input and returns the same value. square(), which takes this returned value as parameter and returns square of the same. The code in square() uses a for-loop that squares the integer by 'repetitive addition.' Finally, the...
Objective: A lightweight shell that runs on a microcontroller (MSP430) and parses incoming data into a command and additional parameters. Requirements: Support of quoting in parameters using " Escaping special characters using \ in parameters Ending commands with \r or \n Separating parameters using or \t Sendin...
Version 1: Graph implementation adjacency list 1.0 Please note the following: All edges are directed A user of the class Graph shall never be able to aces an object of type Edge or Vertex Only class Vertex can create an object Edge and only class Graph can create an object Vertex No loops are allowed Maximum one edge ...
I wrote a small scientific simulation where I wanted to manipulate vectors with the same kind of functionality that Python's NumPy vectors use. Namely, I wanted to be able to add vectors together, multiply by constants, etc. I have need for both vectors of type int and floating point, so I wanted to template the overlo...
R does not support line continuation as Python, and it's disturbing to have long file paths like /media/user/data/something-not-very-important-but-super-long/some-curious-secret-file.pdf and can't break it into multiple lines. The workaround is to use the file.path function: file.path( "/root", "folder", "file....
My project is composed of several parts: Repositories, Services, Domain objects, etc in a .NET MVC web application. My repositories handle all data i/o, the services are responsible for CRUD operations as well as other logic, such as getting a count of objects from the database. I am trying to shift from an "anemic" do...
I'm making a calculator that can solve calculations that are inputed in a very raw form. Say: "3*52+11+3/2" I'm using the console, at least for now. This will also take in consideration that multiplications and divisions should be completed first, so 2+3*4 is 14 instead of 20. I wanted someone to see if there are more ...
var addToTeam = document.getElementsByClassName('addToTeam'), parentElement = document.getElementsByClassName('playerTypeBlock'), playerName = document.getElementsByClassName('heading'), totalVal = document.getElementById('totalvalue'), tableBody = document.querySelector('.totalPlayers'); var updateP...
state object - a state or scene from the game. When the start function is called, the state starts rendering, shutting down any other state using the renderer, and calling the specified functions (init, update, etc.) as necessary. state constructor - given an object definitions, it overrides the object's default settin...
Task: Print sum of first 1000 primes. public class PrimeSummation { public static void main(String[] args) { System.out.println(sumFirstPrimes(1000)); } // Calculates the total of the first n primes public static int sumFirstPrimes(int n) { /* Since 2 is the only even prime it is pre-inc...
This was found on CodeEval. Challenge: Write a program that prints out the final series of numbers where those divisible by X, Y and both are replaced by “F” for fizz, “B” for buzz and “FB” for fizz buzz Specifications: Your program should accept a file as its first argument. The file contains multiple separated lines...
I have a structure like this: <a> <b> <c>foo</c> <d>bar</d> </b> <b> <c>baz</c> <d>qux</d> </b> </a> I set /a/b as context and loop through all occurrences to get the texts of c and d: VTDGen vg = new VTDGen(); vg.parseFile("test.xml", true); VTDNav vn = vg.getNav(); AutoPilot ap = new AutoPi...
My implementation of generic Tree structure: /** * Tree data structure */ public class Tree<T> { private T value; private Tree<T> parent; protected List<Tree<T>> children = Collections.emptyList(); public Tree(T value) { this.value = value; } public Tree() { } /** *...
Previous question: Text-based Tetris game with CRTP - follow-up 2 Summary of improvements: Fixed Issues preventing the code from compiling on Clang Implemented helper class range_impl Removed all std::initializer_list Elimination of magic numbers How can I improve this code further? Tetris.cpp #include <iostream> #i...
I am reading a large data file where the time is given in number of days since some epoch. I am currently converting this to Python's datetime format using this function: import datetime as dt def days2dt(days_since_epoch): epoch = dt.datetime(1980, 1, 6) datelist = [epoch + dt.timedelta(days=x) for x in days_s...
I am using the following code to copy the contents of two files into one. Earlier I was not closing the Buff and as eclipse gave warnings I did close it. I want to know if this code is susceptible to failure. public void mergeFiles() throws IOException{ ArrayList<String> list = new ArrayList<String>(); ...
Following from this question I created a Image cache of sorts (let's call it version 1.0) that used WeakReference as "cache" items. And this comes from the accepted answer: It looks like weak reference would serve the purpose of what you are trying to achieve [IF] those images will go out of scope (not being directly ...
I have been using the John Resig JavaScript class implementation in my web apps, but the tests shows it is really slow. I really find it useful for the way of extending objects, and the benefits got from having a better code and less redundancy. In some post was explained that it was slow because of the how the _super ...
Here's my function for calculating the volume of a tetrahedron. I've tried to comment well and perform a few checks on the types of the objects passed to it. Can the comments be improved? I'd also like an opinion about my method for checking the object types. Is it better to use assert for this? # eg9-tetrahedron.py im...
This code is used to toggle buttons within a div: var chosen = {}; var form_name = 'the_div'; function(what) { if('number' != typeof what) { // toggle-one var el = $(what); var name = el.html(); var ch = ['success','default']; if( !chosen[name] ) ch.unshift(ch.pop()); el.remov...
These functions work well for me. Can they be improved or made more standard in some way? Each function has a documentation header block, which contains a description of what it does, along with example usage and reference links where applicable. :<<COMMENT Alias function for recursive deletion, with are-you-sure p...
I am learning CoreData and I wanted to have my code reviewed. As usual, I get something to work, then I attempt to refine it. I have a data model that consists of an Item entity and a subItem entity. The Item has a 'to many' relationship with the subItem and subItem has a 'to one' relationship with Item. Basically I...
I am declaring a "class" using a "constructor method". In both samples, properties uuid and dateCreated are initialized but in different places. I would like to know the "best practice" in this scenario and why (also in terms of readability). Solution A define([ 'dojo/_base/declare', 'dojo/_base/lang', ], func...
I am working in C# to write a scheduling application for operations in a factory. I have a custom class Workday, with properties to represent a Workday for the operations in the shop. I also have a class Timeline that contains a dictionary of DateTimes as keys (using DateTime.Date to make sure we don't have two Workday...
I've built the groundwork for an attributes (as in Strength, Intelligence, not as in DebuggerHidden, TestMethod) framework for my game. Each attribute can be upgraded and downgraded individually as well as part of a bulk change (such as for upgrades that have side effects, or leveling up). I'm looking to get a thorough...
Given my IUnitOfWork interface using System; public interface IUnitOfWork : IDisposable { void Commit(); } I then create an abstract factory interface called IUnitOfWorkFactory using System.Transactions; public interface IUnitOfWorkFactory { IUnitOfWork GetUnitOfWork(IsolationLevel isolationLevel); } I ...
I am learning to code in the Assembly language for the x86 architecture. I currently know of a few registers and certain arithmetic operations like add, sub, inc, dec, mov and to check for conditionality using certain jump statements. I am using some "ready-baked" code for input and output. The input - call_hex reads h...
I got it working, all variations are displayed Sint-Anna as should be, but I wonder, is there a simpler way to this, since it looks very cluttered? String.prototype.capitalize = function(){ var sa = this.replace(/-/g,' '); var saa = sa.toLowerCase(); var sb = saa.replace( /(^|\s)([a-z])/g , function(m,p1,p2...
I saw this implementation of Least common ancestor and thought that it was very inefficient as it used Queues. I have tried to implement it using a normal tree traversal. I have also tried to keep all the utility methods as public static so that they could be accessed from anywhere. Is the implementation correct? I hav...
The objective of the two classes below is to manage a collection of records where the record structure (i.e. the fields that comprise the record) is variable and defined at run-time. The record structure may contain integers, amounts, dates and strings. The RecordDefinition class is used to define the record structure...
Zombies are questions with no upvoted answers. I came up with this SEDE query to find answers with zero votes on questions that have no accepted answer and no answers with greater than zero score. In other words, answers on questions that show up on the Unanswered tab, until the answer receives an upvote. (Latest versi...
This is a follow up to Rolling my own Configuration with UI. I got a lot of great advice about the Configuration system I created, but no one touched on how all of my logic for the UI was in the code behind of the control. I decided that it was a bad idea, and took a stab at the Model-View-Controller pattern. Mostly, b...
I have two matrices (a, b), each including 3 genes and 6 observations. I have estimated the Spearman correlation for gene pairs (rcorr.observed). Then I want to do an empirical permutation (1000 times) and estimate the correlation for each time, then achieve a Pval_estim file. Since I have a very huge datasets (23000*2...
I have a method to upload a file using the Net::SFTP gem: class Uploader def initialize(host,user,password) @host = host @user = user @password = password end def upload(local_file_path,remote_file_path) Net::SFTP.start(@host,@user,:password => @password) do |sftp| sftp.upload!(local_file_path,remote...
A = [9, 1, 4, 2, 5] k unique integers B = [3, 1, 8, 7, 6, 5] n unique integers Intersection => [1, 5] Find an algorithm that uses \$O(1)\$ space (the space used by the return variable is not considered) and runs as fast as possible to find the intersection of the arrays. private static List<Integer> getIntersec...
I've created a Timecode class. The "timecode" that I'm trying to represent is a timecode that is used in video editing quite often, and is seen displayed in the format "hh:mm:ss:ff", or 10:00:05:24, for example ("ff" = frames"). /// <summary> /// Immutable timecode. /// </summary> /// <remarks> /// Rep...
I have the following code that checks the value of a variable and then applies the correct id attribute accordingly. The value of menuLink will have the same value of one of the parts of .mainmenu a href path name. Is there a way to simplify this so it can search the href path of .mainmenu a instead of explicitly stati...
I have just written a function copy_lowbits_off to copy any number of bits (not bytes) from a source buffer to a destination buffer. The function also supports arbitrary offset (expressed in bits) in the source and the destination buffer. Could you have a look at it and let me know if anything can be improved in style,...
A while back, I posted a question involving code of the same function. This post contains improved code. From the last post, I have improved size, my work with conventions, and my comments. I was also able to minimalism memory interaction to speed things up/make things more efficient. %define KERNEL_CALL int 80h %defi...
The program is asking you to guess a number between 1-100 and if you guessed too low it says that in Swedish and the same goes for if it's too high and if it's the correct answer it says congratz you guessed right in Swedish. I'd like comments about any aspects of my code. public class Kidsprogram { public static v...