18 November, 2008

Using VS2005 IDE regular expressions for find and replace

Suppose you have redundant information such as :

, (11,12,1,5,75,1,1,'2008-10-19 00:00:00')
, (11,13,1,6,200,1,1,'2008-10-19 00:00:00')
, (11,14,1,7,50,1,1,'2008-10-19 00:00:00')
, (11,15,1,8,100,1,1,'2008-10-19 00:00:00')
, (11,16,1,9,25,1,1,'2008-10-19 00:00:00')
, (11,17,1,10,60,1,1,'2008-10-19 00:00:00')


You need to replace the first two integer fields with say 7.


Hit Ctrl + F to bring up the find and replace dialog. click on Regular expressions.


Find : [(]:z:z,:z,

Replace with : (7,

Heres a nice page about VS 2005 IDE's regular expression comparison with other regular expression 'standards':

Coding horrors take on VS IDE regular expressions


Result:
, (7,1,14,75,1,1,'2008-10-19 00:00:00')
, (7,1,15,60,1,1,'2008-10-19 00:00:00')
, (7,1,16,10,1,1,'2008-10-19 00:00:00')
, (7,1,17,25,1,1,'2008-10-19 00:00:00')
, (7,1,18,150,1,1,'2008-10-19 00:00:00')
, (7,1,19,100,1,1,'2008-10-19 00:00:00')

Net Packets Out Of Order - Expected ( xxx ), Received ( y ) error in Toad:

Toad is one of the most versatile front ends I have seen for an efficient database such as MySQL. But toad does have its rough edges. The error message "Net Packets Out Of Order - Expected ( xxx ), Received ( y )" pops up whenever the client has been opened for many hours together. There is something about the situation that makes me feel that the toad front end was made to be specifically timed with the number of packets that were recieved after a transaction is complete. That is, it estimates the number of packets that are to be recieved whenever a transaction is completed. If at all the number of packets recieved after a transaction doesnt match up with the ones expected, the above error is seen.

The problem not only arises for specific transactions but also for transactions involving a series of transactions involving a large number of unions. Yes, this is a fact.

The solution:

> The first possible solution is to copy the query and execute it in the mysql command line client. You will be happy to see that it works.

> The second solution is to restart the PC and hope that Toad is back to its helpful self again.

>
The third and last solution is to modify your query to involve fewer number of joins, or unions. This would surely solve the problem.