instruction
stringlengths
71
71.9k
I have two functions for writing data to binary file using BinaryWriter. The first function has single data object as argument and looks as below: // write single data object to binary file public void AddHeaderToIndexer(string path, RollHeader header) { bool isDone = false; bool error = fal...
I found a way to solve my problem, but I want to see if there is any better or clear solution for this. I have two associative arrays like this: $person= [ "A" => [ "sur" => "a", "fir" => "andras" ], "C" => [ "sur" => "b", "fir" => "balint" ...
This CalendarService is part of a little node-bot I wrote today which sends out reminder-emails if a team member forgets to submit his weekly schedule in time. Calendar backend is using Google Calendar. I'm interested in feedback, what I could simplify, where are the code smells, etc. index.js import CalendarService fr...
I had a problem that I posted on StackOverflow about that I could not connect to windows phone 7 from a 64-bit application. I got one response that said I should try to create a WCF Service over named pipe transport. Now, I have something that is working but since I am new to C#, WCF and COM, I would be happy for any g...
So my this class is one in which is used to find rectangles in images that have already been pre-processed. For example the images are to be deskewed, greyscale etc. Following feedback off of various people I have been told to try and conform it to c# coding standards. I have tried to do my best but was wondering what ...
I decided to step out of my comfort zone (Java) and try out Python. I wrote a very simple reverser.py and want it to be reviewed. """ This python script basically takes a string and reverses it. This python script can be used as a command line script as well as a separate module. """ import sys def reverse(message):...
I was working on a timer code in pure JavaScript and would like to know any pointers to improve: Features Start/ Stop/ Reset on click of a button. Set limit to clock. Update class name for warning and error based on threshold timer. JSFiddle function timer() { var time = { sec: 00, min: 00, hr: 00 }...
For my fellow Computer Science and Media students at my university, I build a link collection which soon a lot of people used. It basically served as a central place for all the links we needed to get access to lecture and exercise scripts, etc. To step it up a bit, I decided to throw some JavaScript at it so folks cou...
I want to ask if you can review the code for a simple contact form and the PHP code which sends me an email once a visitor fills the form and is validated through Recaptcha On my index.php file here are the form and php code HTML: <form id="contactform" action="index.php#contact" method="post" class="form" role="form">...
Everything works, but my hard coding is worse: Codepen <div class="header__search"> <form action=""> <div class="search__input-wrapper"> <div class="search__dropdown"> <div class="search__dropdown-trigger btn-default"> <span>Portfolio</span> <i class="search__dropdown-icon"></i> </div>...
Are there any memory leaks in this linklist implementation.Also is the implementation correct?Can the time complexity be optimized? #include <iostream> #include <cstdlib> #include <cstdio> using namespace std; struct node { int n; node* point; }; node* first=NULL; void search(int n); void insert(int n); void del(int...
I'm currently processing xml messages with C#. It is working But I'm not confident that my code is fast enough. There are 3 possible messages I can receive. When I receive one the message an event is triggered and I can access the object outside of this thread and do the necessary processing. The method start is runnin...
I wrote a python script that converts English to Entean language from an anime called "The Devil is a part timer". I am sloppy at coding and know that the script can be made better. In the anime, the language in Ente Isla is called Entean, which is basically most of the consonants in the English alphabet switched aroun...
I've reached a point in an application where I need to initialize some coordinates to an array and I wound up using nested for-in loops to accomplish the task. Is there is a better way to accomplish this? class Coord { let xVal : Int let yVal : Int init(x: Int, y: Int) { xVal = x yVal = y...
I made two player objects (p1 and p2): public class tttmodimproved{ static int turn=0; public static void main(String[] args){ System.out.println("Let's play TicTacToe"); char isWin=' '; Board b= new Board(); Player p1=new Player('X'); Player p2= new Player('O'); ...
I'm trying to test an elevator simulator program that runs in the console and requires user interaction. At the moment, my tests look like this: gem 'minitest', '>= 5.0.0' require 'minitest/spec' require 'minitest/autorun' require_relative 'elevator' class SingleFloorElevator < Elevator @@moves = ["2", "N"].each d...
I created the below script to help break apart large flat files; to save myself effort opening files which are several gigs in a text editor and manually split them. So far I've only tested on sample files, so I can't yet comment on the performance, but wanted to share my work so far / get feedback on whether I've miss...
I feel like I'm overdoing the async await stuff. I'm just learning. Maybe this isn't the best instance to be using this stuff. I have a system with sensors that detect the completion of some action. I decided to approach this solution using asynchronous programming since I still need to communicate with other contro...
This is my Player file. It is mainly for saving purposes. Is it easy to understand and read? Anything I should add or change for improvements? #Programmer: DeliriousSyntax #Player.py #Date: November 22, 2015 import math class User: def __init__(self, user, class_type): self.user = user self.level...
I've created a program for my job that unlocks spreadsheet files quickly and efficiently. What we use to have to do before this program is we'd have to go into the system, search for the file, kill the users process containing the file, unlock the file, then the user can finally get back into their spreadsheet. With my...
This code is just some exercise code printing questions and waiting for answers. It is working perfectly well as far as I can tell. I would like to know if this code could be considered acceptable or how it could be improved. import java.util.ArrayList; import java.util.Scanner; public class MainClass { public st...
I had written with very few PHP skills a conjugator script. It was not good, so I decided to start it from scratch with a help from a friend. I'm using the code formatter from eclipse. Now I need your reviews and improvement tips. I know all my long arrays with the all verbs and many more long arrays aren't a good way,...
This is a simple 4-stage pipeline that partially implements the RV32I ISA. All instructions are supported, except jalr, those relating to memory (l*, l*u, s*, fence and fence.i), or system calls (sbreak and scall). The pipeline stages are more or less the classic RISC ones without the memory access stage (i.e. fetch ...
I designed a "Ticker" based on how I imagine Minecraft's tick system works. My ticker calls a method tickRate times a second and provides a Delta Time value (deltaTime) to the method being called. The issue I have with my code is that I find the update method (which handles timing) to be ugly but I'm not sure what I ca...
I wrote a simple function to sort an array of integers in ascending order. Here is the code - void sort(int* begin, int* end) { int* it = begin; int num1 = 0, num2 = 0; while (it != end) { num1 = *it; num2 = *(it + 1); if (num1 > num2) { *it = num2; *(it...
The goal of this game is to not say the number 21. Rules: You must only say numbers consecutive to the previous said number. You may say 1, 2, or 3 numbers at a time. For example: Player 1 says 1 Player 2 says 2, 3 Player 1 says 4, 5, 6 Player 2 says 7, 8 And so on... You will be playing AI, and you will start. T...
I wrote this code for a multiplayer game I am developing to transmit floats over the network. It works, on the systems that I have tested it with. What I am worried about is the little-endian big-endian thing and the possibility of different float representations in general over computers. So here it goes: private stat...
I'm building a small game in pure JS for my own learning purposes, using sprites to model players. Before I go further, I want to try to get the animation down. The below code should produce a blank page with a skelton sprite that responds to arrow key presses. It should work in both firefox and chromium (but no other...
New Approach My previous question may have had a little too much going on and I realized I could simplify the problem by constructing the data a bit differently thanks to @Gentian Kasa . Previously, the code was filtering data constantly and causing a big bottle neck in the processing time. I have now constructed the ...
I wrote a module with 3 services that execute the oauth (and set the api key) for the google api and return the token object if the promise is positive. Here is the whole working module: angular.module('gapiOAuth', []) .controller('gapiOAuthController', ['$scope', function($scope){ }]) .factory('gapiCredentials...
I have a DAL class full of LINQ queries which I would like to improve as I found that I'm repeating myself couple of times. As you can see the part below is repeated couple of times and I was wondering if it is possible to reduce the number of repetitions (passing the query somehow?) and/or improve the queries overall...
This is a program to read and store the data from a Excel file (.xlsx) which is uploaded by users. Any better approach to reduce the usage of if-else to return the error message? How to design or construct a good coding pattern before I code? What kind of aspects I should pay more attention on ? Excel file uploaded b...
I am working on architecture where I can have any client + server API. I need to call API as clean as possible and get, post, put any object I want to. For me, it is important to have clean secure code with good practice. This is how I implemented it and I would like you to help me to improve this code. Some of questio...
I'm debating trying to take a crack at getting something similar to C#'s async-co-routine like nature over on JavaFX. This is technically feasible since the Quantem toolkit exposes the enterNestedEventLoop and exitNestedEventLoop methods, but using them is tricky. If you haven't seen it, C#'s await & task syntax (butch...
I have figured out how to serialize multiple objects, however I am utterly convinced I can use some kind of loop for the if statements below, to avoid duplication. Please can someone advise how I would do this? I have 20 objects in total, this code snippet shows the "if statements" for 4 of them. import java.util.Inpu...
I'm super new to PHP and I'm trying to get a functional login system together. This is the code I have: class/user.php <?php class Users { public $username = null; public $password = null; public $salt = "Zo4rU5Z1YyKJAASY0PT6EUg7BBYdlEhPaNLuxAwU8lqu1ElzHv0Ri7EM6irpx5w"; public function __construct...
I am currently creating multiple games by adding objects of type Game as properties of an object called games. The names of these properties are set programmatically - for example, the first game will be a property of games called game1. Sockets joining this game will join the room room1. Is this the right approach? It...
I am not much experienced in Python, just write some small script. All my codes are procedural. They work fine, and I always check them with pep8. One of them is: #!/usr/bin/python3 import os import sys import numpy as np import scipy as sp import scipy.optimize import matplotlib.pyplot as plt def f(x, a, b, c, d): ...
Here is a simple password generator in Java: public class PasswordGenerator { public static final String LOWER_CASE = "abcdefghijklmnopqrstuvwxyz"; public static final String UPPER_CASE = LOWER_CASE.toUpperCase(); public static final String DIGITS = "0123456789"; public static final String PUNCTUATION_...
def search(a,b): for d in b: if a==d: m=True break else: m=False return m x=[1,4,5,7,9,6,2] target=int(raw_input("Enter the number:")) for i in x: if i<target: pair=int(target)-int(i) in2=search(pair,x) if in2==True: pr...
This is a simple repository where I want to save all the invoices of some queried users. I wanted this module to only expose a simple saveInvoices method and return a Promise. As a DB, I use Firebase whose API is async but does not return standard JS promises so I promisify the db queries. I haven't yet taken every re...
Inspired by this question in chat Is there an easy way in .NET to split a string into an array by pulling chunks of the text in. I.e. I have an 18 character string I would like in 3 6-character pieces. I thought that ain't be that hard. I would like to get any thoughts and improvements you can think of. public st...
My task: Write nested for loops to produce the following output with each line 48 characters wide: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~+~~+~~+~~+~~+~~+~~+~~+~~+~~+~~+~~+~~+~~+~~+~~+~ +~++~++~++~++~++~++~++~++~++~++~++~++~++~++~++~+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This is my idea...
I made a custom encryption library/class which allows to en-/decrypt Strings with a custom charset. I think you'll get what I mean with that when you take a look at the code. Since I haven't much cryptography knowledge, I'd like to ask if someone who knows about it could tell me if this is "safe". I know nothing is 100...
Related to the question Verb conjugator for French, I was asked an question on whether one could summarize all the $exceptionIs<NAME_OF_EXCEPTION> = $exceptionmodel-> getValue() === ExceptionModel::NAME_OF_EXCEPTION lines. In other words, can one make dynamic variables out of the comparison of a value combined with all...
As an exercise, I wanted to make an array implementation of Stack, including most of the methods from the native Java Stack. I'd like to know the following: Does the code follow good programming principles? Is the code readable/understandable? Are there any redundant fields/operations? Is there a way to further impro...
up moves N directories above the current directory (executes "cd .."" N times) When executed without input values it moves only one directory above the current directory When executed with input values, up uses the first input value (checking to see if it is a positive integer)to move above the current directory the...
I have an app that makes calls to the Podio API. The Podio Api uses OAuth2 protocol , after user's authenticate with their podio username and password an access and refresh token is provided for subsequent requests. Podio has a Javascript SDK that handles authentication and API calls. I wrote a simple Session Manager u...
It is common to shorten city names when writing, or at least in Sweden. "Göteborg" (Gothenburg) is often referred to as "Gbg" "Uddevalla" is commonly written as "Ua" "Trollhättan" is often written as "Thn" ...and a whole lot of other city names are often shortened "Uddevalla" could also be shortened as "Uva", "Uvalla...
Write a function Int -> Char -> Char -> [String] that will create the appropriate pattern. For example: mapM_ putStrLn (pattern 48 '.' '+') ................................................ .+..+..+..+..+..+..+..+..+..+..+..+..+..+..+..+. +.++.++.++.++.++.++.++.++.++.++.++.++.++.++.++.+ ..................................
A while ago, I found a somewhat interesting sorting algorithm named Exact-Sort, which is introduced with the following somewhat bold claim: No sort algorithm can sort an array with less position changing (relocating) than Exact-Sort. While the claim is perhaps not as impressive as the fact that the website is still h...
This is quite final code of a script. It looks to me a little messy ad repetitive. What can I do to improve it? jQuery(function($) { 'use strict'; /* * This Object calls a editor based * on the choice of a radio input */ var wiz_ajax = { callUrl : setup.ajax_url, ...
Based on my previous question, I have implemented all the recommendations received. Here is a summary of the improvements: Use meaningful names as much as possible. Removed multiple declarations in one line. Removed the dynamic_casts and applied a new class hierarchy design. Added a Game class to improve code modulari...
Follow-up to: Brainfuck Interpreter: Slower than a Snail? Many improvements have been added, including: Remembering where the matching [ and ] is Combining +s, -s, <s, and >s into groups Providing the option to not optimize the code I have no idea how to use JUnit to test on the output, so I stuck with Main.java: pub...
So, this is my first web scraper (or part of it at least) and looking for things that I may have done wrong, or things that could be improved so I can learn from my mistakes. I made a few short function that can take a user and search tpb to get the maximum number of pages of content that that user has by requesting th...
Inspired by this question, I wrote a program in Whitespace to output the following text: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~+~~+~~+~~+~~+~~+~~+~~+~~+~~+~~+~~+~~+~~+~~+~~+~ +~++~++~++~++~++~++~++~++~++~++~++~++~++~++~++~+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ I left comments in the sour...
Here is an implementation I pieced together from various papers on the subject. It took a lot of fiddling to get it to run at all. My ideas for better performance and readability, based on looking at other GMP examples: Always pass by reference and never return any "large type" Separate matrix Gaussian elimination fr...
I have written a program to perform a task, but I'm guessing it is not optimized. I want to know if there are any ways to improve the effiency and performance of this program. This program reads a set of .gz files from a directory, parses each file, inserts the filtered content into another .xml file in the results di...
From this question, I do know that initialization list and in-class initialization are different things. The class in the following code has members with in-class initializers and those initialized in initialization list in constructors: class Bamboo { public: int a = {0}; int b; Bamboo() :a(3), b(12) { ...
I have two riscProfileTypeIds (both of type uniqueidentifier) of which I need the one with the highest sequence number (the highest of the two risc profiles, at business level). The below query does the job, but I'm not very happy with the union, I wonder if there's a way to do the same without it. SELECT [ID] FROM [Ri...
Is this good way to create a get API method with different service methods? Based on the scope parameter, it decides what service method in the API to call. Enum: enum scopeValue { None, GetAll, GetWithDetails }; API: public class WorkItemController : BaseController ...
(See the next iteration.) From time to time, while working with a command line in *nix family of operating systems, we have to write those scripts doing a rather specific task. Usually we use bash + utility programs to do the job. However, I had to ask myself: how to implement such a script in C? After an invocation of...
This function is working exactly as I want, only, it's taking too long. For speed ups, I've tried to do as much as I can before the main for loop by declaring each function as a local variable, I've also switched from using pandas dataframes to numpy arrays and decreased the outputted dpi. This function is being fed l...
Inspired by this question: Split a string into chunks of the same length The code is designed to work on text elements rather than chars to avoid unicode problems. public static class StringExtensions { public static IEnumerable<string> Partition(this string value, int chunkSize) { if (value == null) ...
If you are wondering why I ask, it is because I have numerous different methods all with very similar code (the only difference in the code in each method is what is between the generate resultset comments). I have tried any amount of times to try and shorten this but I am out of ideas. What I have been trying to get i...
The point of this code is to build an ip from a list of type ushort. var ip = new StringBuilder(); List<ushort> ipList = new List<ushort>(4) {192, 168, 1, 1}; ipList.ToList().ForEach(x => ip.Append(x + ".")); return ip.Remove(ip.Length - 1, 1).ToString(); The code works and outputs an ip as expected, but the formatt...
I am using reflection to check if a private variable is set to null after the logout function. This is needed because the getUser function will always attempt to set and return an user if no user is set. Am I doing something wrong or can I do something better? This is the bean that has the logout and getUser function: ...
I wrote a python script that converts English to Entean language from an anime called "The Devil is a part timer". This is the second version of the script which was first posted here Translating from English to Entean. This version is compatible with both Python 2 and 3.This version uses the str.maketrans method which...
Motivation I have found on occasion that I have needed to safely increment/decrement iterators by ensuring they are within some bounded range. After reading through some implementations (SO, Boost Summer code) and a proposal, I found that most of these "safe" functions did not handle the case where a negative differen...
i made a simple js snake game with canvas, the code is all mine so it can have some drawbacks or not so good parts. I will be glad to hear some opinions. https://github.com/vitaliyterziev/snake var Poly = { //polyfill Set() set: function (array) { 'use strict'; var cleanList = []; var ...
Could you please review the below AngularJS service. What it does is centralize all (relevant) HTTP action calls. Do you see any chances for improvement?: "use strict"; angular.module("services.api") .factory("apiService", [ "$http", "$q", "coreUtilityService", "constantsServiceName...
So I recently had a practical exam in which I was told to execute a function of a menu oriented matrix operation program using classes. The code I made was supposedly wrong as I hadn't used classes the way they have to be used. Can anybody help me rectify the error here. I'm a noob (less than 2 months into C++) so plea...
I have code that is used to add all cells of a tab to a var: #include <stdio.h> #include <stdlib.h> #include <assert.h> #include <malloc.h> #define NB 10000 // Instruction RDTSC du Pentium static __inline__ unsigned long long RDTSC(void) { unsigned hi, lo; __asm__ __volatile__ ("rdtsc" : "=a"(lo), "=d...
I needed a script to wrap phrases with tag, they all are separated by commas, for i.e "Alan, Bob, John". I came to this result: $actors = explode(',', $item->casting); $item->casting = array_map(function($a) { $a = trim($a); return '<a href="'.$a.'">'.$a.'</a>'; }, $act...
WE_ALL_LOVE_SHOUTY_SNAKE_CASE_SO_I_WROTE_A_PROGRAM_FOR_IT!!1! Alright, enough of this. This is a rags-to-riches from this question. The pattern is pretty simple, it takes a String input, verifies if it is numerical, and if so, converts it to SHOUTY_SNAKE_CASE. Example : "1231" -> "ONE_TWO_THREE_ONE" It is fairly simp...
I'm currently building some HTML with JS (specifically using the jQuery library). My code is as follows: goToError: function (error, returnView, returnController, callback) { console.log(error); this._transitionOutPanel(function () { loadError(); }); var loadError = function () { $("#p...
I have a factory method that should accept a list of coordinate lists, which are pairs of numbers, for example [[(2,4),(3,3),(2,4)],[(6,6),(7,6),(7,7),(6,7),(6,6)]]. I'd like to make sure the input is indeed in this format, but without specifying the types of sequences (might be lists, tuples, numpy arrays, and mixture...
I'm doing a comparison of Erlang, Haskell, Elixir and ES6, and I'm less farmiliar with Erlang and Elixir, but I want to represent all of these languages fairly, so is this good Erlang code? -module(mapreduce). -export([map_reduce/1]). add_to_key(KV, Sum) -> {Key, Value} = KV, Tmp = proplists:get...
The main body of code is located here. In the code linted_error is a platform specific type for error codes. As well, as an optimization the code can use Linux futexes. linted/mem.h is just a tiny wrapper around malloc. linted/sched.h does a bunch of stuff but is only used in this code to wrap platform specific pause ...
This is one of the (many) utilitarian classes I have that I use with my ASP.NET sites. The basis of this one is to make gathering certain tokens that I use periodically, to make URL's more friendly. It's pretty simple, and should be quite obvious. I use it to make URL's a little more friendly. (/Id/SomeKey/SomeValue/Ot...
I am an experienced Java developer (12+ years) and have recently switched to Scala and I love it. However I feel not comfy yet and I have a feeling that I might use to many paradigms from the good old Java days. That's why I would like to start with some simple code I wrote while viewing a Stanford Seminar on Youtube w...
I have a units of measure library that I added string formatting to. Here is sample code: [Test] public void FormatSpeed() { var speed = Speed.FromMetresPerSecond(1.2); using (Thread.CurrentThread.UsingTempCulture(CultureInfo.InvariantCulture)) { Assert.AreEqual("1.20\u00A0m/s", speed.ToString("F2")...
I write a simple php login class that only operate on php sessions to login user in the system. My Question is that this class is secure enough to be used on production environment ? NOTE : Die Statements are used only for testing of scripts class.login.inc.php class Login { //setSessionFunction sets a login session ...
today I tried to code all the dictionary operations such as Search, Successor, Predecessor, Minimum, Maximum, Insert, Delete etc. for a Binary Search Tree data structure using the Java programming language. I would be grateful to you guys if you can review my code and suggest me some cool tricks as to how to optimize m...
I was inspired by Processing a list to build an IP in String Format to reinvent the wheel a little bit and play around with explicit struct layouts. You see, an IP address is really made up of four, 1-byte numbers. Each Octet of an IP address is one byte. So, this means that an IP address can be represented by either...
I've written a program that takes a mathematical formula as an user input and converts it from infix to postfix. It doesn't support negative numbers. The program doesn't depend on the user having to pay attention on how to use spaces, so '1+2*3' and '1 + 2 * 3' are the same. (formulas like 'x^2^3' however must be writt...
My code finds the best match between a private company and a listed company based on 3 ratios in order to report the ratio4 from the listed to the private company. In order to do that first, I do the percentile of the ratio1 of listed company (as it is the most important). Secondly, I check in which percentile the val...
I've created a Combobox GUI that allows the user to search through the Combobox by entering a letter on the keyboard. If user enter letter 'L' it will search through the Combobox drop-down list for the first occurrence of a word that starts with letter 'L'. Please let me know if I could have made my findInBox method be...
I am trying to implement the Multiple Producer-Consumer problem. I have made the buffer as the lock to maintain consistency of the system. Does this system actually implement multithreading? How can I improve the system using wait and notify? Producer.java import java.util.*; import java.io.*; class Producer extends T...
This function receives an HTMLElement as an argument and returns true if the tag is on the screen and false otherwise. function isTagVisible(tag) { var box; box = tag.getBoundingClientRect(); if (box.left > 0) { if (box.left >= window.innerWidth) { return false; } } if...
I have written a wrapper for Java's Iterator class using Java 7, which is designed to only iterate items that match a certain filter. When the filter is null, all items should be iterated. Filter.java public interface Filter<T> { boolean apply(T type); } FilteredIterator.java import java.util.Iterator; public cla...
I have written a program to evaluate a postfix expression using a stack. I had my stack implementation using a linked list reviewed here, so I am only including the header file here. I have taken the postfix expression in form of a string where the operators and operands are delimited by spaces and have used a sentine...
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Configuration; using System.Data.SqlClient; using System.Data; namespace ExamManagement.DLL { public class SQLDataAccessHelper { string connectionString=string.Empty; public SQLDataAccessHelper()...
Update I've posted a follow up question to this code. Find it here: Not a very interesting implementation of a Simple Substitution Cipher in Python. I implemented a second encryption algorithm: the well known caesar-cipher. This turned out to be longer than I expected. The "main" code is very concise, but the interfac...
See the initial/previous iteration. I have rewritten the script following the answer of @200_success. Now it looks like this: #! /bin/bash # Create a temporary file name for the executable file: TMP_PROGRAM_FILE="$(mktemp programXXXXXX)" # Compile the embedded C program: gcc -o "$TMP_PROGRAM_FILE" -x c - <<- END_OF_...
I have a "Like" button in my iOS app that updates the votes every time it's tapped. Just like Facebook, Instagram, ProductHunt, etc. I have a custom cell where that IBAction and IBOutlet is declared and that's where I'm making the query to the Parse db to update the UI (initially I'm querying the vote values from the ...
I'm trying out different sorting algorithms for learning purposes, here I'm doing a "type-agnostic" bubbleaort. I modeled the function signature after the standard library's qsort. I know the bubblesort algorithm in general is not that fast, but I'm looking for a review in particular about the memory management. In my ...
I'm writing a php library for managing configurations of an application. but the problem is anyone who uses my library will store their configuration files in ./config folder of their project root directory. e.g. var/www/example.com/config/site.php and my library is installed in a sub directory of the project i.e ven...
I am learning Ruby programming from "Learn Ruby the Hard way" and I am doing the "Ruby koans". I have heard a little bit about "Idiomatic" Ruby but I don't know much about it. How can I make it more idiomatic? # Program to solve polynomials def solve(coeff) coefficients = [] coeff.each{ |a| coefficient...
I have to create a batch process which reads data from DB , process it and saves it in db . The batch data is fetched organization wise ( each organization has set of data to be processed) at once.We need to process only specific set of data i.e organization related and save it into db. Hence i have designed below clas...