generator

Is there a generator version of `string.split()` in Python?

string.split() returns a list instance. Is there a version that returns a generator instead? Are there any reasons against having a generator version? ...

Color Generator Script

Are there any open source scripts that will allow you to enter a website url and it will generate a color palette based on your site? I would prefer something that ran on a typical LAMP stack. I've been able to find many websites that offer the functionality as a service but no downloadable scripts... Update: I'm looking for the palette...

Is there way to turn list of answers from script as yielded values?

I have long running program that I want to keep responsive. The algorithm is recursive, so sometimes even the sub-tasks in longer running calls can be longer than shorter whole runs. I have tried to make it to use yield but only ended up with list full of generators in various levels of recursive list structure (list also multilevel hier...

Converting while to generator 3.4 times slow down

What is happening? Can somebody explain me what happens here, I changed in tight loop: ## j=i ## while j < ls - 1 and len(wordlist[j]) > lc: j+=1 j = next(j for j in range(i,ls) if len(wordlist[j]) <= lc) The commented while version ran the whole program: 625 ms, the next generator version ran the wh...

Windows log generator

Is there a way to generate specific Windows events? I'm currently developing a solution to get this events through WMI process, but I need all the logs Windows can generate. I know there is a way to make .net solution to write the events to the event viewer, but I don't want that. Is there a way to code or make a solution to make W...

Generating (PHP-)Code with Scala

Hello I want to generate PHP-code from a Model I created from parsing a WSDL-File. Anyone an advice how to generate PHP-Code in a smart way? Thanks ...

libxml2 generator ( from xsd to C source code)

Hi at all, there is someone that know if exist a XSD code generator for C source code? I have a lot of xsd files and I need to generate C struct and relative function fromXml and toXml. Thanks. ...

Work with OData secured service

I want to generate entity classes and Service class of OData secured service. In OData Java extension page it is written that I need to use org.restlet.ext.odata.Generator class that should get uri and output directory parameters. But if my OData service is secured the generator instance is not able to generate service classes without us...

Hibernate exception while using "identity" generator - how to use

I am using Hibernate over SQL Server for a web application. I was using the "increment" generator class till now and recently ran into ConstraintViolation exceptions. So, I changed the generator to "identity" and I am getting the following error - Cannot insert the value NULL into column 'assessment_administration_id', table 'faip....

Generating sine, square, triangle, sawtooth audio signals using Android's AudioTrack Class

Hi, My objective is to generate sine, square, triangle and sawtooth signals with Android's AudioTrack Class. I have made an attempt based on a tutorial. It works relatively well, although I'm not always sure how accurate the frequency generated corresponds with the frequency aimed at. I would like to make square, triangle etc. functi...

Python generator that groups another iterable into groups of N.

I'm looking for a function that takes an iterable i and a size n and yields tuples of length n that are sequential values from i: x = [1,2,3,4,5,6,7,8,9,0] [z for z in TheFunc(x,3)] gives [(1,2,3),(4,5,6),(7,8,9),(0)] Does such a function exist in the standard library? If it exists as part of the standard library, I can't seem to ...

Python generator, non-swallowing exception in 'coroutine'

I recently came across some surprising behaviour in Python generators: class YieldOne: def __iter__(self): try: yield 1 except: print '*Excepted Successfully*' # raise for i in YieldOne(): raise Exception('test exception') Which gives the output: *Excepted Successfully* Traceback (most recent call last)...

Problem with auto-generated primary_key using jpa on DerbyDB

I have jpa annotated entity class like: @Configurable @Entity @Table(name="PLAYERS") public class Player { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name="ID") private Integer id; @Column(name="NAME") private String name; @PersistenceContext public transient EntityManager entity...

A good line-graph generator for my benchmarking?

To learn more about a language I rewrite some of the core functions, or compare basic speeds of each set of functions per problem to see what is more suited in real world situations. Other than an ugly online line-graph generator which often only allows one or two series, I cannot find anything that would suit what I need. Do you know ...

Use Something like Rails Generator for PHP Development

I want to create a command line based tool for PHP Development. It should do something quite similar based on what the rails generator does as well as integrate with rake, as the rake tasks for the DB should also be available. Or is there a ruby framework that allows to build such generators? ...

Short code generator for long text in java

I have long text that identifies few things in my application For example my code: U2Cd3c7a781856c69559539a78e9492e9772dfe1b67.2.nrg As I am sharing this key in public, it is bit long and I would like to make short by transforming just like shorturl so that is shorter in public and internally i would like to map this long text as...

Howto get source line from python generator object?

Here is an example: def g(): yield str('123') yield int(123) yield str('123') o = g() while True: v = o.next() if isinstance( v, str ): print 'Many thanks to our generator...' else: # Or GOD! I don't know what to do with this type # raise TypeError( '%s:%d Unknown yield value type %s.' % \ ...

Best python/Django code generator?

Hello, very quick question. I am wondering if there are any software Django software that generates python coding automatically. If there are any, please let me know. ...

dose rails scaffold command support generate belongs_to or many to many model middle table migration info?

Product,Category is two model on rails3 the relation between them are follow: product has_and_belongs_to_many categories category has_and_belongs_to_many products i can use scaffold generate migration for this two modle use rails g scaffold product name:string rails g scaffold category name:string but how can i generate the many to...