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