fun with arrays and requirement chains

Recently, I had to figure out if a given set of features contained all of their necessary requirements.

For better or worse, the table was modeled so that the feature table referenced itself so that it could create a parent/child requirement chain. For example:

feature_id requirement_id
2 null
5 2
7 null
11 5

So my problem is to find out if a given set of requested features, make sure that the requirements are also present. This includes any requirements the requirement feature may have. In this example, 11 requires 5 which requires 2.
Let’s take $featureRequest1=array(2,5,7,11) and $featureRequest2=array(7,5,11). If I were to run a look up of requirements, I would find that we have

$requirements=array(2,5).

I tried to use the php in_array function but it didn’t work as I expected it to.

in_array($requirements,$featureRequest1); // i expect true
var_dump(in_array($requirements,$featureRequest1)); // false
in_array($requirements,$featureRequest2); // i expect false
var_dump(in_array($requirements,$featureRequest2)); // false

I then realized what I need is for there to be a clear intersection between the requirements and the request.

$requirements==array_intersect($requirements,$featureRequest1); // expect true
var_dump($requirements==array_intersect($requirements,$featureRequest1)); // true
$requirements==array_intersect($requirements,$featureRequest2); // expect false
var_dump($requirements==array_intersect($requirements,$featureRequest2)); // false

I should probably note that array_interest will preserve the array keys. To fix it, you can either flip the 2 arguments or pass the return array to array_values

Meet the PHP Dev Derby Team

I liked how the Dev Derby website did team leader profiles and decided to try to do something similar. No one provided any pictures but most did answer some questions I asked so without much further ado, meet the PHP Dev Derby Team.

The team consists of

  • Dennis Rogers (@_drogers)
  • Max Beatty (@maxbeatty)
  • Matthew Haralovich (aka zon)
  • Grant Simpson (@grantls)
  • Ryan Dagey (@dageytech)

Update: added in Ryan Dagey’s answers. And photo.

Continue reading

Call to Arms

A selection of programming language textbooks ...
Image via Wikipedia

How much code can you generate in a day?

We are actively recruiting participants to take place in a developer event (“Dev Derby“) that pits one language against others. It is a day-long programming challenge where teams of developers work to create an application serving a real-world need. Five teams will represent different programming languages—PHP, C#, Ruby, ColdFusion, and Java—to produce a demo application that will be released as open source software.

http://devderby.com/application/

Team Leaders for each language will review applications and select competitively balanced squads. There is no cost to enter, but spots on teams are limited. Winning teams can win prizes and all participants are eligible for discounts to other tech events taking place that week.

The Dev Derby will start and end on Saturday, September 11, 2010, in Bloomington, Indiana. It is part of The Combine (http://thecombine.org), the area’s first major technology conference, and at the start of the BFusion/BFlex conference (http://bflex.info). Dev Derby involves an intense six-hour coding session.

Each challenge submission will be judged by knowledge leaders and representatives of the non-profit organizations benefiting from this work. The criteria spans Design (features and UI choices made), Technical Efficiency (code and performance), Communication (documentation and presentation), and Practical Value (use, adoption, and maintenance).

Prizes will be awarded at the end of the day, following a panel discussion about the development process and the future of application programming.

Dev Derby is situated in The Combine along with other technology-related events, such as Tech Cocktail, Ignite Bloomington, and a variety of of other gatherings. It is hosted by the BFusion/BFlex conference, a two-day hands-on training event from the experts of Adobe Flex and ColdFusion. Dev Derby is inspired by our experience with Startup Weekend in 2008, but with a short day of coding and focused on a specific challenge.

Apply now: http://devderby.com/application/

Enhanced by Zemanta

Valuable Professional Reading

book cover
Image via Wikipedia

The team leaders for Dev Derby have been asked to list what we consider valuable professional reading. Our book selections are not limited to our respective Languages. I thought I would share my list with everyone.

The first 2 (GoF design patterns and Patterns of enterprise application architecture) really just need to be in every developer’s library. The rest are a collections of books I’ve read and liked as well as recommendations from developers I like and respect. Keith Casey pointed me in the general direction of a lot of these books.I suspect that some of the Dev Derby people will end up contacting various publishers to solicit swag sometime soon.

In other news about Dev Derby, I think that an application for teams should be available to announce sometime soon geneerinen cialis. I do know we have a deadline for selection approaching and it’s kinda hard to select without people to select from.

GoF design patterns:
* ISBN-10: 0201633612
* ISBN-13: 978-020163361

Patterns of enterprise application architecture:
* ISBN-10: 0321127420
* ISBN-13: 978-0321127426
Continue reading

Auth/ACL implementation strategies

I’m going to talk more about ACLs than Auth. Auth is simple, it’s the ACL that will trip you up.  Since both concepts are coupled together when you’re making a login system, I feel it’s appropriate to at least touch on Auth. What I want to cover is the ways we can create the ACL object to suit needs based on the scale of the project. I’m going to assume that readers have a passing familiarity with using the Auth and Acl objects and may have even implemented them into projects.

Continue reading