6
голосов
2ответов
3373 просмотров

Java: create new implementation of type at runtime?

So, I realize the answer to this is probably "it's hard", but: I've got a weird idea, and was wondering if it's possible in Java to create a method like: <T> T wrapInterface (Class<T> interfaceClass, T wrappedObject) { if (mClass.isInterface()) { //create a new implementation ...

14
голосов
2ответов
5381 просмотров

Debugging a generated .NET assembly from within the application that generated it

The question in short: How can I debug the code generated during a debugging session on the generating program? (see code below) I am facing the following issue: I would like to debug into dynamically generated/compiled code from the application that generates it. I provided an oversimplified ex...

6
голосов
1ответов
4855 просмотров

How to configure StyleCop to suppress warnings on generated code?

Another project, Visual Studio's Code Analysis has this option. But I couldn't find it for StyleCop (AKA Source Analysis). The file I want to ignore is a dbml's .designer.cs code, that includes the // <autogenerated> tag. A blog post tells me that it would be sufficient, but in my case it ...

2
голосов
2ответов
826 просмотров

Passing JavaScript variable names and values from server script (ASP.NET)

What are some good ways to deal with this messy and unnecessary and not-really-dynamic generation of JavaScript: var <%# JavascriptId %> = new BusinessChart( '<%# JavascriptId %>',<%# CurrentUserId %>,'<%# ChartId %>' ,'<%# Helper.GetBaseUrl() %>','<%# Ch...

13
голосов
4ответов
8582 просмотров

How to write a Makefile rule to download a file only if it is missing?

I'm trying to write a Makefile which should download some sources if and only if they are missing. Something like: hello: hello.c gcc -o hello hello.c hello.c: wget -O hello.c http://example.org/hello.c But of course this causes hello.c to be downloaded every time make command is run...

3
голосов
2ответов
3500 просмотров

generate viewmodel from model?

I'm currently writing viewmodels for my (WPF/C#) app. I have to do a lot of copy and paste though. Isn't there a way to generate the viewmodel from the model like generating the model from the database? I haven't found anything about it on the net ...

0
голосов
2ответов
278 просмотров

How could you enable a WPF application to create user controls on the fly?

How could you create an application that could search through a directory, find user controls in the form of paired .xaml / .xaml.cs files, and compile/execute these on the fly? Is this possible? Is there an .exec() or .compile() class somewhere that could do this? Basically what I want to do wi...

1
голосов
2ответов
589 просмотров

How to create CodeFunction2 with IEnumerable<> Type?

I really need to create something like the following, I am building 2 classes, the first is a class with the name of tableNameAsSingular (i.e AddressEntity) , in my second worker class I need to having something like the following public IEnumerable<AddressEntity> GetAddressEntity() { // ...

0
голосов
2ответов
456 просмотров

C# CodeFunction2 - How do you prevent creation of 'return'?

I am creating a C# class as per: http://msdn.microsoft.com/en-us/library/x6h10s6x.aspx however I want my own 'return' rather than the return default(int); it automatically generates. I know I can insert my own text using an EditPoint i.e editPoint.Insert("return records.AsEnumerable<" + t...

1
голосов
1ответов
330 просмотров

How do you add a C# CodeClass2 AutoProperty?

I would like to generate an auto-property. At the moment I can add a property to the CodeClass by using the following: codeproperty = entityClass.AddProperty(columnName, columnName, c.ColumnType); but this produces code like this: int AddressID { get { ...

9
голосов
12ответов
8583 просмотров

appfuse vs roo - what would you use

Appfuse vs. Roo, what would you use and why? What are the sweet spots of each.

65
голосов
12ответов
118308 просмотров

What is the correct way to write HTML using Javascript?

It seems that experienced web developers frown upon using document.write() in JavaScript when writing dynamic HTML. Why is this? and what is the correct way?

10
голосов
4ответов
2247 просмотров

How to inject/generate plumbing code into methods decorated with an Attribute?

I was reading through some articles on Caching and Memoization and how to implement it easily using delegates and generics. The syntax was pretty straightforward, and it is surprisingly easy to implement, but I just feel due to the repetitive nature it should be possible to generate code based on...

0
голосов
1ответов
540 просмотров

How to force VS2008 to "Generate Create Script to Project" to multiple files when multiple stored procedures are selected?

I'm using Visual Studio 2008 Developer Edition and I've created a Database Project and want to generate CREATE scripts from my database and save them in my database project. It works just fine when I select a single stored procedure in the Database and click "Generate Create Script to Project". ...

1
голосов
2ответов
185 просмотров

Is there an automated way of transforming Java code with over-long (>64kb compiled) methods?

As I understand it, the JVM has a limit of 64KB of compiled code per method. I have a tool which generates Java code to be run, and sometimes the generated code contains methods which are longer than this. Does there exist an automated way of transforming a Java class file with overly long metho...

1
голосов
2ответов
579 просмотров

c# refactoring - How is it done? CodeDom, EnvDTE, another way?

What method does VS use to manipulate the cs file when refactoring. I.e if you extract a method. I am 100% sure (I hope) it is not T4, It could be EnvDTE or CodeDom but could not find out which one and was hoping someone knew. Thanks

7
голосов
4ответов
8399 просмотров

Do you know of any ASP.NET MVC code generators?

Does anyone know of a good/usable ASP.NET MVC code/solution generator. Ideally it would build from a domain model, but from a data model is also acceptable. If you do, can you answer the following: Does it produce "good" code? Can it be extended? What do you like and not like about it if you h...

12
голосов
5ответов
9172 просмотров

Free Codesmith alternatives?

Are there any free/open source alternatives to Codesmith that would be comparable in features and generate .NET code?

93
голосов
2ответов
18185 просмотров

Naming Conventions For Partial Class Files

I'm generating the bulk of my ASP.NET MVC scaffolding code. All generated files are partial classes which use standard naming conventions. For example, my employee controller file is named EmployeeController.cs. If I wish to extend the EmployeeController with custom, non-generated logic, I creat...

0
голосов
2ответов
1194 просмотров

How to recognize code generated by Visual Studio's GUI designer?

Visual Studio is kind enough to generate a lot of code for us when we create and design Windows.Forms controls. It also surrounds most of it with a #region statement. In newer versions it also uses a partial class to separate generated from manually created code. Developers are supposed to edit ...

14
голосов
3ответов
9323 просмотров

Eclipse auto-generation of serialVersionUID with each change

Eclipse nicely generates the serialVersionUID for me. But this seems to be passive code generation as the id won't be automatically updated as I change the file unless I do the generation again. Is there some way to have the serialVersionUID being generated every time I change the contents? The...

0
голосов
2ответов
100 просмотров

How do I manage generated classes in a Visual Studio solution?

I have written a code generator using CodeDom and it generates a number of classes from stored procedures. I'd like to add its execution as a build step and then add all of its classes to the solution programatically at build-time. How do I do this?

2
голосов
8ответов
4935 просмотров

Are there any free tools to help with automatic code generation?

A few semesters back I had a class where we wrote a very rudimentary scheme parser and eventually an interpreter. After the class, I converted my parser into a C++ parser that did a reasonably good job of parsing C++ as long as I didn't do anything fancy with the preprocessor or macros. I could u...

-1
голосов
3ответов
1980 просмотров

Generate unique 3 letter/number code and compare to existing ones in PHP/MySQL

I'm making a code generation script for UN/LOCODE system and the database has unique 3 letter/number codes in every country. So for example the database contains "EE TLL", EE being the country (Estonia) and TLL the unique code inside Estonia, "AR TLL" can also exist (the country code and the 3 le...

2
голосов
6ответов
5861 просмотров

Simple ADO.NET C# Stored Procedure Generator

I am using Visual Studio 2005, Sql Server 2005, C#, ADO.NET. We have a very large database and routinely adding new stored procedures. I am tired of writing the C# wrapper code for these stored procedures, seems like there should be some simple utility or Add In that would allow me to simply ...

6
голосов
3ответов
3555 просмотров

Generate and parse Python code from C# application

I need to generate Python code to be more specific IronPyton. I also need to be able to parse the code and to load it into AST. I just started looking at some tools. I played with "Oslo" and made a decision that it's not the right tool for me. I just looked very briefly at Coco/R and it looks pro...

0
голосов
1ответов
339 просмотров

TypedDataSetGenerator ignoring HierarchicalUpdate option?

I'm using System.Data.Design.TypedDataSetGenerator to convert a .xsd file (generated by VS2008) into a strongly-typed DataSet class compatible with .NET 2.0. From what I understand from MSDN, the HierarchicalUpdate option must be specified to get the same result that the VS2008 IDE generates: Hi...

11
голосов
2ответов
1762 просмотров

Generating java code parse trees and evaluating it for testing

We have a need to generate Java source code. We do this by modeling the abstract syntax tree and have a tree walker that generate the actual source code text. This far all good. Since my AST code is a bit old, it does not have support for annotations and generics. So I'm looking around for open ...

0
голосов
1ответов
3304 просмотров

What are the best free CASE tools for PHP?

What are your favorite free CASE/UML/Code generation/diagramming tools that you use with PHP? There are various commercial products that support code generation in PHP language, are there any free CASE tools? What would you recommend?

0
голосов
4ответов
387 просмотров

Code generation tools for crm 4.0

Is there any free code generating tool that can connect to crm server and create code for selected entities? The code should use SDK assemblies. UPDATE: @friism C# code if possible, each entity one class and each attribute one property so it's not necessary to use Properties collection. That's b...