Creative Jar Blog RSS Feed

Software Profiling minus the Midnight Oil equals ANTS Profiler

September 5, 2008 16:17 by tim

You have got to check this out

I've been using RedGate's tool for year.  Their SQLCompare and SqlDataCompare are essential parts of my toolbox.  Being more dev than DBA, these tool offer excellent functions for marrying up your dev databases to the production servers.  Even when you can't see your production databases, all the work is scripted so you can save the Sql files and send them on to your hosts.  Magic

Their latest offering, ANTS Profiler, is another high calibre tool that we've become very attached to.  We all like to write bullet-proof code which works lightening quick, but old habits die hard and it's often a thing we aspire to but never quite get there

we've been using a lot of LINQ lately using IQueryable results.  Alls well while you're coding them up and using them on your dev server.  However, combine thse results sets with 10,000 users all looking for the latest news and the code starts to get a bit laggy to say the least. 

We installed the ANTS profiles and it instantly identified these query's as the casue of a lot of the lag we were experiencing.  It seems they are still attached to the database in some manner as any subsequent access was still causing a call to the database , even though we'd stored them in an application variable.  We converted to List<> and the lag was a thing of the past.

There must be more to it but i'm miffed that all these new Microsoft tool are behaving like this.  Sure, they're a dream to code for ; LINQ style queries make up some of the most logical (from a coding perspective) syntax i've seen for a long time and object-oriented data access is somehting i've personally spent ages emulating in previous languages i've worked on.  Who would have thought that they'd be so expensive on the processor

If you're getting any kind of weird slow-down on your code, i can highly recommend the ANTS profiler.  Even if you're not, the profiler can still identify problematic sections of code and offer you some pointers.  We run everything through it now as a matter of course :¬)


Currently rated 2.5 by 2 people

  • Currently 2.5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

ADO and Text fields from SqlServer

August 28, 2008 17:01 by tim

I've been trying to fathom this for ages and finally have found a solution

When we're been working on the older ASP sites, using ADO for the data access, Text fields are constantly coming in blank.  We try casting them as VARCHAR(8000) but this is a bit dodge as you can't guarantee that you won't be truncating any data.  Text is meant to be infintely long, after all

After some digging around, I noticed a few threads on the same problem, some indicating that the issue was a bug in the driver we were using.  We use a set of standard connection include files, all with DRIVER={SQL SERVER}.  This was the cause of the problem.  There is a bug in the standard sql server driver which stops Text fields coming back to your Recordsets correctly

We changed it to Provider=sqloledb and it works a lot better :¬)


Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Tags: ,
Categories: SQL | Technical | Tim Hustler
Actions: E-mail | Permalink | Comments (0) | Comment RSSRSS comment feed

Janko at warp speed

May 23, 2008 09:26 by rob

Come across an interesting website for web development.

The site contains helpful tips on CSS, ASP, ASP.Net, Ajax and much more.

Check it out at www.jankoatwarpspeed.com 


Currently rated 5.0 by 2 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

CSV Import : Don't re-invent anything, let alone the wheel

May 15, 2008 14:33 by tim

I've worked with data for the whole of my programming life.  If it's not dbf, mdb, ldf its those annoying Excel spreadsheets people love to send you and just "import" with all the dodgy quotes and pipes etc

I was used to opening the file low-level and reading the file line-by-line, splitting up the fields as we go and inserting the data into the database.  However, people love to put quotes, commas and any combination of quote-comma-quote actually in to the text.  Fine if you're a human, as it makes the reading of the text much easier and feature-filled ; Nightmare if you're a computer as those just look like new fields leaving you with more or less fields than the last record

Those clever guys at Microsoft have done it again with OleDb.  Ever wondered how Excel knows how to delimt the fields properly, given a really poor system of data entry?  I have wondered this for years, putting it down to sheer magic, and the magic really works!!

http://ronaldlemmen.blogspot.com/2008/03/import-csv-file-to-datatable.html has detailed instructions on how to get a CSV file and translate that directly into a DataTable.  DataTables are one of the most logical structures i've used and that format suits me fine

Shazzam!!


Currently rated 4.5 by 2 people

  • Currently 4.5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Tags:
Categories: asp.net | SQL | Technical
Actions: E-mail | Permalink | Comments (0) | Comment RSSRSS comment feed

NETTUTS!

May 13, 2008 11:44 by rob

Recently launching NETTUTS at the end of April by the highly successful PSDTUTS team.

http://nettuts.com

Here you'll be able to find:
- step by step web builds
- html css techniques
- flash effects and techniques
- Javascript and AJAX
- Dreamweaver and other tools
- ... And general web dev skills

As stated on the launch page http://nettuts.com/news/launch/
They'll be adding content every week or so, a site definately to watch for the future...

Fancy writting a tutorial guys and seeing $150 for it ???


Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

SQL (TSQL)Tips & Tricks

April 9, 2008 11:02 by billy

Hi All,

Some great tips and tricks for SQL for ya'll.

DISTINCT & GROUP BY

http://www.sqlteam.com/article/how-to-use-group-by-with-distinct-aggregates-and-derived-tables

INNER JOIN - REMOVING DUPLICATES

(Within the INNER JOIN you can get the TOP 1 of a unique field and then use this to only return 1 from the koop up table, in this case Field1 and Field 2 can contain different values and therefore a DISTINCT will NOT work)

SELECT
TABLENAME.requiredField,
LOOKUPTABLENAME.Field1,
LOOKUPTABLENAME.Field2,
FROM TABLENAME
INNER JOIN LOOKUPTABLENAME ON LOOKUPTABLENAME.uniqueField = (SELECT TOP 1 uniqueField FROM LOOKUPTABLENAME WHERE LOOKUPTABLENAME .requiredField= TABLENAME.requiredField)
ORDER BY TABLENAME.requiredField

DUPLICATES

Also deleting duplicates ROWS from a table (need to :

DELETE FROM T1
FROM TABLENAME T1, TABLENAME T2
WHERE T1.dupField = T2.dupField
AND T1.uniqueField > T2.uniqueField

Hope they come in handy!

Laughing

 


Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Tags:
Categories: Billy Johal | SQL | Technical
Actions: E-mail | Permalink | Comments (0) | Comment RSSRSS comment feed

Calendar

November 2008
SuMoTuWeThFrSa
2627282930311
2345678
9101112131415
16171819202122
23242526272829
30123456