Summer

Posted by: Matt Kull Thu, 13 Jul 2006 04:07:00 GMT

Summer is halfway over, unbelievable.

Time has been flying by. Between the nice weather, shore house, and work being extemely busy I haven’t spent much time on here or on ybg. At work we are wrapping up footballfanatics.com, the big asp.net/c# ecommerce site mentioned before. It has been a lot of work, but I have learned a ton and theres some cool stuff done which I will blog about soon.

Lately I have been burnt out on ybg and other side projects, after a long day of coding at work its tough to come home and get back at it. I’m trying to get over that though.

I have made some progress on the Flickr integration, not going to make any promises when that will be up though. In other areas I have been messing with Pl/SQL and finally got my distance calculations going.

I ended up using the “Haversine” forumula and created simple Pl/SQL function that calculates the distance between two sets of longitude and latitude. Could probably be tidied up a bit but heres my first go at it that works.

CREATE OR REPLACE FUNCTION distance
(
    lat1 decimal,
    long1 decimal,
    lat2 decimal, 
    long2 decimal
) 
RETURNS decimal AS $$
DECLARE
    r decimal := 6371; -- earth’s radius (mean radius = 6,371km)
    rLat1 decimal := degreesToRadians(lat1);
    rLat2 decimal := degreesToRadians(lat2);
    rLong1 decimal := degreesToRadians(long1);
    rLong2 decimal := degreesToRadians(long2);
    dLat decimal := rLat2 - rLat1;
    dLong decimal := rLong2 - rLong1;
    a decimal; 
    distance decimal;
BEGIN
    -- "Haversine" Formula
    a := sin(dLat/2)^2 + cos(rLat1)*cos(rLat2)*sin(dLong / 2)^2;
    distance := r * 2 * atan(sqrt(a) / sqrt(1-a));

    -- Spherical Law of Cosines
    -- distance := acos(sin(rLat1)*sin(rLat2)+cos(rLat1)*cos(rLat2)*cos(rLong2 - rLong1)) * r;  
    RETURN distance * .62; -- convert to miles
END;
$$ LANGUAGE plpgsql;

That code uses a simple degree to radian conversion function

CREATE OR REPLACE FUNCTION degreesToRadians
(
    degrees decimal
) 
RETURNS decimal AS $$
BEGIN
    RETURN degrees * (pi() / 180);
END;
$$ LANGUAGE plpgsql;

First use of this will be to show “Other bars in the neighborhood” when looking at a bar detail page.

Posted in , , ,  | 4 comments | 73011 trackbacks

SQL Server 2005 DTS (Integration Services) Woes...

Posted by: Matt Kull Wed, 10 May 2006 22:04:00 GMT

So apparently embedded text qualifiers are not supported in SQL Server 2005 yet when attempting to import data from a flat file.

I really hope I am wrong, but myself and another developer spent the better of an afternoon debugging this.

Heres the really simple test case which demonstrates the breakage:

Create a dummy table to import into, lets pretend it’s called “test” with two varchar(50) columns named test1 and test2.

Now create a dummy data import file (just a .txt file) with the following contents….

“this”,”is ok”

“even “”this”” works”,”12”“x18”” Print”

Now in MSQL Management Studio right click on your database name and hit import data. Set your data source to flat file, and enter your text qualifier as a double quote (“).

Hit next and you should see a warning about embedded text qualifiers… and then upon executing the procedur You will see the error:

Error 0xc0047038: Data Flow Task: The PrimeOutput method on component “Source - test3_txt” (1) returned error code 0xC0202092. The component returned a failure code when the pipeline engine called PrimeOutput(). The meaning of the failure code is defined by the component, but the error is fatal and the pipeline stopped executing. (SQL Server Import and Export Wizard)

Importing the exact same file on SQL Server 2000 runs without a hitch.

Pretty lame Microsoft, you would think this would have been fixed by SP 1.

Posted in ,  | Tags  | 7 comments | 3195 trackbacks

New Project...

Posted by: Matt Kull Tue, 28 Mar 2006 04:25:00 GMT

Trip to Jacksonville last week went great. We kicked off a big new ecommerce project, which I am pretty excited about.

Without getting into too much detail, the client has reached the limits of their legacy architecture and is bringing us in to deliver the scalability they require.

The site does a ton of traffic, over 1.5m page views a day. The new system is being built in ASP.Net 2.0. We hope to cut the amount of hardware they need by over half. (they are using a lot of hardware on their current site)

Project has a pretty short timeline though, go-live is set for the begining of July… going to be a busy 3 months.

Should be a very interesting projec, finally will be an excuse to play with some load / performance testing tools.

Posted in , ,  | Tags ,  | 4 comments | 1663 trackbacks

eXTReMe Tracker