instruction
stringlengths
71
71.9k
Given a set of points, what is the number of isosceles triangles that can be formed with the combinations of all points in the set? It is certain that 3 collinear points never exists in the set. #include <stdio.h> typedef unsigned long long llu; typedef struct { llu x,y; }point_t; inline llu distance_p(point_t &...
I wrote a small code in Python to conduct a backtest. My rebalance function is very slow and I would like to improve it. I need to profile it but I would welcome any opinion on how to refactor my code nicely. def Rebalance(self, currentDate, data, VolatilityForSizing,Wthtslippage=True): # Handle open positions...
Today I saw an extremely interesting question on the Rock, Paper, Scissors, Lizard and Spock game. I've decided to take my swing at it and I've written the following OOP implementation: function RockPaperScissors(name, hard_action, soft_action) { this.name = (name + '').toLowerCase(); this.hard_action = hard_ac...
hackerrank.com - diagonal difference: Problem Statement You are given a square matrix of size N×N. Calculate the absolute difference of the sums across the two main diagonals. Input Format The first line contains a single integer N. The next N lines contain N integers (each) describing the matrix. Constraints \$...
This is a school project and took me a while to write the code. Any help to improve my code is welcome! #include <fstream> #include <conio> #include <stdio> #include <stdlib> #include <iomanip> #include <windows> #include <time> typedef char string[50]; int ra; /*************************************** Modified gets() f...
Basically I am trying to iterate over one collection moduleList and adding to another collection targetList Is this a good practice in Java 8? Do we have better way of doing this? modulesList.forEach( m -> targetList.add(new ModuleType().withModuleNum(m.getLeft()).withModuleName(m.getRight())));
I've created a Windows Form Number to Word converter application in C# which converts any number from 0 to 1 million. I would love a review based on efficiency and best practices. MainInterface.cs using System; using System.Windows.Forms; namespace NumberToWords { public partial class MainInterface : Form { ...
I have been fiddling around with creating my own Sprite Cache. Currently, I am using the C header file, dirent.h, to open up a directory and load all .bmp files. I do not have to check if the file ends with .bmp, as SDL_LoadBMP will return a null pointer if it can not read the supplied file as a bitmap image. One thi...
I wanted to implement a van Emde Boas Tree in Rust, to start learning the language. Much of my implementation is derived from the pseudo-code on wikipedia, with the exception that empty subtrees are not stored. Besides the obvious lack of docstrings on public methods, what could be improved? use std::mem; #[derive(Deb...
It's a script that I've ripped off elsewhere, and have modified it via help from Stack Overflow on a couple of other questions, so that it tops out at 10 fields. My knowledge of JS/jQuery is barely there. I'm terrified that I did it badly or wrongly. Could you please let me know if this is the correct way of doing it,...
I have this query here that I am trying to make more efficient as it is taking an extremely long amount of time, about 40s on 3 million records. The query basically takes X amount of rows per company and turns them into columns for a given existing column. SQLFiddle SET @sql = NULL; SET @sql1 = NULL; SET @sql2 = NULL; ...
I have a table that reads every minute, but the data on one meter only changes once every 60 minutes. It will then repeat that value for 60 minutes before changing again. I need to take the sum of these values and add them up for the day. But if I grab it by the hour, I will get duplicates. So what I decided to do was...
This code runs fine without a bug, I need to optimize this code for following interview requirement. Lets say i need to send it to 1 million contacts and emailBody is ~100Kb. What code optimization do you recommend to make it faster ? Write code or algorithm to explain the optimization you think will make this code fa...
Write a menu-driven program to represent Polynomials as a data structure using arrays and write functions to add, subtract and multiply two polynomials; multiply a polynomial with a constant, find whether a polynomial is a “zero” polynomial, return the degree of the polynomial. Assume that a new polynomial is ...
This is a follow-up question to this question. Is this a reasonable implementation for a blocking version of method ArrayBlockingQueue.drainTo(Collection)? /** * This blocking method blends {@link #take()} with {@link #drainTo(Collection)}. * <br> * Chiefly, {@code take()} blocks and {@code drainTo(Collection)} does...
I've been on a quest to learn C++, and to learn, I've started building a small Role-Playing-Game skeleton to help myself learn the language. I've tried to make sure that I've followed C++ styles/standards correctly. This is the first "part" of my development of the skeleton, and it includes a usable class, Character. T...
Is there a more efficient way to do the below without two for loops in actionscript 3? In java there is NavigableMap or something like that where dont need to loop. var treasureItemsWeights:Object = { "1" : 5 , "2" : 20, "3" : 400, "4" : 60, "5" : 20, "6" : 20 , "7" : 20 ,...
I've been playing around synchronizing two scrollbars on a web application using JavaScript and jQuery (1.11.3). So far what I've been doing is any time a scroll event happens on one div, I use scrollTop to adjust the position on the other div: $left = $("#left") $right = $("#right") $left.scroll(function () { $ri...
I would like to refactor that code. def experiences work_experience_array = @coach.delete(:work_experience) education_array = @coach.delete(:education) array = [] array << work_experience_array.map do |experience| Db::Experiences::Work.new(experience.for_indexing) end array << education_array.map do |e...
I want to store some user settings into a file, so that the users get the same experience on all machines they're working on. The built-in user.config turned out to be insufficient, as I can't store Nullable<T> values in it. I created a simple class for my program that stores the user settings in an XML file. This is h...
Given a bunch of latitudes and longitudes stored as Points, I would like to determine the points that are closest to each point given some maximum threshold in meters. This is my first stab at this: DECLARE @ThresholdInMeters FLOAT = 1000000.0; IF OBJECT_ID('tempdb..#Points1') IS NOT NULL DROP TABLE #Points1 CREAT...
I have this PHP curl function to check if a site is online or not: function check($proc,$url,$keyword,$method,$timeout,$maxredirs) { // Format Link $link = $proc."://".$url; // Agent $user_agent='Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.130 Safari/537....
How would you simplify the following block of jQuery code? I use this in a tab-box to size the tabs to style the tabs to the full width of the box no matter if it's 2 or 10 tabs... It works perfectly, just interested if there's a better/shorter way to achieve the goal. $(document).ready(function() { $('ul.tabs-list')...
I saw this question: Is this FizzBuzz Swift-y? and I couldn't resist the temptation to attempt a Swift2 implementation: for i in 1...100 { switch i { case _ where i % 15 == 0: print("FizzBuzz") case _ where i % 3 == 0: print("Fizz") case _ where i % 5 == 0: print("Buzz") default :...
I made a code and it is doing what I want. But, I would like to know if I am doing it right or in the best way. Could you please give me your thoughts about it? Thank you. $result = mysqli_query($sql); $p_before = ""; $year_before = ""; while ($rows = mysqli_fetch_array($result)) { $p_now= $rows["cop"]; i...
I'm building a bounding volume hierarchy in Golang. I can tell my code works because I did some test on it and it gives the same results as the brute force implementation (brute force is to test all possibilities, in \$O(n^2)\$). My problem is that the code is slower than the brute force implementation (not by that muc...
I have written this function but I am not so proud on it. I could use some help refactoring it. Would recursion improve my code? Data sample. { "Name":"test2", "DepartmentUnitId":"test", "ParentDepartmentUnitId":"test", "NestedDepartments":[ { "Name":"test2", "DepartmentUnitId":"test", ...
In this scenario, the main page contains a list of links to the subpages. The requirement is to navigate to each page (if a condition passes) and perform some actions. I have written the loop using Geb: at MainPage ListItem.each { if(Button.present){ Button.click() at SubPage ...
I found a few question about the game and IMHO it's a relational problem and better addressed by set logic. Thus I created this solution in SQL to get away from ugly JavaScript, elegant java and practical C# --drop table [Hand] --drop table [Action] create table [Hand] ( Id int primary key not null ,Name varc...
I have the following table definition: CREATE TABLE ProductPointValues ( id INT, effective DATE, minPoints INT, maxPoints INT, CONSTRAINT PK PRIMARY KEY (id, effective), CONSTRAINT FK FOREIGN KEY (id) REFERENCES Products(id) ) ; INSERT INTO ProductPointValues VALUES (1, '1/...
Win32 File API Wrapper Based on a few fundamental frustrations with VBA (namely the lack of ability to work with files larger than 2GB, the lack of encapsulation of the file functions and the lack of intellisense to guide my use of the file statements) I put together a wrapper for the Win32 File API. This includes 64-...
Background I work at a company that makes hardware products. All the test settings are stored on the server so it updates all our test stands. I'm currently working on a web-based app using ASP.NET so we can quickly change the test settings. I've been working to make the UI easier to use by adding modals, AJAX, and som...
I wrote an ugly mess of a JavaScript function that pops up a dialog box based on validation data, when a checkbox is clicked. I am wondering if it can be refactored somehow. varButtons contains code for which buttons are used as a parameter to BootstrapDialog function. //checkbox validation var varButtons = []; if (is...
I'm studying C# and trying to work on efficiency and making the best use of C# 6.0 features. I have created the following program based on an exercise challenge in a book, and have used Resharper to fix certain things; however, I still feel my novice knowledge of C# is preventing me from creating the below program in a...
This is a start towards implementing a poker-like game called Jacks Or Better. Before proceeding to improve the way cards are shuffled and dealt, I would really appreciate help cleaning up my code. using Sandbox.Properties; using System; using System.Windows.Forms; namespace Sandbox { public partial class Form1 ...
I have written code to check any birthday input's validity. As I am new in programming, and after going through several debugging steps, the code became very ugly. month_dict = {'jan':'January', 'feb':'February', 'mar':'March', 'may':'May', 'jul':'July', 'sep':'Septembe...
I have trouble understanding recursion, so I'm trying to implement algorithms using it. I wrote this code that calculates the length of the longest increasing sub-sequence. How can I improve this? int _lis(int arr[], int n){ if(n==0) return 1; int m=1, temp; for(int i=0; i<n; i++){ if(arr[i]<arr[n]){ ...
After reading a lot of tutorials, I was finally able to code my version of a Tic-Tac-Toe game. I would like to have some honest review of the code to see what I can do to better my coding. class Game attr_reader :board , :marker def initialize @board = Array.new(3," "){Array.new(3," ")} @marker = ["X", "...
I have created a simple program that is supposed to be the core of a roguelike game. The program uses ncurses, and all that is supposed to happen is you choose a race and class, then choose an arena. The player can move around, and if the player moves onto deep water or lava, they die. /* * main.c - main file for the ...
I wrote this encrypter based on the idea of a Vigenere cipher, but instead of using only one key, it "makes" another key from the existing key. The length of the second key also depends on the different characters in the first key. And so it uses both keys in the shifting of letters. def scram(key): key2 = [] #...
This is an implementation of the Nothing programming language. The language spec is as follows: Design philosophy In the current software industry focus lays on solving complex problems by using complicated algorithms. The language "Nothing" was created to shift this focus from complex problems towards the expec...
I am working on some code that will generate a link with a relativly unique 10 character hash. I am not worried to much about colisions as long as they are rare enough that I could have a couple thousand links out standing since I soft delete after they are used and a colision between an open item and a closed item is...
My program is complete and runs, and gives me the output I expect. For example, if I enter the string "HELLO" I should get 8. Are there any improvements that can be made? #include "stdafx.h" #include <iostream> #include <cctype> #include <string> using namespace std; int gameScore(string word); int letterValue(ch...
I managed to finish my approach on the legendary Snake game. You move around with the WASD keys. I would like to hear your opinion and maybe ideas on how I can improve frame rate because now it sort of flickers (but it is playable). #include <conio.h> #include <stdio.h> #include <ctime> #include <vector> #include <win...
I was assigned to write a piece of Haskell code that makes an infinite list containing increasing numbers of 'a's. My first thought was to write it as a list comprehension like this: aStar = [replicate n 'a' | n <- [0..]] But when I asked my professor he said I should use explicit recursion so I came up with this: aSt...
I've created a working XML RSS reader. I wanted to know if it's a good one or not and if it's efficient for the server or not. I run this code every 12 hours or something give or take the amount of time that a new article will be published. This is the code itself with all the explanation of every part of the code. Tel...
I've been working on this utility for a while now, and have since gone through a couple reworks to try and increase the readability and best practices, but since I don't usually work a lot with Swing, or UI design in general, I still have the nagging feeling there's a better way to approach this. Code for both files is...
Since I learnt about refactoring, I've been busy creating my own Module of Standard Methods. I feel it's about time they got a review of their own. Open to all aspects of advice but particularly interested in: Method Naming: Are they completely unambiguous about what the method does/returns? Use of Optional / Variable ...
template<typename... T> constexpr std::size_t sizeof_struct() { // Helper auto alignto = [](auto x, auto a) { return (x + a - 1) / a * a; }; // Algorithm std::size_t max_align{0}; std::array<std::pair<std::size_t, std::size_t>, sizeof...(T)> arr{{ {alignof(T), sizeof(T)}... }}; a...
Code shows duplicate values of integers in an array with indexes and the number of occurrences. Can you please critique my code and provide your thoughts on where I should improve my code? import java.util.Set; import java.util.HashMap; import java.util.Map; import java.util.HashSet; public class DuplicatesInAnArray {...
Rubberduck's unit testing feature (heck, the whole project) started with a VBA unit testing framework that was ported from vba to c#; the VBA logic was pretty much simply rewritten in another language, and a dockable toolwindow is now available in the VBA IDE for Rubberduck users around the world: For the next major r...
I wrote a little fractal noise generator the other day, and to test it I wanted to display the dark values with a darker character and the bright values with bright characters (I use a dark background with light foreground). So I wrote a simple java program to do this, and here it is: package com.loovjo.brightSort; im...
I'm trying to solve this problem. I changed Scanner and used BufferedReader but I'm still getting TLE with the given code. Can I have a code review to help determine where else performance can be optimized? import java.util.ArrayList; import java.util.List; import java.io.BufferedReader; import java.io.InputStreamReade...
I am working on an application in which I have to parse an XML file. Nodes of the XML file corresponds to an object. I have to populate the properties of the objects at run time. The code below queries the metadata of property and sets its value. Is there a better way to do it or is there a better way to map the elemen...
I'm doing a problem from Project Euler to find the sum of all primes under two million. My code manages to get a pretty good result for small inputs, but when trying inputs like million or two it just won't finish. import time import math def primes_sum(limit): num_list = range(2, limit) i, counter = 2, 1 ...
This is my first attempt to draw using FLTK libraries *: // Objective: Draw an 8-by-8, red and white checkers board #include "std_lib_facilities.h" #include <iostream> #include "Simple_window.h" int main(){ try{ // create a window in the center of the screen wiht size: 600x600 int wWidth = 660; int wHe...
As my first Java program, I have written a number-guessing game. I would appreciate any suggestions on how I can clean it up or streamline it. I don't mean cut down on the general tasks executed within the program, but rather if there were better methods/classes/syntax I could have used to make it better. I took a few ...
First off, this is the 3rd (and probably last) review of the project in question. You can find the previous question here. The Macro accesses a workbook containing 8 worksheets each with similarly structured but not identical tables of data (submitted business for my company). It then filters this data for desired colu...
I have been trying to get better at functional programming, which includes understanding map/reduce. I wrote a function intended to fill an autocomplete with values. The challenge I was encountering was my Mongo records, which had a category array that needed to be flattened for the autocomplete to work. Being a novice...
I currently have what seems to be a very overly complicated underscore template full of conditionals and as the data grows I'm worried the conditions are going to get more and more extreme. Can anyone advise how I could make this template logic a little easier for my inputs, right now I'm running if...else just to make...
I have problems with dealing with derived classes that inherit from the same base class. I have 2 types of songs: Songs with lyrics that have: Title, Tags (sad, happy etc.), lyrics (one line), writer. Instrumental song: Title, Tags (same as lyric songs), instrumentals (a string), performer, BPM. I thought it would be...
I have been reading the chapter 15 of "Introduction to Algorithms" (3rd edition) by Cormen, etc. The chapter 15 is about dynamic programming, and the first example they show us is the "rod cut problem". Now, I have spent some time trying to understand it, but mostly trying to understand the pseudocode, and why it real...
I have a piece of code where I have string pairs (eg. 'a' and 'AA'), where both have their own unique ids. Id for first object is configured by user and second id is received at some point during runtime. Example code: http://repl.it/BE5N Is there smarter way to load/save second ids from/to a file? It feels somewhat un...
Here is my Python code for Project Euler #2: Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... By considering the terms in the Fibonacci sequence whose values do not exceed four milli...
Reverse engineering old games is something I do every now and then. This time, I took a shot at this old RPG called Darkstone. The bulk of the game's data is stored in archive files with the .MTF extension (not related to the Microsoft Tape Format). A partial description for this file format can be found here. The form...
I'm new (to CR and to programming in general). I wrote my first VBA on Monday. This is my first working project. It Takes a bunch of financial data from a company called Financial Analytics and a bunch more from a number of webqueries, and puts it all in a nicely formatted table for external consumption. It's a kludgy ...
After writing a rather long document in Markdown and using pandoc to convert it to a PDF, I found, to my dismay, that many of the images were out of place, and that they all had their alternate text proudly displayed underneath them as captions. My document is rather instructional, so this rearrangement was harmful to ...
While reviewing Sending templatized e-mail to a million contacts, I wrote this implementation to illustrate an alternate approach. It is designed to be the fastest possible way to generate templated text repeatedly. Is it? I used the in-memory Java compiler featured in this Stack Overflow answer. I think that the str...
I have an openwrt router (TP-Link MR3040) and on boot I have it check the slider (AP, WISP, 3G/4G mode). The goal was to have it execute the current "slider status" vs the old one, or do nothing if it's the same (before reboot). I just want a critique on making it more elegant. #!/bin/sh test=$(cat /root/logs/sliders...
The following class BackgroundExecutable is to be used to take a function f and return a function f' where f' asks iOS for background execution. f takes a completion closure which it uses to end the background execution. class BackgroundExecutable { var identifier: UIBackgroundTaskIdentifier let f: (() -> Void) -> ...
Write a function called answer(document, searchTerms) which returns the shortest snippet of the document, containing all of the given search terms. The search terms can appear in any order. Inputs: (string) document = "many google employees can program" (string list) searchTerms = ["google", "program"] Output: (st...
This is my current RowDataBound function. I think this functionality is a bit horrrendous really and it winds up with an extreme amount of LINQ SQL queries being passed around (which makes for big server load etc). What I'm wondering is, is there any way that I could pull all the data in the first select statement, pu...
I was in the mood for some data structures and I decided to code up an ordered map using AVL tree. I will post only map.h and map.c. The demonstration driver may be found here. See what I have: map.h: #ifndef MAP_H #define MAP_H #include <stdlib.h> #ifdef __cplusplus extern "C" { #endif typedef struct map_entry...
I have a WPF application that gets data from a web-server. It contains two Views LeftView RightView three Models LeftModel RightModel CentralModel and two ViewModels LeftViewModel RightViewModel I will show only LeftView, LeftViewModel, LeftModel, and CentralModel (too much code). You can find the entire pro...
I wrote (as part of a greater work) a Boost.Spirit grammar that would parse string literals, including support for the various escape sequences known from C/C++ (\n, \x7f, \341, \u017f, \U00010451). At some point I encountered some problems, mostly due to my lack of understanding either Boost.Spirit or Boost.Phoenix to...
I was just wondering if my code contains defects or if there was a more efficient or general way to convert string to DateTime object. In the input, I have a string in the UTC format. public static DateTime ParseDateTime(string dateString) { DateTime dateTime; if (!DateTime.TryParse(dateString, Cult...
So, I had a go at re-writing my Workbook_Open event based on The advice from my previous question. Thoughts? Private Sub Workbook_Open() Dim strTableTitle As String Dim StrTodaysDate As String Dim StrThisDay As String Dim StrThisMonth As String Dim StrThisYear As...
I have a C# type to generate Layer SubLayer: public class Layer { public int Id { get; set; } public int ParentId { get; set; } public string Name { get; set; } } And simulated a list with a Db class: public static class Db { public static IList<Layer> GetLayers() { return n...
I have a JSON API where a user can update a post and related details to that post. To simplify the process the user just fills in one hash and we don't expose our architecture. What I did here works but I would like to know if their is a better way. This smells to me, but I don't know why... def update params['blog...
I'm learning C++, so I wrote a stack with the help of templates. I'm wondering if there is anything I can improve or if I did something vastly wrong. Stack.h #pragma once #include <ostream> template <class Type> struct Node { Node(Type data, Node<Type>* next) : data(data), next(next) {} Node* next; ...
POSIX version: ^((00)*|(11)*|((10|01)(\2|\3)*(10|01))*)++$ Emacs version: "\\"^\\(\\(00\\)*\\|\\(11\\)*\\|\\(\\(10\\|01\\)\\(\\2\\|\\3\\)*\\(10\\|01\\)\\)*\\)+"+$" (in case you were too lazy to add backslashes) I am absolutely sure that the language of binary strings of arbitrary length with a requirement of even num...
I wanted to scrape all the wallpapers from the Bing wallpaper gallery. This was for personal use and to learn about webscraping. The gallery progressively gets images using javascript as the user scrolls down the page. Then you can download the high-resolution image with a few clicks. I actually succeeded in scrapi...
I wrote a snippet of code to help me memorize text out of files and was hoping to get some feedback on the code, since Python isn't my strongest language. You can see the code on GitHub, but I've pasted it below as well. #!/usr/bin/python # coding=utf-8 import argparse import codecs import random import sys parser = ...
I'm making a text simulation game in C# and I've made the calculations and all. But I know there's a better, faster and more efficient way of doing this. Basically, the first calculation is that there's a 5% chance that there would be a 80-100 yard gain and so on. public static class Program { public static Random ...
This is an implementation of a segment tree with lazy propagation. Could you please review this code so that I can improve my Go language skills? package main import ( //"fmt" ) var array []int; // Array to store initial input like: [1,2,3,4,5,6,7,8,9,10] /* This is Node structure val : aggregate result (s...
I'm writing and app in AngularJS and am learning about writing RESTful services. I also want to make sure that I'm understanding the MVC pattern correctly. In my code, this is my take on how I'm implementing MVC. I have two services that get JSON data from the server. The JSONController then calls these services, an...
I'm writing a sub which is going to determine which type of business is being detailed on a particular line of data. It's going to use column positions to check if the data exists, and then output the corresponding string if it does. I've decided that the best way to organise a group of my arguments is using a 2D array...
I just started JavaScript about a week ago. For my first project, my goal was to use my knowledge of basic JavaScript to create somewhat of a "thinking computer brain," so to speak. I wasn't focused on the looks of it, as seen by my only using the basic prompts and alerts. I just wanted to get used to writing coherentl...
Let's say I have a bunch of Widget, where a Widget is class Widget (sku: Int, label: String, name: String, description: String) And I have 2 sources of Widgets: List[Widget] wInventory = getWidgetsInInventory() List[Widget] wCatalog = getWidgetsFromCatalog() I want to use the name & label from the Catalog to overri...
The following is a function that takes an area as an input and outputs some resulting calculations. I thought an object was useful for creating multiple instances with different custom properties overwriting the defaults to make comparisons easy. The getter and the setters are there so when one property is updated th...
The application leverages the bitcoinj library to generate a vanity bitcoin address. A vanity address is simply a bitcoin address that contains a personalized string. I would like some critical feedback, specifically code correctness, code smells, and my usage of futures Sample Invocation: java -jar vanitas-1.0-SNAPSH...
The title is a joke on how some people take a lot of selfies pictures Recently, in The 2nd Monitor, there was a brief discussion on selfie answers, starting with this post. At one point, a user said this: I don't know how many selfies I have :s I immediately thought: this is the perfect opportunity for an SEDE query!...
This is horrendous. I'm using lodash's templating engine for this table. Here's the template for an individual record's row. I've got 5 different table and record-types and a view and edit mode for each row: <script id="individual-template" type="text/template"> <div class="individual<%= typeof isParent !== 'undefine...
I was working through a programming challenge I found on Reddit and it seemed easy enough: Find all numbers less than \$10^n\$ where the number and its reverse (the reverse of \$123\$ is \$321\$) are both divisible by \$7\$ and then sum them all together. def challenge_229(power): numbers = [] for x in range(...
I'm hoping for some input on if my code is DRY or how I could have made it more efficient. I am pretty new in terms of jQ/JavaScript and this took me far longer than I care to admit. I will post the CodePen and also the entire JavaScript (Unsure which is better in terms of formatting.) Forked CodePen so new changes won...
I just wrote an advanced CSV parser that translates CSV to SQL(SQLite Compatible) statements, which are then inserted into the database. It translates variable names in the CSV to values defined in the script. Example CSV 0,1,An empty black tile,${ASSET_PATH}/BlackTile.png 1,1,Grassy Tile,${ASSET_PATH}/Grass.png 2,1,La...
This code checks to make sure a directory is hidden and if not hides it. Then if hidden it will prompt for password and if password matches it will un-hide it. There is also an argument to open un-hidden directory too. #! /bin/bash DIR="path/untitled" DIR2="path/.untitled" password="Z2FsdGVkX18vy4f4QRB3qnb5vIWR0x+...
I am an electrical power engineer with some programming skills. My boss asked me to make a program which could analyze very large data, make some calculations and give the result. The task looks like this: I have an Excel file with a list of objects (Number of object, Name, Power, Switched on state decimal fraction, S...
This is my implementation of a binary tree in Scala. How can this be made better? abstract class BinaryTreeNode[+A] case class MyBinaryTreeNode[A](var data: A,var left: BinaryTreeNode[A],var right: BinaryTreeNode[A]) (implicit ordering: Ordering[A]) extends BinaryTreeNode[A] { override def toString = data + " " +...
I am using MVC+Angular. In MVC, I created partial views for search, listing, etc. I show them using: @Html.Partial("_Search") @Html.Partial("_Featured") @Html.Partial("_Listing") Previously each partial view had an ng-app and ng-controller. Now I combined them all into one ng-app. I added ng-app to master page, and ...