Translate

Friday, June 1, 2012

Conditional Fields vs AHAH Helper





I worked on a project in which node forms display text fields based on the values of other fields. For example, if a checkbox field is checked, the form should display a text field below. Another example would be if a user chooses the option "other" in a select box, a text field should be displayed as well.


The first thing that came to my mind was AHAH, which I could easily use with the help of AHAH Helper module. After further research, I discovered the perfect solution to my problem: Conditional Fields.


Conditional fields define dependencies between content type fields based on the state of their states and values. An example scenario would be a selection box of "Occupations". If the user did not see their occupation in the predefined list, a text box will be displayed so that they can enter the right information.


Another good thing about using conditional fields is that it can be exported via features. You don't need to write code to do this and maintenance does not become a nightmare.


In order to use conditional fields here is what you need to do:



  • enable the module

  • navigate to "admin/content/node-type/CONTENT_TYPE_NAME/fields/FIELD_NAME"

  • under "Controlling fields", select the choose the field's value that would be used to display current field


For more information regarding conditional fields, please visit the following links:
http://drupal.org/project/conditional_fields
http://drupal.org/node/475488





Source : http://appnovation.com//conditional_fields_vs_ahah_helper

Thursday, May 31, 2012

3 Books Worth Checking Out for Web App Developers




I’ve recently been able to get a copy of three books that I thought I’d promote here. Two of them (from O’Reilly) are relevant to developers who are working on high-end JavaScript-based applications and the other one (from No Starch Press) is a highly regarded book covering the topic of web application security.


JavaScript Web Applications by Alex MacCaw


JavaScript Web Applications by Alex MacCaw


The book’s description from the O’Reilly page is, in part, as follows:


“Building rich JavaScript applications that bring a desktop experience to the Web requires moving state from the server to the client side—not a simple task. This hands-on book takes proficient JavaScript developers through all the steps necessary to create state-of-the-art applications, including structure, templating, frameworks, communicating with the server, and many other issues.”


The book’s subtitle is “jQuery Developers’ Guide to Moving State to the Client”, so it is mainly targeted at jQuery developers. The book also covers MVC, Templating, plus info on three MVC libraries: Spine, Backbone, and JavaScriptMVC.


And if you’re in doubt, the book has 14 reviews on Amazon with a 4.5 star average rating. Definitely worth checking out.


The Tangled Web by Michal Zalewski


The Tangled Web by Michal Zalewski


This one is subtitled “A Guide to Securing Modern Web Applications”. I like this book because it seems quite focused. It has one goal: To help you secure your web apps. Here’s part of the description from publisher No Starch Press:


“In The Tangled Web, Michal Zalewski, one of the world’s top browser security experts, offers a compelling narrative that explains exactly how browsers work and why they’re fundamentally insecure. Rather than dispense simplistic advice on vulnerabilities, Zalewski examines the entire browser security model, revealing weak points and providing crucial information for shoring up web application security.”


On Amazon, the book has 18 reviews with an average of 5-stars (only 2 of the 18 are 4-stars). Looks like a must-have for anyone concerned about the security of their website or web app.


Maintainable JavaScript by Nicholas C. Zakas


Maintainable JavaScript by Nicholas C. Zakas


Coincidentally, this book is being released on Amazon today. I was able to get an advance copy from O’Reilly, but I haven’t dug into it yet. If you know Zakas, then you know this is a quality pick-up even before reading it.


Here’s part of the O’Reilly page description:


“You may have definite ideas about writing code when working alone, but team development requires that everyone use the same approach. With the JavaScript practices in this book—including code style, programming tips, and automation—you’ll learn how to write maintainable code that other team members can easily understand, adapt, and extend.”


Subtitled “Writing Readable Code”, the book covers code conventions, using tools like JSLint, style guides, and more.


Got Any Others?


If you have authored or know of any other good books that would be of interest to Web App developers, post a comment or contact me if you have a review copy.


Although I do have a print copy of each of the books listed above, I haven’t yet read any of them – there are a few other others I’m working my way through right now. But I do highly recommend all three due to the experience and reputation of the authors along with the quality of the publishers.











Source : http://www.impressivewebs.com/books-web-app-developers/

Wednesday, May 30, 2012

Testing Databases





Databases are an integral part of any software developed today. Whether you are a Software Tester or an owner of a web site, it is of utmost importance to know about the underlying database.


The simplest task in dealing with databases is to write queries in order to communicate with a database. Web masters owning web sites or database administrators for complex or large software need a certain level of expertise to perform complex tasks such as database monitoring, database auditing, database optimization, database models (also known as database schema), to name a few. This level of expertise calls for undergoing a comprehensive course.


It's a good idea for web masters to know about how their database works so that they can troubleshoot their own systems or know what is being done if a professional is hired.


Database Testing is an important aspect that a versatile Software Tester should be aware of. A few aspects of database testing here will be discussed here.


Why do we conduct tests?
We all know that it's important to test the database our software uses. Your database holds confidential and valuable information which you would not like to be compromised. Testing the database provides us with a solid feedback essential for identifying defects.


What to test in database testing?
We need to consider the threats within the database (similar to White box Testing) as well as at the interface level (Similar to Black Box Testing).


Black Box testing might include, but not limited to:
Input data
Output Data (from queries, views, stored procedures)


White Box testing might include, but not limited to:
Unit tests for Stored Procedures / functions
Triggers / Views code
Referential Integrity


How to test?
When you want to test your database, you would need to test databases that are a replica of the original database. These are sometimes called 'sandboxes' in agile terms. In this test database, you can experiment with data, develop new functionality, validate the changes and then integrate it with the project if satisfactory.


You'll need to create database tests based on either rebuilding the existing database or starting afresh with creation of database and related schema. Identifying Test Data is an important task here. Once the tests are ready, you would execute them and check the results.


Please leave your comments below.





Source : http://appnovation.com//testing_databases

Tuesday, May 29, 2012

The CSS Clip Property




You’ve probably heard of CSS’s clip property. It has some unique features and syntax, and in this post I’ll outline how it’s used.


At the end of the post you’ll find a link to a demo page where some photos are used to animate the clip property, just to visually demonstrate what this property does.


Syntax


The syntax for clip looks like this:



.example {
position: absolute;
clip: rect(110px, 160px, 170px, 60px);
}

The first thing you should know about clip is that it can be applied to an element only if that element is set to position: absolute. I’m not entirely sure why this is the case. I assume there are reasons. It is quite a big drawback, but regardless, this can be an interesting property to experiment with.


The next part of the syntax is the actual clip property itself. The value can be either a defined shape, or “auto”. A value of “auto” has no clipping, and is the default for all elements. So using clip: auto is the same as not including clip at all.


If you define a shape (currently only rectangles are allowed), you do so with the “rect()” function, passing in values that define the shape. The values can be positive or negative values.


The rect() Values


The values passed into rect() are a tad confusing at first, but once you fiddle with them, they’re not difficult to work with. Basically the values represent top, right, bottom, and left, in that order — just like other CSS properties like margin and padding. The values define the offsets from the top of the element and from the left of the element.


In other words, in the example above, the first value places an imaginary line running horizontally 110px from the top (the first value) and another horizontal line 170px from the top (the third value). The second value places an imaginary vertical line 160px from the left, and the last value places another imaginary vertical line 60px from the left.


If that confuses you, maybe this image will help:


CSS Clip Visualized


This image uses Photoshop-like “guides” to show you where the respective values will place the imaginary intersecting lines. The bright area of the image is the part of the image that would be visible. The rest would be hidden. So the “clipped” area defined by the intersecting lines is the area that remains.


You can think of clipping kind of like adding visibility: hidden to a portion of an element.


It’s also of note that IE6-8 do provide support for clip but instead of commas separating the values, those browsers require white space instead. It seems that most other browsers also support clip with white space instead of commas, so if you want full support you’ll have to either serve IE its own styles with the space-delimited syntax or else just use spaces for all browsers. I haven’t tested spaces in all browsers, so test before you do anything.


A Funky Animated Gallery


The clip property is included in the W3C’s list of animatable properties, so I put together a wacky little animated gallery just to demonstrate how clip works. View it with the button below and click any of the images to see them animate.












Source : http://www.impressivewebs.com/css-clip-property/

Friday, May 25, 2012

One Week Away! Drupal Business Summit and Drupal Camp Vancouver





We're ONE WEEK away from the Drupal Business Summit and Drupal Camp events happening here in Vancouver on June 1 & 2! We here at Appnovation are excited, not only because we're gold sponsors of both events, but also because a few of our team members have been chosen to run sessions for Drupal Camp.


Check out what our guys will be talking about:


Scott Bell - Lifecycle of a Drupal Project


Afraaz Ali - The Basics of Multisiting


Adrian Jones - The Drupal User Experience


Jim MacInnes - Drupal and HTML5: Playing Well Together


Both events will be a wealth of information for technical and business people alike looking to learn more about Drupal and what it can do for them.


Register today!





Source : http://appnovation.com//one_week_away_drupal_business_summit_and_drupal_camp_vancouver