instruction
stringlengths
71
71.9k
I am trying to implement Stack using a linked list. Looking for code-review, best practices and optimizations. public class StackUsingLinkedList<T> { private Node<T> top; int size; public StackUsingLinkedList() { } private static class Node<T> { Node<T> next; T item; pu...
I've spent quite a bit of time studying the repository and entity patterns and this is what I came up with. I would appreciate it if you could post suggestions and critique. User entity: <?php namespace App\Entities\Entities\User; use App\Entities\Abstracts\AbstractEntity, App\Repositories\Interfaces\U...
<?php namespace Users; use mysqli; class Users { protected $db; public function __construct() { $this->db = new mysqli('localhost', 'root', 'php123', 'sms'); } public function login($username, $password) { $query = $this->db->prepare("SELECT username, password FROM users WHERE username...
I have a satellite orbit simulation in Matlab (Using Runge Kutta 4). It seems ugly and I don't know how to fix it. fx.m file: function v = fx(t,x,vx) v = vx; fy.m file: function v = fy(t,y,vy) v = vy; gx.m file: function v = gx(t,x,y,vx,vy) global G M; v = -G*M*(x/((x^2+y^2)^(3/2))); gy.m file: function v = gy(t,x,...
I previously asked in StackOverflow for help putting this together, and was told that I could improve the HTML and CSS. Could you help me? Here is my code, and the pictures I am using: Code <!DOCTYPE html> <html class="no-js" lang="en-us"> <head> <link rel="dns-prefetch" href="//analytics.google.com/"> <meta charset=...
I hope that someone could review a module I wrote for bank card validation. I included a class that tests some of the methods, which is purely to show the methods work, rather than unit testing. Validator import java.util.regex.Matcher; import java.util.regex.Pattern; /** * This module provides static methods for cre...
/** * Class stringHelperK * Helper Class to deal with small string manipulations. */ class stringHelperK { public function normalizeStringK($string) { return $this->removeAccents( $this->replaceSpacesWithSlashes($string) ); } /** * @param $string * @return str...
This is a continuation of this question, v3 can be found here Taking into account the advise given by Loki, an implementation of the threadpool using a std::condition_variable to control when threads wakeup is presented below. Using this, the test program eventually deadlocks, the time before deadlock occurs is directl...
This is my first attempt to write a multithreaded application that downloads files from internet. I am looking for improvement in code, logic and better strategy for implementation. Please ignore the pylint messages which is not the focus at the moment. To manually test you can use the URLs from the list I have provide...
I am writing a recursive function based on the Travelling Salesman Problem. Is this a correct way of doing things, or am I creating memory leaks? Prerequisites are: a two dimensional matrix distance_matrix[][] to store the distances between the cities a global int called current_minimum_cost which will be MAX_INT for ...
Here is my full implementation of a generic Functor-like class: #ifndef FUNCTIONHPP #define FUNCTIONHPP #include "Types.hpp" #include <tuple> #include <utility> BEGIN_NAMESPACE //This is a define in "Types.hpp" namespace FN_HELPERS { template<int ...> struct seq { }; ...
I am using this jQuery code to get two carousels working in bootstrap, and it's working for me. $('#image-gallery-carousel').carousel({ interval: 5000 }); $('#carousel-caption-text').html($('#slide-content-0').html()); // When the carousel slides, auto update the text $('#image-gallery-carousel').on('slid.bs.carou...
Old Post: Classes for user registration and authentication This post is an update of the old post of mine. This is the code after suggestions were implemented in the review. Do you think I could make this even better? Please criticize as thoroughly as possible for the smallest thing possible as it will be very useful f...
I am using this script to detect the most prefered language by the user. function Get_Client_Prefered_Language ($getSortedList = false, $acceptedLanguages = false) { if (empty($acceptedLanguages)) $acceptedLanguages = $_SERVER["HTTP_ACCEPT_LANGUAGE"]; preg_match_all('/([a-z]{1,8}(-[a-z]{1,8})*)\s*(;\s...
On my website I want to offer some PDFs, ZIP files and images for download. They are all in the same folder and I could simply link to them like <a href="download/file.pdf">download file</a>. But instead I want to invoke a download dialog by sending an attachment header via php. The link would change into <a href="down...
I have this function: function Filer() { setTimeout(function () { $.ajax({ url: '/Pages/Handlers/filecheckerhandler.ashx', data: { id: GetMyId(), sid: GetSessionId() }, success: function (data) { if (data == "true") { window.open('/Page...
This code asks for letters and a number of letters per word and generates all possible permutations. Then compares those permutations with an English dictionary and creates a list with all the words that match with the dictionary. Finally, it prints the list on a new terminal. The problem is that when words are long (a...
This is a prepared statement (I think). Have I done this well? function wyswietl($rekord, $tabela) { $lacz = lacz_bd(); if (!$zap_preparowane = $lacz->prepare("SELECT {$rekord} FROM {$tabela} where email = ?")) {echo "Prepare nieudane: (" . $zap_preparowane->errno . ") " . $zap_preparowane->er...
This is a module to implement a key value store in Python using SQLite3. Originally written to allow sharing of configuration among multiple threads that are already sharing a SQLite3 database, I have generalized for most use cases. The interface in Python is as similar to dictionary objects as possible. Differences fr...
Please review these activities which handle converting units in an Android app: I would appreciate any guidance and advice on code refactoring and different design patterns or strategies that I could use to improve the code. Thank you! AngleActivity: public class AngleActivity extends BaseUnitActivity implements OnIte...
I have spent a long time trying to find a way to do the following: Update a MySQL database with AJAX Reload the Page to show changes Show a success message I think I have finally found a way! Let me know of any improvements. The method: Make your Ajax call and reload on success Set a session in your php code with ...
Follow-up question: Detect if a tree is complete binary tree Detect if a tree is complete binary tree or not. Looking for code review, optimizations and best practices. public class CompleteBinaryTreeDetection<T> { private TreeNode<T> root; /** * Constructs a binary tree in order of elements in an array....
Implement a queue using a linked list. I'm looking for a code review, optimizations and best practices. public class QueueAsLinkedList<T> { private Node<T> front; private Node<T> rear; private int size; public QueueAsLinkedList() {} private static class Node<T> { T item; Node<T...
I work on ubuntu machine and my backup requirements are straightforward. My only requirement is the usual copy paste, but only changed files (ie. the files whose modification-time OR size has changed) should get replaced. Since I could not find such option in the default nautilus copy-paste (it only allows a merge with...
This is a continuation of this question, v4 can be found here Taking the advise given previously, the deadlock was fixed in the non-yielding code. The next problem comes from the suggestion to make the interface, now renamed enqueue_task able to handle more generic tasks. The goal was to have the ability to return a re...
I'm just trying to create a binary tree, and a pretty printer for it: #include <stdio.h> typedef unsigned long Leaf; struct NodeStruct { struct TreeStruct * left; struct TreeStruct * right; }; typedef struct NodeStruct Node; struct TreeStruct { char isNode; union { Node node; Leaf lea...
So I have some code that works as PDO. But is it secure? I'm trying to prevent SQL injection. This is my first PDO script and was hoping to see if it was done correctly. Here it is. <?php echo 'Your query code has been submited'; $host = "localhost"; $pass = "root"; $user= "root"; $dbname = "users"; try{ $con = new P...
I've implemented the solution to Project Euler Problem 18 in Haskell and I'd like to get some thoughts on my implementation. Its the dynamic programming solution, working from the bottom up. Basically, given a set of numbers in a triangular shape, the path whose numbers add up to the greatest possible sum from the top...
Is there a better way to do this? A time series, data Model a where Variant :: [(Day, a)] -> Model a deriving (Show) ... where type a in [(Day, a)] basically represents the "total balance" e.g. bank account. Some example data, day1 = fromGregorian 1987 10 17 day2 = fromGregorian 1987 10 18 day3 = fromGregorian 19...
I'm new to Go and looking for a review of my merge sort and bubble sort implementations. What can be done better? Can my code be cleaner/clearer? // algos.go // (C) 2014 splashinn // Implement two types of sorting algorithms; merge sort and bubble sort package main import ( "fmt" "time" "math/rand" ) f...
I spent a lot of time doing Go Horse Extreme programming, but now I want to be a better person. How can I make this method smaller, better, more OOP? /** * @return \Illuminate\Http\RedirectResponse */ public function store() { if (!User::is_valid(Input::all())) { Flash::error(User::$errors->first());...
The new table feature on Excel is excellent and you can specify a column formula as well as exceptions on the column. However, if you want to change the column formula, Excel will rewrite the whole column including the exceptions. I've tried to avoid this issue with the following code: Private Sub Worksheet_Change(ByVa...
I am writing my first jQuery plugin that converts li tags to horizontal responsive barcharts. I am looking for some feedback and suggestions regarding the implementation. (function($) { $.fn.barcharts = function(options) { // Establish default settings var defaults = { animationSpeed...
I could not find any definitions of the EventSource object that belongs to Server-Sent Events, so I create the definitions. That's how they look like: declare var EventSource : sse.IEventSourceStatic; declare module sse { enum ReadyState {CONNECTING = 0, OPEN = 1, CLOSED = 2} interface IEventSourceStatic ext...
I need to validate whether my regex is correct for below scenario. Suggestion's if the regex is correct: Wiki Link Local_part The local-part of the email address may use any of these ASCII characters.[4] RFC 6531 permits Unicode characters beyond the ASCII range: Uppercase and lowercase English letters (a–z, A–Z) (ASC...
The simplest introduction to this code is to play it! Here's an SQL Fiddle. However, to enjoy it fully, you'll need a more interactive environment, like the psql command prompt. If you don't have PostgreSQL installed already, this may be the killer app that makes you want to install it. Capabilities Manually make a...
I've tried to refactor my program to single return statement at the end of the program, however, it ruins the end statements of the recursion because I want to return from function in specific line and not in the end of the function. I'd like suggestions on how this code can work and be elegantly designed to comply wit...
I'm working on a game in C#, this game generate new chunk (infinite) when you move around. If I have > 1000 chunks in my list then it become laggy even though I only load the necessary chunks on my screen. Tried all things to improve the code but it did not improve. Stopwatch ChunkDetect = new Stopwatch(); List<Chunks>...
This isn't really much of an actual project, just something I threw together in about 5-10 minutes. I just want to know if it goes with the current Python standards, and if anything should be changed or fixed. print(''.join([__import__('random').choice(['\033[7;1;32m \033[0m','\033[7;32m \033[0m','\033[7;1;33m \033[...
class AcmeFactory { public static function anvil() { $crud = new Crud; $productTypes = new ProductTypes($crud); $productImages = new ProductImages($crud); $product = new Anvils ($crud, $productImages); $productManager = new ProductManager ($productTypes, $product)...
I have this function that works fine, but it looks really ugly and repetitive... Basically I have a featured profile and underneath I have 4 smaller thumbnails, on click I want to populate the large profile. The code works fine it just doesn't look too good... $('ul.teamProfiles li').click(function () { var $name...
Is it a good practice to initialize the max to -100000 and min to 100000? Is there any other way to initialize both min and max to 0? import javax.swing.*; import java.util.*; public class arrayTajba { public static void main(String[] args) throws Exception { String userStringInput = " "; ...
Last time I made a website using PHP, I didn't know of PDO, so someone dropped all my tables. I think I've made an improvement now. I'm sorry if there's a lot to go through, but I want to make sure its safe (most importantly) and also using the best practices. Here are some snippets: 1) $form = $_POST; $name = $for...
I am newish to Python and I am looking for some extra eyes on a script I wrote. I wrote this script to learn more about web-scraping and using requests and Beautiful Soup. I use it to connect to the website wallbase.cc and save the top 32 wallpapers from the last 3 days into a directory where I later cycle through disp...
Interview question from the interwebz You have a set of envelopes of different widths and heights. One envelope can fit into another if and only if both the width and height of one envelope is greater than the width and height of the other envelope. What is the maximum number of envelopes can you russian doll...
I recently bought a PSP and wanted to know the best ISO files and wrote a scraper to retrieve games ISOs titles that received a high rating and send them to a csv. Any recommendations as to readability, and/or better code optimizations? var request = require('request'); var cheerio = require('cheerio'); var json2csv = ...
I am implementing atoi() by traversing a string from the beginning as well as from the end. Is there anything I can improve? using namespace std; int atoiLefttoRight(char *s){ int num = 0; int negative = 1; if(s) { if(*s == '-') { negative = -1; s++; ...
I am trying to learn Ruby and made a simple Caesar cipher program and I was wondering if the following code follows the 'ruby way' or the way most ruby users would do it # Implements the classes caesar cipher encryption and decryption. class CaesarCipher def initialize(shift) @shift = shift end def encrypt(...
I have a softmatch function (below) that takes a donor list and a new entry and looks to see if the given donor already exists. The data is not exact, so I have to use a softmatch to determine whether a given record exists (ex: Jon Doe at 123 Sesame St. is the same as John P. Doe at 123 Sesame Street). I have this i...
I've been trying to write a really basic function to determine the difference (in days) between two dates. I am very new to C++ so as you can imagine I am very happy with my work. This function is part of a much larger code so I have missed off my includes, but the function does compile without warnings. Just looking f...
I've spent a couple days making this script in Outlook that checks my emails and saves/sorts/sends a reply based on the subject. This also happens to be my first experience in working with VBA. Now that I have it working, I was wondering how I could simplify it or "make it prettier" (I always got docked points in my C+...
I've just published ADExploder. It's a single-script PowerShell app (source) that uses classic Windows Forms and the Directory Services API to be able to browse nodes and properties of Active Directory servers. I am interested in hearing feedback about my use of PowerShell, whether it can be made more terse or idiomati...
I used the information from the article "Auto-Start ASP.NET Applications (VS 2010 and .NET 4.0 Series)" to create a background task that runs on an infinite loop. Ultimately, this program is going to be consuming a REST API to get data from a remote web site and insert records into my database. For the time being, I am...
I have been working on a small game called apple picker, it's text-based, and relvolves around picking and selling apples. Unfortunately I've been using global variables for this whole thing and it's starting to get a bit ugly looking. Is there a more efficient way to do this than using global variables? from random i...
I am working through more tutorials on Design Patterns and came across the Abstract Factory Pattern. I extended it out a bit (the example that is) and want your opinion: using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace DoFactory.GangOfFour.Abstract.RealWorld { class M...
I'm doing some of the Codility challenges using Ruby. The current challenge is "The MaxCounter," which is described as: Calculate the values of counters after applying all alternating operations: increase counter by 1; set value of all counters to current maximum. See the link above for more details. I managed to get...
I have been going through algorithms and data structures and recently came across string matching algorithms. I have not yet wrapped my head around the significance KMP algorithm so I came up with the function below. Is it really efficient or is there a better approach? bool simplePatternMatch(const std::string &text...
I wrote the following code using Ruby to compute item-based collaborative filtering (using Jaccard coefficient of similarity). I would appreciate feedback about any potential issues with the code and tips to make the code better comply with the best practices. require 'json' require 'set' def compute_jaccard_coeffici...
Here is a Tic Tac Toe game in C++ that I have been working on. My questions are as follows: I tested it for bugs, but if you find any, please post the solution! I want to make the code more recursive, in a sense. Instead of having multiple lines of code that do the same things with different values, it would be nice t...
I've been working on ubuntu since many years but not quite familiar with bash scripting. My development tools involve servers like nginx and apache, the mysql database and beanstalkd. Obviously, I just can't keep all these services running always and overwhelm my CPU capacity!, so I need a way of starting a bunch of th...
Using x64 assembly, I solved the Largest Prime Factor problem on Project Euler. The problem is as follows: The prime factors of 13195 are 5, 7, 13 and 29. What is the largest prime factor of the number 600851475143 ? The answer is 6857. I think I have a top notch algorithm to do the job (speed wise), which doesn't ac...
I'd like some input on the way I've structured some things in a side-project I'm working on. I declare an abstract class, CelestialObj, which will contain the common elements between Planets, and Moons (both of which I'd like to be derived from CelestialObj, obviously). Now, a Planet must keep track of its Moon objects...
I used Python to write the following program: """ A desired equation includes a 4-digit integer multiplied with a single-digit integer to give another 4-digit integer and all 9 digits(1-9) are used in the equation. """ import random found=False while not found: full_range=range(1,10) four_digit_num="" ...
I am purely new to C++ memory management. Am I on the right path, or should I employ a different design strategy or a different memory manager policy (such as weak_ptr)? #include <mutex> #include <assert.h> #include <iostream> #include <unordered_map> #include <memory> #include <string> #include <stdio.h> // // Requ...
I would like some feedback on a Java program which implements the Sieve of Eratosthenes to find prime numbers. Some of the 'features' I've included in the program include: It uses a BitSet for identifying primes. What really gets checked is whether the index of any bit is prime. This eliminates the need to store the...
Can someone let me know if this is a proper (and efficient) way of doing it? It works, but I wanted to understand if there's a way it be made better (I can use a for loop for the clones, but my browser gets stuck if I do it). Here's the fiddle window.onload = function() { rot(); } var rot = function(){ var paper = ne...
package standardcalculator; /** * * @author BSK */ public class calculator2 extends javax.swing.JFrame { private String input="";//We have nothing to display on the screen,if we dont do this creates the problem of displaying the null. private String firstOperand="0"; //Standard firstOperand. private Strin...
I am generating a random numerical 6-10 digit password. I need some important reviews of yours. Is it OK or are there some needed modifications? val AB = "0123456789669900" val rnd = new Random() def randomNumericalString(): String = { val len = rnd.nextInt(5) + 5 val sb = new StringBuilder(len) for (i <-...
This is a continuation of this question. Following the previous advise, the thread pool now can handle almost all types of input, except for one key form, where the function/functor requires one of its arguments to be std::move'd as shown below. main.cpp #include <iostream> #include "threadpool.hpp" threadpool pool; ...
This is a client module of an Eclipse plugin. I am planning to use this code as a "good exception handling" code example in one of my papers. How does it look? HttpURLConnection httpconn=null; BufferedReader breader=null; try{ URL url=new URL(this.web_service_url); httpconn=(HttpURLConnection)url.openConnec...
In my (c#) code, I need to generate a string (from a longer string) which when UTF-8 encoded, is no longer than a given max length (in bytes). public static string OfMaxBytes(this string str, int maxByteLength) { return str.Aggregate("", (s, c) => { if (Encoding.UTF8.GetByteCount(s +...
I am following up on this answer for a scenario that I am currently working on. Like the OP, I am too concerned about the longevity of the code. public IQueryable<TEntity> EmptyEnumerable() { return Enumerable.Empty<TEntity>().AsQueryable(); } private Expression<Func<TEntity, bool>> GetFilterExpression(FilterQuery...
Problem is Talent Buddy. Your task is to write a function that prints to the standard output (stdout) for each query the user name that matches the query if there are multiple user names matching the query please select the one that is the smallest lexicographically all string matches must be case insensitive if no m...
This is the first time using a class. Please review this and tell me if it's secure and if it's the right way to do it. The code itself is working, but I have doubts in the way I used all this. // register.php <?php ... $db_password = $hash = password_hash($pass, PASSWORD_BCRYPT, array("cost" => 10)); .... // store ...
I want to create a table that looks like this: -------------------------------------------------- | | USD |CAD | -------------------------------------------------- |Smallest Donation | 100 |250 | -------------------------------------------------- |Largest Donatio...
I have a Unit of Work / Repository pattern in place to abstract away some nHibernate. Most examples I've seen though use the pattern a little differently. In particular, in the constructor for UnitOfWork, most examples start the transaction immediately and have one transaction per unit of work. Whereas I created a Begi...
There have been a number of questions asking for comments on code for the Project Euler problem to compute the largest prime factor of a number. A primary intent of this task is to find the factor as quickly as possible. I decided to implement the code in C++ using at least some approximation of the best techniques/alg...
I started improving my validator library even more, and I think I'm at the last final element (domain object / entity validations) before I can gladly say that my Validator library is completely done and it supports all of it. Here you can see that my validator can already deal with regular variable inputs or non-entit...
First project in Dart - looking for style tips. I feel like I'm writing it a bit like Java, and would like to learn how to write dart-y dart. Also - what's the convention on multiple files in a project? There are other files in this project, and I do not know how to include them in each other, etc... See more library ...
Some might not think it's worth asking but I consider good function names quite important. I am not sure what should be the overridable function name in what I think is template design pattern. I am printing a report which has 3 types. There are lots of if-else which is confusing. I replace the long function with the p...
I've got the following code inside an integration test. [TestMethod] public void Integration_GetUser_WithoutLoggingIn_ThrowsInvalidOperationException() { var myApi = new Api(new Session()); try { var irrelevant = myApi.GetUserInfoAsync().AsTask().Result; } catch (AggregateException ae) ...
I built a simple class to handle skill increases for the workers in a strategy game for iOS. The basic idea is that whenever a worker finishes a job, their skill (which starts at 0) will increase by 1. Whenever the skill reaches a multiple of 10, this increases the skill multiplier by 0.10. This multiplier is multip...
I'm trying to design an API.NET for some communication purposes with Testing Equipment and I cannot figure out a proper way for designing the architecture. Basically, we have different (physical) products: A Controller to perform measurement on channel inputs (e.g. Current, Voltage, Frequency, Digital, Relay, etc.) an...
The problem I am talking about is this: We'll say that a "mirror" section in an array is a group of contiguous elements such that somewhere in the array, the same group appears in reverse order. For example, the largest mirror section in {1, 2, 3, 8, 9, 3, 2, 1} is length 3 (the {1, 2, 3} part). Return the size ...
Is it considered bad style to have that BOTH value in the Direction enum? Problems can arise from BOTH being present, for example when trying to build a procedural UI for the Car class, it (the generator) would see the setTurnSignal(Direction) method and create a way for the user to give it a Direction, but it would su...
I've written the following code to get all .txt files in a directory and read+delete them, repeating every 15 seconds. var fs = require("fs"); var path = require("path"); var Q = require("q"); var dir = "stuff"; var analyseFile = function(fileData, callback) { ... }; // Not important. var deleteFile = function(filePa...
The following code is intended to parse a string of the following format and return whether the current time falls in that window: start_time-stop_time [(day|day-day[, ...])][; ...] For example, 0900-1200 (mon-wed, sat); 0100-0200 (sun, tue) The code for parsing that type of string is here: days = ['mon', 'tue', 'wed...
I am trying to implement an infix to postfix conversion program using stacks. I have actually have done it successfully, but I'm uncertain about the complexity of the logic that I used for the priority checking. int hasLowerPriority(char ch,char ch2) { int num=0,num2=0; if(ch=='+'||ch=='-') num=1; ...
I find the default Javascript extremely poor on useful functions. There are some nice libraries, but somehow I always need something I can't find. Currently, I'd need a method removing all matching properties from an object. And I really mean removing, not creating a filtered copy. I've found similar methods in both jq...
Is there a better method for covering errors in my case? I am looking for best practice for now and future instances. Foreseen errors that could arise: No attributes at all Some attributes could be missing Attribute value could be empty // converting dom into array to use later $fields = $dom->getElementsByTagName($...
I am a newbie and tried to find the laziest way to do a file upload using EmberJS, jQuery and formdata (IE10+). The code might look stupid, but it worked. Can you please take a look and give some suggestions? Am I doing it wrong? <script type="text/x-handlebars" data-template-name="posts"> <form role="form" enctype="...
I wanted to share this and get some feedback. My goal was to be able to have an object with methods: class Thing(object): def __init__(self, data=123): self.data = data def add_one(self): self.data += 1 def add_number(self, number): self.data += number And then a collection obj...
Im trying to draw a lot of fields image for my world generation, all is perfect 64 fps, but if i began to draw all the time the grass it became laggy, like 59 fps (something that musn't happen! :( ), i need help and some tricks to draw things in c# with more optimization :) int loadedChunks = 0; for (int chunkX...
Here's my attempt at a script that will take user input and produce a custom interactive eBay listing. This is definitely still in progress, but I wanted to post the code I have since I'm sure there will be awesome suggestions on how I can improve functionality and write less. Here's a Fiddle. The default window size t...
I need to assign a number to each userId. I think this is too much of a query for updating. Is it possible to reduce the number of queries, or is it okay? def newRanking(groupId: String) = { DB.withConnection { implicit con => var rank: List[Int] = util.Random.shuffle(List(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,...
I'm a new programmer, so any help is welcome. Preferably to make it faster, avoid heavy memory usage, and so on. #! /usr/bin/env python """ This module is a frame work for a Genetic Algorithm. :param GenePool: See this documentation for how to use this module.. :type GenePool: GenePool Author: Fernand...
I am trying a very simple method of getting the theme information via a theme.xml within each theme folder. What it should do: Scan the theme directory ../themes Return the names of all the theme folders (array) Use the name of the theme folder returned to create a link to search in file_exists() Find the theme.xml in...
I believe I have made the following data class quite decently, and I'd like a thorough review on it. The code is built on Java 8 and uses the Builder and Serialization Proxy pattern, it is used to store results from a web service call, and the only certainty I have is that the organization id will be an integer, as it'...
I have the following MySQL query which selects product details and whether the viewing user likes them. I feel like it could be more efficient and that there is a more practical approach than using a sub-query here. Any suggestions? SELECT p.*, pm.filename AS thumbnail, (SELECT COUNT(id) FROM likes W...
I wrote this piece of code to make any breakpoint to the users choice: @mixin breakpoint($media) { $max-width: 0; @if($media == 'phones') { $max-width: $phone-medium; } @else if ($media == 'monitors') { $max-width: $screen-medium; //etc etc etc } @else if($media > 0) { $max-width: $media; } ...