generator

How to create the union of many sets using a generator expression?

Suppose I have a list of sets and I want to get the union over all sets in that list. Is there any way to do this using a generator expression? In other words, how can I create the union over all sets in that list directly as a frozenset? ...

Stopping a recursive generator & permutations

As an exercise, I've been trying out various ways of generating all permutations of a list in Python -- recursive, non-recursive... -- and comparing the performance with itertools.permutations(). But I'm having trouble with the generator version of the recursive method, which doesn't finish cleanly with a StopIteration exception, but ins...

C++ Document Generator

Hello, What are some good document generators of source (specifically) C++ source code, not including DOxygen. Thank you, Scott. ...

How to add watermark to the qr code?

Hi, I want to add a watermark to the qr code generated automatically on generation. Is there a open source solution to start. We are trying to implement a organisation wide solution, but have to complete successful pilot to get it to make it organization standard. I appreciate any help. Thanks. ...

Rails 3 : `require` within a generator

I am writing a Rails 3 generator, but things get a bit complicated so I would like to extract some code to put it in a separate file. So I create a file in the generator folder, and within my generator file, I put at the top: require 'relative/path/to/my/code.rb' But when I launch the generator, it tells me that it can't find the fil...

Dynamic tags generation from sql server database using full text search

Hi, Is there any solution to generate list of tags (common phrases/words) from sql server full text index. I store some data in xml data type column. I would like to generate common words from that column (performance is on the first place). data changes frequently. ...

generate random words from the list of words in c programming

hey, i wanna ask if i have a list of words let say 'tiger, lion, elephant, zebra, horse, camel, deer, crocodile, rabbit, cat' haw can i generate 5 words out of the list randomly in c programming? for example: tiger, zebra, cat, deer, horse or crocodile, rabbit, camel, zebra, elephant ect thank you in advance :D Edit: #include <st...

Which is generally faster, a yield or an append?

I am currently in a personal learning project where I read in an XML database. I find myself writing functions that gather data and I'm not sure what would be a fast way to return them. Which is generally faster: yields, or several append()s within the function then return the ensuing list? I would be happy to know in what situati...

Invalid primary key datatype [int]

I am using Afo Castle AR Code Generator v1.0.0.4 at first I was receiving errors for using tinyint as a primary key so I changed those to int but the only error I have left and can't seem to get rid of is Invalid primary key datatype [int] for table dbo.Level_Code. Only int identity and uniqueidentifier primary keys are suppor...

A one-time generated CSV file in RoR

Is it possible to create a CSV file right out of the command line in IRB or elsewhere with a one-time use on it. Say, I just need a CSV file with all my user's first name on it. Can I create that without setting up any architecture? ...

How do I split a string and rejoin it without creating an intermediate list in Python?

Say I have something like the following: dest = "\n".join( [line for line in src.split("\n") if line[:1]!="#"] ) (i.e. strip any lines starting with # from the multi-line string src) src is very large, so I'm assuming .split() will create a large intermediate list. I can change the list comprehension to a generator expression, but i...

Looking for commercial grade license key generator for .net app

I am looking for some kind of licensing solution for a .net application such that we can gen a license key during e-commerce checkout, or something a support person can generate and email to a customer. I'd like to have admin type capabilities, tracking key generations, adding products, features etc... I did a quick Google search and a...

C# API generator

I have a few dll files and I want to export all public classes with methods separated by namespaces (export to html / text file or anything else I can ctrl+c/v in Windows :) ). I don't want to create documentation or merge my dlls with xml file. I just need a list of all public methods and properties. What's the best way to accomplish...

Visual Tree (graph) generating

I'm trying to find a piece of software or some API / technology that would allow me to do the following.... I'm looking to generate a family tree based on input I was to feed into a piece of software. I'd like each child of the tree to be clickable and for me to embed it into a website somehow. ...

Why won't recursive generator work?

Hi all, I have a class where each instance is basically of a bunch of nested lists, each of which holds a number of integers or another list containing integers, or a list of lists, etc., like so: class Foo(list): def __init__(self): self.extend( list(1), list(2), list(3), range(5), [range(3), range(2)] ...

Generate a specific color for each string?

I have a DataGrid that shows orders that belong to product. I want to have a generated SolidColorBrush that is unique to each product. Update I need these colors to be solid and distinctive, or at least to be ordered in a distinctive way, i.e. there shouldn't be black, blue, green as these 3 colors can be confused with each other. Bes...

How to create random image generator in asp.net mvc project c#

Hello all, I am looking for some solution of the random user image. I created some image and calling it from database if user has no image. But i dont like it, it is quite ugly. Is it exists some random image generator, like here in stackoverflow the the user has no photo. Please help me! Thanks and take care, Ragims ...

For Ruby on Rails, how do you use delayed_job (and add generator)?

This is for http://github.com/tobi/delayed_job the example says: script/generate delayed_job_migration if I run it $ script/generate delayed_job_migration Couldn't find 'delayed_job_migration' generator On github, there is a generators folder, an init.rb, a lib folder, and a tasks folder, where should they go into our project? (u...

Should I include a <meta generator> tag?

Suppose I have some sort of proprietary web framework. Should I include a <meta generator="My framework"> tag in the generated files? I noticed that StackExchange 0.9 applications do that, and wondered what are the pros/cons of doing it. Does it have any effect, or is it just useful for people looking at the source to see? ...

How to break from a Python generator with open file handles

I'm writing a Python generator which looks like "cat". My specific use case is for a "grep like" operation. I want it to be able to break out of the generator if a condition is met: summary={} for fn in cat("filelist.dat"): for line in cat(fn): if line.startswith("FOO"): summary[fn] = line break S...