Create a Custom Error Handler in Silverlight

This video tutorial from Microsoft shows how to create a custom error handler in Silverlight.

Read More >>

Get the OS Current User Name in Java

This Java tutorial shows how to get current OS user name in Java.

Java makes the operating system's current user name available as the system property user.name. The following code sample shows how to get the user name system property.

String userName = System.getProperty("user.name");
Read More >>

Web Performance, Inc. Launches Load Tester 4, Push-Button Cloud-Based Load Testing

Web testers are about to discover a whole new level of performance testing with the release of Load Tester, Version 4.0 from Web Performance, Inc. (WPI). Load Tester 4 gives users access to the cloud network--a virtual network of servers spread across the globe--to let developers conduct load testing outside their own networks and simulate greater numbers of potential site visitors.

"Our latest version of Load Tester was designed to generate loads from both in the lab and outside the network," says Michael Czeiszperger, founder of WPI. "Along with all the benefits of previous releases, Version 4.0 lets our customers specify a virtually unlimited number of users and test computers, without any hand coding, and run their test at the push of a button."

Unlike most web-based solutions, Load Tester 4 can handle even the most complex websites, including often used variables such as session tracking, VIEWSTATES and data customization, and is ideally suited for performance testing throughout a site's development cycle.

"We recently tested a website for the 2009 MTV Music Video Awards," says Czeiszperger. Our engineers completely configured 50 separate test machines, enough to simulate 100,000 concurrent users, in just five minutes."

Load Tester 4 now also simulates the latest versions of Internet Explorer and Firefox, both of which have increased the number of simultaneous socket connections that place a higher load on web servers and reduce web server capacity by up to 60%. By simulating these browsers, Load Tester 4.0 helps developers tune web servers to sidestep any performance problems.

To learn more about Web Performance Load Tester 4, go to

http://www.webperformance.com/load_testing/newfeatures.html


Watch the video on Cloud-based Load Generation



Web Performance, Inc is a leading website performance testing company founded by web technology experts who saw a growing demand for easy-to-use web testing software for projects of all sizes, especially during early development stages. Its offerings include testing services and software, including industry-leading Web Performance Load TesterTM. For more information, visit webperformanceinc.com, or call 919-845-7601.

Source: PRWeb
Read More >>

Murach's JavaScript and DOM Scripting Book Review

JavaScript and DOM Scripting is the latest book from Mike Murach & Associates. From the title, you might assume that this is an intermediate or advance level book. Although it does get to that level, it makes no assumptions on your knowledge level.

The Basics
The first five chapters of this book starts get you up to speed with the basics. These chapters cover basic HTML, JavaScrpt, HTML Forms, and CSS. If you haven't had any experience with HTML, CSS, or JavaScript, these chapters will cover the basics.

Learning JavaScript
In chapter 3, you got a taste of JavaScript. In chapters 6 through 12, it covers the JavaScript language in depth. You will learn everything you need to know about the JavaScript language. This section covers using numbers, strings, dates, control statements, arrays, functions, objects, and regular expressions. By the time you have completed this section, you will have a grasp on the JavaScript language.

The Next Level
The remaining section of the book covers more advanced topics. Chapter 13 starts off by covering how to access the DOM with examples on how to create a simple photo gallery and a slide show. The next chapter discusses advanced event handling. It builds on the slide show from example from chapter 13. This section continues with more real world examples such as rotating news headlines and a drop down menu.

Chapter 17 is a treasure of ready to use information. It starts off with covering how to modify the DOM of tables including how to sort items in a table and how to add/remove rows in a table. The second half of the chapter covers how to code forms. This information is valuable for anyone that wants to dynamically update data on a form.

Chapter 18 shows how to use JavaScript to animate. It builds on the photo gallery from chapter 13, to build a carousel photo gallery (similar that seen in iTunes).

Chapter 19 covers using windows from JavaScript (open, close, move, resize, scroll, print), script browser objects (navigator, location, history, screen), and cookies. This chapter seems a little out of place and probably should have been included in Section 2 on JavaScript.

To finish the book, chapter 20 covers how to use popular JavaScript libraries jQuery, Dojo, and Dijits. This chapter only provides a brief look at these libraries. For each library, they provide a reference to the functions in the libraries. I found the reference text hard to read. They heavily used bold text which makes it difficult to read (like using ALL CAPS when typing).

Summary
This book isn't a light read. This book is 743 pages, which is more than most other programming books. But unlike other books, it covers the information for a beginner, intermediate user, and advance user.

Each chapter ends with a set of exercises. These exercises help keep the reader involved.

Throughout the book, the exercises and examples build on each other. I find this to be a useful technic to help keep the reader involved. The sample applications in the book are practical examples that you can use in your application immediately.

Like other Murach books, this book would be ideal for use as training course material. The combination of thorough material and exercises makes it perfect for training course material.

JavaScript and DOM Scripting is available at Amazon.com and your local book stores.
Read More >>

Navicat Giveaway

We are giving away 3 licenses of Navicat (1 for MySQL, 1 for Oracle, and 1 for PostresSQL).

Navicat is a leading administration and development tool for MySQL, Oracle and PostgreSQL which features an intuitive interface and provides a set of useful tool to manage, backup/ restore, import/ export data, create report, synchronize database and connect to remote database server, etc.

Also, Navicat provides a number of tools allowing to perform all the necessary database operations such as creating, editing, and duplicating database objects.

It also offers a well-described wizard system that simplifies your database development tasks. Navicat supports the latest MySQL, Oracle and PostgreSQL Database and runs on Windows, Mac OS X and Linux with multiple databases connection capability.

How to Win
  1. Visit the Navicat web site and find your favorite feature of Navicat

  2. Send an email to contest@codebeach.com. In the email, include:

    Your Name

    Database Choice (Oracle, MySQL, PostresSQL)

    Favorite Navicat Feature

Restrictions: One entry per person. All emails must be received no later than October 24, 2009.
Read More >>

Appcelerator Announces PHP Support for Building Desktop and Netbook Applications

Today at the Zend PHP Conference 2009, Appcelerator®, the leading platform for rapidly developing mobile, desktop, and web applications with web technologies, announced its support for building desktop and netbook applications with PHP. Developers can now use PHP, JavaScript, Python, or Ruby to quickly build native PC, Macintosh, or Linux applications with the web skills they use today.

As netbooks, mobile phones, and devices in-between increase in popularity, extending the reach of applications beyond the browser becomes increasingly important. Yet, learning a new language is time and cost prohibitive in most cases. Applications built for the desktop or netbook using PHP on Appcelerator Titanium(TM) provide the best of both worlds for developers: the performance, rich native experience, and offline capability of the desktop coupled with the speed and ubiquity of PHP development.

Seeing the opportunity for desktop and netbook app development, Titanium community member, Zend Certified Engineer, and software architect Ben Ramsey decided to lead the charge for integrating PHP, with Titanium. Explains Ramsey, "I've been following Titanium development for over a year and it's clear that Appcelerator's approach in leveraging open, ubiquitous tools to create rich, native applications that communicate with web services is the future of not only web development, but cross-platform development in general. I'm pleased to help open up the Titanium platform to the broader PHP community."

"The level of excitement around this release is tremendous. We're very thankful for Ben's contribution to the project and we look forward to bringing application development to this large, diverse audience," said Jeff Haynie, CEO, Appcelerator.

Appcelerator community member Ed Finkler discussed Titanium during his presentation at ZendCon last night. Appcelerator will also be demonstrating desktop development with PHP during ZendCon's Unconference.

PHP developers can download Titanium from www.appcelerator.com and begin building applications immediately. Titanium is licensed under the Apache license v2, so it's free to use for both personal and commercial application development.

Source: PRWeb
Read More >>

Detect Poor Performing Database Code Instantly with Enzo Audit

With Enzo Audit and its client-side popup alerting technology, development organizations and Independent Software Vendors (ISVs) can give developers the tools necessary to know instantly if their SQL code (embedded SQL, Views, Stored Procedures...) violates established performance thresholds, collaborate with senior developers and DBAs, and take corrective action immediately.

Whether your organization develops SQL Server code for internal use or for customers, controlling poor performing database code proliferation is always a challenge. The difficulty lies in three primary areas:

- Early Detection and Tracking
The first challenge developers face is visibility: is the query slow because the database is busy, or is the network slow? Enzo Audit provides actual database performance metrics so that the developer is alerted instantly (through a popup window) if the query is performing poorly. Developers can save the evidence for future resolution or share it with other developers and DBAs.

- Established Performance Guidelines
The second challenge developers typically face is related to guidelines: what is considered poor performance? Since complex SQL code can be difficult to improve, it is important to provide clear guidelines to developers on what is considered good enough or not acceptable. With Enzo Audit development departments can establish clear guidelines that are used to trigger popup alerts on developer's workstations.

- Progress Report
Development managers also face multiple challenges when it comes to database performance: is the code ready for release? What are the unresolved performance issues? What is the overall progress from the previous release? Enzo Audit comes with three reports that provide enough information to give management teams the necessary information to answer these questions, providing better visibility into a product's actual performance footprint.

"Large software development organizations have a difficult time managing their database performance objectives and meeting customer expectations" explains Herve Roggero, Managing Partner of Pyn Logic. "Most solutions available today address performance problems once they are already in production. With Enzo Audit, companies have a fighting chance to prevent them in the first place."

OPPORTUNITY: Reduce Support Costs
The size of a support department largely depends on the overall quality of software products found in customer production environments. Creating poor performing SQL code can yield to more expensive support operations and may require dedicated support engineers knowledgeable in database performance tuning. As most quality assurance professionals can attest, detecting defects early in the software development lifecycle (SDLC) reduces overall support costs.

With Enzo Audit, development organizations can provide enough information to developers to detect and fix database performance early in the development lifecycle, before the code is ever released in production. Over time, managers can refine established performance thresholds to continuously improve a system's performance objectives, hence improving customer satisfaction and reducing database performance-related support costs.

Enzo Audit offers many features that allow software departments to take control of their SQL Server performance objectives. Enzo Audit is designed as a hub-and-spoke system and as such scales to dozens of developers easily without impacting database performance.

Try Enzo Audit for free for 30 days by visiting Pyn Logic at www.pynlogic.com.

About Pyn Logic
Pyn Logic LLC, headquartered in Wellington, Florida, combines deep technology expertise and strong management consulting to develop unique security and performance solutions for SQL Server. For more information go to www.Pynlogic.com or email at info(at)Pynlogic.com.

Source: PRWeb
Read More >>

Exporting your SketchFlow project with Expression Blend 3

In this video tutorial, learn how to export a SketchFlow project for client, designer and developer use.

Read More >>

Adding Feedback and Annotations in the SketchFlow Player with Expression Blend 3

In this video tutorial, learn how clients can use the annotation feature to speed up the design evolution process.

Read More >>

Using Sample Data in SketchFlow with Expression Blend 3

In this video tutorial, learn how to easily use the Sample Data features within a website.

Read More >>

Working with Behaviors in SketchFlow with Expression Blend 3

In this video tutorial, explore how complex application behaviors can be added using Behaviors.

Read More >>

Working with the SketchFlow Animation Panel with Expression Blend 3

In this video tutorial, learn how to create animated behavior using the SketchFlow Animation panel.

Read More >>

Working with States in SketchFlow with Expression Blend 3

In this video tutorial, learn how to use the States panel to record layout changes and create animations that users can view and interact with in the SketchFlow player.

Read More >>

Adding Navigation to Buttons in SketchFlow with Expression Blend 3

In this video tutorial, learn how to enable realistic navigation within a prototype by enabling user interaction with buttons.

Read More >>

Working with Components in a SketchFlow Project with Expression Blend 3

In this video tutorial, learn how to add common components across pages.

Read More >>

Using SketchStyle Controls to Enhance a SketchFlow Layout with Expression Blend 3

In this video tutorial learn about using SketchStyle Controls to Enhance a SketchFlow Layout with Expression Blend 3.

Read More >>

Building Basic Layout in SketchFlow with Expression Blend 3

In this video tutorial, learn how to add basic components to navigation screens. Working with the Asset Library.

Read More >>

Introducing SketchFlow with Expression Blend 3

In this video tutorial, explore a final SketchFlow project and the benefits of the prototyping workflow.

Read More >>

Zend Server 5.0 Slashes Problem Resolution Time, Boosts Performance of PHP Web Apps

Zend Technologies, the PHP company, today released a public beta of Zend Server 5.0, a major new version of the company’s enterprise-ready PHP Web application server. Zend Server 5.0 includes a ground-breaking new feature – Code Tracing – that enables users to slash problem resolution time by up to 50 percent. For the first time, PHP developers and administrators can quickly pinpoint the root cause of a problem in production by viewing a “digital documentary” of the execution of their application – similar to a black box flight recorder in an airplane – and avoid the time-consuming task of recreating the problem.

“Zend Server gives organizations everything they need to deploy and manage business-critical Web applications, including the most up-to-date PHP, advanced application monitoring, and consistently high performance,” said Andi Gutmans, CEO and co-founder at Zend. “With Zend Server 5.0, we are revolutionizing how PHP developers can manage their production servers, significantly reducing the time spent on root cause analysis and resolution. We are proud to be the first to deliver this enterprise-grade feature to businesses using PHP.”

Zend Server is an essential part of Zend’s professional integrated solutions for developing and managing business-critical Web applications. Zend Server includes a complete, up-to-date PHP stack for PCI compliance, advanced monitoring and diagnostics for application reliability, industry leading code acceleration and page caching to maximize performance. This is coupled with access to Zend’s expert technical support, online updates, hot fixes and security patches. Zend Server is fully integrated with Zend’s Studio PHP IDE, Zend Framework, the most popular open source framework creating the fastest and easiest solution for developing and deploying reliable and secure Web applications.

The Code Tracing feature in Zend Server 5.0 takes root cause analysis to a whole new level, enabling operations, quality assurance, and development staff to significantly boost productivity and enhance application reliability. Similar in concept to an airplane black box flight recorder that captures the data required to analyze flight problems, Zend Server Code Tracing captures the full execution of an application in real-time, so IT staff can quickly find the root cause of a problem without having to reproduce it. Code Tracing can be turned on and off by Zend Server’s Event Monitoring capability so that real-time PHP code execution is captured only during specified events, such as those triggered by performance degradation or other error conditions. The trace is displayed in the Zend Server Web console to enable staff to view the complete execution history of an application and definitively pinpoint a problem’s root cause. Zend Server Code Tracing can cut problem identification and resolution time by up to 50 percent.

In addition to Code Tracing, Zend Server 5.0 includes many other features to maximize the performance and reliability of PHP Web applications, such as Job Queues. Zend Server Job Queues increases application performance and responsiveness by allowing jobs (tasks) to be performed asynchronously or at recurring intervals, offloading long-running tasks from Web servers to back-end servers. End users experience snappy responses in their Web browser while long-running jobs like credit card processing, shipping and other activities proceed in the background. In addition, maintenance tasks such as database cleanup and RSS feed pulls can be run at specific times or at recurring intervals. The Job Queue feature is fully integrated into the Zend Server monitoring system and Web console, giving developers and other IT staff one place to monitor the overall execution of their application.

Zend Server also includes support for PHP 5.3, enabling programmers to more easily maintain, organize, and deploy concise, professional code for their applications with modern language features like namespaces and closures.

With Zend Server 5.0, the product line will also support IBM i, in addition to Linux and Windows.

For a complete list of new features and functionality in Zend Server 5.0, please go to the Zend Web site at http://www.zend.com/products/server/zend-server-5-new.

Availability
A public beta version of Zend Server 5.0 is available today and can be downloaded directly from the Zend Web site at http://www.zend.com/products/server/zend-server-5-new. The Zend Server 5.0 production release will be available by the end of the year.

About Zend Technologies
Zend Technologies, Inc., the PHP Company, is the leading provider of products and services for developing, deploying, and managing business-critical PHP applications. PHP runs 35 percent of the world’s Web sites and has quickly become the most popular language for building dynamic Web applications. Deployed at more than 30,000 companies worldwide, the Zend family of products is a comprehensive solution for supporting the entire lifecycle of PHP applications. Zend is headquartered in Cupertino, California.

For more information, please visit http://www.zend.com or call +1 408-253-8800.

Zend, Zend Technologies, Zend Framework, Zend.com, Zend Server, and associated logos and icons, are trademarks of Zend Technologies, Inc. and may be registered in certain jurisdictions. All other trademarks are the property of their respective owners.

Source: PRWeb
Read More >>

Embarcadero DB Optimizer 2.0 Reduces the Complexity of SQL Tuning

Embarcadero, a leading provider of multi-platform database tools and developer software, is adding more graphical capabilities to DB Optimizer to make it easier for developers and DBAs to do SQL profiling and tuning.

With the new DB Optimizer 2.0, Embarcadero is innovating on the SQL tuning front by incorporating graphical tools like the Visual SQL Tuning (VST) diagram and the Index Analysis feature that allow developers to quickly understand the components of a SQL query and DBAs to make faster at-a-glance decisions.

"SQL is becoming an essential language for developers, and with assistance from the right tools, they can confidently own more of the SQL performance tuning process to ensure the code they pass to the QA engineer and DBA is fully optimized," said Greg Nerpouni, senior product manager of developer solutions for Embarcadero. "DB Optimizer 2.0 allows users to tune SQL at an expert level, ultimately maximizing database and application performance."

DB Optimizer 2.0 takes SQL tuning beyond standard hint injections and SQL rewrites by offering advanced features such as VST diagrams and Index Analysis.

The new VST diagram displays indexes and constraints on tables and views, as well as the joins used in a SQL statement. This helps developers and DBAs see potential flaws in the schema design such as Cartesian joins, implied Cartesian joins and many-to-many relationships, accelerating trouble-shooting and analysis.

With the new Index Analysis feature, DBAs and developers can fully examine SQL execution paths to better understand which indexes are used, not used, or missing. If an index is missing, DB Optimizer 2.0 offers indexing recommendations for optimum performance.

"These new features help support a best-practices approach to troubleshooting performance issues and optimizing SQL code," added Nerpouni.

About DB Optimizer
DB Optimizer is an easy-to-use, easy to install SQL profiling and tuning IDE that supports IBM® DB2® for LUW, Oracle®, Microsoft® SQL Server and Sybase®. DB Optimizer helps eliminate performance bottlenecks by identifying data intensive or frequently executed queries, focusing on specific SQL statements through query statistics (CPU, I/O, wait times), and fine-tuning problematic statements.

For a video demonstrating what's new with DB Optimizer 2.0, please visit http://altd.embarcadero.com/download/video/DBO/dbo-20-sql-task-analyzer.mp4.

Pricing and Availability
Embarcadero DB Optimizer 2.0 is now available worldwide as a standalone tool or as part of the Embarcadero All-Access tool chest. North American pricing begins at $1,500 per license. For more information, visit www.embarcadero.com/products/db_optimizer.

About Embarcadero Technologies
Embarcadero Technologies, Inc. is a leading provider of award-winning tools for application developers and database professionals so they can design systems right, build them faster and run them better, regardless of their platform or programming language. Ninety of the Fortune 100 and an active community of more than three million users worldwide rely on Embarcadero products to increase productivity, reduce costs, simplify change management and compliance and accelerate innovation. Founded in 1993, Embarcadero is headquartered in San Francisco, with offices located around the world. Embarcadero is online at www.embarcadero.com.

Embarcadero, the Embarcadero Technologies logos and all other Embarcadero Technologies product or service names are trademarks or registered trademarks of Embarcadero Technologies, Inc. All other trademarks are property of their respective owners.

Source: PRWeb
Read More >>

Using Expression Web 3 Publishing Features

In this video tutorial, learn how to publish a website using FTP.

Read More >>

Adding DeepZoom Content to a Webpage Using Expression Web 3

Learn how to add a DeepZoom project to your pages.

Read More >>

Inserting Silverlight Video into Expression Web 3

Learn how to add Silverlight video to your pages and customize the video player skin and encode the video using Expression Encoder.

Read More >>

Using Dynamic Web Templates in Expression Web 3

Discover how to generate additional pages in a site using Dynamic Web Templates. Creating a Dynamic Web template allows you to generate additional pages in your web site based off of the original file.

Read More >>

Inserting Silverlight Content into an Expression Web 3 Page

Discover how to add an animated Silverlight header into their web page.

Read More >>

PHP IDE Roundup

This is a roundup of the available PHP IDEs both free and commercial. You will find a wide range in pricing (free to $400) and options available on Windows, Linux, and Mac OS X including PHPAnywhere which is a web-based IDE.

If there are additional IDEs not covered here, please post a comment.

Commercial PHP IDEs

Delphi for PHP
Delphi for PHP revolutionizes web development with a completely integrated, rapid visual development approach and component framework for PHP. The proven and familiar RAD approach means you are quickly up to speed and productive.
Platforms: Windows
Free Trial: 30-day free trial
Price: $299.00

EditRocket
EditRocket, a Text and Source Code Editor with support for over 20 programming languages, includes a powerful PHP editor that strives to make PHP development quick, easy, and enjoyable.
Platforms: Windows, Linux, Mac OS X
Free Trial: 30-day free trial
Price: $39.95

NuSphere PhpED
PhpED is the Integrated Development Environment for PHP (PHP IDE), HTML, CSS, XML, SMARTY, XHTML and other. Balanced combination of advanced code editor, reliable dbg debugger, productive database connectivity client and fast and secure deployment abilities make PhpED a complete solution for most sophisticated developer needs.
Platforms: Windows
Free Trial: 30-day free trial
Price: $119 and up

phpDesigner
phpDesigner is more than just a PHP IDE and PHP EDITOR - it's also a full-featured HTML-, CSS- and JavaScript editor boosted with features so you can get your work done -- for both beginners and professional developers! phpDesigner assists you with everything from editing, analyzing, debugging to publishing websites powered by PHP, HTML, CSS to JavaScript plus other languages! phpDesigner supports not only working with your favorite PHP frameworks but also popular JavaScript frameworks jQuery, Ext JS, YUI, Dojo, MooTools and Prototype!
Platforms: Windows
Free Trial: 21-day free trial
Price: 99 euro

PHPEdit
PHPEdit is an integrated development environment specialized for PHP, the most popular web scripting language in the world. PHPEdit integrates all the tools you will need to carry out your web application projects.
Platforms: Windows
Free Trial: 30-day free trial
Price: 89 euro

Rapid PHP
Rapid PHP editor is a powerful, quick and sophisticated PHP editor with features of a fully-loaded PHP IDE and speed of the Notepad. Convenient features enable you to instantly create and edit not only PHP, but also HTML, XHTML, CSS and JavaScript code, while integrated tools allow you to easily debug, validate, reuse, navigate and format your code.
Platforms: Windows
Free Trial: 30-use free trial
Price: $39.85 and up

VS.Php
VS.Php is a PHP IDE (integrated development environment) based on Visual Studio IDE. With VS.Php you can design, develop, debug and deploy PHP applications within the Visual Studio IDE. VS.Php key features are around providing rich PHP editor as well as Smarty editing capabilities. Also is the ability to debug PHP scripts locally as well as remotely.
Platforms: Windows
Free Trial: 30-day free trial
Price: $99.99

Zend Studio
Zend Studio 7.0 is the next generation of our professional-grade PHP application development environment. It has been designed to maximize developer productivity by enabling you to develop and maintain code faster, solve application problems quickly and improve team collaboration.
Platforms: Windows, Linux, Mac OS X
Free Trial: Yes
Price: $399


Free PHP IDEs

Aptana Studio
Aptana Studio offers unprecedented support for Ajax combined with today's popular Web platforms. Download Studio standalone or plug it into Eclipse to see for yourself. It's your choice.
Platforms: Windows, Linux, Mac OS X
Price: Free

Code Lobster PHP Edition
Starting developing on PHP, probably you often face the problem which IDE to choose for Windows OS. Code Lobster offers a multifunctional IDE FREE absolutely with all standard features: PHP/HTML/CSS/JavaScript highlighting, advanced PHP/HTML/CSS/JavaScript autocomplete, Powerful PHP debugger, SQL autocomplete, Context and Dynamic Help and much more...
Platforms: Windows
Price: Free

Dev-PHP
Dev-PHP is a well-featured IDE for PHP. Fast and powerful, it is easy to use and has a lot of cool features: class browser, scripts preview, integration with PHP parsers, PHP-GTK library, and Xdebug of course. Dev-PHP-usb slips even into your pocket.
Platforms: Windows
Price: Free

Eclipse PDT
The PDT project provides a PHP Development Tools framework for the Eclipse platform. This project encompasses all development components necessary to develop PHP and facilitate extensibility. It leverages the existing Web Tools Platform (WTP) and Dynamic Languages Toolkit (DLTK) in providing developers with PHP capabilities.
Platforms: Windows, Linux, Mac OS X
Price: Free

Komodo Edit
Komodo Edit supports PHP, Python, Ruby, Perl and Tcl, plus JavaScript, CSS, HTML and template languages like RHTML, Template-Toolkit, HTML-Smarty and Django.
Platforms: Windows, Linux, Mac OS X
Price: Free

Netbeans
The NetBeans project offers a version of the IDE tailor-made for developing PHP sites. PHP developers do not need to install the full Java Development Kit (JDK) to run the NetBeans PHP IDE, the standard Java Runtime Environment (JRE) is sufficient. The NetBeans PHP editor is dynamically integrated with NetBeans HTML, JavaScript and CSS editing features such as syntax highlighting and the JavaScript debugger. NetBeans IDE fully supports iterative development, so testing PHP projects follows the classic patterns familiar to web developers.
Platforms: Windows, Linux, Mac OS X, Solaris
Price: Free

PHPanywhere
Develop and maintain your php applications in almost any browser, with all the comfort that you are used to in any desktop ide, with one major advantage: you can do your work anywhere (hotel, internet caffe, etc.)
Platforms: Web based
Price: Free

Shishkabab PHP IDE
This IDE was created to have a fast and stable PHP IDE. It is programmed in C++ using Qt/KDE technology, so it runs on Linux and BSD based systems.
Platforms: Linux and BSD
Price: Free
Read More >>

An Introduction to Inserting Silverlight with Expression Web 3

Discover the various ways that Silverlight content such as rich media video, games and DeepZoom content can easily be added to your website.

Read More >>

Working with the DOM View in SuperPreview with Expression Web 3

Learn how to work with the HTML DOM using SuperPreview in Expression Web 3.

Read More >>

Identifying the Source of Layout Problems in SuperPreview with Expression Web 3

Learn how to identify the source of layout problems in SuperPreview with Expression Web 3.

Read More >>

Defining Baseline Browsers and Comparing Image Mock Ups in SuperPreview with Expression Web 3

Learn more about Super Preview, a new visual diagnostics tool in Expression Web 3 that let's you test your websites right in the browser of your choice.

Read More >>

An Introduction to SuperPreview in Expression Web 3

Learn more about Super Preview, a new visual diagnostics tool in Expression Web 3 that let's you test your websites right in the browser of your choice.

Read More >>

How to Pad a Number with Leading Zeros in Java

This Java tutorial shows how to pad a number with leading zeros.

In Java 1.5, Sun addd the format() method to the String class. This is a static method on the String class. This method allows you to format a string including padding the string with 0. For more information on the format string that can be used in the format() method, visit the javadoc.

In this example, the string will be padded with up to 10 zeroes. The format string used is "%010d". The first part of the string "%0" tells it to pad the string with zeros. The "10" tells it to pad it with up to 10 zeros. The "d" tells it to format the number as a decimal integer.

int invoice = 1234;

String paddedInvoice = String.format("%010d", invoice);

System.out.println(paddedInvoice);

Below is the result of the output:
0000001234
Read More >>

Understanding Layout Containers in Expression Blend 3

Venture into gaming and learn more about organizing artwork. Includes: hiding and showing objects and canvases in Expression Blend, locking objects and canvases, rearranging objects, stacking order-resizing, using a viewbox.

Read More >>

Wolfram|Alpha Web Services API Released

Today, Wolfram|Alpha has released a REST-based web services to access the Wolfram|Alpha platform.

Use the Wolfram|Alpha Webservice API to access and control every aspect of Wolfram|Alpha—from extracting individual data results to generating complete formatted output. Use the API to seamlessly integrate knowledge-based computing into any web or software project, large or small.

Some of the features:
  • REST-style API

  • structured XML output

  • results as images, text or HTML

  • Unicode support

  • Bindings for Java, .NET, Python, Ruby, Perl, PHP

All of the web service API plans are paid plans (no free meal). Pricing plans start at $60 for Developer and Personal Plans and go up from there.

For more information, visit Wolfram|Alpha web services page. Read More >>

Microsoft Expression Web 3 Overview

An overview of the new features Expression Web 3 provides for helping create and maintain exceptional websites.

Read More >>

Microsoft Expression Blend 3: Overview

A quick tour of the new features available in Expression Blend 3.

Read More >>

ActiveBase Is Providing a Free SQL Improvement Automation Tool for Oracle Databases

ActiveBase (www.active-base.com) has released ActiveBase SQL Expert™ - a SQL improvement automation tool for Oracle DBAs and developers, improving execution time for business application's SQL requests by 5, 10 or more. This tool is offered at no charge, and is available for download from our web site (www.active-base.com/download_sqlexpert.asp)

The ActiveBase SQL Expert™ improves execution time for business application's SQL requests by 5, 10 or more. With quick Installation it is fully operational within minutes, automatically identifying SQL improvements for all types of applications running on Oracle versions 8i and above.

In today's world, confronted with recession and ever growing work load, automation is a proven way for increasing productivity and saving costs. This is why ActiveBase has developed the first automated SQL Improvement Factory™ which provides unprecedented productivity gains in improving application performance on Oracle databases.

With shrunk IT budgets in many of our customers, we have decided to release one of our break-through components ACTIVEBASE SQL EXPERT™ at no charge.

ActiveBase SQL Expert™, the newest module of the ActiveBase's SQL Improvement Factory™, helps the DBA and SQL developer by automating the process of finding the right Oracle Hint, for a given SQL statement.

The "right Hint" is the one that, when added to the original SQL statement, produces the best result (shortest elapsed time or the least CPU or I/O consumption). Oracle Hints can improve the way the Oracle optimizer executes queries without changing its logic.

Through its simple graphic interface, ActiveBase SQL Expert™ completely automates the process of finding the best alternative, without any extra effort.

1. Select un-tuned SQL requests from your applications or from current Oracle SGA
2. Let the Expert automatically find different alternatives (SQL + 'Hints') generating multiple unique execution plans; then let it execute the alternatives against a database to find the best result.

Other modules in the automated SQL Improvement Factory™ include:
ActiveBase Tuning Robot™ - SQL Optimizer Automation Factory.
ActiveBase Performance™ - Fix SQL requests transparently without touching source-code™
Read More >>

All About the SaveFileDialog Feature in Silverlight 3

Laurence Moroney demonstrates a simple, but useful addition complimentary to the OpenFileDialog, introducing us to the SaveFileDialog feature in Silverlight.

Read More >>

Publishing Silverlight Projects to the Web using Expression Blend

Discover how Silverlight applications are published locally and then walk through the process of moving your final project to the Web.

Read More >>

What is Silverlight?

An overview of the Silverlight technology and the workflow using Expression Studio.

Read More >>

Beginning Adobe Flex Tutorial

Adobe Flex 3 is a development environment used to create both windows and desktop applications that can be run on Windows, Mac or Linux systems. Adobe Flex is used to create programs with Actionscript 3 and MXML. It is perfect for Rich Internet Application Development and is easy to learn-- especially if you already know HTML or Actionscript programming. Adobe Flex 3 is similar to Flash, but the environment uses a screens metaphor instead of timeline metaphor for development.

This tutorial takes you through developing your very first interactive application in Adobe Flex.




Read More >>

Creating an MP3 Player with Flash CS4

Have you ever wanted to create your own MP3 player using Flash CS4?

This tutorial is hosted by Mark Lassoff from LearnToProgram.TV will show you how. In this first video, the groundwork is laid for a completely functional MP3 player. Mark will help you set up the project in Flash CS4, adjust the properties of the stage, create an instance of a button component and write the necessary Actionscript 3.0 to make the whole thing work.

This is a great opportunity to learn how to make a complex Flash CS4 movie that depends on Actionscript 3.0's sound objects. In the end you will be able to create an MP3 player in Flash that has a volume control, pan control, shows ID3 tags, the time a song has been playing and lets the user select between several available MP3s.




Read More >>

iPhoneDevCamp Taking Place October 17 and 18, 2009 at the University of Calgary

iPhoneDevCamp 1 (yyc), produced by Robots and Pencils Inc., is taking place this weekend at the University of Calgary. The 2 day barcamp style un-conference starts at 9am and is open to people wanting to learn more about iPhone development, marketing, business models and funding.

The list of key speakers confirmed for iPhoneDevCamp 1 includes:
  • Jon Lam of the iPhoenix Fund 1
  • Michael Sikorsky of Robots and Pencils Inc.
  • Mark Donovan of the Happy App Company Inc.
  • Michael Loh of iKingdom Corp.
  • Stephen Gazzard of Broken Kings Inc.
  • Brenden Duddridge of TapForms.com
The 2 day event also includes an AppsTrack where conference participants can spend the weekend developing an iPhone App.

To learn more about iPhoneDevCamp 1 or to register visit: http://yyc.iphonedevcamps.org/

Source: PRWeb
Read More >>

nWire for PHP Released: Real-Time PHP Code Visualization and Exploration

nWire Software, Ltd., an independent software vendor offering innovative Eclipse-based tools, today announced the general availability of nWire for PHP. nWire for PHP accelerates PHP development by helping developers navigate through their code and better understand the architecture of their application. nWire was developed with support from Zend, the PHP Company, and it is the first plugin to be based on the new Zend Studio 7 and the latest Eclipse PHP Development Tools 2.1 (PDT).

"Large, complex, PHP applications can be overwhelming, even for the most experienced web developer. Reading an individual piece of code is easy, the challenge is understanding the structure of the application, getting the bigger picture. It turns out that most developers spend more time on reading and understanding code than writing it," said Zviki Cohen, founder and chief software architect for nWire Software. "Having a centralized view of all the application components and associations, coupled with unique search and visualization tools expedites the coding process greatly. We aim to make developers more productive and shorten the learning curve for new developers."

nWire adds a unique view into how single components (e.g. classes, method) fit within a project's architecture and its dependent relationships. For the first time, PHP developers gain valuable insights regarding their code. With a few clicks one may instantly determine where a given file is being used, where a class is instantiated, where a method is invoked and much more.

"As PHP applications scale and meet rapidly expanding requirements, the use of advanced, design-pattern based architectures is becoming more and more widespread. While advanced frameworks like Zend Framework provide great basis to build on, making the most of them can sometimes be challenging.", said Zeev Suraski, co-founder and CTO at Zend Technologies (zend.com). "nWire's solution, sporting tight integration with Zend Studio 7.0 and PDT, enables developers to build and maintain complex, large-scale applications while greatly reducing the time and pain normally involved with understanding existing application architecture and code. I believe many developers will find it as an invaluable addition to their toolbox."

nWire utilizes intelligent static code analysis techniques during the coding process to keep a live database of the application components and associations. The following tools are available:

  • nWire Navigator - a unique tool for browsing any type of association in the application code: type inheritance, file inclusion, method invocation and more. This view can be synchronized with the PHP code editor to provide instant context while reading the code.
  • nWire Quick Search - search as you type for any element in the system, including methods and fields. Once a relevant component is found, a single click will reveal all its' associated components.
  • nWire Visualizer - graphically browse the system elements and visualize the associations between them. Filter the associations to produce different types of graphs. Exported images serve as a time saving enhancement for code reviews and developer documentation.

The key benefits of nWire:
  • Reduce the learning curve for new developers, including contractors. nWire can lead to substantial budget savings when outsourcing development tasks.
  • Expedites modifications to existing code by developers other than the original author.
  • Improve software quality. Full understanding of the application architecture contributes to keeping it sound and prevents bugs beforehand.
  • Reduce the testing time after a code change. Using nWire, the developer or QA engineer may determine which pages might be affected by a given code change and focus the testing on relevant parts.
nWire requires no special configuration nor code adaptation and provides a simple installation process, based on the Eclipse standards. nWire for PHP is available today at an introductory price of $59 for a perpetual license (volume discounts available). A free, 30 day trial is available on the nWire web site.

In other news
nWire for Java version 1.2 was released today with important enhancements like a smarter navigator view and improved performance. nWire for Java can be installed alongside with nWire for PHP.

About nWire Software
nWire Software, Ltd, is an independent software vendor offering innovative and unique software development tools based on the Eclipse platform. The vision of nWire Software is to assist developers in maximizing their potential by offering simple and pragmatic tools for boosting productivity. nWire Software Ltd was established in 2007 and is headquartered in Tel Aviv, Israel.

For more information, please visit http://www.nwiresoftware.com or call +1-212-203-0665.

Source: PRWeb
Read More >>

Get the Current User Directory in Java

This Java tutorial shows how to get the current user directory in Java.

The default temporary directory location is specified in the user.dir system property. To get the value, use the System.getProperty() method to get the value.
String userDirectory = System.getProperty("user.dir");

System.out.println(userDirectory);
Read More >>

Get the Operating System Temporary Directory in Java

This Java tutorial shows how to get the operating system temporary directory.

The default temporary directory location is specified in the java.io.tmpdir system property. To get the value, use the System.getProperty() method to get the value.
String tempDirectory = System.getProperty("java.io.tmpdir");

System.out.println(tempDirectory);
Read More >>

Get the Current Year in Java

This Java tutorial shows how to get the current year. This tutorial will use the SimpleDateFormat to get the year.

To get the year, the SimpleDateFormat class will be created with "yyyy". For more information, refer to the SimpleDateFormat class documentation.

The final step of getting the current year is to call the format() method in SimpleDateFormat. This method will return a formatted string based on the string provided to the SimpleDateFormat constructor. In this example, the format() method will return a four digit year.

The following code example puts it all together to show how to get the current year.
import java.util.Date;
import java.text.SimpleDateFormat;

...

Date today = new Date();

SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyyy");
String year = dateFormat.format(today);
Read More >>

Determine Palindromes using Java

This Java tutorial shows how to determine if a string is a palindrome using Java.

First, what is a palindrome. From Wikipedia:
A palindrome is a word, phrase, number or other sequence of units that can be read the same way in either direction.

In a previous tutorial, we showed how to reverse a string. This tutorial takes it the next step and checks to see if the string is a palindrome.

To determine if it is a palindrome, we have added an extra line to compare the reverse string is the same as the original string. If it the same, it is a palindrome.
//Original String String
originalString = "Radar";

//Create a StringBuffer from the original string
StringBuffer buffer = new StringBuffer(originalString);

//Reverse the contents of the StringBuffer
buffer = buffer.reverse();

//Convert the StringBuffer back to a String
String reverseString = buffer.toString();

//Determine if the string is a palindrome
boolean isPalindrome = originalString.equalsIgnoreCase(reverse);

//Print the original and if it is a palindrome
System.out.println("palindrome: " + originalString + " - " + isPalindrome);

Below is the output from the sample code above:
palindrome: Radar - true


Some definitions of palindromes allow for the exclusion of spaces and punctuation. If you want to exclude spaces and punctuation, you can replace all spaces and punctuation before creating the StringBuffer.

//Replace spaces and punctuation
originalString = originalString.replaceAll("[ ,.?!]", "");
Read More >>

Oracle Performance Tuning With Solid State Disk Book Provides Valuable Performance Tuning Guidance for Database Administrators

Mike Ault today announced the publication of Oracle Performance Tuning With Solid State Disk, a book that helps Oracle database administrators (DBAs) improve their database performance. The book is written by Oracle expert, Mike Ault, with contributions from Jamon Bowen, Joe Bromley, and Matt Key, all experts on Solid State Disk (SSD). The increasing popularity of Solid State Disk (SSD) is challenging DBAs to adapt their database performance tuning methodologies in order to optimize application performance and return on investment. This new book delivers up to the minute, practical guidance that empowers DBAs to target SSD technology to those database areas that will benefit most.

Dramatic decreases in the cost of SSD over the past five years are changing Oracle architectures. Deploying SSD in place of hard disk drives can result in immediate performance gains as both Random Access Memory (RAM) and Flash SSD eliminate bottlenecks caused by mechanical hard disk I/O latency. Oracle Performance Tuning With Solid State Disk provides a comprehensive guide that enables DBAs to make the transition to SSD successfully and with confidence. By accelerating Oracle databases, applications can handle more transactions, more concurrent users and deliver higher profits and productivity gains.

Oracle Performance Tuning With Solid State Disk explains everything the DBA needs to know about SSD, its impact on caching, and the benefits it offers for specific types of Oracle database systems. It is a clear and definitive guide for converting existing systems from hard disk to SSD technology and empowers DBAs to make the logical choice of how and when to use SSD. The book provides an in-depth examination of testing methodologies, with clear examples, that DBAs can use to effectively benchmark and improve their own specific databases.

"Solid State Disk is changing the game for Oracle databases, and how we think about performance tuning," said Mike Ault, renowned author and expert on Oracle database performance. "Whereas in the past a poorly-designed database might take six months and $500,000 in consulting costs to repair, simply installing SSD can mean the database immediately runs more than ten times faster for a fraction of the cost of repairing the source code. We wrote the book specifically for DBAs so that they could easily understand the benefits and limitations of SSD in their specific circumstances, and have all the tools they need to benchmark effectively. Any DBA who wants to keep their performance tuning skills relevant will read this book."

Oracle Performance Tuning With Solid State Disk is published by Rampant Press. As a special introductory promotion, Texas Memory Systems will be giving away a limited number of free copies to visitors to its booth (1227) at Oracle World 2009 from October 12th through 15th. More information about Texas Memory Systems, including self-serve pricing, may be found online at http://www.texmemsys.com.

About Mike Ault
Mike Ault is a recognized Oracle expert and a prolific author, who has published more than twenty Oracle-related books. He is Oracle guru in residence at Texas Memory Systems, where he oversees Texas Memory Systems' sponsorship of StatspackAnalyzer.com, a free tool that is popular in the Oracle community. Mike was an Oracle database specialist at Quest Software. He has more than 17 years of experience as an Oracle DBA and consultant. Mike previously served for six years as a Navy submariner and for ten years as a programmer in Basic and Fortran IV on the PDP-11 architecture, in addition to working with PDP, IBM-PC, Osborne and later VAX-VMS and HP architectures and with the Informix and Ingres databases. In 1990, Mr. Ault began working with Oracle as the only DBA at the Iuka, Mississippi-based Advanced Solid Rocket Motor (ASRM) project for NASA. Since 1990 Mike has used his Oracle expertise in a variety of industries, working in corporate settings as well as independently as a consultant.

Mike has published more than 20 Oracle-related books, including Oracle Administration and Management (Wiley), Oracle DBA OCP ExamCram (Coriolis) and Oracle 10g Grid and RAC (Rampant Technical Press). In addition, he has written articles for Oracle, Select, DBMS, Oracle Internals and several other database-related magazines. Mike is also a frequently high-rated presenter at local, regional and international Oracle conferences, such as GOUSERS, SEOUG, RMOUG, NYOUG, NCOUG, IOUG, OOW, ODTUG, UKOUG and EOUG.
Read More >>

CONNX Solutions Releases CONNX 11 Which Includes 64-Bit and Expanded SQL Support

CONNX Solutions, Inc., a leading provider of simplified data access, management and integration software solutions, announces the release of CONNX 11, which is available today for demonstration, evaluation and purchase. This release introduces 64-bit Windows support, performance increases, several new SQL features and On Demand Connectivity.

CONNX 64-Bit Windows Support
With the upgrade to 64-bit database connectivity, CONNX now allows companies to take advantage of the scalability and performance gains of 64-bit applications, such as Microsoft SQL Server and Oracle. This new support means that the CONNX ODBC/OLE DB Drivers and .NET Data provider can be used in developing 32-bit or 64-bit applications. Also, CONNX Solutions is very pleased to announce a unique 32/64-bit ODBC/OLE DB Bridge feature in this new release. The Bridge feature allows companies to access 32-bit data sources from 64-bit applications, and 64-bit data sources from 32-bit applications.

"We have had many requests for a 64-bit driver to work with 64-bit SQL Server Linked server, 64-bit Oracle heterogeneous data access and other 64-bit applications, and we are pleased that we can deliver this technology," said Larry McGhaw, the CTO & VP of Engineering at CONNX Solutions, Inc.

Speed and Ease of Use Improvements
  • Server performance has been increased by 20% while reducing CPU utilization.
  • Complex expressions in join clauses resulting in significant performance increases with certain queries.
  • Integrated install of DataSync and CONNX Drivers.

Expanded SQL Support Improvements
  • Temp Table Support
  • CONNX now supports the creation of true temporary tables. These tables are session based and are removed when the connection is closed. Temp tables provide a way to perform complex calculations that require intermediate storage.
  • Expanded SQL Support in CONNX Views
  • CONNX Views may now contain SQL DISTINCT, Aggregates, Unions, Subqueries, and Subtables.
  • Support for ANSI SQL COALESCE and NULLIF functions
  • Extended Functions - CONNX_SERVER_VERSION, CastASCONNXType
  • Subquery as a Table Support
  • CONNX now supports the ability to treat a subquery as a table. This powerful SQL feature enables complex SQL statements to be written simply and with better understanding and performance.
Metadata Support Improvements
  • COBOL Copybooks with IMS.
  • RM/COBOL Files.
"With the release of Version 11, CONNX is now firmly established in all levels of the enterprise. The quality of our products and increased functionality make CONNX a great investment in today's economy as well as protection for future technology," stated Douglas D. Wright, President and CEO of CONNX Solutions, Inc.
On Demand Connectivity
With the 'On Demand Connectivity' feature, initial application connection time is shortened by only connecting to those databases specified within the query and not all of the databases it is currently accessing. As a result, companies can now establish a faster connection through CONNX when accessing a large grouping of data sources, but only querying a few.

CONNX 11 is currently available for purchase. Contact CONNX Solutions at 888-882-6669 for pricing information.

About CONNX Solutions, Inc.
CONNX Solutions, Inc. continues to offer standards-based software tools for direct access to enterprise data via SQL regardless of the database type being targeted (relational or non-relational). With CONNX's unique metadata capabilities, VIEWS can be defined using disparate database tables and the CONNX SQL engine will perform the joins for you when accessing or writing to your data through this CONNX TABLE VIEW. CONNX continues to allow an automated way of replacing the 3GL program writing for extracting, transferring, loading of production data to data warehouses as well as synchronizing that data using our DataSync product.

CONNX Solutions' products, CONNX drivers, CONNX DataSync and InfoNaut Professional, have been implemented by over 3,000 organizations worldwide. Government and business entities use CONNX in a wide range of industries, including manufacturing, education, healthcare, financial services, telecommunications, aerospace, and information technology.

For Simplified Data Access, visit connx.com.
Read More >>

Ruby and MySQL Tutorial

1. Introduction

Mysql is a powerful, fast and popular open source relational database management systems and Ruby is a very powerful open source programming language. I want to show you how to use these two powerful tools together to create database powered applications. I will show you how to use the mysql-ruby module. At the end I will also show you how to use Ruby/DBI together with MySQL.

All the examples have been testet with the following sytem:

  • Red Hat Linux 7.3

  • Ruby 1.7.3

  • Mysql-Max 4.0.x (rpm version)

  • mysql-ruby-2.4.x

Some things might be different with MySQL versions smaller than 4.0.

I also have not tested the stuff on a Windows machine, but it should there too. If you have any comments on how to improve this document, please let me know. My native tongue is German and not English, so I am sure that there are some errors in these documents like grammer errors and wrong usage of words. If your english is better than mine and you find some errors, please tell me.


Notation:

I use the same Notation for class methods and instance methods as used in the
Book "Programming Ruby" by David Thomas and Andrew Hunt (For more informations about books
see the end of this tutorial). Example:

Mysql.new means that new is a class method of class Mysql and

Mysql#close means that close is an instance method of a Mysql object.

2. The sample database

First of all, we have to create our sample database. This database will be very, very simple (this document is not about database design). It will be called sampledb and will have one table called words. This table will have three columns holding the translation of some words for the languages German, English and French. First I will show you how to create the sample database using just SQL, and then I will show you how you can do this with Ruby.

Fire up your favourite editor and type (or copy and paste) the following code in the editor:


CREATE DATABASE sampledb;
USE sampledb;

CREATE TABLE words
(
german varchar(30),
english varchar(30),
french varchar(30)
);

INSERT INTO words VALUES('Adler', 'eagle', 'aigle');
INSERT INTO words VALUES('Haus', 'house', 'maison');
INSERT INTO words VALUES('Name', 'name', 'nom');
INSERT INTO words VALUES('Wal', 'whale', 'baleine');

GRANT ALL ON sampledb.* TO rubyuser@localhost IDENTIFIED by 'ruby';



I assume that you have MySQL installed and running. In order to create the sample database save this SQL code to a file called create.sql and then type at your command prompt
mysql -u root -p < create.sql

Then enter the root password for MySQL. If you don't know how to install MySQL and set up the password for the root user (this is not the root user of your Linux or Unix system. Give him a different password than the linux root user. This is for security reasons) then checkout the official MySQL documentations available at http://www.mysql.com or check out a good book on MySQL. (For some book recommendations check at the section recommended books.

The SQL code I showed you here will create the sample database, the table words and will insert four rows of data. And it will grant all privileges on this database for the user rubyuser and set the password for this user to rub. I just wanted to show you the SQL code in case you already know MySQL, so you can see what the sample database will loke like. Now I will show you how to use Ruby for this.

3. Using mysql-ruby

3.1 Installation

First, you have to download the MySQL Ruby Module. You can find it at http://www.tmtm.org/en/mysql/
The installation is very simple. Just type

$ ruby extconf.rb

$ make

# make install #(as root or with sudo)


Often you have to specify where the MySQL header files and the MySQL shared libraries are located on your system. On my system I had to enter this command

$ ruby extconf.rb --with-mysql-include=/usr/include/mysql/ --with-mysql-lib=/usr/lib/mysql/

and then you can run make and make install.

3.2 Classes and Methods


The method names for mysql-ruby are generally the same as the underlying C functions but without the "mysql" prefix. And they are part of classes. So the mysql_qurey C functions becomes Mysql#query, that is a method named query in the Mysql class. There are four classes in mysql-ruby:
  • Mysql

  • MysqlRes

  • MysqlField

  • MysqlError

The first three are derived from class Object and the last is derived from StandardError.

Mysql is the most important one. You create an instanze of it when you want to connect to MySQL.

MysqlRes is for the results for query that return rows like the SELECT statement. According to the MySQL Reference Manual we will call the results returned by a query "result set".

MysqlField allows you to access information about a field like it's name or size.

MysqlError is a class you need when something goes wrong.

In the next paragraphs in this tutorial I will show you how to use these classes.

3.3 creating the sample database

Now we will see mysql-ruby in action. First, please delete the sampledb in your MySQL installation because we will create it again with Ruby. If you don't delete it, you will get an error message during the execution of the following example.

Here is the code for out first example:


#!/usr/local/bin/ruby -w 
# create.rb

require "mysql"

dbname = "sampledb"

m = Mysql.new("localhost", "root", "passwd")
r = m.query("CREATE DATABASE #{dbname}")
m.select_db(dbname)
m.query("CREATE TABLE words
(
german varchar(30),
english varchar(30),
french varchar(30)
)"
)

m.query("INSERT INTO words VALUES('Adler', 'eagle', 'aigle')")
m.query("INSERT INTO words VALUES('Haus', 'house', 'maison')")
m.query("INSERT INTO words VALUES('Name', 'name', 'nom')")
m.query("INSERT INTO words VALUES('Wal', 'whale', 'baleine')")
m.query("GRANT ALL ON sampledb.* TO rubyuser@localhost IDENTIFIED by 'ruby'")

m.close

The code is easy to understand. First we load the mysql module.

Then we create a Mysql Object. Mysql.new is an alias to the Method Mysql.real_connect. We pass the host where the MySQL server is running and the username and the password of the root user to the constructor. Then we create the database with the Mysql#query Method. We pass this method the SQL code to create the database. Then we have to call Mysql#select_db. You always have to select a database before you can work on it like inserting data or creating tables as we do here. (This is like "use sampledb" within an interactive mysql session.

After selecting the database we create the tables and then we insert the data. We have to call Mysql#query for every row we want to insert. If you would have a lot of more rows you would do this in a loop of course.

At the end we call Mysql#close in order to close the connection to the MySQL server.

In MySQL versions small than MySQL 4 there was a function called Mysql#create_db("dbname"). But because the underlying C function is deprecated this method is no longer available. The recommended way to create a database according to the MySQL manual is to connect to the MySQL server and to use the mysql_query function and the SQL command CREATE DATABASE dbname, as we did in our example.

If you still want to use the Mysql#create_db function with Mysql 4.X you can write it on your own like this:

require "mysql"

class Mysql
def create_db(db)
query("CREATE DATABASE #{db}")
end
end

Here we add the method Mysql#create_db to the Mysql class. In Ruby you can always add methods to classes like this. You do not have to change the original source code of the class.

In our method we just call Mysql.createdb which is accessible inside the Mysql class because. Here createdbis called on self which is always the current object. For more on this look in one of the Ruby books recommended at the end of this tutorial.

(Another way to add this method is to change the source code of the mysql-ruby module and recompile it.)

Here I show you how to use this newly created method. First save the above code in a file called mymysql.rb, so you can load it with require.

Put it either in the same directory as the following example or in a directory where Ruby looks for modules, for example /usr/local/lib/ruby/site_ruby/1.6 on many Linux systems.



#!/usr/local/bin/ruby -w

require "mymysql"

m = Mysql.new("localhost", "root", "passwd")
m.create_db("sampledb")


3.4 Querying a database

In this part I will show you various methods on how to get information about the sample database and on how to retrieve date from it.

Getting field informations


In the next listing you see how to get some informations about the fields returned by a query.


#!/usr/local/bin/ruby -w

# example for MysqlRes#fetch_fields and MysqlRes#fetch_rows

require "mysql"

dbname = "sampledb"

m = Mysql.new("localhost", "rubyuser", "ruby")
m.select_db("sampledb")
result = m.query("SELECT * FROM words")
fields = result.fetch_fields
fields.each do |field|
puts field.name
puts field.table
puts field.def
puts field.type
puts field.length
puts field.max_length
puts field.flags
puts field.decimals
end

m.close

After creating the Mysql Object and selecting the sample database we use a simple SELECT statement to get data out of the database. In this example we are not interested in the data itself but on informations about the fields of the result set. The underlying C structure for MysqlField is called MYSQL_FIELD and has the following members:
  • name: name of the field

  • table: name of the table containing the field

  • def: default value of the field

  • type: type of the field

  • length: width of the field

  • max_length: maximum length of the field

  • flags: various bit flags for the field

  • decimals: for numeric fields this contains the number of decimals

For a more detailed explanation of this values please see the MySQL Reference Manual.

The Ruby class MysqlField has methods with the same name as the members of the underlying C structure as you can see in the example above. For many applications you will not be interestedin this values and will not use the MysqlField classes. But for example when you write a management tool for MySQL this values can be very helpful.

Getting data

There are several ways to get data out of a MySQL database. The Mysql#query method returns a MysqlRes object which is a class for the result set returned by a SQL querey. Two very easy to use methods of MysqlRes are MysqlRes#each and MysqlRes#each_hash. First I will show you how to use MysqlRes#each.
#!/usr/local/bin/ruby -w

# example for MysqlRes#each

require "mysql"

dbname = "sampledb"

m = Mysql.new("localhost", "rubyuser", "ruby")
m.select_db("sampledb")
result = m.query("SELECT * FROM words")

result.each do |array|
array.each do |value|
puts value
end
puts
end

m.close

MysqlRes#each is a iterator method that returns an array of field values for every row of the result set. In our example we just iterate over the array with Array#each and print the value to standart output.

The next example demonstrates MysqlRes#each_hash.
#!/usr/local/bin/ruby -w

# example for MysqlRes#each_hash

require "mysql"

dbname = "sampledb"

m = Mysql.new("localhost", "rubyuser", "ruby")
m.select_db("sampledb")
result = m.query("SELECT * FROM words")
result.each_hash do |h|
printf("%-12s %-12s %-12s\n", h['english'], h['german'], h['french'])
end
m.close

MysqlRes#each_hash is an iterator method that returns a Hash for each row of the result set where the fieldname is the key and the fieldvalue is the value of the Hash. The next example is very similar. It again uses MysqlRes#each_hash but now we print the names of the fields and the values for each row of the result set using Hash#each.
#!/usr/local/bin/ruby -w

# example for MysqlRes#each_hash

require "mysql"

dbname = "sampledb"

m = Mysql.new("localhost", "rubyuser", "ruby")
m.select_db("sampledb")
result = m.query("SELECT * FROM words")
result.each_hash do |h|
h.each do |key, value|
printf("%-12s %-12s\n", key, value)
end
puts
end
m.close

Recommended Books

Here a several useful books for Ruby and MySQL users:

Ruby


  • Title: Programming Ruby - The Pragmatic Programmer's Guide

    Authors: David Thomas, Andrew Hunt

    Publisher: Addison-Wesley

    (The Ruby bible - a must have)

  • Title:The Ruby Way

    Author: Hal Fulton

    Publisher: Samspublishing

  • (great cookbook, with a small chapter an using Ruby with MySQL)
  • Title: The Ruby Developer's Guide

    Authors: Robert Feldt, Lyle Johnson, Michael Neumann

    Publisher: Syngress

    (This book has a great section about using Ruby/DBI)


MySQL


  • Title: MySQL Reference Manual

    Authors: Michael Widenius, David Axmark, MySQL AB

    Publisher: O'reilly

    (Print edition of the MySQL manual written by the creators of MySQL themselves. Here is the Online Version):


This tutorial is published under the GNU Free Documentation License.

Read More >>