code-generation

C# How to generate code from code

Is it possible to generate and build some c# code based on the code from the same project. I tried with T4 and Reflection, but there are some assembly locking issues. Is there any other way? ...

Automatic form generation software

Hi! I'm using winforms. I spend a lot of time drawing forms (maybe not a lot, but it is a boring task). To sum up... I want to develop a simple aplication that connect to a sql server database, let the user to select a table, and put the controls in a form for me (generate the designer code), based on the tipe of each column. Then my ...

How do I generate (ActionSctipt) classes for a new project?

Whenever I start a new game, I make a whole bunch of classes that extend my base classes, so: com.blah.Game extends com.iainlobb.Game and has some setup code com.blah.Player extends com.iainlobb.Player, and has some setup code etc Now all I need is a way to generate these classes at the start of the project so I don't have to create ea...

[GeneratedCodeAttribute] Attribute Missing from Generated WinForm Code

The method definitions in any winform's *.Designer.cs file created by Visual Studio are not decorated with [GeneratedCodeAttribute] attributes. As a result, the generated code is analyzed when I run code metrics or code analysis. Does any one know why the attribute is not provided (it is generated code after all)? Would it be safe to add...

How can I automatically generate sql update scripts when some data is updated ?

I'd like to automatically generate an update script each time a value is modified in my database. In other words, if a stored procedure, or a query, or whatever updates column a with value b in table c (which as a pk column (i,j...k), I want to generate this : update c set a=b where i=... and j=... and k=... and store it somewhere (fo...

Generating code for service proxies

I'm trying to generate some additional code base on the auto-generated webservice proxies in my VS2010 solution, I'm using a T4 template to do so. The problem is, automatically generated proxies are added in "Service Reference" folder but ProjectItems (files) are hidden by default and the following code does not find them in the project...

Partially parse C++ for a domain-specific language

I would like to create a domain specific language as an augmented-C++ language. I will need mostly two types of contructs: Top-level constructs for specialized types or declarations In-code constructs, i.e. to add primitives to make functions calls or idiom easier The language will be used for scientific computing purposes, and will ...

XSLT: Disable output escaping in an entire document.

I'm trying to generate some C# code using xslt - its working great until I get to generics and need to output some text like this: MyClass<Type> In this case I've found that the only way to emit this is to do the following: MyClass<xsl:text disable-output-escaping="yes">&lt;</xsl:text>Type<xsl:text disable-output-escaping="yes">&gt;<...

NHibernate mapping an Dictionary to sql database

I've got the a class created in code an added it to my class diagram. The class diagram is used by a text template generatorto generate code from this class diagram. I'm trying to map a dictionary to an sql database with NHibernate, the generated mapping looks ok to me, but the class property as shown below is giving me problems. This i...

What are the limitations of Reflection.Emit vs. other assembly generation techniques?

I've used Reflection.Emit in the past to write a compiler, but I know the standard compilers don't use it, and in an answer to another question here I saw a mention that there are some things Reflection.Emit is unable to do. What are the limitations of Reflection.Emit that I should be aware of if I plan on writing another compiler for ....

What should be modified to change the URL of a web service in C#?

Hi, I have one problem and it is some time ago I have added a Webservice proxy class into my application by copying all the generated code (copy paste the text of the .cs content). And it worked! But now I need to change the URL used by this web-service proxy class and I am not sure what and where to change in the code. I would appr...

What are the best (powerful yet easy) languages to implement text/data processing and code generation?

If I want to write my engine which will generate all the code solving the task described in simple declarative style, what languages should I look at? ...

EDIT: I need to generate a string of 7 chars that is based on the id of the row.

EDIT: I need to generate a string of 7 chars that is based on the id of the row. So knowing the id of the image and a secret key, i should get the generated string. the string must contain chars from "a" to "z" and numbers from 0 to 9. I have a dir that contains photos like this dir/p3/i2/s21/thumb.jpg the generated string is p3i2s21...

Are there any tools for porting c++ code to c# code?

I have a couple c++ utilities that I would like to port over to dot net. I was wondering if there are tools for porting a c++ application to c#? I imagine that any automated tool would make a mess of any code, so perhaps, I should also be asking if this is a good idea or not? ...

Converting standard mbeans to dynamic mbeans / Code generation

I have a bunch of standard MBeans which I need to convert to dynamic MBeans, (main purpose is to add user friendly descriptions to attributes, operations and operation parameters). I was wondering if there is any tool which can make my job easier by generating skeleton code for dynamic MBeans from the existing standard MBeans. ...

Dynamically generating high performance functions in clojure

I'm trying to use Clojure to dynamically generate functions that can be applied to large volumes of data - i.e. a requirement is that the functions be compiled to bytecode in order to execute fast, but their specification is not known until run time. e.g. suppose I specify functions with a simple DSL like: (def my-spec [:add [:multiply...

DTO and mapper generation from Domain Objects

I have plenty of java domain objects that I need to transform to DTOs. Please, don't start with the anti-pattern thing, the Domain Objects are what they are because of a long history, and I can't modify them (or not too much, see below). So, of course, we've passed the age of doing all that manually. I've looked around, and dozer seems...

machine learning and code generator from strings

The problem: Given a set of hand categorized strings (or a set of ordered vectors of strings) generate a categorize function to categorize more input. In my case, that data (or most of it) is not natural language. The question: are there any tools out there that will do that? I'm thinking of some kind of reasonably polished, download, ...

Why do PHP Array Examples Leave a Trailing Comma?

I have seen examples like the following: $data = array( 'username' => $user->getUsername(), 'userpass' => $user->getPassword(), 'email' => $user->getEmail(), ); However, in practice I have always not left the trailing comma. Am I doing something wrong, or is this just 'another' way of doing it? If I was using a framework woul...

How do I set a member field to a value using codeDom namespace

Hi I want to create code that is something like this: public string randomString = "some Random String"; How can i set a value to the member field that I created using: CodeMemberField field = new CodeMemberField("System.String", "randomString"); Thanks, ...