instruction
stringlengths
71
71.9k
I want to know the correct way to finish up this code at the bottom. I'm thinking there has to be a better way to grab content from one section of your site and displaying it somewhere else with animation attached to it. The Code below seems like it can do better. I post the entire code below, but you might be able to ...
I have the following SQL structure (simplified for brevity): TABLE [Posts] [Id] INT NOT NULL IDENTITY PRIMARY KEY, [ParentId] INT NULL, [Type] INT NOT NULL, FOREIGN KEY ( [ParentId] ) REFERENCES [Posts] ( [Id] ) FOREIGN KEY ( [Type] ) REFERENCES [PostTypes] ( [Type] ) TABLE [Po...
I'm using both Core Data and NSFetchedResultsController. Is there anything I can improve on? // // RoutineTableViewController.m // App // // Created by Me on 3/21/11. // Copyright 2011 __MyCompanyName__. All rights reserved. // #import "RoutineTableViewController.h" #import <QuartzCore/QuartzCore.h> #import "Flur...
Because we're passing object to Spring Framework in which Jackson classes convert them into JSON as a response, we chose to implement a simpler Tweet class rather than the Twitter4j-provided Status class, which includes numerous data that is irrelevant. Status class provided by Twitter4j has arrays of entities that spe...
This is my second attempt to create asynchronous version of AutoResetEvent. At first I tried to make it completely lock-less, but it turned out to be impossible. This implementation contains a lock however the lock isn't an instance wide: /// <summary> /// Asynchronous version of <see cref="AutoResetEvent" /> /// ...
I wrote a two player Noughts and Crosses game in Python 3, and came here to ask how I can improve this code. import random cell = ['1', '2', '3', '4', '5', '6', '7', '8', '9'] board = '\n\t ' + cell[0] + ' | ' + cell[1] + ' | ' + cell[2] + '\n\t-----------\n\t ' + cell[3] + ' | ' + cell[4] + ' | ' + cell[5] + '\n\t----...
I have a card matching game with a model of: Card Deck PlayingCard PlayingCardDeck And another model called CardMatchingGame. Now, I had a task to add a button to the view for new game, which deals the cards again and setting the labels to 0 (#flips and score). I added this method: - (IBAction)newGame:(UIButton *)sen...
Im trying to solve two problems I see with JSF2 and Spring. First @Autowired in @ManagedBean does not work Nor does @ViewScoped with @Controller @ManagedProperty is not type safe and requires setter Second You can not serialize singleton spring beans without hassle Managed beans must be serializable so the container...
There are some things that I know that need to be fixed, such as mysql_* needing to be converted to PDO, and using a better hash. I am working on building a social networking site, and I've been having issues with some of the mysql like mysql_real_escape_string and implementing newer techniques. Any criticism and/or he...
Can you please review the following code and give any suggestions for improvment? Class ContactList.java import java.io.*; import java.util.*; public class ContactList { public static void main(String args[]) throws IOException { Contact contact; contact = new Contact(); int action = 0; ArrayList<Con...
For my simple Android application, I don't want to use an ORM. I'd like to have a db-communcation layer easy to user, to read and efficient. This is my solution: every entity (ex: Person) as an helper that do the CRUD functions (ex: PersonHelper). The helper extends another class (EntityHelper), that contains the logi...
I've started writing a game and I need help, because I know there are many ways to improve what I am doing. I am doing it the basic way I know I can but I know there is more complex ways of doing it. import time print"Created on 3/12/2013" print"ver 1.2" print"Created by: Daniel Vargas" print'At any point type "help" f...
I'm currently writing a WebGL HTML5 game, and large part of the game initialization involved loading assets streamed over a websocket, and saving them to disk using the FileSystem API. As part of optimizing the code, we're trying to eliminate as many memory allocations as we can, which means cutting down on the use of ...
I have a table full of URLs, some of which will occasionally become invalid. As part of a system I'm writing to go through the links periodically, and test if they are valid (or redirect to valid sites), I wrote the following class. The feedback I'm looking for is primarily related to clean code and best practices--how...
See the examples below: function map_cloning(obj,fn){ result = {}; for (var key in obj) result[key] = fn(obj[key]); return result; }; function map_modifying(obj,fn){ for (var key in obj) obj[key] = fn(obj[key]); return obj; }; function sum_cloning(vector1,vector2){ return [vect...
I'm new to JS/jQuery and wrote some JavaScript/jQuery lines to create a "pulsating" object. I get the "pulse" effect by increasing/resizing the object and then bringing it back to its original state periodically. I was uncomfortable with calculating the necessary values every time they are needed, so I used the first ...
This is completely optimization question, I have a pagination query like this: $this->paginate = array( 'fields' => array( 'DISTINCT Contact.contact_id', 'Contact.first_name', 'Contact.last_name', 'Contact.ema...
Is this a good CSS? .table1 thead tr td, .table1 tbody tr td, .table2 thead tr td, .table3 tbody tr td:first-child, .table4 tbody tr td:first-child, .table7 tbody tr td:first-child ,.table7 tbody tr td:nth-child(2), .table8 tbody tr td:first-child, .table9 tbody tr td{background-color:#cfeae6} ....
Is it possible to write the two following lines of code in a more compact one? IEnumerable<int> collection = from partnerNumbers in contract.Contact.PartnerNumbers select partnerNumbers.Pnr; var response = this.otherClass.SomeMethod(collection, DateTime.Now.Date); Additional information: public int SomeMethod(IEnumera...
I have created a simple DBLayer class. But I am not sure whether this class have any bug/issue using in production. public class DBLayer { private static string connectionString = ConfigurationManager.AppSettings["ConnectionString"]; public static DataTable GetDataTable(string strSQL, CommandType type) { ...
I am learning C# from a book, and there is an exercise as follows: Write a program that has a person enter full name, age, and phone number. Display this information with formatting. Also display the person's initials. I wrote some code and I feel that it could be improved, so I ask anyone to comment on it. using...
This program use random number generator to create sentences. It prints 20 sentences randomly. Here is the code: #include <stdio.h> #include <string.h> #include <time.h> #include <ctype.h> #define STR_LEN 80 #define MAX_SEN 20 int main(void) { char *article[] = {"the", "a", "one", "some", "any"}; char *noun[]...
Below is the code of a custom C# class I have called UniversalTextBoxTextBinder. I'm interested to hear the code review comments to find out the limitations of this 'universal' solution as well as to get posted here the references on similar solutions. Obviously the solution posted here can be generalized on other type...
I have no idea if I'm doing this efficiently, or ideally, but I've written what I think is a factory. Please help me understand if this is good practice, or if there is another direction I should take this. There's no particular project in mind with this, I'm just farting around. (Written in PHP) class Factory { pr...
The following script should get links which are stored in a text file (line by line), then put them into an array and finally scan each links' source code for a certain line. If this line is found, it will be pasted into a CSV file. It works fine so far, but it takes ages to finish, since each link is 'opened' and the ...
I'm writing a function that takes between one and three arguments (function callback [, number limit] [, regexp pattern]). Since the second two are both optional, I need to determine which argument is being passed when the function is supplied with only two. Below is my solution, but it seems overly verbose. Is there a...
I'm wondering if the way I wrote our TextHelper class is a really a proper way to do it. We have products that are interlinked in different ways and every product has multiple text fields that might be empty. Now depending on where the text is supposed to show up, we want different texts. A simple example would be: On ...
I'm trying to establish a concurrency violation verification in my SQL updates using C# and raw SQL. What I'm doing now is storing the TimeStamp value in a byte[] upon selection and before updating I'm checking if the stored value is equal to the current value. here's the code: static void update() { using (SqlConn...
I have done a lot of research on OOP and I keep seeming to read different opinions on several items, especially the scope resolution operator (::) and handling class containing private functions. When calling a private function from within the class it seems that a majority of programmers recommend self::method(), is t...
I wrote a basic Clojure single-threaded socket server, mostly following Java examples; in particular I'd appreciate feedback on three things, how I handle mutable state (I/O, managing connections). how I pass the server around among the create-server/run/app functions. my setup to enable working with the server in t...
I am working on the following problem (http://www.enigmagroup.org/missions/programming/9/). You have a 6x6 table where the first 5 columns and rows are comprised of different types of shapes, 5 total. The sixth row contains the sum of the values of the shapes for all columns for each column. And the sixth column contai...
I have a small function which I regularly use to check if a variable contains only [a-z][0-9] and the special chars '-' and '_'. Currently I'm using the following: function is_clean($string){ $pattern = "/([a-z]|[A-Z]|[0-9]|-|_)*/"; preg_match($pattern, $string, $return); $pass = (($string == $return[0]) ? ...
I want to get a better feeling for how JavaScript works and how to use it well. I coded up this Tetris game, and have iterated over the code base and improved it a couple of times now. I hope the state of the code is fairly good at this point, but also that someone more familiar with the language can suggest further im...
I'm trying to change the background color of each .achievement div. The content is being generated dynamically so I can't add a class easily to each one. I have it working with selectors like .achievements .grid-row:nth-child(odd) .col-1-2:nth-child(even) .achievement but they seem a little bloated. The problem I'm hav...
I am new with SignalR and still a newbie with IoC Container SimpleInjector and I am wondering if there are any side effects and/or if I'm save with my chosen approach. In my web app I have a SetupHub that invokes a method on an object resolved with SimpleInjector. This method may do anything that I'm not aware about. M...
I started feeling like my code was becoming a little cluttered in the graphics: void render() { BufferStrategy bs = getBufferStrategy(); if (bs == null) { createBufferStrategy(3); return; } Graphics2D g = (Graphics2D) bs.getDrawGraphics(); g.setColor(Color.BLACK); g.fillRect(0, ...
I point to my problem in the comments of my code. I have a class RomanNumeral: public class RomanNumeral { private String romaNumera; private String romans = "IVXLCDM"; public RomanNumeral(String rn) { //sets rn to romaNumera and checks if rn is a valid roman numeral } public boolean equa...
I have developed a system whereby I use an attribute to state which SelectList to use for an 'FK' property. I would appreciate some feedback mainly on by good practice, and also on any ways to do this better. Let me start my exposition with a demo view model: public class DemoModel { [DropDownList("LanguageSelect")...
I'm using the following function to fuzzy match strings: function fuzzy_match(str,pattern){ pattern = pattern.split("").reduce(function(a,b){ return a+".*"+b; }); return (new RegExp(pattern)).test(str); }; Example: fuzzy_match("fogo","foo") //true fuzzy_match("jquery.js","jqjs") //true fuzzy_match("jquery.js",...
Note: This ended up being much longer than I was expecting. I have a number of side questions that relate to specific parts of the code for if you don't want to slog through all this mess. Background I have had some experience in Java, but recently decided to learn C#. I would like to know if my first program is idioma...
I'm mostly looking for performance suggestions. Feel free to include more than just that. Since Google Code Jam is coming around, I thought I would look at some of the previous questions. Alien Language is the one I picked and did this in my lunch / spare time / while waiting for the build to complete. It's a little me...
I wrote two functions for determining leap years. ("Kabisat" means "leap year" in Indonesia.) def kabisat? y return false if y%4!=0 return true if y%100!=0 y%400==0 end def kabisat_2? y return true if y%400==0 return false if y%100==0 y%4==0 end require 'dat...
Please check my code below. I don't have any problems but I'm not aware how far the code will work, release and kill excel instances.. try { wBook = xCel.Workbooks.Open(excelfilepath); xCel.Visible = false; this.xCel.DisplayAlerts = false; wSheet = (Excel.Worksheet)wBook.Worksheets.ge...
Is this code correct? This code was adapted from this alphabeta pseudocode. AlphaBeta search is often mentioned but getting the code 100% correct is tricky. IGame is an interface with two methods: getScore() - evaluates the current game state from the viewpoint of the AI generateMoves() - creates possible moves fro...
I'm not entirely sure on how to handle errors on this: Is returning a nullptr in case of bad parameters okay, or is it better to return a ENFMPCodegenData.Empty, like there is Rectangle.Empty or Point.Empty in the .NET Framework? What about handling errors, if any should occur when creating the native object Codegen? ...
I'm trying to find a good pattern for new applications (and for refactoring old ones). Maybe it's just me, but I dislike spawning my main logic thread from inside my main form thread (so far I always have 2+ threads in my apps and beefy hardware, also .NET 4.5). I feel it conflicts with the separation of concerns prin...
This is K.I.S.S, but how about some error and misuse control? I am wishing it were .NET. <?php function array_group_by($arr, $key_selector) { $result = array(); foreach($arr as $i){ $key = $key_selector($i); if(!array_key_exists($key, $result)) { $result[$key] = array(); } ...
I made this class to handle any min max integer value and return a random number in the entered parameter range. I tested it to work with all combinations(I think). But is this totally wrong or written with unnecessary amounts of code? Are there obvious Java convention violations or obvious redundancy in this? I was wo...
I have a function that searches the shortest vector in a vector of vectors of pointers. Which is a better way? std::vector<std::vector<void*>> const& ways { size_t i = SIZE_MAX; for(auto& it : ways) { if(i > it.size()) i = it.size(); } } OR std::vector<std::vector<void*>> const& ways { ...
I am learning about the class and methods in Python. The class Accuracy is a class of several (13 in total) statistic values between a reference polygon and one or more segmented polygons based on shapely module. from numpy import average #some stat def ra_or(ref, seg): return average([(ref.intersection(s).area/...
Is there a better, more elegant solution to the following method? Boolean[] spades = new Boolean[10]; // 40 cards deck foreach (Card card in m_Cards.Where(card => (card.Suit == Suit.Spades))) spades[(Int32)card.Rank] = true; // Rank goes from Ace (0) to King (10) if (spades[0] && spades[1] && spades[2]) { poi...
I know I should be using vectors, but I want to learn something. Please review it and point out any mistakes. Thank you. Here it is: template< typename T > class Table2D { public: Table2D( unsigned int sizeX, unsigned int sizeY ) : m_sizeX( sizeX ) , m_sizeY( sizeY ) { ...
Recently I needed to manipulate with cookies using JavaScript, so I wrote a class: function Cookies() { var cookieLifeTime = null; this.setCookie = setCookie; this.getCookie = getCookie; this.deleteCookie = deleteCookie; this.setLifeTime = setLifeTime; function setLifeTime(lifeTime) { ...
I wrote a simple JSON schema validator. The full code is over here on gist.github.com However, the code without comment is... validate = function(schema, instance) { var i; var errors = 0; var getType = function(attr) { return Object.prototype.toString.call(attr); } var addError = fun...
How can I verify that ohterClassMock.MethodToTest() was called with contracts? That it was called with contract, that have Id = 1 and Param2 = 34 and also with contract2, which has Id = 2 and Param2 = 56. This is my code: GoodClass goodClass = new GoodClass(ohterClassMock); ... var contracts = new List<Contract>(); var...
I often have method like this one with two or more render to do due to catching the error for example. I currently do something like this: def update @user = current_user if params[:user][:camera_type].present? && params[:user][:lens_type].present? && params[:user][:photo].present? r = Photo.instance.Upload(cam...
Just trying to work out some simple graceful connection handling code in Haskell to get my head around some of the IO/Networking/Threading stuff, some tips where I'm doing things poorly would be appreciated! I'm sure I could just use a module like network pipes that would handle all the graceful stuff for me out of the...
I have implemented the DBSCAN algorithm for clustering image keypoints. I have been following the pseudocode on the wiki page pretty strictly, and it's working, but I get the feeling its a very naive implementation and could be improved in terms of performance. I was hoping you could offer me some feedback on how to ...
In effort to streamline applicable PHP file include or require functions I thought that making a class to handle this might be a good idea. Originally I had an includes/init.php file that included everything, I wanted to make this more dynamic to the specific page the user was on. For example, some pages require the Go...
I initialized a tree using a nested hash as input, but when I recursively call Tree.new on the children, it doesn't seem to pass each child as a hash. As a pretty ugly, but working, alternative, I translated everything to arrays. Is there a way to preserve the hash? I'm doing this exercise using Ruby 1.9.3, so I can't ...
Here is a solution to the SPOJ's JPESEL problem. Basically the problem was to calculate cross product of 2 vectors modulo 10. If there is a positive remainder, it's not a valid PESEL number; (return D) if the remainder equals 0, it's a valid number (return N). import re, sys n = input() t = [1,3,7,9,1,3,7,9,1,3,1] whil...
I am searching a recursive solution space and would like to return the first match I find. (I am using this to solve sudoku, but I guess this would apply to any recursively defined problem or datastructure). So, in pseudocode, I need to call a function repeatedly with a set of possible input values, and return the firs...
I would like to know if this is being done correctly. using System; using System.Collections; using System.Collections.Generic; using System.Data; using System.Diagnostics; using System.Linq; using System.Text; public class InnerJoinTables { public List<InnerJoinTable> Items = new List<InnerJoinTable>(); } publ...
I received the following feedback for my code: "I still do not see a design here that will work. It is a very bad idea to have the big switch and loop at this point. All you need in your main() method is to create one object of each class and call the methods on them. In class Contact: Every class needs a comment. Th...
Say I have a data structure like this: array(3) { ["id"]=> int(1) ["name"]=> string(3) "foo" ["message"]=> array(1) { ["action"]=> string(3) "PUT" } } Where 'message' and 'action' are both optional. To check if they're present my first attempt would be to write something like this: if (array_key...
At the "if(a==2)" part of my code below, the android emulator takes 8 seconds to process and display some data in a list. I need to reduce this time to 1 second or less. I am accessing a 50 KB .txt file with 3200 lines, comparing each line with a string passed by another function, and whichever line matches the string,...
Looking for optimizations and cleaner, more pythonic ways of implementing the following code. #Given an array find any three numbers which sum to zero. import unittest def sum_to_zero(a): a.sort(reverse=True) len_a = len(a) if len_a < 3: return [] for i in xrange(0, len_a): j = i + 1...
I am creating a multiple choice quiz game with PHP and Javascript. Questions can have 2 to 6 answers. I have been using the PHP queries in the code below to get arrays of the questions of a quiz, and the answers for each questions. I now want to use this data in Javascript, and want to make it so each time a user click...
I am trying to implement a stable radix sort in place with O(1) space. I've seen Wikipedia, and I notice the C implementation is using a temporary variable to hold the sorted value for each pass, and the section of "in-place" MSD radix sort implementation is quite confusing. I took the C code and tried to implement it...
I'm using the BigRational beta off the BCL CodePlex (bcl.codeplex.com), and I realized it had no parsing method, so I tried to write one. However, it's quite inefficient (5.5ms for a 254 character number). That's over 45x slower than the BigInteger implementation. I'd like to lower it to .5ms if that's even possible. p...
I am developing a web-application and I am encountering some trouble : I have some tabs and each one contains input forms with different values. I need to switch beetween these tabs and see the different contents of each one. So I thought I could create objects for every tab , but I have to name them , I use somethin...
I don't know what this problem is named, so I can't Google for a solution about it. Here's the image: There are three pitchers with capacities of 10, 7 and 3 quarts. We need to move the water from a pitcher (or jar) to another pitcher so it will result in 5, 5 and 0. I have to print all the steps needed to make the pi...
I'm very new to Angular, and trying to get my head around whether or not I'm doing it the Right Way (tm). I want to filter a set of results by their properties, where if none of the filters are checked, all the results are displayed, but if one or more filters are checked, all results which match the checked properties...
I've discovered (and written) a way to object oriented programming in lua in a functional fashion instead of the standard metatable method. It carries much more functionality (no pun intended) but I'm afraid it might dent performance. My goal is to experiment with servers written in lua and I wanted to use this OOP sol...
I have a function that takes an XML document and parses out specific XML elements and appends those to a list for use by an Oracle executemany call. The placement of the elements matters as the executemany string uses positional binds, though I could easily use a dictionary to use named binds instead. I feel that while...
i wish to improve my Progressbar in Python from __future__ import division import sys import time class Progress(object): def __init__(self, maxval): self._seen = 0.0 self._pct = 0 self.maxval = maxval def update(self, value): self._seen = value pct = int((self._seen / ...
The following batch script runs on a Scheduled Task on Windows 7 with a quad core 2.5GHz and 16GB of DDR3. It makes the svn server unavailable for about 10 minutes, so it can produce a 500MB file, and this is only increasing. How can I speed this up? @echo off mode con cols=33 lines=3 >nul color 1F if "%1"=="done" goto...
I have a pack of cards and I am doing a 'deal' action. I am dealing n number of cards, for now to one player. How can I DRY up the while and unless loops to have fewer lines? def deal(number_of_players, number_of_cards_each) # 1..number_of_players players_cards_array=[] (1..number_of_cards_each).each do |a_card...
I have an abstract class which implements the IDataCreator interface: public interface IDataCreator { public String getDataString(); } public abstract class AbstractCreator implements IDataCreator { protected IProject p; public AbstractCreator(IProject p) { this.p = p; } public abstract St...
I haven't spent too much time with CoffeeScript and am trying to have a simple counter: casper.on('step.complete', ( -> i = 0 return (step) -> i += 1 @echo "Step#{ i }" )()) Which works fine but seems to have a bit too many parenthesis for CoffeeScript.
I need the most efficient way to get the value of the searchName, or if null return searchName. I am returning just a single string, so maybe I should search itemRepository.Item instead of Items return itemRepository.Items() .Where(i => i.Name.Contains(searchName)) .Select(i => ...
A general question: For using matlabpool, I write the line matlabpool open local 12; as the first line in my code and the line: matlabpool close; as the last. Is this correct?
Below is attempt to catch potential deadlocks at runtime in C#. Basically this class allows user to acquire locks in a pre-defined order only. I ran some basic tests and it appears to work. Please review and let me know if you find something wrong with implementation. public class OrderedLock { [ThreadStatic] s...
In the project I work on there are several places where a switch statement is used on a type enum. (I know, better to use virtual functions or a visitor pattern or something, but sometimes switching on type codes is unavoidable - e.g., deserializing XML.) All of our type enums are of the simple form enum { TypeA, TypeB...
So I'm making a program that is a serial port wedge. In other words I want it to listen to a serial port. If data comes in, wait a given amount of time, then play a sound and finally send the data out. All of those things have a abstract class associated with it. I'm thinking that I might eventually want to monitor USB...
This plugin displays a tooltip popup with the data obtained via Ajax. I am sure there are better ones out there, but my objective is to learn how to correctly build a plugin, not find the best one available. I would appreciate any comments, suggestions, criticism from a best practices and design pattern usage perspect...
This is inside a method (basically its just this), I try to get the neededValue otherwise I pass back what was passed in... private static string GetNeededValue(string param) { string tValue = ""; if (!string.IsNullOrEmpty(param)) { var map = repo.Item(string.Format("CoverageNam...
I have implemented a global appIncluder function which is imported as includeme with the init.py of the package to be included. includeme (ApplicationIncluder) receives the config object, so it is then easy to use config.package and its variables/methods/classes (present in the same init.py and submodules. I would real...
Please have a look at the code below: ClassLibrary1 has a structure as follows: Namespace com.app.test Public Class Class1 End Class End Namespace ClassLibrary2 has a structure as follows: Namespace com.app.test Public Class Class2 End Class End Namespace WindowsApplication1 has a structure like this: Impor...
I'm new to programming and even more new to Haskell. Below is a little tid-bit I wrote that operates on a bunch of lists. I am wondering if someone would be kind enough to walk through the function margProbs line-by-line, and enumerate their respective space/time complexities and/or just possibly suggest improvements....
I have a website that keeps track of 'changes' that users make. These changes come in all shapes and sizes and each shape and size has a different MySQL table to store them in. In total there are 8 different tables. Each table has completely different columns, so I don't think a simple JOIN would be possible, however t...
I would like to refactor this block, it looks clunky: # refactor me receive_payment_on = false config[:sections].each do |section| if section[:applicants] section[:applicants][:sections].each do |app_sec| if app_sec[:employment] && app_sec[:employment][:receive_payment_on] receive_payment_on = true ...
is this class ok? any and all advice very welcome. Would it be better to pass the config file path array into the constructor or even through the static register method namespace dh_mvc2\autoloaders; use dh_mvc2\classes\Config; /** * * @namespace dh_mvc2\autoloaders * @uses dh_mvc2\classes\Config in class constructor...
I've been porting python Keyczar to work under 2to3 conversion (Github). I wanted to consolidate its streaming AES encrypt/decrypt backend interface with its string decrypt/encrypt. So I wrote a new implementation using io.BufferReader and io.BufferedWriter. In my construction, I decrypt up until the last block and the...
Implement atoi to convert a string to an integer. Requirements for atoi: The function first discards as many whitespace characters as necessary until the first non-whitespace character is found. Then, starting from this character, takes an optional initial plus or minus sign followed by as many numerical digits ...
I've taken this class and made it my own but I'm curious to know what other think of it? Are there things I'm missing? Anything you can recommend? class Database { private $host = ''; private $user = ''; private $pass = ''; private $dbname = ''; private $dbh; private $error; private $stmt; ...
the requirement for our search query is to look for all search words in the beginning of vehicle manufacturer, model and variant name. Case insensitive. The word being a string of characters separated by space. E.g. when search for "AU A3 TDI" you would find a vehicle with the following attributes: Vehicle { Manufactur...
Can anyone help me optimize my code? I really don't know what to do about all the var rectangles and var colors. package PO; import javafx.stage.Stage; import javafx.scene.Scene; import javafx.scene.text.Text; import javafx.scene.text.Font; import javafx.scene.shape.Rectangle; import javafx.scene.paint.Color; import j...
Please could you review and critic my code and logic? Is this is along the right lines of an MVC application class or not? namespace dh_mvc2; use dh_mvc2\dispatchers\Base_Dispatcher; use dh_mvc2\routers\Base_Router; use dh_mvc2\autoloaders\Basic_Autoloader; use dh_mvc2\classes\Config; class Applic...
For class, I was asked to write a (linear probing) hash table in Java. (I was also asked to write a linear-chaining hash table, which is why I named this one HashtableB as opposed to just Hashtable.) I'm think my code is correct, but please tell me if I've messed up. Primarily, though, my questions are: Is my style (e...