Monday, March 31, 2008

WhitePages.com Makes Free Search API Available to Developers

WhitePages.com, a leading Web site for finding contact information, today announced that it is making its data available for free in a beta Web services API. To kick off development, the company is sponsoring a contest awarding either a 50" HD Plasma TV or a 15" MacBook® Pro* computer for the best iPhone™* application and the best social networking application.

WhitePages.com provides free access to contact information for millions of people. In 2007 the company more than doubled the size of its database to nearly 180 million people which equals 80 percent of the U.S. adult population. Included in the company's database are 25 million at work listings which give consumers the flexibility to connect with others during the workday and offers an alternative to calling a home number when it is not convenient.

"WhitePages.com has always been focused on helping you find contact information for the people you care about," said Scott Ruthfield, vice president of engineering and technology at WhitePages.com. "The API enables people-centered developers to integrate the high quality data we provide into their own user experiences. Providing contact information in the context of other applications helps make the Internet a more connected place."

WhitePages.com is making available virtually all of the same data available on the Web site for free to developers as part of the beta Web services API. Included are the company's core search types including people search, reverse phone and reverse address. Developers can use the API to create consumer applications, Web sites, and mashups, including integrating into existing applications or combining with other Web service APIs.

More information on the API can be found on the WhitePages.com Developer Blog, and contest details and API documentation can be found at the WhitePages.com Developer Portal. Contest entries must be received no later than May 15, 2008. Winners will be notified on or around May 31, 2008.

To deliver the API to developers, WhitePages.com partnered with Mashery to provide core API management features including credential management, throttling, and metrics. Mashery is the leading provider of Web services and API management solutions, enabling companies to accelerate their web distribution channel.

About WhitePages.com
WhitePages.com, a privately held company based in Seattle, is the most trusted and comprehensive source for consumers to quickly and easily find relevant, accurate contact information in North America. The company's network of sites include WhitePages.com (www.whitepages.com), WhitePages.ca (www.whitepages.ca), 411.com (www.411.com), Address.com (www.address.com), PhoneNumber.com (www.phonenumber.com), and its 1,300 partner sites including Superpages.com, YellowPages.com and Canada411. The on-the-go user can also access contact information via cell phone, Blackberrys and other Web-enabled mobile devices.

*MacBook is a registered trademark and iPhone is a trademark of Apple, Inc.

Source: PRWeb

Saturday, March 29, 2008

LearningRails: Create and Deploy a Web Application in Two Days

Following the success of their inaugural seminar, a new offering of the 2-day LearningRails seminar will be held in San Francisco on April 29-30, 2008. Michael Slater and Christopher Haupt, both former Adobe engineers, have aimed their Ruby on Rails Seminar for web developers, designers and programmers to anyone who has some PHP or .Net experience.

Combining lecture, hands-on labs, and personal attention, the LearningRails Seminar reduces the complications of web development by teaching students from a prepared application, using a step-by-step approach to create and deploy a complete web application.

"To learn to use a highly capable framework like Rails on your own, you can spend months learning it from the bottom up. We help people get up and running quickly by focusing on just what they need to know first, and providing them with proven code to work from," Michael said. "People leave the seminar with a fully-launched web-app that they can develop incrementally." Participants also receive a complete set of software, tools, and documentation on a Flash drive, containing all the code for the application they have built in class, and a hosting environment they can use after the course has ended.

The LearningRails seminar focuses on the core principles for creating an effective web application: views, models, and controllers, as well as basic principles of Ruby and application development in general. Participants will work with Ajax, ActiveRecord, RESTful design, Subversion, and Capistrano during the two-day event.

The inaugural seminar held in February established the validity of this model of learning. As one participant, Chris Madden, shared, "The Seminar was just what I needed. It provided me with the overall knowledge of Rails, Ruby, and deployment that I didn't find in most of the tutorial books that I had completed beforehand."

Details and registration for the seminar can be found at BuildingWebApps.com/seminar.

Slater and Haupt have also launched a Free On-Line Course which includes podcasts and screen shots, and serves as a basic introduction to learning Ruby on Rails.

BuildingWebApps.com is an information portal for web application developers providing a valuable resource for the Ruby on Rails community. The company is focused on the Ruby on Rails platform and also covers related subjects, such as servers, user interfaces and related business issues.

Michael Slater and Christopher Haupt are available to discuss anything related to Ruby on Rails and web application development. Contact michael @ buildingwebapps.com, or call (888) 670-6793 ext. 702.

Source: PRWeb

Thursday, March 27, 2008

Murach's C# 2008 published March 20

Mike Murach and Associates has just published a 2008 edition of their core C# book, "Murach's C# 2008." It's described in detail at the Murach web site:

http://www.murach.com/books/cs08/index.htm

It teaches how to develop Windows forms applications for business the way the best professionals do. To do that, it incorporates the features that have made earlier editions such popular choices among developers.

#1: It focuses on the essential skills that C# developers need every day

That may sound obvious. But too often, critical skills are glossed over or ignored in C# training.

So as this book teaches how to use Visual Studio 2008 and C# 2008 to create business applications, it covers the skills that developers need most on the job. That includes skills like how to validate input data, how to work with different data types, how to use arrays and collections, how to do structured exception handling, and how to read and write text, binary, and XML files.

#2: The OOP section deals with business objects, not cats and dogs

Many books explain object-oriented programming by using examples that are meant to be easily understood, like illustrating objects by creating animal classes such as mammals, cats, and dogs. However, the analogy breaks down as developers try to figure out how to apply it to business applications.

So this book presents business objects like customers, invoices, and products to show how OOP is applied in the real world. Likewise, it explains critical concepts like inheritance, polymorphism, and interfaces within the context of business applications so there's no confusion.

#3: There's a 4-chapter section on database programming

Because database handling is so critical in business applications, this book presents more coverage than is usual in introductory texts.

To begin, it teaches how to prototype database applications using rapid application development tools like the data sources feature, datasets, and bound controls. But beyond that, it shows developers how to start using ADO.NET to work directly with databases for more processing control than the RAD tools offer.

#4: It provides practical coverage of new features, especially LINQ

LINQ is the big news in C# 2008. Using constructs that are built into the C# language, developers can now use the same language to access a variety of data sources from their applications, from databases to arrays to XML files. The introductory chapter on LINQ in this book gives you a practical overview that will prepare you for more in-depth LINQ training.

#5: Complete applications show how all the pieces interact

One key to mastering C# development is to have plenty of applications that show how the features you're learning interact and what problems you might run into as you work on your own. So this book shows complete Windows forms applications for everyday business functions. These can be downloaded for free from the Murach web site, along with coding starts for the practice exercises in the book.

#6: The paired-pages format lets developers set their own pace

Murach books have a distinctive format, where each two-page spread presents a single topic. Both beginning and experienced developers find that this format makes it easy to focus on the information they need, whether they're using the book for training or reference.


"Murach's C# 2008" is available from all major retail outlets and directly from the publisher at the Murach web site:

http://www.murach.com

iPhone SDK Beta 2 released

The second beta version of the iPhone SDK is now available and includes Interface Builder, a powerful tool that allows you to visually build your interface and makes creating a UI as simple as drag and drop.

Apple also added new sample code and updated documentation to the rich set of resources available to you in the iPhone Dev Center.

For more information, the SDK, and source code examples, visit the iPhone Dev Center.

Wednesday, March 26, 2008

Application Virtualization for Enterprise Java

Learn how to take the next step in Java virtualization: achieving flexibility through policy-based, next-generation application virtualization technology.

In this free white paper, learn how to make your computing resources more flexible, responsive, and highly available—all by deploying a management framework to proactively address key Java virtualization challenges. Find out how you can achieve centralized, policy-based control across both virtualized and non-virtualized Java applications, to automate key data center operations and ensure application SLAs are met. Get virtualization under control.

Download your free copy now

Enterprise Java Virtualization

Cut ownership costs by letting enterprise Java applications run directly inside a virtual machine—without overhead from a traditional OS.

In this free executive brief, discover a better, less costly way to run Java on hypervisor-based virtualization platforms. Understand important TCO factors for a virtualized enterprise Java application, as well as the benefits of eliminating the OS layer. Then, discover a useful model for comparing the potential costs of running Java apps under competing architectures. This free brief is a must-read for those charged with keeping TCO low.

Download your free copy now

The Java Virtual Appliance - No OS Required

Learn how a new approach to Java virtualization can make your data center's hardware go farther—and run faster.

This free white paper reveals how a new Java virtualization approach can result in a streamlined "Java Virtual Appliance" that lets you leverage your current hardware for years—without the usual OS overhead. Learn why most servers run at only 10 percent of capacity; how virtualization saves an average of 23 percent on server space, power, and cooling; and how virtual middleware enhances speed, flexibility, and ROI.

Download your free copy now.

Saturday, March 22, 2008

Introduction to Glass Panes in Swing

In the Java Swing classes JFrame and JApplet, the glass pane provides a unique and powerful feature. The glass pane is a layer above all other controls within the JFrame and JApplet. It allows you to paint above all other controls.

In addition to drawing graphics over the contents of a JFrame or JApplet, the glass pane can also be used to handle mouse events. Be aware that adding a mouse listener to the glass pane will prevent any mouse events from being sent to the controls below it.

The first example will demonstrate drawing graphics over all controls in the JFrame.

//Create a panel to use as the glass pane
JPanel panel = new JPanel()
{
public void paintComponent(Graphics g)
{
g.setColor(Color.red);

//Draw an oval in the panel
g.drawOval(10, 10, getWidth() - 20, getHeight() - 20);
}
};

//Turn off the opaque attribute of the panel
//This allows the controls to show through
panel.setOpaque(false);

//Set the glass pane in the JFrame
setGlassPane(panel);

//Display the panel
panel.setVisible(true);
The results of the glass pane:


By setting the opaque attribute on the JPanel to false, it turns of the background of the JPanel. When the panel is painted, only the graphics in the paintComponent will be drawn without the background.

By simply modifying the paintComponent you can create a completely different effect. In the next example, we set the alpha level for the color. This allows a color to be painted while allowing the controls below it to be shown.
//Create a panel to use as the glass pane
JPanel panel = new JPanel()
{
public void paintComponent(Graphics g)
{
//Set the color to with red with a 50% alpha
g.setColor(new Color(1, 0, 0, 0.5f));

//Fill a rectangle with the 50% red color
g.fillRect(10, 10, this.getWidth() - 20, this.getHeight() - 20);
}
};

The results of glass pane:


This tutorial only covers the basics of using the glass pane. There are a number of interesting possible uses of the glass pane. Below are some ideas of things to try with the glass pane:
  • Create a transition effects between screens.
  • Display a progress screen within the glass pane.
  • Display debug information within the glass pane.
Related Links
Swing Hacks -Chapter 6 has some cool examples for creating a progress indicator in the glass pane.

Monday, March 17, 2008

Embarcadero Releases New Eclipse SQL Development Tool

Following on its recent series of announcements of key hires from the Eclipse community, Embarcadero is debuting its new professional-grade SQL development tool, PowerSQL, today at EclipseCon 2008. PowerSQL dramatically improves productivity for Eclipse application developers charged with SQL development.

"With the growing sophistication of J2EE, Ruby on Rails and other development frameworks increasingly dependent on databases, application developers require more depth in knowledge and tooling for the underlying DBMS technologies," said Greg Keller, vice president of product management, Embarcadero Technologies. "PowerSQL brings developers what they expect in an IDE with tremendous depth equaling hundreds of man-years worth of experience in database SQL parsing, connection, debugging and general optimization to produce high-performance SQL."

Embarcadero PowerSQL, the company's fourth tool built on the Eclipse framework, is a SQL IDE (Integrated Development Environment) that can be installed as a standalone application (Eclipse RCP) or as an Eclipse plug-in. It offers native support for Oracle, Microsoft SQL Server, Sybase and DB2 for LUW, as well as JBDC support for other prominent DBMSs such as MySQL. PowerSQL runs on both Windows and Linux operating systems. Its flexibility and compatibility, in addition to a low price-point, make it a must-have tool for application developers who are increasingly working with databases.

"We are seeing an upsurge in the number of traditional developers who are taking on more database work and using SQL on a somewhat regular basis," said John F. Andrews, president and CEO of Evans Data Corporation. "In fact, according to research we conducted in September 2007, SQL is the second most popular language among Eclipse users, with 64 percent using it at least some of the time."

Features of the new Embarcadero PowerSQL tool include:
• SQL Code Assist ensures 100% object name accuracy, even when not connected to a database, plus real-time SQL syntax validation
• SQL Project Insight provides project-level SQL file cataloging and search features to help streamline project organization and maintenance
• Migration Wizard imports data sources from Eclipse DTP (Data Tools Project) or Quest TOAD
• Data Source Explorer enables users to easily navigate, search, extract DDL, execute commands, and even browse an outline view without opening the SQL file
• Formatting Profiles ensure consistent, quality code layout for easy review and extension. Profiles can be customized and shared.

"Embarcadero continues to deliver on its commitment to Eclipse," said Mike Milinkovich, executive director, Eclipse Foundation. "By bringing new Eclipse-based tools to market like PowerSQL, more developers are able to experience the many benefits offered by Eclipse. Embarcadero is a great example of a company that is providing innovative solutions to the Eclipse community."

Pricing and Availability
Embarcadero PowerSQL is now available in three versions worldwide: Personal, Standard and Professional. North American pricing for Personal Edition begins with annual subscription-based options as low as $8.25 per month per developer. Embarcadero PowerSQL can be purchased online at www.embarcadero.com/store. For more information, visit www.embarcadero.com/products/powersql.

About Embarcadero Technologies
Embarcadero Technologies, Inc. delivers professional grade database tools that companies use to design, develop and manage databases and the data they contain. More than 12,000 customers worldwide and over 90 of the Fortune 100 rely on Embarcadero's cross-platform tools to reduce complexity, improve productivity and strengthen security. The company's flagship database tools include: ER/Studio, DBArtisan, Rapid SQL and Change Manager. Founded in 1993, Embarcadero Technologies is headquartered in San Francisco with offices in Melbourne, Australia, Munich, Germany and Maidenhead, United Kingdom. For more information, visit 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

Sunday, March 16, 2008

Improve The Performance Of Your MySQL Server

MySQL is a rock solid, lighting fast database server which has been designed for two factors speed and performance. It is the Ferrari of databases: Light weight, fast and Built for the high speed tracks!

I still hear an awful lot of stories from owners whose databases are running two slow. In my experience, the three main places to look for problems are:

1. Faulty Database Design
2. Bad Queries
3. Server factors

Faulty Database Design
Proper database design is the single most important factor for the ensuring performance and maintainability of the database. Here is what you need to answer when designing a table: Can I reduce the size of data that each row will have? Here is what you can do:

1. Use unsigned numeric values when the application will not store negative numbers. Like the “quantity ordered” of an item in an ecommerce application is never going to be -$125.

2. Use Variable length values instead of fixed length value i.e. used varchar instead of char.

3. Do not use unnecessarily large field sizes. For most ecommerce application “unsigned smallint” is more than enough to store inventory count. A field described as “unsigned smallint” can store a max value of 65535.

4. Don’t ignore normalization; its helps prevent unnecessary repetition of data. The part B of this is, don’t overuse normalization. If the table will not grow in size significantly, there is no point in normalization. For example, if the user table has just 20 rows (i.e. 20 employees in a company), all attempts of normalization are wasted.

5. Use Keys. Don’t decide keys by “The customer id has to be indexed in the order table”. If the order table is being searched 90% of the times by “order date”, it makes more sense to index “order date”.

Remember, how a table will be used should determine how it is designed. Spending time here will save years of frustration.

Bad Queries
It sounds too good to be true but you wont believe the number of developers out there who completely suck at writing queries. There are two types of bad queries:

a) Unnecessary Queries: These are the queries that shouldn’t have been made in the first place. The only way to avoid this is asking, “Do I really need this data?”

b) Inefficient Queries: These are the queries that do not use the underlying table structure or MySQL functions in the correct way.

Here is a starting point to start looking at problem areas:

1. Unnecessary usage of “Select * “statements when the entire processing is being done on a single column. The more data is fetched from the server the more work MySQL has to do and more bandwidth it takes.

2. Using sub-query instead of a join. On a properly designed database, joins are incredibly fast. Using sub-queries just shows a lack of knowledge.

3. Improper use of Keys. This is especially valid for range checks. Remember to use the “Explain” statement to check the usage of keys and then use the “use key” statement in your “where” clauses to force key usage.

Server Factors
Everything done correctly, there still may be some server factors that may be causing the system to be slow. These are:

1. Hardware related
2. Server configuration related

Here is what you can do about the hardware:

1. The more RAM is on the system the better it is. MySQL frequently fetches data from the RAM and more the RAM is on the system, the better it is.

2. Buy the fastest possible RAM! A slower RAM is just irony.

3. Once you are settled with the RAM size and speed, look for processing speed. MySQL can use multiple processors.

Once you are satisfied with the hardware, there are a set of variables in “my.cnf” that you must look at:

a) key_buffer_size: This describes the memory available to store the index keys. The default is 8 MB but you can set it to 25% of the RAM.

b) query_cache_size: This value is by default 0. if you have a lot of repeating queries like in reporting applications etc, make sure you set this value high.

c) table_open_cache: This determines the number of table descriptors that MySQL will keep in the cache. The default value is 64. But, if you have 100 users accessing a table concurrently then this value should atleast be 100. You also have to take into considerations joins etc. Thus, this value should also be kept high.

I hope this article will take one step further in unlocking the mystery of slow servers and help solve some of the problems.

About Author:
Mukul Gupta is the CMO of Indus Net Technologies, an India based Internet Consulting firm which specializes in Opensource solutions. You can reach him at script@script2please.com or visit http://www.script2please.com

Hiding and Displaying the Mouse Cursor in Visual Basic

Pesky, isn't it? I hate that little cursor sometimes, and now I'm armed and ready to kill it. The scourge of mice everywhere, the bane of the arrow, it's the ShowCursor function!

Private Declare Function ShowCursor Lib "user32" (ByVal bShow As Long) As Long

This tutorial is not for the faint of heart, or the verbose... this promises to be quite short. There are only two things you need to know about this API call, how to hide the cursor, and how to show the cursor. Notice I said "hide" not destroy. The ability to click is still there, even though we remove the cursor, there is simply no longer a graphical representation.

To remove the cursor, pass 0 (that's a zero not the letter 'o') as the bShow argument. To replace the cursor, pass 1 as the bShow argument, that's it! Here's an example in case you're a slow learner :)
ShowCursor 0

That would remove the cursor! How quaint. Anyway, I have written a small program that toggles the cursor on and off, so download it if you're still confused.

About this Tutorial
This tutorial is from The Game Progamming Wiki which is published under the GNU Free Documentation License 1.2.

Simple Solution for Php Includes - IFrames

I have recently created my first Php program. I wanted to share with others some of the problems that I encountered, and how I finally overcame these obstacles.

My Reason for needing a Php Include
To start, my most recent website features a free classified advertising solution, a modified version of PhpBB stripped to function as an Article Bulletin Board (No replying), and a link directory. The business model of my Website offers free Classified Advertising, but charges a small fee for enhanced advertisements (Featured, Bolded, and Better Placement). The Classifieds were purchased from a developer, so I had little experience with the application. The link directory was a free resource of an old program that I modernized a bit. I choose the old link directory because the links are clean. They are not replaced with coding to count outbound traffic. I figured this would increase the value of links, to sites who exchanged links with me.

To increase revenue on the new site, I realized that I needed to increase the value of, “Featured Advertisements”. To do this I wanted to randomly rotate featured advertisements, from the classifieds, across my Bulletin Board and Link Directory. Bare in mind, all three are run from a unique table, and I wanted to leave it that way. In addition, I had little experience with the development for all three applications.

I started reading tutorials and utilizing Forums to create a Php program for external pages on the site. The program would pull a random featured ad from the classified table. This program only took me about 32 hours to create, while performing research. I didn't intend to get into the schematics of the program with this post, so forgive me if you are looking for a Random generator. But I would be more than happy to share my code upon request.

The code I created was simple, it worked just the way I wanted, but I ran into one cumbersome obstacle; how do I implement this easily across two unique table driven applications? The answer was to use a Php Include.

I started reading tutorials on, "Php includes and functions and classes". I realized quickly that this was a bit more confusing than creating the actual coding. In addition, I ran into parsing errors if I included the new coding in only one application.

My solution to using the, "Include ()," Php function.

I found that very few people were willing to provide any feedback for such a problem, even in the most resourceful forums for Php Coding and information resources. I fumbled with the coding for over 72 hours. I thought this was a bit ridiculous, as the code itself took less time to create.

I finally came across a helpful solution that may prove beneficial, if you are in the same situation with Php Includes. The code was uploaded onto my server as a file (something.php). I removed the standard, "Php Include ()," function from all links and the PhpBB coding. I then called the Php file (page) using an Iframe tag, on pages I wanted it to appear. This proved to be a successful replacement for the Php Include.

Search Engine Results Using Iframe for Php Include
I waited until Google came around to see how the Iframe affected my sites search rankings. Finally, the other day this happened. The conclusion, my search rankings still increased due to recent link exchanges. The code is working to my needs, and it is easily included on any page that I want, even externals outside my site can call on the code, which opens more doors for advancement.

Here is the simple Iframe code I used to replace the Php Include:

<iframe align=top valign=right width=600 height=105 marginwidth=0
marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling=no
src="http://your.com/file-to-include.php" width=600
height=105></iframe>
Using the Iframe tag for Php Include Conclusion
I have encountered no problems with including my PHP code on pages across external servers, using the iframe as a Php Include. As you can see, it is totally customizable. You can specify the width, height, alignment, border, scrolling, margins and more. The only obstacle that I have encountered, is the style sheet that the site, or page, with the, "Php Include," is not utilized. The page that the code is on seems to need its own unique style sheet.

I hope this proves beneficial to anyone having trouble with running a "Php Include" across various unique online applications.

About The Author
Michael J. Medeiros is the owner of http://www.mjmls.com/. He has worked as an Independent Real Estate Agent for three years, in New Jersey. He has an extensive background in Business and Marketing. Michael’s latest research and attention has been devoted to online business development and the Internet.

More Dockable Forms in Delphi

In this Delphi training guide we look further into Form Docking. In particular we look at the ManualFloat and ManualDock methods to dock and undock forms in code (rather than Drag & Dock).

Wednesday, March 12, 2008

LightScribe Direct Disc Labeling Launches Windows Software Development Kit

LightScribe today announced the immediate release of publicly available Windows software development tools for its Direct Disc Labeling technology. These downloadable tools significantly simplify the creation of LightScribe DVD/CD labeling applications, expanding LightScribe integration beyond general data mastering software. The LightScribe Windows public software development kit (SDK) allows individual application developers to integrate LightScribe support into Windows-based software with a standardized LightScribe application user interface. LightScribe is a no-hassle way to burn professional, silkscreen-quality labels on CDs and DVDs right in the drive. The LightScribe Windows public SDK is available at (http://www.lightscribe.com/go/downloads/windows).

The new Windows SDK gives documented access to new LightScribe software components that provide all the standard functionality a labeling application needs to support LightScribe printing. Because the LightScribe System Software includes a standard set of user-interface components, end users will now have a consistent and accurate user-interface for the print operations no matter what application is used. This greatly simplifies application development, provides a consistent user interface to all users, standardizes end-user messaging and enables rapid application development by all software developers. With this SDK, LightScribe also supports localized applications for most common languages and has simplified its licensing process for software developers.

With the existing broad embrace of LightScribe across more than 90 optical drive and media manufacturers, software developers, and media and computer brands, new software developers can leverage this widely-available embedded disc labeling technology.

"The LightScribe Windows public software development kit allows any Windows developer to enable LightScribe capability," said Kent Henscheid, marketing manager for LightScribe."Thousands of downloads occurred in the first several weeks of the public Windows SDK posting, and we anticipate many new market applications to emerge with LightScribe labeling support."

LightScribe-enabled CDs, DVDs, software, desktops, notebooks, aftermarket optical disc drives and duplicator systems are available at major retailers worldwide, as well as through most leading brands online.

About LightScribe
LightScribe Direct Disc Labeling offers consumers and businesses a simple, no-hassle way to burn professional-looking, silkscreen-quality labels on their CDs and DVDs. LightScribe extends optical media, recorders and software through an integrated system of media with special laser-sensitive coating, laser control and imaging drive modifications, and labeling software enhancements. LightScribe uses the same laser that burns data in the disc drive to create precise, iridescent labels. LightScribe technology was developed and patented by HP. A business unit of HP, LightScribe licenses its technology to optical industry leaders in drive and media manufacturing and to hardware, media and software brands. Additional information about LightScribe is available at www.lightscribe.com.

Source: PRWeb

Saturday, March 8, 2008

Dockable Forms in Delphi

This is an introduction to using Dockable Forms with Delphi. In it we create some multi-coloured forms and dock them into a TPageControl and a TPanel.

Friday, March 7, 2008

Java for iPhone

Infoworld is reporting that Sun will be making Java Micro Edition (JME) available for iPhone. Sun says they try to provide as much native functionality as possible. Sun plans to release it sometime after June.

Although Sun has made this announcement, there maybe legal issues with this. In the iPhone SDK Agreement, it states:

No interpreted code may be downloaded and used in an Application except for code that is interpreted and run by Apple's Published APIs and builtin interpreter(s).
I hope that Apple and Sun can getting the legal issues resolved, so the release of JME isn't prevented.

For the full article, visit InfoWorld.

iPhone SDK Released

Apple has released their SDK for iPhone and iPod Touch. Here's are the main highlights from the news release:

  • Release version of the SDK will be in June
  • Requires an Intel based Mac
  • Applications are developed in Objective-C using Xcode
  • A new tool called Interface Builder will help developers create interfaces (not yet available)
  • Full access to the multi-touch API
  • Full access to the accelerometer. This could really push the creativity of games.
  • There is a simulator for testing on the Mac
  • There is a tool called Instruments that helps measure performance of your application on the iPhone
  • Support for standard APIs like OpenGL and OpenAL
  • Applications can be purchased through the App Store directly from the iPhone
  • It will cost developers $99 if they want to distribute their application
  • The revenue split for applications sold through the App Store is 30% to Apple and 70% to the developer
  • Applications can only run in the foreground

For more information, the SDK, and source code examples, visit the iPhone Dev Center.

Thursday, March 6, 2008

Convert a String to Lower Case in Java

This tutorial will show you how to convert a string to lower case in Java. To convert a string to lower case, call the toLowerCase() method on the string.

Below is an example:

String original = "HELLO";

String lowerCase = original.toLowerCase();

Convert a String to Upper Case in Java

This tutorial will show you how to convert a string to upper case in Java. To convert a string to upper case, call the toUpperCase() method on the string.

Below is an example:

String original = "hello";

String upperCase = original.toUpperCase();

Get the List of Files in a Directory using Java

This tutorial shows how to get the list of files that are in a specific directory using Java. This tutorial will also show you how to filter the files to get only the files you are interested in.

To get the list of files, you need to create a File object for the directory. Next, you can call the listFiles() method on this File object to get the list of files contained in this directory.

File directory = new File("c:\\");
File[] files = directory.listFiles();

for (int index = 0; index < files.length; index++)
{
//Print out the name of files in the directory
System.out.println(files[index].toString());
}

If you don't want to get all the files in a directory, you can create a class that implements the FileFilter (java.io package) interface. The accept() method that you implement will specify the criteria to be used to determine if the file is returned. In our example below, the filter will only return files with "txt" for the extension.

class Filter implements FileFilter
{
public boolean accept(File file)
{
return file.getName().endsWith("txt");
}
}

To use apply this filter, pass an instance of it to the listFiles() method. Below is an example:

files.listFiles(new Filter());

Tuesday, March 4, 2008

Basic PHP Includes

Lets say you have a Web site with 10 or so pages, and you want to update the navigation. You don't want the hassle of updating every single page. That's where PHP includes come in handy.

Your basic include will look like this.

<?php include ( 'includes/navigation.php' ); ?>

That's it! What I typically do is design a page as usual, then begin breaking sections up into includes. To use this effectively:

1) Find sections or tables that will repeat throughout the site.
2) Cut the section of code out and paste it into another file.
3) Save this file into an includes folder.
4) Where the original section was, insert your PHP inclue code, referencing the file name.

Let's say I want to use the highlighted code on multiple pages.

<table>
<tbody>
<tr>
<td>
This table will be on every page.
</td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<td>
This is some other content.
</td>
</tr>
</tbody>
</table>
I'll include it like this.

<?php include ( 'includes/table.php' ); ?>
<table>
<tr>
<td>
This is some other content.
</td>
</tr>
</table>
Now if I change table.php later, it will change on every page automatically. It's just like using image tags, but instead of image files, you are including pieces of html. This can save you hours and hours.

About the Author
Alan Hettinger is a freelance designer available for print, web, and multimedia projects.

Array Variables in Perl

This tutorial walks through using array variables in Perl.

Simple Arrays
You’ve already seen simple arrays. We used them for the “command line” variables. Simple arrays begin with the “@” symbol. If you want a specific value from the array, you index that value using its number in the array. If you want the first item from the array, you ask for “$ARGV[0]”. If you want the third item, use “$ARGV[2]”.

Arrays always use the “@” symbol. Scalar variables always use the “$” symbol. A piece of an array is always a scalar. (You can’t have arrays inside of arrays in simple Perl.) That's why you use “@” to refer to the entire array, and “$” to refer to items within the array. If you want to know how many values are in an array, use the scalar variable $#ARRAY. This is actually the index of the last element, so for the count, you’ll need to add one. For example:

@Names = ("John","Jerry","Steve","Hsiao-Ping","Daniel");
$NameCount = $#Names+1;
print "There are $NameCount names in the array.\n";
foreach $Counter (0..$#Names) {
$HumanCounter = $Counter+1;
print "Name number $HumanCounter is $Names[$Counter].\n";
}
@Names = sort(@Names);
foreach $Name (@Names) {
print $Name;
if ($Name eq $Names[$#Names]) {
print ".\n";
} else {
print ", ";
}
}

The above program should produce the following:

/u5/jerry> arraytest
There are 5 names in the array.
Name number 1 is John.
Name number 2 is Jerry.
Name number 3 is Steve.
Name number 4 is Hsiao-Ping.
Name number 5 is Daniel.
Daniel, Hsiao-Ping, Jerry, John, Steve.

Can you spot a possible problem in the above program? You’d better, because fixing it is going to be an exercise!

Shifting Array Values
You will often shift array values when you are pulling command line options from a command line that can also include filenames. In general on Unix, when a command takes both options and filenames as arguments, the filenames come last. The ‘shift’ function allows you to slide the first element of the array out from under the rest of the elements. It completely removes that element from the array.

while ($ARGV[0] =~ /^-/) {
$currentArg = shift(@ARGV);
#figure out which option this is
#blah blah
}
#go ahead and do the rest on the filenames
while (<>) {
print;
}

Getting a Numeric Array
Suppose you want an array of numbers from 5 to 1000. You could construct it by hand, but Perl will make it for you. We‘ve already done it once with “foreach”:

@Counters = (5..1000);
This numeric construction always counts up by one. If you want to count down instead of up, you can reverse the array:
@Counters = reverse(@Counters);

or, you could combine it into one line with

@Counters = reverse(5..1000);

Sorting Arrays
You can sort arrays using simple or complex methods. The simplest way to sort an array is to use the sort function:

@Names = sort(@Names);

Sort always sorts in alphabetical order. If you want to sort in numerical order, you need to use the more complex version:

@Numbers = sort numerically @ARGV;
sub numerically {
return $a <=> $b;
}

In this case, we’re telling ‘sort’ to use the ‘subroutine’ numerically to determine how to sort the array. A ‘subroutine’ is a bit of code that can be reused without having to retype it. In this case, a sort subroutine is a special subroutine that has its arguments automatically put into $a or $b. The subroutine must return an integer. If this integer is less than zero, sort assumes that $a comes before $b. If this integer is greater than zero, sort assumes that $b comes before $a. If the integer is zero, sort assumes it doesn’t matter.

The operator ‘<=>‘ returns -1 if the item on the left is less than the item on the right, zero if they’re equal, and 1 if the item on the right is less than the item on the left. Go ahead and test it:

print $ARGV[0] <=> $ARGV[1];
print "\n";

You can do whatever you want in your subroutine, as long as it returns predictable integer values based on $a and $b.

The equivalent to ‘<=>‘ for strings is ‘cmp’. Go ahead and replace ‘<=>‘ above with ‘cmp’ and try different strings on the command line.

Other Array Functions

join(@array,$string)
returns the elements of array using string as a delimiter

pop(@array)
returns and removes the last element of array

push(@array,$string)
puts string onto the end of array. Does not return ‘array’.

shift(@array)
returns and removes the first element of array

split($string1,$string2)
returns string2 split into an array wherever string1 occurs

Associative Arrays
Associative arrays start tapping into the database functions of Perl. An associative array is a list of elements, but each element in the array is accessed by an index value that does not have to be a number.

$LastNames{'Jerry'} = 'Stratton';
$LastNames{'John'}='Paul';
$LastNames{'Steve'}='Spear';
print $LastNames{$ARGV[0]};
print "\n";
This array stores the values “Stratton”, “Paul”, and “Spear”. In order to access those values, I need to know the value they’re associated with:
20: lastname Jerry
Stratton
21: lastname Steve
Spear

You’ll use the “delete” function to delete an element of an associative array:

$deletedName = delete $LastNames{'Steve'};

If you need to get a list of all the keys in an associative array, use the keys function:

@FirstNames = keys(%LastNames);
foreach $key (@FirstNames) {
print "$key: $LastNames{$key}\n";
}

Like scalar variables and simple arrays, associative arrays have their own prefix, the “percent” sign. Like simple arrays, you’ll only use the percent sign when referring to the associative array as a whole. When referring to individual elements, you’ll continue to use the dollar sign.

Let’s take a look at a simple program for viewing the passwd file in Unix:

$PASSWDFILE = '/var/yp/passwd';
open PASSWDFILE;
while (<PASSWDFILE>) {
@lineItems = split(':');
$username = $lineItems[0];
$passwords{$username} = $lineItems[1];
$userids{$username} = $lineItems[2];
$groupids{$username}=$lineItems[3];
$names{$username}=$lineItems[4];
$homes{$username}=$lineItems[5];
$shells{$username}=$lineItems[6];
}
close PASSWDFILE;
foreach $User (@ARGV) {
$User = lc($User);
print uc($User);
print ":\n";
print "\tPassword: $passwords{$User}\n";
print "\tUser ID: $userids{$User}\n";
print "\tGroup ID: $groupids{$User}\n";
print "\tReal Name: $names{$User}\n";
print "\tHome Directory: $homes{$User}\n";
print "\tDefault Shell: $shells{$User}\n";
print "\n";
}

This script uses usernames as the ‘key’ for this associative array. It could just as well have used user id. The key has to be something that will be unique for each ‘record’.

Note that in the ‘split” line, we’ve left out the $_. Perl will often assume that that’s what you meant, and in this case it works just fine.We’ve also explicitly opened a file here for the first time. We’ll have more on that later, but we put the filename into a scalar variable, and made sure that scalar variable was in all capitals. This allowed us to use the simple form for opening the filename contained in that variable. And don’t forget that we closed it at the end! If you look at the ‘while’, you’ll see that it looks pretty much the same as when we used the <STDIN> filehandle.

About this Tutorial
This tutorial is written by Jerry Stratton and is published under the GNU Free Documentation License.

Murach's Visual Basic 2008 Published

Mike Murach and Associates has just published a 2008 edition of their core Visual Basic book, "Murach's Visual Basic 2008." It's described in detail at the Murach web site:
http://www.murach.com/books/vb08/index.htm

It teaches how to develop Windows forms applications the way the best professionals do. To do that, it incorporates the features that have made earlier editions such popular choices among developers.

#1: It focuses on the essential skills that VB developers need every day
Although that may sound obvious, some skills tend to be glossed over or ignored in VB training. But in teaching how to use Visual Studio 2008 and VB 2008 to develop Windows forms applications, this book covers skills like how to validate input data, how to work with different data types, how to use arrays and collections, how to do structured exception handling, how to read and write text, binary, and XML files...the kinds of skills needed to develop the applications that businesses rely on.

#2: There's a 4-chapter section on database programming
Because database handling is so critical in business applications, this book presents more coverage than is usual in introductory texts.

To begin, it teaches how to prototype database applications using rapid application development tools like the data sources feature, datasets, and bound controls. But beyond that, it shows developers how to start using ADO.NET to work directly with databases for more processing control than the RAD tools offer.

#3: It teaches the OOP skills that many developers miss out on
Visual Basic is an object-oriented language, yet many VB developers have only a hazy understanding of OOP. So this book includes 5 chapters that clearly explain OOP features like inheritance and interfaces in the context of database applications. The intent is to provide the kind of background that makes you a more savvy, confident developer.

#4: It provides practical coverage of new features, especially LINQ
LINQ is the big news in VB 2008. It allows you to query a data source using constructs that are built into the VB language. That way, you can use the same language to access a variety of data sources, from databases to arrays to XML files. The introductory chapter on LINQ in this book gives you a practical spin that will prepare you for more in-depth LINQ training.

#5: Complete applications show how all the pieces interact
One key to mastering VB development is to have plenty of applications that show how the features you're learning interact and what problems you might run into as you work on your own. So this book shows complete Windows forms applications for everyday business functions. These can be downloaded for free from the Murach web site, along with coding starts for the practice exercises in the book.

#6: The paired-pages format lets developers set their own pace
Murach books have a distinctive format, where each two-page spread presents a single topic. Both beginning and experienced developers find that this format makes it easy to focus on the information they need, whether they're using the book for training or reference.

"Murach's Visual Basic 2008" is available from all major retail outlets and directly from the publisher at the Murach web site:
http://www.murach.com/

Sunday, March 2, 2008

Displaying a TIFF in a Web Page

This tutorial will show you how to display a TIFF in a web page. Web browsers can display standard image formats such as GIF, JPG, and PNG files. Unfoturnately, web browsers won't display TIFF images.

Luckily for us, we have a secret weapon called QuickTime. Beyond having the ability to play QuickTime movies, QuickTime also supports a number of image formats including TIFF, Photoshop (PSD), PICT, Targa, and more. Visit the QuickTime Tech Specs page for a complete list of supported files.

Apple's QuickTime player is available for both Windows and Mac. Foturnately, QuickTime is installed on most computers. If the plugin isn't installed on the computer, we can take advantage of the auto install feature.

Below is a sample embed tag that will load the sample TIFF image (car.tif):

<OBJECT CLASSID="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" WIDTH="100%" HEIGHT="100%"
CODEBASE="http://www.apple.com/qtactivex/qtplugin.cab">
<PARAM name="SRC" VALUE="car.tif">
<PARAM name="SCALE" VALUE="aspect">
</OBJECT>

The WIDTH and HEIGHT of the QuickTime plugin is set to 100%. This will make the plugin the same size as the web page in the browser.

The SRC attribute specifies the file to load. In our example, the file is in the same directory as the html file. If the file is in a different directory, specify the complete URL.

The SCALE parameter will specify how to scale the image. In our example, we set it to "aspect". This will maintain the aspect ratio. If you specify "1", the image will displayed in it original size.

NOTE: Because of the "Click to Activate" issue with Active X controls (ie QuickTime plugin), the image will not load until the plugin is clicked on. There is a solution for this problem. In short, the <OBJECT/> tags must be written in an external JavaScript file. Our example files below take care of this problem. To understand more about this issue, visit Apple's tutorial "Including QuickTime In A Web Page".

Demo:
Click to View Demo
Download Files (Right Click - Save Target As):

Resources:

Saturday, March 1, 2008

Convert a String to Number in Java

This tutorial will show you how to convert a string to different number types. Each number type in Java has a parse method that allows you convert a string into the primitive type.

When converting a string to a number, the parse method may throw a NumberFormatException if the string is null or an invalid representation for that type.

Convert a String to an int
To convert a String to an int, call the static method parseInt() on the Integer class. Below is an example:

String string = "123";
int value = Integer.parseInt(string);
Convert a String to a long
To convert a String to a long, call the static method parseLong() on the Long class. Below is an example:
String string = "123";
long value = Long.parseLong(string);

Convert a String to a float
To convert a String to a float, call the static method parseFloat() on the Float class. Below is an example:
String string = "123.4";
float value = Float.parseFloat(string);

Convert a String to a double
To convert a String to a double, call the static method parseDouble() on the Double class. Below is an example:
String string = "123.4";
double value = Double.parseDouble(string);

Split a String into Words in Java

This tutorial shows how to split a string into multiple words.

In Java 1.4, Sun added a split() method to the String class. The split method allows you to specify a regular expression that is used to split the string into a string array. To split a string where there words are separated by a space, simply specify a space (" ") as the parameter to the split() method.

The following code example shows how to split a sentence into words:

String sentence = "This is a sentence.";
String[] words = sentence.split(" ");

for (String word : words)
{
System.out.println(word);
}
Below is output from the example code:
This
is
a
sentence.

Convert a BMP to a PNG in Java

This tutorial shows how to use the ImageIO API to convert a BMP to a PNG image in Java. The ImageIO API provides methods to read the source image and to write the image in the new file format.

To read the image, simply provide the ImageIO.read() method a File object for the source image. This will return a BufferedImage.

//Create file for the source
File input = new File("c:/temp/image.bmp");

//Read the file to a BufferedImage
BufferedImage image = ImageIO.read(input);

Once you have the BufferedImage, you can write the image as a PNG. You will need to create a File object for the destination image. When calling the write() method, specify the type string as "png".

//Create a file for the output
File output = new File("c:/temp/image.png");

//Write the image to the destination as a PNG
ImageIO.write(image, "png", output);

Convert a BMP to a JPG in Java

This tutorial shows how to use the ImageIO API to convert a BMP to a JPG image in Java. The ImageIO API provides methods to read the source image and to write the image in the new file format.

To read the image, simply provide the ImageIO.read() method a File object for the source image. This will return a BufferedImage.

//Create file for the source
File input = new File("c:/temp/image.bmp");

//Read the file to a BufferedImage
BufferedImage image = ImageIO.read(input);

Once you have the BufferedImage, you can write the image as a JPG. You will need to create a File object for the destination image. When calling the write() method, specify the type string as "jpg".

//Create a file for the output
File output = new File("c:/temp/image.jpg");

//Write the image to the destination as a JPG
ImageIO.write(image, "jpg", output);

Convert a PNG to a BMP in Java

This tutorial shows how to use the ImageIO API to convert a PNG to a BMP image in Java. The ImageIO API provides methods to read the source image and to write the image in the new file format.

To read the image, simply provide the ImageIO.read() method a File object for the source image. This will return a BufferedImage.

//Create file for the source
File input = new File("c:/temp/image.png");

//Read the file to a BufferedImage
BufferedImage image = ImageIO.read(input);

Once you have the BufferedImage, you can write the image as a BMP. You will need to create a File object for the destination image. When calling the write() method, specify the type string as "bmp".

//Create a file for the output
File output = new File("c:/temp/image.bmp");

//Write the image to the destination as a BMP
ImageIO.write(image, "bmp", output);

Convert a JPG to a BMP in Java

This tutorial shows how to use the ImageIO API to convert a JPG to a BMP image in Java. The ImageIO API provides methods to read the source image and to write the image in the new file format.

To read the image, simply provide the ImageIO.read() method a File object for the source image. This will return a BufferedImage.

//Create file for the source
File input = new File("c:/temp/image.jpg");

//Read the file to a BufferedImage
BufferedImage image = ImageIO.read(input);

Once you have the BufferedImage, you can write the image as a BMP. You will need to create a File object for the destination image. When calling the write() method, specify the type string as "bmp".

//Create a file for the output
File output = new File("c:/temp/image.bmp");

//Write the image to the destination as a BMP
ImageIO.write(image, "bmp", output);

Convert a GIF to a BMP in Java

This tutorial shows how to use the ImageIO API to convert a GIF to a BMP image in Java. The ImageIO API provides methods to read the source image and to write the image in the new file format.

To read the image, simply provide the ImageIO.read() method a File object for the source image. This will return a BufferedImage.

//Create file for the source
File input = new File("c:/temp/image.gif");

//Read the file to a BufferedImage
BufferedImage image = ImageIO.read(input);

Once you have the BufferedImage, you can write the image as a BMP. You will need to create a File object for the destination image. When calling the write() method, specify the type string as "bmp".

//Create a file for the output
File output = new File("c:/temp/image.bmp");

//Write the image to the destination as a BMP
ImageIO.write(image, "bmp", output);