Contents

274 Articles
13 Comments

Search

15 years Ago

Entity Framework: Be Prepared

Published by marco on

This article was originally published on the Encodo Blogs. Browse on over to see more!


In August of 2008, Microsoft released the first service pack (SP1) for Visual Studio 2008. It included the first version (1.0) of Microsoft’s generalized ORM, the Entity Framework. We at Encodo were quite interested as we’ve had a lot of experience with ORMs, having worked on several of them over the years. The first was a framework written in Delphi Pascal that included a sophisticated ORM with support... [More]

Mercurial, Python & Debian

Published by marco on

After nearly a decade of using Perforce for my private source control, I’d decided to switch to Mercurial. Mercurial is a distributed version control system and open-source and all kinds of awesome and I won’t go into why I made the switch here. Suffice it to say it makes it much easier to release code and work with others.

Mercurial itself is an easy installation and I had it running both on my OS X 10.4 and Windows XP in a flash. I even installed the newly released HgTortoise plugin, which... [More]

Using an OpenSSL certificate for Courier IMAP

Published by marco on

Courier IMAP has a default certificate for SLL communication, but it’s only valid for a year and has bogus, default information in it. You can use a utility to generate a new certificate and, with a little perseverance, find the configuration file from which it draws its parameters. With these parameters, you can make a slightly better certificate, but it’s better to use OpenSSL to generate a proper certificate, based either on a trusted certificate or self-signed. However, OpenSSL’s default... [More]

16 years Ago

Sorting Algorithms Head-to-head

Published by marco on

 If you’re faced with a pile of data that needs to be sorted, you can use the Animated Sorting Algorithms by David R. Martin to decide, based on what kind of data you think you’re going to have. Click a little green refresh symbol in the rows to watch the algorithms race on the same dataset or click a column header to watch the same algorithm attack best- and worst-case scenarios simultaneously.

 

PHP Gets Closures / Lambda Functions

Published by marco on

The recently-published RFC: Lambda functions and closures by Christian Seiler & Dmitry Stogov (PHP) has all the details about a patch for PHP that adds support for closures to PHP 5.3 and higher. It looks like the proposal was initially made in December of 2007 and the process lasted about half a year. Compare and constrast with Java’s long struggle to get closures, which isn’t over by half[1].

The syntax is pretty straightforward, though not as elegant as the lambda syntax adopted by C# (and likely others of whose syntax I’m not aware,... [More]

Metadata in Software Development

Published by marco on

This article was originally published on the Encodo Blogs. Browse on over to see more!


 Download

This paper sketches a brief background of metadata, lists the advantages and drawbacks to existing approaches and provides some examples on where metadata can be useful. It describes Encodo’s approach to metadata with a brief overview of the basic elements and ideas on how to avoid the limitations of existing solutions.

What is Metadata?

Metadata is, by definition, data about an application’s... [More]

Encodo C# Handbook

Published by marco on

This article was originally published on the Encodo Blogs. Browse on over to see more!

 Download

The first publicly available version of the Encodo C# Handbook is ready for download! It covers many aspects of programming with C#, from naming, structural and formatting conventions to best practices for using existing and developing new code.

Here’s the backstory on how and why we decided to write a formal coding handbook.

Here at Encodo, we started working with C# less than a year ago. We... [More]

Office Formats

Published by marco on

Microsoft recently released documentation for their binary office formats in both PDF and their own XPS format. The PDF for Word weighs in at 2.8MB and has 210 pages. Why are the Microsoft Office file formats so complicated? by Joel Spolsky, provides a lot of good reasons for why the formats are so complicated (most rooted in history), like speed, complexity of the task, purely internal formats (until now), etc.

Where Spolsky veers off the path (and he almost always does) is in reaching a bit too far with his... [More]

Improving Online Chatting

Published by marco on

The article Two-Party Threaded Chat by Peter Arrenbrecht addresses the problem of multiple threads of discussion within a single conversation. Without face-to-face contact, the threshold for interruption is much lower and answers will not always neatly line up under their questions. A conversation may have many of these “threads”, though individual ones are usually quite short-lived. Chat clients are currently limited by their purely serial approach to inserting text into a conversation.

The solution proposed in... [More]

17 years Ago

Generics and Delegates in C#

Published by marco on

This article was originally published on the Encodo Blogs. Browse on over to see more!


The term DRY—Don’t Repeat Yourself—has become more and more popular lately as a design principle. This is nothing new and is the main principle underlying object-oriented programming. As OO programmers, we’ve gotten used to using inheritance and polymorphism to encapsulate concepts. Until recently, languages like C# and Java have had only very limited support for re-using functionality across larger... [More]

The All-Downside Architecture

Published by marco on

If you’ve ever thought that PHP was too fast or used too little memory or that Java’s class encapsulation was too restricitive, boy has Quercus: PHP in Java got the solution for you. At last, PHP developers can enjoy the benefits of enterprise computing complete with abominable startup times, appalling refresh speeds and PermGen errors every 15 minutes. And Java developers can finally leave their half-assed web frameworks behind and get behind the ultra-organized global namespace with a little... [More]

18 years Ago

When Tapestry’s @Inject* Silently Fails

Published by marco on

This article was originally published on the Encodo Blogs. Browse on over to see more!


Most Tapestry programming involves writing event handlers and operations on page objects. In order to execute these operations, you need access to properties of the form and properties of the session and application in which the page resides. For convenience, developers can add references to all sorts of objects in the system using various forms of the @Inject* annotation (like @InjectPage, @InjectObject... [More]

Versioned Objects with Hibernate

Published by marco on

This article was originally published on the Encodo Blogs. Browse on over to see more!


Hibernate is a persistence framework for Java. Among the many perks it purports to bring to the table is automatic versioning for objects in the database. That is, when saving an object to the database, it increments a version number. Any process that attempts to store a different version of the same object is rejected. This is all extremely flexible and can be added to a POJO using an annotation:

 ... [More]

Override an Implementation in HiveMind

Published by marco on

This article was originally published on the Encodo Blogs. Browse on over to see more!


If you are not already familier with HiveMind, read Setting up a Service in HiveMind for an introduction.[1]

In the article mentioned above, we learned how to set up a new HiveMind service. What if we want to replace the implementation for an existing service? Is it even possible? Why would you want to do that? This article answers these questions in the context of a real-life example from one of our... [More]

Session and Requests in HiveMind

Published by marco on

This article was originally published on the Encodo Blogs. Browse on over to see more!


If you are not already familier with HiveMind, read Setting up a Service in HiveMind for an introduction.[1]

Almost every application is going to need to have information that is session-specific. This is accomplished by adding a member to Tapestry’s application objects list and assigning it the proper scope. With a scope of “session”, HiveMind makes sure that each session in the web application has its own... [More]

Setting up a Service in HiveMind

Published by marco on

This article was originally published on the Encodo Blogs. Browse on over to see more!


HiveMind is the IOC manager used together with Tapestry; it’s in charge of bootstrapping and connecting all of the myriad objects and services available to a Tapestry application. Applications based on Tapestry are encouraged to use it to configure their application- and session-level objects and services as well.

Once it works, it works well. Getting it configured in the first place—especially when new... [More]

Missing ognl?

Published by marco on

This article was originally published on the Encodo Blogs. Browse on over to see more!


Every once in a while, when adding a new component to or changing an existing one on a Tapestry page, you’ll make a mistake. Most of the time, the exception handler page is pretty good; sometimes the exception can be quite confusing. For example, suppose we have a custom component with a single property:

package com.encodo.blogs.samples;

class CustomComponent extends BaseComponent {
  public abstract... [More]

Sorting Collections in Java

Published by marco on

This article was originally published on the Encodo Blogs. Browse on over to see more!


One of the features we expect from a collections library is sorting. You should be able to use generic library mechanisms to sort a list of any kind of element. Most libraries include a generic sort function, to which a comparison functor (object or function pointer) is passed. This functor is called repeatedly on pairs of elements until the list is sorted.

Let’s define the simple class we’ll use in the... [More]

Debugging IE 6: Operation Aborted

Published by marco on

This article was originally published on the Encodo Blogs. Browse on over to see more!


Develop your web application using Firefox. Validate your (X)HTML, validate your CSS, test your JavaScript. Tweak graphics, tweak layout. Get the client to sign off. Now that everything’s looking and working just right, it’s time to get it running in IE. Fire up IE and load the application.

Internet Explorer cannot open the Internet site ‘’http://your.hostname.com/’‘. Operation aborted

?!?!

Lingering... [More]

Wildcard Generics

Published by marco on

This article was originally published on the Encodo Blogs. Browse on over to see more!


As of version 1.5, Java has blessed its developers with generics, which increase expressiveness through improved static typing. With generics, Java programmers should be able to get away from the “casting orgy” to which Java programming heretofore typically devolved. The implementation in 1.5 does not affect the JVm at all and is restricted to a syntactic sugar wherein the compiler simply performs the... [More]

Recursive Components in Tapestry

Published by marco on

This article was originally published on the Encodo Blogs. Browse on over to see more!


Given a recursive object structure in memory, what’s the best—and most efficient—way to render it with Tapestry? First, let’s define a tiny Java class that we’ll use for our example:

public class DataObject {
  private String name;
  private List<DataObject> subObjects = new ArrayList<DataObject>();

  public String getName() {
    return name;
  }

  public List<DataObject> getSubObjects() {
   ... [More]

Inherited Method Annotations in Java

Published by marco on

This article was originally published on the Encodo Blogs. Browse on over to see more!


See Finding Conforming Methods for part one of this two-part article.

The problem we’re working on is as follows:

  1. Given an object, a method name and a list of parameters, execute the matching method on the given object.
  2. Determine from the object’s class whether the given method can be executed from the given context (web, command-line, etc.)

We will use annotations to mark up methods as callable or... [More]

Finding Conforming Methods in Java

Published by marco on

This article was originally published on the Encodo Blogs. Browse on over to see more!


This is a two part post illustrating some tricks for working with the Java reflection API. Part two is available here.

Java reflection provides a wealth of information about your code. One interesting use of this information is to layer scriptability on top of an application, calling code dynamically. Suppose we wanted to do the following:

  1. Given an object, a method name and a list of parameters, execute... [More]

Inherited Method Annotations

Published by marco on

This article was originally published on the Encodo Blogs. Browse on over to see more!


See Finding Conforming Methods for part one of this two-part article.

The problem we’re working on is as follows:

  1. Given an object, a method name and a list of parameters, execute the matching method on the given object.
  2. Determine from the object’s class whether the given method can be executed from the given context (web, command-line, etc.)

We will use annotations to mark up methods as callable or... [More]

Finding Conforming Methods

Published by marco on

This article was originally published on the Encodo Blogs. Browse on over to see more!


This is a two part post illustrating some tricks for working with the Java reflection API. Part two is available here.

Java reflection provides a wealth of information about your code. One interesting use of this information is to layer scriptability on top of an application, calling code dynamically. Suppose we wanted to do the following:

  1. Given an object, a method name and a list of parameters, execute... [More]

Interfaces in Delphi − Part I

Published by marco on

This article was originally published on the Encodo Blogs. Browse on over to see more!


This is the first of a two-part article on interfaces. part two is available here.

Delphi Pascal, like many other languages that refuse to implement multiple inheritance, regardless of how appropriate the solution often is, added interfaces to the mix several years ago. However, Borland failed, at the same time, to add garbage collection, so they opted instead for a COM-like reference-counting model,... [More]

Interfaces in Delphi − Part II

Published by marco on

This article was originally published on the Encodo Blogs. Browse on over to see more!


This is the second of a two-part article on interfaces. part one is available here.

In part one, we saw how to use non-reference-counted interfaces to prevent objects from magically disappearing when using interfaces in common try…finally…FreeAndNil() cases. Though this brings the interface problem under control, there is further danger.

Dangling Interfaces

A dangling interface is another problem... [More]

Pitfall in the @For component in Tapestry

Published by marco on

This article was originally published on the Encodo Blogs. Browse on over to see more!


Any properties used from a Tapestry template have to be declared in the corresponding Java page class. It is highly recommended to declare these properties as abstract; Tapestry implements them for you, automatically including code that re-initializes each property automatically when a page is re-used from the cache. If you implement the properties yourself in the customary Java getter/setter way, it is up... [More]

Immutable Collections in Java

Published by marco on

This article was originally published on the Encodo Blogs. Browse on over to see more!


Java supports immutable collections of all kinds, but not in the way you would expect. A naive implementation would declare the immutable (unmodifiable in Java parlance) interface as follows[1]:

interface UnmodifiableList<T> {
  function T get();
  function int size();
}

There is no way to modify this list—the API is simply not available. That done, we can now create the modifiable version of the list... [More]

Commodore PET

Published by marco on

 Commodore PET 2001The Commodore PET (Wikipedia) first came onto the scene in 1977. Why is that interesting? As with most disciplines and careers, programmers like to engage in pissing contests to determine who’s suffered the most under the least expressive language under the most oppressive OS on the most restrictive hardware. One of the most important markers of experience is the “first machine I ever programmed on” metric. Many cut their teeth on BASIC on the Commodore 64; I cut mine on the machine to the left.

Until... [More]