instruction
stringlengths
71
95.1k
Here is the database query needed to create the database: create table Area ( AreaId int primary key identity(1,1), Name nvarchar(64) not null ) create table Level ( LevelId int primary key identity(1,1), Name nvarchar(32) not null, Principle nvarchar(512) not null ) create table Subject ( SubjectId int primary key i...
I am creating a form class for validating form data, and would like some advice on how to refactor it for best practices. Keep in mind that this is a rough draft. Basically, there is a form abstract class (lev_form), which you would extend. In the extended classes, you would write a __construct method that creates all ...
Exercise 1.31 a. The sum procedure is only the simplest of a vast number of similar abstractions that can be captured as higher-order procedures.51 Write an analogous procedure called product that returns the product of the values of a function at points over a given range. Show how to define factoria...
Given the following recursive definition of sum: (define (sum term a next b) (if (> a b) 0 (+ (term a) (sum term (next a) next b)))) And the task: Exercise 1.30 The sum procedure above generates a linear recursion. The procedure can be rewritten so that the sum is performed iteratively...
As an answer to this problem: Exercise 1.29 Simpson's Rule is a more accurate method of numerical integration than the method illustrated above. Using Simpson's Rule, the integral of a function f between a and b is approximated as (h / 3) * (y_0 + 4y_1 + 2y_2 + 4y_3 + 2y_4 + ... + 2y_(n-2) + 4y_(n-1) + y_...
Given this task: Exercise 1.32 a. Show that sum and product (exercise 1.31) are both special cases of a still more general notion called accumulate that combines a collection of terms, using some general accumulation function: (accumulate combiner null-value term a next b) Accumulate takes as arguments the...
Given the following task: Exercise 1.33 You can obtain an even more general version of accumulate (exercise 1.32) by introducing the notion of a filter on the terms to be combined. That is, combine only those terms derived from values in the range that satisfy a specified condition. The resulting filtere...
Some days ago I made you a question and I got some really useful answers. I will make a summary to those of you who didn't read and I will explain my new doubts and where I have problems now. Explanation I have been working on a program, simulating a small database, that first of all read information from txt files and...
I'm working with the following code which adjusts an int based on multiple elements of an integer array. I am wondering if there's a cleaner, easier-to-read construct for this: int Blue = 0; int[] Adjustments = new int[24]; // ... populate Adjustments if (Adjustments[0] == 255) Blue = 128; else if (Adjustments[0] ...
I have a simplified model that looks like this: class Player < ActiveRecord::Base has_many :picks def pick_for_game(game) id = game.instance_of?(Game) ? game.id : game pick = picks.find {|pick| pick.game_id == id} if !pick pick = picks.build(:game_id => id) end pick end end The pick_fo...
This function will read an expression (made up of tokens) from the vector of tokens passed into it. It will remove the tokens that make up the expression from the vector and return them. A token is added to the expression if it is the first token it has an operator before it Brackets are handled in parseBracketTokens...
I'm a little unsure as to what code belongs in the services and what belongs in the controllers. Lets say I'm creating a website that requires a fine grained level of permissions (e.g. a user has permissions based on their user level (if they're currently logged in) determining whether they can view, edit, add entities...
Given the following exercise: Exercise 1.37. a. An infinite continued fraction is an expression of the form As an example, one can show that the infinite continued fraction expansion with the Ni and the Di all equal to 1 produces 1/, where is the golden ratio (described in section 1.2.2). One way to ap...
Given the following task: Exercise 1.38. In 1737, the Swiss mathematician Leonhard Euler published a memoir De Fractionibus Continuis, which included a continued fraction expansion for e - 2, where e is the base of the natural logarithms. In this fraction, the Ni are all 1, and the Di are successively 1...
There are two aspects to this question that are inter-related. Change I've made to the trie module in python (PyPI, GitHub) to make it serialisable (and deserialisable). The change I made is visible on GitHub. I added two functions to the Node class used in serialisation. def __getstate__(self): return (self.pare...
I'm creating a gradebook. Many students earn a grade in many standards each. I'm hoping to get help analyzing the code below for efficient use of asynchronous result fetching. ofy is an Objectify object, which is basically just a convenience wrapper over the async fetching capabilities of AppEngine. public List<Stand...
I've been working on a Stack Overflow like pager for my personal use and I've gotten everything working pretty good. Some of my logic is a bit suspect though, especially the logic in the Pager class itself. I thought I'd try posting this code on here just to see what sort of responses I got. I included my test cases...
I had this as an interview question, and the interviewer pointed this out. Here's what I wrote: //C# Syntax here public string Reverse(string s) { char[] arr = s.ToCharArray(); int idx = 0; int endIdx = s.Length - 1; for(; idx < endIdx; ++idx, --endIdx) { char temp = arr[idx]; arr[id...
I want to write my own version of HttpUtility.ParseQueryString, because it is not included in the .NET Framework Client Profile. My code is pretty straightforward and simple, but I'm looking at the code of HttpUtility.ParseQueryString with Reflector, and is about 200 lines including the code of the called methods. I d...
Given the following task from SICP Exercise 2.1 Define a better version of make-rat that handles both positive and negative arguments. Make-rat should normalize the sign so that if the rational number is positive, both the numerator and denominator are positive, and if the rational number is negative, on...
From SICP: Exercise 2.2 Consider the problem of representing line segments in a plane. Each segment is represented as a pair of points: a starting point and an ending point. Define a constructor make-segment and selectors start-segment and end-segment that define the representation of segments in terms...
I had a job to remove all kinds of comments from the Lua file. I tried to find a usable Python script to this on the net, but Google did not help. Therefore, I made one. This script recognizes all types of comments such as single and multi-Line comments. I would welcome your opinion. # written in Python 3.2 import c...
I am new to using classes heavily, and was wondering if going so far as to create a class specifically for templates was going to far. Here is a simplified version of my class template. Yes, I know I the use of unset is not necessary, but I like it there so don't give me any grief for it. class template{ private $t...
In response to the SO question C: f>0 vs Perl: $f>0?, the use of overflow to terminate the loop is referred to as "poor programming practice". Paraphrased: Your c code is actually exiting because of poor programming practice. You're relying on fib being a long long int, which has an upper limit of 9.22337204 ×...
I am hoping the code is readable as is. I can probably just print the XML using streams but I have other reasons for using the library. Please offer any inputs on how to improve program design/structure. The header file #ifndef GEN_XML #define GEN_XML #include <iostream> #include <fstream> #include <string> #include ...
I am trying to cycle through a few of these blocks. They basically narrow down a number of people that fulfill a bunch of attributes. I apologize if this seems really messy, but my database is really taking a toll processing this, and I know there's a better way. I'm just lost on strategy right now. def count_of_distri...
Having fancy animations in WPF is quite nice so I tried to implement a generic fading animation for UIElements which I use for the Popups in my application. I was wondering if there was anything wrong with it, and thought about posting it here yesterday. There were indeed many things wrong at that time and I have impro...
I don't really have any specific questions for this thread. I have been working on an independent project recently and have been learning everything from the web. Just yesterday I became aware of templating and the idea of separating business and presentational logic. I would be very thankful for any comments regarding...
You may see full code here (note that the link points to the specific commit). Language is "clean C" (that is, a subset of C89, C99 and C++98 — it is intended to compile under all of these standards). The code must be portable between x86 and x86_64. UTF-8 handling implemented based on information here and tested with ...
I've had a go at writing something that generates a random maze using disjoint sets using the grouping class I found here. The way I'm generating the maze is by generating all the cells, with each cell having a wall to the right of it and beneath it. Each wall can either be active or not. I pick wall at random and look...
I'm currently working on a project where I am trying to predict a presidential election based on the population density and region of a voter. I wrote a few MATLAB functions to parse the data, but it takes about a minute to run, which seems long. My languages of choice are usually Java or Python and I feel like this c...
Given the following exercise: Exercise 2.5 Show that we can represent pairs of nonnegative integers using only numbers and arithmetic operations if we represent the pair a and b as the integer that is the product 2^a * 3^b. Give the corresponding definitions of the procedures cons, car, and cdr. I wrote...
Given the following exercise: Exercise 2.6 In case representing pairs as procedures wasn't mind-boggling enough, consider that, in a language that can manipulate procedures, we can get by without numbers (at least insofar as nonnegative integers are concerned) by implementing 0 and the operation of add...
From the Extended Exercise beginning in section 2.1.4, you can find exercise 2.8: Exercise 2.8. Using reasoning analogous to Alyssa's, describe how the difference of two intervals may be computed. Define a corresponding subtraction procedure, called sub-interval. I wrote the following: (define (sub-interva...
From 2.11 Exercise 2.11. In passing, Ben also cryptically comments: ``By testing the signs of the endpoints of the intervals, it is possible to break mul-interval into nine cases, only one of which requires more than two multiplications.'' Rewrite this procedure using Ben's suggestion. I wrote the foll...
Since I did not get a satisfactory answer here (and I really needed to get it going on this weekend), I decided to implement my own Fisher–Yates shuffle, porting the code I found in other SO posts. I know my programming technique is far from optimal, so I decided to post this here. What do you think? Can it be improved...
I've just tried to do some code for TreeMap. The TreeMap concept can be found here. As an exercise I've tried to find the solution without reading the article. Then, I came across this code. The main problem is that I missed the algorithm, my code is not so simple, elegant, short and clean. And I used OOP because I did...
SICP exercise 2.18 asks the following: Exercise 2.18. Define a procedure reverse that takes a list as argument and returns a list of the same elements in reverse order: (reverse (list 1 4 9 16 25)) (25 16 9 4 1) I wrote this iterative function: (define (reverse n) (define (iter a b) (if (null? a) b ...
Exercise 2.20 The procedures +, *, and list take arbitrary numbers of arguments. One way to define such procedures is to use define with dotted-tail notation. In a procedure definition, a parameter list that has a dot before the last parameter name indicates that, when the procedure is called, the init...
Exercise 2.23 The procedure for-each is similar to map. It takes as arguments a procedure and a list of elements. However, rather than forming a list of the results, for-each just applies the procedure to each of the elements in turn, from left to right. The values returned by applying the procedure to...
I don't see any way to refactor this, but something tells me I'm missing something. if val.instance_of?(Hash) then @fields.has_key?(key) ? @fields[key].merge!(val) : @fields.merge!({key => val}) elsif val.instance_of?(Array) then @fields.has_key?(key) ? @fields[key].push(val) : @fields.merge!({key => Array.new....
I have a list of map entries, and I need an iterable that returns the keys. Of course, we could be naive and copy over into a new collection of the desired type, but that's inefficient. So let's see if we can provide a view of the existing structure using generics. Yes, I was able to do that, but it's not perfect: i...
I'm changing code that writes data to a DB, so I have a dump (a text file) of an earlier run to compare against, to ensure that my changes don't screw things up. Here goes: def dbcheck(cursor): dbresult = list() cursor.execute("SELECT COLUMN FROM TABLE") for item in cursor.fetchall(): line = item[0]...
I was wondering if my code will produce a true singleton. I am creating an Android app, and all activities should access my API through one instance of the SyncApi class. public class Api { private static SyncApi api = null; static { synchronized (api) { if (api == null) { ...
Is there a better way of doing this? File.open( "/etc/my.cnf" ) do |f| f.grep( /^testdir/ ) do |line| test1 = line.chop.gsub(/ /,"") test2 = test1.sub(/.*=/, "") RETURN_PATH = "#{test2}/test_ups" end end
Which one of the following is preferrable and why when writing C macro? Type 1 #define I2C_START() I2C_WAIT_IDLE(); SSP1CON2bits.SEN = 1 Type 2 #define I2C_START() \ do \ { \ I2C_WAIT_IDLE(); \ SSP1CO...
I've written the code below to do some work on machine learning in R. I'm not overly happy with some bits of it, and I suspect I could improve it quite a bit. Bits I'm specifically interested in looking at are how to deal with appending to vectors in the loop, and whether I can combine all of the functions kf.knn, kf.s...
Of course the recursive version is trivial: hanoi n = solve n 1 2 3 solve 0 _ _ _ = [] solve n from help to = (solve (n-1) from to help) ++ [(from,to)] ++ (solve (n-1) help from to) However my iterative version looks terrible with a lot of code repetition: hanoi n = map rep $ solve [1..n] [] [] where rep (x...
An anagram is like a mix-up of the letters in a string: pots is an anagram of stop Wilma is an anagram of ilWma I am going through the book Cracking the Coding Interview and in the basic string manipulation there's the problem: write a method to check if two strings are anagrams of each other. My method uses Str...
Motivating SO question: Is there a C++/CLI smart pointer project (e.g. scoped_ptr)? I'm interested in any reviewer comments, and especially identified bugs or inconsistencies with the native scoped_ptr template after which this code is patterned. #pragma once /** @file clr_scoped_ptr.h ** @author R Benjamin Voigt (ri...
With just a brief look over I can think of a large amount of changes that would improve the clarity but I would love to see how someone else would refactor this mess. Spec Code static Func<string, RegExpParser.MatchState, string> MakeReplacer(string format) { var tokens = new Regex(@"[^\$]*(\$[\$&`']|\...
Exercise 2.27 Modify your reverse procedure of exercise 2.18 to produce a deep-reverse procedure that takes a list as argument and returns as its value the list with its elements reversed and with all sublists deep-reversed as well. For example, (define x (list (list 1 2) (list 3 4))) x ((1 2) (3 4)) (re...
I want to get distinct of two columns from an SQL table. Can I optimize this query? create TABLE #Temporary_tbl ( ProductColour VARCHAR(50), ProductSize VARCHAR(20), ) insert into #Temporary_tbl (ProductColour) select distinct productcolour from shoptransfer insert into #Temporar...
Because I don't like using \ to break long lines (to comply with PEP8), I tend to do something like this: message = "There are {} seconds in {} hours." message = message.format(nhours*3600, nhours) print(message) It also makes code cleaner. Is this an okay way of doing things?
I wrote this interpreter a little while ago and was hoping I could get some comments/criticisms. It it somewhat similar to the "languages as libraries" concept of Racket, though obviously with less features. Another goal was to see how little I could implement and still have a usable language. I chose to implement a ...
I'm only asking because almost the entire code base I've inherited here, in C# and PHP, looks like this: if (varOne == flag) { run_some_sql(); set_some_flag = true; } if (varTwo == flag) { run_some_sql(); set_some_flag = true; } if (varThree == flag) { run_some_sql(); set_some_flag = true; } ...
I am looking for a suggestion or advises about some code I have written. I build an online application about 3 month ago the app registers new buildings including description names and so on. The app works perfectly and does what it suppose to. While working on it I was constantly learning and improving my skills. I d...
I have written some survey functionality for a project. Basically, a generic survey form that can be composed of sections and questions. I have a Survey class, Questions and Sections. The Survey is basically a tree, where each node can be a Question or a Section. Nodes have children -- so essentially Question can ha...
Define a procedure square-tree analogous to the square-list procedure of exercise 2.21. That is, square-list should behave as follows: (square-tree (list 1 (list 2 (list 3 4) 5) (list 6 7))) (1 (4 (9 16) 25) (36 49)) Define square-tree both directly (i.e., without using any higher-order proce...
Exercise 2.31. Abstract your answer to exercise 2.30 to produce a procedure tree-map with the property that square-tree could be defined as (define (square-tree tree) (tree-map square tree)) I wrote the following solution: (define (square x) (* x x)) (define (tree-map f tree) (cond ((null? tree) null) ...
EDIT: My code DOES not work, see https://gis.stackexchange.com/questions/294380/if-rectangle-corner-points-have-same-nearest-neighbor-does-whole-interior Given 5 (currently hardcoded) cities, this code uses Google Maps to split the world into 5 regions, each region being the points closer to a given city than to the ot...
I need to figure out the best way to deal with memory pre-allocation Below is pseudo-code for what I am doing now, and it seems to be working fine. I am sure there is a better way to do this, I would like to see if anyone has any good idea. In Thread A I need to allocate 300 MB of memory and zero it out: Thread A: char...
Given a Binary Search Tree, determine its k-th element in inorder traversal. Here's my node structure: struct node { int elem; node *left, *right; static node* create(int elem) { node *newnode = new node; newnode->elem = elem; newnode->left = newnode->right = NULL; ...
I have written the following tiny extension method to help me when I'm working with sequences in which I have to find a pattern. public static IEnumerable<T[]> SearchPattern<T>(this IEnumerable<T> seq, params Func<T[], T, bool>[] matches) { Contract.Requires(seq != null); Contract.Requires(matches != null);...
Lately I seem to run into a situation very frequently where I want to write something like the following: var x = condition1 ? value1 : condition2 ? value2 : condition3 ? value3 : condition4 ? value4 : throw new InvalidOperationException(); Suppose the conditions are not simply constants so I can’t...
I don't want anything to execute if any preceding step fails: #!/bin/sh file="v0.9" renamed=$file".tar.gz" dir="utils/external/firepython/" location="https://github.com/darwin/firepython/tarball/$file" wget --no-check-certificate $location --output-document=$renamed && \ mkdir -p $dir && \ gunzip $renamed && \ echo "...
I have been trying to wrap my head around MVVM for the last week or more and still struggling a bit. I have watched Jason Dolingers MVVM video and gone through Reed Copsey lessons and still find myself wondering if i am doing this right... I found both sources very interesting yet a bit different on the approach. If...
I'm trying to figure out how to do this more dynamically. Right now I save each and every form field individually/manually. I would love to maybe have some kind of master form list that I could loop through. I'm fairly new to C#, so I don't know many tricks yet. Please let me know what you think. Here is my simplified ...
At work I am developing an application using hand-coded Swing, and I've found that I have an easier time reading, writing, and maintaining hierarchical component creation using code blocks like: JPanel mainPanel = new JPanel(new BorderLayout()); { JLabel centerLabel = new JLabel(); centerLabel.s...
Exercise 2.35. Redefine count-leaves from section 2.2.2 as an accumulation: (define (count-leaves t) (accumulate <??> <??> (map <??> <??>))) I wrote the following: (define (accumulate op initial sequence) (if (null? sequence) initial (op (car sequence) (accumulate op initial (cdr sequence)))...
I have written a cart Class, it use session to store data. Is the code well implemented or could been better? You can rewrite my code if you can. Each item have a number of options with price Each Option can have many extras or without extras For example: Item 1 -> (Option ID 1) Item 2 -> (Option ID 3, Option ID 4) Op...
I am trying to use HibernateCompositeUser type to handle i18n specific data in my application. I am trying to use the below approach. I have a table named master table which contains all locale independent data, while I have created another table master_translation which contains all locale sensitive information. Maste...
UPDATE: I didn't write the library pasted below I just make use of it. I'm unable to paste the part I wrote here because the message exceeds 30k characters when I try to do so. I have been working on my webapp and this a simple came into life as I needed to scratch my own itch. It basically enables you to store models...
Exercise 2.37. Suppose we represent vectors v = (vi) as sequences of numbers, and matrices m = (mij) as sequences of vectors (the rows of the matrix). For example, the matrix is represented as the sequence ((1 2 3 4) (4 5 6 6) (6 7 8 9)). With this representation, we can use sequence operations to co...
Exercise 2.39 Complete the following definitions of reverse (exercise 2.18) in terms of fold-right and fold-left from exercise 2.38: (define (reverse sequence) (fold-right (lambda (x y) <??>) nil sequence)) (define (reverse sequence) (fold-left (lambda (x y) <??>) nil sequence)) I wrote this answer: (define ...
I'm new to rails and have built a multi-model form. It's working, but some of the code doesn't feel right. The model code is below. I'm using Devise for my user authentication: # models/signup.rb class Signup < ActiveRecord::Base has_one :company accepts_nested_attributes_for :company end # models/company.rb class...
This is an intersection-detection algorithm I developed as an alternative method to the one developed for my coursework. I won't post some of the other functions as they are used in the coursework too, feel free to ask if their names aren't self explanatory. This function simply returns whether 2 bcw objects are inters...
This is a small extension based on a boost::property_tree, which supports arbitrary values for the properties and appropriate serialization. It can be used as an alternative to QSettings in Qt and provides very convenient way to pass properties inside your applications. I would like to have a code review from somebody...
function reformat($data, $registration = false) { // Initializing aircompanies codes $iata = new iata; for ($i = 0; $i < count($data); $i = $i + 6) { if ($registration) { $r = str_replace('<nobr>', '', $this->prep_value($data[$i])); $block[$i]['reis'] = str_replace('</nobr>',...
So, here's my code: public class NList : SExp, IEnumerable<Object> { private Object _car; private NList _cdr; IEnumerator<Object> IEnumerable<Object>.GetEnumerator() { return new NListEnumerator(this); } IEnumerator IEnumerable.GetEnumerator() { return new NListEnumerator(t...
I'm trying to speed up the following code for summing doubles with full precision, based on a Python recipe from Raymond Hettinger. Any thoughts on how to make this go faster? -- Full precision summation based on http://code.activestate.com/recipes/393090/ msum :: [Double] -> Double msum [] = 0 msum (x:xs) = sum $ fol...
NOTE: My implementation is based on codeproject article by Vladislav Gelfer. Based on valdok's codes, I rewrote the critical section class. The difference is that my implementation integrated recursive(reentrantable) locking feature into a single critical section class. (FYI, valdok provides 2 classes: one without recu...
Does this code look OK? public Map<String, String> getById(long id) { String sql = "select * from " + this._TABLE_NAME + " where id = ?"; PreparedStatement p; Map<String, String> result = new HashMap<String, String>(); try { p = conn.prepareStatement(sql); p.setLong(1, id); Resul...
From the section called Nested Mappings Exercise 2.40 Define a procedure unique-pairs that, given an integer n, generates the sequence of pairs (i,j) with 1 < j < i < n. Use unique-pairs to simplify the definition of prime-sum-pairs given above. I wrote the following: (define (prime-sum-pairs n) (filter (...
How can I write this code better? $cookieUrl = 'https://-------------/ps/scc/login.php'; $sessionUrl = 'https://-------------/ps/scc/php/check.php'; $balanceUrl = 'https://-------------/SCWWW/ACCOUNT_INFO'; $vars = "LOGIN={$this->login}&PASSWORD={$this->password}"; $response = $this->_sendPostRequest($cookieUrl, '', nu...
Exercise 2.41. Write a procedure to find all ordered triples of distinct positive integers i, j, and k less than or equal to a given integer n that sum to a given integer s. (define (enumerate-integers i j) (if (= i j) (list j) (cons i (enumerate-integers (+ i 1) j)))) (define (filter f seq) ...
I use VS 2008 and .NET 3.5 I have this code using CustomChannelFactory and Proxy ServiceReference. I would like refactor using lambdas, Action, ... any suggestions ? ServiceDependencias.IDependencias svcDependencias = null; public void Dependencias(List<MfaFicheroForm> listaFicherosFormXML, string entorno) { Custo...
This might be a bit silly because there are like a thousand ways to do this, but I'm struggling to come up with one that I like. I feel like this should fit in one line, but I don't like re-using read_attribute(:length) lots and I don't like the below because it's not that clear. # returns a human-readable string in th...
I could use the function Intersection, but it returns a sorted list. That's why I have to do my own, but it looks too big. I hope it could be done shorter. lists = {{1, 2, 3, 4, 5}, {1, 2, 3, 4}, {2, 3, 4, 5}}; Fold[ Function[ {a, b}, Select[b, MemberQ[a, #] &] ], lists // First, lists // Rest]
public final class Descriptors { public static final EnumValueDescriptor TIME_SETTING = new EnumValueDescriptor( R.string.pref_label_time_setting, Measures.TIME_SETTING_12, R.string.pref_time_setting_12, Measures.TIME_SETTING_24, R.string.pref_time_setting_24); public static fi...
In the similar vein as ToIEnumerable and FromSingleItem Is this a good improvement for making lists on the fly? SyntaxSugar.ToIEnumerable("test1","test2","test3"); vs. new []{"test1","test2","test3"}; Code: public static class SyntaxSugar { public static IEnumerable<T> ToIEnumerable<T>(params T[] items) { ...
I've written a backup script to make a backup of the latest modified files in 12 hours. Basically, it searches two directories for modified files (statically coded) then the find command is used to find the related files. A log file is then created to keep a list of the files. Later on, they are used to form a list of ...
I present you my first ever module to learn some Erlang awaiting your scrutiny . It does a word frequency count using map/reduce . I'm an Erlang noob, so I would very much like feedback about: Unneeded verbosity / code Erlang 'style' mistakes Things that can be done more elegantly -module(main). -export([map/1]). -exp...
I have a method that gets an RSS feed using LINQ to XML and returns a collection of an object that grabs only the data I need. There's really only one other method in the class I'm concerned about that you'll see in the sample -- RemoveUrlNoise. How do I test a method like this or change it to be more testable? pub...
Figure 2.8: A solution to the eight-queens puzzle. The ``eight-queens puzzle'' asks how to place eight queens on a chessboard so that no queen is in check from any other (i.e., no two queens are in the same row, column, or diagonal). One possible solution is shown in figure 2.8. One way to solve the ...
Here's an interesting scenario that I encountered the other day. I did eventually reach a solution on my own. However, I'd welcome any comments and better approaches. The requirements I want to generate JAXB objects based on a collection of XSDs using XJC as part of a Maven build. I'll be using JAXB-RI 2.1 as the imple...
It seems to play up sometimes and I'm not sure if this is due to the class itself or the way I'm using it. Can someone confirm that this is a 'good' implementation of a VertexArrayObject class? //The following code is public domain public class VertexArray : GraphicsResource { protected readonly int ID; DrawMo...
I am quite new to Java and was trying to improve my skills a little by doing a binary file reader. The choosen one was the TLV format. I've chosen that one for being reasonably simple, but not so simple. Also I had some concrete examples with good documentation which I could follow for decoding. The reader works, but I...
var studentRepo = new StudentRepository(); int gradeParaleloId = Convert.ToInt32(cmbGradeParalelo.SelectedValue); var students = studentRepo.FindAllStudentsFromGradeParalelo(gradeParaleloId); int year = DateTime.Now.Year; int month = Convert.ToInt32(cmbMes.SelectedIndex) + 1; AttendanceRepository attendanceRepo = new ...
From SICP 2.2.4: The textbook has already defined a function (right-split ...) as follows: (define (right-split painter n) (if (= n 0) painter (let ((smaller (right-split painter (- n 1)))) (beside painter (below smaller smaller))))) and they have indicated that there exists a procedure (up-spl...