instruction
stringlengths
71
71.9k
Essentially I'm taking a number of checkboxes off of my view, adding them to a Dictionary<string, bool>, and writing out the Keys of any checkbox that is checked. I'm guessing there must be a better way of doing this. // We need to build a list of what the user would like more information on. // First step is to add a...
I'm looking for ways to improve this code (more readable, less redundant and maybe cleaner/faster). The problem I needed to solve: I was designated to implement a software that is going to validate an 96 column Excel file and if there is no error on it, create an XML file from it. In case there are any error in the exc...
Consider the following reproducible example: # note that lh is a standard ts dataset that ships with R lh # fit an R model ar.mle<-ar(lh,method="mle") # now get the min AIC, this is the relevant line: ar.mle$aic[ar.mle$aic==min(ar.mle$aic)] This works fine and gives back the smallest AIC value and it's index, wh...
How could I improve this code? var to = "http://forum."; if (!RedirectPermanent("http://www.", to)) if (!RedirectPermanent("http://blog.", to)) if (!RedirectPermanent("http://forum.", to)) if (!RedirectPermanent("http://tracker.", to)) if (!RedirectPermanent("http://wiki.", to))...
Please review this connection pool. I tested it and it works but can we improve it from design or performance perspective? public class ConnectionPool { private static final int MAX_SIZE=10; private static final BlockingQueue<Connection> bq; static{ bq= new ArrayBlockingQueue<Connection>(MAX_SIZE)...
I'm working on a Cocoa project that uses OpenGL. I'm trying to keep things easily cross-platformable for later (which is the primary reason for my GL singleton; I hope to implement Linux versions of the IRGL methods that currently use NSOpenGL...). When doing Cocoa & OpenGL stuff, though, I'm never sure that I'm doing ...
Wondering if this is fully in C++, and if not can someone help me tell the differences. This was submitted by me last semester, and received a good grade. I'm currently trying to ensure I can tell C++ and C apart. #include <fstream> #include <stack> #include <stdlib.h> //Not neccessary in C++ #define swap(type, a, b) ...
I'm primarily a C++/Java programmer, but I've recently started using Python at work and decided to write a Lottery Simulator at home. I wrote it to test out different combinations of lottery numbers against a set of winning numbers to calculate how much I would have won (I also run the lotto pool at work). The only m...
I'm working on a small winforms app, the goal of which is to capture data and write to xml. I'm still a child where programming is concerned so could you guys please take a look and suggest changes as I'm pretty sure that this is not a good approach. I'm using a masked-textbox for the invoice number which should only c...
Not long ago I tried to get a game developer job (casual games). There was a task to write a simple game like this one. I was supposed to use an existing game engine (given in the task) and only create a game logic. After writing the solution I got the answer that my code has a bad style and not accepted for the review...
How to write and design a simple (but still proper and secure) login class for PHP? Currently I'm checking whether there is a login request (user entered data into login form) or the session is already existent and contains $_SESSION['authenticated'] == TRUE;. If both checks failed the user is not (properly) logged in....
I have a form and need to be able to highlight/decorate fields as they gain focus (change their background color, border). I'm also decorating their corresponding 'labels'. All works fine where it needs to: FF, Safari, IE 7, 8 and 9 Problem 1 cropped up with IE7 and changing background color of drop down box. There I h...
I'm an iPhone Developer mainly, and I'm very new to web development - especially jQuery. My task: I have three divs, which each contain a short biography about a certain person. (I have three people: liz, chris and michael). Those divs are hidden at the start of my code, because they all belong to the class profile. I...
I am writing a PHP application that works with a MySQL database. As I am fairly new to PHP I am looking for ways to improve my code. Below are two functions, create_ct_query and create_ct_query2. create_ct_query2 is the result of my refactoring create_ct_query. I am fairly happy with it now, but am wondering how it...
I wrote the following code to give an HTML element max width/height in its parent container. I think I address the box model issues but I am wondering if anyone can see issues and or shortcomings. Are there other solutions out there that accomplish this? I want to make sure I didn't re-invent the wheel. function height...
As an exercise in learning bash, I wrote this script designed to automate the process of populating a drive with uncompressed .aiff files copied directly from a CD. It saves me having to do a bunch of separate commands to create subdirectories, check before clobbering, etc. It stores them in this fashion: Root director...
I know that nested namespaces are used in C++ very rarely. But I think it's a nice solution to exclude types from global scope and sometimes it helps to write programs faster when we use things like "IntelliSense" or search for documentation (maybe it's similar for C# developers). I've tried to organize my simple 3D gr...
I have a Sprite class and an AnimatedSprite subclass, and I'd like to decouple these them and maintain substitutability, according to the Liskov Substitution Principle. I find that when dealing with pointers to Sprites I always use GetFrameWidth and GetFrameHeight instead of GetWidth and GetHeightjust in case the point...
I have a basic cache set up. Whenever a user requests a bitmap, it fetches or loads it from disk if it isn't already loaded, significantly reducing load times. Currently, the design explicitly tells the user that they are responsible for freeing the individual bitmaps when they are done. That's fine, but the biggest p...
I needed a mutable priority queue (the priorities can be changed) for my currect project, and started by simply wrapping a class around a std::vector and make/push/pop_heap. However, it is not nearly fast enough, profiling shows ~70% of processing time is spent in the queue. I need some input on how to either fix the q...
We have some developers in house that believe it is best practice to use exception handing as flow control, as well as, thinking that catching and re-throwing exceptions is effective error handling. In an effort to educated, I attempted to come up with a simple sample to demonstrate to them the negative effects of do...
This is the code that I'm using. I'm working on LINQ TO SQL and I'm using this model in my program: How can I model this class in a database The person must have to enter the level, for example 1.2, 1.1.4, etc. The program must check if the level is available or busy. The function ToIntArray is an extension and consis...
I know this is a pretty simple class for loading a config file into an object, and then accessing it's properties. I think config options should be lightweight and a class like this seems to adds a lot of overhead IMO but I really like being able to access the config properties with $config->propertyName. So do you s...
I feel a need to rewrite a rather large Python class that "does its job" but it looks somewhat terrible since it was pasted together while learning Python and the platform Google App Engine. It works so that there are no bugs towards user but readability and structure are poor. This is also the largest class of the who...
I need a version of the mvc RouteValueDictionary that I can chain Add calls to, ie: new RouteValueDictionaryExtended() .AddValue("controller", "Home") .AddValue("action", "Index") .AddValue("id", 3) Is there a more description name I can use for this instead of just "Extended"? public class...
Would a join be quicker here? I tested a join and it's almost the same time! Basically its a ray casting mechanism that finds all properties in a square on GMaps, and then there's a javascript function that finds the point in polygon. So at any time, the records fetched could be in the tens of thousands. The first sta...
I'm looking for a better way to create objects based off of a value of a string. Consider the following: Input file: //each Vehicle type has a list of different options //whose length varies, I provided a simple case van*2006*dodge*grand caravan*green~ car*2010*toyota*corolla*red~ truck*2005*toyota*tundra*black~ Clas...
My page contains: GridView1, GridView2, Button1, Button2, DropDownList1 I bind Gridviews to the table selected in dropdown like this: Dim results as DataTable Select Case ddl1.SelectedValue Case 0 Dim cl as ClassZero = new ClassZero() results = cl.GetClassZeroNames() Case 1 Dim cl as ...
The following code has a lot of conditionals. I am trying to write it in a functional programming way. val basePrice = { var b = 0.0 if (runtime > 120) b += 1.5 if ((day == Sat) || (day == Sun)) b += 1.5 if (!isParquet) b += 2 if (is3D) b += 3 b } I think the following code would be a good...
Currently I have this code: float tileX = (float)rectangle.X / (float)newTileSize; float tileY = (float)rectangle.Y / (float)newTileSize; int xOrigin = (int)Math.Round(tileX) * newTileSize; int yOrigin = (int)Math.Round(tileY) * newTileSize; // Same idea for the next 4 lines float tileWidth = (float)rectangle.Width ...
I'm writing a perl script which reads logs from a file and looks for matches from another file before sending the matches off by email. The problem is, I'm dealing with files which could be changed (a log written to them by syslog) at any time. I discovered that files can be locked in perl, however I'm not sure if it i...
Ruby code below seems to be not so dry. Can you please help me reduce the code. self.value = case self.type when 'fast' Increment.first.max_hours * Incrementor.first.fast_completion_day when 'super_fast' Increment.first.max_hours * Incrementor.first.super_fast_completion_day when 'ludicrous' Increment.first.max_...
I wrote the following function to determine whether a string ends with one of a few given options. I'm sure it can be written more elegantly, probably avoiding the loop. bool EndsWithOneOf(string value, IEnumerable<string> suffixes) { foreach(var suffix in suffixes) { if value.EndsWith(suffix) ...
There are some things I am not sure of from a professional standpoint about the "correct" way to write C++ code. I have been looking through source code produced by various opensource projects, as well as other code posted here and on Stack Overflow. So let's just leave it at this. Let's say I am interviewing for comp...
I am using code like this everywhere. How can I reduce such this code so that my Ruby code looks a lot cleaner? Fabricate(:tl, :when =>Date.yesterday.to_s,:work => 266,:type => "fast" ) Fabricate(:tl, :when =>Date.yesterday.to_s,:work => 100,:type => "super_fast" ) Fabricate(:tl, :when =>Date.yesterday.to_s,:work => 50...
Here is my code, I use it to verify whether an input path is correct or not. I assume that the input path is encoded in UTF8. Is there any way to make it better? #define MAX_PATH_LEN MAX_PATH #define IN #define OUT typedef int Bool_T; static int GetCharsNumInPath( IN const char * path ) { int cnt; int i; ...
I'm investigating some feature for the ScalaDoc tool, which would allow library writers to link to documentation created by third party tools like JavaDoc. My idea is to have some (XML) configuration which specifies which package prefixes belong to which vendor and how to create a valid URL from the the class name, sto...
I have a set of classes that abstract away calls to a set of web services. I have 6 classes in this particular group, 4 of which contain a simple function that, while small, is still duplicated. What happens is that if some exception or business rule violation happens in the service, they package it up as a fault objec...
I was applying for a position, and they asked me to complete a coding problem for them. I did so and submitted it, but I later found out I was rejected from the position. Anyways, I have an eclectic programming background so I'm not sure if my code is grossly wrong or if I just didn't have the best solution out there...
I have been working on a script for almost a month now, which takes in an XML file and uses it to either download or upload files from an ftp site. It also copies the files to a history directory for historical purposes. This thing has to be flawless so any suggestions to make the script more stable, reliable, error fr...
I'd appreciate any and all criticism about this code. I didn't have a particular use case in mind when I wrote it; I just wanted to try implementing linked lists. My comments are not very useful, I think. I'm not a very experienced programmer, so there's probably plenty of things I could improve or fix here. Here is...
I've been trying to learn different patterns of programming, and the "Chain of Responsibility" sort of eludes me. I've been told that my specific code snippet would be a good candidate for chain of responsibility, and I'm wondering if someone could show me how to get there? Public Overrides Sub OnActionExecuting(ByVal...
I have a set of Class methods which is : class << self def increment_value self.first.increment_value end def max_work_hours_per_day self.first.max_work_hours_per_day end def fast_completion_day self.first.fast_completion_day end def super_fast_completion_day self.first.super_fast_completion_day end def lud...
This function checks if a file name is valid or not. I think it's not good enough for integration (not optimized, maybe I forgot about some checks), so need your comments. static int ReservedName( const char * name ) { char * reservedFileNames[] = { "CON", "PRN", "AUX", "NUL", ...
I'm attempting to create a function that will give me a "fish" at random, though a bias random depending on the weight value for the "fish". var FISH = { "level1": [ //["name", xp, weight] ["Shrimp", 10, 95], ["Sardine", 20, 85], ["Herring", 30, 75], ...
I'm coming from a Python background(look at indentation :) ) and trying to learn basics of C++. I wrote a simple prime generator, I know there is better algorithms, but I want advices about coding style, inconsistencies, or better language use. Here is my main.cpp: #include <iostream> #include "PrimeGenerator.h" usin...
I made this sketch in Processing (basically Java) that consists of a bunch of particles moving around a Perlin Noise field. Each particle is aware of the position of one other particle and this creates a rope like effect. The sketch is intended to be aesthetic, like a screensaver, and I in that way it might be difficul...
I was wondering if anyone would be so kind as to look at this code I've written for practice. Tell me what am I doing wrong, where can I optimize, anything. What this code does is (in terminal) draw a bunch of random 1's and 0's, but I added an effect kinda like a lattice. The bulk of this I got help on here. #includ...
if(env['REQUEST_METHOD'] == 'POST') $post = {} post = env['rack.input'].read.split('&') post_split = Array.new post.each{|x| post_split << x.split('=')} post_split.each{|x| $post[x[0]] = x[1] } end What would be a nice way to do this? I have a string like: "a=b&c=d" and i'm trying to get it into a has...
(cn.PublishEnd == null || cn.PublishEnd < DateTime.Now) vs (cn.PublishEnd ?? DateTime.MinValue < DateTime.Now) Which is more readable? I'm inclined towards the second form, but something tells me I'm wrong. Context: namespace Damnation.Website.Main.Business.Extensions { public static class CommunityNews { ...
I need to get this program reviewed. It is counting the lines of code in all files in the given directory. I'm new to python and need some advice on pretty much everything. #!/usr/bin/python import os import sys def CountFile(f): counter = 0 f = open(f, "r") for line in f.read().split('\n'): coun...
I have written this implementation of Huffman coding. Please suggest ways to make this code better, i.e. more Pythonic. from collections import Counter ##################################################################### class Node(object): def __init__(self, pairs, frequency): self.pairs = pairs self.freq...
I've written some code to do the job for me. The final results seems to work fine, but I would like to know if this is how I should Handle classes. And where I can improve or things which are just plain stupid. class CInit { public: CInit(); ~CInit(); void Check(bool); virtual bool Init(); virtual...
Any idea on how to run application continuously? I tried follow suggestions from this link, but to no avail. It might be because of my coding but I don't know how to amend it. Someone suggested that I use Windows Service, but I don't want to use it at this moment because I want to learn basics first like in the above l...
Is there any way to refactor this? objLeadTimeReportResult = (from prop in propList join book in booking on prop.PropertyId equals book.PropertyId into j from book in j.DefaultIfEmpty() group book by new { prop.PropertyId, prop.PropertyName } into groupedLeadTime select new LeadTimeReportRe...
This is from a flex app that is for quizzing. It calls the database for the question and then checks to see if it has been tagged (bookmarked) by a user already. "Question" is a value object and "Tag" is also a value object. I just wanted to post it to see how it could be better. It works fine, but I feel that since I ...
I have 3 objects and 3 models. The note, have many tags, and every tags must have one note. So, I have a note_tag_list to store the tags and notes relationship. The program creates a note, with some tags. First, I create a note object, and put it into the model. And I get back the object from the model. I create the ...
I'm a hobby programmer and have started 2 month ago with C++. I had some knowledge of Python, and I learned it all through Internet tutorials. I'm looking for your help, since I don't have a tutor I would like to have a comment about my programming style. I used this small "library" to create the Snake4D game (see bo...
I've got this working JavaScript (example is [here][1]), which should work the same as on the Stack Exchange network. How can I simplify it a bit? function yellow() { return 'rgb(255, 255, 0)'; } $(function() { $(".post-upvote").click(function() { // ajax(url + "upvote/" + $(this).attr('data-postid'),...
i'm currently writing a generic data access object for the persistent entities I have to handle in my JavaEE application. What this codeReview is about is a findByExample method that is used to find database entries on the basis of a given example object. This may already be implemented for openJPA but I'm bound to ope...
This is my first script in object-oriented JavaScript (jQuery 1.5.2). Its purpose is to simply validate a form (nothing fancy at the moment just checks if any value is present on required fields) and if validation is passed it submits the form via Ajax and alerts the server's response. It would be great if more experie...
Question: What are peoples preferences between the two methods of creating an object (in C# in particular) and setting other fields (that may not be given values during construction)? Are either of them considered best practice? or is it down to the programmer and any styling conventions in place at the company? My pre...
I've been practicing using BSP trees as I hear they are a good start to create procedural spaces such as houses. For ease-of-deployment purposes, I've tested this code in Lua and it seems to work. However, I want to confirm if I did what I needed to do instead of something else. When I am sure this works I will proper...
I'm new to python but not to programming in general. This is my first project beyond the basics. I was wondering if I could get some feedback on the code in general, in particular on any bad Java/C++ habits I might be dragging along. I have some specific questions regarding performance of numpy's array vs. lists. As yo...
I've written this bit of JavaScript to just learn basics of drawing on/interacting with the HTML5 canvas element. Just want to make sure I'm doing things "correctly" in case I have any glaring code gaffs or there's a more efficient way. function start() { canvas = document.getElementById("area"); // initiate bal...
Example 1 if (myList.ContainsKey(myKey)) { myList[myKey]++; } else { myList.Add(myKey,1); } Example 2 Where(x => (myList.ContainsKey(x.Key) ? x.Value - myList[x.Key] : x.Value) > myList is Dictionary. Is there any way or existing method of simplifying or normalizing the code? Update Now I've learned Python ...
This seems like rather too much nesting: using (XmlReader reader = XmlReader.Create(filename)) { while (reader.Read()) { if (reader.IsStartElement()) { switch (reader.Name) { case "Width": map.Width = ParseXMLValue(reader); ...
Running the same test 10,000 times with cProfile tells me that most of the damage happens in the count() function. This is my attempt at a solution to the Quadrant Queries challenge from InterviewStreet (the problem statement can be found here). According to InterviewStreet, I passed 3/11 testcases and I ran out of CP...
I have an abstract class which holds a hook method for a template method. Not all classes which extend this class will need to implement this method (in fact most will not, but a few will). As such I declared the method this way: protected void applyExtraCriteria(Object extraCriteria) { } Should it instead be decla...
I recently discovered/came across linq and have been trying to learn and utilize its features. Here's my first function UpdateTransactionsData(). This method is for a PurchaseDocument class which I have included partially. Basically this function loops through the selected items on the PurchaseDocument, and works out w...
Sometimes, I need to map from a Domain entity to a ViewModel - to display information. Other times, I need to map from a ViewModel to a Domain entity - for persistance of data. Is this kosher or does this code smell? protected void Application_Start() { AreaRegistration.RegisterAllAreas(); MapObjects(); Re...
I've written the following small helper class for use in my WPF applications. It comes up from time to time that I need to display message boxes, or otherwise interact with the UI from a non UI thread. public static class ThreadContext { public static InvokeOnUiThread(Action action) { if (Application.Cu...
Does my code contain anything invalid? <form name="myForm" id="myForm"> <table id="myTab"> <tr> <td> <label for="id">User ID:</label> <input type="text" id="id" /> </td> </tr> <tr> <td> <label for="pass">Pass...
In order to secure my page SESSIONS I have the following pages. My questions are Am I over-reacting with this? Should I place the token in login.php instead of the loginForm.php ? When a user logins, I save his IP in the DB. Should I make use of this in authentication ? Thank you community. Login form loginForm.php ...
I'm currently making a manga (read: comic) viewer in Python. This project has been a code-as-you-learn project, because I have been trying to code this as I learned about Tkinter. Python I have known for some time, but not too long. Performance-wise, I'm worried about the image loading and resizing time; it seems slow....
If you were given the following: #include <cassert> struct vec { float x,y,z; vec(float x, float y, float z) : x(x), y(y), z(z) {} }; int main() { float verts[] = {1,2,3,4,5,6,7,8,9}; // length guaranteed to be a multiple of 3 assert(sizeof(vec) == sizeof(float) * 3); // Option 1 for (int i =...
I was looking for advice, feedback and information on best practices when designing ASP.NET Web Forms in a .NET web application. Allow me to post a sample of how I currently do things. I am omitting the ASPX page as it only has 2 textboxes and a button. PersonEntity validates, loads, and saves in this example. Real-wo...
There's things I know about JavaScript and jQuery, and things I don't. I know that this works, gets and stores what I want so that, when I need to do stuff, I don't have to wait for it. Functionally, I like this. But I'm the only JavaScript guy in my shop, and so I don't see JavaScript I didn't write all that often. I...
My colleague did some code Optimise work. Code below is from a public method of a public class (NOT STATIC CLASS OR METHOD) code before: Bitmap btMap = new Bitmap(Convert.ToInt32(WebConfig.StatsOpenEmailImageWidth), Convert.ToInt32(WebConfig.StatsOpenEmailImageHeight), PixelFormat.Format32bppArgb); ...
I'm developing a log-on page where users either select or create an associated organization when they sign up. There can be either 1 user per organization or many users per organization, this is specified at runtime via web.config. I have a separate project that handles all user account creation. I don't know if thi...
I have a few different classes in my application, but this specific class is the one I'm interested about. Please review for good practices and potential problems. using ExactEarth.Utilities.Jaguar.Properties; using System; using System.Data; using System.Data.SqlClient; using System.IO; public class Downlink { pu...
Profiling shows MoveNext takes most time, which I guess is true as it is lazy. But I don't know in what direction I could improve the code. (Open pic in new tab would allow u see bigger chart.) IEnumerable<string> MixedBlock(List<string> reelLayout, string thisBlock, int length) { List<string> recentBl...
I created this class that connects to Gmail contacts, and enables you to add/edit/delete the contact. I'm curious to see what others think of my code. If you see any areas for improvement, that would be awesome! The contact[] is purely for testing. I also realize that it could be more robust, but for my needs, this ...
This may be a naive question, but what are the dangers of the following code (allocate more memory in the new operator for the info struct)? struct Info { Info():nLineNo(0){memset(cFile, 0, 256);} ~Info(){} char cFile[256]; unsigned int nLineNo; }; void *operator new(size_t Size, const...
I have this JavaScript function which gets prices from a table, adds them up, and outputs the total cost. I want to refactor this to make it as small as possible. function getTotalPrice(do_request) { console.log('Get total price'); var prices_array = new Array(); // Where our prices are held // For each .total_item_...
I'm using this little macro a lot: #define RUN_ONCE(runcode) \ { \ static bool code_ran = 0; \ if(!code_ran){ \ code_ran = 1; \ runcode; \ } \ } I find it useful when I want to initialize stuff just once when I don't really care about performance (for example, if it's inside a render loop,...
This is a page that allow user to do register: <?php echo form_open('user/valid_register_page', 'autocomplete="off"');?> <?php $this->table->set_template(array('table_open'=>'<table class="table_form_register">')); $this->table->add_row(form_label($label_email. form_label(f...
I wrote this program which finds the definite integral of a function. Where in the program could I optimize this code: def trapezium(f,n,a,b): h=(b-a)/float(n) area = (0.5)*h sum_y = (f(0)+f(b)) i=a while i<b: print i sum_y += 2*f(i) i += h area *= sum_y return a...
Imagine a UTF-8 decoder that takes a list of bytes and returns human-readable code points like: > (utf-8->human-readable-code-points '(32 32 195 160 160)) ("u+0020" "u+0020" "u+00E0" ("Error: trailing byte without preceding start byte" 160)) This list builder functionality is meant for that function: ;; a list builde...
For a messenger program I am writing a Server class that will run a non-blocking server in one thread. A messenger thread will use this server thread to communicate with other clients. What the server should do Accept connections from / connect to other instances of the server and associate the selection keys for the ...
So the way I understand this code I wrote, it is thread safe, as long as the retrievers and depositors are thread safe. The only bad state I could see occurring is that a thread is using a retriever as a method local while another thread calls RefreshDependencies(), which would mean the thread with it as a method local...
In this project I've taken my first shot at OO JavaScript, and I'm not sure how it turned out. The script dynamically makes a tooltip with different text if you so choose. As of now it takes a lot to create the tooltip and show it, is there a way to make this smaller? Here is the code at JSFiddle. Let me know if it wou...
FileBro is a basic GUI based File Browser. FileBro Functionality Directory tree - shows the file system roots at start-up, but is otherwise built lazily as the user browses around the file system. FileBro displays a progress bar as it is loading new entries. The file list (a table) displays a list of the directorie...
Is this a good method to optionally run some code on a background thread depending on a configuration setting? This will primarily be called from an ASP.NET front-end (although others are possible) under Framework 3.5. I'm attempting to keep this as DRY as possible. Dim sendEmails = Sub() Dim emai...
I'm seeking review comments (design, performance, etc.) based on the problem statement: Write a CashWithDrawal function from an ATM which based on user specified amount dispenses bank notes. Ensure that the following is taken care of Minimum number of bank notes are dispensed Availability of various denominations...
For practice, I am working through some Google Code Jam problems. The code below is for the Milkshakes problem, which is located here. Problem You own a milkshake shop. There are N different flavors that you can prepare, and each flavor can be prepared "malted" or "unmalted". So, you can make \$2N\$ different typ...
What are your thoughts on using an IDisposable to stripe an HTML table like so? It's a blatant abuse of IDisposable but this allows you to use the counter in a using(){} block which gives you a clear block in the markup. public class StripeCounter : IDisposable { private string cssClass = "stripe"; private int...
Im running a photocontest and making a list of winners with one winner each day. My loop is running very slow. It seams to be the toList() that is time consuming. Any suggestions on how to make it run faster? foreach (var date in dates) { var voteList = _images.Select(image => new ImageWinnerVotes ...
I suspect there is a simpler way to find if a select has a certain option, but don't know what. The objective of the following is to check if the desired option exists or not, and if it does, set it as the selected option: Markup <input type="text" size="2" id="selectVal"/> <button onclick="setSelect()">Set the select<...
I've been trying to implement a fast Huffman decoder in order to encode/decode video. However, I'm barely able to decode a 1080p50 video using my decoder. On the other hand, there are lots of codecs in ffmpeg that entropy decode 4-8 times faster. I have been trying to optimize and profile my code, but I don't think I c...