Weblog

Tuesday, 27 October 2009

  • Finding distance using latitude and longitude using T-SQL

    This is very useful...

    Create Function [dbo].[fnGetDistance]
    (
    @Lat1 Float(18),
    @Long1 Float(18),
    @Lat2 Float(18),
    @Long2 Float(18),
    @ReturnType VarChar(10)
    )

    Returns Float(18)

    AS

    Begin

    Declare @R Float(8);
    Declare @dLat Float(18);
    Declare @dLon Float(18);
    Declare @a Float(18);
    Declare @c Float(18);
    Declare @d Float(18);

    Set @R =
    Case @ReturnType
    When 'Miles' Then 3956.55
    When 'Kilometers' Then 6367.45
    When 'Feet' Then 20890584
    When 'Meters' Then 6367450
    Else 20890584 -- Default feet (Garmin rel elev)
    End

    Set @dLat = Radians(@lat2 - @lat1);

    Set @dLon = Radians(@long2 - @long1);

    Set @a = Sin(@dLat / 2)
    * Sin(@dLat / 2)
    + Cos(Radians(@lat1))
    * Cos(Radians(@lat2))
    * Sin(@dLon / 2)
    * Sin(@dLon / 2);
    Set @c = 2 * Asin(Min(Sqrt(@a)));

    Set @d = @R * @c;
    Return @d;

    End

Tuesday, 17 March 2009

  • The Provider Pattern

    The Pattern

    The pattern itself is exceedingly simple and is given the name "provider" since it provides the functionality for an API. Defined, a provider is simply a contract between an API and the Business Logic/Data Abstraction Layer.

    referenced from : http://msdn.microsoft.com/en-us/library/ms972319.aspx

    Factory methods

    The abstract base class should support factory methods to create new objects wherever appropriate, for example, CreateUser().

    If a feature allows a provider to create a framework object, but does not allow the provider to extend the object, the framework class should be sealed.

    Complex objects created by a provider may keep track of the provider that created it, and expose it as a Provider property. This allows users of the feature to determine the provider that owns the data for the object. For example, when a new user is created with the Membership API, it may be useful for the developer to be aware of the provider that data for the object is stored in.

    Administration

    The object model for ProviderCollection should include APIs to add, remove, and clear the collection and to set parameters of individual providers in the collection.

    Every feature that has providers should have a Provider property that returns type ProviderCollection, for example, Membershp.Providers.

Friday, 16 January 2009

  • I'm appalled at the lack of user requirements document. wtf.
    I'm appalled that I have to write the user manual for the development team. wtf.
    I'm appalled that I have to write the test scripts for the development team. wtf.
    I'm appalled that I have to support the current legacy shit system. wtf.
    I'm appalled that I have to code for the integration. wtf.
    I'm appalled that I have to be involved with the PM of the new system. wtf.
    I'm appalled that I was given slack about the importance of the new system being secure when there was no technical document about the whole bloody system in the first place. wtf.
    I'm appalled that I am doing all the above shit and yet not gone crazy yet. wtf.

    I'm going crazy soon. I think the boiling point will happen if i miss my reunion dinner on Friday due to the manila trip. wtf.
  • This is shit.

    Doing 101 things on my plate is really frustrating. If I get what I want I would have loved to do exactly what is needed to solve and organize all the problems in the office with the expected resources that is needed.

    But wtf if i'm expected to make every freaking things in accordance to freaking ISO standards, with no head and no tail and I'm supposed to be a professional when the head and the tail doesn't even have a professional conduct of organizing things. Then seriously how am I supposed to be compensated?

    My annual leave was cancelled in december.
    My christmas was not a christmas.
    My New year was not a new year.
    Now My Chinese New Year reunion dinner is hanging by my neck.

    wtf.


  • Tired.

    I'm tired.
    My eyes are tired.
    My brains are tired.
    I'm physically tired.

    I'm exhausted.
    Of having to explain.
    Of having to negotiate.
    Of having to give in.

    Its only the 16th of January of the year 2009.
    And I felt like I have lost my energy for everything.
    Give me strength to overcome my weakness.
    Give me wisdom to face challenges.
    Give me patience when I am tested.

    OR... Just let me give up on myself.

Top Tags - Weblog

[no tags]

bullzzz

  • Visit bullzzz's Xanga Site
    • Name: Weng Kin
    • Gender: Male
    • Member Since: 11/2/2003

Weblog Archives

Don't worry - your calendar is here… to see it in action just click "Save" above and refresh the page.

About Me

  • Feverish pitching of what has to be interesting, else whats there to be pissed about? duh...