code-generation

Techniques for building HTML in code.

An html template is compiled into the application as a resource. A fragment of the HTML template looks like: <A href="%PANELLINK%" target="_blank"> <IMG border="0" src="%PANELIMAGE%" style="%IMAGESTYLE%"> </A><BR> %CAPTIONTEXT% i like it like this because the larger resource HTML file contains styling, no-quirks mode, etc. But as ...

Invent new language, syntax check?

i been thinking of a new programming language. Before trying to implement it i would like to check the syntax of code to see if there is much ambiguity. (i find it funny that its possibly to do var++++ to a class) ...

How to change the layout of a WPF Control from outside of that Control

Hi, I am big into code generation for the service/data layer of my apps. What I would really love to do is generate some basic WPF Controls, Data Templates, or some other XAML code based on the metadata I use to generate my service/data layer. EDIT: This generation is done before compile time. What I envision is being able to generate...

Good APIs for scope analyzers

I'm working on some code generation tools, and a lot of complexity comes from doing scope analysis. I frequently find myself wanting to know things like What are the free variables of a function or block? Where is this symbol declared? What does this declaration mask? Does this usage of a symbol potentially occur before initialization?...

Where can I get a list of the 'Custom Tool' code generators that come with VS2K8?

I've used MSDataSetGenerator a fair bit and it causes a bunch of pain because the XMLSerializer rarely works on the output. Are there any other code generators that come with the SDK? ...

Comparison of xsd codegenerators (C#)

I'm doing some research in code generation from xsd schema files. My requirements: Must generate C# 2.0 code, using generic collections where needed. Must generate comments from the xsd comments Must generate fully serializable code. Should be able to generate resuable basetypes when generating from multiple xsd's with the same includ...

How can I add my attributes to Code-Generated Linq2Sql classes properties?

Hi I would like to add attributes to Linq 2 Sql classes properties. Such as this Column is browsable in the UI or ReadOnly in the UI and so far. I've thought about using templates, anybody knows how to use it? or something different? Generally speaking, would do you do to address this issue with classes being code-generated? ...

Simple Mapper Pattern C# Code Generation Template

Can anybody recommend a decent C# Mapper Pattern code generation template that plays nicely with SQL stored procedures? I'm looking for something that generates POCO style entity objects, with a static mapper class for transferring data to/from the database through entity objects. I understand that NHibernate can generate POCO style en...

Generating Code in an MSBuild task

I am creating an MSBuild task that will generate one or more files, I have a Task with an [output] property that is of type ITaskItem[]. My question is, do I need to implement that interface myself or is there a class I can use already? I want them to be Compile task items that get added to the list of files to compile. ...

How can I get the current CodeDomProvider in an MSBuild Task

I have a task and I want to generate some code using the CodeDom. How can I get either the current "language" or the CodeDomProvider for the current project calling my task? ...

creating unit tests (semi-)automatically?

Is there a framework that supports generating some standard unit tests from annotations? An example of what I have in mind would be: @HasPublicDefaultConstructor public class Foo { } This would obviously be used to automatically generate a unit test that checks whether Foo has a default constructor. Am I the only person who thought o...

How can I get the correct text definition of a generic type using reflection?

I am working on code generation and ran into a snag with generics. Here is a "simplified" version of what is causing me issues. Dictionary<string, DateTime> dictionary = new Dictionary<string, DateTime>(); string text = dictionary.GetType().FullName; MessageBox.Show(text); With the above code snippet the value for "text" is as follows...

Possible to generate an iPhone application automatically from another iPhone application?

As title; is there any function that can achieve this? ...

Contains Test for a Constant Set

The problem statement: Given a set of integers that is known in advance, generate code to test if a single integer is in the set. The domain of the testing function is the integers in some consecutive range. Nothing in particular is known now about the range or the set to be tested. The range could be small or huge (but a solution ca...

comparing code size vs source size

There are plenty of script/tools for counting line of code, and some to count functions size in terms of line of code. But here I'm looking to a way to measure function size in terms of bytes of generated code. Does anyone know a way/tools to extract this information from a .lib or a .dll? For example, I know how to list function name...

Delphi code generation

I need to speed up my coding, too much work, so I need be able to generate code. Any tools, any ideas? ...

generating a code from emacs

How can I write the following code quickly in emacs? \newcommand{\cA}{\mathcal A} \newcommand{\cB}{\mathcal B} \newcommand{\cC}{\mathcal C} ... ... \newcommand{\cY}{\mathcal Y} \newcommand{\cZ}{\mathcal Z} Is there a way faster than writing A B C D . . . Y Z and then doing macro on each line? (changing A to \newcommand{\cA}{\mathc...

Is Micro Code Generation Considered Harmful?

I recently wrote a small tool to generate a class for each tier I hand write for the boring "forms over data" work where I spend almost 90% of my time (depressing I know) ... more on this as the economy improves ;) My question is this - will using this tool instead of hand typing all this code from day to day actually hurt me as a devel...

Are there any open-source code-generation projects out there?

I'm using an in-house code generator in which we supply all the metadata regarding our objects, and it generates our database, and object model including validation logic. Once we load all the data in the database, we use classic ASP <% %> to build our templates. I would like to know what open-source frameworks similar to this that are o...

CodeIgniter Table Class: How to add a link from a generated cell

I'm using the table class that autogenerates a table for me from an array of data from my database. So in my model I have: function get_reports_by_user_id($userid) { return $this->db->get_where('ss2_report',array('userid' => $userid))->result_array(); } In my controller I have: function index() { echo $this->table->generate(...