Skip to main content

Posts

Showing posts from 2014

Inexpensive, Non-realtime Sites using Queues

A lot of the sites for small and medium businesses rely on dynamic engines (such as ASP.NET, PHP, etc) to generate most of the content at run-time. This kind of typical setup requires expensive hosting (relative to a small and medium size company) and (if not designed properly) may not perform very well. I would like to argue that most of those sites could be served with static HTML pages generated offline at different time intervals (either fixed or on-demand intervals, discussed later) and a Javascript Client front end that communicates with a slim server side service whose only job is to store commands from visitors into a queue. The queue can then be read and processed by non-hosted computers, freeing the business from having to pay extra hosting fees for application server. The costs are reduced by the following: Static HTML sites mean less power required. Queue storages are usually cheaper services than full SQL Databases. A slim service that just relays the commands fr...

R Cookbook

The R Cookbook by  Paul Teetor ( O'Reilly Media) aims and succeeds in introducing programmers to the technical aspects of the R language. R is a programming language designed for Statistical work, therefore it might not share too much ground with other typical languages like Python or C. The R Cookbook gives a tour to programmers to this wonderful language, from the very screen output beginnings, through ploting, to the creation of statistical models and Time Series. The author does a great job exposing the differences and similarities of R to other languages. For example, the author, explains how in R the single brackets applied to a vector (myvector[1]) mean "give me a vector of one item from myvector", he then explains that the correct way to get a single item is myvector[1]. Comparisons to other languages like SQL are dispersed through the chapters. Mr. Teetor provides a throughout explanation of other aspects of R that might not be common in other computer lang...

List to ICollection AutoMapper and WebAPI problem

I was getting an exception from Automapper when it tried to map a List to an ICollection . The problem was that WebApi was building the MyClass from the xml sent by the client and instead of using a List for the ICollection property, it used a plain array. When Automapper tried to map the List to the Array, it failed because even though Arrays are ICollections, they do not support some of the ICollection operations, such as Add.  To solve the problem, I used Json in the client side when posting. After that, webapi chose to use List instead of an Array when the data came as Json.

Cryptic message when serializing Computed Observable to JSON

If you have an error in one of your computed observable in Knockout.js, the toJson function will set the value of that property to a cryptic script snipped when serializing it to JSON. For example: var SortField = function (expression) { this .FieldDef = ko.observable( null ); this .SortOrder = ko.observable( "" ); this .ExpressionType = "SortField" ; this .Label = ko.computed( function () { return this . FieldDef () == null ? "" : this . FieldDef ().Label + ' ' + this .SortOrder(); }, this ); } var FieldDefinition = function (table_name, field_name, table_alias) { this .TableName = table_name; this .TableAlias = ko.observable(table_alias); this .FieldName = field_name; this .Label = ko.computed( function () { return this .TableAlias() + '⇨' + field_name; }, this ); In this example SortField’s Label function ...

Compile Postgres in Windows with GSSAPI

Configuration Phase Install the 64 bit versions of OpenSSL and MIT Kerberos Get the professional version of Visual Studio 2010 or 2012. Open the 64Bit of the Visual Studio Command Prompt (not the 32 bit version) cd to src\tools\msvc in the folder that contains Postgres’ source code Change the config_default.pl: add these lines: includes => 'C:\\Program Files\\MIT\\Kerberos\\include:C:\\OpenSSL-Win64\\include', libraries => 'C:\\Program Files\\MIT\\Kerberos\\lib\\amd64:C:\\OpenSSL-Win64\\lib', after  “iconv   => undef,” change the krb5 and ssl lines to: krb5    => 'C:\\Program Files (x86)\\MIT\\Kerberos',    # --with-krb5= openssl => 'C:\\OpenSSL-Win64',    # --with-ssl= Build Phase in the vs command prompt, type Build When done, if no errors, then type Install C:\PathWhereYouWanToInstallPostgres Go to the folder where OpenSSL is installed Search in the folder and subfolders for libeay32 and ssleay.dll a...