instruction
stringlengths
71
71.9k
i am trying to learn Trie Data Structure and just implemented it without giving much attention to the code standards , its a raw implementation , can you guys help me to understand whether this implementation make some good progress? Thanks public class TrieNode { public string Word { get; set; } public IList<...
I have written a little bit of code which illustrates DI(dependency injection) and IoC(Inversion of control) container. The point of this exercise is to illustrate the two methods by which you can actieve inversion of control. Please let me know if this code achieves the objective. (That is, if I have illustrated the t...
I'm working on the Rails project where I have many-to-many :through relationship. Each setting has many notifications through email_notification model where the notification can be primary or a secondary. schema.rb create_table "email_notifications", :force => true do |t| t.integer "setting_id" t.integer "notifica...
Having an issue optimising has_many through relationship To quickly introduce I have Setting model and Notification model (that is mainly used as a storage of all notification types). They have through relationship :email_notification, where notification can be specified as primary or secondary. I think I have hardcode...
Yesterday I got a sudden urge to go from writing Python to something, well, more UNIX core-ish. I read some examples on here and decided I might as well put some of that stuff to use to test something else I'm working on: computability theory. Ergo: I wanted to write a basic, one tape, Turing machine simulator. It work...
Is there better way to read from a file and connect all data in one big data than to use generators? At the moment, I do the following: use generators to read data from files. use NumPy to pack all files in 3D array. use pandas to stack it to 2D array so readable for next operations (e.g. plotting). In my example: I ...
Looking for general feedback on this module. remember is property that a user sets via clicking "remember me" when logging in. A token identifies the user - h_token. If localStorage.h_token is set, it is assumed the user has clicked remember me, this is checked at load time. When the remember state is changed manuall...
Is this the right way to do a singleton in Objective-C (coming from an Android background, with a little understanding of threading)? #import "ItemsManager.h" #define kNumMaxSelectableItems 15 @implementation ItemsManager{ NSMutableArray *currentItems; } static ItemsManager *myself; -(id)init{ if(self=[supe...
I am utilizing CodeIgniter's Pagination class to implement pagination in the project. In this project, there are 3 modules: Event, Business and Parts. Each Module has the same "view" for pagination. I have written pagination code for the event module, which has 3 types of pagination depending on the condition (received...
This question is a follow-up to the questions here: Illustrating DI and IoC concepts : Simple code requesting review I have taken the very good review comments got and tweaked the code. These are the classes I define: Dependencies: This namespace holds the interfaces and concrete implementations. CoreClassDI: This cl...
I posted this same question on StackOverflow but guys over there told me to post it here. I have programming in PHP since past 2 years and yet haven't found a perfect script for logging the user in. It's very messy when it comes to deciding whether to use Session or Cookies or both. What value to assign to the Session ...
I'm looking to remove all magic quotes at the start of my PHP script (if they are turned on). The code I'm using to do this is rather simple, so I was wondering if I was overlooking anything: if (get_magic_quotes_gpc()) { foreach ($_GET as $key => $value) $_GET[$key] = stripslashes($value); foreach ($_...
Here is the class: class Field(object): """Class which contains logic of field-processing """ def __init__(self, routes, callback=None, is_iterable=False,default=None): """ Arguments: - `routes`: sequence of xPath routes to the field, in order of descending priority. - `cal...
I have written the following code, I am quite new to C# and Sockets, so perhaps I have made some big mistakes that only more experienced eyes can detect. This is to be used in a Windows Mobile 6.1 device, so I am trying to avoid using many threads. using System; using System.Collections.Generic; using System.Text; usi...
This code is for a spreadsheet that tracks weekly picks for NFL games. Four friends and I pick winners for every NFL game each week. Suppose there are 18 games being played this week; for each game, we all pick a winner, and also a level of confidence in that winner. We rank each game 1 to 18 based on our confidence-- ...
I'm currently using a scientific information management system that employs a RESTful API. I've never used this API with PHP, and I had a hard time finding best practice examples online. After some reading and experimenting, I came up with the following proof-of-concept procedure to retrieve data from the API and then ...
I am looking to submit the following code (adapted to fit into java.util obviously) which significantly improves performance and reduces useless allocations of java.util.UUID. Help me find the bugs and stupidity before I submit myself to the judgment of the JDK maintainers! :-) benchmark instances Bytes n...
I've put together this simple fetcher for text data (which I just copy and pasted from a flight info website) - it takes in text data, and spits out an array of objects containing values for each property of each flight it finds. I thought it would be a good accompaniment exercise to "Eloquent Javascript: Chapter 3, D...
This is my first attempt at trying to write a "monitor" class to determine if a UNC path is available. I need the monitor to not block the main thread and to also event when the UNC is toggled UP/DOWN so that I can respond to that event. I'm looking for: Best practice suggestions Am I doing this properly? Is there a ...
Listening to mseancole's advice in my previous post, I have rewritten the code. function fihHomeIndex() { global $conf, $DBH; if (strtoupper($_SERVER['REQUEST_METHOD']) == 'POST') { $prelim_check_errors = array(); if (@$_POST['ss'] != $_SESSION['shared_secret']) { array_push($prel...
I'm currently attempting to learn OCaml, and I'm working thought the Project Euler problems to do so. Here's some code I knocked together for problem 10. I am looking for idiomatic feedback rather than algorithmic (* The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17. Find the sum of all the primes below two milli...
I have a textView which is displaying a string. I also have an array which keeps track of where every line begins, it stores the "start index" or NSRange.location for every line. However, when text is inserted on one line, the start indexes of every line afterwards change. So I'm doing this: //i = the linenumber of th...
I wrote this code about finding the end of file (EOF). Please review this. #include<stdio.h> #include<conio.h> void main (void) { int x,y,m; for(x=0;x>=0;x++){ m=scanf("%d %d",&x,&y); if (m!=2 || m==EOF){ break; } else printf("/%d/%d/\n",x,y); } if (feof ( stdin )){ printf("End of input\n"); } el...
I have view and it works correct, but very slow class Reading(models.Model): meter = models.ForeignKey(Meter, verbose_name=_('meter')) reading = models.FloatField(verbose_name=_('reading')) code = models.ForeignKey(ReadingCode, verbose_name=_('code')) date = models.DateTimeField(verbose_name=_('date')) ...
I'm wondering if perhaps I am doing this all wrong: Questions: How is my OOP? Is it running multiple methods on a value {i.e.: is strip_tags($copy->truncateString($articles[$i]['body'], 250, " "))} a terrible way to manage resources? Should I create separate methods to use for the following line: echo '<div class="su...
There is no doubt that Knockout.js is a very useful tool, which will save you from a lot of JavaScript (jQuery) binding hassle, which will reduce your team's bug ratio concerning this part. But unfortunately, its JavaScript part gets ugly sooner than you can imagine. The resulting unreadable code is killing me and my ...
My solution to this feels 'icky' and I've got calendar math falling out of my ears after working on similar problems for a week so I can't think straight about this. Is there a better way to code this? import datetime from dateutil.relativedelta import relativedelta def date_count(start, end, day_of_month=1): """...
I always seem to struggle refactoring my code. I can look at any other code and know exactly what is going on, but when it comes to cleaning up my code, I get writers block. The following code works, but I know if can be done much nicer, and with few lines of code. I just wanted to wrap a memcache client to use one se...
Is this code (also available at github with tests, example, and description of algorithms) correct and secure? It follows the recommendations here as far as I can tell. from Crypto.Cipher import AES from Crypto.Hash import SHA256, HMAC from Crypto.Protocol.KDF import PBKDF2 from Crypto.Random.random import getrandbits ...
I'm working on a game in JavaScript and I'm trying to generate rooms in a map. For this example, the map is 32 by 24 (each tile is 32 by 32 pixels). A room is made up of a collection of tiles. A room is always in a square or rectangle shape. For example, 16,16,8,8 would make a room that draws from the top left corne...
I created a function that rewrites file names according to the available space on screen: @{ var index = 0; foreach (var item in Model) { <div class="gallery-item"> <a href="@item.Uri" title="Click to open file" target="_blank" style="display:block; width: 100%;"> var id = "filename_" + ++...
I have following HTML class collector. Is there a better way than []tap for this? def tr_classes(user) classes = [].tap do |c| c << "error" if user.company.nil? c << "disabled" if user.disabled? end if classes.any? " class=\"#{classes.join(" ")}\"" end end <tr<%= tr_classes(user) %>> <td><%= user...
I am wondering if someone can take a look at my lock-free, circular ring implementation which I use to implement a background logger. The CircularRing pre-allocates LoggableEntity elements and stores them in an AtomicReferenceArray. Then, I have multiple producer threads which will enqueue elements and single consumer ...
I have a data structure, containing time span nodes, with the following properties: Nodes are sorted ascending Time spans will not overlap, but may have gaps between them Each node will have a start datetime and a finish datetime The last node's finish may also be null (not finished yet) I want to be able to find the...
I have a file containing lines having this structure : var marker25 = createMarker(point, '<div id="infowindow" style="white-space: nowrap;"><h3>Katz\'s Deli</h3>205 E. Houston Street, Manhattan, New York City,<br />New York, USA<br /><br /> <a href="/When_Harry_Met_Sally/filming_locations"><img style="margin-right: 5...
I am working on a P2P streaming sim (which I think is correct), however I've discovered a huge bottleneck in my code. During the run of my sim, the function I've included below gets called about 25000 times and takes about 560 seconds from a total of about 580 seconds (I used pycallgraph). Can anyone identify any way ...
I'm using this simple plugin to show a simple countdown in my pages, what I would like is to keep it more accurate, cause somentimes it seems it isn't accurate. This is the plugin: /* countdown is a simple jquery plugin for countdowns Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) and...
Here I have 2 email validation regexps, which one is better and why? new RegExp("^[a-zA-Z0-9_-]+@[a-zA-Z0-9-]{2,}[.][a-zA-Z]{2,}$", "i"); new RegExp("^([a-zA-Z0-9._%-]+@[a-zA-Z0-9.-]+.[a-zA-Z]{2,4})*$", "");
Basically, the code looks for certain emoticon characters (like :) or :|) and replace them with an emoji icon. It also does this for emoji keywords like (:blush: or :smirk:). A better explanation is probably on the GitHub repo. What areas of the code should I concentrate on improving, and if possible, how to improve th...
I am trying to solve the following via recursion: In a phone we have each digit mapped to a number. Example: 1 2(ABC) 3(DEF) 4(GHI) 5(JKL) 6(MNO) 7(PRS) 8(TUV) 9(XYZ) * 0 # I need to print out all the possible sequences of a phone number (example: 637-8687). I did the following that...
So I've been working on Tony Morris' Tic-Tac-Toe challenge. The rules are as follows: Write an API for playing tic-tac-toe. There should be no side-effects (or variables), at all, for real. The move function will take a game state, a Position and it will return a data type that you write yourself. The following ...
Here is a link to my project, more details regarding the Diffie Hellman Key Exchange using MODP cyclic grous are available here, no ECP currently implemented https://en.wikipedia.org/wiki/Diffie_hellman I would like to know if I my code could be improved or if the BCMath implementation can pe significantly improved, be...
Service Class # services/search.rb class Search include Rails.application.routes.url_helpers include ActionView::Helpers::TagHelper def initialize(term, app_ids) @term = term @app_ids = app_ids end def results term = @term app_ids = @app_ids multi_search = Tire.multi_search do no...
Trying to see if anyone sees any potential flaws with this submit function. One concern is this line: /* Not sure if this is needed if ($this->session->userdata('failed_logins')) { // User has previous failed logins in session $failed_logins = $this->session->userdata('failed_logins'); } */ /** * submit func...
I'm developing a web application that leverages multiple programming languages. The data flow resembles: Browser » PHP » PL/SQL » XML » XSLT » XHTML + JavaScript » Browser Using different languages makes it tempting to hard-code various constants within the different languages, which encourages inconsistencies. Witho...
This is what i had before (using the MySQL api) $info_get = mysqli_query("SELECT * FROM `users` WHERE `uid`='".$_SESSION['uid']."'") or die(mysqli_error()); $info = mysql_fetch_assoc($info_get); This is after I converted it to MySQLi $var = $_SESSION['uid']; //var is an integet $table = "users" if($stmt = mysqli_p...
Essentially I'm wondering if this implementation of an interface is correct. I mostly don't like having to repeat the exact same getters and setters. Is there a better way or is this alright? using System; using System.Collections.Generic; using System.Linq; using System.Text; using Microsoft.Xna.Framework; namespac...
So, I have coded a PHP script that will make it able for the users to edit their Post, or comments on a site that runs SociaEngine 4. So, Is there anything that could get inproved/fixed on this? <?php session_start(); $Mysql_Hostname = "192.168.1.110"; $Mysql_Username = "*user"; $Mysql_Password = "*****...
I have following queries First one using inner join SELECT item_ID,item_Code,item_Name FROM [Pharmacy].[tblitemHdr] I INNER JOIN EMR.tblFavourites F ON I.item_ID=F.itemID WHERE F.doctorID = @doctorId AND F.favType = 'I' second one using sub query like SELECT item_ID,item_Code,item_Name from [Pharmacy].[tblitemHdr...
Given the following code, I have written a for loop that returns a key and value (0 or 1) of file names passed. 1 means present, and 0 means not present. Is there a way to construct a flat map without having to use into? (defn kind-stat [filename expected-type] (let [f (File. filename) s (cond ...
I've started to learn an OOP and I've built a class called accountactions, and I would like to know if I did a good job writing it. The class is in the file: accountactions.class.php. <?php class accountactions(){ public function register($login, $password, $email){ //Zapisujemy dane wysłane formularzem ...
I wrote this perl script that analizes a text and plot out a bar graph of the word occurrences during the text. Since come mainly from Javascript and PHP, i would like to know how bad is this code and if there is room for improvement and how, any tip will be appreciated! Thanks! #!usr/bin/perl -w use strict; use warni...
For a project I need to give a load of diverseinformation in JSON format. All the information will be used on the same page so a single call would result in the least overhead. The information all concerns the same database object and is all nescessary on the page. It basically is a collection of counts of the amount o...
I am trying to implement Boyer Moore Algorithm for text searching and have come up with this implementation: public class BoyerMooreStringSearching { readonly Dictionary<char, LastIndexTable> _lastIndexTable = new Dictionary<char, LastIndexTable>(); public string PatternToSearch; public List<int> GetStarti...
Given an input string, write a function that returns the Run Length Encoded string for the input string. For example, if the input string is “wwwwaaadexxxxxx”, then the function should return “w4a3d1e1x6″. The following is my implementation: string length_encoding(const string& s) { char c = ' '; int num ...
I have this method that will give a random prime for a given range (min inclusive an max not inclusive) all comments are welcome: public static int randomPrime(int min, int max) { if (min < 0) throw new IllegalArgumentException("min must be positive."); if (min >= max) throw new IllegalArgumentE...
I have written some code which will fetch contents from a resource which is actually stored in a tree format. Since it is in a tree format, there will be a parent-child relation and hence recursion. I am facing lot of performance issue as tree is growing in size this particular piece of code takes up-to 25 sec which is...
I'm working on a 3 columns photo website (responsive), and I'm parsing the img src from XML. I need to prepend HTML code every 3 elements so my photo wall respects my responsive class. I just found a cheap solution, repeating the XML loop (for). Do you have an advice to give me, to do it right, to improve my code? $(do...
This is my first time building anything remotely like a robust database. I'm midway through designing it and I would be grateful if you have suggestions or have found any logical errors. Goal: allow authenticated users to enter data for multiple hospitals. My database has three tables: User, Hospital, and Data. A User ...
I've finally finished my universal query preparation function. Any suggestions on making it better? I feel it could use some tweaking, but am not sure how I would go about it. Variable examples/explanation $db - The database connection $query - Example: $query = "SELECT * FROM users WHEREusername=?" $operation - The o...
I created some code for Minesweeper but I need help going over it. I would like if someone could go over it and point out anything (repeating code, code being called multiple times when not needed, etc). This it the main class that also does a lot of other things: public class BoardBuild extends JFrame implements Actio...
The problem can be viewed here, since it's styled. I don't think I should just copy and paste. I implemented recessive function and dynamic programming to solve it. It can successfully passed UVa Judge with a score of 612ms, but it's not fast enough for this site. Which test my code against 200000 lines of input, and g...
Here is my breadth-first search (bfs) and depth-first search (dfs) code for graph traversal. Please give me some constructive reviews on it. #include<stdio.h> #include<stdlib.h> #define null 0 typedef struct node//node of a linked list { struct vertex* info;//info part of node struct node* next;// next point...
As a Java native, I am always a little worried when doing Objective-C because of memory leaks and pointers flying at my head... All comments are welcome on the Category below. The Category functions are correct. GitHub #import "NSString+r47.h" @implementation NSString (r47) -(NSString *) r47String { const char *_...
I have multiple forms, each of which would like to send message through the network, using my NetworkCommunicator class's SendMessage method. The solution I described here works, however it is ugly, and bludgeons some of the main concepts of OOP paradigm. What I'm looking for (and I'm open to any suggestions) is basica...
Problem Disclaimer: This is my first clojure function & I'm still busy finishing the last chapters of "Programming Clojure". Thanks! :) I am writing a function to randomly flood-fill parts of a game's map (i.e. this is not a traditional flood-fill that can recursively fill all available space). The idea is to create a ...
I'm currently using SciPy's mode function to find the most occurring item in different iterable objects. I like the mode function because it works on every object type I've thrown at it (strings, floats, ints). While this function seems reliable, it is very slow on bigger lists: from scipy.stats import mode li = range...
I am writing a function for a rotating navigation with JS and jQuery. I am using a plugin called jQuery transit for animating rotation. The code works, but it is very long for such a simple function. Is there any way this can be improved? var rotation = 0; $('nav ul li a').bind('click', function() { 'use strict'; var i...
Background: A synchronous grammar is a like two context-free grammars connected in parallel. It is used for translation. For example, here is a small synchronous grammar that can be used for translating between natural language text and semantic representation: == {verb} == * I offer {noun}. / OFFER({...
In chapter 45 of Learn Python the Hard Way, the author basically says: "Ok, go figure out how to make a text based game" Before I get too far in this I just want to be sure I'm not doing anything stupid. The code as it is is fairly functional just not too many rooms. I am running this under Windows: from sys import exi...
Would you have any suggestions improvements for the below functions classes ? Ok here how do i make a registered member login HttpCookie LoginInfo = new HttpCookie("LoginInfo"); LoginInfo.Values["UserName"] = srUserName; LoginInfo.Values["Password"] = srPassword; LoginInfo.Values["selectedLanguage"] = s...
I have a dataframe with several columns. One of them is an user ID column, in this column, I have several ids that can be repeated several times. What I want to do is remove the first ID, for instance: 1,2,3,4,3,4,2,1,3,4,6,7,7 I would like to have an output like this: 3,4,2,1,3,4,7 Where is what I have done: #find f...
This is a polymorphic wrapper capable of holding any type. (It is loosely based on boost::any) In particular, this is useful when you want to store a heterogeneous collection, such as vector<Any>. Synopsis string s = ...; int i = ...; Any a1 = s; Any a2 = i; int j = a2; // ok j now equals i string t = a1; // ok t n...
Write an efficient function to find the first non-repeated character in a string. For example, the first non-repeated character in "total" is 'o' and the first non-repeated character in "teeter" is 'r'. Please see my solution and give me some feedback and suggestions for improving and optimizing it if needed. #in...
I quite often need to implement collection-like classes and - to make using them more comfortable - would like to take advantage of a constructor with variable arguments. The following implementation does not work, though. class FruitsStore { private List<String> availableFruits; public FruitsStore(String... f...
I've been trying to get a relatively optimized version of base64 encoding that works against files. However, I've made several attempts and haven't gotten anything much faster than what I have here. On the posted implementation, I started from what was posted on http://www.swissdelphicenter.ch/torry/showcode.php?id=1...
I am trying to wrap my arms around all the digital files we have, so I thought I would organize all of our pictures and videos into folders named after dates. I'm learning F#, and this felt like a good chance for me to exercise that muscle. Please review the code. I'm open to any criticisms, but I also have some spec...
This question is related to Express under Node.js. Background With Express, you stack up several "middleware" modules to handle a specific HTTP request. app.use(express.logger()); app.use(express.favicon())); app.use(express.cookieParser()); app.use(express.session()); app.use(app.router); When a request comes in, Exp...
I started off with a simple dispatch class, but it's grown and I'm sure it could be simplified in the very least. In fact, I'm doing way too much in the __construct() method It it being called as such: $router = new router($_SERVER['REQUEST_URI'], $database); $router->dispatch(); Yep, I'm pushing my database object i...
Following code helps me to automatically map the query result with Entity properties. For example, result of the following query “ReportTypeCode“ is mapped with Report object’s ReportTypeCode property. SELECT R.report_type_code AS ReportTypeCode FROM Report_Type R QUESTIONS Is there any datatype or scenario that it w...
I'm asking for suggestions on a random accessed vector with allocated elements sorted by its key obtained from its member function. I use it with Qt tree view where the access, add and deletion of tree items is implemented via its index or row number. And I want all the tree items are automatically sorted under a tree ...
I am working on a little browsergame project written in PHP and using PostgreSQL as DBMS. Now I'm not really lucky with the process started after a userlogin was successful. Some info: There are 3 different kinds of properties a game character can have: Attributes Skills Talents Each of these properties is a table i...
I have this code that converts audio to different file formats: import java.io.File; import it.sauronsoftware.jave.AudioAttributes; import it.sauronsoftware.jave.Encoder; import it.sauronsoftware.jave.EncoderException; import it.sauronsoftware.jave.EncodingAttributes; import it.sauronsoftware.jave.InputFormatException;...
Here is the code: https://github.com/EarlGray/haskell-snippets/blob/master/ext2hs/Ext2.hs My problem is that it is quite painful to make large Haskell "records" and deserialize a binary layout with Data.Binary.Get manually like this: instance Binary Superblock where   get = binGetSuperblock binGetSuperblock = do   uin...
I have a list of pointers to objects where some of the objects contain a pointer to another object. When I remove an object in the list which has a linked object I need to remove them BOTH. I also want to position the next iterator at a convenient position which will usually be just after the object in the list which...
The new HTML5 Bones template uses the following example for the main content (I removed some parts (like ARIA, comments, aside, …) not relevant for this question): <!-- The <section> element can be used to enclose content that comes under a related heading. NOTE: The <section> element can contain <article> elements and...
The same view (a layout) used for all pages in Kohana3.3 project. That's why it could be placed in before() method instead of every action. Right? Is there any better way to optimize the code below so you shouldn't use so many $this->? Are there any other improvements of this code so it looks really good? public functi...
This is a little yet unfinished RPG I made with C#. It runs well but I'm wondering if there are things I could improve to make it more clear or optimal. I'm basically asking for some feedback and suggestions. The program is obviously not finished but I'm asking now before I move on so I know if I got some serious desi...
I had this programming exercise of mine where I had to find the shortest path to an exit in an NxM -grid maze in under a second (both N and M would be anywhere between 3 and 1000). The program would be tested with 10 different inputs (mazes), all of which includes a very different amount of exits. The input goes as fol...
This program displays either the time, current temperature, 12hr graph of temps, 24 hr graph of temp or a week's graph of temps. Selection is based on user input of one of the GPIO pins. Please review my code, especially the use of the global variables, indentation and comments. from subprocess import * import matplot...
I am using DataGrid to show storagehouse occupancy (Occupied-Show Image With a box, Not Occupied-Show Empty Image). In DataGrid I am using DataGridTemplateColumn to override the Images. My Main Form XAML Code: <xctk:BusyIndicator Name="ctrlBusy" IsBusy="False" BusyContent="Generating Maps..." > <Grid> <St...
I have a wrapper which interacts with a third party component. In Each function i am performing the operation if it the component is initialized. I have other function to check the errorCode and component initialization check. Is this right way to do this? I am not happy with the readability of this code. Help me imp...
This is my command interface: public interface IConverter { void convert(); } This is my Receiver class: public class Ogg extends Audio{ private File src; private File trgt; public static final String CODEC = "libvorbis"; public static final String FORMAT = "ogg"; public Ogg(File src, File t...
I am working on a sparse matrix application in C and I choose compressed sparse row (CSC) and compressed sparse column (CSC) as my data structure for it. But the difficult part is I cannot improve my matrix multiplication function. /** * The element and matrix are the naive format I have for sparse matrix, * They are...
I have some pretty basic Regex that scans the output of a HTML file (the whole document source) and attempts to extract all of the absolute links that look like images. Whether they are actually images or not isn't too important, as those checks would be made later. I am just trying to see if this Regex looks okay, sin...
public class NANDFunction : FunctionInfo { public override string Name { get { return "NAND"; } } public override int MinArgs { get { return 2; } } public override int MaxArgs { get { return 2; } } public override object Evaluate(object[] args) { bool arg0 = CalcConvert.ToBool(args[0]); ...
I'm developing a desktop app that will scan a user's system for mp3 files and send their whole collection to a website. I'm assuming the best file format for sending this data to a server would be XML -- although correct me if I'm wrong. Can someone kindly comment on whether the formatting of the sample XML file below ...
I need help refactoring this code to dynamically generate a sort string that I can send to my data layer so that my database does the sorting instead of it happening in memory. I am using MVC4 with EF5 as my data layer. public ActionResult InstanceSearch(int? page, string sortOrder, string computerName, string instance...
I would like to know, if my design of this class is good OOP. Should I implement for every hash algorithm a separate class? I'm asking this, because the HashService can be used with a KeyedHashAlgorithm which wouldn't work correctly?! public class HashService : IDisposable { public HashService(HashAlgorithm algorit...
Uint8Array.prototype.indexOfMulti = function(searchElements, fromIndex) { fromIndex = fromIndex || 0; var index = Array.prototype.indexOf.call(this, searchElements[0], fromIndex); if(searchElements.length === 1 || index === -1) { // Not found or no other elements to check return index; ...