Pages

Sunday, March 10, 2013

Mother Teresa's Anyway Poem



People are often unreasonable, illogical and self centered;
Forgive them anyway.

If you are kind, people may accuse you of selfish, ulterior motives;
Be kind anyway.

If you are successful, you will win some false friends and some true enemies;
Succeed anyway.

If you are honest and frank, people may cheat you;
Be honest and frank anyway.

What you spend years building, someone could destroy overnight;
Build anyway.

If you find serenity and happiness, they may be jealous;
Be happy anyway.

The good you do today, people will often forget tomorrow;
Do good anyway.

Give the world the best you have, and it may never be enough;
Give the world the best you've got anyway.

You see, in the final analysis, it is between you and your God;
It was never between you and them anyway.

Saturday, March 9, 2013

Some Linq and NullableExtension

So, Here is some problem and solution going into My vault.

Problem1: I was having a Collection where each item has some sequence number, I need to override all the sequence number with my own sequence number starting from 1 to n , though not changing any repeated values.

Here i have done in two ways...First simple, another simpler via Linq. There are still possibility for optimizations, and i will keep looking into them always.....


static void Main(string[] args)
        {
            int _sequence=1;
            
            List<Employee> lst = new List<Employee>();
            lst.Add(new Employee { EmpId = 10, EmpName = "Bheeshm" });
            lst.Add(new Employee { EmpId = 11, EmpName = "Bheeshm1" });
            lst.Add(new Employee { EmpId = 12, EmpName = "Bheeshm2" });
            lst.Add(new Employee { EmpId = 13, EmpName = "Bheeshm3" });
            lst.Add(new Employee { EmpId = 10, EmpName = "Bheeshm4" });
            lst.Add(new Employee { EmpId = 10, EmpName = "Bheeshm5" });

            #region Region1
            //var a = lst.GroupBy(i => i.EmpId);

            //foreach (IGrouping<int, Employee> ii in a)
            //{
            //    foreach (Employee item in ii)
            //    {
            //        item.EmpId = _sequence;
            //    }
            //    _sequence++;
            //}

            //var orderedlist = lst.OrderBy(i => i.EmpId); 
            #endregion

            #region Region2
            lst.GroupBy(i => i.EmpId).ToList().ForEach(ii => { ii.ToList().ForEach(item => { item.EmpId = _sequence; }); _sequence++; });

           
            var orderedlist = lst.OrderBy(i => i.EmpId);
            #endregion
        }


Problem2: I was having two null-able values , and i requires to get the Max among them, It can be done easily but my quest was to do it with minimum number of code-lines.
System.Nullable provides some method, and i was trying to make an Extension method using the one provided by System.Nullable . But as Defined , System.Nullable was static , and i failed Doing so.
Then i received a very nice thought from an architect .... and here it is ::
    class Program
    {
        static void Main(string[] args)
        {
            
            DateTime? dt = null;
            DateTime? dt1 = DateTime.Now;

            DateTime? Max= NullableTypeExtension.ReturnMax(dt, dt1);
        }
    }

    public static class NullableTypeExtension
    {
        public static T? ReturnMax<T>(this T? n1, T? n2) where T : struct
        {
            int val = System.Nullable.Compare(n1, n2);
            if (val >= 0)
                return n1;
            return n2;
        }
    }

Wednesday, September 5, 2012

Realted To .net webservice(.asmx)

SOAP:
Simple Object Access Protocol is a communication protocol, a way to structure data before transmitting it, is based on XML standard. It is developed to allow communication between applications of different platforms and programming languages via internet.

Http-Get, Http-Post works with name/value pair which means transferring complex object is not possible with these protocols, whereas SOAP serializes complex structure, such as ASP.NET DataSets, complex arrays, custom types and XML nodes before transmitting and thus allows exchange of complex objects between applications.

Two components can easily communicate using Remote Procedure Calls protocol. But because of their compatibility and security issues, most of firewalls and proxy server block this type of messages. SOAP uses HTTP channel to transport which makes it widely accepted protocol over the internet.

WSDL stands for Web Services Description Language, an XML-based language that describes Web services and how to access and locate them.

UDDI stands for Universal Description, Discovery and Integration. It is an open, Internet-based specification that offers directory service for storing information about web services. 
A standard for creating business registries that catalog companies, the web services they provide, and the corresponding URLs for their WSDL contracts.UDDI (Universal Description, Discovery, and Integration) offers centralized directory for web services over the internet. It hosts web services from different companies and can be used by the clients to find web services of their specific need. To make web services shared publicly, they have to be published in UDDI.

DISCO : It is used to create discovery documents that provide links to multiple web service endpoints. The DISCO standard creates a single file that groups a list of related web services. A company can publish a DISCO file on its server that contains links to all the web services it provides. DISCO, an abbreviation of discovery, is a file that groups together a list of related web services. A company that offers web services publishes a DISCO file on its server that has links of all the web services it provides. The client requests this file to see all the available web services. This standard is useful when client already know about a company that offers web services. You can also use DISCO standard while working in local network. It is not helpful to find all web services over the internet.

Documenting a Webservice and Methods

[WebService(Name = "Calculator Service",Description = "Performs Mathematical Operation",
Namespace=http://www.apress.com/ProASP.NET/)]
public class Calculator: System.Web.Services.WebService
{   
       [WebMethod(Description = "Returns Sum")]
       public int Add(int z, int r)
      { ... }
}

Namespace allows your web service to be uniquely identified. By default, ASP.NET web services use the default XML namespace http://tempuri.org/, which is suitable only for testing. XML namespace simply identifies your web service. XML namespaces usually look like URLs. However, they don't need to correspond to a valid Internet location.

DataType Support in Webservice

.Net web services are built on XML-based standards for exchanging data. This means .NET web services can support only those data types that can be recognized by the XML schema standard. There are many proprietary .Net objects such as FileSteam, Eventlog etc. are not supported in the web services. These data types are .Net specific types that are not universally recognized, i.e. .Net specific only.

You can even exchange custom objects using .Net web services. The only limitation is that only public data members are transmitted, and all public members and properties must use one of the other supported data types.

You can use DataSet and DataTable to return information from database but can't use other ADO.NET objects such as DataColumns and DataRows.

.Net offers a distributed technology called .Net remoting that can plays around wide range of .Net specific data type. But unfortunately, .Net remoting doesn't support client other than .Net.








+ Coming Soon.....

Saturday, June 25, 2011

Journey

.
I can see her skin like paper
when i was sitting on a roller
i was going with her farther and longer
the experience was sensational
which is letting me to feel old and older
reached to state where my skin is like paper
then i was seeing my past in a mirror
but still had a question , what she has for her?

The wrinkles on her face and near the eye
telling me nothing but seems quite dry
i was awake that time and demanding for a gentle touch
i was waiting for that , but never happened as planned such
Thinking i should have said, cause to see you mean so much
but actually not interrupting her tranquility to say this.
it seems like a blessing to have a traveller like you
where nothing is requested and nothing is demanded for
she was a twinkling star in my journey far
then 12-22 aa gaya and i start looking for a beer-bar


If is a dream then never me awake
it is the time to return my breath that you take
else if it's a hangover, then give me some lemon shake.

It's Written in the Moonlight

It's Written in the Moonlight
while holding my pillow tight
where i was playing as a fool
where i was playing smart
then i turned my sight
there was a moon and it's moonlight.

It's Written in the Moonlight
when moon was big and so bright
while holding my pillow tight
now here on everything seems right
got the reason why i was holding my pillow tight
may i was scared by the brutality of light
may be in a dream where i got terrified
or may it was just a hangover of last night

Now i am seeing no moonlight
it actually seems like sunlight
time to go office with hair untide
to do some coding and some fight.


Author: Me

Evacuation

.
.
Element within me for decision making seems screwed
Erased Evacuated from the brain that i have borrowed
May be it is into the next one level where it was raised
Everything seems like a failure and has actually failed
.
.

Author: Me

Thursday, June 16, 2011

Darkness

ये तमस है घना
विचित्र सा है बड़ा
इस चक्रव्यूह में
में घिरा में घिरा
आकार अदृश्य है
फैलता अनंत है
प्रलय के पयोध सा
विश्व व्योम व्याप्त सा
ये तमस है घना

इस विहंगम द्रश्य में
इसके सानिध्य में
पुनः चक्रव्यूह में
में घिरा में घिरा
ये तमस है घना

आदि से अनंत की
करता है ये व्याख्या
और रिक्त अन्तराल में
सूझता है सांख्य सा
शून्य के प्रमाण सा
प्रत्यक्ष के प्रयाण सा
था वो तमस घना

Author: Me

Wednesday, June 1, 2011

Reading Kural- I am Just Echoing

Sage Thiruvalluvar writings ,-KURAL- it is originally in Tamil, and now it is translated into many language, is my current reading.

The way it is written is astonishing, in most of such thing which i have ever read, is always referring some person, some god, but here it is little different. Quite abstract and applicable in various dimension and fields of life. Like a Rule book.
Also mention some of very common thing, and it feels like we are in a process of being transcend. Some things which i remembered and found interesting , when he discuss about Learning ,Ignorance ,Hearing ,Possession of Knowledge ,Correction of Faults, Un-Forgetfulness,Energy ,Friendship ,Not Drinking Palm-Wine ,Gaming (Gambling),Medicine.

I Came to know about it after reading some Writing of Dr. kalam. There is radical constructivism which can be seen in every great person. and also sometime wants to read Confucius.

Friday, April 9, 2010

Important Links- .Net Topics

Hi,

Here i am sharing some important links which i found while my learnings, as they are quite simple,important and interesting.

Programmatically Encrypt and Decrypt Configuration Sections of web.config file:

Here is the Link

About String Builder:

StringBuilder

Here is the link for Serialization/Deserialization in .NET:

Serialization


Start the Email Process and Let the User send it Manually:-
(For Non Html Text)
Process.Start("mailto:email@email.com?subject=My Email&body=Hello, Mail Body Goes Here.");


How to redirect dos command result to my VB app?

Redirect Dos Result

User-defined implicit conversions:

Implicit conversions