generator

JSF action, value and binding catalog generator

I am looking for a simple tool that generates a catalog of all used action methods, values and bindings. I'm working on a big JSF/RichFaces project and I have lost the overview of the used links to the beans. Therefore I need a tool (would be nice if it is a Eclipse plugin) that generates a simple list of all used EL expressions. Is the...

Doctrine schema.yml generator

Hi, I am pretty new to doctrine. I made two small projects with doctrine for my own but now I am about to create big project for my client. The project will have more than 50 tables. Is there any way of generating schema.yml? I tried DB Designer and converted it to schema.yml, but I still had to check and rewrite the definitions by hand...

Create a new Tuple with one element modified

(I am working interactively with a WordprocessingDocument object in IronPython using the OpenXML SDK, but this is really a general Python question that should be applicable across all implementations) I am trying to scrape out some tables from a number of Word documents. For each table, I have an iterator that is giving me table row ob...

Python asynchronous callbacks and generators

Hello, I'm trying to convert a synchronous library to use an internal asynchronous IO framework. I have several methods that look like this: def foo: .... sync_call_1() # synchronous blocking call .... sync_call_2() # synchronous blocking call .... return bar For each of the synchronous functions (sync_call_*), I have...

How do I make my generator discoverable by Rails?

When I'm creating a gem, how do I make the generator discoverable by Rails? I have a generators directory with my generator inside. I symlinked it from ~/.rails/generators and it worked fine, but when I install the gem, even though the generators directory is installed, Rails doesn't find it. ...

How to create a generator/iterator with the Python C API?

How do I replicate the following Python code with the Python C API? class Sequence(): def __init__(self, max): self.max = max def data(self): i = 0 while i < self.max: yield i i += 1 So far, I have this: #include <Python/Python.h> #include <Python/structmember.h> /* Define a ne...

Lexer written in Javascript?

I have a project where a user needs to define a set of instructions for a ui that is completely written in javascript. I need to have the ability to parse a string of instructions and then translate them into instructions. Is there any libraries out there for parsing that are 100% javascript? Or a generator that will generate in javascri...

Automatic Application Generator

Is it possible to write a automatic application generator that can output hundreds of applications/day? An application is just a series of binary values. If a super computer is put to generate millions of combinations/day and output the generated binaries with varying sizes. These binaries will then be "run" to see if they are actually r...

Creating a generator expression from a list in python

What is the best way to do the following in Python: for item in [ x.attr for x in some_list ]: do_something_with(item) This may be a nub question, but isn't the list comprehension generating a new list that we don't need and just taking up memory? Wouldn't it be better if we could make an iterator-like list comprehension. ...

resampling, interpolating matrix

I'm trying to interpolate some data for the purpose of plotting. For instance, given N data points, I'd like to be able to generate a "smooth" plot, made up of 10*N or so interpolated data points. My approach is to generate an N-by-10*N matrix and compute the inner product the original vector and the matrix I generated, yielding a 1-by-...

Newbie question : table to form generator in php

Hi all, I'm pretty sure there is a solution for this but I'm not sure about how to phrase it correctly. I have a form that needs to be saved in a database, pretty simple done in php and stored in a mysql table. But maintenance is pretty tedious, so I'm wondering if there is (or I should write my own) a solution to write the form's questi...

In NHibernate, is increment appropriate for identity key that's unique by group? What is appropriate?

I'm connecting to a legacy database that is our ERP system. I have a table that is using composite keys and one of those fields is incremented but it is unique within a subgroup of records. I have no ability to change this although I wish I could. For example, CustomerId_Field, SequenceID_Field 49, 1 49, 2 200, 1 200, 2 200, 3 200, 4 T...

In python is there a way to check if a function is a "generator function" before calling it?

Lets say I have two functions: def foo(): return 'foo' def bar(): yield 'bar' The first one is a normal function, and the second is a generator function. Now I want to write something like this: def run(func): if is_generator_function(func): gen = func() gen.next() #... run the generator ... else: func() ...

How can I do python/ruby/javascript style generators in actionscript?

I want to use coroutines in actionscript to implement a state machine. I'd like to be able to do something like the following function stateMachine():void { sendBytes(0xFFFF); var receiveBytes:ByteArray = yield() sendBytes(receiveBytes); } stateMachine.send( Socket.read() ) like in this blog entry ...

Singleton python generator? Or, pickle a python generator?

I am using the following code, with nested generators, to iterate over a text document and return training examples using get_train_minibatch(). I would like to persist (pickle) the generators, so I can get back to the same place in the text document. However, you cannot pickle generators. Is there a simple workaround, so that I can sa...

Add a member variable / method to a Python generator?

Can I add a member variable / method to a Python generator? I want something along the following lines, so that I can "peek" at member variable j: def foo(): for i in range(10): self.j = 10 - i yield i gen = foo() for k in gen: print gen.j print k Yes, I know that I can return i AND j every time. But I do...

Need ideas for an algorithm that generates an "echo text" from a given input.

After having some fun in a chatbox on a certain website I had an interesting idea. What would be an algorithm that, given some input text, would generate an "echo" text from it. That is, it generates the echo that you would hear if you shouted the input text in a large empty cave. For example: Input text: Hello! Output text: Hello! ...

Python: generator expression vs. yield

In Python, is there any difference between creating a generator object through a generator expression versus using the yield statement? Using yield: def Generator(x, y): for i in xrange(x): for j in xrange(y): yield(i, j) Using generator expression: def Generator(x, y): return ((i, j) for i in xrange(x) f...

How to combine two generators in a non-trivial way.

Hi, I have a generator which produces all positive integers that are powers of 2, and another which produces all integers that are powers of 3. I now need to use those to produce integers of the form 2^i*3^j where i,j >=0,0 in the increasing order. The point of using generators is to reduce memory consumption, I think. I have been tryin...

Tool to generate sitemap from list of links?

I have a list of links for our site that point to my local dev environment. I need to make a valid sitemap according to the protocol here. http://www.sitemaps.org/protocol.php I have created an initial version by hand that validates as XML, however when I feed it into the Dustme Selectors Firefox extension, I am told that it is invalid....