This can be a bit interesting thing that you can go for while adding an Index as required for your update session. As per our practice for better performance in our Informatica we prefer adding an index to be created while performing the dtata load. This is usually achieved through adding of an Index in the Pre SQL in the Target transformation (before loading into the target table) and then finally dropping the same Index with the one defined in Post SQL of our target transformation.

This was all going good with the index creating, session succeeding and finally the Index dropping after target loading. But then i face one scenario, where my target load fails of some reason, here the session completes with no execution of Post SQL, that is the index is not dropped. Well then when i executed the same session all again, to my surprise it Fails, showing the Index aloready exists!! Well well that was all because my index that was created in the last run was not dropped in the last time failed run.

Hmmm.. this is a interesting scenario and requires a permanent solution rather than a human intervention to drop the index every time the session fails. Then on my team mate’s advice i was able to give a stop to this issue by a simple SQL query which first checks for the availability of the index and then goes for creating or dropping before the Creation. The Pre SQL then shall look something like below,

IF EXISTS
(SELECT name FROM sysindexes WHERE name = ‘index_update’)
Drop index [index_update] on [Sample_Table]

CREATE NONCLUSTERED INDEX [index_update] ON [Sample_Table]
( [Column_Name] )

 Looks simple, but a very crucial one to have a smooth going to your workflow running. And as usual keep the Drop index as normal in the Post SQL,

Drop index [index_update] on [Sample_Table]

Thanks for a read, Just share with others as this may help someone.. as i did ūüôā

Its been long since i have posted something on design. Hard to stay away from design ūüôā

Let me share some really good web designs to inspire. Do not miss to scroll from top till bottom. These web designs below have got really cool footers that have got the best creative works all around the planet.

Zagrebfever

Tvrdek

Urbanpie

Twither

Mecannical

Thepixel

Grzegorzkozak

Midnightersclub

Snailbird

Thanks for reading this post. Do share your comments and¬†feedback¬†ūüôā

A yet another topic and a great article on C#(ASP.net) to share,

The Properties in C#:

The usual way of haing fields made them unsafe to be accessed (read and write) by any¬†external class that had an access to them. We can either make these variables unsafe¬†through a access modifier of “Private”, but then they can not be used in the other¬†classes.

To have a safer access to the member variables, where we can set the right to read or¬†write of any field in C#, we have got an extraordinary feature added up as “Properties”

csharp Properties Example

Sample Code:

using System;

namespace SampleProgram

{

public class Employee

{

private int emp_id = -1; //field with private access

//Property for the field emp_id as ID

public int ID

{

get { return emp_id; }

set { emp_id = value; }

}

private string emp_name = string.Empty;//field with private access with in this class

//Property for the field emp_name as NAME

public string NAME

{

get { return emp_name; }

set { emp_name = value; }

}

}

//Lets define the other class to initiate the Main method

public class EmployeeManager

{

public static void Main(String[] args)

{

Employee emp = new Employee();

emp.ID = 1011; //initializing id with the property

emp.NAME = “Mahaveer”; //initializing name with the property

Console.WriteLine(“Employee Id:{0}, Employee Name:{1}”, emp.ID,emp.NAME);

Console.ReadKey();

}

}

}

Advantage of using Properties You might ask a question Isn’t it better to make a field public than providing its property with both set { } and get { } block? After all the property will allow the user to both read and modify the field so why not use public field instead?

Not always! Properties are not just to provide access to the fields; rather, they are supposed to provide controlled access to the fields of our class. As the state of the class depends upon the values of its fields, using properties we can assure that no invalid (or unacceptable) value is assigned to the fields.

Here we go with one more big big advantage of having the Properties are to have a control over the freedom to allow either write or read alone right to the class using this property with the object instantiated,

Lets see to an example for Read Only Properties:

public class Employee

{

private int emp_id = -1; //field with private access

//Property for the field emp_id as ID

public int ID

{

get { return emp_id; }

}

private string emp_name = string.Empty;//field with private access with in this

class

//Property for the field emp_name as NAME

public string NAME

{

get { return emp_name; }

}

//Constructor for initializing the fields

public Employee(int employeeId, string employeeName)

{

emp_id = employeeId;

emp_name = employeeName;

}

}

//Lets define the other class to initiate the Main method

public class EmployeeManager

{

public static void Main(String[] args)

{

Employee emp = new Employee(1011, “Mahaveer”);

Console.WriteLine(“Employee Id:{0}, Employee Name:{1}”, emp.ID, emp.NAME);

Console.ReadKey();

}

}

Here in the above example as you can find the fields are not given a set in the¬†property, that makes it a read only property, hence these read only Properties can not¬†initialized directly. Therefore we have them initialized in the “Custom Constructor”¬†Employee(int employeeId,string employeeName).

As I said above, we can have both read opnly and write only Properties, I suppose you guys might have even got an idea of how to get this, just have a look at the below example that can make you understand it much easyly,

Write Only Properties example:

public class Employee

{

private int emp_id = -1; //field with private access

//Property for the field emp_id as ID

public int ID

{

set { emp_id = value; }

}

private string emp_name = string.Empty;//field with private access with in this class

//Property for the field emp_name as NAME

public string NAME

{

set { emp_name = value; }

}

//Method to display the Employee fields

public void DisplayEmployee()

{

Console.WriteLine(“Emplyee ID:{0}, Employee Nmae: {1}”, emp_id, emp_name);

}

}

//Lets define the other class to initiate the Main method

public class EmployeeManager

{

public static void Main(String[] args)

{

Employee emp = new Employee();

emp.ID = 1011;

emp.NAME = “Mahaveer”;

emp.DisplayEmployee();//To display the field values

Console.ReadKey();

}

}

This again as given above, allows the programmer only to have a write performed on the property, and so we have a method defined for displaying the Property that are written and so we get the output that displays the exact value that taken up by the Write only property.

Hope the examples have given a clear idea of what are the advantage of having our Properties defined for the fields. For any more queries on this you can get back to me.Keep visiting my blog for more interesting topics on C# and ASP.net.

This sounds one of the very interesting topic i have come across.

Adding a Jquery or JavaScript to your WordPress website is very simple and a very tricky thing to do. We can have any kind of a Jquery plugin to work on our WordPress Post or Page by simply adding the JQuery script in to the PHP file available in our Wordpress website. For this we must have a knowledge on the basic Jquery script adding knowledge, as we do in any normal HTML/XHTML web template.

Do get the Jquer/JavaScript code that you require to add in to your wordpress and make available all the files that you might require to add up. Now I did something like this:

Search for the “header.php”, must be available in your theme folder, and then add the code,

“<?php wp_enqueue_script(“jquery”); ?>”

above the code – “<?php wp_head(); ?>” available in your header.php.

Now add your Jquery that you would like to add up in your wordpress, but very important add it after the line “<?php wp_head(); ?>”. So the code after adding might look something like this,

<?php wp_enqueue_script(“jquery”); ?>

<?php wp_head(); ?>

<script type=”text/javascript” src=”<?php bloginfo(‘stylesheet_directory’); ?>/jquery-1.3.2.min.js”></script>

<script type=”text/javascript” src=”<?php bloginfo(‘stylesheet_directory’); ?>/ui.core.min.js”></script>

<script type=”text/javascript” src=”<?php bloginfo(‘stylesheet_directory’); ?>/ui.slider.min.js”></script>

<script type=”text/javascript” src=”<?php bloginfo(‘stylesheet_directory’); ?>/jquery.mousewheel.js”></script>

<script type=”text/javascript” src=”<?php bloginfo(‘stylesheet_directory’); ?>/jquery.gzoom.js”></script>

Here i have added the JQuery scripts Рjquery-1.3.2.min.js, ui.core.min.js, ui.slider.min.js, jquery.mousewheel.js,  jquery.gzoom.js.

So its a normal looking script adding in any normal HTML way, but we find the php code comprising of the SRC parameter given¬†in a different way. This is a pre written key word (“stylesheet_directory”) available in wordpress that takes you to the¬†default stylesheet directory of your theme in the wordpress.

In a similar way we can add the CSS file too that can be added something like,

<link rel=”stylesheet” href=”<?php bloginfo(‘stylesheet_directory’); ?>/jquery.gzoom.css” type=”text/css” />

and so i am done with my Jquery adding, just add your JQuery and make the code in the POST/PAGE adding on the admin side to be of structure that makes your JQuery to work, with the correct CLASS/ID name to be included.

Hope this post was informative. All your comments and reviews are welcome. Thank you.

%d bloggers like this: