Pages

ColdFusion - VariableTypes

0 comments

"Variables"

ColdFusion Variable Types:

  • A variable is a named location in memory that holds a value. The "type" of variable refers to the type of data stored at that memory location. Some languages strongly resist converting numbers to strings (text) values and vice-versa; these languages are referred to as "strongly typed." ColdFusion is a "loosely typed" programming language. 
  • This means that variables are not (generally speaking) strongly associated with one data type or another; for example, a variable assigned a numeric value can be used as if it were a string variable. The length of text variables need not be defined before use, and I've created string variables several megabytes in length. 
  • The basic data types in ColdFusion (not that it's really all that important) are Numeric, String, Date/Time, and Boolean.
  • There are others data types: arrays can be created; SQL queries, once executed, become a type of array; and structures were added in version 4.0. A List is almost another data type is ColdFusion, but it is actually just a string with some sort of delimiter, usually a comma. Special variables cannot be automatically converted to other types.
  • A string can only be converted to a numeric if it looks like a number. "45.3" can be converted; "two" cannot be converted. Any number can be converted to a string. The two basic Boolean values are TRUE and FALSE; however YES and NO work well too. Non-zero numbers are considered TRUE; zero is considered FALSE. String values other than true, false, yes, no, or something easily converted to numeric, will cause an error to be displayed.
  • Variables names are NOT case-sensitive, must start with a letter, and can include letters, numbers, and underscores ("_"). "Customer_Name" is valid; "2Customer" and "Customer Name" are not valid variable names. The value of a variable is displayed by expressing the variable in pound signs, within a CFOUTPUT block:
        <CFOUTPUT>Welcome to our online system,
        #Customer_Name#!</CFOUTPUT>
  • All variable names that contain a single value exist in "variable scopes." (More about that in the next section.)

SQL Data Types:

  • SQL (as implemented by ODBC) has three data types: string, numeric, and date/time (or timestamp.) SQL queries are sent to SQL-based databases via the <CFQUERY> tag.

SQL Strings:

  • SQL strings begin and end with a single quote ('). If you want to embed a single quote in a query, you need to type two single quotes. (Programmers generically called this 'escaping' a reserved character.) Therefore, to express the value:
     I don't get this.
          as an SQL string, you would type:
     'I don''t get this.'
  • Within a CFQUERY, ColdFusion will replace single quotes in #variables# with double quotes automagically; however, ColdFusion will not do single quote escaping for functions. Therefore, any data that may contain single quotes should be manipulated outside of the CFQUERY statement.

Wrong:
<CFQUERY...>
    SELECT * FROM Users
    WHERE UserName = '#ucase(User_Name)#'
</CFQUERY>
  
Right:
<CFSET UserName = ucase(UserName)>
<CFQUERY...>
    SELECT * FROM Users
    WHERE UserName = '#User_Name#'
</CFQUERY>

SQL Numbers:

  • Numbers are provided to SQL without any special consideration. However, ColdFusion programmers must be sure to handle numeric values passed into queries! Otherwise, the supposedly numeric value could be 'hijacked' by a malicious user and used to run other SQL commands. Say a link is created that passes a numeric row identifier "OrderID." OrderID is the primary key for the table "Orders" and is numeric. Although it's tempting to write a query to get the order from the database like this:
SELECT *
FROM Orders
WHERE OrderID = #OrderID#

  • Someone could easily replace the numeric OrderID (e.g. "5") an the URL line (or alter the form, etc.) with a value followed by a malicious command, such as "http://myserver/MyPage.cfm?OrderID=5+delete+from+orders". The SQL passed to the database system would then look like this:
SELECT *
FROM Orders
WHERE OrderID = 5 delete from orders
  • Most high-end database systems allow more than one SQL statement per query. Without very conservative database security settings, the above command would delete all orders from the system. You don't want to get that phone call. All numeric values passed by the user should be wrapped by the ColdFusion val() function, which returns the numeric value of the parameter supplied to it, or zero (0) if the value is not numeric. 
  • Therefore, val("5") is 5, but val("5 delete from orders") is 0. The code would be properly rewritten like this:
 
SELECT *
FROM Orders
WHERE OrderID = #val(OrderID)#

SQL Date and Date/Time values:

  • ODBC was designed to provide one consistent application interface to many different DataBase Management Systems (DBMSes). There is a problem with providing one SQL front end to many DBMS back end systems...
Date/Time values, in ODBC, are provided in one of the following three formats:
  • Timestamp: {ts '1999-11-01 15:14:23'}
  • Date: {d '1999-11-01'}
  • Time: {t '15:14:23.00001'}
For time (and timestamp) values, the seconds and fractional seconds portion are optional. Many SQL systems do not support fractional second timestamps; if you attempt to use a fractional second value with these systems, strange errors may occur.

An example SQL Insert showing all three data types:
 
<CFQUERY Name="InsertCustomer" DataSource="CustomerData">
    INSERT INTO Customers (
        CustomerName
               ,CustomerAge
               ,DateAdded
    ) VALUES (
            'John''s Bakery'
               ,30
               ,{ts '1999-11-01 15:54:00'}
        )
</CFQUERY>

ColdFusion - Introduction

0 comments

What is ColdFusion?

  • ColdFusion is a programming language. Like Java, in the sense that it is nothing by itself; it requires a programmer with vision and skill to make anything useful out of it. Like Visual Basic, in the sense that the language is tailored for a specific purpose, but general enough to accomplish most any task easily within that scope. (Visual Basic is designed to make applications for the Windows environment; ColdFusion is designed to make applications for the Web server environment.)

Databases

  • ColdFusion was originally designed for allowing database contents to be easily displayed in Web pages for any browser, without plugins, by manipulating the HTML output of a Web browser. Since the browser is fed nothing other than standard HTML, no plugins are needed.

More..!

  • ColdFusion also makes gathering, manipulating, and presenting data from other data sources easy, including other Web servers, FTP servers, ASCII data files, POP mail servers--not even COM and CORBA objects are safe :-)
Web application server:

  • ColdFusion is an application server that runs on a web server. It runs on Linux, Solaris, Windows servers and even the personal web server on Windows 98. The ColdFusion Web application server works with the HTTP server to process requests for web pages. 
  • Whenever a Cold Fusion page is requested, the ColdFusion Application Server executes the script or program the page contains. Unlike JavaScript and Java applets, which run on the client, ColdFusion runs on the Web Server itself. Scripts you write in Cold Fusion will run the same way on every browser.
  • ColdFusion server was developed by the Allaire Corporation to be a simple to use yet powerful alternative to Perl and other CGI technologies. 
  • ColdFusion server is a Rapid Application Development system for professional developers who want to create dynamic Web applications and interactive Web sites. It provides a fast way to integrate browser, server and database technology into Web applications. 
  • Developing applications with Cold Fusion does not require coding in a traditional programming language like Perl, C/C++, Visual Basic, Java. You build applications by combining standard HTML with a straightforward server-side markup language, the Cold Fusion Markup Language (CFML). Cold Fusion is a markup language. 
  • It can create and modify variables and has program flow controls. It can perform quite complicated tasks. With over 75 CFML tags and over 250 custom functions any web application can be built. Input for Cold Fusion scripts often comes from a user submitting a form to a Cold Fusion template. 
  • Cold Fusion application pages handle everything from capturing data a user enters to presenting output. Cold Fusion scripts can also get their input from URL strings, CGI variables or databases. Pages with the .cfm extension are processed without the need for CGI-style URLs to specify an executable. 
  • Output from Cold Fusion scripts is typically sent to a user's web browser, put into a database, written to a file or e-mailed. Cold Fusion was designed to build complex, high traffic web sites. ColdFusion server is designed to run on multi-processor systems and allows you to build a dynamic web site that can be run on a cluster of servers.
  • Use ColdFusion server to build and maintain databases, process forms, make parts of your web site secure and gather or publish data. You can use it to build web applications like bulletin boards, pop mail clients, online-calendars and chat rooms. Cold Fusion scripts can be written to track hits, clicks, return visits and other valuable traffic statistics. 
  • A Cold Fusion application could consist of many application pages, depending on the complexity of your application. Each page performs specific functions in the application. Basically, any function you find on the Internet today can be built and maintained with ColdFusion server.
Databases:
  • ColdFusion makes interacting with your database (Sybase, Oracle, MySQL, SQL or Access) simple. Using standard SQL (Structured Query Language) your web pages and web applications can retrieve, store, format and present information dynamically. If you are known with HTML, CFML (Cold Fusion Markup Language) is just one step further. 
  • Reading from and writing to servers is tag based. The <CFFILE> tag takes "arguments" which specify 'action=read/write/copy/delete', 'path=' , and so forth.
  • The CF tag <CFFORM> will automatically build all the JavaScript code to verify required fields before the form submits. Cold Fusion also has tags to embed COM and Java applets and servlets.
ColdFusion Components:   
  • Cold Fusion applications need the following components.

The ColdFusion Application server: 

  • The application server runs as a service under Windows NT. The application server listens for requests from the web server to process Cold Fusion application pages. You can stop or start the service.
The ColdFusion Administrator:
  • You use the Administrator to configure various Cold Fusion Application server options, including: Cold Fusion data sources,debugging output, server settings and directory mapping.
ColdFusion Application pages: 

  • These are the functional parts of a ColdFusion application, including the user interface pages and forms that handle data input and format data output. ColdFusion makes it simple to pass data to a data source and to receive and format data for display.
ODBC Data Sources: 
  • ColdFusion uses ODBC to interact with a database therefore you can use any database that supports ODBC as a data source for your Cold Fusion applications. 
  • A ColdFusion data source can be any ODBC-compliant database, as well as an Excel spreadsheet, a text file, an LDAP directory server and others.

Hyperion Introduction

0 comments

1). Hyperion:

Established in 1981, hypeion is a solution provider in the fields of Customer relationship management, Human resource management, Enterprise management, e-business, manufacturing anlytics, Datawarehousing etc.
In e-business solution Hyperion has three components, E marketing analysis, website analysis an e-commerce analysis.

2). E-marketing analysis:

Hyperion e-Marketing Analysis is an analytic application that allows users to understand, manage and control the performance of e-marketing programs and how effectively visitors are being driven to web sites. E-Marketing issues that can be explored, answered and optimized using Hyperion e-Marketing Analysis include: 


  • How does reach and frequency of online advertising equate to sales? 
  • Do direct email campaigns or direct mail campaigns perform better?
  • Which marketing campaigns generate the highest ROI?
  • What keywords work most effectively on which search engines?
Hyperion e-Marketing Analysis features a wide range of metrics that allow users to analyze their e-marketing activity by time, campaign, customer segment, site advertised on, and much more. From basic click rates to advanced click rates to sales ratios, Hyperion e-Marketing Analysis guides users to maximize the return on on-line marketing expenditures. 


Hyperion e-Marketing Analysis is integrated with Hyperion Web Site Analysis and Hyperion e-Commerce Analysis so users can "close the loop" among promotional spending, web site activity, and e-commerce performance. 


Hyperion e-Marketing Analysis is built on open, scalable, cross-platform technologies and is deployable over intranets, extranets and the Internet. The interactive graphical user interface supports both 32-bit Windows clients and Java-enabled web browsers.

3). Hyperion Web Site Analysis:

Hyperion Web Site Analysis is an analytic application that allows users to understand, manage, and optimize the experience of visitors to web sites. Hyperion Web Site Analysis also includes comprehensive measurements and analyses of the technical performance of web sites. A wide range of issues that can be explored, answered and optimized using Hyperion Web Site Analysis include: 


  • What patterns are discernable in the makeup and behavior of web site visitors?
  • Which segment of affiliate networks drive the most traffic to the web site?
  • Given historical trends for past product launches, what traffic is forecasted an upcoming product launch?
  • Which competitors are accessing the web site and what areas are they visiting?
  • How are web servers, internal networks and Internet connections performing?
Hyperion Web Site Analysis features a wide range of metrics that allow users to analyze web site activity by time, user segment, company name, referring URL, by product or service interest etc. From page views, average number of visits, trending response time, percentage change in average pages served etc, Hyperion Web Site Analysis guides users to optimize the performance of web sites and the experience of on-line visitors.

Hyperion Web Site Analysis offers very fast response time and scales from analysis of a single web server to networks of thousands of web servers generating hundreds of gigabytes of web logs per month.


Hyperion Web site Analysis supports all leading web servers; is built on open, scalable, cross-platform technologies; and is deployable over intranets, extranets and the Internet. The interactive graphical user interface supports both 32-bit Windows clients and Java-enabled web browsers.

4). e-commerce analysis:

Hyperion e-Commerce Analysis is an analytic application that allows users to understand, manage, and optimize on-line selling. A wide range of issues that can be explored, answered and optimized using Hyperion Web Site Analysis include: 


  • Which customers are most and least profitable?
  • What is the conversion rate for cross-selling?
  • How is the average sale size changing over time?
  • What is causing shopping cart abandonment?
Hyperion e-Commerce Analysis features a wide range of metrics that allow users to analyze e-commerce activity by time, customer segment, location, customer attribute, product etc. From sales trends, average basket revenue, customer lifetime value, customer profitability etc, Hyperion e-Commerce Analysis helps users maximize revenue and profitability from e-commerce initiatives.

Hyperion e-Commerce Analysis is built on open, scalable, cross-platform technologies and is deployable over intranets, extranets and the Internet. The interactive graphical user interface supports both 32-bit Windows clients and Java-enabled web browsers.

5). Hyperion MBA: Online Business Analysis

Hyperion MBA is designed to allow users to make better decisions about their businesses by giving them a better understanding of the many types of information – both internal and external – that are often stored in hard to find or hard to reach locations. Hyperion MBA provides powerful multidimensional analysis and reporting capabilities to support high volume, complex business analysis of metrics such as sales analysis, customer profitability and product line profitability.

It allows analysis in up to 16 dimensions and is suitable for multi-user applications and what-if analysis.


Features:

Hyperion MBA, as an analytic application, provides value along the three dimensions:

  • Process support: MBA has built-in “Wizards” that allow end users to create applications based upon predefined business templates.
  • Separation of function: User implement MBA “on top” of transactional systems such as SAP or Baan or “alongside” Hyperion Enterprise or Pillar. Users can also analyze data from other data sources( dataware house containing sales, marketing information, etc.)
  • Time-oriented, integrated data: MBA supports a time-oriented dimension for analysis by extracting and integrating information from multiple databases. For example, clients can analyze data from customer files at the same time that they access information from financial repositories.

Architecture:

Following figure shows the architecture of Hyperion MBA

Platforms supported:



Applix TM1 multidimensional engine
Reporting
Can be integrated with cognos powerplay besides it’s own reporting capabilities
OLAP
Follows Microsoft OLE DB standard for OLAP API

Teradata DBA - Basics

11 comments

Hi,
In this post we will discuss about Teradata DBA basic concepts:
1). Some of the functions of a Teradata Database Administrator (DBA) include:
  • User and Database Management
  • Space Allocation and Usage
  • Access of Objects (e.g., tables, views, etc.)
  • Access Control and Security
  • System Maintenance
  • System Performance
  • Resource Monitoring
  • Data Archives, Restores, and Recovery
2). Examples of tools available to the Teradata DBA include:
  • Use of Data Dictionary/Directory tables and views to manage the system
  • Teradata Administrator – Windows administration utility
  • Teradata Manager – suite of Windows tools
  • Teradata Analyst Toolset – Index Wizard, Statistics Wizard, and Teradata SET
  • Teradata Dynamic Query Manager (DQM)
  • Database Console Window and System utilities – e.g., dbscontrol, ferret, rebuild, etc.
  • User scripts and 3rd party applications
3). To do these functions, it is important to understand key concepts such as …
  • Teradata hierarchy and the concepts of ownership (parents and children)

Space Allocation and Usage in Teradata

0 comments

Hi,

Today we will discuss about Space management in Teradata.
Permanent Space Terminology

MaxPerm
  • The maximum number of bytes available for table, index and permanent journal storage in a database or user.
CurrentPerm
  • The total number of bytes in use to store the tables, subtables, and permanent journals contained in the database or user.
PeakPerm
  • The largest number of bytes actually used to store data in this user since the value was last reset.



Spool Space Terminology
MaxSpool
  • A value used to limit the number of bytes the system will consume to create spool files for a user.

CurrentSpool
  • The number of bytes currently in use for running transactions.
PeakSpool
  • The maximum number of bytes used by a transaction run for this user since the value was last reset.
 
         Spool space marked (last use) is recovered by a worker task that is initiated every five minutes.

Temporary Space Terminology

MaxTemp
  • A value used to limit the number of bytes the system will use to store data for global temporary tables for a user.
CurrentTemp
  • The number of bytes in use for global temporary tables.
PeakTemp
  • The maximum number of bytes used by global temporary tables for a user since the value was last reset.



Temporary space is released when the user terminates the session or when the user frees the temporary space.