Friday, December 17, 2010

How to avoid Conflict in jQuery

Many JavaScript libraries use $ as a function or variable name, just as jQuery does. In jQuery's case, $ is just an alias for jQuery, so all functionality is available without using $. If we need to use another JavaScript library alongside jQuery, we can return control of $ back to the other library with a call to $.noConflict():



Creates a different alias instead of jQuery to use in the rest of the script.



var $j = jQuery.noConflict();
// Do something with jQuery
$j("div p").hide();

// Do something with another library's $()
$("content").style.display = 'none';

Monday, December 13, 2010

404 Page on a Static Site

Here's a very quick, but very useful trick. You can catch 404 errors (page not found) on a static site and serve up a custom 404 page with a one-liner in your .htaccess file:



ErrorDocument 404 /404.php

The "/404.php" part is the path to whatever file you want to serve up as the error page.


Remember that the .htaccess file works on Apache servers only. I say "static" sites, because if you are using a CMS system already (like WordPress), there is already a system in place for catching 404 errors and this is unnecessary.

create windowed applications with no system chrome

To  build a AIR application with custom window(which has your own shape), try the fallowing:

In the <project_root>/src folder, open the XML file named "<your_project_name>-app.xml" and modify the two lines:

<!--<systemChrome>none</systemChrome>-->
to
<systemChrome>none</systemChrome>

and

<!--<transparent></transparent>-->
to
<transparent>true</transparent>

Then in your main page,

<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" showFlexChrome="false">

<mx:Script>
<![CDATA[
public function startMove(event:MouseEvent):void {
stage.nativeWindow.startMove();
}
]]>
</mx:Script>

<mx:Image id="mainPanel"  mouseDown="startMove(event)"  x="10" y="10" width="300" height="200"
source="myBg.gif /*path to a transparency image*/" scaleContent="true" />

Sunday, December 12, 2010

Data Storage and Data flow

Data Storage and Data Flow 


SAP NetWeaver BI offers a number of options for data storage. These include the implementation of a data warehouse or an operational data store as well as the creation of the data stores used for the analysis.

Architecture


A multi-layer architecture serves to integrate data from heterogeneous sources, transform, consolidate, clean up and store this data, and stage it efficiently for analysis and interpretation purposes. The data can be stored with varying granularity in the layers.

●      Persistent Staging Area

After being extracted from a source system, data is transferred to the entry layer of the Enterprise Data Warehouse, the persistent staging area (PSA). The data from the source system is stored unchanged in this layer. It provides the backup status at a granular level and can offer further information at a later time in order to ensure a quick restart if an error occurs.

●      Data Warehouse

The way in which data is transferred from the PSA to the next layer incorporates quality-assuring measures and the clean up required for a uniform, integrated view of the data. The results of these first transformations and cleanups are stored in the data warehouse layer. It offers integrated, granular, historic, stable data that has not yet been modified for a concrete usage and can therefore be seen as neutral. The data warehouse forms the foundation and the central data base for further (compressed) data retentions for analysis purposes (data marts). Without a central data warehouse, the enhancement and operation of data marts often cannot be properly designed.

●      Architected Data Marts

The data warehouse layer provides the mainly multidimensional analysis structures. These are also called architected data marts. Data marts should not necessarily be equated with added or aggregated; highly granular structures that are only oriented to the requirements of the evaluation can also be found here.

●      Operational Data Store

An operational data store supports the operational data analysis. In an operational data store, the data is processed continually or in short intervals, and be read for operative analysis. In an operational data store, the mostly uncompressed datasets therefore are quite up-to-date, which optimally supports operative analyses.

Data Store


Various structures and objects that can be used depending on your requirements are available for the physical store when modeling the layers.

In the persistent staging area (PSA), the structure of the source data is represented by DataSources. The data of a business unit (for example, customer master data or item data of an order) for a DataSource is stored in a transparent, flat database table, the PSA table. The data storage in the persistent staging area is short- to medium-term. Since it provides the backup status for the subsequent data stores, queries are not possible on this level and this data cannot be archived.

Whereas a DataSource consists of a set of fields, the data stores in the data flow are defined by InfoObjects. The fields of the DataSource must be assigned with transformations in the SAP NetWeaver BI system to the InfoObjects. InfoObjects are thus the smallest (metadata) units within BI. Using InfoObjects, information is mapped in a structured form. This is required for building data stores. They are divided into key figures, characteristics and units.

●      Key figures provide the transaction data, that is the values to be analyzed. They can be quantities, amounts, or numbers of items, for example sales volumes or sales figures.

●      Characteristics are sorting keys, such as product, customer group, fiscal year, period, or region. They specify classification options for the dataset and are therefore reference objects for the key figures. Characteristics can contain master data in the form of attributes, texts or hierarchies. Master data is data that remains unchanged over a long period of time. The master data of a cost center, for example, contains the name (text), the person responsible (attribute), and the relevant hierarchy area (hierarchy).

●      Units such as currencies or units of measure define the context of the values of the key figures.

Consistency on the metadata level is ensured by your consistently using identical InfoObjects to define the data stores in the different layers.

DataStore objects permit complete granular (document level) and historic storage of the data. As for DataSources, the data is stored in flat database tables. A DataStore object consists of a key (for example, document number, item) and a data area. The data area can contain both key figures (for example, order quantity) and characteristics (for example, order status). In addition to aggregating the data, you can also overwrite the data contents, for example to map the status changes of the order. This is particularly important with document-related structures.

Modeling of a multidimensional store is implemented using InfoCubes. An InfoCube is a set of relational tables that are compiled according to an enhanced star schema. There is a (large) fact table (containing many rows) that contains the key figures of the InfoCube as well as multiple (smaller) surrounding dimension tables containing the characteristics of the InfoCube. The characteristics represent the keys for the key figures. Storage of the data in an InfoCube is additive. For queries on an InfoCube, the facts and key figures are automatically aggregated (summation, minimum or maximum) if necessary. The dimensions combine characteristics that logically belong together, such as a customer dimension consisting of the customer number, customer group and the steps of the customer hierarchy, or a product dimension consisting of the product number, product group and brand. The characteristics refer to the master data (texts or attributes of the characteristic). The facts are the key figures to be evaluated, such as revenue or sales volume. The fact table and the dimensions are linked with one another using abstract identifying numbers (dimension IDs). As a result, the key figures of the InfoCube relate to the characteristics of the dimension. This type of modeling is optimized for efficient data analysis. The following figure shows the structure of an InfoCube:

You can create logical views (MultiProviders, InfoSets) on the physical data stores in the form of InfoObjects, InfoCubes and DataStore objects, for example to provide data from different data stores for a common evaluation. The link is created across the common Info Objects of the data stores.

The generic term for the physical data stores and the logical views on them is InfoProvider. The task of  an InfoProvider is to provide optimized tools for data analysis, reporting and planning.

Data Flow


The data flow in the Enterprise Data Warehouse describes how the data is guided through the layers until it is finally available in the form required for the application. Data extraction and distribution can be controlled in this way and the origin of the data can be fully recorded. Data is transferred from one data store to the next using load processes. You use the InfoPackage to load the source data into the entry layer of SAP NetWeaver BI, the persistent staging area. The data transfer process (DTP) is used to load data within BI from one physical data store into the next one using the described transformation rules. Fields/InfoObjects of the source store are assigned to InfoObjects of the target store at this time.

You define a load process for a combination of source/target and define the staging method described in the previous section here. You can define various settings for the load process; some of them depend on the type of data and source as well as the data target. For example, you can define data selections in order to transfer relevant data only and to optimize the performance of the load process. Alternatively, you can define if the entire source dataset or only the new data since the last load should be loaded into the source. The latter means that data transfer processes automatically permit delta processing, individually for each data target. The processing form (delta or entire dataset) for InfoPackages, that is the loading into the SAP NetWeaver BI System, depends on the extraction program used.

Saturday, December 11, 2010

Fixing libmysql.dll issue in Rails

While working on rails with mysql as database you may got error like this "This application has failed to start because libmysql.dll was not found. Re-installing the application may fix this problem" while executing the code 'rake db:create'. If that so, then fallow the fallowing steps:

1. type the command in the console

gem install mysql

(this is for windows, if you are  using linux os add sudo at the beginning)

2. Copy the libmysql.dll found in the mysql installation directory (mysql\bin) and paste it in your ruby installation directory (ruby\bin).

3. Restart the server.

thats all, it will work now.

Friday, December 10, 2010

Importing data from CSV File

Here is an example to importing data from csv file into MySQL table.

LOAD DATA INFILE "/home/mysql/data/file_name.csv" INTO TABLE table_name FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';

Find duplicate repords in Table

Here is an example to find duplicate records from the table.
select address, count(address) as cnt from mailing_list group by address having cnt > 1 order by cnt;

Export a table into csv format

Here is an example to export data from MySQL into CSV File Format.
SELECT * INTO OUTFILE '/tmp/file_name.csv' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n' FROM table_name;

Fields Other than the PK Need to be Indexed

The Table Primary Key (PK) is automatically an index.

Indexes should be used whenever a relationship needs to be established between two tables using a field other than the PK E.g. both fields included in the ON table1.field1=table2.field3 clause. Making both fields indexes allows MySQL to JOIN the two tables much more efficiently and much faster.

The working of an index is hidden from the user but involves MySQL setting up lookup pointers.

Thursday, December 9, 2010

ETL Concepts

Extraction, Transformation and Loading (ETL) SAP NetWeaver BI offers flexible means for integrating data from various sources. Depending on the data warehousing strategy for your application scenario, you can extract the data from the source and load it into the SAP NetWeaver BI system or directly access the data in the source without storing it physically in the Enterprise Data Warehouse. In this case the data is integrated virtually in the Enterprise Data Warehouse. Sources for the Enterprise Data Warehouse can be operational, relational datasets (for example in SAP systems), files or older systems. Multidimensional sources, such as data from other BI systems, are also possible. Transformations permit you to perform a technical cleanup and to consolidate the data from a business point of view. Extraction and Loading Extraction and transfer processes in the initial layer of SAP NetWeaver BI as well as direct access to data are possible using various interfaces, depending on the origin and format of the data. In this way SAP NetWeaver BI allows the integration of relational and multidimensional data as well as of SAP and non-SAP data. ● BI Service API (BI Service Application Programming Interface) The BI service API permits the extraction and direct access to data from SAP systems in standardized form. This can be SAP application systems or SAP NetWeaver BI systems. The data request is controlled from the SAP NetWeaver BI system. ● File Interface The file interface permits the extraction from and direct access to files, such as csv files. The data request is controlled from the SAP NetWeaver BI system. ● Web Services Web services permit you to send data to the SAP NetWeaver BI system under external control. ● UD Connect (Universal Data Connect) UD Connect permits the extraction from and direct access to both relational and multidimensional data. The data request is controlled from the SAP NetWeaver BI system. ● DB Connect (Database Connect) DB Connect permits the extraction from and direct access to data lying in tables or views of a database management system. The data request is controlled from the SAP NetWeaver BI system. ● Staging BAPIs (Staging Business Application Programming Interfaces) Staging BAPIs are open interfaces from which third party tools can extract data from older systems. The data transfer can be triggered by a request from the SAP NetWeaver BI system or by a third party tool. Transformation With transformations, data loaded within the SAP NetWeaver BI system from the specified interfaces is transferred from a source format to a target format in the data warehouse layers. The transformation permits you to consolidate, clean up and integrate the data and thus to synchronize it technically and semantically, permitting it to be evaluated. This is done using rules that permit any degree of complexity when transforming the data. The functionality includes a 1:1 assignment of the data, the use of complex functions in formulas, as well as the custom programming of transformation rules. For example, you can define formulas that use the functions of the transformation library for the transformation. Basic functions (such as and, if, less than, greater than), different functions for character chains (such as displaying values in uppercase), date functions (such as computing the quarter from the date), mathematical functions (such as division, exponential functions) are offered for defining formulas. Availability Requirements for Data in SAP NetWeaver BI For different business problems, the data might need to be more or less up-to-date. For example, if you want to check the sales strategy for a product group each month, you need the sales data for this time span. Historic, aggregated data is taken into consideration. The scheduler is an SAP NetWeaver BI tool that loads the data at regular intervals, for example every night, using a job that is scheduled in the background. In this way no additional load is put on the operational system. We recommend that you use standard data acquisition, that is schedule regular data transfers, to support your strategic decision-making procedure. If you need data for the tactical decision-making procedure, data that is quite up-to-date and granular is usually taken into consideration, for example, if you analyze error quotas in production in order to optimally configure the production machines. The data can be staged in the SAP NetWeaver BI system based on its availability and loaded in intervals of minutes. A permanently active job of SAP background processing is used here; this job is controlled by a special process, a daemon. This procedure of data staging is called real-time data acquisition. By loading the data in a data warehouse, the performance of the source system is not affected during the data analysis. The load processes, however, require an administrative overhead. If you need data that is very up-to-date and the users only need to access a small dataset sporadically or only a few users run queries on the dataset at the same time, you can read the data directly from the source during analysis and reporting. In this case the data is not archived in the SAP NetWeaver BI system. Data staging is virtual. You use the VirtualProvider here. This procedure is called direct access.

Monday, December 6, 2010

Integration, Storage and Management of Data

Comprehensive, meaningful data analyses are only possible if the datasets are bundled into a business query and integrated. These datasets can have different formats and sources. The data warehouse is therefore the basis for a business intelligence solution.

Enterprise data is collected centrally in the Enterprise Data Warehouse of SAP NetWeaver BI. The data is usually extracted from different sources and loaded into SAP NetWeaver BI. SAP NetWeaver BI supports all kinds of sources - relational and multidimensional, SAP and non-SAP. Technical cleanup steps are then performed and business rules are applied in order to consolidate the data for evaluations. The consolidated data is stored in the Enterprise Data Warehouse. This entire process is called extraction, transformation and loading (ETL).

Data can be stored in different layers of the data warehouse architecture with different granularities, depending on your requirements.  The data flow describes the path taken by the data through the data warehouse layers until it is ready for evaluation.

Data administration in the Enterprise Data Warehouse includes control of the processes that transfer the data to the Enterprise Data Warehouse and broadcast the data within the Enterprise Data Warehouse as well as convert strategies for optimal data retention and history keeping (limiting the data volume. This is also called Information Lifecycle Management.

With extraction to downstream systems, you can make the data consolidated in the Enterprise Data Warehouse available to further BI systems or further applications in your system landscape.

A metadata concept permits you to document the data in SAP NetWeaver BI using definitions or information in structured and unstructured form.

The Data Warehousing Workbench is the central work environment that provides the tools for performing the tasks in the SAP NetWeaver BI Enterprise Data Warehouse.

 >>>>>TOMMOROW'S CHAPTER  - ETL CONCEPTS

Tips for using jQuery

Find if something is hidden:


We use .hide(), .show() methods in jquery to change the visibility of an element. Use following code to check the whether an element is visible or not.
if($(element).is(":visible") == "true") {
//The element is Visible
}

Center an element on the Screen:

To make align the element to center.




jQuery.fn.center = function () {
this.css("position","absolute");
this.css("top", ( $(window).height() - this.height() ) / 2+$(window).scrollTop() + "px");
this.css("left", ( $(window).width() - this.width() ) / 2+$(window).scrollLeft() + "px");
return this;
}


//Use the above function as:
$(element).center();

Disable right-click contextual menu:

There’s many Javascript snippets available to disable right-click contextual menu, but JQuery makes things a lot easier:
$(document).ready(function(){
$(document).bind("contextmenu",function(e){
return false;
});
});

Get mouse cursor x and y axis:

This script will display the x and y value – the coordinate of the mouse pointer.
$().mousemove(function(e){
//display the x and y axis values inside the P element
$('p').html("X Axis : " + e.pageX + " | Y Axis " + e.pageY);
});
<p></p>

Font resizing:

Font Resizing is a very common feature in many modern websites. Here’s how to do it with JQuery.
$(document).ready(function(){
// Reset Font Size
var originalFontSize = $('html').css('font-size');
$(".resetFont").click(function(){
$('html').css('font-size', originalFontSize);
});
// Increase Font Size
$(".increaseFont").click(function(){
var currentFontSize = $('html').css('font-size');
var currentFontSizeNum = parseFloat(currentFontSize, 10);
var newFontSize = currentFontSizeNum*1.2;
$('html').css('font-size', newFontSize);
return false;
});
// Decrease Font Size
$(".decreaseFont").click(function(){
var currentFontSize = $('html').css('font-size');
var currentFontSizeNum = parseFloat(currentFontSize, 10);
var newFontSize = currentFontSizeNum*0.8;
$('html').css('font-size', newFontSize);
return false;
});
});

Preloading images:

When you’re using images in Javascript, a good thing is to preload it before you have to use it. This code will do the job:
jQuery.preloadImages = function()
{
for(var i = 0; i").attr("src", arguments[i]);
}
};

// Usage
$.preloadImages("image1.gif", "/path/to/image2.png", "some/image3.jpg");

MNP–Mobile Number Portability

INTRODUCTION

Mobile Number portability (MNP) enables mobile subscribers to change their service providers or their location without having to change their existing phone numbers. If the subscribers are not satisfied with the services of their service provider, they can change their service provider while retaining the existing phone number. This infuses competition among service providers and forces them to improve their service standards to check subscriber churn. Many countries have made number portability mandatory to liberalize competition. Many others are in the process of implementing it. A significant technical aspect of implementing number portability is related to the routing of calls or mobile messages (SMS, MMS) to a number once it is ported to some other network. This paper discusses:. types of number portability. various call routing schemes for service provider number portability. comparisons among various routing schemes. challenges of implementing number portability. best solution in terms of complexity of implementation, use of network resources, and scalability

TYPES OF NUMBER PORTABILITY

The various types of number portability are:.

Service Provider Number Portability: Subscribers can change the service provider while retaining the same phone number. It is also called operator portability.

Location Number Portability: Subscribers can change their service location while keeping the same telephone number.

Service Portability: Subscribers can change the subscribed services while retaining the same telephone number. Service portability allows the subscribers to enjoy the subscribed services in the same way when they roam outside their home networks

Sunday, December 5, 2010

How do I find out If Running Kernel Is 32 Or 64 Bit?

Target Audience: Beginners of Linux/Unix Users


Many beginners of Linux/Unix users might struggle or uncertain when they download softwares for Linux/Unix to choose correct software according to its kernel ie. 32 bit or 64 bit.



The uname command gives you the solution. Execute the following command in terminal:



$ uname -a

If the result contains x86_64, its 64 bit kernel.


If the result contains i386 or i486 or i586 or i686, its 32 bit kernel.

Saturday, December 4, 2010

Using find command in linux

Using find command in linux


find is a powerful command in linux. If u understand it then u can do most thing using it. but in this post i am not going to teach the full power of  it but some basic usage.

This is a simple one finding any .txt file in the home directory of vallu with exact size of 100kb


$find /home/vallu -name "*.txt" -size 100k

here this is a simple one finding any .txt file in the home directory of vallu with size greater than 100kb

$find /home/vallu -name "*.txt" -size +100k
here this is a simple one finding any .txt file in the home directory of vallu with size lesser than 100kb

$find /home/vallu/ -name "*.txt" -size -100k
this is also a simple command which finds any picture with .jpg extenstion which was accesed in past 5 mins


$find /home/vallu/ -name "*.jpg" -amin -5

this command finds any text file which are modified in last one min


$find /home/vallu -name "*.txt" -mmin -1


this command finds any text file which are created in last one day(24 hrs)

$find /home/vallu -name "*.txt" -ctime -1

Friday, December 3, 2010

5 CSS tricks you may not know


  1. Using multiple classes together

  2. Usually attributes are assigned just one class, but this doesn't mean that that's all you're allowed. You can actually assign as many classes as you like.

    For example:
    <div class="class1 class2"></div>

    The class names are separates by a space. So that means "class1" and "class2" calls up the rules assigned to the div. If any rules overlap

    between the two classes then the class which is below the other in the CSS document will take precedence.
  3. !important ignored by IE

  4. Normally in CSS whichever rule is specified last takes precedence. However if you use !important after a command then this CSS command will take precedence regardless of what appears after it. This is true for all browsers except IE.

    For example:
    margin-top: 3.5em !important; margin-top: 2em;

    So, the top margin will be set to 3.5em for all browsers except IE, which will have a top margin of 2em.
  5. Centre aligning a block element

  6. If you wanted to fixed a width website of layout, and the content floated in the middle of the screen.

    For example:
    #content
    {
    width: 750px;
    margin: 0 auto;
    }

  7. Changing Cursor

  8. The cursor property specifies the type of cursor to be displayed when pointing on an element.

    For example:
    #wrapper a:hover
    {
    cursor: pointer;    /*crosshair*/
    }

  9. Transparency

  10. This makes any element transparent.

    For example:
    .transparent_class {
    filter:alpha(opacity=50);
    -moz-opacity:0.5;
    -khtml-opacity: 0.5;
    opacity: 0.5;
    }

    This code makes the element 50% transparent- you can adjust the levels accordingly. Transparency is a bit weird because each browser reads it differently, so you need to make separate statements.

    opacity: This will work in most versions of Firefox, Safari, and Opera. This would be all you need if all browsers supported current standards.

    filter: This one you need for IE.

    -moz-opacity: You need this one to support way old school versions of the Mozilla browsers like Netscape Navigator.

    -khtml-opacity: This is for way old versions of Safari (1.x) when the rendering engine.

Get your free personal cloud -Ubuntu One

Introduction to Ubuntu One:


Ubuntu One is a personal cloud for everyone. It's just like syncing files, notes and contacts. You can access your contacts, notes or bookmarks from any computer or the web.
The mind blowing thing in it is you can enjoy accessing your favorite music or stuff from a your iPhone and Android phones. Though this seems to be a small thing it is just not small

now i want to tell the secret that it is not just like syncing files, notes and contacts, its like hosting your personal cloud. woooooo... thats great right. it means you can have your pc where ever and you can share it and if u want u can remove it. ubuntu one gives all cool stuff to monitor the pc, tablets, and what ever u are connected with it.

what u can get with it? ofcrs no need to fly to home if u have all ur stuffs there. what ever u want to do is to sync your folder with ubuntu one.

right now comes with these cool things specified below for free of cost with 2gb of space and if u want more then u can buy some more.
Automatic sync to keep all of your important data the same across all of your computers and your personal cloud.Unlimited computers you can use and there's no limit to the number of Ubuntu and Windows (beta) computers that you can sync.

Anytime, anywhere access everything from your desktop while offline or via a web browser when online

if u are still struck with your virus filled OS. don't worry ubuntu one can be accessed via your OS too. dont think that i am talking about MS platform. i m not gona talk about it anyway. wana try just go to https://one.ubuntu.com/ and enjoy

i have my own cloud with ubuntu one and i have lot n lot of data which i always want to use. guz what its my GF's pics. luv u honey.... ummmmmaaaaaaa.....

Thursday, December 2, 2010

SlideShow using jQuery

Creating Image Slide Show using jQuery:

In the code below you will see a surrounding div (id slideshow-area) which holds our slideshow content scroll area and our next and previous buttons. Inside our scroll area we have a div to hold the content and finally the content itself. As far as html goes this is pretty simple stuff.


<div id="slideshow-area">
<div id="slideshow-scroller">
<div id="slideshow-holder">
<div class="slideshow-content">
<img src="eureka_small.jpg" />
</div>
<div class="slideshow-content">
<img src="wallace_gromit_small.jpg" />
</div>
<div class="slideshow-content">
<img src="dead_like_me_small.jpg" />
</div>
</div>
</div>
<div id="slideshow-previous"></div>
<div id="slideshow-next"></div>
</div>

CSS is up next, it is slightly more complicated than the html but nothing too crazy. The first piece to look at is the positioning and sizing of main slide show area and scroller, which can have pretty much the same css. We do however add a border to our area to bring it out a little. The code below is fairly understandable, I make sure to set the position to relative so that I can easily position the next and previous buttons absolutely.





#slideshow-area, #slideshow-scroller {
width: 500px;
height: 500px;
position: relative;
overflow: hidden;
margin: 0 auto;
}

#slideshow-area {
border: 1px solid #000;
}



We are also going to set the height of the content holder to 500px, same as the area.




#slideshow-holder {
height: 500px;
}

The next two items are the previous and next buttons. They take a little bit more work to make sure they are in the correct position. The buttons also have background images for pretty arrows (sorry IE6 users it may look bad since the arrows are png files). I also set the cursor to hand and pointer - for browser compatibility. And finally we also have classes to identify and float left each piece of content in the slideshow.




#slideshow-previous, #slideshow-next {
width: 50px;
height: 50px;
position: absolute;
background: transparent url("arrow_left.png") no-repeat 50% 50%;
top: 225px;
display: none;
cursor: pointer;
cursor: hand;
}

#slideshow-next {
display: block;
background: transparent url("arrow_right.png") no-repeat 50% 50%;
top: 225px;
right: 0;
}

.slideshow-content {
float: left;
}


Well onto the real work, we now have to create the JavaScript to handle our functionality. jQuery makes this relatively simple though. First item is adding code to the document ready event.




var totalSlides = 0;
var currentSlide = 1;
var contentSlides = "";

$(document).ready(function(){
$("#slideshow-previous").click(showPreviousSlide);
$("#slideshow-next").click(showNextSlide);

var totalWidth = 0;
contentSlides = $(".slideshow-content");
contentSlides.each(function(i){
totalWidth += this.clientWidth;
totalSlides++;
});
$("#slideshow-holder").width(totalWidth);
$("#slideshow-scroller").attr({scrollLeft: 0});
updateButtons();
});


Next we need to create the two functions showPreviousSlide and showNextSlide. These two functions do mainly three things: change current slide number, update the buttons, and scroll the content. These functions along with support functions are below.




function showPreviousSlide()
{
currentSlide--;
updateContentHolder();
updateButtons();
}

function showNextSlide()
{
currentSlide++;
updateContentHolder();
updateButtons();
}

function updateContentHolder()
{
var scrollAmount = 0;
contentSlides.each(function(i){
if(currentSlide - 1 > i) {
scrollAmount += this.clientWidth;
}
});
$("#slideshow-scroller").animate({scrollLeft: scrollAmount}, 1000);
}

function updateButtons()
{
if(currentSlide < totalSlides) {
$("#slideshow-next").show();
} else {
$("#slideshow-next").hide();
}
if(currentSlide > 1) {
$("#slideshow-previous").show();
} else {
$("#slideshow-previous").hide();
}
}










CPU Power States

The CPU power states C0-C3 are defined as follows:

  • C0 is the operating state.

  • C1 (often known as Halt) is a state where the processor is not executing instructions, but can return to an executing state essentially instantaneously. All ACPI-conformant processors must support this power state. Some processors, such as the Pentium 4, also support an Enhanced C1 state (C1E or Enhanced Halt State) for lower power consumption,.

  • C2 (often known as Stop-Clock) is a state where the processor maintains all software-visible state, but may take longer to wake up. This processor state is optional.

  • C3 (often known as Sleep) is a state where the processor does not need to keep its cache coherent, but maintains other state. Some processors have variations on the C3 state (Deep Sleep, Deeper Sleep, etc.) that differ in how long it takes to wake the processor. This processor state is optional.



































Device power stateRegistry keyDescription
Full onD0Device is on and running. It is receiving full power from the system and is delivering full functionality to the user.
Low onD1Device is fully functional at a lower power or performance state than D0. D1 is applicable when the device is being used, but peak performance is unnecessary and power is at a premium.
StandbyD2Device is partially powered, with automatic wakeup on request.
SleepD3Device is partially powered, with device-initiated wakeup, if available. A device in state D3 is sleeping but capable of raising the system power state on its own. It consumes only enough power to be able to do so; which must be less than or equal to the amount of power used in state D2.
OffD4Device has no power. A device in state D4 should not be consuming any significant power. Some peripheral buses require static terminations that intrinsically use non-zero power when a device is physically connected to the bus. A device on such a bus can still support D4.

Have a happy day..

Escape String Literals for SQL

To run a SQL query with text data containing single quotes ' as well as other SQL reserved punctuations, and to prevent SQL injections, you will always want to escape the text values before using them in a SQL query.


mysql_real_escape_string() calls MySQL's library function mysql_real_escape_string, which prepends backslashes to the following characters: \x00, \n, \r, \, ', " and \x1a.




mysql_real_escape_string($content); 

"SELECT * FROM users WHERE user='%s' AND password='%s'", mysql_real_escape_string($user), mysql_real_escape_string($password)

Linux gzip and gunzip commands

gzip:

gzip compresses files in linux and unix.

If given a file as an argument, gzip compresses the file, adds a ".gz" suffix, and deletes the original file. With no arguments, gzip compresses the standard input and writes the compressed file to standard output( use ">" to redirect to a file).

Examples:Compress the file named vallu.txt. Creates vallu.gz and deletes vallu.txt.

$ gzip vallu.txt

Compress the file called vallu.txt. The standard output (which is the compressed file) is redirected by the shell to vallu.gz. Keeps vallu.txt.

$ gzip -c vallu.txt > vallu.gz

note: -c option Write compressed file to stdout and keeps the original file.

Some useful options are:

-1  Performance: Use fast compression (somewhat bigger result)

-9  Performance: Use best compression (somewhat slower)

gunzip:

gunzip uncompresses a file that was compressed with "gzip".

Examples:Uncompress the file named vallu.gz and extracts the vallu.txt in that compressed file and deletes vallu.gz.

$ gunzip vallu.gz

Uncompress the file named vallu.gz and extracts the vallu.txt in that compressed file and keeps the vallu.gz.

$ gunzip -c vallu.gz > vallu.txt

zcat:

zcat is also same as gunzip -c it is basically used to display the content of compressed fule.

Examples:

$zcat vallu.gz

Wednesday, December 1, 2010

Passing Parameters to Crystal Report in .Net

Now we are going to see, how we can show report by passing parameters or values. For example, Let us see how to retrieve details of an employee by means of Empid.


First Step


Create a table like the below structure.


Eg:


























Column nameDatatype
Namevarchar(50)
Empidvarchar(20)
Genderchar(10)
Designationvarchar(30)

Second Step


Create a crystal report and drag down your details. Create a parameter for empid. In the details right click the empid->select expert->select is equal to and select your parameter(here empid).


Third Step


Create a web or windows form add the control (Eg.dropdownlist, from where we are going to get the parameter) and add  crystalReportViewer in the same form.


Fourth Step


This is the time to add the code.


add the below packages to the code file,









using CrystalDecisions.CrystalReports.Engine;using CrystalDecisions.Shared;

add the below code to the Form_Load() event:

//setting the path of your crystal report

string path = “type the path of your report”;

this.crystalReportViewer1.ReportSource = path;

ReportDocument cryRpt = new ReportDocument();

cryRpt.Load(path);

//Creating parameters

ParameterFieldDefinitions crDefinitions;

ParameterFieldDefinition crDefinition;

ParameterValues crParameterValues = new ParameterValues();

ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue();

//Binding the parameter with class variable

crParameterDiscreteValue.Value = sample_class.empid; //you can save this value from your control

crDefinitions = cryRpt.DataDefinition.ParameterFields;

crDefinition = crDefinitions["empid"];//Parameter Name which is same in the table

crParameterValues = crDefinition.CurrentValues;

crParameterValues.Clear();

crParameterValues.Add(crParameterDiscreteValue);

crDefinition.ApplyCurrentValues(crParameterValues);

crystalReportViewer1.ReportSource = cryRpt;

crystalReportViewer1.Refresh();

Run your program and select the parameter(here empid).It will show the details of an employee.

Have a happy coding..

Java Design Pattern

Design Patterns are recurring solutions to design problems.

The 23 design patterns included in Design Patterns all had several known applications and were on a middle level of generality, where they could easily cross application areas and encompass several objects. These patterns are divided into 3 types.


  1. Creational Patterns: create objects for you, rather than your having to instantiate objects directly. Your programs gains more flexibility in deciding which objects need to be created for a given case.

  2. Structural Patterns: help you to compose group of objects to larger structures, such as complex user interfaces and accounting data.

  3. Behavioural Patterns: help you to define the communication between objects in your system and how the flow is controlled in a complex program.


Who Uses XML?

Introduction


XML (eXtensible Markup Language) is self-describing. XML tags act as metadata, describing each element. The main purpose is for information exchange between organizations, applications, services, processes, etc.

Who Uses XML?








































Financial
FIXMLFinancial Information eXchange Protocolhttp://www.fixprotocol.org
FPMLFinancial Product MLhttp://www.fpml.org
FUNDSMLFunds Markup Languagehttp://www.funds-xml.org
XBRLeXtensible Business Markup Languagehttp://www.xbrl.org
Publication etc.
SportMLSport Markup Languagehttp://www.sportsml.com
NewsMLNews Markup Languagehttp://www.newsml.org
XBITSXML Book Industry Transaction Standardshttp://www.xmlbits.org
XPRLeXtensible Public Relations Languagehttp://www.xprl.org
Life Sciences
BSMLBioinformatic Sequence Markup Languagehttp://www.bsml.org
CMLChemical Markup Languagehttp://www.xml-cml.org
Other
LandMLLand Development Markup Languagehttp://www.landml.org
MatMLMaterials Property Data Markup Languagehttp://www.matml.org
JXDMGlobal Justice XML Data Modelhttp://www.it.ojp.gov/jxdm/3.0/index.html
ebXMLElectronic Business using eXtensible Markup Languagehttp://www.ebxml.org

Quoting HTML attribute values

The values of attributes can contain text, hexadecimal color codes or numbers. In case of JavaScript event handlers, the values consist of small JavaScript code. A sincere advice for good and clean HTML coding is to always put quotes around attribute values. It is a good habit, will save you many headaches and avoid errors especially when attribute values contain spaces.



while using bgcolor="#ffffff" instead of bgcolor=#ffffff results is greater browser compatibility and differentiates it nicely from other attribute-value pairs.

Quoting attribute values is also required in XHTML. Your pages will fail the W3C validation if you leave the values hanking around with the quotes.

HTML mailto attribute

The HTML mailto is a quick way to add the facility of receiving feedback from visitor on the web site. when the visitor clicked the HTML mailto, It lanuches their email program with new email window.



Note: HTML mailto assumes that the visitor has configured an email client (Outlook Express, Netscape Messenger, Thunderbird or any other) to send emails.

The Basic form HTML mailto requires an email address.

Its looks like:
<a href="mailto:info@openshell.in">Feedback Form</a>

The Complex form HTML mailto by adding an email subject and the email body so that it looks a little more professional.

Its look Like:
<a href="mailto:info@openshell.in?subject=Feedback for Openshell.in&body=Thanks for Provinding useful Tips">Feedback Form</a>

In addition to the body and subject, we can also provide HTML mailto with CC (Carbon Copy) and BCC (Blind Carbon Copy). This, as you would have guessed, requires us to append these values to the HTML mailto attribute just like we had done for body and subject.

Its look Like:
<a href="mailto:info@openshell.in?subject=Feedback for Openshell.in&body=Thanks for Provinding useful Tips&cc=anotheremailaddress@anotherdomain.com&bcc=onemore@anotherdomain.com">Feedback Form</a>

HTML mailto is a quick and easy way for beginners and who don't know server-side programming languages (such as JSP, PHP, ROR etc.) to add a link on their web site for receiving visitor feedback.

SAP System Landscape:

(Kind Note: In this post i going to give a short hint about SAP system landscape don't consider this as a SAP Architecture. Often times, SAP users, especially new comers misunderstands these two concepts.)

They system landscape basically is the set-up or arrangement of your SAP servers. Ideally, in an SAP environment, a three-system landscape exists. A three-system landscape consists of the Development Server-DEV, Quality Assurance Server-QAS and the Production Server-PROD. This kind of set-up is not primarily designed to serve as server clusters in case of system failure, the objective to enhance "configuration pipeline management".

A Typical SAP Three-System Landscape would consist of one or two development system ==> one Quality system ==> Production system. (but it is not must to keep separate server for each systems, you can configure DEV & QAS on a same server but it is not advisable to keep PROD too in the same server)


Pipeline is the environment where the configuration in the development system is moved to the quality assurance system and finally to the production system. The whole idea is to sync the configuration of these systems at any point in time. Devlopment/configuration/changes are first made in the Development system, thoroughly tested in the Quality Assurance system then loaded into the production system. TMS Does this process nicely. Transport management system is the coordination of the movement of objects and configuration changes from the development system to the Quality Assurance system and then to the Production system.

Tips to inspect the code in Rails


  • Inspect


It inspects the value. It formats the array with square brace, hash with curly braces with arrows between the key value pairs

inspecting parameter.

  • Type


It identifying the type of the instance variable.

  • Debug


It give nice, easy to read inspection of the value and displayed in a formatted way.

These are all some good ways to see what is happening inside your application code.

Example

action inside the controller

def current_status

@my_array = [1,'king', 200]

@my_hash = {'name'=> 'Pinto'}

end

in view

<%= @my_array.inspect %>

<%= @my_hash.inspect %>

<%= params.inspect %>

Result:

[1,"king", 200]

{'name'=> 'Pinto'}

{"action"=>current_status, "controller"=>sample}

To inspect the data type use 'type':

in view

<%= @my_array.type %>

<%= @my_hash.type %>

Result:

Array

Hash

Another inspection method 'debug' :

in view

<%= debug(@my_array) %>

<%= debug(@my_hash) %>

Result:

---

-1

-king

-200

---

name: Pinto

Tuesday, November 30, 2010

Multiple Message Resource Bundle in Struts 1

Target Audience: Web Developer, Web Component Developer

What you should know already: Struts Web Framework, MVC Pattern, Knowledge of struts-config.xml file

Introduction


The message resource class in Struts allows the developer internationalizing web application easy and fast. The user can put labels of fields or description text in a central file and can access them later in the JSP File. The advantage is that you can reuse labels like error messages, titles in multiple JSP files and you can provide the ressource files in multiple languages.

message-resource Element


You might have already seen the message-resource element used in the file struts-config.xml

<message-resources parameter="ApplicationResource" null="false" />


However, it is not often recognized that you can use more than one of these elements in struts-config.xml file. For example, this is a perfectly legal configuration:
<message-resources parameter="ApplicationResrc_English" null="false" />
<message-resources parameter="ApplicationResrc_French" key="fr" />
<message-resources parameter="ApplicationResrc_German" key="gr" />


The first of these - without a key attribute - becomes the default resource set. So, all your JSPs and servlets have access to that set of resources through the servlet context.

Content of ApplicationResrc_English.properties is:
label.register=register
Content of ApplicationResrc_German.properties is:
label.register=registrieren

How to Access?


Your JSP page must indicate a resource if they want to use the non-default set (in this case ApplicationResrc_German). To do this, you will need to use the message tag, part of the bean tag library. So, assume that,

  • you have associated the bean tag library with bean prefix

  • you have got a property in the ApplicationResrc_German bundle with the key label.register, then


<bean:message bundle="gr" key="label.register" />
This will print registrieren

If you use without the bundle attribute, it will pick from the default resource set which from ApplicationResrc_English.properties file.

<bean:message key="label.register" />
This will print register

Thus, by configuring multiple message resource bundles in Struts 1, website can easily be internationalized.

Design Patterns

Some useful definitions of design patterns are:
Desingn patterns constitute a set of rules describing how to accomplish certain tasks in the realm of software development.

Design patterns focus more on reuse of recurring architectural design themes while frameworks focus on detailed design and implementation.

A pattern addresses a recurring design problem that arises in specific design situations and presents a solution to it.

Patterns identify and specify abstractions that are above the level of single classes and instances, or of components.

RequisitePro

Target Audience: Analysts, Designers, Project Managers,Team Members, System Integrators

Requirement Management

When you develop software products, failing to manage requirements decreases the probability of meeting the project objectives. Rational RequisitePro helps you manage project requirements.
Requirement Management is the process of eliciting, organizing and documenting requirements of the system. A requirements management process establishes and maintains agreement between the customer and team regarding changing requirements of the system.

What is Rational RequisitePro?

Rational RequisitePro

  • is a requirements management tool

  • enables you to track relationships between requirements

  • provides functionality to analyze the impact of changes to requirements


RequisitePro is integrated with Microsoft Word for creating document-based requirements. Team members use RequisitePro to:

  • plan projects by creating and editing requirements and requirements documents

  • gather, organize and document requirements

  • manage requirements

  • communicate with team members and stakeholders

  • perform project administrative tasks


Benefits of Rational RequisitePro

  • Maintains documents with the requirements dynamically linked to a database which enables sort and query capabilities

  • Identifies the impact of change with traceability features and impact analysis queries

    • scope management and resource allocation decisions



  • Integrates requirements with other life cycle artifacts and processes

    • clear communication accross tools and teams




Rational RequisitePro provides a groundwork for organizing and efficiently managing requirements and project document information


MVC

MVC is a design pattern.

It contains two models. MVC Model 1 and MVC Model 2.

Struts framework implements MVC Design Pattern.
Struts can implement Model 1 and Model 2.

Model 2 most properly describes the application of MVC in a Web-Application context.
Features of MVC1 Architecture:

(1) HTML or JSP files are used to code the presentation. JSP files use java beans to retrieve data if required.
(2)MVC1 architecture is page-centric design all the business and processing logic means any JSP page can either present in the JSP or may be called directly from the JSP page.
(3)Data access is usually done using Custom tag or through java bean call.
Therefore we can say that in MVC1 there is tight coupling between page and model.

Features of MVC2 Architecture:

(1)This architecture removes the page-centric property of MVC1 architecture by separating Presentation, Control logic and Application state
(2)In MVC2 architecture there is one Controller which receive all request for the application and is responsible for taking appropriate action in response to each request.
Second one is Model which is represented by JavaBeans, business object, and database.
Third one is View or is JSP page it takes the information provided by Controller and Module and presents it to user.

Main Difference between MVC1 and MVC2:

The main difference between MVC-I and MVC-II is in MVC-I all the view,control elements are implemented using Servlets. in MVC-II the view is implemented using JSP,and the controller is implemented using Servlets,as JSP provides better user interface than Servlets

OLAP VS OLTP

OLTP Vs OLAP

OLTP(On-Line Transaction Processing)

It is a set of information which processes a data transaction in a database system that manage transaction-oriented applications, typically for data entry and retrieval transaction processing.

OLAP(On-Line Analytical Processing)

OLAP is an approach to quickly provide answers to analytical queries that are multi-dimensional in  nature.It supports the regular retrieving of information depends upon the user input system in real time.

OLTP Vs OLAP

In general we can assume that OLTP systems provide source data to data warehouses, whereas OLAP systems help to analyze it.





















OLTPOLAP
Characterized by a large number of short on-line transactions (INSERT, UPDATE, DELETE).Characterized by relatively low volume of transactions.
OLTP systems is put on very fast query processing, maintaining data integrity.



in multi-access environments.
Queries are often very complex and involve aggregations.
Effectiveness measured by number of transactions per second.For OLAP systemsa response time is an effectiveness measure.

Before OLAP technology was well developed, data had to be extracted from databases using "queries".This meant that the analyst had to structure a request to the database for the information desired, and then
submitted this query to the database server.That server would processing query and return the results.

Depending on the size of the database and the data requested, this query could take minutes or hours to complete.In this sense, the "online" aspect of this type of reporting is questionable.For this purpose OLAP was developed.

In the next article we will see how to create a analysis services(that is creating cube in OLAP) in .net

Have a happy coding..

BI IN SAP NETWEAVER 7.0

Purpose
The reporting, analysis, and interpretation of business data is of central importance to a company in guaranteeing its competitive edge, optimizing processes, and enabling it to react quickly and in line with the market. With Business Intelligence (BI), SAP NetWeaver provides data warehousing functionality, a business intelligence platform, and a suite of business intelligence tools with which an enterprise can attain these goals. Relevant business information from productive SAP applications and all external data sources can be integrated, transformed, and consolidated in BI with the toolset provided. BI provides flexible reporting, analysis, and planning tools to support you in evaluating and interpreting data, as well as facilitating its distribution. Businesses are able to make well-founded decisions and determine target-orientated activities on the basis of this analysis.
 

Integration with Other SAP NetWeaver Components
BEx Information Broadcasting allows you to publish precalculated documents or online links containing business intelligence content to the portal. The Business Explorer portal role illustrates the various options that are available to you when working with content from BI in the portal. For more information, see Information Broadcasting.

The BEx Broadcaster, the BEx Web Application Designer, the BEx Query Designer, KM Content, SAP Role Uploads, and the Portal Content Studio are used to integrate BI contents into the portal. For more information, see Integrating BI Content into the Portal.

The documents and metadata created in BI (metadata documentation in particular) can be integrated using the repository manager in knowledge management. The BI Metadata Repository Manager is used within BEx Information Broadcasting. For more information, see BI Document Repository Manager and BI Metadata Repository Manager.

You can use SAP NetWeaver Exchange Infrastructure (SAP NetWeaver XI) to send data from SAP and non-SAP sources to BI. In BI, the data is placed in the delta queue where it is available for further integration and consolidation. Data transfer using SAP NetWeaver XI is SOAP-based. For more information, see Data Transfer Using SAP XI.

Integration with BI Content Add-On
With BI Content, SAP delivers preconfigured role and task-based information models and reporting scenarios for BI that are based on consistent metadata. BI Content provides selected roles within a company with the information they need to carry out their tasks. The information models delivered cover all business areas and integrate content from almost all SAP and selected external applications. For more information, see BI Content.

Rounded Corners

When CSS3 is fully supported across browsers rounded corners will be as simple as:



.element {border-radius: 5px}

which will set a 5px radius on all 4 corners. For now we need some browser specific CSS combined with a little JavaScript to make this work in all browsers.


In Safari, Chrome, and other webkit browsers we use -webkit-border-radius and in Firefox and other Mozilla based browsers we use -moz-border-radius.



.element {
border-radius: 5px
-webkit-border-radius: 5px
-moz-border-radius: 5px
}

Webkit and Mozilla use different syntax when specifying one corner.



.element {
border-top-left-radius: 5px
-webkit-border-top-left-radius: 5px
-moz-border-radius-top-left
}

For non Webkit and Mozilla browsers a little jQuery plugin will mimic the border-radius property.



$(".element").corner("5px");

The jQuery corner plugin allows for more than setting the radius of the corner. You can also set the corner to show as a number of other patterns.

Web Developer

The Web Developer Extension is a extension for the Firefox browser and it's a great tool for web designers. It has a variety off essential tools that allow you to code quality websites and troubleshoot problems easily. It's a powerful all in one plugin. Web Developer extension adds a menu and a toolbar to the browser with various web developer tools. The added benefit of having Web Developer Tool is the ability to edit CSS on the fly. If you want to try a different font, different size, different color, background, borders, margins, padding, practically anything to do with CSS, you can make the changes in the Web Developer tool and see the changes instantly. The Web Developer tool saves you time when playing around with CSS.

Essential Firefox Add-ons - MeasureIt

As someone who creates designs for the Internet, one of the most challenging job is to create design elements aligned. In that case MeasureIt comes in handy and allows you to overlay a ruler on a browser page so you can verify width, height and alignment of page elements. With this beautiful extension you can measure distances between any two points on the page.

Essential Firefox Add-ons - ColorZilla

ColorZilla add-on features an online eyedropper, which makes it quite simple to get the exact value of a specific color. With ColorZilla you can get a color reading from any point in your browser, quickly adjust this color and paste it into another program. In addition to color picker, ColorZilla offers a DOM color analyzer which allows you to locate elements on the page that correspond to a given color and find out the CSS rules that specify a certain color. ColorZilla also features a online palette viewer that allows choosing colors from pre-defined color sets and saving the most used colors in custom palettes.

Essential Firefox Add-ons - Firebug

Firebug integrates with Firefox to put a wealth of development tools at your fingertips while you browse. You can edit, debug, and monitor CSS, HTML, and JavaScript live in any web page. Firebug gives you full control over the CSS, HTML and JavaScript of any page that you choose. Inspect and edit HTML, Tweak CSS to perfection, Visualize CSS metrics, Monitor network activity, Debug and profile JavaScript, Quickly find errors, Explore the DOM, Execute JavaScript on the fly, Logging for JavaScript. Best of all, every change that you make is done live and instantly, so you can quickly test out different changes and see the results of those changes instantly.

Make 3D buttons view in CSS

3D CSS buttons are easy to create. The trick is to give your elements borders with different colors. Lighter where the light source shines and darker where it doesn't.
div#button {background: #888; border: 1px solid; border-color: #999 #777 #777 #999 }

The CSS above will create a button with the light source at the upper left. Usually one or two shades of color change is all that’s needed, but you can experiment for different effects.

Accessing parent documents in Flex

It will achieved by Application and Doccument object

Application object has the following characteristics:

* Application objects are MXML files with an <mx:Application> tag.
* Most Flex applications have a single Application object.
* The Application file is the first file loaded.
* An Application object is also a Document object.
* You can refer to the Application object as mx.core.Application.application from anywhere in the Flex application.
* If you load multiple nested applications by using the SWFLoader control, you can access the scope of each higher application by parentApplication.parentApplication, and so on.

Document object has the following characteristics:
* All MXML files that a Flex application uses are Document objects, including the Application object's file.
* Custom ActionScript component files are Document objects.
* The Flex compiler cannot compile a SWF file from a file that does not contain an <mx:Application> tag.
* Documents usually consist of MXML custom controls that you use in your Flex application.
* You can access the scope of a document's parent document by using parentDocument, parentDocument.parentDocument, and so on.
* Flex provides a UIComponent.isDocument property so that you can detect if any given object is a Document object.
Accessing Document and Application object scopes

mx.core.Application.application The top-level Application object, regardless of where in the document tree your object executes.

mx.core.UIComponent.parentDocument The parent document of the current document. You can use parentDocument.parentDocument to walk up the tree of multiple documents.

mx.core.UIComponent.parentApplication The Application object in which the current object exist

EXAMPLE:

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:MyComps="myComponents.*"
>
<mx:Script>
<![CDATA[

public function getSalutation():String {
return "Hi, " + mylbl.text;
}
]]>
</mx:Script>
<mx:Label  id="mylbl"  text="Guys"/>
<!-- Include the ButtonGetSalutation.mxml component. -->
<MyComps:ButtonGetSalutation/>

</mx:Application>

To access the mylbl(Label control) and call the getSalutation() method in your MXML components, you can use the application property, as the following example from the MyComponent.mxml component shows:

<?xml version="1.0"?>
<!-- containers\application\myComponents\ButtonGetSalutation.mxml -->
<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" height="100%">

<mx:Script>
<![CDATA[
/* To refer to the members of the Application class,
you must import mx.core.Application. */
import mx.core.Application;
]]>
</mx:Script>

<mx:Label id="myL"/>
<mx:Button label="Click Me" click="myL.text=Application.application.getSalutation();"/>
</mx:VBox>
Similarly use parentDocument.parentDocument.doSomething() for Document object.

Monday, November 29, 2010

SAP BI

What is SAP BI?

SAP BusinessObjects business intelligence (BI) solutions can empower your users to make effective, informed decisions based on solid data and analysis. All users, from the high-end analyst to the casual business user, can leverage business intelligence solutions to access to the information they need – with minimal dependence on IT resources and developers.

Sunday, November 28, 2010

Make use of toString() in Java

Every Java beginners must know about toString() method of java.lang.Object class. As you know java.lang.Object is the super most class in Java. Every pre-defined and user-defined class can override the methods available in the class java.lang.Object.

Of these, toString() method plays a vital role. See the following example:

int x = 100;
System.out.println(x);


This will print 100. Discuss the below example too:

class Student{
private String name;
public Student(String studentName){ name=studentName; }
private void setName(String name){ this.name=name; }
private String getName(){ return name; }
}


class ABC{
public static void main(String [] a){
Student s=new Student("Guru");
System.out.println(s);
}
}


Can you guess the output of the above program? Dirtily, it prints the object reference, not some meaningful information (such as student name, in this example). Now see this example:
class Student{
private String name;
public Student(String studentName){ name=studentName; }
private void setName(String name){ this.name=name; }
private String getName(){ return name; }
/** method overridden **/
public String toString(){ return name; }
}


class ABC{
public static void main(String [] a){
Student s=new Student("Guru");
System.out.println(s);
}
}


This prints Guru. So, overriding toString() method improves your object quality and very very helpful when you directly pass or print object.

Ruby Symbols Description

Matter related to the old and new Ruby programmer, and Ruby's symbols are confusing sometimes or always. Smoothly before this, can not get used is pretty. People learn about the Ruby language is often Rubionreiruzu learn from the project. The Rubionreiruzu symbol is everywhere. There really is everywhere. So, pay attention to the concept of a symbol of ruby, it's important to remember that.
Ruby is an instance of a symbol of class symbol. Put before the identifier symbol following the colon, ": name", ": id" or ": user". Ruby Symbol class includes a method of a class.




  1. all_symbols - Returns an array of all the symbols currently in Ruby’s symbol table.

  2. id2name - Returns the name or string corresponding to sym:, name.id2name the "name" back.

  3. inspect - Literally back to the symbol.

  4. to_i - Return a unique integer to each symbol. This method never raises an exception.

  5. to_s - id2name as same. Returns the string.

  6. to_sym - Returns the symbol corresponding to string.

Debugging Rails

You can always debug your application and get it back on the rails if ever it something goes wrong. You have to check the application log files. See to it that "tail –f" commands are running on the server.log and development.log. Rails will then show debugging and runtime information to these files and debugging information will also be displayed in the browser on requests from 127.0.0.1.

Using the Ruby logger class from inside your controllers, you can also log your own messages directly into the log file from your code like:
class ReportController < ActionController::Base

def destroy

@report = Report.find(params[:id])

@report.destroy

#Debug Log file

logger.info("#{Time.now} Destroyed Report ID ##{@report.id}!")

end

end

These are the available log levels, :debug, :info, :warn, :error, and :fatal, corresponding to the log level numbers from 0 up to 4 respectively.

Description:


logger.debug

The DEBUG level designates fine-grained informational events that are most useful to debug an application.

logger.info

The INFO level designates informational messages that highlight the progress of the application at coarse-grained level.

logger.warn

The WARN level designates potentially harmful situations.

logger.error

The ERROR level designates error events that might still allow the application to continue running.

logger.fatal

The FATAL level designates very severe error events that would presumably lead the application to abort.

To write in the current log use the logger.(debug|info|warn|error|fatal) method from within a controller, model or mailer.
The default Rails log level is info in production mode and debug in development and test mode.

Finders are great but be careful

Finders are very pleasant to use, enable you to write readable code and they don’t require in-depth SQL knowledge. But the nice high level abstraction come with a computational cost.


Follow these rules of thumb:





  1. Retrieve only the information that you need. A lot of execution time can be wasted by running selects for data that is not really needed. When using the various finders make sure to provide the right options to select only the fields required (:select), and if you only need a numbered subset of records from the resultset, opportunely specify a limit (with the :limit and :offset options).

  2. Don't kill your database with too many queries, use eager loading of associations through the include option:
    Avoid dynamic finders like MyModel.find_by_*. While using something like User.find_by_username is very readable and easy, it also can cost you a lot. In fact, ActiveRecord dynamically generates these methods within method_missing and this can be quite slow. In fact, once the method is defined and invoked, the mapping with the model attribute (username in our example) is ultimately achieved through a select query which is built before being sent to the database. Using MyModel.find_by_sql directly, or even MyModel.find, is much more efficient.

  3. Be sure to use MyModel.find_by_sql whenever you need to run an optimized SQL query. Needless to say, even if the final SQL statement ends up being the same, find_by_sql is more efficient than the equivalent find (no need to build the actual SQL string from the various option passed to the method). If you are building a plugin that needs to be cross-platform though, verify that the SQL queries will run on all Rails supported databases, or just use find instead. In general, using find is more readable and leads to better maintainable code, so before starting to fill your application with find_by_sql, do some profiling and individuate slow queries which may need to be customized and optimized manually.


Optimize your Ruby code

This may seem obvious, but a Rails application is essentially ruby code that will have to be run. Make sure your code is efficient from a Ruby standpoint. Take a look at your code and ask yourself if some refactoring is in order, keeping in mind performance considerations and algorithmic efficiency. Profiling tools are, of course, very helpful in identifying slow code, but the following are some general considerations (some of them may appear admittedly obvious to you):





  1. When available use the built-in classes and methods, rather than rolling your own;

  2. Use Regular Expressions rather than costly loops, when you need to parse and process all but the smallest text;

  3. Use Libxml rather than the slower REXML if you are processing XML documents;

  4. Sometimes you may want to trade off just a bit of elegance and abstraction for speed (e.g. define_method and yield can be costly);

  5. The best way to resolve slow loops, is to remove them if possible. Not always, but in a few cases you can avoid loops by restructuring your code;

  6. Simplify and reduce nested if/unless as much as you can and remember that the operator ||= is your friend;

  7. Hashes are expensive data structures. Consider storing the value for a given key in a local variable if you need to recall the value a few times. More in general, it’s a good idea to store in a variable (local, instance or class variable) any frequently accessed data structure.


Group operations in a transaction

ActiveRecord wraps the creation or update of a record in a single transaction. Multiple inserts will then generate many transactions (one for each insert). Grouping multiple inserts in one single transaction will speed things up.


Insead of:




 my_collection.each do |q|
Report.create({:phrase => q})
end


Use:




Report.transaction do
my_collection.each do |q|
Report.create({:phrase => q})
end
end



or for rolling back the whole transaction if any insert fails, use:




Report.transaction do
my_collection.each do |q|
report = Report.new({:phrase => q})
report.save!
end
end

Saturday, November 27, 2010

IBM DB2 Security Mechanisms

For every e-business solution, the company should give more sound for database security. The database security plan should define:


  • who is allowed to the instance and/or database

  • where and how a user's password will be verified

  • authority level that a user is granted

  • commands that a user is allowed to execute

  • data that a user is allowed to read and/or alter

  • database objects a user is allowed to create, alter, and/or drop



DB2 Security Mechanisms

There are 3 main mechanisms within DB2 that allow a DBA to implement a database security plan:

  1. Authentication

  2. Authorization

  3. Privileges


1. Authentication

Authentication is the first security feature you'll encounter when you attempt to access a DB2 instance or database. It works closely with the security features of the underlying operating system to verity the user IDs and passwords. It can also work with security protocols like kerberos to authenticate users.

2. Authorization

It involves determining the operations that user and/or groups can perform, and the data objects that they may access. An user's ability to perform high level database and instance management is determined by the authorities that they have been assigned. The 5 different authority levels within DB2 are

  1. SYSADM

  2. SYSCTRL

  3. SYSMAINT

  4. DBADM

  5. LOAD


3. Privileges

A bit more granular than authorities, and can be assigned to users and/or groups. It defines the commands that a user can use to access objects like tables, views, index and packages.

Locate ASP.Net AJAX AutoCompleteExtender inside TabContainer

ASP.Net Ajax contains rich array of controls used to create an interactive Web experience.While creating a ajax website you might face problems in binding two controls.For example locating AutoCompleteExtender inside the tab Container.Let us see how to solve this above problem.


1.   First, create the a script manager in your .aspx page.like this,


<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>


As a server-side control, ScriptManager reacts to events in the ASP.NET page life cycle and uses those events to coordinate the activities of all the controls, options, and code employed by ASP.NET AJAX.


2.   Create the Tab Container,inside it create one or more Tab Panel like


<cc1:TabContainer ID="Container1" runat="server"  ActiveTabIndex="1" >


<cc1:TabPanel ID="tpanel1" runat="server" HeaderText="Sample Tab">


<ContentTemplate>


//place other controls here(Eg:labels,buttons,textboxes,etc..)</ContentTemplate>


</cc1:TabPanel>


</cc1:TabContainer>


3.  Here AutoCompleteExtender is also acting as a controls of tpanel1,So your will be look like this


<cc1:TabContainer ID="Container1" runat="server"  ActiveTabIndex="1" >


<cc1:TabPanel ID="tpanel1" runat="server" HeaderText="Sample Tab">


<ContentTemplate>


//place other controls here(Eg:labels,buttons,textboxes,etc..)  including the textbox(txt_sample)


//here is the code for autocompleteextender


<cc1:AutoCompleteExtender ID="AutoCompleteExtender1"  runat="server" ServiceMethod="GetCompletionList1"
DelimiterCharacters="" Enabled="True" ServicePath="" CompletionInterval ="500" MinimumPrefixLength="1"
UseContextKey="True"  TargetControlID="txt_sample" >
</cc1:AutoCompleteExtender>


</ContentTemplate>


</cc1:TabPanel>


</cc1:TabContainer>


4. Create a Service Method in .cs page for working with autocomplete textbox.


Have a  Happy Coding...


Configuring JNDI data source in Tomcat

By using Java Naming and Directory Interface (JNDI) service, one can connect resources of different technologies.

A typical web application in Tomcat has a file called as context.xml in which the context path (root) of the web application is defined. Usually this file is located in META-INF directory of you web application (see figure 1). You can configure a JNDI data source in Tomcat by adding a declaration for your resource to this file. This is the application's context container, which enables you to specify application meta-data necessary for the server in order to deploy and run the application. There are various locations where you can specify context elements, such as your server's global i.e. tomcat-install-dir/conf/context.xml

[caption id="attachment_109" align="alignnone" width="264" caption="Figure 1: META-INF/context.xml"]context.xml[/caption]

Add the following Resource tag as a declaration for the JNDI resource. The code below is an example of how you can declare JNDI resource for MySQL database.

<?xml version="1.0"?>
<Context path="/abc">
<Resource name="jdbc/jndi-name"
auth="container"
type="javax.sql.DataSource"
maxActive="100"
maxIdle="30"
maxWait="10000"
username="yourusername"
password="yourpassword"
driverClass="com.mysql.jdbc.Driver"
url="jdbc:mysql://hostname:3306/databasename" />
</Context>

Friday, November 26, 2010

Prototyping Visualization

if you want to design a website or user interface for a website, one of the fundamental things to do is to make sure you have the interface designed well before you start building. The most general way to plan an interface are to use Wireframes.

Wireframes are line drawings, comparable to blueprints, which demonstrates the general navigation and the building blocks e.g. content, functionality etc. that will go into making of the website. The main rationale behind creating Wireframes is to sustain the flow of your particular logical and business functions by classifying all the entrance and exit points for every single page of your website.

Wireframes can be created manually on a paper. It is the easiest and fastest way of creating Wireframes. When time is short just put your layout ideas on a paper with a focus on what elements should go where.

Wireframes are crucial component of the initial development stage as they generate user expectations and help to boost the understanding and flow of a website by increasing acquaintance with the site.

During the creation of the project, Wireframes function as a firm and established base on which to consider changes and new requirements. Common page structure and content needs for individual web pages are easily conveyed using Wireframes.

Wireframes mostly lead to a better output in terms of superior product because they are also immensely helpful in getting valuable and accurate input.

Wireframes/Prototyping makes it easy to compare and evaluate different ideas and rival designs, which further makes it easier to incorporate changes.

Development cost and time are ultimately cut down by sizeable amount by getting a signoff on a detailed Wireframes because programmers making never-ending changes to their code have become a passe.

Some people prefer Visio, Adobe Illustrator, Photoshop, Freehand, Fireworks, and of course even PowerPoint, Dreamweaver, Adobe Indesign etc.

But the following are some of the other tools, which are less popular but have good stuff.

Dia
Website Wireframes Tools
Oversite
Gliffy
Protoshare
Jumpchart
Pencil
Denim

Wednesday, November 24, 2010

Find out IP address

We can get the IP address of any visitor by using PHP. Finding the IP address is very important requirement for many scripts where we store the members or visitors details. For security reason we can store IP address of our visitors who are doing any purchases or recording the geographical location of the visitor can be done this way. Some time based on the IP address we can redirect the browser to different areas of the site. There are many applications using this and here is the PHP code to know the IP address of any visitor to the site.
<?php
//Get IP Address
$ip = $_SERVER['REMOTE_ADDR'];
echo "<b>IP Address= $ip</b>";
?>

Tuesday, November 23, 2010

Send HTML Mail With PHP

Sending html email in php is extremely easy. All you have to do is call the “mail” function with some extra header.

Have a look on example:
<?php
//define the receiver of the email
$to = 'youraddress@example.com';

//define the subject of the email
$subject = 'Test HTML email';

//create a boundary string. It must be unique
//so we use the MD5 algorithm to generate a random hash
$random_hash = md5(date('r', time()));
//define the headers we want passed. Note that they are separated with \r\n
$headers = "From: webmaster@example.com\r\nReply-To: webmaster@example.com";

//add boundary string and mime type specification
$headers .= "\r\nContent-Type: multipart/alternative; boundary=\"PHP-alt-".$random_hash."\"";

//define the body of the message.
ob_start(); //Turn on output buffering
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

<h2>Hello World!</h2>
<p>This is something with <b>HTML</b> formatting.</p>

echo $random_hash;

//copy current buffer contents into $message variable and delete current output buffer
$message = ob_get_clean();

//send the email
$mail_sent = @mail( $to, $subject, $message, $headers );

//if the message is sent successfully print "Mail sent". Otherwise print "Mail failed"
echo $mail_sent ? "Mail sent" : "Mail failed";
?>