instruction
stringlengths
71
95.1k
I'm making a project to calculate road-tax prices based on a vehicle's weight, type and vehicle's owner's province. For that I've received data in 9 different JavaScript files, all those files contain circa 12 arrays. I've been told I could just do this in arrays as well. I've made this data-mapper: var roadTaxData = {...
This Python module is supposed to be a generic engine for games of life. By generic, I mean that it is supposed to be able to handle different kind of rules (not just Conway's) and graphs (not just square grids). The implementation presented here comes with an example of a 4-state rule that could be used on Penrose til...
This is a follow-up to: Pointer handle - follow-up Pointer class/handle Please review my pointer class. template<typename T> class Ptr { public: Ptr(T* t, int s = 1) : sz{s<1 ? throw std::logic_error("Invalid sz parameter") : s} { sz = s; p = new T[sz]; std::copy(t,t+sz,p); } Ptr(...
As a casual Rubyist I am mainly interested, how ideomatic my solution is. class Integer def divisible_by?(n) (self % n).zero? end end def fizzbuzz(upper_bound) 1.upto(upper_bound).map do |number| next "fizzbuzz" if number.divisible_by? 3 and number.divisible_by? 5 next "fizz" if number.divisible_by?...
I wrote a tiny command line tool that converts ADF audio files from the Grand Theft Auto - Vice City game to MP3 files that can be played outside the game. The ADF file format stores the game soundtracks and radio stations. These in turn are just MP3 files that had every byte XORed with the decimal constant 34. My appl...
Please note the following: All edges are directed Removal of edges/nodges is not implemented yet A user of the class Graph can never (hopefully) access a Node directly If one tries to add an edge to a node that does not exist, insert_edge() will do nothing. A Vertex cannot point to another vertex with several edges. ...
The idea I have in my head is this: I am not sure if I need the index variable in consumer and producer. Moreover, I want to know if it is OK like this (it seems to work), or it is just some stupid working code. Can it be more clever/efficient? Leave the readability for me. My code will use the POSIX semaphore mutex i...
I've built an anagram solver in Python 2.7. It goes through a text file with over 100,000 words and checks if any permutations of the input matches the line. It works great, except it is very slow. I've tried making the text file a list with each line as a list item, but the text file is too big to do that. This is the...
I wrote a method to check if each parenthesis in a string is closed. It should take into account the order in which a parenthesis is presented, e.g. "hello)goodbye(" should return false even though there are an equal number of opening and closing parentheses. My method is as follows: def balance(chars: List[Char]): Boo...
Previous question: Text-based Tetris game with CRTP - follow-up Summary of improvements: Fixed issues preventing the code from compiling on Clang Implemented override specifier Fixed single letter type classes Elimination of magic numbers Removed unnecessary Block class Summary of new features: Renamed clonable clas...
I have a file containing information about the session of students. The structure of this file is: group number, student name, exams, and tests. debt() function find and print the names of underachieving students. student_score() calculate the average score of groups group_score() calculate the average score of each s...
I am writing an application that shows a news feed, much like Instagram. For this, I have a function in the model to select the feeds as shown in the code. For some reason, this runs quite slow and I am sure my code is the issue. Is there something I could do to optimise this. public static function getPublicFeed($user...
I have a sparse matrix (term-document) containing integers (word counts/tf) and I am trying to compute the tf-idf, for every non-zero value in the sparse-matrix. The formula for tf-idf I am using is: log(1 + tf) * log(N / (1 + df)) # N is the number of coloumns of the matrix # tf is the value at a cell of the matrix ...
I am implementing an OpenGL ES 2.0 renderer in c. I want to use quaternions for rotations. Please take a look at the way I am implementing the rotation math. Everything looks as expected when the program runs, but since I am very new to using quaternions, I am wondering if I am doing things in a sub-optimal way. The id...
I've seen many implementations of Sieve of Eratosthenes in Scheme, but I thought I'd try to write one that is both space- and time-efficient: Space-efficient: I use R7RS bytevectors as a bitset, which encodes odd numbers starting with 3 (so bit 0 = 3, bit 1 = 5, bit 2 = 7, etc.). Time-efficient: Many implementations s...
This function checks an array for duplicated values. If it finds a duplicate value, it increments the variable name repeatedTime and then if repeatedTime is greater than 1 it calls a randomize function which produce different values in the array that was passed to the function. It repeats these steps until a duplicated...
I'm new to both GTK and Haskell, so I'd appreciate any in both. I'm making an application which for the purposes of this question is just drawing a window that shows a red circle getting larger until it touches the edges of the window. I have a CircleGUI.hs module which defines the following functions: module CircleGUI...
This is my second follow-up. Major changes made: Use a Map instead of an enum for the Morse characters Added (space) in Morse characters Added method play() to play the Morse code Comments are now JavaDoc comments Moved CHAR_SEPARATOR and WORD_SEPARATOR to the class that contains the Map of characters MorseString.ja...
I have written a pong game in C++ using SDL2.0 for the graphics. I have a couple of questions regarding this code: How can I make the AI better, in such a way that it is actually dumber? Right now, my AI can return the ball to me every time, which is unfair. I want the player to be able to score at least some of the t...
We have been working on a mutation analysis tool for Haskell tests called MuCheck. It accepts any Haskell source file, and a function name to mutate, applies a defined set of mutation operators on it, and runs the specified test suite on it. The mutation of code is accomplished using the haskell-src-ext library, and SY...
This is my code. All comments welcome. Last time run it only took 335 milliseconds: static bool CheckMultiples(int val) { for (int i = 1; i <= 20; i++) { if (val % i != 0) return false; } return true; } static void Main(string[] args) { Stopwatch s = new Stopwatch(); s.St...
I'm looking for following kind of feedback: Firstly, is the use of a cursor an overkill here? Is there a simpler way to do what I'm doing in SQL? Could the script go terribly wrong? I have limited SQL experience, how does it look? Any standards that I'm not following? Bear in mind that this is a one-time script to be...
The challenge: Given a String, for each digit in that original string, replace that digit with that many occurrences of the character following it. So a3tx2z yields attttxzzz. My Solution: import java.util.Scanner; public class Standford1 { public static void main(String[] args) { Scanner input = new Scann...
We are designing a small framework to create and send messages to external parties as a result of internal events. I am reasonably happy with the design, but I am wandering if it can be further improved. The external messages are large and complex and involve getting data from different areas in the system and are sen...
Out of curiosity, I built a recursive Sieve of Eratosthenes in Python and I was wondering how it could be improved for efficiency and how it can improved to be aligned with python best practices. Essentially, there is a recursive function (coded horrendously IMO), filter_multiples, which removes the multiples of some n...
I hate using unnecessary catch blocks and I like to see my code look beautiful. In most of the cases in my project, which is a web application, I can't declare many exceptions as checked exceptions as there is little that my client (browser) can do to recover from the exception. However, only if there is a way that the...
A Collatz sequence for a given positive integer \$n\$ is to take half of \$n\$ if even and \$3n+1\$ if \$n\$ is odd; repeat until the value goes to \$1\$. The question is which number from 1 to 1,000,000 has the longest Collatz sequence? The Collatz sequence for \$n=13\$ from Project Euler #14: 13 → 40 → 20 → 10 ...
I'm moving a system over to PDO and since the queries are parameterized, I need to specify both the type and value of each parameter when preparing them. Right now I have a prepare method to create the PDOStatement object: /** * Prepares a statement * @param string $sql The query * @param array $data The data to bin...
Merge function: void merge(int outputArray[], int firstArray[], int sizeFirst, int secondArray[], int sizeSecond){ int p = 0; int p1 = 0; int p2 = 0; while(p1 < sizeFirst && p2 < sizeSecond){ if(first[p1] < second[p2]) outputArray[p++] = firstArray[p1++]; else o...
I want to do simple encryption using PHP 5.5. By “simple” I mean I want to use native PHP functions. I have created this code that works, can it be improved? It's to encrypt/decrypt strings and binary files that are to be stored in a database and accessed via a website. Assume that it is done over SSL and that the pass...
I have written a simple wrapper for WinSCP in C#. I have written it to simplify SFTP connections I will needing to perform. public class WinSCPConn : IDisposable { //private fields private SessionOptions sessionOptions; private TransferOptions transferOptions; private Session session; ...
I have created a system where user selects files from their Google Drive to be uploaded into Parse. I have done so separately though, where I have one code that allows user to select an item from Google Drive, and one that allows user to upload a file from their computer into parse. Google Drive (Using Google drive pic...
I am using a recursive directory scan to find all objects inside a Unity3D project. After that, I wish to move all these files to a sorted List. Is there a cleaner and/or more optimal way of doing so? I have the feeling the AssignFileToList could be less complex than it currently is. //Requestable total values public i...
I am working on a web app that uses a WebSocket to log in users. I would like to minimize bandwidth usage by using binary messages. I came up with the following, and would like to know whether there is something better I could be doing: -define(LOGIN, 1). websocket_handle({binary, <<?LOGIN:8,LengthUser:8, Rest/bitstri...
I have tried to implement an in-place quicksort Algorithm in Python 2. Please suggest how I can Make the code more efficient Increase readability Improve writing style Make it more Pythonic def swap(x,y): return y,x def sort(ar, start, end, l): if start<end-1: # pivot element is taken as the last...
How can I improve this code? template<class T> class Queue { public: Queue(const std::initializer_list<T>& i) :elem{i} {} int size() const { return elem.size(); } bool empty() const { return elem.empty(); } void enqueue(T&&); void dequeue(); T peek(); T& operator[](st...
I'm trying to read doubles from a relatively small binary file. This currently reads a 100 KB file in about 6 milliseconds in my system. I would like to reduce that if possible. void readNParseData(const char* filePath, vector<double> *&data){ ifstream ifs(filePath, ios::in | ios::binary); // If this is a val...
Input: { 1: [2,3], 2:[4], 3: [5,6], 4:[6] } Expected output: [[1, 2, 4, 6], [1, 3, 5], [1, 3, 6]] My Code: def parse(node, tree): result = [] if node not in tree: return [[node]] else: res = [] for next_node in tree[node]: res.extend(parse(next_node, tree)) for ...
I am doing the Python Koans to practise Python a bit more and I got to the greed dice project. It is a very simple dice game that scores a set of up to five rolls. These are the rules: # A greed roll is scored as follows: # # * A set of three ones is 1000 points # # * A set of three numbers (other than ones) is worth ...
I am displaying menus and submenus in my WinRT app, and I think I am doing it wrong. I have thought I was doing it wrong for a long time, so here it is for review. This is the section in my ViewModel. Probably needless to say, both Remove() and NewSelectionWS() have had large quantities of nearly identical code remov...
When this ViewModel loads we kick off the IsAuthenticatedCommand: If the result of IsAuthenticatedCommand is false we set the value of NeedsToLogin to true. If the result of IsAuthenticatedCommand is true we set the value of IsAuthenticated to true. There are (subscriptions?) to both NeedsToLogin and IsAuthenticated ...
A split-string function seems to be missing in R7RS. I came up with the following implementation today: (define (split-string delim str) (let ((add (lambda (current output) (cons (list->string (reverse current)) output)))) (let loop ((input (string->list str)) (output #f) ...
Background I created a simple class to reflect emotion classification based on the Lövheim cube. The code is not scientific at all, and I just did it for fun, but I want all code I write to be as Pythonic and efficient as possible, so I was hoping for some help refactoring it. Code Purpose Class Emoter takes in seroton...
If it is possible, could someone please revise my code to see if any improvements can be made? <html> <head> <title>Roamfree - Official Website</title> <link rel="stylesheet" href="index.css"> <style> ul { list-style-type: none; margin: 25px; padding: 0; overflow: hidden; } li { float: cent...
I am relatively new to programming and OOP in PHP. I tried to create a Simple Login Register Script using my basic knowledge of OOP. I'm sure my code can be better in a lot of way. I'm trying to code better and learn new things. Be harsh, please find out as many small noob mistakes as you can. Suggestions and Feedbacks...
I seek the assessment of which code block is more efficient in Java at detecting the byte sequence of 00 00 00 01 and 00 00 01 in a byte array. Version 1 for (int i = 0; i < frame.length - 4; i++) { if (frame[i] == 0) { if (frame[i + 1] == 0) { if (frame[i + 2] == 0) { ...
I am looking for best practice in handling conditions inside the controller actions in ASP.NET MVC: public ActionResult Edit(int Id = 0) { var Item = _todoListItemsRepository.Find(Id); if (Item == null) return View("NotFound"); if (!Item.IsAuthorized()) return View("NotValidOwner"); return View...
I perform an if-check (commented in the code) to determine whether a user can access certain actions or not. The user will be redirected to the index page if they try to access the login.action while already logged in. I have this kind of if-check in many of my Action classes (containsKey() or !containsKey(), depending...
I started actually learning a little programming last year, as opposed to just hacking away at libraries and found fragments. For a WordPress plugin I needed to navigate through weeks, which I thought would be pretty easy. Well it should have been, but my method of using the week and the year returned by php based on t...
I wrote this function to format a given sentence via Java, and I'm wondering if there is a better way of doing this without use of external libraries, such as with regex. public class ChatFormat { public static void main(String[] args) { String input = "hello, it's a monday today and i think i'll go to the...
I am working on a pathfinding program / algorithm, and I have the following class: [System.Serializable] public class UnitTileCosts { int[] tileCosts; public UnitTileCosts() { //empty constructor uses default value of 1 for all fields GenerateDefaults(); } public UnitTileCosts(Dict...
I am trying to optimize my script that loops through a folder and extracts only the part of a file name before a date and the header of the file and outputs it into a different file using a delimiter. I feel the script is robust and I want to refactor it. If there is also a better way, please tell me. #!/bin/bash # scr...
I was reading this question and realized that I didn't know Python well enough to critique the algorithm. So I wrote a Java solution instead, which is inappropriate for that question. Since there's no Java solution for #14, I'm posting this one. Project Euler #14 problem statement The following iterative sequence ...
This is a basic implementation of a stack. Can anyone please review it and let me know how I can improve this code and overall coding practice? #include"iostream" #define MAX_SIZE 5 using namespace std; class Mystack { private: int A[MAX_SIZE]; int top; public: Mystack()...
I was studying for arrays from coding-bat and encountered this: The question is: (fix34) Return an array that contains exactly the same numbers as the given array, but rearranged so that every 3 is immediately followed by a 4. Do not move the 3's, but every other number may move. The array contains the same numb...
Script designed to avoid manually edit configuration files by support. Config file example: $ cat ../secure/test.property [Connection settings] jdbc.main.url = jdbc:oracle:thin:@host1 jdbc.main.username = USER jdbc.main.password = pass [Mail settings] mail.smtp.host=127.0.0.1 mail.smtp.port=25 mail.smtp.on=false mail....
I'm programming code with MySQLi prepared statements. I'm a beginner and just want to ask to experts if my code is correct. function getPaymentMethodName( $id ) { global $mysqli; if ( $stmt = $mysqli->prepare( 'SELECT name FROM `payment_methods` WHERE id = ?' ) ) { if ( $stmt->bind_param( 'i', $id ) ) {...
Since I'm still learning jQuery, I would like to have some feedback on my code: var showImgage = function() { var selection = $(this).val(); switch(selection) { case 'Monica Bellud': $('#Belluci').removeClass().addClass('show'); $('#Andres').removeClass().addClass('hide'); $('#Seydoux').removeClass().ad...
This is a follow up question of Importing different type of files into Lists. Where the original lists are acquired. In this script I am processing the obtained lists, and comparing them with each other to determine whether or not a used material has duplicate functions. This using their most commonly known traits, wh...
I am currently working on a little binary patcher. My current code works fine but I do want my code to be optimized (fast) and as clean as possible. Could you all please help me review this? IDE: Delphi 7 and XE7 const OriginalByte: array [0 .. 55] of Byte = ($64, $69, $6E, $67, $20, $6D, $65, $20, $68, $69, $73,...
This is an implementation of a stack where I have used vectors. Can anyone please review it and let me know how I can improve this code and overall coding practice? #include"iostream" class Mystack { private: int *A; int top; int size; public: Mystack(int capacity); void push(int x); int pop...
I've finally got a working Proxy pattern. The original task is presented here. My test case is on coliru. It appears to flow through the correct pathways, however I am grateful for feedback and possible improvements. EDIT: I've reworked the code to provide sensible trace output, so it is possible to examine the flow un...
What is the best way to refactor the following code to avoid duplication? // JQuery FORM Functions $(document).on('change','.submittable',function(){ //save current input field into hidden input 'focus_field' if it exists if($('input#focus_field').length){ var $focus_field = $(this).attr('i...
I have some code that will brute force solve the following problem: Given a set of x coins and a target sum to reach, what is the fewest number of coins required to reach that target? The code so far: import java.util.ArrayList; import java.util.Arrays; public class coinsSum { public static int min = Integer.MAX...
I have this Java implementation of Kruskal's algorithm. It solves a tiny problem instance correctly, yet I am not quite sure, whether my implementation is correct. The code as follows: MSTFinder.java package net.coderodde.graph.mst; import java.util.List; import net.coderodde.graph.UndirectedGraphEdge; import net.code...
I finished the Python Koans because I wanted to practise Python and I completed the extra assignment which is the Greed Game (see the rules here). I think there are no flaws but you never know. import random class DiceSet(object): def __init__(self): self._values = None @property def values(self):...
I am very new to HTML and I've decided to attempt to put what I know into an HTML page that allows you to enter any amount of numbers, separated by commas, and would display the sum of all the numbers below. <!DOCTYPE html> <html> <head> <title>Sum of two numbers</title> </head> <body> <h1>Enter any amount of ...
I had already posted this question at here and have tried to incorporate some of the suggestions given. Kindly let me know if there are still some concerns/suggestions/improvements in the code mentioned below. #include"iostream" #define MAX_SIZE 5 class Mystack { private: int A[MAX_SIZE]; int top; public: M...
How do I decrease time, especially in sorting? Given a list of numbers, you are to sort them in non-decreasing order. Input t – the number of numbers in list, then t lines follow [\$t \le 10^6\$]. Each line contains one integer: N [\$0 \le N \le 10^6\$] Output Given numbers in non-decreasing order. Example Input: 5 5...
I have a Component that is used for all Active Directory queries. The function below is used heavily perhaps even milions of times each day. Performance is a feature! It's used on servers and I want to reduce memory press on these servers (when the GC is collecting the server websites etc are not responding... well of ...
I have the following code for importing Yahoo contacts from an address book, but it imports only the top 30 contacts, not all of the contacts. Anyways, I think another alternative (and better) way of doing it is by using another latest Yahoo API. private const string _addressBookUrl = "http://address.mail.yahoo...
This is the code I wrote to compute the newton's square root of a number. I aimed for extreme clarity over efficiency and I have put an abundant docstring at the start of the newton_sqrt function where I describe the main formula and explain all the parameters. This function is not meant to be fast (standard library is...
I wrote my first WPF UserControl today, and I would like you to review it. Its purpose is to have images by default resize with the page, but expand to full size with a double-click: <UserControl x:Class="MyApp.ImageDisplay" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://...
I'm developing an Android application which would remotely connect to an insurance database and perform some basic CRUD operations and I'd like to learn how to keep clean app's architecture from Fernando Cejas' and Uncle Bob's blog entries. Presented below domain layer contains entities and use cases which I don't want...
This program is eventually going to be a screen recorder, but right now I just want it to capture screen images. using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using Syste...
I wrote a transition table which allows the client to: Create States Create a TransitionTable or some kind of StateManager Create StateNodes using that table A StateNode is what I use to link one state to other states. It has the mainState and an ArrayList<State> full of states it can jump to. After creating nodes, t...
I have to do multiplication of two billion by billion sparse matrices (on a CPU), hence any help or hints in optimizing the below given code would be extremely useful. Note: I am only showing the code to compute number of non-zeros in the output matrix. Buffer based adjustment of memory is not an option for such a larg...
Input: String : Title; List Tags Problem statement: Need to map title to tags, e.g. title is "china man japan beijing bell" and tags are ["china man" "beijing bell"], output should be ["china man" "japan" "beijing bell"] What I am doing: List<String> getTitleSplits(String title, List<String> tags) { List<S...
I recently applied for a job where the company gave me the following prompt for a code challenge. They have since told me "yeah, no thanks" but provided me with no feedback about why they came to that decision. Would you be so kind as to review my code? You can even be harsh. I'd just like to know what this program is ...
I'd like to know if there is a standard way of creating a matrix like the one shown below using the R programming language. $$ \begin{bmatrix} 1 & \rho & \rho^2 & \cdots & \rho^{T-1}\\ \rho & 1 & \rho & \cdots & \rho^{T-2}\\ \rho^2 & \rho & 1 & \cdots & \rho^{T-3}\\ \vdots &\vd...
I'm new to GNU Smalltalk. I'd like to port a script I've written in Ruby, Scala, CoffeeScript, and several others. It's the one I use to try to learn the classic OOP concepts of abstract classes, abstract methods, overriding, dispatch, etc. It goes like this: Define an abstract class Animal with a constructor to set t...
I wrote simple jQuery code and I want suggestions as to how I can do it better and shorter. Basically the following code is used to change the menu icon on each click event and also hide and display menu accordingly. If I did it correctly, then fine, but is there any way to make the code shorter and faster? if ( $('.si...
The PHPSESSID is stored in the clients cookie so I don't consider it as secure. Someone might bruteforce it and perform some action (like a Facebook status post) whenever a session was successfully hijacked. I was wondering how I can protect against attacks like that. Maybe by locking out suspect users? My solution I c...
I have a search box for searching for people in a list of names. Here is the code that runs every time the query changes. I could not find anything open-sourced for this, so I wanted to make sure this looks good and efficient. How does it look? private final List<String> mTotalNames = ............ // some ArrayList<St...
Today I wrote a JavaScript module (with module pattern) which generate gradient texts using canvas tags. This is my first JavaScript "program" (I don't know how to call it) created for a real need. I would like to receive opinions about: The performance factor: Is creating canvas slow? Or is it acceptable? The maintai...
Over the course of the past month I've worked on a little visualizer to show how different algorithms are sorted. I'm pretty happy with how it turned out but would be interested in any feedback pertaining to the design of it or the coding. I'm still a bit of a novice to Swing, so I'd love some feedback on my usage: pub...
Find the last element of a list from codewars.com Example: last( [1,2,3,4] ) # => 4 last( "xyz" ) # => z last( 1,2,3,4 ) # => 4 I completed this kata several times tonight. My current answer is a mashup of several other people's solutions. I do not understand why I cant change .respond_to?(:index) into .is_a? A...
I am creating styles for the comment posts for a projects using BootStrap. I am wondering if this is good HTML markup and the extending of BootStrap's CSS. Using HTML5 markup recommendations the HTML for the comment posts is as follows. <div class="container"> <div class="row"> <div class="col-md-8"> <h2 class="...
I'm somewhat new to SQL (only had to use it in Database classes). I have a simple table of stylesheets, from which I want to select specific ones in a specific order (e.g. reset, then layout, then colors). Below is an example selector that my current algorithm might generate. Is there a better (more efficient or more i...
I am working with very large datasets in a distributed environment. In particular, I am writing some code in Python for analyzing web logs in Spark. Because of the nature of Map-Reduce computing and the size of the logs I am working with, I would like to restrict the amount of data being passed around as much as possib...
This code is used to get the users location and deliver it as a resource to the controller. The aim is to have this data shared across multiple controllers in the application. So far this does deliver the data as a parameter of the then() method on the promise. Is this pattern a suitable way of sharing a resource whic...
This isn't too complicated but I usually code in C++ instead of C. Doing memory management and IO in C always makes me feel like I'm doing everything wrong and making a mess. This is a small sample that has both which I think came out reasonable. I don't have C people to talk to so any critiques are welcome. The goal h...
This piece of code is working - It gives me a lot of JSON back, which I have yet to parse, but I'd like to show my code here first to get tips on how to improve what I already have: VenueService.swift class VenueService { private let __kVenueServiceClientID = "CLIENT_ID" private let __kVenueServiceClientSe...
I have modified my code as per the suggestion given by some of the developers. Let me know if there are any further concerns or scope for improvements. Original Version #include"iostream" template <class T> class Mystack { private: T *input; int top; int capacity; public: Mystack(); ~Mystack(); ...
Is there a better way, or the correct one to have this approach for a JSON object that hast the following structure? (it's only a portion of my object, the most important one) { "Questions": [ { "AnswerType": "single-choice", "Answers": [ { "Answer...
I have serious problem with my Hexadoku (16 x 16 , a - p) solver. I'd like to run the program in under 2 seconds but my solution solves it in 10 seconds. Native Code: #include <stdio.h> #include <stdio.h> int isfree(int hexadoku[][16], int radek, int sloupec, int num) { int rowStart = (radek/4) * 4; int colStart =...
I am fairly new to Assembly language programming and, for practice, I gave myself a problem: count down from 10 and right after 1, say "Blast off!". section .text global _start _start: mov eax, '10' ; asci 10 mov [num], eax ; num now equals ascii 10 mov edx, 2 mov ecx, num mov ebx, 1 mov ea...
In my college Java course, I wrote an ASCII Turtle Graphics. My professor said the only thing he could suggest was to turn the turtle into a class and create an instance of it (I hadn't because we hadn't covered classes yet). What do you think? package javaapplication74; import java.util.Scanner; import static java....
This takes a collection of Objects from JavaScript and puts them into a Java project. How can I improve this code? What's the best solution? // JavaScript fetch data into List ChartData int i = 0; int k = 0; // output for (Object currObj : ChartData) { // get all fields of Object for (Field field : currObj.g...
I haven't used Python in a number of years, but recently started working on a project called Photoshell which is written in Python 3. As I attempted to learn the "Pythonic way", I wrote a parser for Canon's CR2 raw image file format. I'm not sure how "pythonic" the parser is, so I'd love to get some feedback on how it ...