Wednesday, March 14, 2012

DataContext.SubmitChanges - Doesn't update data to DB

DataContext.SubmitChanges doesn't update data to DB if primary key is not set to the table. .Net framework wouldn't throw any error, but the data wouldn't get update.

Tuesday, February 7, 2012

.Net FAQ

-----------------------------------------------------------------------------
C# Frequently Asked Questions
http://blogs.msdn.com/b/csharpfaq/default.aspx?PageIndex=2

------------------------------------------------------------------------------
1. Default access specifier

Classes and structs that are declared directly within a namespace (in other words, that are not nested within other classes or structs) can be either public or internal. Internal is the default if no access modifier is specified.

http://msdn.microsoft.com/en-us/library/ms173121%28v=vs.90%29.aspx

2. Protected Internal
The type or member can be accessed by any code in the assembly in which it is declared, or from within a derived class in another assembly. Access from another assembly must take place within a class declaration that derives from the class in which the protected internal element is declared, and it must take place through an instance of the derived class type.

Note:
The protected internal accessibility level means protected OR internal, not protected AND internal. In other words, a protected internal member can be accessed from any class in the same assembly, including derived classes. To limit accessibility to only derived classes in the same assembly, declare the class itself internal, and declare its members as protected.
http://msdn.microsoft.com/en-us/library/ms173121%28v=vs.90%29.aspx

3. Advantages of Delegates

They're a great way of encapsulating a piece of code. For instance, when you attach an event handler to the button, that handler is a delegate. The button doesn't need to know what it does, just how to call it at the right time.

Another example is LINQ - filtering, projecting etc all require the same kind of template code; all that changes is the logic to represent the filter, the projection etc. With lambda expressions in C# 3 (which are converted into delegates or expression trees) this makes it really simple:

var namesOfAdults = people.Where(person => person.Age >= 18)
.Select(person => person.Name);

(That can also be represented as a query expression, but let's not stray too far from delegates.)

Another way of thinking of a delegate is as a single-method interface type. For example, the EventHandler delegate type is a bit like:

public interface IEventHandler
{
void Invoke(object sender, EventArgs e)
}

But the delegate support in the framework allows delegates to be chained together, invoked asynchronously, used as event handlers etc.

For more on delegates and events, see my article on the topic. Its focus is events, but it covers delegates too.

http://stackoverflow.com/questions/639320/what-are-the-advantages-of-delegates

4. Function Overloading in webservices

The function overloading in Web Service is not as straightforward as in class. While trying to overload member function, we make two or more methods with the same name with different parameters. But this will not work in web services and will show runtime error because WSDL is not supported by the same method name.

http://www.codeproject.com/Articles/30018/Function-Overloading-in-Web-Services

5.Web services vs WCF
http://msdn.microsoft.com/en-us/library/aa738737.aspx

http://www.codeproject.com/Articles/45698/WCF-Comparison-with-Web-Services-and-NET-Remoting

6. How to consume .net web services from java/python. How dataset will be processed.?
At design time, when the Java developer runs WSDL2Java, there isn't enough information in the schema definition to do anything.Hence, In order for Java developers to consume this Web Service, they'll have to drop down and use their equivalent DOM API directly.


http://msdn.microsoft.com/en-us/magazine/cc188755.aspx


7. Abstract Classes vs. Interfaces
http://msdn.microsoft.com/en-us/library/scsyfw1d%28v=vs.71%29.aspx

8. What is an asax file.
http://msdn.microsoft.com/en-us/library/1xaas8a2%28v=vs.71%29.aspx

9.MutliCast delegates
http://msdn.microsoft.com/en-us/library/ms173175.aspx

10. Sealed Class

The main purpose of a sealed class to take away the inheritance feature from the user so they cannot derive a class from a sealed class. One of the best usage of sealed classes is when you have a class with static members. For example, the Pens and Brushes classes of the System.Drawing namespace.
The Pens class represent the pens for standard colors. This class has only static members. For example, Pens.Blue represents a pen with blue color. Similarly, the Brushes class represents standard brushes. The Brushes.Blue represents a brush with blue color.
So when you're designing your application, you may keep in mind that you have sealed classes to seal user's boundaries.

http://www.c-sharpcorner.com/UploadFile/mahesh/SealedClasses11142005063733AM/SealedClasses.aspx

http://codebetter.com/patricksmacchia/2008/01/05/rambling-on-the-sealed-keyword/

http://www.codeproject.com/Articles/239939/Csharp-Tweaks-Why-to-use-the-sealed-keyword-on-cla

11. Static Classes and Static Class Members
http://msdn.microsoft.com/en-us/library/79b3xss3%28v=vs.80%29.aspx

12.What is the difference between const and static readonly?
http://blogs.msdn.com/b/csharpfaq/archive/2004/12/03/274791.aspx

13.Static Class vs Singleton

What makes you say that either a singleton or a static method isn't thread-safe? Usually both should be implemented to be thread-safe.

The big difference between a singleton and a bunch of static methods is that singletons can implement interfaces (or derive from useful base classes, although that's less common IME), so you can pass around the singleton as if it were "just another" implementation.

http://stackoverflow.com/questions/519520/difference-between-static-class-and-singleton-pattern

14.Primary Interop Assemblies
http://msdn.microsoft.com/en-us/library/aax7sdch.aspx

15.What is SOAP Prootcol

16.Access Modifiers
http://msdn.microsoft.com/en-us/library/wxh6fsc7%28v=vs.71%29.aspx

17. Indexes in SQL
http://www.sqlservercentral.com/articles/Stairway+Series/72284/

18. ExecuteQuery-Vs-ExecuteNonQuery
http://www.dotnetspider.com/forum/98072-ExecuteQuery-Vs-ExecuteNonQuery.aspx

19. ExecuteQuery VS ExecuteReader

20. idictionary
http://msdn.microsoft.com/en-us/library/system.collections.idictionary.aspx

21. Hash table vs. Dictionary

The Dictionary class has the same functionality as the Hashtable class. A Dictionary of a specific type (other than Object) has better performance than a Hashtable for value types because the elements of Hashtable are of type Object and, therefore, boxing and unboxing typically occur if storing or retrieving a value type.
http://msdn.microsoft.com/en-us/library/4yh14awz%28v=vs.80%29.aspx

22. Layered Archtecture and Multitier architecture
The concepts of layer and tier are often used interchangeably. However, one fairly common point of view is that there is indeed a difference, and that a layer is a logical structuring mechanism for the elements that make up the software solution, while a tier is a physical structuring mechanism for the system infrastructure.

http://en.wikipedia.org/wiki/Multitier_architecture


23. Should I use a view, a stored procedure, or a user-defined function

databases.aspfaq.com/database/should-i-use-a-view-a-stored-procedure-or-a-user-defined-function.html

1. A function is a subprogram written to perform certain computations
2. A scalar function returns only a single value (or NULL), whereas a table function returns a (relational) table comprising zero or more rows, each row with one or more columns.
3. Functions must return a value (using the RETURN keyword), but for stored procedures this is not compulsory.
4. Stored procedures can use RETURN keyword but without any value being passed.
5. Functions could be used in SELECT statements, provided they don’t do any data manipulation. However, procedures cannot be included in SELECT statements.
6. A function can have only IN parameters, while stored procedures may have OUT or INOUT parameters.
7. A stored procedure can return multiple values using the OUT parameter or return no value at all.
http://searchsqlserver.techtarget.com/tip/Stored-procedures-vs-functions

We can call a SQL Function from ADO.NET code. Say we havea function named ABC(). So we call as SELECT ABC() from ADO.Net code. We cannot calla directly as ABC().

http://stackoverflow.com/questions/1056390/how-to-use-sql-user-defined-functions-in-net

Wednesday, September 7, 2011

"നെക്കിങ്ങും പെറ്റിങ്ങും" ലേഖനം in http://thummarukudykkathakal.com/

Language - Malayalam

ആദ്യം "നെക്കിങ്ങും പെറ്റിങ്ങും" ലേഖനം in http://thummarukudykkathakal.com/  വായിച്ചിട്ട് ഇതു വായിക്കുക ...

പ്രിയപ്പെട്ട തുമ്മാരകുടി ചേട്ടാ,

നിങ്ങളോട് എനിക്കു respect ഉണ്ട്. പക്ഷെ നിങ്ങളെ പോലുള്ള വിവരവും വിദ്യാഭാസം ഉള്ള ആള് ഇങ്ങനെ എഴുതിയതില്‍ ലജ്ജ തോന്നുന്നു. നിങ്ങള്‍ പറഞ്ഞ എല്ലാ കാര്യങ്ങളോടും യോജിക്കാന്‍ ഒരു വിധത്തിലും ആര്‍ക്കും കഴിയില്ല . എനിക്കു തോന്നുന്നു നിങ്ങള്‍ ലേഖനം അവതരിപ്പിച്ച രീതി ശരിയായില്ല.

1 . ജിജോ സിറിയക്കിന് അയാളുടെ opinion പറയാന്‍ അവകാശമുണ്ട്‌. അതിനെ തള്ളി പറയാന്‍ പറ്റില്ല. പിന്നെ അയാള് പറഞ്ഞത് നൂറു ശതമാനം ശരിയാണ്  താന്നും.

2 ."സത്യമായ കാര്യം കേരളം ഇപ്പോഴും ഒരു പുരുഷ മേധാവിത്ത സമൂഹം ആണെന്നാണ്. സൌദിയില്‍ ആണ്‍ തുണ  ഇല്ലാതെ പെണ്ണുങ്ങള്‍ പുറത്തിറങ്ങരുത് എന്ന നിയമത്തെ നമ്മള്‍..." ഈ ഖണ്ഡികയില്‍ എഴുതിയത് തീര്‍ത്തും സത്യമാണ് .

നമ്മള്‍ നമ്മുടെ കുട്ടികളെ കുഞ്ഞുനാളിലെ നമ്മുടെ മഹത്തായ സംസ്ക്കാരത്തെ പറ്റി  പഠിപ്പിക്കണം . എന്നാലേ ഇതിനു മാറ്റം ഉണ്ടാവു.

ജിജോ സിറിയക്  പറഞ്ഞത് പോലെ
"ഏത് മോശം സാഹചര്യത്തിലും പ്രലോഭനങ്ങള്‍ക്ക് വഴിപ്പെടാതിരിക്കാനുള്ള ഒരു ഉള്‍ക്കരുത്ത് അവര്‍ക്ക് നല്‍കാന്‍ നമുക്ക് കഴിയണം. മതത്തിന്റെ മൂല്യങ്ങള്‍ക്ക് ഇത് കഴിഞ്ഞെന്നുവരില്ല. മാതാപിതാക്കളുടെ നല്ല മാതൃക വളരെ പ്രധാനമാണ്. ഒപ്പം നൈമിഷികസുഖങ്ങള്‍ക്കപ്പുറം ജീവിതത്തിനുണ്ടാകേണ്ട നൈതികമൂല്യത്തെക്കുറിച്ച് അവരെ ബോധ്യപ്പെടുത്തുകയും വേണം.
മറ്റൊരു നാട്ടിലെത്തുമ്പോള്‍ ലഭിക്കുന്ന സ്വാതന്ത്ര്യം ദുരുപയോഗം ചെയ്യാതിരിക്കാന്‍ ഒരു ലക്ഷ്മണരേഖ എല്ലാവരുടെയും മനസ്സിലുണ്ടാകണം. പുരാണത്തിലേതുപോലെ അതു വരയ്ക്കാന്‍ ഒരു ലക്ഷ്മണനുണ്ടാവില്ല, സ്വയം വരച്ചേ തീരൂ."

3. നിങ്ങള്‍ പറഞ്ഞ പോലെ "
പതിനെട്ടു വയസ്സ് ആയ ഇന്ത്യന്‍ യുവാക്കള്‍ക് പ്രധാനമന്ത്രിയെ വരെ തിരഞ്ഞെടുക്കാനുള്ള ലോകസഭ തിരഞ്ഞെടുപ്പില്‍ വോട്ട് ചെയ്യാനുള്ള പ്രായപൂര്‍ത്തി ആയെന്നു നമ്മുടെ ഭരണഘടന പറയുന്നുണ്ട്. "

ഞാന്‍ ഒരു കാര്യം നിങ്ങളോട് ചോദിച്ചോട്ടെ ..  പതിനെട്ടു വയസ്സ് ആയ യുവാവ്‌ / നിങ്ങള്‍ തുണി ഇല്ലാതെ പൊതു സ്ഥലത്ത് നടന്നാല്‍ ആള്‍ക്കാര്‍ നോക്കി നിക്കുമോ ? നിങ്ങളുടെ മകളോ മകനോ ഭാര്യയോ ' ആ പ്രായപൂര്‍ത്തിയായ കുട്ടികള്‍ ' ബസില്‍ കാണിച്ചത്‌ പോലെ കാണിച്ചാല്‍ നിങ്ങള്‍ കയ്യും കെട്ടി നോക്കി നിക്കുമോ ?

4 . "വാസ്തവം പറഞ്ഞാല്‍, എന്‍റെ അഭിപ്രായം തീര്‍ത്തും തിരിച്ചാണ്. ഈ ഇരുപതൊന്നാം നൂറ്റാണ്ടിലും നമ്മുടെ കുട്ടികള്‍ ആവശ്യത്തിനു സ്വതന്ത്രമായി ഇടപെടുന്നില്ല. ..."  
ഇതിനോട് ഞാന്‍ യോജിക്കുന്നു..

കുട്ടികളെ കുഞ്ഞുനാളിലെ കുടുംബ കാര്യങ്ങളിലില്‍ ഉള്‍പെടുത്തിയാല്‍ കുട്ടികള്‍ക്ക് വലുതാകുമ്പോള്‍ കാര്യങ്ങള്‍ ചെയ്യുവാനുള്ള ആത്മവിശ്വാസം കിട്ടും. NO  പറയേണ്ടടുത്തു NO  പറയാന്‍ പരിശീലിപ്പിക്കണം.

5 . റോമന്‍സ് വേണം. പക്ഷെ മാന്യമായ രീതിയില്‍ വേണം. ഈ കാലത്ത് ഇന്‍റര്‍നെറ്റില്‍ തിരഞ്ഞാല്‍  ആയിരക്കണക്കിനു videos  കിട്ടും ഇങ്ങനെ ബസില്‍ കാണിച്ചത്‌ പോലെയും അതിനെക്കാള്‍ കൂടിയതും,  പെണ്‍കുട്ടികള്‍ അറിഞ്ഞോ അറിയാതെയോ കാമുകന്മാര്‍ ഷൂട്ട്‌ ചെയ്തത്.

Friday, August 26, 2011

Missing her badly. Need to date her once more at least.. ;)

Missing those days badly..


“Very few people have ever said anything nice about Calcutta, unless they were Bengali.”
(Geoffrey Moorhouse)

Kolkata, She is sweet and cute, and will create a strong bond with you. She would never depart from you. If you had lived with her for even the least amount of time, you are sure to get a gift of warm memories that you will never forget in all your life! 

I was with her for 4 years. You can imagine the depth of bond that I shared with her. The weekends were always enjoyed with her company. She will take you to the streets for a casual walk where you can find a sea of humanity. Never ever you tire of her nor is there a boring moment around her! You can either go to high-tech Salt Lake where air-conditioned cars travel silently side by side with cycle rickshaws and auto-rickshaws. The auto-rickshaw drivers in Kolkata are simply awesome. They will never cease to amaze you with their driving skills. If you want to enjoy the true auto rickshaw ride, you should take a ride in Salt Lake on the morning of any weekday . They are very precise at keeping gaps in traffic. They will come as fast as they can and sharply and precisely stop the vehicle. And speaking of blocks, a traffic block in Kolkata is something you should experience at least once your life, especially in Salt Lake. You have to see it to believe it :D

Shot from Kolkata taxi in a rainy season...

She will always call you to City Centre, Salt Lake. You can't ignore that call as the joys of window shopping and roaming around are too strong of resist. After the mundane terrible 1 hour sleepy boring morning meeting in my company, she take you to the small poori kada, where you will get 4 poories and sabhgy [Potato curry] for 10 bucks and 1 rupee tea in a small cute clay pot. After that tea and chit chat from Shambhu dha's shop  where one can enjoy viewing the perfect style of cigarette smoking by a lady. Every day morning and evening, we meet this lady at Shambhu dha's shop (because one of my friends is a big fan of this lady's smoking style ;)). Actually I wished to photograph her smoking, but I was scared of the commission that I would have to pay her ;)
 
Waking up at 9.30 and then running behind the Garia Station - New Town bus to get into to reach the 10.00 AM morning meeting at office. Hanging onto the bus floorboard from home to office, where the whole road will be covered by yellow taxis. Oh..That was wonderful. Missing those days.. :(. Evening having hardcore spicy pani poori @ 50 paisa per pani poori.. Where else you can get this???
 
Playing football on weekends near by Karunamayi and fighting  with big fat guy, Santy Singh which almost always results in me falling down!  :). Then taking a taxi from Karunamayi; a taxi where the driver has already manipulated the taxi's meter to make it run at lighting speed and thus shows double the actual fare; Fighting with the guy to cut down the taxi fare finally ending up with us settling on a decent fare (tough to bargain with Bengalis ;) ! )
 
Central park near by Karunamayi is a wonderful place. Central park is a huge expanse of greenery meant for relaxation, but through out the day, it is taken over by young boys and girls on the lookout for seclusion. Elders find it embarrassing to stroll in its grounds for fear of suddenly finding scenes being enacted – scenes that are appropriate in the privacy of the bedrooms, not in the open, behind some shrubs!! :D
 
Victoria Memorial, Kolkata
On weekends morning after football I usually go with her to central Kolkata, where we will have appam and kadala curry, a mouth watering Kerala dish from a Kerala hotel in park street. Then walking in the streets of park circus where you can find another sea of humanity. Oh! Darling, you are photographer's paradise. She will always remember me that I have to do something to make these poor homeless peoples lives in a better way. Central Kolkata is the best part of Kolkata and this is the Old Kolkata. Central Kolkata has lot of things to show you, old buildings constructed at the time of British era, Victoria memorial building and lot more... Walking with her in these streets is a wonderful experience. That will relax you like anything.

How can I forget College Street, a wonderful place where we can walk into old Kolkata buildings. College street has book stalls from start to the end of the street and lot of stalls that offers 1000+ designs of unique wedding cards.

Gariahat, I probably spent most of my time with her in Gariahat . Endless road side shops where you can get everything from  salt to camphor at a very cheap price. Sriram market, New market in Esplanade, bargaining with shopkeepers for every paisa! They will say something  like 1000 INR for a small hand bag. and we would start at 50-100 rupees.. ha..ha.. Having famous mouth watering Kolkata sweets from sweet stalls and lot more...

This is a small taste of the beauty that is Kolkata...You should date her once in your life time..


Thanks to Aneesh Ramaswami for correcting grammar ...

Thursday, August 25, 2011

.Net Error The modifier 'private' is not valid for this item OR The modifier 'public' is not valid for this item OR The modifier 'protected' is not valid for this item

.Net Error

The modifier 'private' is not valid for this item.
The modifier 'public' is not valid for this item.
The modifier 'protected' is not valid for this item.

Cause - Giving access modifier for a function defined in interface. Functions defined in interface should not have access modifier.
Fix - Remove the access modifier from the function definition.

Tuesday, August 16, 2011

Creating a hack-proof and crack-proof software.

Everyday lots of software are born. And the funny thing is hackers and crackers are always there to crack the software what you are creating. So how do we tackle this? How we will create hack-proof or crack-proof software? What we will always do is we will give the full software package to user in the trial version itself and add a criteria that once user is entering correct key, he can access the full version. So what is the loop hole here?. We are providing user the full access explicitly. The only thing he want to do is crack the software to bypass the authentication procedure/create a key-gen for the software.