Answer the phone by LEFT ear.
Do not drink coffee TWICE a day.
Do not take pills with COOL water.
Do not have HUGE meals after 5pm.
Reduce the amount of OILY food you consume.
Drink more WATER in the morning, less at night.
Keep your distance from hand phone CHARGERS.
Do not use headphones/earphone for LONG period of time.
Best sleeping time is from 10pm at night to 6am in the morning.
Do not lie down immediately after taking medicine before sleeping.
When battery is down to the LAST grid/bar, do not answer the phone as the radiation is 1000 times.
Forward this to those whom you CARE about!
---Thanks and care
Pradeep
Thursday, February 28, 2008
Thursday, February 07, 2008
I am a Brainbench certified C# programmer !!!!!
I`ve heardabout brainbench from lot of people, so when i got this link, i thought to have some fun, and i am brainbench certified C# developer !!!!!!!!!
According to your survey i am about of 76% of people had accessment -- not bad.
here is details,
my Report card
http://www.brainbench.com/xml/bb/transcript/public/viewtranscript.xml?pid=7120700
-- thanks
Pradeep
According to your survey i am about of 76% of people had accessment -- not bad.
here is details,
my Report card
http://www.brainbench.com/xml/bb/transcript/public/viewtranscript.xml?pid=7120700
-- thanks
Pradeep
Thursday, November 22, 2007
Make a copy of the object
if we have a object and want to create a deep copy of it,then we need to implement deepCopy or copy type of method in the class (Type). and this must be repeated with each type (class) you have in ur system and want to create a copy of the object,
this simple class will replicate the object without using much of the resource.
--Feedback are wellcome
thanks
Pradeep
///
/// Public class containing function to replicate object without implementing copy or DeepCopy type of function
///
public class DeepCopyClass
{
///
/// Make a copy of the object passed as argument
///
///
///
public static object DeepCopyOfAnyTypeOfObject(object objAnyTypeOfObject)
{
BinaryFormatter binFormater = new BinaryFormatter();
MemoryStream memStream = new MemoryStream();
binFormater.Serialize(memStream, objAnyTypeOfObject);
//Reset the posotion to initial so that it can read the bytes
memStream.Position = 0;
return binFormater.Deserialize(memStream);
}
}
this simple class will replicate the object without using much of the resource.
--Feedback are wellcome
thanks
Pradeep
///
/// Public class containing function to replicate object without implementing copy or DeepCopy type of function
///
public class DeepCopyClass
{
///
/// Make a copy of the object passed as argument
///
///
///
public static object DeepCopyOfAnyTypeOfObject(object objAnyTypeOfObject)
{
BinaryFormatter binFormater = new BinaryFormatter();
MemoryStream memStream = new MemoryStream();
binFormater.Serialize(memStream, objAnyTypeOfObject);
//Reset the posotion to initial so that it can read the bytes
memStream.Position = 0;
return binFormater.Deserialize(memStream);
}
}
Friday, September 21, 2007
Difference between Focusing on Problems and Focusing on Solutions
Difference between Focusing on Problems and Focusing on Solutions
Case 1
When NASA began the launch of astronauts into space, they found out that the pens wouldn't work at zero gravity (Ink won't flow down to the writing surface). To solve this problem, it took them one decade and $12 million.
They developed a pen that worked at zero gravity, upside down, underwater, in practically any surface including crystal and in a temperature range from below freezing to over 300 degrees C.
And what did the Russians do...?? They used a pencil.
Case 2
One of the most memorable case studies on Japanese management was the case of the empty soapbox, which happened in one of Japan's biggest cosmetics companies. The company received a complaint that a consumer had bought a soapbox that was empty. Immediately the authorities isolated the problem to the assembly line, which transported all the packaged boxes of soap to the delivery department. For some reason, one soapbox went through the assembly line empty. Management asked its engineers to solve the problem.
Post-haste, the engineers worked hard to devise an X-ray machine with high-resolution monitors manned by two people to watch all the soapboxes that passed through the line to make sure they were not empty. No doubt, they worked hard and they worked fast but they spent a whoopee amount to do so.
But when a file employee in India in a small company was posed with the same problem, he did not get into complications of X-rays, etc., but instead came out with another solution. He bought a strong industrial electric fan and pointed it at the assembly line. He switched the fan on, and as each soapbox passed the fan, it simply blew the empty boxes out of the line.
Moral:
Always look for simple solutions.
Devise the simplest possible solution that solves the problems
Always focus on solutions & not on problems
So at the end of the day, the thing that really matters is HOW ONE LOOK INTO THE PROBLEM, mere perceptions can solve the toughest of problems....
Case 1
When NASA began the launch of astronauts into space, they found out that the pens wouldn't work at zero gravity (Ink won't flow down to the writing surface). To solve this problem, it took them one decade and $12 million.
They developed a pen that worked at zero gravity, upside down, underwater, in practically any surface including crystal and in a temperature range from below freezing to over 300 degrees C.
And what did the Russians do...?? They used a pencil.
Case 2
One of the most memorable case studies on Japanese management was the case of the empty soapbox, which happened in one of Japan's biggest cosmetics companies. The company received a complaint that a consumer had bought a soapbox that was empty. Immediately the authorities isolated the problem to the assembly line, which transported all the packaged boxes of soap to the delivery department. For some reason, one soapbox went through the assembly line empty. Management asked its engineers to solve the problem.
Post-haste, the engineers worked hard to devise an X-ray machine with high-resolution monitors manned by two people to watch all the soapboxes that passed through the line to make sure they were not empty. No doubt, they worked hard and they worked fast but they spent a whoopee amount to do so.
But when a file employee in India in a small company was posed with the same problem, he did not get into complications of X-rays, etc., but instead came out with another solution. He bought a strong industrial electric fan and pointed it at the assembly line. He switched the fan on, and as each soapbox passed the fan, it simply blew the empty boxes out of the line.
Moral:
Always look for simple solutions.
Devise the simplest possible solution that solves the problems
Always focus on solutions & not on problems
So at the end of the day, the thing that really matters is HOW ONE LOOK INTO THE PROBLEM, mere perceptions can solve the toughest of problems....
Friday, August 03, 2007
how to invoke a new application from .net
how to invoke a new application from .net
public enum OpenMode
{
Mode_HIDE = 0,
Mode_SHOWNORMAL = 1,
Mode_SHOWMINIMIZED = 2,
Mode_SHOWMAXIMIZED = 3,
Mode_MAXIMIZE = 3,
Mode_SHOWNOACTIVATE = 4,
Mode_SHOW = 5,
Mode_MINIMIZE = 6,
Mode_SHOWMINNOACTIVE = 7,
Mode_SHOWNA = 8,
Mode_RESTORE = 9,
Mode_SHOWDEFAULT = 10,
Mode_FORCEMINIMIZE = 11,
}
[DllImport("shell32.dll")]
static extern IntPtr ShellExecute(IntPtr hwnd, string lpOperation, string lpFile, string lpParameters, string lpDirectory, OpenMode opnMode);
and use this method to call exes
//ShellExecute(this.Handle,"open",textBox1.Text,"","",ShowCommands.SW_MAXIMIZE);
// ShellExecute( IntPtr.Zero, "open", "mailto:support@microsoft.com", "", "", ShowCommands.SW_SHOWNOACTIVATE );
//ShellExecute( this.Handle, "open", textBox1.Text, "", "", ShowCommands.SW_SHOWNOACTIVATE );
and replace textBox1.Text with proper exename
public enum OpenMode
{
Mode_HIDE = 0,
Mode_SHOWNORMAL = 1,
Mode_SHOWMINIMIZED = 2,
Mode_SHOWMAXIMIZED = 3,
Mode_MAXIMIZE = 3,
Mode_SHOWNOACTIVATE = 4,
Mode_SHOW = 5,
Mode_MINIMIZE = 6,
Mode_SHOWMINNOACTIVE = 7,
Mode_SHOWNA = 8,
Mode_RESTORE = 9,
Mode_SHOWDEFAULT = 10,
Mode_FORCEMINIMIZE = 11,
}
[DllImport("shell32.dll")]
static extern IntPtr ShellExecute(IntPtr hwnd, string lpOperation, string lpFile, string lpParameters, string lpDirectory, OpenMode opnMode);
and use this method to call exes
//ShellExecute(this.Handle,"open",textBox1.Text,"","",ShowCommands.SW_MAXIMIZE);
// ShellExecute( IntPtr.Zero, "open", "mailto:support@microsoft.com", "", "", ShowCommands.SW_SHOWNOACTIVATE );
//ShellExecute( this.Handle, "open", textBox1.Text, "", "", ShowCommands.SW_SHOWNOACTIVATE );
and replace textBox1.Text with proper exename
Wednesday, July 18, 2007
"as in C#" can be used with reference type or nullable types
ControlTypeEnum myEnum = Enum.ToObject(typeof(ControlTypeEnum),id) as ControlTypeEnum ;
here ControlTypeEnum as an Enum
and id is int value
will give an error
"Error 2 The as operator must be used with a reference type or nullable type ('ControlTypeEnum' is a non-nullable value type) "
because if type casting is not possible then in that case reference point to null, and in case of value type -we do not have the concept of null .
so .net 2.0 has concept of nullable types, like int?, float? (hay there is no string? - do u kow why ? think and u will get it.)
so proper syntex of the previous one is
ControlTypeEnum? myEnum = Enum.ToObject(typeof(ControlTypeEnum),id) as ControlTypeEnum ;
or
ControlTypeEnum myEnum = (ControlTypeEnum ) Enum.ToObject(typeof(ControlTypeEnum),id) ;
--thanks
Pradeep
here ControlTypeEnum as an Enum
and id is int value
will give an error
"Error 2 The as operator must be used with a reference type or nullable type ('ControlTypeEnum' is a non-nullable value type) "
because if type casting is not possible then in that case reference point to null, and in case of value type -we do not have the concept of null .
so .net 2.0 has concept of nullable types, like int?, float? (hay there is no string? - do u kow why ? think and u will get it.)
so proper syntex of the previous one is
ControlTypeEnum? myEnum = Enum.ToObject(typeof(ControlTypeEnum),id) as ControlTypeEnum ;
or
ControlTypeEnum myEnum = (ControlTypeEnum ) Enum.ToObject(typeof(ControlTypeEnum),id) ;
--thanks
Pradeep
Wednesday, June 13, 2007
how to rename tables
select ' exec sp_rename '''+ name + ''' , ''zOLD_'+name +'''' from sys.objects where type_desc = 'user_table' and name not like 'zold%' order by [name]
here
name - actual table name
changed name will be zOLD_[TableName]
selected from sys.tables, alternatively u can select it from sys table
execute this query and copy the result into new Query analyser
and here is script that will do the disaster.
thanks
Pradeep
here
name - actual table name
changed name will be zOLD_[TableName]
selected from sys.tables, alternatively u can select it from sys table
execute this query and copy the result into new Query analyser
and here is script that will do the disaster.
thanks
Pradeep
Friday, June 01, 2007
The type System.Collections.Hashtable is not supported because it implements IDictionary.
When you will work with webservices and want to
1. Send an object that implements IDirectory Interface
2. Receive an object that Implement IDirectory Interface
most commonly used object from this category is HashTable.
so if a hashtable is passed to or returned froma a webmethod, we get a very specific error.
"The type System.Collections.Hashtable is not supported because it implements IDictionary."
this is because "IDictionary cannot be serialized via XML".
here is very interesting fact from MS guy (Dare Obasanjo,Microsoft Corporation,January 23, 2003)
Q: Why can't I serialize hashtables?
A: The XmlSerializer cannot process classes implementing the IDictionary interface.
This was partly due to schedule constraints and partly due to the fact that a hashtable does not have a
counterpart in the XSD type system. The only solution is to implement a custom hashtable that does not
implement the IDictionary interface.
(http://msdn2.microsoft.com/en-us/library/ms950721.aspx)
there are many possible solutions out of them here are two :
1. Convert this object into Jagged Arrays.
2. Implement a custom object which behave like wrapper to this hashtable (remember it must not expose this hashtable publicily).
1. Jagged arrrays :-
A Jagged arrray is nothing but arrays of arrays (any type) OR
A jagged array is a single dimensional array of arrays. The elements of a jagged array can be of different dimensions and sizes. It’s better to use jagged arrays instead of multidimensional arrays to benefit from MSIL performance optimizations. MSIL has specific instructions that target single dimensional zero-based arrays and even access to this type of array is optimized
EX. int[][] intJagged;
Or object [][]objHashTable
Or T[][] CustomTypeArray
There are two possibilites,
if your data contains one level of information means value field of hashtable contains premitive datatype values you can use
any of premitive type of jagged array.
object [][]objHashTable
and if it of custom type them use
T [][] objCustom
Note : this schenerio is not tested please verify it before use.
2. Custom object :-
In my case this hashtable was containing DataObject of a type which was subtype of for another DataObject means there was one to many relation
so i implemented it like this
subTypeDO
{
attributes ;
}
superTypeDO
{
attributes;
List objSubTypeDO;
}
remember in this case subTypeDO is a fat Data object (other wise jagged arrays are perfect)
Another use of collections in .net .
Try which one works for you, may be u`ll find some other way, second one worked for me.
Thanks
1. Send an object that implements IDirectory Interface
2. Receive an object that Implement IDirectory Interface
most commonly used object from this category is HashTable.
so if a hashtable is passed to or returned froma a webmethod, we get a very specific error.
"The type System.Collections.Hashtable is not supported because it implements IDictionary."
this is because "IDictionary cannot be serialized via XML".
here is very interesting fact from MS guy (Dare Obasanjo,Microsoft Corporation,January 23, 2003)
Q: Why can't I serialize hashtables?
A: The XmlSerializer cannot process classes implementing the IDictionary interface.
This was partly due to schedule constraints and partly due to the fact that a hashtable does not have a
counterpart in the XSD type system. The only solution is to implement a custom hashtable that does not
implement the IDictionary interface.
(http://msdn2.microsoft.com/en-us/library/ms950721.aspx)
there are many possible solutions out of them here are two :
1. Convert this object into Jagged Arrays.
2. Implement a custom object which behave like wrapper to this hashtable (remember it must not expose this hashtable publicily).
1. Jagged arrrays :-
A Jagged arrray is nothing but arrays of arrays (any type) OR
A jagged array is a single dimensional array of arrays. The elements of a jagged array can be of different dimensions and sizes. It’s better to use jagged arrays instead of multidimensional arrays to benefit from MSIL performance optimizations. MSIL has specific instructions that target single dimensional zero-based arrays and even access to this type of array is optimized
EX. int[][] intJagged;
Or object [][]objHashTable
Or T[][] CustomTypeArray
There are two possibilites,
if your data contains one level of information means value field of hashtable contains premitive datatype values you can use
any of premitive type of jagged array.
object [][]objHashTable
and if it of custom type them use
T [][] objCustom
Note : this schenerio is not tested please verify it before use.
2. Custom object :-
In my case this hashtable was containing DataObject of a type which was subtype of for another DataObject means there was one to many relation
so i implemented it like this
subTypeDO
{
attributes ;
}
superTypeDO
{
attributes;
List
}
remember in this case subTypeDO is a fat Data object (other wise jagged arrays are perfect)
Another use of collections in .net .
Try which one works for you, may be u`ll find some other way, second one worked for me.
Thanks
Tuesday, January 16, 2007
TimeOut Expired in ado.net and sql server
Some times we feel if we can speed up the sqlserver , or database, and get rid of the a specific problem named "timeout expired"
here`s a link for the same , and now onwards u will not pray to god, we have solution at ur hand
let`s go
thanks
Pradeep Tiwari
here`s a link for the same , and now onwards u will not pray to god, we have solution at ur hand
let`s go
thanks
Pradeep Tiwari
Monday, January 15, 2007
timeout expired - ado.net
Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
Help for ADO.net objects
Some times we get “timeout expired” error.
It may be because of actually time allocated to a particular operation is getting timeout so start debugging.
1st thing to keep in mind is there is two types of time out
1. Connection time out (which is property (read only) of connection object) default (15 sec)
2. Command time out (which is property (read , write) of command object) default (30 sec)
To start with 1st one means Connection Time out : solution is to increase the value say 60 seconds
And for this you will rush to your connection object and as u got a property named ConnectionTimeout and u wil put the code
conn.ConnectionTimeout = 60; (60 seconds)
and according to you every thing is okey, BUT NOT ACCORDING TO ADO.NET
this is read only property.
Work around is to chage your connection string (usually we have this in our web.config or app.config) by putting “connection timeout = 60” or “connect timeout = 60”
Now is you check your connection string, it will use 60 seconds value.
This solution may or may not resolve the problem as there is an another operation connection to this “command” and command it self call time out.
This is 2nd case
To start with Command Time out : solution is increase the value say 60 seconds
And again for this you will rush to ur web.config or app.config and try to accommodate “command timeout = 60” but this will not work for your kind information, information placed at this place is used by connection not by command object.
The work around is, command.commandTimeout is a read and write property means you can set the value directly in code.
Like “Command.CommandTimeout = 900”, if u r using DataAdopter, not a issue just use its proper command type (select, update , delete).
And set this property to a numeric value.
(best example of lateral thinking)
or you can access the same at
timeout Expired
Help for ADO.net objects
Some times we get “timeout expired” error.
It may be because of actually time allocated to a particular operation is getting timeout so start debugging.
1st thing to keep in mind is there is two types of time out
1. Connection time out (which is property (read only) of connection object) default (15 sec)
2. Command time out (which is property (read , write) of command object) default (30 sec)
To start with 1st one means Connection Time out : solution is to increase the value say 60 seconds
And for this you will rush to your connection object and as u got a property named ConnectionTimeout and u wil put the code
conn.ConnectionTimeout = 60; (60 seconds)
and according to you every thing is okey, BUT NOT ACCORDING TO ADO.NET
this is read only property.
Work around is to chage your connection string (usually we have this in our web.config or app.config) by putting “connection timeout = 60” or “connect timeout = 60”
Now is you check your connection string, it will use 60 seconds value.
This solution may or may not resolve the problem as there is an another operation connection to this “command” and command it self call time out.
This is 2nd case
To start with Command Time out : solution is increase the value say 60 seconds
And again for this you will rush to ur web.config or app.config and try to accommodate “command timeout = 60” but this will not work for your kind information, information placed at this place is used by connection not by command object.
The work around is, command.commandTimeout is a read and write property means you can set the value directly in code.
Like “Command.CommandTimeout = 900”, if u r using DataAdopter, not a issue just use its proper command type (select, update , delete).
And set this property to a numeric value.
(best example of lateral thinking)
or you can access the same at
timeout Expired
Tuesday, December 26, 2006
Tuesday, December 05, 2006
Tips when working With Master page or SqlDataSource insert function
ADD by Google
Hello here is a posting related to cross container controls access and also a tip related to SqlDataSource.
Go
When We are Working with subcontainers and wanted to access controls from other containers, which is more prominent situation with Master pages , inbuild container controls comes along with VS or with user controls, a tip related to this and a tip related to datasource`s insert command text .
So just into the posting
thanks
Pradeep
Hello here is a posting related to cross container controls access and also a tip related to SqlDataSource.
Go
When We are Working with subcontainers and wanted to access controls from other containers, which is more prominent situation with Master pages , inbuild container controls comes along with VS or with user controls, a tip related to this and a tip related to datasource`s insert command text .
So just into the posting
thanks
Pradeep
Wednesday, August 30, 2006
introduction of HashTable using .net
Many a times we need to store similar data in our propgram, and you might encounter the situation where the descriminating item is not an integer value ,
What to do? Use Hashtable ..
Enjoy Have nice Time !!!
Pradeep Tiwari
What to do? Use Hashtable ..
Enjoy Have nice Time !!!
Pradeep Tiwari
Tuesday, August 22, 2006
Hello here`s a posting on Dynamic building and execution of assembly at runtime in .net, this posting is coded in .net 2.0 but can be modified for .net 1.x
Enjoy !
have nice time
Pradeep Tiwari
Enjoy !
have nice time
Pradeep Tiwari
Monday, August 21, 2006
Subscribe to:
Posts (Atom)