example

JPA one-to-many relationship question (relations on one entity)

In this JPA example there is a code: @OneToOne(cascade=CascadeType.ALL) private Deity mother; @OneToOne(cascade=CascadeType.ALL) private Deity father; @OneToMany(cascade=CascadeType.ALL) private Set<Deity> children; Why relation with father and mother is implemented by @OneToOne annotation and not in @ManyToOne relation? If Child an...

Apache: I want to enable SSI. Can anyone furnish an example config file?

Yes - Google abounds with information about configuring Apache to support SSI. But unfortunately, I still cannot seem to get it right. My questions: Can anyone furnish me a full-fledged example config file that enables SSI on an Apache server? Also can you please tell me where I should drop this config file (i.e. which dire...

Open source non-trivial SOA examples

Hello, I've been looking for open source examples of SOA applications, but most of the times I find simple tutorial hello world style examples that introduce the tricks of the respective middleware. Do you have any suggestion about any middle to big size example with multiple layers and/or governance ? Isn't it some kind of common exa...

Any References to Example Projects

Currently I am a moderate (in terms of difficulty) when it comes to PHP. I would like to test my knowledge by developing certain utilities using PHP (and maybe SQL). But the problem is that I am not able to find any example projects. Does anyone have any links or some small sample projects? ...

Is there a rich domain model example?

I'm looking for a simple example to illustrate the benefits of using a rich domain model. Ideally, I'd like a before and after code listing (which should be as short as possible). The before code listing should show the problem being solved using an anemic domain model, and a lot of fairly procedural service-layer code, and the after co...

Boost Serializing of Object containing Map (with object values) and Multimap (with std::string values): what is needed?

See below a main() and two very simple classes. Then per Boost serialization (and what is shown) my questions are: 1) Does class B need the normal overloaded stream insertion operators '<<' and '>>' to be defined? Currently in my real code it doesn't have these. 2) Does class A in the store() and load() methods need to iterate thro...

Where can I find examples of Quartz 2D drawing on the iPhone?

Hi, I am going to develope the 2D game in Iphone using Quartz. what is the main Difference between Quartz and QuartzCore? I have searched a lot over the internet, but only able to find out the MAC OS with Quartz Examples. If any body has any Link/URL for Examples of Quartz(2D) using Iphone Developement,which would be run in the Real ...

Good problem domain for introduction to OO project?

I'm working with someone who's looking to get back into programming after several years of IT support work. They know all the iterative programming basics and have used them frequently, but their only object-oriented programming experience was in college. The goal is to come up with a decent-sized project that is good for illustrating ...

Filtering odd numbers

M = [[1,2,3], [4,5,6], [7,8,9]] col2 = [row[1] + 1 for row in M if row[1] % 2 == 0] print (col2) Output: [3, 9] I'm expecting it to filter out the odd numbers, but it does the opposite. ...

Python: next() function

I'm learning Python from a book, and I came across this example: M = [[1,2,3], [4,5,6], [7,8,9]] G = (sum(row) for row in M) # create a generator of row sums next(G) # Run the iteration protocol Since I'm an absolute beginner, and the author hasn't provided any explanation of the example or the next() function, I don't unde...

PHP5 OOP Tutorial or examples

Hello, I am currently trying to get my head around OOP in PHP, I understand the basic concepts etc. Up to this I have been working for tutorials and books. What I am looking for is some good tutorials that use real examples [ie make a functioning application] or a simple well written application [with source code] so I can look through ...

Impressing Ruby example

Hi, in some days I am giving a talk about a Rails project at university and I want to introduce the audience to Ruby. I want to show them one or two really nice code examples to demonstrate how awesome Ruby is. Do you know a good example? Best regards ...

Understanding Generators in Python?

Reading the Python cookbook at the minute and currently looking at generators. I'm finding it hard to get my head round. As I come from a Java background, is there a Java equivelant? The book was speaking about 'Producer / Consumer', however when I hear that I think of threading. Can anyone explain what a generator is and why you would...

Where I can find good Spring project example with Hibernate?

I need to make project with Spring + Hibernate, where I could find good example project how basic things are done? ...

python optparse, how to include additional info in usage output?

Using python's optparse module I would like to add extra example lines below the regular usage output. My current help_print() output looks like this: usage: check_dell.py [options] options: -h, --help show this help message and exit -s, --storage checks virtual and physical disks -c, --chassis checks specified chassis components...

Odd behavior of parser when trying sample grammar

I'm trying to get the feel for antlr3, and i pasted the Expression evaluator into an ANTLRWorks window (latest version) and compiled it. It compiled successfully and started, but two problems: Attempting to use a input of 1+2*4/3; resulted in the actual input for the parser being 1+2*43. One of the errors it shows in it's graphical pa...

While loop example

x = y // 2 # For some y > 1 while x > 1: if y % x == 0: # Remainder print(y, 'has factor', x) break # Skip else x -= 1 else: # Normal exit print(y, 'is prime') This is an example for understanding while loop in a book I'm reading, I don't quite understand why a floor division and then y % x? Can someone please...

Example of code generator you made from scratch?

What are some examples of code generators you have used? I think it's a cool idea, but I have trouble thinking of things they can do besides make a class based on an object's attributes/database schema (as described in The Pragmatic Programmer). What language did you write them in and what language did they output? Edit: Thanks for th...

Authlogic with sinatra?

I couldn't find resources on how to use authlogic with sinatra. Or at least no documentation about a canonical way to do authentication with authlogic ... Anyone has pointers to some tutorials, sample code or can sketch out a minimal authlogic/sinatra example? Thanks in advance. ...

Use case of DB design

Hello Merry Christmas and happy new year to all. I wondered if there is any site out there with some detailed examples of normalization and DB design in general.Any comments are welcome.Thanks for your time. ...