instruction
stringlengths
71
71.9k
I'm new to Haskell. I'm developing a game-like simulation. I try to use lenses to update the state of the world. Current iteration of code works, but looks clumsy. I am trying to improve it, e.g. I would like to: Get rid of direct enumeration of q1 and so on, with usage of quantityPolymorph and others in them. Problem...
I've decided to improve / test my knowledge so far, as I haven't coded in Java for a while now. Is there anything I can improve in my code? The OOP structure? The code itself? Useless code? Main.java: import java.util.Scanner; class Main { /** * A Simple question-and-answer game based on poin...
I am working on converting a mailing list that has longitude and latitude coordinates within the CSV file. This script I came up with does what I need, but this is my first real-world use of python. I want to know where I am making any mistakes, not using best-practices, and what can be optimized to make it faster. The...
I have the code above in my iOS SDK that I am building that makes it easy for users of the SDK to make API calls. Basically, users can specify an API endpoint and easily make API calls. Is there any way to improve the code above to make it more maintainable and easy for users? Is that the proper way to handle asynchr...
Consider the below: public int DoSomethingComplicated(ComplicatedObject input) { try { return input.Analyse(); } catch(CustomExceptionOne ex1) { throw; } catch(CustomExceptionTwo ex2) { Log(ex2.Message); return -1; } } Obviously I have abstracted quite...
This is part of a class for paginating a Backbone collection. The paginateTo method is for paginating to a model id. It returns the model if it's already in the collection, otherwise it checks with the server that it exists. If so, it requests subsequent pages until it's loaded into the collection. How would you refact...
This time I'm not here to ask for help with my code, but to ask you to judge my code. Where can I improve? What should I do better? Where did I do things wrong? This is a quiz that I had to do as an assignment today. I'm not a professional. I'm still studying, and at the moment, I'm doing an internship. <? session...
I'm looking for some general feedback about the layout and structure of my code. Basically just any feedback, as I'm not super happy about this code, but I'm not sure how to improve it further. 'use strict'; /* jshint node: true */ var fs = require('fs'); var os = require('os'); var nodemailer = requi...
In my game, there is a terrain generator subsequently resulting in many instances. I have implemented this code: for b in blocklist: if b.rect.left>=0: if b.rect.right<=640: screen.blit(b.sprite, b.rect) It only renders things within the screen (400-500 blocks), but it still runs as if it were ren...
I'm working on a writing platform and am using a modified version of the Levenshtein distance algorithm to track a writer's engagement with their writing. It tracks not only words added to their content, but also rewards editing by including words removed and words substituted in the count. Here's my algorithm in Ruby ...
I have this annoying problem in PHP with faking overloading constructors. I understand the concept, but the code I produce feels kind of ugly. It isn't a lot of code, just bad code. Any ideas on how to make this sane? /** * Instantiate Fencer object from user meta database. * * If fencer data does not exist in data...
There's a bit of a weird piece in my API that I'm not too happy about, but I can't seem to see any other way of going about. It involves a IFunctionalityFactory abstract factory: public interface IFunctionalityFactory { IFunctionality Create(); } An IFunctionality interface: public interface IFunctionality { v...
I have written a PHP class called "graph". It is a class that performs RESTful-like commands to a MySQL database. I have posted the GitHub repo. Here is the code as well: config.php <?php //standard database connection data //these obviously need to be changed.... define("DBHOST","localhost"); define("DBUSERNAME","...
I'm trying to learn PHP/MySQL and the likes, so I've been reading tutorials for PHP login systems. My current iteration is based heavily on one from this website and contains the accepted answer for random salts here. This is my first thing I've done in MySQL, and my first attempt at PHP besides a tiny Tic-Tac-Toe game...
I wrote 2 filters in C for the Altera DE2 Nios II FPGA, one floating-point and one fixed-point. I've verified that they perform correctly and now I wonder if you can give examples for improvement or optimization? I'll reduce the C library to a small library and turn on optimization, and perhaps you can suggest how to d...
I have a file with just 3500 lines like these: filecontent= "13P397;Fotostuff;t;IBM;IBM lalala 123|IBM lalala 1234;28.000 things;;IBMlalala123|IBMlalala1234" Then I want to grab every line from the filecontent that matches a certain string (with python 2.7): this_item= "IBMlalala123" matchingitems = re.findall(".*?;....
I'm using a very lightweight jQuery accordion with some tweaks and it's working nicely. Is there anything to improve? JS ;(function($, doc, win) { "use strict"; $.fn.accordionLite = function(){ var sections = this.children(), trigger = sections.find('.accordion_trigger'), allCo...
How could the following code be made more concise? HTML structure <body> <header> <ul id="main-nav"> <li></li> <li></li> <li></li> </ul> </header> <section> <div class="toggle"> <div class="secondState"></div> </div> </secti...
I have created a function in C on OSX in Xcode which captures the screen, adds the mouse pointer to the image, rescales the image to fit a certain width X height requirement, and puts the rescaled image in a "bounding box", and finally converts the image from RGBA to RGB. Is there a kind and experienced OSX developer o...
This script creates an adhoc network using hostapd. I have tested it and seems to work reliably. I am new to linux networking and not sure if this is a recommended way to create an adhoc network this way. #!/bin/bash #set -x DEVICE=wlan0 CONFIG_FILE=./hostapd.conf ConfigureDevice() { if ! sudo iwconfig 2>/dev/null ...
Is there is a better way of selecting the span tag that I'm dynamically adding? Here's what I'm trying to do: If you click the .toggle div, it shows a detailed div with the id that matches the href of the anchor tag in the particular .toggle div. $('.toggle').click(function (e) { e.preventDefault(); var elemHref = ...
I've just solve one problem that notifies users if their password is going to expire in 14 days. The script is working fine. I just want to improve my code and desire some suggestions. #!/usr/bin/env python # Author :- Rahul Patil<linuxian.com> # import sys import os #-----------------------------------------------...
In C++11 we have the option of using std::unordered_set if we require a list of elements that have no duplicates but order is not important. In C++03 we don't have this options, although we can use the std::set to achieve something similar. Let's consider the following code: std::set<ElementType, std::NotEqualTo<Elemen...
I have the code below: <?php $i = array(1, 2, 3); $w = array(1 => '11', 2 => '22', 3 => '33'); foreach ($i as $f) { $ws = $w[$f]; $file_names[] = array( 'fn' => 'fname', 'sn' => 'sname', 'is' => 'is', 'rv' => 'rv' ); foreach ($file_names as $k => $v) { if (!i...
My database (SQL Server 2008) looks like this: People 1 -- * TaskPersons * -- 1 Tasks * -- 1 Project The GROUP BY part of the query is quite long, all because of the COUNT aggregate. This seems to perform reasonably well. I would like to know if there is a more concise way of writing this. use Projects SELECT COUNT...
The main purpose of Ruby is to be readable. I hope I did a good job with this gem I made. If there's any kind of suggestion of how to make this better, then please tell me. class Trigger def initialize event, *callbacks @callbacks = callbacks @event = event if @callbacks[0].is_a? TrueClass @progres...
What would be the fastest way of skipping certain values in a for loop? This is what I intend to do in its most basic form, with about 20 more keys to omit. for (var key in arr ) { if ( key != 'ContentType' && key != 'FileRef' ) { arrayPushUnknown( columns, formatTitle( key ), true, key ) } }
I'm trying to write a short function which takes a list (a) and returns another list which only contains the elements (x) such that -x is also in a. I've done that, and it works, but it runs really slowly. I know why it does, and I know the second for loop is unnecessary, but I don't know how to fix it without breaking...
I wrote a bash completion script for the cpupower command but I feel that it sucks. It's too long for such a simple task and have too much case/if-else nesting. It supports all the subcommands of cpupower and their options but not the values. It also support the incompatibilities between some options. ## Autocompletion...
I have tried to mimic Golang channels in C# and its performance is pretty good compared to golang itself. On my machine, each channel operation of Golang takes ~75 nano-sec and each Chan<T> (in C#) operation takes ~90 nano-sec. Please let me know if this code can be improved in any way. class Chan<T> { readonly int...
I just started with Python a month ago, and with Flask this week. This is my first project. I am curious about general style, proper use of Python idioms, and Flask best-practices. run.py: #!/usr/bin/env python # -*- coding: utf-8 -*- import logging import os import sqlite3 import StringIO import time from ConfigPars...
How can I most effectively refactor the code in these 2 ViewControllers? I'm familiar with subclassing in Objective-C and have used it extensively else where with NSObjects and UIViews, but I'm not sure how to approach doing so with ViewControllers. The rooms have fairly similar functions, but I think are different en...
I wrote this Ruby code that takes data from a survey. Seeing as it is my first Ruby project, I know it can be written much better. How could some of this code be written in more idiomatic Ruby? This code is extracted from a Rails model (the rest of the model is tame). def prepare_anova_data n = surveys_completed ...
I'm writing a simple JavaScript game, which uses a 2-dimensional array as the main data structure. I wrote this function-class-thing that allows me to give any two integers, positive or negative. This class should "wrap" those integers back onto the game grid. For example: var g = new Grid(10, 10) g.set(15, -2, "hello...
Is this a good/correct way to write a robust C program? //File1 => Module1.c static int Fun(int); struct{ int (*pFn)(int) }Interface; static int Fun(int){ //do something } Interface* Init(void) { Interface *pInterface = malloc(sizeof(Interface)); pInterface->pFn = Fun; return pInterface; } //File 2 main() {...
$(document).on('dblclick', '#li', function () { oriVal = $(this).text(); $(this).text(""); input = $("<input type='text'>"); input.appendTo('#li').focus(); }); $(document).on('focusout', 'input', function () { if (input.val() != "") { newInput = input.val(); $(this).hide(); ...
I'm working on mobile app which doing requests to a server's API. I want to develop module that doing following: get authorization key already exists in previous session connect to server api and read server StatusLine answer code if answer code is 403 then try to re authorize when authorization is passed process serv...
I just finished a little game of Tic-Tac-Toe for a class I'm in, and I think it looks alright, but I'm pretty fresh, so I would like to know how I might be able to improve it, given the situation I'm in. I'd like to host it on my website and I'd like it to be safe and expandable. Please let me know where I'm off (or g...
At the request of my father, I've adapted some C# code he wrote which uses a timer to display the true and approximate solutions of the ODE y' = -lambda*y in real time to do the same in java and then graph the solutions using JFreeChart. The approximate solution is Euler's (first order) method. I don't have much progra...
I have a requirement where there are 3 selection criteria user selects countries from a map displayed as lets say in 3 categories , i am maintaining 3 arraylist for the same.Each time he selects a country i have to display list of country names displayed in Alphabetical order in a bottom bar with font color distinguish...
I have this Crazy Eights game (which at the moment does not include crazy cards): class Card(object): RANKS = ("2", "3", "4", "5", "6", "7", "8", "9", "T", "J", "Q", "K", "A") SUITS = ("c", "d", "h", "s") def __init__(self, rank, suit): self.rank = rank self.suit = suit def __str__(sel...
I have the following JavaScript code to work out the angle between two points (clockwise). The code I have seems a bit "hacky" to me, as I have a while loop ensuring the number is not negative (to make the range 0-360), as well as I have to subtract 270 degrees to get it to work correctly. Is there a better way to do t...
The game I am working with is a block game. It generates terrain and then allows you to freely mine and place blocks as you wish (sound familiar Cx) BUT! there is a problem. I have a code that snaps the mouse to a 32x32 grid: mse=pygame.mouse.get_pos() mse=(((mse[0])/32)*32,((mse[1])/32)*32) cursrect.x,cursrect.y=mse s...
In a web application I am writing, I have used the following: def dbgmsg(lvl, fmt, ...): if dbglvl >= lvl: # ... format and write the message pass # just here for correctness Which is then used inside the code as: dbgmsg(3, "Something happened") Since there is no thing such as a the #ifdef in Pyth...
Here is a self imposed exercise and solution to learn Scalaz state monad. How can I refactor it to take it to the next level? So far I've only studied the state monad so would welcome suggestions on introducing other Scalaz features of relevance, as well as general Scala style/approach. Exercise Use state monad to s...
I have a couple of fields which I am trying to put together into a single ByteBuffer before storing it in a Cassandra database. That byte array which I will be writing into Cassandra is made up of three byte arrays as described below: short employeeId = 32767; long lastModifiedDate = "1379811105109L"; byte[] attributeV...
The code uses SQLAlchemy Core. However, what I want to know is if writing code in this pattern is recommendable. def saveUser(self, user): """ Inserts or updates a user in database. The method first checks if the provided user's id already exists. If no, then the user will be inserted. Otherwise, the stored...
Here's my first VBA project. I have some very limited Python experience, and this is my first VBA project. I'm sure I could have done it a lot more simply, but I just stuck with what I knew, and googled what I didn't, so feedback is very welcome. The basic purpose is to compare a table from one sheet (OP) with a table ...
I would like to know your opinion about my simple JS/jQquery switcher. Is it a good idea to use toggle()? var s = $('.slider'), i = 0; setInterval(function(){ var o = $([]); o = o.add(s[i]); if(i === s.length - 1) { i = -1; } i++; o = o.add(s[i]); o.toggle(); }, 1000); jsFiddle...
I'm working on a program that handles UTF-8 characters. I've made the following macros to detect UTF-8. I've tested them with a few thousand words and they seem to work. I'll add another one to do error-checking later, but for now I would like to know what mistakes I've made and how these macros can be improved. //ch...
I'm trying to write Jasmine tests and I need a review and some advice on spying on events and their behavior. // my example source code ;(function () { var app = { exampleModuleName: { navigateTo: function () { /* do something */ } }, navigation: { init: function () { this.routeHandl...
I need to implement the dynamic programming algorithm for the travelling salesman problem. My input is a text file with first line indicates the number of cities. Each city is a point in the plane, and each subsequent line indicates the x- and y-coordinates of a single city. The distance between two cities is defined a...
In effort to be more effective and productive with terminals I have started building a bash script. It is for handling the bash history of concurrently running terminals, archiving old commands, and dynamically loading bash history profiles. Most current development is going to be found at https://launchpad.net/bashor...
In my Repository class: public class DeliveryRepository : IDeliveryRepository { private readonly List<Delivery> deliveries = new List<Delivery>(); public Delivery Add(Delivery item) { if (item == null) { throw new ArgumentNullException("item"); } deliveries.Add(i...
I have a classes for working with a web service (Windows Phone 8 app). My main question is about the thread-safety of the solutions. I think there will be problems with a static class GYApi. After all, static classes aren't inherently thread safe. But not only in a static class. If synchronization is necessary for lo...
I am learning C++ and have been trying to create an event system for use in a small game. This will be the mechanism by which game entities communicate. I would be eternally grateful if someone with experience could critique my code. Running through it myself, I'm a little concerned about the use of Runtime Type Inform...
My function calculates days elapsed from the current date. Input is fixed. I will get vector. Please comment on this. static bool daysElapsed(const std::vector<char>& vec,int& val) { std::string str(vec.begin(),vec.end()); char *pos;// whose value is set by the function to the next character in str aft...
I have an object for which I wish to modify a property if a condition is met, else leave it virginal. I find my current code to be very repetitive and would instead like to use a more succinct form, but am unsure of how to lambda-fy it or at least tell it to pass if condition not met: my_object.unique_id = 'TBC' if not...
This is a pretty big undertaking for me with my basic skills, and I was kind of flying blind. It's basic in its intent: get a bunch of case info from a helpdesk app and put it into a database. There are >10k records, so I had to overcome some pagination challenges. It works, and I would love your opinions regarding bes...
Is this the correct implementation of Heap Sort using Java? How can it be improved further? import java.util.Arrays; public class HeapSort { public static int heapSize; public static int LEFT(int i) { //returns left index of a zero index based array return 2*i+1; } public static i...
Please tell me what you think. Is my code bad? Function checking #-*- coding: utf-8 -*- import re import unittest def email_check(mail): # E-mail as argument func compil = re.compile(r""" ^([-a-z0-9_]+ ((?![.][.])|([.])) ((["]["])|(["][!:,]+["]))? ([-a-z0-9_]+)?) @...
Which of the following is better code: div#style1{ } or #style1{ } Also, should the element type be specified for classes or not?
I have a large number of images that were named in a odd way and because of that, when they're displayed in a file browser, they're completely out of order. However, since they weren't named in a completely random manner, I can use regex to properly rename them, once I understand all the subpatterns that went into it. ...
I'm building a game. It is going well at the moment, but I'm not quite happy with my code because is not working the way I want to, due my low knowledge of C#. I was wondering if you guys could help me out to improve it by giving me some ideas and tips. This is how I'm checking if the user has completed the levels. p...
Recently I decided VB6's Collection wasn't enough for my needs, so I decided to implement something like C#'s List<T>. Here's the class that resulted, I'd like to know if the implementation could be made better /more efficient, especially with Insert and Sort methods; also I'd like another pair of eyes to examine the e...
I was able to complete the problem, but I would like to improve my code and make it more idiomatic. Here is the challenge description: Problem 7 - 10001st prime By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th >prime is 13. What is the 10 001st prime number? http://projecteule...
I am working through some of the exercises at Coberbyte. The instructions for this exercise are to replace every letter in a string with the letter following it in the alphabet (i.e., c becomes d, z becomes a), then capitalize every vowel in this new string (a, e, i, o, u) and finally return this modified string. Is t...
Okay code reviewers, I need you to make my FizzBuzz code even better. Any suggestions for improvement, optimizations, etc. public final class FizzBuzz { private FizzBuzz() {}; /** * comparisons for a multiple of 3 = 2 * comparisons for a multiple of 5 = 2 * comparisons for a multiple of 15 = 2 ...
The following is the current iteration of a gaussian blur approximation code I am using. A typical naive convolution operation is O(N*M), where N is the number of image pixels, and M is the number of kernel pixels. I am using three tricks to avoid this penalty: 3 iterations of simple box blurs look very similar to a g...
I have an object like this initialize : { method : function() { this.__. //--> do another thing ... //--> so many this.__.params. //--> do another thing ... //--> so many } } and the method of this object call by another function. As you can see, we have many lines...
I am thinking about how to split my website into smaller reusable apps. I've finally figured out something and need your opinion. My main problem was that each app uses Profile model. This is of course a snippet of my work with the most important parts. # App Userdata class BaseProfile(models.Model): city = mode...
I have a project in school. This is the game that I've created, but I need to make some improvements. I put a swing.timer inside the action event to create a score/time decrements effects. But, I have a problem because there is a textfield inside the frame and I can't type any words there because of the timer.setRepe...
I need to build a football team. Every player has his performance described by an integer. The greater the number, the more effective the player is. Every team should be solid. If one of the players plays much better than all others, then other team members will dislike him, and the team will not be solid. Thus, the pe...
I created a function that compares an array of letters to the alphabet, and returns the letters that are not in the original array. While this works, it looks somewhat clumsy to me, but I don't know what I'm looking for to improve the code...Is there a way to make it more elegant? Perhaps getting rid of the notPresent ...
This is my attempt at creating a database schema for a Minecraft logging plugin. I'm by no means a SQL expert, so suggestions would be greatly appreciated. -- -- Table structure for table `actions` -- DROP TABLE IF EXISTS `actions`; CREATE TABLE IF NOT EXISTS `actions` ( `id` tinyint(3) unsigned NOT NULL, `name` v...
Here is the code I wrote for my mother's dental office. It fulfills these tasks: determines whether a tooth is anterior or posterior determines if the patient needs a filling sets up a later appointment My issue is with cleaning the code to increase readability, because I think there is a better way to write it. I ...
I am working on some code which checks whether or not to unlink a file on the basis of the class: File.unlink(file.path) if file.is_a? File I think it would be more idiomatic to check whether the object responds to the unlink message: File.unlink(file.path) if file.respond_to? :unlink Is there any good reason to pref...
I have an optimization issue and I'm not sure if I can improve the overall speed of my function. The function draw_w is my actual implementation that gives me the right update for my vector w. You can see that the code is running for 1000 iterations in 9s. I had a first implementation (draw_w_fw) that was quiet good be...
A friend of mine needs a scraper that reads product titles, prices and pictures from eBay and saves them to an Excel-ready .csv file. The program reads product pages into a list and then loops through it to get the relevant data, which it then saves to a .csv file. import pdb import time import urllib import urllib2 im...
Background: I was working on a project were I needed to write some rules for text-processing. After working on this project for a couple of days and implementing some rules, I realized I needed to determine the order of the rules. No problem; we have topological sorting to help. But then I realized that I can't expect ...
The code below just senses when the network is available and enables/disables a button on the UI. If I am registered to the NetworkAvailability event for the life of the program, will it cause a memory leak? I heard it might but didn't understand why. System.Net.NetworkInformation.NetworkChange.NetworkAvailabilityChang...
I wrote the method below, and was wondering whether a better way exists/best practice tips _objectIsDefined = function (obj, path) { if (typeof path !== 'undefined') { // if we have been given a specific object path then recursively search it var pathSplit = path.split("."), scope = undefined; scope...
I've already reduced it and have tried making the main code is_divisible=, followed directly by the (2...).each... code, but that didn't work. Any suggestions on reducing the size of this code? I have tests for other methods that use the code (so I know if changes are working) but not unit tests for this method yet. ...
After trying a couple of parsers, such as Log Parser 2.2, I ended up writing a small utility that supposedly parses the following information onto an object: (from DirectX Caps Viewer, truncated) DirectX Graphics Adapters AMD Radeon HD 7800 Series Driver aticfx32.dll Descri...
I'm making a very basic user system, and this is what I have so far: <?php /* The class for constructing any user's information */ class User { protected $userId, $email, $userGroup; protected function getEmail() { return $this->email; } protected function getUserI...
I am working on an online ordering form and am looking for some advice about my jQuery. I am re-developing the code base for this ordering form and improving what was created by a web design group years ago. The existing form uses Javascript to dynamically generate a new line of item information when the starts typin...
How can I shorten this class method (currently 10 lines long)? class DoubleSeries def self.generate_sequences(seq1_start, seq2_start, seq1_step, seq2_step, iterations) seq1,seq2=seq1_start,seq2_start result=[] (1..iterations).each do result << seq1 << seq2 seq1+=seq1_step seq2+=seq2_step...
I have two functions to find the number of factors of a given number. I was wondering which one will be more efficient to use? def nu_of_factors2(n): return len(set(reduce(list.__add__, ([i, n//i] for i in range(1, int(n**0.5) + 1) if n % i == 0)))) def nu_of_factors1(n): result_set = set() ...
This code is for a program that needs to add thousands of strings to memory while it's running and these strings will be used until the end of execution. So the memory for these strings will be freed only in the end. First I tested calling malloc for every new string and have used Valgrind to benchmark total execution ...
I've recently just started with AngularJS and the best way for me to learn is to get some criticism to find out how I can do things better. I did a small project that calls a third party API and shows a bit of the return data. HTML <body ng-controller="Album"> <div class="container"> <input id="artist" type...
Regarding re-usability, is this OK? What might go wrong? What would be a better design? Performance-related issues and any other comments are welcome. package sample.library.dao.util; import java.io.Serializable; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.sprin...
I wrote this looping Caesar cipher with a default key. I'd love for some input on how I could make this operate better/more effectively. #Et Tu, Brute? [Caesar's Cipher] #loops? #Determine type of cipher... doLoop=("y") while doLoop==("y"): #yep. loops. det=input("Enter N for number or C for character; 'exit' t...
I saw a tutorial from a site where it showed the use of ArrayBlockingQueue as a thread-safe concurrent data-structure . Just for learning purposes , i tried to build something similar using synchronized and wait-notify methods in java. I'm really very new to java.util.concurrent and i'm hoping someone could guide me to...
Here is a slightly modified challenge from Coderbyte: Determine if a given string is an acceptable. The str parameter will be composed of + and = symbols with several letters between them (ie. ++d+===+c++==a) and for the string to be true each letter must be surrounded by a + symbol. So the string to the left would be ...
I'm whitelisting the input data to an LDAP/AD search on 'sn' (=surname). The purpose is to stop penetration attacks through the app and into the LDAP servers (i.e. no brackets, please). // whitelist input data. string partialName = Regex.Replace(partialName, "[^. a-zA-Z-']", string.Empty); Do you think this is a usefu...
I'm trying to get better at Python and would like a critique. Problem statement: Accept a 2D grid containing 1's and 0's (1 being mine locations) and print a solved sum grid (the way the final grid would show upon completion of a minesweeper game with all the neighbor sums). Beyond that, what might be horribly wr...
I have a data frame called data with lots of columns, and Country is one of them. I created a new logical column called train, which is true when the row belongs to the train set and false otherwise. The data frame is already sampled. Now I want to be sure that there are no countries in both train and test sets with t...
I'm using bootstrap 3.0 to display a tooltip (this example isn't specific to boot-strap) where the html inside the tooltip is fed from an AJAX call. In the future I want to be able to use the same element to fire different AJAX calls (something like fire a different AJAX call if the shift+click was used). To make tha...
Here is another challenge from Coderbyte. I found this one challenging, although not quite as much as the previous two I've posted. Based on the feedback I received on my earlier posts, I structured this solution as a function. It is probably better than my previous solutions but still could be improved. In particular,...
This is a class/method that manages files being written to and read from. I have a lot of code, and it grew as I tried to get it to work properly. Is there a better way to write this (i.e. trim the fat) or is it written properly? import java.io.*; public class DataBase { public static String getExtension(File f) { ...