From jwcolby at colbyconsulting.com Sat Jul 2 12:29:27 2011 From: jwcolby at colbyconsulting.com (jwcolby) Date: Sat, 02 Jul 2011 13:29:27 -0400 Subject: [dba-VB] SQL Server - SSD / Rotating media - Side by side test results Message-ID: <4E0F5577.9060206@colbyconsulting.com> This morning I set out to do a little bit of real world testing to see what my SSD investment buys me. The following are some results. BTW if a SQL Server guru wants to actually gain remote access and run tests on my system I would welcome that. I am obviously not very talented as a SQL Server DBA and so a real DBA who has an interest is welcomed to tune and test. Anyway, I have a pair of databases that I will be testing with. One is my infamous "database from hell" called HSID, containing 51 million records with about 600 fields. The other is my HSIDAllAdults containing about 65 million Name and address fields. HSIDAllAdults is child to HSID, IOW it has a foreign key which contains the PK of HSID. Both databases have a clustered index on their autonumber PK. So... I have both of these databases on a four SSD RAID 0. I backed them up last night and restored them to the same name + _Rotatingmedia on my RAID6 volumes. So I have identical databases on a 4 SSD Raid 0 and a 6 disk RAID 6. I am now doing some comparative A/B runs of rather standard queries - similar to things I do routinely. I backed up the two databases last night just before upgrading the server. I restored both tha HSID and HSIDAllAdults this AM to the same rotating media location I normally hold the databases. I did not defrag the rotating media before doing the restore. I include the counts so that we can be assured that the actual data is identical between the SSD and rotating media DBs. HSIDAllAdults - has a pair of cover indexes each of which includes Address valid DBCC DROPCLEANBUFFERS SELECT AddrValid, COUNT(PK) AS Cnt FROM dbo.tblAllAdultNameAddr GROUP BY AddrValid SSD: 12 seconds ANK 635917 E 2918652 INV 936058 MOV 112093 PO 3780131 V 59074768 Rotating: 52 seconds ANK 635917 E 2918652 INV 936058 MOV 112093 PO 3780131 V 59074768 DBCC DROPCLEANBUFFERS SELECT COUNT(_DataHSID.dbo.tblHSID.PKID) AS Cnt, dbo.tblAllAdultNameAddr.AddrValid FROM dbo.tblAllAdultNameAddr INNER JOIN _DataHSID.dbo.tblHSID ON dbo.tblAllAdultNameAddr.PKHSID = _DataHSID.dbo.tblHSID.PKID GROUP BY dbo.tblAllAdultNameAddr.AddrValid SSD: 35 seconds 635917 ANK 2918652 E 936058 INV 112093 MOV 3780131 PO 59074768 V DBCC DROPCLEANBUFFERS SELECT COUNT(_DataHSID_RotatingMedia.dbo.tblHSID.PKID) AS Cnt, dbo.tblAllAdultNameAddr.AddrValid FROM _DataHSID_RotatingMedia.dbo.tblHSID INNER JOIN dbo.tblAllAdultNameAddr ON _DataHSID_RotatingMedia.dbo.tblHSID.PKID = dbo.tblAllAdultNameAddr.PKHSID GROUP BY dbo.tblAllAdultNameAddr.AddrValid Rotating: 1:00 635917 ANK 2918652 E 936058 INV 112093 MOV 3780131 PO 59074768 V The following appears to be a table scan which would be a "worst case". I just picked a field from HSID which we use occasionally. DBCC DROPCLEANBUFFERS SELECT COUNT(PKID) AS Cnt, Household_Occupation_code FROM dbo.tblHSID GROUP BY Household_Occupation_code Rotating: 7:06 35481479 NULL 7143021 10 11480 11 9780 12 37452 13 115093 20 2266292 21 501715 22 23724 23 1039660 30 1325728 40 1183311 50 8271 51 70318 52 2566 60 33157 61 28595 62 15305 70 511464 80 739340 90 609317 91 Rotating media: 1:05 35481479 NULL 7143021 10 11480 11 9780 12 37452 13 115093 20 2266292 21 501715 22 23724 23 1039660 30 1325728 40 1183311 50 8271 51 70318 52 2566 60 33157 61 28595 62 15305 70 511464 80 739340 90 609317 91 DBCC DROPCLEANBUFFERS SELECT COUNT(PKID) AS Cnt, Narrow_Income_Band FROM dbo.tblHSID GROUP BY Narrow_Income_Band SSD: 8 seconds 13824508 NULL 3762511 1 1675853 2 1015899 3 2307736 4 1031640 5 2595759 6 1069374 7 2662509 8 1100049 9 1055216 A 1026910 B 4285629 C 941494 D 862906 E 831573 F 2443917 G 738328 H 676959 I 478582 J 423856 K 1168819 L 371413 M 333796 N 249064 O 204771 P 708189 Q 193265 R 189413 S 2927130 T Rotating media: 10 seconds 13824508 NULL 3762511 1 1675853 2 1015899 3 2307736 4 1031640 5 2595759 6 1069374 7 2662509 8 1100049 9 1055216 A 1026910 B 4285629 C 941494 D 862906 E 831573 F 2443917 G 738328 H 676959 I 478582 J 423856 K 1168819 L 371413 M 333796 N 249064 O 204771 P 708189 Q 193265 R 189413 S 2927130 T I am going to stop for now. I have the rotating media copies and will leave them in place for awhile. If any real DBA wants to do some testing let me know. Obviously I have to know you. :) -- John W. Colby www.ColbyConsulting.com From jwcolby at colbyconsulting.com Sat Jul 2 13:36:42 2011 From: jwcolby at colbyconsulting.com (jwcolby) Date: Sat, 02 Jul 2011 14:36:42 -0400 Subject: [dba-VB] [dba-SQLServer] SQL Server - SSD / Rotating media - Side by side test results In-Reply-To: References: <4E0F5577.9060206@colbyconsulting.com> Message-ID: <4E0F653A.7070503@colbyconsulting.com> Arthur, There are definite cases where the gains are minimal, others where they are significant. The other thing is that I am intentionally clearing the cache before each test. The cache further minimizes the differences as it turns out. That is to be expected of course. This just goes to show the old axiom that throwing memory at SQL Server does a world of good. Without a shadow of a doubt, one thing that SSDs (and faster / better hardware in general) do is minimize the impact of ignorance and sloth. ;) I am not an accomplished DBA, and I simply do not have the time to become one. As a result I am unable to correctly tune my system. By throwing cores, memory and SSDs at the problem I manage to achieve respectable results in spite of myself. Hardware is cheap. My entire server cost somewhere in the neighborhood of $5K. Additionally I have dragged disk and RAID controllers forward through many upgrades. Back around 2005 I spent the then enormous sum of $1600 for three Areca raid controllers which I am still using today. I bought 10 1 TB drives back when they were $150, but I am still using them today. What I upgrade are the motherboards and more frequently the processors. In 2004 I started with single core AMD 3800 processors using Windows2003 X32 and 4 gigs of RAM. I built two systems for $4000! Moving up to dual and then quad cores, and Windows / SQL Server X64 and 8 GB RAM, then 16 gigs of ram. My latest motherboard / processor cost me (my client of course) about $700 (8 cores, with 24 cores possible) and 32 gigs of ram was about $1000. I was looking last night and another 32 GB of RAM (same modules) is now only $600! And... I am using my entire old server (quad core / 16 gigs ram) for a VM server. The point really is that while it is not a trivial amount spent over the years making these upgrades, over that same period I billed a couple of hundred thousand dollars. All these upgrades make me more and more productive, faster and faster getting the results back to the client. The client *loves me* precisely because he gets results back in hours instead of a week as his previous provider gave him. I program custom C# solutions (and bill him for the programming) which have enabled me to do orders literally in hours which (back in 2006) took me a full day or even two to get out. Counts which took an hour in 2004 now take my custom program 2 minutes. *AND* I have developed a system which allows him to send emails with zip lists as attachments. A program running on my server strips off the CSV attachment, generate counts, build a count spreadsheet, attach it to an email and send it back to him literally within 5 minutes of him pressing send *without* my doing anything. Again those counts used to take me an hour back when I did everything by hand. Now I log that a count came in and put a small charge in my billing database! The lesson for me is that my time is worth much more than the cost of the electronics and my response time is what makes me valuable to the client. I fully understand than everyone cannot solve all their problems by throwing hardware / custom software at it, but for a sole proprietor it just might be the only way! I don't have the time to be good at all the hats I wear! And so I do things like spend a thousand on SSDs on an educated guess that they will make a significant difference for an uneducated sloth. :) And finally, because the client loves me, he is sending me a *ton* more work! MORE CORES! MORE MEMORY! More SSDs! :):):) John W. Colby www.ColbyConsulting.com On 7/2/2011 1:48 PM, Arthur Fuller wrote: > I would be happy to assist. Judging by your IMO rather narrow result-gap (measured in a few > seconds), my initial guess would be that the SSHDs are not gaining you much over your investment in > CPU and RAM. However, that remains to be determined. Could be that table-scans or some other factor > are causing this lag. Should be that SSHD retrieves ought to be an order of magnitude quicker, but > according to your posted measurements they lag significantly behind that thumbnail benchmark. > > And besides all that, how are you? What's new with you and your family? > > A. From jwcolby at colbyconsulting.com Sun Jul 3 11:56:54 2011 From: jwcolby at colbyconsulting.com (jwcolby) Date: Sun, 03 Jul 2011 12:56:54 -0400 Subject: [dba-VB] SSD, The Game Changer - SQL Man of Mystery - SQLServerCentral.com Message-ID: <4E109F56.809@colbyconsulting.com> -- John W. Colby www.ColbyConsulting.com http://www.sqlservercentral.com/blogs/sqlmanofmystery/archive/2009/04/14/ssd-the-game-changer.aspx From jwcolby at colbyconsulting.com Tue Jul 5 03:56:04 2011 From: jwcolby at colbyconsulting.com (jwcolby) Date: Tue, 05 Jul 2011 04:56:04 -0400 Subject: [dba-VB] Sourcegear vault free two developer license Message-ID: <4E12D1A4.1010809@colbyconsulting.com> I ran across this today. http://www.sqlservercentral.com/articles/Red+Gate+Software/74579/ http://promotions.sourcegear.com/vouchers/new/ -- John W. Colby www.ColbyConsulting.com From rls at WeBeDb.com Tue Jul 5 09:17:54 2011 From: rls at WeBeDb.com (Robert Stewart) Date: Tue, 05 Jul 2011 09:17:54 -0500 Subject: [dba-VB] Silverlight Image in Listbox In-Reply-To: References: Message-ID: <5A357FDC-7B9A-405A-9581-55AB3A4EA646@holly.arvixe.com> Question: I have a silverlight listbox control. It is bound to data in a database, not an object. I have the URL for an image stored in each of the records returned from the database. I need to display that in the list box. < Image x:Name="imgPhoto" Height="30" Width="30" Source="{Binding Path=PhotoURL}" /> does not work by itself. The URL stored in the database looks something like this: "/images/1_0.jpg" Does anybody know how to get the image to display? Robert L. Stewart www.WeBeDb.com www.DBGUIDesign.com www.RLStewartPhotography.com From R.Griffiths at bury.gov.uk Tue Jul 5 11:39:53 2011 From: R.Griffiths at bury.gov.uk (Griffiths, Richard) Date: Tue, 5 Jul 2011 17:39:53 +0100 Subject: [dba-VB] Silverlight Image in Listbox In-Reply-To: <5A357FDC-7B9A-405A-9581-55AB3A4EA646@holly.arvixe.com> References: <5A357FDC-7B9A-405A-9581-55AB3A4EA646@holly.arvixe.com> Message-ID: <201107051640.p65Gdx1H016343@databaseadvisors.com> Hi this is what I do... if (this.ImgCoverMedium.Length>0) this.imgCover = new System.Windows.Media.Imaging.BitmapImage(new Uri(this.ImgCoverMedium, UriKind.Absolute)); Where imgCover is type : System.Windows.Media.Imaging.BitmapImage and ImgCoverMedium is the (string) path the image. HTH Richard -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Robert Stewart Sent: 05 July 2011 15:18 To: dba-vb at databaseadvisors.com Subject: [dba-VB] Silverlight Image in Listbox Question: I have a silverlight listbox control. It is bound to data in a database, not an object. I have the URL for an image stored in each of the records returned from the database. I need to display that in the list box. < Image x:Name="imgPhoto" Height="30" Width="30" Source="{Binding Path=PhotoURL}" /> does not work by itself. The URL stored in the database looks something like this: "/images/1_0.jpg" Does anybody know how to get the image to display? Robert L. Stewart www.WeBeDb.com www.DBGUIDesign.com www.RLStewartPhotography.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com ----------------------------------------------------------------- Why not visit our website www.bury.gov.uk ----------------------------------------------------------------- Incoming and outgoing e-mail messages are routinely monitored for compliance with our information security policy. The information contained in this e-mail and any files transmitted with it is for the intended recipient(s) alone. It may contain confidential information that is exempt from the disclosure under English law and may also be covered by legal,professional or other privilege. If you are not the intended recipient, you must not copy, distribute or take any action in reliance on it. If you have received this e-mail in error, please notify us immediately by using the reply facility on your e-mail system. If this message is being transmitted over the Internet, be aware that it may be intercepted by third parties. As a public body, the Council may be required to disclose this e-mail or any response to it under the Freedom of Information Act 2000 unless the information in it is covered by one of the exemptions in the Act. Electronic service accepted only at legalservices at bury.gov.uk and on fax number 0161 253 5119 . ************************************************************* From jwcolby at colbyconsulting.com Wed Jul 6 06:46:07 2011 From: jwcolby at colbyconsulting.com (jwcolby) Date: Wed, 06 Jul 2011 07:46:07 -0400 Subject: [dba-VB] =?windows-1252?q?HASHBYTES_=96_A_T-SQL_Function_-_SQL_Mu?= =?windows-1252?q?sings_-_SQLServerCentral=2Ecom?= Message-ID: <4E144AFF.5010306@colbyconsulting.com> We were discussing hashes awhile back. -- John W. Colby www.ColbyConsulting.com http://www.sqlservercentral.com/blogs/steve_jones/archive/2011/6/28/hashbytes-_1320_-a-t_2D00_sql-function.aspx From df.waters at comcast.net Wed Jul 6 08:57:58 2011 From: df.waters at comcast.net (Dan Waters) Date: Wed, 6 Jul 2011 08:57:58 -0500 Subject: [dba-VB] More on SourceGear Message-ID: <002201cc3be4$b9dc5a30$2d950e90$@comcast.net> >From SourceGear's FAQ page: --------- Somebody said that Vault is FREE for a single user. Is this true? Yes. Vault is free for use by a single user. Simply install the product and do not enter any serial numbers at all. When no serial numbers are present, Vault behaves as if there is exactly one user license. Note that this free license does not apply when the product is used by more than one person. If you have two people who need to use Vault, you will need to purchase?two?initial licenses. If you enter a serial number containing only one license, then the product will?still?have exactly one license present. --------- The promotional pair of licenses does not include maintenance updates, but I'll guess that a single user license can be updated. Also, I wanted the Standard version instead of the Pro version. Dan From fhtapia at gmail.com Fri Jul 8 16:23:44 2011 From: fhtapia at gmail.com (Francisco Tapia) Date: Fri, 8 Jul 2011 14:23:44 -0700 Subject: [dba-VB] OO Programming Message-ID: Hey gang, This thread I wanted to start to help cover some best practices when it comes to programming, since we don't have a C# group I figured vb.net is close enough :). I was wondering how to approach my current scenario. I'm building a really rather simple windows service. It monitors a folder share on the network and whenever a new file is created it takes a look at it and streams the contents to read for particular pieces of data. Once the target data is obtained, the stream is closed and the data is then inserted into a Sql Server database. simple. I'm thinking that the threaded process should have some events it advertises that the gui can hook into right? the other way to get this to work would be to just eliminate the gui updating from the tread and have it read right off the log.txt file streamed in? what are your thoughts? -Francisco http://bit.ly/sqlthis | Tsql and More... From stuart at lexacorp.com.pg Fri Jul 8 17:36:03 2011 From: stuart at lexacorp.com.pg (Stuart McLachlan) Date: Sat, 09 Jul 2011 08:36:03 +1000 Subject: [dba-VB] OO Programming In-Reply-To: References: Message-ID: <4E178653.23831.499CCE7@stuart.lexacorp.com.pg> Best prectice is for a service to not interact with the desktop in any way. Your service and your GUI should be separate applications. The GUI and service should communicate with each other through some form of Inter Process Communication (IPC). If the server and GUI will always run on the same workstation a good choice would be file mapping using named shared memory, (See http://msdn.microsoft.com/en-us/library/aa366556%28v=VS.85%29.aspx ) The server can then use SendNotifyMessage() with HWND_BROADCAST to tell any active GUI to check for updated data in the mapped file. -- Stuart On 8 Jul 2011 at 14:23, Francisco Tapia wrote: > Hey gang, > This thread I wanted to start to help cover some best practices when > it > comes to programming, since we don't have a C# group I figured vb.net > is close enough :). I was wondering how to approach my current > scenario. > > I'm building a really rather simple windows service. It monitors a > folder share on the network and whenever a new file is created it > takes a look at it and streams the contents to read for particular > pieces of data. Once the target data is obtained, the stream is > closed and the data is then inserted into a Sql Server database. > > simple. > > I'm thinking that the threaded process should have some events it > advertises that the gui can hook into right? the other way to get > this to work would be to just eliminate the gui updating from the > tread and have it read right off the log.txt file streamed in? what > are your thoughts? From michael at ddisolutions.com.au Fri Jul 8 20:32:59 2011 From: michael at ddisolutions.com.au (Michael Maddison) Date: Sat, 9 Jul 2011 11:32:59 +1000 Subject: [dba-VB] OO Programming References: <4E178653.23831.499CCE7@stuart.lexacorp.com.pg> Message-ID: <99266C61B516644D9727F983FAFAB465086569@remote.ddisolutions.com.au> Hi, I agree the service should have no UI component. Use a config file to set paremeters. It seems to be a filewatcher --> parser --> database updater service. Another option for notifying the user UI application is SQLDependency. http://msdn.microsoft.com/en-us/library/a52dhwx7%28v=vs.80%29.aspx I'm using this approach for the app I'm currently building (does not use a service, though I did consider that.). A bit quirky to set up but so far so good! Using this approach means that the service is completely separated from any client UI apps. The UI's are notified by the SQL database when the data changes or is inserted. No polling required either. Cheers Michael M Best prectice is for a service to not interact with the desktop in any way. Your service and your GUI should be separate applications. The GUI and service should communicate with each other through some form of Inter Process Communication (IPC). If the server and GUI will always run on the same workstation a good choice would be file mapping using named shared memory, (See http://msdn.microsoft.com/en-us/library/aa366556%28v=VS.85%29.aspx ) The server can then use SendNotifyMessage() with HWND_BROADCAST to tell any active GUI to check for updated data in the mapped file. -- Stuart On 8 Jul 2011 at 14:23, Francisco Tapia wrote: > Hey gang, > This thread I wanted to start to help cover some best practices when > it > comes to programming, since we don't have a C# group I figured vb.net > is close enough :). I was wondering how to approach my current > scenario. > > I'm building a really rather simple windows service. It monitors a > folder share on the network and whenever a new file is created it > takes a look at it and streams the contents to read for particular > pieces of data. Once the target data is obtained, the stream is > closed and the data is then inserted into a Sql Server database. > > simple. > > I'm thinking that the threaded process should have some events it > advertises that the gui can hook into right? the other way to get > this to work would be to just eliminate the gui updating from the > tread and have it read right off the log.txt file streamed in? what > are your thoughts? _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com ----- No virus found in this message. Checked by AVG - www.avg.com Version: 10.0.1388 / Virus Database: 1516/3751 - Release Date: 07/08/11 From fhtapia at gmail.com Mon Jul 11 09:27:03 2011 From: fhtapia at gmail.com (Francisco Tapia) Date: Mon, 11 Jul 2011 07:27:03 -0700 Subject: [dba-VB] OO Programming In-Reply-To: <4E178653.23831.499CCE7@stuart.lexacorp.com.pg> References: <4E178653.23831.499CCE7@stuart.lexacorp.com.pg> Message-ID: thanks for this advise. I am going to do some reading and see if I can implement some of this, this afternoon. -Francisco http://bit.ly/sqlthis | Tsql and More... On Fri, Jul 8, 2011 at 3:36 PM, Stuart McLachlan wrote: > Best prectice is for a service to not interact with the desktop in any way. > Your service and > your GUI should be separate applications. > > The GUI and service should communicate with each other through some form of > Inter > Process Communication (IPC). If the server and GUI will always run on > the same > workstation a good choice would be file mapping using named shared memory, > (See http://msdn.microsoft.com/en-us/library/aa366556%28v=VS.85%29.aspx ) > The server can then use SendNotifyMessage() with HWND_BROADCAST to tell > any active > GUI to check for updated data in the mapped file. > > -- > Stuart > > On 8 Jul 2011 at 14:23, Francisco Tapia wrote: > > > Hey gang, > > This thread I wanted to start to help cover some best practices when > > it > > comes to programming, since we don't have a C# group I figured vb.net > > is close enough :). I was wondering how to approach my current > > scenario. > > > > I'm building a really rather simple windows service. It monitors a > > folder share on the network and whenever a new file is created it > > takes a look at it and streams the contents to read for particular > > pieces of data. Once the target data is obtained, the stream is > > closed and the data is then inserted into a Sql Server database. > > > > simple. > > > > I'm thinking that the threaded process should have some events it > > advertises that the gui can hook into right? the other way to get > > this to work would be to just eliminate the gui updating from the > > tread and have it read right off the log.txt file streamed in? what > > are your thoughts? > > > _______________________________________________ > dba-VB mailing list > dba-VB at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-vb > http://www.databaseadvisors.com > > From fhtapia at gmail.com Mon Jul 11 09:32:13 2011 From: fhtapia at gmail.com (Francisco Tapia) Date: Mon, 11 Jul 2011 07:32:13 -0700 Subject: [dba-VB] OO Programming In-Reply-To: <99266C61B516644D9727F983FAFAB465086569@remote.ddisolutions.com.au> References: <4E178653.23831.499CCE7@stuart.lexacorp.com.pg> <99266C61B516644D9727F983FAFAB465086569@remote.ddisolutions.com.au> Message-ID: this is also a great lead! Thanks Michael! -Francisco http://bit.ly/sqlthis | Tsql and More... On Fri, Jul 8, 2011 at 6:32 PM, Michael Maddison < michael at ddisolutions.com.au> wrote: > Hi, > > I agree the service should have no UI component. Use a config file to > set paremeters. > > It seems to be a filewatcher --> parser --> database updater service. > Another option for notifying the user UI application is SQLDependency. > http://msdn.microsoft.com/en-us/library/a52dhwx7%28v=vs.80%29.aspx > I'm using this approach for the app I'm currently building (does not use > a service, though I did consider that.). > > A bit quirky to set up but so far so good! > Using this approach means that the service is completely separated from > any client UI apps. The UI's are notified by the SQL database when the > data changes or is inserted. > No polling required either. > > Cheers > > Michael M > > Best prectice is for a service to not interact with the desktop in any > way. Your service and your GUI should be separate applications. > > The GUI and service should communicate with each other through some form > of Inter > Process Communication (IPC). If the server and GUI will always run on > the same > workstation a good choice would be file mapping using named shared > memory, (See > http://msdn.microsoft.com/en-us/library/aa366556%28v=VS.85%29.aspx ) The > server can then use SendNotifyMessage() with HWND_BROADCAST to tell > any active GUI to check for updated data in the mapped file. > > -- > Stuart > > On 8 Jul 2011 at 14:23, Francisco Tapia wrote: > > > Hey gang, > > This thread I wanted to start to help cover some best practices when > > it > > comes to programming, since we don't have a C# group I figured vb.net > > is close enough :). I was wondering how to approach my current > > scenario. > > > > I'm building a really rather simple windows service. It monitors a > > folder share on the network and whenever a new file is created it > > takes a look at it and streams the contents to read for particular > > pieces of data. Once the target data is obtained, the stream is > > closed and the data is then inserted into a Sql Server database. > > > > simple. > > > > I'm thinking that the threaded process should have some events it > > advertises that the gui can hook into right? the other way to get > > this to work would be to just eliminate the gui updating from the > > tread and have it read right off the log.txt file streamed in? what > > are your thoughts? > > > _______________________________________________ > dba-VB mailing list > dba-VB at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-vb > http://www.databaseadvisors.com > > > ----- > No virus found in this message. > Checked by AVG - www.avg.com > Version: 10.0.1388 / Virus Database: 1516/3751 - Release Date: 07/08/11 > > _______________________________________________ > dba-VB mailing list > dba-VB at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-vb > http://www.databaseadvisors.com > > From gustav at cactus.dk Tue Jul 19 16:07:39 2011 From: gustav at cactus.dk (Gustav Brock) Date: Tue, 19 Jul 2011 23:07:39 +0200 Subject: [dba-VB] DatePart "WW" (C#: Extension of DateTime) Message-ID: Hi all Now, would you believe this _old_ bug has survived A2010 and .Net 4 / Visual Studio 2010! So - as someone brought up a long-winded solution - I had to post my version of the extension method for DateTime of C# at CodeProject: http://www.codeproject.com/Tips/227801/DateTime-extension-method-to-give-Week-number /gustav >>> Gustav at cactus.dk 24-05-2007 16:44 >>> Hi Mark If you are looking for ISO week numbers, use these constants: bytWeek = DatePart("ww", datDate, vbMonday, vbFirstFourDays) However, DatePart has always - since Access 1.0 - been buggy for week number 53. Thus, for serious business use, use a function like this which I have posted many times: Public Function ISO_WeekNumber( _ ByVal datDate As Date) _ As Byte ' Calculates and returns week number for date datDate according to the ISO 8601:1988 standard. ' 1998-2000, Gustav Brock, Cactus Data ApS, CPH. ' May be freely used and distributed. Const cbytFirstWeekOfAnyYear As Byte = 1 Const cbytLastWeekOfLeapYear As Byte = 53 Dim bytWeek As Byte Dim bytISOThursday As Byte Dim datLastDayOfYear As Date bytWeek = DatePart("ww", datDate, vbMonday, vbFirstFourDays) If bytWeek = cbytLastWeekOfLeapYear Then bytISOThursday = WeekDay(vbThursday, vbMonday) datLastDayOfYear = DateSerial(Year(datDate), 12, 31) If WeekDay(datLastDayOfYear, vbMonday) >= bytISOThursday Then ' OK, week count of 53 is caused by leap year. Else ' Correct for Access97/2000 bug. bytWeek = cbytFirstWeekOfAnyYear End If End If ISO_WeekNumber = bytWeek End Function /gustav >>> markamatte at hotmail.com 24-05-2007 16:14 >>> Hello All, I'm using datepart to get the week. 12/31/2006 I am having an issue...No matter what optional constant I use or change...I get Day1 of week 53... and 1/1/2007 shows as Day2 of week 1. How do I get Day1 of Week1? Thanks, Mark A. Matte From df.waters at comcast.net Wed Jul 20 19:13:56 2011 From: df.waters at comcast.net (Dan Waters) Date: Wed, 20 Jul 2011 19:13:56 -0500 Subject: [dba-VB] Problem with LinqToSQL, a listbox, a textbox, and SubmitChanges Message-ID: <006a01cc473b$167e99e0$437bcda0$@comcast.net> In a simple test form, I have a listbox and a textbox. The form is bound to a datacontext, which has a single table. The listbox has two items, and is not bound. The textbox is bound to the datacontext. When I select an item from the listbox, the following code runs: txtTest.Text = lstTest.SelectedItems(0).ToString Then when I push my Save button, the following code runs: Me.TextDC.SubmitChanges() But - the database field which the textbox is bound to is NOT updated. If I manually type in a value into the textbox and then push the Save button, the database field IS updated. I've been trying to solve this on and off for several days, and I finally made this very simple text form to confirm or deny what was happening. No errors occur. So, for some reason SubmitChanges() does not recognize that the textbox needs to be updated if it's .Text property has been updated from the listbox, but does recognize that it needs to be updated if I manually type in a value. What's the difference? Dan From michael at ddisolutions.com.au Wed Jul 20 19:52:16 2011 From: michael at ddisolutions.com.au (Michael Maddison) Date: Thu, 21 Jul 2011 10:52:16 +1000 Subject: [dba-VB] Problem with LinqToSQL, a listbox, a textbox, and SubmitChanges References: <006a01cc473b$167e99e0$437bcda0$@comcast.net> Message-ID: <99266C61B516644D9727F983FAFAB465086626@remote.ddisolutions.com.au> I havn't confirmed this but the same would happen when binding with ADO objects as well. I assume it's a part of the binding process. IIRC you need to update the underlying entity and it will update the text property. I can't test now but I think that should work. Cheers Michael M -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Dan Waters Sent: Thursday, 21 July 2011 10:14 AM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: [dba-VB] Problem with LinqToSQL, a listbox, a textbox,and SubmitChanges In a simple test form, I have a listbox and a textbox. The form is bound to a datacontext, which has a single table. The listbox has two items, and is not bound. The textbox is bound to the datacontext. When I select an item from the listbox, the following code runs: txtTest.Text = lstTest.SelectedItems(0).ToString Then when I push my Save button, the following code runs: Me.TextDC.SubmitChanges() But - the database field which the textbox is bound to is NOT updated. If I manually type in a value into the textbox and then push the Save button, the database field IS updated. I've been trying to solve this on and off for several days, and I finally made this very simple text form to confirm or deny what was happening. No errors occur. So, for some reason SubmitChanges() does not recognize that the textbox needs to be updated if it's .Text property has been updated from the listbox, but does recognize that it needs to be updated if I manually type in a value. What's the difference? Dan _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com ----- No virus found in this message. Checked by AVG - www.avg.com Version: 10.0.1390 / Virus Database: 1518/3777 - Release Date: 07/20/11 From fhtapia at gmail.com Thu Jul 21 14:19:04 2011 From: fhtapia at gmail.com (Francisco Tapia) Date: Thu, 21 Jul 2011 12:19:04 -0700 Subject: [dba-VB] iOS and Sql Server Message-ID: Is anybody here working on mobile apps? Today I ran into this link from redgate for helping to get access to sql servers in your organization using iOS's mobile platform... http://mobilefoo.com/ProductDetail.aspx/iSql -Francisco http://bit.ly/sqlthis | Tsql and More... From df.waters at comcast.net Fri Jul 29 12:38:32 2011 From: df.waters at comcast.net (Dan Waters) Date: Fri, 29 Jul 2011 12:38:32 -0500 Subject: [dba-VB] Setting a Textbox Variable Message-ID: <002b01cc4e16$56dc31a0$049494e0$@comcast.net> In VB.Net, I'm trying to pass a listbox object into a procedure, get part of the name of that listbox, and then set a textbox object to a specific textbox using the partial name of the listbox. In Access it's easy: Public Sub XXX(lst As ListBox) Dim txt As TextBox Dim stg as String stg = "txt" & Mid(lst.Name, 4) Set txt = Me.Controls(stg) End Sub Part of the answer is: stg = "txt" & lst.Name.Substring(0, 4) But I don't know how to actually 'set' the textbox variable to a specific textbox. Thanks! From michael at ddisolutions.com.au Fri Jul 29 21:05:50 2011 From: michael at ddisolutions.com.au (Michael Maddison) Date: Sat, 30 Jul 2011 12:05:50 +1000 Subject: [dba-VB] Setting a Textbox Variable References: <002b01cc4e16$56dc31a0$049494e0$@comcast.net> Message-ID: <99266C61B516644D9727F983FAFAB46508667C@remote.ddisolutions.com.au> Hi Don, Your code seems to work as is. Are you sure you have a textbox with that name? Cheers Michael M -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Dan Waters Sent: Saturday, 30 July 2011 3:39 AM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: [dba-VB] Setting a Textbox Variable In VB.Net, I'm trying to pass a listbox object into a procedure, get part of the name of that listbox, and then set a textbox object to a specific textbox using the partial name of the listbox. In Access it's easy: Public Sub XXX(lst As ListBox) Dim txt As TextBox Dim stg as String stg = "txt" & Mid(lst.Name, 4) Set txt = Me.Controls(stg) End Sub Part of the answer is: stg = "txt" & lst.Name.Substring(0, 4) But I don't know how to actually 'set' the textbox variable to a specific textbox. Thanks! _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com ----- No virus found in this message. Checked by AVG - www.avg.com Version: 10.0.1390 / Virus Database: 1518/3797 - Release Date: 07/29/11 From shamil at smsconsulting.spb.ru Sat Jul 30 05:24:47 2011 From: shamil at smsconsulting.spb.ru (Shamil Salakhetdinov) Date: Sat, 30 Jul 2011 14:24:47 +0400 Subject: [dba-VB] Setting a Textbox Variable In-Reply-To: <99266C61B516644D9727F983FAFAB46508667C@remote.ddisolutions.com.au> References: <002b01cc4e16$56dc31a0$049494e0$@comcast.net> <99266C61B516644D9727F983FAFAB46508667C@remote.ddisolutions.com.au> Message-ID: Yes, Don, your code should work as is - there are several other options (VS2010): Dim txt As TextBox txt = Me.Controls("TextBox1") or txt = Me.Controls.Item("TextBox1") or txt = CType(Me.Controls.Find("TextBox1", False)(0), TextBox) ... Thank you. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Michael Maddison Sent: 30 ???? 2011 ?. 6:06 To: df.waters at comcast.net; Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] Setting a Textbox Variable Hi Don, Your code seems to work as is. Are you sure you have a textbox with that name? Cheers Michael M -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Dan Waters Sent: Saturday, 30 July 2011 3:39 AM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: [dba-VB] Setting a Textbox Variable In VB.Net, I'm trying to pass a listbox object into a procedure, get part of the name of that listbox, and then set a textbox object to a specific textbox using the partial name of the listbox. In Access it's easy: Public Sub XXX(lst As ListBox) Dim txt As TextBox Dim stg as String stg = "txt" & Mid(lst.Name, 4) Set txt = Me.Controls(stg) End Sub Part of the answer is: stg = "txt" & lst.Name.Substring(0, 4) But I don't know how to actually 'set' the textbox variable to a specific textbox. Thanks! _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com ----- No virus found in this message. Checked by AVG - www.avg.com Version: 10.0.1390 / Virus Database: 1518/3797 - Release Date: 07/29/11 _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Sat Jul 2 12:29:27 2011 From: jwcolby at colbyconsulting.com (jwcolby) Date: Sat, 02 Jul 2011 13:29:27 -0400 Subject: [dba-VB] SQL Server - SSD / Rotating media - Side by side test results Message-ID: <4E0F5577.9060206@colbyconsulting.com> This morning I set out to do a little bit of real world testing to see what my SSD investment buys me. The following are some results. BTW if a SQL Server guru wants to actually gain remote access and run tests on my system I would welcome that. I am obviously not very talented as a SQL Server DBA and so a real DBA who has an interest is welcomed to tune and test. Anyway, I have a pair of databases that I will be testing with. One is my infamous "database from hell" called HSID, containing 51 million records with about 600 fields. The other is my HSIDAllAdults containing about 65 million Name and address fields. HSIDAllAdults is child to HSID, IOW it has a foreign key which contains the PK of HSID. Both databases have a clustered index on their autonumber PK. So... I have both of these databases on a four SSD RAID 0. I backed them up last night and restored them to the same name + _Rotatingmedia on my RAID6 volumes. So I have identical databases on a 4 SSD Raid 0 and a 6 disk RAID 6. I am now doing some comparative A/B runs of rather standard queries - similar to things I do routinely. I backed up the two databases last night just before upgrading the server. I restored both tha HSID and HSIDAllAdults this AM to the same rotating media location I normally hold the databases. I did not defrag the rotating media before doing the restore. I include the counts so that we can be assured that the actual data is identical between the SSD and rotating media DBs. HSIDAllAdults - has a pair of cover indexes each of which includes Address valid DBCC DROPCLEANBUFFERS SELECT AddrValid, COUNT(PK) AS Cnt FROM dbo.tblAllAdultNameAddr GROUP BY AddrValid SSD: 12 seconds ANK 635917 E 2918652 INV 936058 MOV 112093 PO 3780131 V 59074768 Rotating: 52 seconds ANK 635917 E 2918652 INV 936058 MOV 112093 PO 3780131 V 59074768 DBCC DROPCLEANBUFFERS SELECT COUNT(_DataHSID.dbo.tblHSID.PKID) AS Cnt, dbo.tblAllAdultNameAddr.AddrValid FROM dbo.tblAllAdultNameAddr INNER JOIN _DataHSID.dbo.tblHSID ON dbo.tblAllAdultNameAddr.PKHSID = _DataHSID.dbo.tblHSID.PKID GROUP BY dbo.tblAllAdultNameAddr.AddrValid SSD: 35 seconds 635917 ANK 2918652 E 936058 INV 112093 MOV 3780131 PO 59074768 V DBCC DROPCLEANBUFFERS SELECT COUNT(_DataHSID_RotatingMedia.dbo.tblHSID.PKID) AS Cnt, dbo.tblAllAdultNameAddr.AddrValid FROM _DataHSID_RotatingMedia.dbo.tblHSID INNER JOIN dbo.tblAllAdultNameAddr ON _DataHSID_RotatingMedia.dbo.tblHSID.PKID = dbo.tblAllAdultNameAddr.PKHSID GROUP BY dbo.tblAllAdultNameAddr.AddrValid Rotating: 1:00 635917 ANK 2918652 E 936058 INV 112093 MOV 3780131 PO 59074768 V The following appears to be a table scan which would be a "worst case". I just picked a field from HSID which we use occasionally. DBCC DROPCLEANBUFFERS SELECT COUNT(PKID) AS Cnt, Household_Occupation_code FROM dbo.tblHSID GROUP BY Household_Occupation_code Rotating: 7:06 35481479 NULL 7143021 10 11480 11 9780 12 37452 13 115093 20 2266292 21 501715 22 23724 23 1039660 30 1325728 40 1183311 50 8271 51 70318 52 2566 60 33157 61 28595 62 15305 70 511464 80 739340 90 609317 91 Rotating media: 1:05 35481479 NULL 7143021 10 11480 11 9780 12 37452 13 115093 20 2266292 21 501715 22 23724 23 1039660 30 1325728 40 1183311 50 8271 51 70318 52 2566 60 33157 61 28595 62 15305 70 511464 80 739340 90 609317 91 DBCC DROPCLEANBUFFERS SELECT COUNT(PKID) AS Cnt, Narrow_Income_Band FROM dbo.tblHSID GROUP BY Narrow_Income_Band SSD: 8 seconds 13824508 NULL 3762511 1 1675853 2 1015899 3 2307736 4 1031640 5 2595759 6 1069374 7 2662509 8 1100049 9 1055216 A 1026910 B 4285629 C 941494 D 862906 E 831573 F 2443917 G 738328 H 676959 I 478582 J 423856 K 1168819 L 371413 M 333796 N 249064 O 204771 P 708189 Q 193265 R 189413 S 2927130 T Rotating media: 10 seconds 13824508 NULL 3762511 1 1675853 2 1015899 3 2307736 4 1031640 5 2595759 6 1069374 7 2662509 8 1100049 9 1055216 A 1026910 B 4285629 C 941494 D 862906 E 831573 F 2443917 G 738328 H 676959 I 478582 J 423856 K 1168819 L 371413 M 333796 N 249064 O 204771 P 708189 Q 193265 R 189413 S 2927130 T I am going to stop for now. I have the rotating media copies and will leave them in place for awhile. If any real DBA wants to do some testing let me know. Obviously I have to know you. :) -- John W. Colby www.ColbyConsulting.com From jwcolby at colbyconsulting.com Sat Jul 2 13:36:42 2011 From: jwcolby at colbyconsulting.com (jwcolby) Date: Sat, 02 Jul 2011 14:36:42 -0400 Subject: [dba-VB] [dba-SQLServer] SQL Server - SSD / Rotating media - Side by side test results In-Reply-To: References: <4E0F5577.9060206@colbyconsulting.com> Message-ID: <4E0F653A.7070503@colbyconsulting.com> Arthur, There are definite cases where the gains are minimal, others where they are significant. The other thing is that I am intentionally clearing the cache before each test. The cache further minimizes the differences as it turns out. That is to be expected of course. This just goes to show the old axiom that throwing memory at SQL Server does a world of good. Without a shadow of a doubt, one thing that SSDs (and faster / better hardware in general) do is minimize the impact of ignorance and sloth. ;) I am not an accomplished DBA, and I simply do not have the time to become one. As a result I am unable to correctly tune my system. By throwing cores, memory and SSDs at the problem I manage to achieve respectable results in spite of myself. Hardware is cheap. My entire server cost somewhere in the neighborhood of $5K. Additionally I have dragged disk and RAID controllers forward through many upgrades. Back around 2005 I spent the then enormous sum of $1600 for three Areca raid controllers which I am still using today. I bought 10 1 TB drives back when they were $150, but I am still using them today. What I upgrade are the motherboards and more frequently the processors. In 2004 I started with single core AMD 3800 processors using Windows2003 X32 and 4 gigs of RAM. I built two systems for $4000! Moving up to dual and then quad cores, and Windows / SQL Server X64 and 8 GB RAM, then 16 gigs of ram. My latest motherboard / processor cost me (my client of course) about $700 (8 cores, with 24 cores possible) and 32 gigs of ram was about $1000. I was looking last night and another 32 GB of RAM (same modules) is now only $600! And... I am using my entire old server (quad core / 16 gigs ram) for a VM server. The point really is that while it is not a trivial amount spent over the years making these upgrades, over that same period I billed a couple of hundred thousand dollars. All these upgrades make me more and more productive, faster and faster getting the results back to the client. The client *loves me* precisely because he gets results back in hours instead of a week as his previous provider gave him. I program custom C# solutions (and bill him for the programming) which have enabled me to do orders literally in hours which (back in 2006) took me a full day or even two to get out. Counts which took an hour in 2004 now take my custom program 2 minutes. *AND* I have developed a system which allows him to send emails with zip lists as attachments. A program running on my server strips off the CSV attachment, generate counts, build a count spreadsheet, attach it to an email and send it back to him literally within 5 minutes of him pressing send *without* my doing anything. Again those counts used to take me an hour back when I did everything by hand. Now I log that a count came in and put a small charge in my billing database! The lesson for me is that my time is worth much more than the cost of the electronics and my response time is what makes me valuable to the client. I fully understand than everyone cannot solve all their problems by throwing hardware / custom software at it, but for a sole proprietor it just might be the only way! I don't have the time to be good at all the hats I wear! And so I do things like spend a thousand on SSDs on an educated guess that they will make a significant difference for an uneducated sloth. :) And finally, because the client loves me, he is sending me a *ton* more work! MORE CORES! MORE MEMORY! More SSDs! :):):) John W. Colby www.ColbyConsulting.com On 7/2/2011 1:48 PM, Arthur Fuller wrote: > I would be happy to assist. Judging by your IMO rather narrow result-gap (measured in a few > seconds), my initial guess would be that the SSHDs are not gaining you much over your investment in > CPU and RAM. However, that remains to be determined. Could be that table-scans or some other factor > are causing this lag. Should be that SSHD retrieves ought to be an order of magnitude quicker, but > according to your posted measurements they lag significantly behind that thumbnail benchmark. > > And besides all that, how are you? What's new with you and your family? > > A. From jwcolby at colbyconsulting.com Sun Jul 3 11:56:54 2011 From: jwcolby at colbyconsulting.com (jwcolby) Date: Sun, 03 Jul 2011 12:56:54 -0400 Subject: [dba-VB] SSD, The Game Changer - SQL Man of Mystery - SQLServerCentral.com Message-ID: <4E109F56.809@colbyconsulting.com> -- John W. Colby www.ColbyConsulting.com http://www.sqlservercentral.com/blogs/sqlmanofmystery/archive/2009/04/14/ssd-the-game-changer.aspx From jwcolby at colbyconsulting.com Tue Jul 5 03:56:04 2011 From: jwcolby at colbyconsulting.com (jwcolby) Date: Tue, 05 Jul 2011 04:56:04 -0400 Subject: [dba-VB] Sourcegear vault free two developer license Message-ID: <4E12D1A4.1010809@colbyconsulting.com> I ran across this today. http://www.sqlservercentral.com/articles/Red+Gate+Software/74579/ http://promotions.sourcegear.com/vouchers/new/ -- John W. Colby www.ColbyConsulting.com From rls at WeBeDb.com Tue Jul 5 09:17:54 2011 From: rls at WeBeDb.com (Robert Stewart) Date: Tue, 05 Jul 2011 09:17:54 -0500 Subject: [dba-VB] Silverlight Image in Listbox In-Reply-To: References: Message-ID: <5A357FDC-7B9A-405A-9581-55AB3A4EA646@holly.arvixe.com> Question: I have a silverlight listbox control. It is bound to data in a database, not an object. I have the URL for an image stored in each of the records returned from the database. I need to display that in the list box. < Image x:Name="imgPhoto" Height="30" Width="30" Source="{Binding Path=PhotoURL}" /> does not work by itself. The URL stored in the database looks something like this: "/images/1_0.jpg" Does anybody know how to get the image to display? Robert L. Stewart www.WeBeDb.com www.DBGUIDesign.com www.RLStewartPhotography.com From R.Griffiths at bury.gov.uk Tue Jul 5 11:39:53 2011 From: R.Griffiths at bury.gov.uk (Griffiths, Richard) Date: Tue, 5 Jul 2011 17:39:53 +0100 Subject: [dba-VB] Silverlight Image in Listbox In-Reply-To: <5A357FDC-7B9A-405A-9581-55AB3A4EA646@holly.arvixe.com> References: <5A357FDC-7B9A-405A-9581-55AB3A4EA646@holly.arvixe.com> Message-ID: <201107051640.p65Gdx1H016343@databaseadvisors.com> Hi this is what I do... if (this.ImgCoverMedium.Length>0) this.imgCover = new System.Windows.Media.Imaging.BitmapImage(new Uri(this.ImgCoverMedium, UriKind.Absolute)); Where imgCover is type : System.Windows.Media.Imaging.BitmapImage and ImgCoverMedium is the (string) path the image. HTH Richard -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Robert Stewart Sent: 05 July 2011 15:18 To: dba-vb at databaseadvisors.com Subject: [dba-VB] Silverlight Image in Listbox Question: I have a silverlight listbox control. It is bound to data in a database, not an object. I have the URL for an image stored in each of the records returned from the database. I need to display that in the list box. < Image x:Name="imgPhoto" Height="30" Width="30" Source="{Binding Path=PhotoURL}" /> does not work by itself. The URL stored in the database looks something like this: "/images/1_0.jpg" Does anybody know how to get the image to display? Robert L. Stewart www.WeBeDb.com www.DBGUIDesign.com www.RLStewartPhotography.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com ----------------------------------------------------------------- Why not visit our website www.bury.gov.uk ----------------------------------------------------------------- Incoming and outgoing e-mail messages are routinely monitored for compliance with our information security policy. The information contained in this e-mail and any files transmitted with it is for the intended recipient(s) alone. It may contain confidential information that is exempt from the disclosure under English law and may also be covered by legal,professional or other privilege. If you are not the intended recipient, you must not copy, distribute or take any action in reliance on it. If you have received this e-mail in error, please notify us immediately by using the reply facility on your e-mail system. If this message is being transmitted over the Internet, be aware that it may be intercepted by third parties. As a public body, the Council may be required to disclose this e-mail or any response to it under the Freedom of Information Act 2000 unless the information in it is covered by one of the exemptions in the Act. Electronic service accepted only at legalservices at bury.gov.uk and on fax number 0161 253 5119 . ************************************************************* From jwcolby at colbyconsulting.com Wed Jul 6 06:46:07 2011 From: jwcolby at colbyconsulting.com (jwcolby) Date: Wed, 06 Jul 2011 07:46:07 -0400 Subject: [dba-VB] =?windows-1252?q?HASHBYTES_=96_A_T-SQL_Function_-_SQL_Mu?= =?windows-1252?q?sings_-_SQLServerCentral=2Ecom?= Message-ID: <4E144AFF.5010306@colbyconsulting.com> We were discussing hashes awhile back. -- John W. Colby www.ColbyConsulting.com http://www.sqlservercentral.com/blogs/steve_jones/archive/2011/6/28/hashbytes-_1320_-a-t_2D00_sql-function.aspx From df.waters at comcast.net Wed Jul 6 08:57:58 2011 From: df.waters at comcast.net (Dan Waters) Date: Wed, 6 Jul 2011 08:57:58 -0500 Subject: [dba-VB] More on SourceGear Message-ID: <002201cc3be4$b9dc5a30$2d950e90$@comcast.net> >From SourceGear's FAQ page: --------- Somebody said that Vault is FREE for a single user. Is this true? Yes. Vault is free for use by a single user. Simply install the product and do not enter any serial numbers at all. When no serial numbers are present, Vault behaves as if there is exactly one user license. Note that this free license does not apply when the product is used by more than one person. If you have two people who need to use Vault, you will need to purchase?two?initial licenses. If you enter a serial number containing only one license, then the product will?still?have exactly one license present. --------- The promotional pair of licenses does not include maintenance updates, but I'll guess that a single user license can be updated. Also, I wanted the Standard version instead of the Pro version. Dan From fhtapia at gmail.com Fri Jul 8 16:23:44 2011 From: fhtapia at gmail.com (Francisco Tapia) Date: Fri, 8 Jul 2011 14:23:44 -0700 Subject: [dba-VB] OO Programming Message-ID: Hey gang, This thread I wanted to start to help cover some best practices when it comes to programming, since we don't have a C# group I figured vb.net is close enough :). I was wondering how to approach my current scenario. I'm building a really rather simple windows service. It monitors a folder share on the network and whenever a new file is created it takes a look at it and streams the contents to read for particular pieces of data. Once the target data is obtained, the stream is closed and the data is then inserted into a Sql Server database. simple. I'm thinking that the threaded process should have some events it advertises that the gui can hook into right? the other way to get this to work would be to just eliminate the gui updating from the tread and have it read right off the log.txt file streamed in? what are your thoughts? -Francisco http://bit.ly/sqlthis | Tsql and More... From stuart at lexacorp.com.pg Fri Jul 8 17:36:03 2011 From: stuart at lexacorp.com.pg (Stuart McLachlan) Date: Sat, 09 Jul 2011 08:36:03 +1000 Subject: [dba-VB] OO Programming In-Reply-To: References: Message-ID: <4E178653.23831.499CCE7@stuart.lexacorp.com.pg> Best prectice is for a service to not interact with the desktop in any way. Your service and your GUI should be separate applications. The GUI and service should communicate with each other through some form of Inter Process Communication (IPC). If the server and GUI will always run on the same workstation a good choice would be file mapping using named shared memory, (See http://msdn.microsoft.com/en-us/library/aa366556%28v=VS.85%29.aspx ) The server can then use SendNotifyMessage() with HWND_BROADCAST to tell any active GUI to check for updated data in the mapped file. -- Stuart On 8 Jul 2011 at 14:23, Francisco Tapia wrote: > Hey gang, > This thread I wanted to start to help cover some best practices when > it > comes to programming, since we don't have a C# group I figured vb.net > is close enough :). I was wondering how to approach my current > scenario. > > I'm building a really rather simple windows service. It monitors a > folder share on the network and whenever a new file is created it > takes a look at it and streams the contents to read for particular > pieces of data. Once the target data is obtained, the stream is > closed and the data is then inserted into a Sql Server database. > > simple. > > I'm thinking that the threaded process should have some events it > advertises that the gui can hook into right? the other way to get > this to work would be to just eliminate the gui updating from the > tread and have it read right off the log.txt file streamed in? what > are your thoughts? From michael at ddisolutions.com.au Fri Jul 8 20:32:59 2011 From: michael at ddisolutions.com.au (Michael Maddison) Date: Sat, 9 Jul 2011 11:32:59 +1000 Subject: [dba-VB] OO Programming References: <4E178653.23831.499CCE7@stuart.lexacorp.com.pg> Message-ID: <99266C61B516644D9727F983FAFAB465086569@remote.ddisolutions.com.au> Hi, I agree the service should have no UI component. Use a config file to set paremeters. It seems to be a filewatcher --> parser --> database updater service. Another option for notifying the user UI application is SQLDependency. http://msdn.microsoft.com/en-us/library/a52dhwx7%28v=vs.80%29.aspx I'm using this approach for the app I'm currently building (does not use a service, though I did consider that.). A bit quirky to set up but so far so good! Using this approach means that the service is completely separated from any client UI apps. The UI's are notified by the SQL database when the data changes or is inserted. No polling required either. Cheers Michael M Best prectice is for a service to not interact with the desktop in any way. Your service and your GUI should be separate applications. The GUI and service should communicate with each other through some form of Inter Process Communication (IPC). If the server and GUI will always run on the same workstation a good choice would be file mapping using named shared memory, (See http://msdn.microsoft.com/en-us/library/aa366556%28v=VS.85%29.aspx ) The server can then use SendNotifyMessage() with HWND_BROADCAST to tell any active GUI to check for updated data in the mapped file. -- Stuart On 8 Jul 2011 at 14:23, Francisco Tapia wrote: > Hey gang, > This thread I wanted to start to help cover some best practices when > it > comes to programming, since we don't have a C# group I figured vb.net > is close enough :). I was wondering how to approach my current > scenario. > > I'm building a really rather simple windows service. It monitors a > folder share on the network and whenever a new file is created it > takes a look at it and streams the contents to read for particular > pieces of data. Once the target data is obtained, the stream is > closed and the data is then inserted into a Sql Server database. > > simple. > > I'm thinking that the threaded process should have some events it > advertises that the gui can hook into right? the other way to get > this to work would be to just eliminate the gui updating from the > tread and have it read right off the log.txt file streamed in? what > are your thoughts? _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com ----- No virus found in this message. Checked by AVG - www.avg.com Version: 10.0.1388 / Virus Database: 1516/3751 - Release Date: 07/08/11 From fhtapia at gmail.com Mon Jul 11 09:27:03 2011 From: fhtapia at gmail.com (Francisco Tapia) Date: Mon, 11 Jul 2011 07:27:03 -0700 Subject: [dba-VB] OO Programming In-Reply-To: <4E178653.23831.499CCE7@stuart.lexacorp.com.pg> References: <4E178653.23831.499CCE7@stuart.lexacorp.com.pg> Message-ID: thanks for this advise. I am going to do some reading and see if I can implement some of this, this afternoon. -Francisco http://bit.ly/sqlthis | Tsql and More... On Fri, Jul 8, 2011 at 3:36 PM, Stuart McLachlan wrote: > Best prectice is for a service to not interact with the desktop in any way. > Your service and > your GUI should be separate applications. > > The GUI and service should communicate with each other through some form of > Inter > Process Communication (IPC). If the server and GUI will always run on > the same > workstation a good choice would be file mapping using named shared memory, > (See http://msdn.microsoft.com/en-us/library/aa366556%28v=VS.85%29.aspx ) > The server can then use SendNotifyMessage() with HWND_BROADCAST to tell > any active > GUI to check for updated data in the mapped file. > > -- > Stuart > > On 8 Jul 2011 at 14:23, Francisco Tapia wrote: > > > Hey gang, > > This thread I wanted to start to help cover some best practices when > > it > > comes to programming, since we don't have a C# group I figured vb.net > > is close enough :). I was wondering how to approach my current > > scenario. > > > > I'm building a really rather simple windows service. It monitors a > > folder share on the network and whenever a new file is created it > > takes a look at it and streams the contents to read for particular > > pieces of data. Once the target data is obtained, the stream is > > closed and the data is then inserted into a Sql Server database. > > > > simple. > > > > I'm thinking that the threaded process should have some events it > > advertises that the gui can hook into right? the other way to get > > this to work would be to just eliminate the gui updating from the > > tread and have it read right off the log.txt file streamed in? what > > are your thoughts? > > > _______________________________________________ > dba-VB mailing list > dba-VB at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-vb > http://www.databaseadvisors.com > > From fhtapia at gmail.com Mon Jul 11 09:32:13 2011 From: fhtapia at gmail.com (Francisco Tapia) Date: Mon, 11 Jul 2011 07:32:13 -0700 Subject: [dba-VB] OO Programming In-Reply-To: <99266C61B516644D9727F983FAFAB465086569@remote.ddisolutions.com.au> References: <4E178653.23831.499CCE7@stuart.lexacorp.com.pg> <99266C61B516644D9727F983FAFAB465086569@remote.ddisolutions.com.au> Message-ID: this is also a great lead! Thanks Michael! -Francisco http://bit.ly/sqlthis | Tsql and More... On Fri, Jul 8, 2011 at 6:32 PM, Michael Maddison < michael at ddisolutions.com.au> wrote: > Hi, > > I agree the service should have no UI component. Use a config file to > set paremeters. > > It seems to be a filewatcher --> parser --> database updater service. > Another option for notifying the user UI application is SQLDependency. > http://msdn.microsoft.com/en-us/library/a52dhwx7%28v=vs.80%29.aspx > I'm using this approach for the app I'm currently building (does not use > a service, though I did consider that.). > > A bit quirky to set up but so far so good! > Using this approach means that the service is completely separated from > any client UI apps. The UI's are notified by the SQL database when the > data changes or is inserted. > No polling required either. > > Cheers > > Michael M > > Best prectice is for a service to not interact with the desktop in any > way. Your service and your GUI should be separate applications. > > The GUI and service should communicate with each other through some form > of Inter > Process Communication (IPC). If the server and GUI will always run on > the same > workstation a good choice would be file mapping using named shared > memory, (See > http://msdn.microsoft.com/en-us/library/aa366556%28v=VS.85%29.aspx ) The > server can then use SendNotifyMessage() with HWND_BROADCAST to tell > any active GUI to check for updated data in the mapped file. > > -- > Stuart > > On 8 Jul 2011 at 14:23, Francisco Tapia wrote: > > > Hey gang, > > This thread I wanted to start to help cover some best practices when > > it > > comes to programming, since we don't have a C# group I figured vb.net > > is close enough :). I was wondering how to approach my current > > scenario. > > > > I'm building a really rather simple windows service. It monitors a > > folder share on the network and whenever a new file is created it > > takes a look at it and streams the contents to read for particular > > pieces of data. Once the target data is obtained, the stream is > > closed and the data is then inserted into a Sql Server database. > > > > simple. > > > > I'm thinking that the threaded process should have some events it > > advertises that the gui can hook into right? the other way to get > > this to work would be to just eliminate the gui updating from the > > tread and have it read right off the log.txt file streamed in? what > > are your thoughts? > > > _______________________________________________ > dba-VB mailing list > dba-VB at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-vb > http://www.databaseadvisors.com > > > ----- > No virus found in this message. > Checked by AVG - www.avg.com > Version: 10.0.1388 / Virus Database: 1516/3751 - Release Date: 07/08/11 > > _______________________________________________ > dba-VB mailing list > dba-VB at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-vb > http://www.databaseadvisors.com > > From gustav at cactus.dk Tue Jul 19 16:07:39 2011 From: gustav at cactus.dk (Gustav Brock) Date: Tue, 19 Jul 2011 23:07:39 +0200 Subject: [dba-VB] DatePart "WW" (C#: Extension of DateTime) Message-ID: Hi all Now, would you believe this _old_ bug has survived A2010 and .Net 4 / Visual Studio 2010! So - as someone brought up a long-winded solution - I had to post my version of the extension method for DateTime of C# at CodeProject: http://www.codeproject.com/Tips/227801/DateTime-extension-method-to-give-Week-number /gustav >>> Gustav at cactus.dk 24-05-2007 16:44 >>> Hi Mark If you are looking for ISO week numbers, use these constants: bytWeek = DatePart("ww", datDate, vbMonday, vbFirstFourDays) However, DatePart has always - since Access 1.0 - been buggy for week number 53. Thus, for serious business use, use a function like this which I have posted many times: Public Function ISO_WeekNumber( _ ByVal datDate As Date) _ As Byte ' Calculates and returns week number for date datDate according to the ISO 8601:1988 standard. ' 1998-2000, Gustav Brock, Cactus Data ApS, CPH. ' May be freely used and distributed. Const cbytFirstWeekOfAnyYear As Byte = 1 Const cbytLastWeekOfLeapYear As Byte = 53 Dim bytWeek As Byte Dim bytISOThursday As Byte Dim datLastDayOfYear As Date bytWeek = DatePart("ww", datDate, vbMonday, vbFirstFourDays) If bytWeek = cbytLastWeekOfLeapYear Then bytISOThursday = WeekDay(vbThursday, vbMonday) datLastDayOfYear = DateSerial(Year(datDate), 12, 31) If WeekDay(datLastDayOfYear, vbMonday) >= bytISOThursday Then ' OK, week count of 53 is caused by leap year. Else ' Correct for Access97/2000 bug. bytWeek = cbytFirstWeekOfAnyYear End If End If ISO_WeekNumber = bytWeek End Function /gustav >>> markamatte at hotmail.com 24-05-2007 16:14 >>> Hello All, I'm using datepart to get the week. 12/31/2006 I am having an issue...No matter what optional constant I use or change...I get Day1 of week 53... and 1/1/2007 shows as Day2 of week 1. How do I get Day1 of Week1? Thanks, Mark A. Matte From df.waters at comcast.net Wed Jul 20 19:13:56 2011 From: df.waters at comcast.net (Dan Waters) Date: Wed, 20 Jul 2011 19:13:56 -0500 Subject: [dba-VB] Problem with LinqToSQL, a listbox, a textbox, and SubmitChanges Message-ID: <006a01cc473b$167e99e0$437bcda0$@comcast.net> In a simple test form, I have a listbox and a textbox. The form is bound to a datacontext, which has a single table. The listbox has two items, and is not bound. The textbox is bound to the datacontext. When I select an item from the listbox, the following code runs: txtTest.Text = lstTest.SelectedItems(0).ToString Then when I push my Save button, the following code runs: Me.TextDC.SubmitChanges() But - the database field which the textbox is bound to is NOT updated. If I manually type in a value into the textbox and then push the Save button, the database field IS updated. I've been trying to solve this on and off for several days, and I finally made this very simple text form to confirm or deny what was happening. No errors occur. So, for some reason SubmitChanges() does not recognize that the textbox needs to be updated if it's .Text property has been updated from the listbox, but does recognize that it needs to be updated if I manually type in a value. What's the difference? Dan From michael at ddisolutions.com.au Wed Jul 20 19:52:16 2011 From: michael at ddisolutions.com.au (Michael Maddison) Date: Thu, 21 Jul 2011 10:52:16 +1000 Subject: [dba-VB] Problem with LinqToSQL, a listbox, a textbox, and SubmitChanges References: <006a01cc473b$167e99e0$437bcda0$@comcast.net> Message-ID: <99266C61B516644D9727F983FAFAB465086626@remote.ddisolutions.com.au> I havn't confirmed this but the same would happen when binding with ADO objects as well. I assume it's a part of the binding process. IIRC you need to update the underlying entity and it will update the text property. I can't test now but I think that should work. Cheers Michael M -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Dan Waters Sent: Thursday, 21 July 2011 10:14 AM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: [dba-VB] Problem with LinqToSQL, a listbox, a textbox,and SubmitChanges In a simple test form, I have a listbox and a textbox. The form is bound to a datacontext, which has a single table. The listbox has two items, and is not bound. The textbox is bound to the datacontext. When I select an item from the listbox, the following code runs: txtTest.Text = lstTest.SelectedItems(0).ToString Then when I push my Save button, the following code runs: Me.TextDC.SubmitChanges() But - the database field which the textbox is bound to is NOT updated. If I manually type in a value into the textbox and then push the Save button, the database field IS updated. I've been trying to solve this on and off for several days, and I finally made this very simple text form to confirm or deny what was happening. No errors occur. So, for some reason SubmitChanges() does not recognize that the textbox needs to be updated if it's .Text property has been updated from the listbox, but does recognize that it needs to be updated if I manually type in a value. What's the difference? Dan _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com ----- No virus found in this message. Checked by AVG - www.avg.com Version: 10.0.1390 / Virus Database: 1518/3777 - Release Date: 07/20/11 From fhtapia at gmail.com Thu Jul 21 14:19:04 2011 From: fhtapia at gmail.com (Francisco Tapia) Date: Thu, 21 Jul 2011 12:19:04 -0700 Subject: [dba-VB] iOS and Sql Server Message-ID: Is anybody here working on mobile apps? Today I ran into this link from redgate for helping to get access to sql servers in your organization using iOS's mobile platform... http://mobilefoo.com/ProductDetail.aspx/iSql -Francisco http://bit.ly/sqlthis | Tsql and More... From df.waters at comcast.net Fri Jul 29 12:38:32 2011 From: df.waters at comcast.net (Dan Waters) Date: Fri, 29 Jul 2011 12:38:32 -0500 Subject: [dba-VB] Setting a Textbox Variable Message-ID: <002b01cc4e16$56dc31a0$049494e0$@comcast.net> In VB.Net, I'm trying to pass a listbox object into a procedure, get part of the name of that listbox, and then set a textbox object to a specific textbox using the partial name of the listbox. In Access it's easy: Public Sub XXX(lst As ListBox) Dim txt As TextBox Dim stg as String stg = "txt" & Mid(lst.Name, 4) Set txt = Me.Controls(stg) End Sub Part of the answer is: stg = "txt" & lst.Name.Substring(0, 4) But I don't know how to actually 'set' the textbox variable to a specific textbox. Thanks! From michael at ddisolutions.com.au Fri Jul 29 21:05:50 2011 From: michael at ddisolutions.com.au (Michael Maddison) Date: Sat, 30 Jul 2011 12:05:50 +1000 Subject: [dba-VB] Setting a Textbox Variable References: <002b01cc4e16$56dc31a0$049494e0$@comcast.net> Message-ID: <99266C61B516644D9727F983FAFAB46508667C@remote.ddisolutions.com.au> Hi Don, Your code seems to work as is. Are you sure you have a textbox with that name? Cheers Michael M -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Dan Waters Sent: Saturday, 30 July 2011 3:39 AM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: [dba-VB] Setting a Textbox Variable In VB.Net, I'm trying to pass a listbox object into a procedure, get part of the name of that listbox, and then set a textbox object to a specific textbox using the partial name of the listbox. In Access it's easy: Public Sub XXX(lst As ListBox) Dim txt As TextBox Dim stg as String stg = "txt" & Mid(lst.Name, 4) Set txt = Me.Controls(stg) End Sub Part of the answer is: stg = "txt" & lst.Name.Substring(0, 4) But I don't know how to actually 'set' the textbox variable to a specific textbox. Thanks! _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com ----- No virus found in this message. Checked by AVG - www.avg.com Version: 10.0.1390 / Virus Database: 1518/3797 - Release Date: 07/29/11 From shamil at smsconsulting.spb.ru Sat Jul 30 05:24:47 2011 From: shamil at smsconsulting.spb.ru (Shamil Salakhetdinov) Date: Sat, 30 Jul 2011 14:24:47 +0400 Subject: [dba-VB] Setting a Textbox Variable In-Reply-To: <99266C61B516644D9727F983FAFAB46508667C@remote.ddisolutions.com.au> References: <002b01cc4e16$56dc31a0$049494e0$@comcast.net> <99266C61B516644D9727F983FAFAB46508667C@remote.ddisolutions.com.au> Message-ID: Yes, Don, your code should work as is - there are several other options (VS2010): Dim txt As TextBox txt = Me.Controls("TextBox1") or txt = Me.Controls.Item("TextBox1") or txt = CType(Me.Controls.Find("TextBox1", False)(0), TextBox) ... Thank you. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Michael Maddison Sent: 30 ???? 2011 ?. 6:06 To: df.waters at comcast.net; Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] Setting a Textbox Variable Hi Don, Your code seems to work as is. Are you sure you have a textbox with that name? Cheers Michael M -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Dan Waters Sent: Saturday, 30 July 2011 3:39 AM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: [dba-VB] Setting a Textbox Variable In VB.Net, I'm trying to pass a listbox object into a procedure, get part of the name of that listbox, and then set a textbox object to a specific textbox using the partial name of the listbox. In Access it's easy: Public Sub XXX(lst As ListBox) Dim txt As TextBox Dim stg as String stg = "txt" & Mid(lst.Name, 4) Set txt = Me.Controls(stg) End Sub Part of the answer is: stg = "txt" & lst.Name.Substring(0, 4) But I don't know how to actually 'set' the textbox variable to a specific textbox. Thanks! _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com ----- No virus found in this message. Checked by AVG - www.avg.com Version: 10.0.1390 / Virus Database: 1518/3797 - Release Date: 07/29/11 _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Sat Jul 2 12:29:27 2011 From: jwcolby at colbyconsulting.com (jwcolby) Date: Sat, 02 Jul 2011 13:29:27 -0400 Subject: [dba-VB] SQL Server - SSD / Rotating media - Side by side test results Message-ID: <4E0F5577.9060206@colbyconsulting.com> This morning I set out to do a little bit of real world testing to see what my SSD investment buys me. The following are some results. BTW if a SQL Server guru wants to actually gain remote access and run tests on my system I would welcome that. I am obviously not very talented as a SQL Server DBA and so a real DBA who has an interest is welcomed to tune and test. Anyway, I have a pair of databases that I will be testing with. One is my infamous "database from hell" called HSID, containing 51 million records with about 600 fields. The other is my HSIDAllAdults containing about 65 million Name and address fields. HSIDAllAdults is child to HSID, IOW it has a foreign key which contains the PK of HSID. Both databases have a clustered index on their autonumber PK. So... I have both of these databases on a four SSD RAID 0. I backed them up last night and restored them to the same name + _Rotatingmedia on my RAID6 volumes. So I have identical databases on a 4 SSD Raid 0 and a 6 disk RAID 6. I am now doing some comparative A/B runs of rather standard queries - similar to things I do routinely. I backed up the two databases last night just before upgrading the server. I restored both tha HSID and HSIDAllAdults this AM to the same rotating media location I normally hold the databases. I did not defrag the rotating media before doing the restore. I include the counts so that we can be assured that the actual data is identical between the SSD and rotating media DBs. HSIDAllAdults - has a pair of cover indexes each of which includes Address valid DBCC DROPCLEANBUFFERS SELECT AddrValid, COUNT(PK) AS Cnt FROM dbo.tblAllAdultNameAddr GROUP BY AddrValid SSD: 12 seconds ANK 635917 E 2918652 INV 936058 MOV 112093 PO 3780131 V 59074768 Rotating: 52 seconds ANK 635917 E 2918652 INV 936058 MOV 112093 PO 3780131 V 59074768 DBCC DROPCLEANBUFFERS SELECT COUNT(_DataHSID.dbo.tblHSID.PKID) AS Cnt, dbo.tblAllAdultNameAddr.AddrValid FROM dbo.tblAllAdultNameAddr INNER JOIN _DataHSID.dbo.tblHSID ON dbo.tblAllAdultNameAddr.PKHSID = _DataHSID.dbo.tblHSID.PKID GROUP BY dbo.tblAllAdultNameAddr.AddrValid SSD: 35 seconds 635917 ANK 2918652 E 936058 INV 112093 MOV 3780131 PO 59074768 V DBCC DROPCLEANBUFFERS SELECT COUNT(_DataHSID_RotatingMedia.dbo.tblHSID.PKID) AS Cnt, dbo.tblAllAdultNameAddr.AddrValid FROM _DataHSID_RotatingMedia.dbo.tblHSID INNER JOIN dbo.tblAllAdultNameAddr ON _DataHSID_RotatingMedia.dbo.tblHSID.PKID = dbo.tblAllAdultNameAddr.PKHSID GROUP BY dbo.tblAllAdultNameAddr.AddrValid Rotating: 1:00 635917 ANK 2918652 E 936058 INV 112093 MOV 3780131 PO 59074768 V The following appears to be a table scan which would be a "worst case". I just picked a field from HSID which we use occasionally. DBCC DROPCLEANBUFFERS SELECT COUNT(PKID) AS Cnt, Household_Occupation_code FROM dbo.tblHSID GROUP BY Household_Occupation_code Rotating: 7:06 35481479 NULL 7143021 10 11480 11 9780 12 37452 13 115093 20 2266292 21 501715 22 23724 23 1039660 30 1325728 40 1183311 50 8271 51 70318 52 2566 60 33157 61 28595 62 15305 70 511464 80 739340 90 609317 91 Rotating media: 1:05 35481479 NULL 7143021 10 11480 11 9780 12 37452 13 115093 20 2266292 21 501715 22 23724 23 1039660 30 1325728 40 1183311 50 8271 51 70318 52 2566 60 33157 61 28595 62 15305 70 511464 80 739340 90 609317 91 DBCC DROPCLEANBUFFERS SELECT COUNT(PKID) AS Cnt, Narrow_Income_Band FROM dbo.tblHSID GROUP BY Narrow_Income_Band SSD: 8 seconds 13824508 NULL 3762511 1 1675853 2 1015899 3 2307736 4 1031640 5 2595759 6 1069374 7 2662509 8 1100049 9 1055216 A 1026910 B 4285629 C 941494 D 862906 E 831573 F 2443917 G 738328 H 676959 I 478582 J 423856 K 1168819 L 371413 M 333796 N 249064 O 204771 P 708189 Q 193265 R 189413 S 2927130 T Rotating media: 10 seconds 13824508 NULL 3762511 1 1675853 2 1015899 3 2307736 4 1031640 5 2595759 6 1069374 7 2662509 8 1100049 9 1055216 A 1026910 B 4285629 C 941494 D 862906 E 831573 F 2443917 G 738328 H 676959 I 478582 J 423856 K 1168819 L 371413 M 333796 N 249064 O 204771 P 708189 Q 193265 R 189413 S 2927130 T I am going to stop for now. I have the rotating media copies and will leave them in place for awhile. If any real DBA wants to do some testing let me know. Obviously I have to know you. :) -- John W. Colby www.ColbyConsulting.com From jwcolby at colbyconsulting.com Sat Jul 2 13:36:42 2011 From: jwcolby at colbyconsulting.com (jwcolby) Date: Sat, 02 Jul 2011 14:36:42 -0400 Subject: [dba-VB] [dba-SQLServer] SQL Server - SSD / Rotating media - Side by side test results In-Reply-To: References: <4E0F5577.9060206@colbyconsulting.com> Message-ID: <4E0F653A.7070503@colbyconsulting.com> Arthur, There are definite cases where the gains are minimal, others where they are significant. The other thing is that I am intentionally clearing the cache before each test. The cache further minimizes the differences as it turns out. That is to be expected of course. This just goes to show the old axiom that throwing memory at SQL Server does a world of good. Without a shadow of a doubt, one thing that SSDs (and faster / better hardware in general) do is minimize the impact of ignorance and sloth. ;) I am not an accomplished DBA, and I simply do not have the time to become one. As a result I am unable to correctly tune my system. By throwing cores, memory and SSDs at the problem I manage to achieve respectable results in spite of myself. Hardware is cheap. My entire server cost somewhere in the neighborhood of $5K. Additionally I have dragged disk and RAID controllers forward through many upgrades. Back around 2005 I spent the then enormous sum of $1600 for three Areca raid controllers which I am still using today. I bought 10 1 TB drives back when they were $150, but I am still using them today. What I upgrade are the motherboards and more frequently the processors. In 2004 I started with single core AMD 3800 processors using Windows2003 X32 and 4 gigs of RAM. I built two systems for $4000! Moving up to dual and then quad cores, and Windows / SQL Server X64 and 8 GB RAM, then 16 gigs of ram. My latest motherboard / processor cost me (my client of course) about $700 (8 cores, with 24 cores possible) and 32 gigs of ram was about $1000. I was looking last night and another 32 GB of RAM (same modules) is now only $600! And... I am using my entire old server (quad core / 16 gigs ram) for a VM server. The point really is that while it is not a trivial amount spent over the years making these upgrades, over that same period I billed a couple of hundred thousand dollars. All these upgrades make me more and more productive, faster and faster getting the results back to the client. The client *loves me* precisely because he gets results back in hours instead of a week as his previous provider gave him. I program custom C# solutions (and bill him for the programming) which have enabled me to do orders literally in hours which (back in 2006) took me a full day or even two to get out. Counts which took an hour in 2004 now take my custom program 2 minutes. *AND* I have developed a system which allows him to send emails with zip lists as attachments. A program running on my server strips off the CSV attachment, generate counts, build a count spreadsheet, attach it to an email and send it back to him literally within 5 minutes of him pressing send *without* my doing anything. Again those counts used to take me an hour back when I did everything by hand. Now I log that a count came in and put a small charge in my billing database! The lesson for me is that my time is worth much more than the cost of the electronics and my response time is what makes me valuable to the client. I fully understand than everyone cannot solve all their problems by throwing hardware / custom software at it, but for a sole proprietor it just might be the only way! I don't have the time to be good at all the hats I wear! And so I do things like spend a thousand on SSDs on an educated guess that they will make a significant difference for an uneducated sloth. :) And finally, because the client loves me, he is sending me a *ton* more work! MORE CORES! MORE MEMORY! More SSDs! :):):) John W. Colby www.ColbyConsulting.com On 7/2/2011 1:48 PM, Arthur Fuller wrote: > I would be happy to assist. Judging by your IMO rather narrow result-gap (measured in a few > seconds), my initial guess would be that the SSHDs are not gaining you much over your investment in > CPU and RAM. However, that remains to be determined. Could be that table-scans or some other factor > are causing this lag. Should be that SSHD retrieves ought to be an order of magnitude quicker, but > according to your posted measurements they lag significantly behind that thumbnail benchmark. > > And besides all that, how are you? What's new with you and your family? > > A. From jwcolby at colbyconsulting.com Sun Jul 3 11:56:54 2011 From: jwcolby at colbyconsulting.com (jwcolby) Date: Sun, 03 Jul 2011 12:56:54 -0400 Subject: [dba-VB] SSD, The Game Changer - SQL Man of Mystery - SQLServerCentral.com Message-ID: <4E109F56.809@colbyconsulting.com> -- John W. Colby www.ColbyConsulting.com http://www.sqlservercentral.com/blogs/sqlmanofmystery/archive/2009/04/14/ssd-the-game-changer.aspx From jwcolby at colbyconsulting.com Tue Jul 5 03:56:04 2011 From: jwcolby at colbyconsulting.com (jwcolby) Date: Tue, 05 Jul 2011 04:56:04 -0400 Subject: [dba-VB] Sourcegear vault free two developer license Message-ID: <4E12D1A4.1010809@colbyconsulting.com> I ran across this today. http://www.sqlservercentral.com/articles/Red+Gate+Software/74579/ http://promotions.sourcegear.com/vouchers/new/ -- John W. Colby www.ColbyConsulting.com From rls at WeBeDb.com Tue Jul 5 09:17:54 2011 From: rls at WeBeDb.com (Robert Stewart) Date: Tue, 05 Jul 2011 09:17:54 -0500 Subject: [dba-VB] Silverlight Image in Listbox In-Reply-To: References: Message-ID: <5A357FDC-7B9A-405A-9581-55AB3A4EA646@holly.arvixe.com> Question: I have a silverlight listbox control. It is bound to data in a database, not an object. I have the URL for an image stored in each of the records returned from the database. I need to display that in the list box. < Image x:Name="imgPhoto" Height="30" Width="30" Source="{Binding Path=PhotoURL}" /> does not work by itself. The URL stored in the database looks something like this: "/images/1_0.jpg" Does anybody know how to get the image to display? Robert L. Stewart www.WeBeDb.com www.DBGUIDesign.com www.RLStewartPhotography.com From R.Griffiths at bury.gov.uk Tue Jul 5 11:39:53 2011 From: R.Griffiths at bury.gov.uk (Griffiths, Richard) Date: Tue, 5 Jul 2011 17:39:53 +0100 Subject: [dba-VB] Silverlight Image in Listbox In-Reply-To: <5A357FDC-7B9A-405A-9581-55AB3A4EA646@holly.arvixe.com> References: <5A357FDC-7B9A-405A-9581-55AB3A4EA646@holly.arvixe.com> Message-ID: <201107051640.p65Gdx1H016343@databaseadvisors.com> Hi this is what I do... if (this.ImgCoverMedium.Length>0) this.imgCover = new System.Windows.Media.Imaging.BitmapImage(new Uri(this.ImgCoverMedium, UriKind.Absolute)); Where imgCover is type : System.Windows.Media.Imaging.BitmapImage and ImgCoverMedium is the (string) path the image. HTH Richard -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Robert Stewart Sent: 05 July 2011 15:18 To: dba-vb at databaseadvisors.com Subject: [dba-VB] Silverlight Image in Listbox Question: I have a silverlight listbox control. It is bound to data in a database, not an object. I have the URL for an image stored in each of the records returned from the database. I need to display that in the list box. < Image x:Name="imgPhoto" Height="30" Width="30" Source="{Binding Path=PhotoURL}" /> does not work by itself. The URL stored in the database looks something like this: "/images/1_0.jpg" Does anybody know how to get the image to display? Robert L. Stewart www.WeBeDb.com www.DBGUIDesign.com www.RLStewartPhotography.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com ----------------------------------------------------------------- Why not visit our website www.bury.gov.uk ----------------------------------------------------------------- Incoming and outgoing e-mail messages are routinely monitored for compliance with our information security policy. The information contained in this e-mail and any files transmitted with it is for the intended recipient(s) alone. It may contain confidential information that is exempt from the disclosure under English law and may also be covered by legal,professional or other privilege. If you are not the intended recipient, you must not copy, distribute or take any action in reliance on it. If you have received this e-mail in error, please notify us immediately by using the reply facility on your e-mail system. If this message is being transmitted over the Internet, be aware that it may be intercepted by third parties. As a public body, the Council may be required to disclose this e-mail or any response to it under the Freedom of Information Act 2000 unless the information in it is covered by one of the exemptions in the Act. Electronic service accepted only at legalservices at bury.gov.uk and on fax number 0161 253 5119 . ************************************************************* From jwcolby at colbyconsulting.com Wed Jul 6 06:46:07 2011 From: jwcolby at colbyconsulting.com (jwcolby) Date: Wed, 06 Jul 2011 07:46:07 -0400 Subject: [dba-VB] =?windows-1252?q?HASHBYTES_=96_A_T-SQL_Function_-_SQL_Mu?= =?windows-1252?q?sings_-_SQLServerCentral=2Ecom?= Message-ID: <4E144AFF.5010306@colbyconsulting.com> We were discussing hashes awhile back. -- John W. Colby www.ColbyConsulting.com http://www.sqlservercentral.com/blogs/steve_jones/archive/2011/6/28/hashbytes-_1320_-a-t_2D00_sql-function.aspx From df.waters at comcast.net Wed Jul 6 08:57:58 2011 From: df.waters at comcast.net (Dan Waters) Date: Wed, 6 Jul 2011 08:57:58 -0500 Subject: [dba-VB] More on SourceGear Message-ID: <002201cc3be4$b9dc5a30$2d950e90$@comcast.net> >From SourceGear's FAQ page: --------- Somebody said that Vault is FREE for a single user. Is this true? Yes. Vault is free for use by a single user. Simply install the product and do not enter any serial numbers at all. When no serial numbers are present, Vault behaves as if there is exactly one user license. Note that this free license does not apply when the product is used by more than one person. If you have two people who need to use Vault, you will need to purchase?two?initial licenses. If you enter a serial number containing only one license, then the product will?still?have exactly one license present. --------- The promotional pair of licenses does not include maintenance updates, but I'll guess that a single user license can be updated. Also, I wanted the Standard version instead of the Pro version. Dan From fhtapia at gmail.com Fri Jul 8 16:23:44 2011 From: fhtapia at gmail.com (Francisco Tapia) Date: Fri, 8 Jul 2011 14:23:44 -0700 Subject: [dba-VB] OO Programming Message-ID: Hey gang, This thread I wanted to start to help cover some best practices when it comes to programming, since we don't have a C# group I figured vb.net is close enough :). I was wondering how to approach my current scenario. I'm building a really rather simple windows service. It monitors a folder share on the network and whenever a new file is created it takes a look at it and streams the contents to read for particular pieces of data. Once the target data is obtained, the stream is closed and the data is then inserted into a Sql Server database. simple. I'm thinking that the threaded process should have some events it advertises that the gui can hook into right? the other way to get this to work would be to just eliminate the gui updating from the tread and have it read right off the log.txt file streamed in? what are your thoughts? -Francisco http://bit.ly/sqlthis | Tsql and More... From stuart at lexacorp.com.pg Fri Jul 8 17:36:03 2011 From: stuart at lexacorp.com.pg (Stuart McLachlan) Date: Sat, 09 Jul 2011 08:36:03 +1000 Subject: [dba-VB] OO Programming In-Reply-To: References: Message-ID: <4E178653.23831.499CCE7@stuart.lexacorp.com.pg> Best prectice is for a service to not interact with the desktop in any way. Your service and your GUI should be separate applications. The GUI and service should communicate with each other through some form of Inter Process Communication (IPC). If the server and GUI will always run on the same workstation a good choice would be file mapping using named shared memory, (See http://msdn.microsoft.com/en-us/library/aa366556%28v=VS.85%29.aspx ) The server can then use SendNotifyMessage() with HWND_BROADCAST to tell any active GUI to check for updated data in the mapped file. -- Stuart On 8 Jul 2011 at 14:23, Francisco Tapia wrote: > Hey gang, > This thread I wanted to start to help cover some best practices when > it > comes to programming, since we don't have a C# group I figured vb.net > is close enough :). I was wondering how to approach my current > scenario. > > I'm building a really rather simple windows service. It monitors a > folder share on the network and whenever a new file is created it > takes a look at it and streams the contents to read for particular > pieces of data. Once the target data is obtained, the stream is > closed and the data is then inserted into a Sql Server database. > > simple. > > I'm thinking that the threaded process should have some events it > advertises that the gui can hook into right? the other way to get > this to work would be to just eliminate the gui updating from the > tread and have it read right off the log.txt file streamed in? what > are your thoughts? From michael at ddisolutions.com.au Fri Jul 8 20:32:59 2011 From: michael at ddisolutions.com.au (Michael Maddison) Date: Sat, 9 Jul 2011 11:32:59 +1000 Subject: [dba-VB] OO Programming References: <4E178653.23831.499CCE7@stuart.lexacorp.com.pg> Message-ID: <99266C61B516644D9727F983FAFAB465086569@remote.ddisolutions.com.au> Hi, I agree the service should have no UI component. Use a config file to set paremeters. It seems to be a filewatcher --> parser --> database updater service. Another option for notifying the user UI application is SQLDependency. http://msdn.microsoft.com/en-us/library/a52dhwx7%28v=vs.80%29.aspx I'm using this approach for the app I'm currently building (does not use a service, though I did consider that.). A bit quirky to set up but so far so good! Using this approach means that the service is completely separated from any client UI apps. The UI's are notified by the SQL database when the data changes or is inserted. No polling required either. Cheers Michael M Best prectice is for a service to not interact with the desktop in any way. Your service and your GUI should be separate applications. The GUI and service should communicate with each other through some form of Inter Process Communication (IPC). If the server and GUI will always run on the same workstation a good choice would be file mapping using named shared memory, (See http://msdn.microsoft.com/en-us/library/aa366556%28v=VS.85%29.aspx ) The server can then use SendNotifyMessage() with HWND_BROADCAST to tell any active GUI to check for updated data in the mapped file. -- Stuart On 8 Jul 2011 at 14:23, Francisco Tapia wrote: > Hey gang, > This thread I wanted to start to help cover some best practices when > it > comes to programming, since we don't have a C# group I figured vb.net > is close enough :). I was wondering how to approach my current > scenario. > > I'm building a really rather simple windows service. It monitors a > folder share on the network and whenever a new file is created it > takes a look at it and streams the contents to read for particular > pieces of data. Once the target data is obtained, the stream is > closed and the data is then inserted into a Sql Server database. > > simple. > > I'm thinking that the threaded process should have some events it > advertises that the gui can hook into right? the other way to get > this to work would be to just eliminate the gui updating from the > tread and have it read right off the log.txt file streamed in? what > are your thoughts? _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com ----- No virus found in this message. Checked by AVG - www.avg.com Version: 10.0.1388 / Virus Database: 1516/3751 - Release Date: 07/08/11 From fhtapia at gmail.com Mon Jul 11 09:27:03 2011 From: fhtapia at gmail.com (Francisco Tapia) Date: Mon, 11 Jul 2011 07:27:03 -0700 Subject: [dba-VB] OO Programming In-Reply-To: <4E178653.23831.499CCE7@stuart.lexacorp.com.pg> References: <4E178653.23831.499CCE7@stuart.lexacorp.com.pg> Message-ID: thanks for this advise. I am going to do some reading and see if I can implement some of this, this afternoon. -Francisco http://bit.ly/sqlthis | Tsql and More... On Fri, Jul 8, 2011 at 3:36 PM, Stuart McLachlan wrote: > Best prectice is for a service to not interact with the desktop in any way. > Your service and > your GUI should be separate applications. > > The GUI and service should communicate with each other through some form of > Inter > Process Communication (IPC). If the server and GUI will always run on > the same > workstation a good choice would be file mapping using named shared memory, > (See http://msdn.microsoft.com/en-us/library/aa366556%28v=VS.85%29.aspx ) > The server can then use SendNotifyMessage() with HWND_BROADCAST to tell > any active > GUI to check for updated data in the mapped file. > > -- > Stuart > > On 8 Jul 2011 at 14:23, Francisco Tapia wrote: > > > Hey gang, > > This thread I wanted to start to help cover some best practices when > > it > > comes to programming, since we don't have a C# group I figured vb.net > > is close enough :). I was wondering how to approach my current > > scenario. > > > > I'm building a really rather simple windows service. It monitors a > > folder share on the network and whenever a new file is created it > > takes a look at it and streams the contents to read for particular > > pieces of data. Once the target data is obtained, the stream is > > closed and the data is then inserted into a Sql Server database. > > > > simple. > > > > I'm thinking that the threaded process should have some events it > > advertises that the gui can hook into right? the other way to get > > this to work would be to just eliminate the gui updating from the > > tread and have it read right off the log.txt file streamed in? what > > are your thoughts? > > > _______________________________________________ > dba-VB mailing list > dba-VB at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-vb > http://www.databaseadvisors.com > > From fhtapia at gmail.com Mon Jul 11 09:32:13 2011 From: fhtapia at gmail.com (Francisco Tapia) Date: Mon, 11 Jul 2011 07:32:13 -0700 Subject: [dba-VB] OO Programming In-Reply-To: <99266C61B516644D9727F983FAFAB465086569@remote.ddisolutions.com.au> References: <4E178653.23831.499CCE7@stuart.lexacorp.com.pg> <99266C61B516644D9727F983FAFAB465086569@remote.ddisolutions.com.au> Message-ID: this is also a great lead! Thanks Michael! -Francisco http://bit.ly/sqlthis | Tsql and More... On Fri, Jul 8, 2011 at 6:32 PM, Michael Maddison < michael at ddisolutions.com.au> wrote: > Hi, > > I agree the service should have no UI component. Use a config file to > set paremeters. > > It seems to be a filewatcher --> parser --> database updater service. > Another option for notifying the user UI application is SQLDependency. > http://msdn.microsoft.com/en-us/library/a52dhwx7%28v=vs.80%29.aspx > I'm using this approach for the app I'm currently building (does not use > a service, though I did consider that.). > > A bit quirky to set up but so far so good! > Using this approach means that the service is completely separated from > any client UI apps. The UI's are notified by the SQL database when the > data changes or is inserted. > No polling required either. > > Cheers > > Michael M > > Best prectice is for a service to not interact with the desktop in any > way. Your service and your GUI should be separate applications. > > The GUI and service should communicate with each other through some form > of Inter > Process Communication (IPC). If the server and GUI will always run on > the same > workstation a good choice would be file mapping using named shared > memory, (See > http://msdn.microsoft.com/en-us/library/aa366556%28v=VS.85%29.aspx ) The > server can then use SendNotifyMessage() with HWND_BROADCAST to tell > any active GUI to check for updated data in the mapped file. > > -- > Stuart > > On 8 Jul 2011 at 14:23, Francisco Tapia wrote: > > > Hey gang, > > This thread I wanted to start to help cover some best practices when > > it > > comes to programming, since we don't have a C# group I figured vb.net > > is close enough :). I was wondering how to approach my current > > scenario. > > > > I'm building a really rather simple windows service. It monitors a > > folder share on the network and whenever a new file is created it > > takes a look at it and streams the contents to read for particular > > pieces of data. Once the target data is obtained, the stream is > > closed and the data is then inserted into a Sql Server database. > > > > simple. > > > > I'm thinking that the threaded process should have some events it > > advertises that the gui can hook into right? the other way to get > > this to work would be to just eliminate the gui updating from the > > tread and have it read right off the log.txt file streamed in? what > > are your thoughts? > > > _______________________________________________ > dba-VB mailing list > dba-VB at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-vb > http://www.databaseadvisors.com > > > ----- > No virus found in this message. > Checked by AVG - www.avg.com > Version: 10.0.1388 / Virus Database: 1516/3751 - Release Date: 07/08/11 > > _______________________________________________ > dba-VB mailing list > dba-VB at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-vb > http://www.databaseadvisors.com > > From gustav at cactus.dk Tue Jul 19 16:07:39 2011 From: gustav at cactus.dk (Gustav Brock) Date: Tue, 19 Jul 2011 23:07:39 +0200 Subject: [dba-VB] DatePart "WW" (C#: Extension of DateTime) Message-ID: Hi all Now, would you believe this _old_ bug has survived A2010 and .Net 4 / Visual Studio 2010! So - as someone brought up a long-winded solution - I had to post my version of the extension method for DateTime of C# at CodeProject: http://www.codeproject.com/Tips/227801/DateTime-extension-method-to-give-Week-number /gustav >>> Gustav at cactus.dk 24-05-2007 16:44 >>> Hi Mark If you are looking for ISO week numbers, use these constants: bytWeek = DatePart("ww", datDate, vbMonday, vbFirstFourDays) However, DatePart has always - since Access 1.0 - been buggy for week number 53. Thus, for serious business use, use a function like this which I have posted many times: Public Function ISO_WeekNumber( _ ByVal datDate As Date) _ As Byte ' Calculates and returns week number for date datDate according to the ISO 8601:1988 standard. ' 1998-2000, Gustav Brock, Cactus Data ApS, CPH. ' May be freely used and distributed. Const cbytFirstWeekOfAnyYear As Byte = 1 Const cbytLastWeekOfLeapYear As Byte = 53 Dim bytWeek As Byte Dim bytISOThursday As Byte Dim datLastDayOfYear As Date bytWeek = DatePart("ww", datDate, vbMonday, vbFirstFourDays) If bytWeek = cbytLastWeekOfLeapYear Then bytISOThursday = WeekDay(vbThursday, vbMonday) datLastDayOfYear = DateSerial(Year(datDate), 12, 31) If WeekDay(datLastDayOfYear, vbMonday) >= bytISOThursday Then ' OK, week count of 53 is caused by leap year. Else ' Correct for Access97/2000 bug. bytWeek = cbytFirstWeekOfAnyYear End If End If ISO_WeekNumber = bytWeek End Function /gustav >>> markamatte at hotmail.com 24-05-2007 16:14 >>> Hello All, I'm using datepart to get the week. 12/31/2006 I am having an issue...No matter what optional constant I use or change...I get Day1 of week 53... and 1/1/2007 shows as Day2 of week 1. How do I get Day1 of Week1? Thanks, Mark A. Matte From df.waters at comcast.net Wed Jul 20 19:13:56 2011 From: df.waters at comcast.net (Dan Waters) Date: Wed, 20 Jul 2011 19:13:56 -0500 Subject: [dba-VB] Problem with LinqToSQL, a listbox, a textbox, and SubmitChanges Message-ID: <006a01cc473b$167e99e0$437bcda0$@comcast.net> In a simple test form, I have a listbox and a textbox. The form is bound to a datacontext, which has a single table. The listbox has two items, and is not bound. The textbox is bound to the datacontext. When I select an item from the listbox, the following code runs: txtTest.Text = lstTest.SelectedItems(0).ToString Then when I push my Save button, the following code runs: Me.TextDC.SubmitChanges() But - the database field which the textbox is bound to is NOT updated. If I manually type in a value into the textbox and then push the Save button, the database field IS updated. I've been trying to solve this on and off for several days, and I finally made this very simple text form to confirm or deny what was happening. No errors occur. So, for some reason SubmitChanges() does not recognize that the textbox needs to be updated if it's .Text property has been updated from the listbox, but does recognize that it needs to be updated if I manually type in a value. What's the difference? Dan From michael at ddisolutions.com.au Wed Jul 20 19:52:16 2011 From: michael at ddisolutions.com.au (Michael Maddison) Date: Thu, 21 Jul 2011 10:52:16 +1000 Subject: [dba-VB] Problem with LinqToSQL, a listbox, a textbox, and SubmitChanges References: <006a01cc473b$167e99e0$437bcda0$@comcast.net> Message-ID: <99266C61B516644D9727F983FAFAB465086626@remote.ddisolutions.com.au> I havn't confirmed this but the same would happen when binding with ADO objects as well. I assume it's a part of the binding process. IIRC you need to update the underlying entity and it will update the text property. I can't test now but I think that should work. Cheers Michael M -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Dan Waters Sent: Thursday, 21 July 2011 10:14 AM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: [dba-VB] Problem with LinqToSQL, a listbox, a textbox,and SubmitChanges In a simple test form, I have a listbox and a textbox. The form is bound to a datacontext, which has a single table. The listbox has two items, and is not bound. The textbox is bound to the datacontext. When I select an item from the listbox, the following code runs: txtTest.Text = lstTest.SelectedItems(0).ToString Then when I push my Save button, the following code runs: Me.TextDC.SubmitChanges() But - the database field which the textbox is bound to is NOT updated. If I manually type in a value into the textbox and then push the Save button, the database field IS updated. I've been trying to solve this on and off for several days, and I finally made this very simple text form to confirm or deny what was happening. No errors occur. So, for some reason SubmitChanges() does not recognize that the textbox needs to be updated if it's .Text property has been updated from the listbox, but does recognize that it needs to be updated if I manually type in a value. What's the difference? Dan _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com ----- No virus found in this message. Checked by AVG - www.avg.com Version: 10.0.1390 / Virus Database: 1518/3777 - Release Date: 07/20/11 From fhtapia at gmail.com Thu Jul 21 14:19:04 2011 From: fhtapia at gmail.com (Francisco Tapia) Date: Thu, 21 Jul 2011 12:19:04 -0700 Subject: [dba-VB] iOS and Sql Server Message-ID: Is anybody here working on mobile apps? Today I ran into this link from redgate for helping to get access to sql servers in your organization using iOS's mobile platform... http://mobilefoo.com/ProductDetail.aspx/iSql -Francisco http://bit.ly/sqlthis | Tsql and More... From df.waters at comcast.net Fri Jul 29 12:38:32 2011 From: df.waters at comcast.net (Dan Waters) Date: Fri, 29 Jul 2011 12:38:32 -0500 Subject: [dba-VB] Setting a Textbox Variable Message-ID: <002b01cc4e16$56dc31a0$049494e0$@comcast.net> In VB.Net, I'm trying to pass a listbox object into a procedure, get part of the name of that listbox, and then set a textbox object to a specific textbox using the partial name of the listbox. In Access it's easy: Public Sub XXX(lst As ListBox) Dim txt As TextBox Dim stg as String stg = "txt" & Mid(lst.Name, 4) Set txt = Me.Controls(stg) End Sub Part of the answer is: stg = "txt" & lst.Name.Substring(0, 4) But I don't know how to actually 'set' the textbox variable to a specific textbox. Thanks! From michael at ddisolutions.com.au Fri Jul 29 21:05:50 2011 From: michael at ddisolutions.com.au (Michael Maddison) Date: Sat, 30 Jul 2011 12:05:50 +1000 Subject: [dba-VB] Setting a Textbox Variable References: <002b01cc4e16$56dc31a0$049494e0$@comcast.net> Message-ID: <99266C61B516644D9727F983FAFAB46508667C@remote.ddisolutions.com.au> Hi Don, Your code seems to work as is. Are you sure you have a textbox with that name? Cheers Michael M -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Dan Waters Sent: Saturday, 30 July 2011 3:39 AM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: [dba-VB] Setting a Textbox Variable In VB.Net, I'm trying to pass a listbox object into a procedure, get part of the name of that listbox, and then set a textbox object to a specific textbox using the partial name of the listbox. In Access it's easy: Public Sub XXX(lst As ListBox) Dim txt As TextBox Dim stg as String stg = "txt" & Mid(lst.Name, 4) Set txt = Me.Controls(stg) End Sub Part of the answer is: stg = "txt" & lst.Name.Substring(0, 4) But I don't know how to actually 'set' the textbox variable to a specific textbox. Thanks! _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com ----- No virus found in this message. Checked by AVG - www.avg.com Version: 10.0.1390 / Virus Database: 1518/3797 - Release Date: 07/29/11 From shamil at smsconsulting.spb.ru Sat Jul 30 05:24:47 2011 From: shamil at smsconsulting.spb.ru (Shamil Salakhetdinov) Date: Sat, 30 Jul 2011 14:24:47 +0400 Subject: [dba-VB] Setting a Textbox Variable In-Reply-To: <99266C61B516644D9727F983FAFAB46508667C@remote.ddisolutions.com.au> References: <002b01cc4e16$56dc31a0$049494e0$@comcast.net> <99266C61B516644D9727F983FAFAB46508667C@remote.ddisolutions.com.au> Message-ID: Yes, Don, your code should work as is - there are several other options (VS2010): Dim txt As TextBox txt = Me.Controls("TextBox1") or txt = Me.Controls.Item("TextBox1") or txt = CType(Me.Controls.Find("TextBox1", False)(0), TextBox) ... Thank you. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Michael Maddison Sent: 30 ???? 2011 ?. 6:06 To: df.waters at comcast.net; Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] Setting a Textbox Variable Hi Don, Your code seems to work as is. Are you sure you have a textbox with that name? Cheers Michael M -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Dan Waters Sent: Saturday, 30 July 2011 3:39 AM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: [dba-VB] Setting a Textbox Variable In VB.Net, I'm trying to pass a listbox object into a procedure, get part of the name of that listbox, and then set a textbox object to a specific textbox using the partial name of the listbox. In Access it's easy: Public Sub XXX(lst As ListBox) Dim txt As TextBox Dim stg as String stg = "txt" & Mid(lst.Name, 4) Set txt = Me.Controls(stg) End Sub Part of the answer is: stg = "txt" & lst.Name.Substring(0, 4) But I don't know how to actually 'set' the textbox variable to a specific textbox. Thanks! _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com ----- No virus found in this message. Checked by AVG - www.avg.com Version: 10.0.1390 / Virus Database: 1518/3797 - Release Date: 07/29/11 _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Sat Jul 2 12:29:27 2011 From: jwcolby at colbyconsulting.com (jwcolby) Date: Sat, 02 Jul 2011 13:29:27 -0400 Subject: [dba-VB] SQL Server - SSD / Rotating media - Side by side test results Message-ID: <4E0F5577.9060206@colbyconsulting.com> This morning I set out to do a little bit of real world testing to see what my SSD investment buys me. The following are some results. BTW if a SQL Server guru wants to actually gain remote access and run tests on my system I would welcome that. I am obviously not very talented as a SQL Server DBA and so a real DBA who has an interest is welcomed to tune and test. Anyway, I have a pair of databases that I will be testing with. One is my infamous "database from hell" called HSID, containing 51 million records with about 600 fields. The other is my HSIDAllAdults containing about 65 million Name and address fields. HSIDAllAdults is child to HSID, IOW it has a foreign key which contains the PK of HSID. Both databases have a clustered index on their autonumber PK. So... I have both of these databases on a four SSD RAID 0. I backed them up last night and restored them to the same name + _Rotatingmedia on my RAID6 volumes. So I have identical databases on a 4 SSD Raid 0 and a 6 disk RAID 6. I am now doing some comparative A/B runs of rather standard queries - similar to things I do routinely. I backed up the two databases last night just before upgrading the server. I restored both tha HSID and HSIDAllAdults this AM to the same rotating media location I normally hold the databases. I did not defrag the rotating media before doing the restore. I include the counts so that we can be assured that the actual data is identical between the SSD and rotating media DBs. HSIDAllAdults - has a pair of cover indexes each of which includes Address valid DBCC DROPCLEANBUFFERS SELECT AddrValid, COUNT(PK) AS Cnt FROM dbo.tblAllAdultNameAddr GROUP BY AddrValid SSD: 12 seconds ANK 635917 E 2918652 INV 936058 MOV 112093 PO 3780131 V 59074768 Rotating: 52 seconds ANK 635917 E 2918652 INV 936058 MOV 112093 PO 3780131 V 59074768 DBCC DROPCLEANBUFFERS SELECT COUNT(_DataHSID.dbo.tblHSID.PKID) AS Cnt, dbo.tblAllAdultNameAddr.AddrValid FROM dbo.tblAllAdultNameAddr INNER JOIN _DataHSID.dbo.tblHSID ON dbo.tblAllAdultNameAddr.PKHSID = _DataHSID.dbo.tblHSID.PKID GROUP BY dbo.tblAllAdultNameAddr.AddrValid SSD: 35 seconds 635917 ANK 2918652 E 936058 INV 112093 MOV 3780131 PO 59074768 V DBCC DROPCLEANBUFFERS SELECT COUNT(_DataHSID_RotatingMedia.dbo.tblHSID.PKID) AS Cnt, dbo.tblAllAdultNameAddr.AddrValid FROM _DataHSID_RotatingMedia.dbo.tblHSID INNER JOIN dbo.tblAllAdultNameAddr ON _DataHSID_RotatingMedia.dbo.tblHSID.PKID = dbo.tblAllAdultNameAddr.PKHSID GROUP BY dbo.tblAllAdultNameAddr.AddrValid Rotating: 1:00 635917 ANK 2918652 E 936058 INV 112093 MOV 3780131 PO 59074768 V The following appears to be a table scan which would be a "worst case". I just picked a field from HSID which we use occasionally. DBCC DROPCLEANBUFFERS SELECT COUNT(PKID) AS Cnt, Household_Occupation_code FROM dbo.tblHSID GROUP BY Household_Occupation_code Rotating: 7:06 35481479 NULL 7143021 10 11480 11 9780 12 37452 13 115093 20 2266292 21 501715 22 23724 23 1039660 30 1325728 40 1183311 50 8271 51 70318 52 2566 60 33157 61 28595 62 15305 70 511464 80 739340 90 609317 91 Rotating media: 1:05 35481479 NULL 7143021 10 11480 11 9780 12 37452 13 115093 20 2266292 21 501715 22 23724 23 1039660 30 1325728 40 1183311 50 8271 51 70318 52 2566 60 33157 61 28595 62 15305 70 511464 80 739340 90 609317 91 DBCC DROPCLEANBUFFERS SELECT COUNT(PKID) AS Cnt, Narrow_Income_Band FROM dbo.tblHSID GROUP BY Narrow_Income_Band SSD: 8 seconds 13824508 NULL 3762511 1 1675853 2 1015899 3 2307736 4 1031640 5 2595759 6 1069374 7 2662509 8 1100049 9 1055216 A 1026910 B 4285629 C 941494 D 862906 E 831573 F 2443917 G 738328 H 676959 I 478582 J 423856 K 1168819 L 371413 M 333796 N 249064 O 204771 P 708189 Q 193265 R 189413 S 2927130 T Rotating media: 10 seconds 13824508 NULL 3762511 1 1675853 2 1015899 3 2307736 4 1031640 5 2595759 6 1069374 7 2662509 8 1100049 9 1055216 A 1026910 B 4285629 C 941494 D 862906 E 831573 F 2443917 G 738328 H 676959 I 478582 J 423856 K 1168819 L 371413 M 333796 N 249064 O 204771 P 708189 Q 193265 R 189413 S 2927130 T I am going to stop for now. I have the rotating media copies and will leave them in place for awhile. If any real DBA wants to do some testing let me know. Obviously I have to know you. :) -- John W. Colby www.ColbyConsulting.com From jwcolby at colbyconsulting.com Sat Jul 2 13:36:42 2011 From: jwcolby at colbyconsulting.com (jwcolby) Date: Sat, 02 Jul 2011 14:36:42 -0400 Subject: [dba-VB] [dba-SQLServer] SQL Server - SSD / Rotating media - Side by side test results In-Reply-To: References: <4E0F5577.9060206@colbyconsulting.com> Message-ID: <4E0F653A.7070503@colbyconsulting.com> Arthur, There are definite cases where the gains are minimal, others where they are significant. The other thing is that I am intentionally clearing the cache before each test. The cache further minimizes the differences as it turns out. That is to be expected of course. This just goes to show the old axiom that throwing memory at SQL Server does a world of good. Without a shadow of a doubt, one thing that SSDs (and faster / better hardware in general) do is minimize the impact of ignorance and sloth. ;) I am not an accomplished DBA, and I simply do not have the time to become one. As a result I am unable to correctly tune my system. By throwing cores, memory and SSDs at the problem I manage to achieve respectable results in spite of myself. Hardware is cheap. My entire server cost somewhere in the neighborhood of $5K. Additionally I have dragged disk and RAID controllers forward through many upgrades. Back around 2005 I spent the then enormous sum of $1600 for three Areca raid controllers which I am still using today. I bought 10 1 TB drives back when they were $150, but I am still using them today. What I upgrade are the motherboards and more frequently the processors. In 2004 I started with single core AMD 3800 processors using Windows2003 X32 and 4 gigs of RAM. I built two systems for $4000! Moving up to dual and then quad cores, and Windows / SQL Server X64 and 8 GB RAM, then 16 gigs of ram. My latest motherboard / processor cost me (my client of course) about $700 (8 cores, with 24 cores possible) and 32 gigs of ram was about $1000. I was looking last night and another 32 GB of RAM (same modules) is now only $600! And... I am using my entire old server (quad core / 16 gigs ram) for a VM server. The point really is that while it is not a trivial amount spent over the years making these upgrades, over that same period I billed a couple of hundred thousand dollars. All these upgrades make me more and more productive, faster and faster getting the results back to the client. The client *loves me* precisely because he gets results back in hours instead of a week as his previous provider gave him. I program custom C# solutions (and bill him for the programming) which have enabled me to do orders literally in hours which (back in 2006) took me a full day or even two to get out. Counts which took an hour in 2004 now take my custom program 2 minutes. *AND* I have developed a system which allows him to send emails with zip lists as attachments. A program running on my server strips off the CSV attachment, generate counts, build a count spreadsheet, attach it to an email and send it back to him literally within 5 minutes of him pressing send *without* my doing anything. Again those counts used to take me an hour back when I did everything by hand. Now I log that a count came in and put a small charge in my billing database! The lesson for me is that my time is worth much more than the cost of the electronics and my response time is what makes me valuable to the client. I fully understand than everyone cannot solve all their problems by throwing hardware / custom software at it, but for a sole proprietor it just might be the only way! I don't have the time to be good at all the hats I wear! And so I do things like spend a thousand on SSDs on an educated guess that they will make a significant difference for an uneducated sloth. :) And finally, because the client loves me, he is sending me a *ton* more work! MORE CORES! MORE MEMORY! More SSDs! :):):) John W. Colby www.ColbyConsulting.com On 7/2/2011 1:48 PM, Arthur Fuller wrote: > I would be happy to assist. Judging by your IMO rather narrow result-gap (measured in a few > seconds), my initial guess would be that the SSHDs are not gaining you much over your investment in > CPU and RAM. However, that remains to be determined. Could be that table-scans or some other factor > are causing this lag. Should be that SSHD retrieves ought to be an order of magnitude quicker, but > according to your posted measurements they lag significantly behind that thumbnail benchmark. > > And besides all that, how are you? What's new with you and your family? > > A. From jwcolby at colbyconsulting.com Sun Jul 3 11:56:54 2011 From: jwcolby at colbyconsulting.com (jwcolby) Date: Sun, 03 Jul 2011 12:56:54 -0400 Subject: [dba-VB] SSD, The Game Changer - SQL Man of Mystery - SQLServerCentral.com Message-ID: <4E109F56.809@colbyconsulting.com> -- John W. Colby www.ColbyConsulting.com http://www.sqlservercentral.com/blogs/sqlmanofmystery/archive/2009/04/14/ssd-the-game-changer.aspx From jwcolby at colbyconsulting.com Tue Jul 5 03:56:04 2011 From: jwcolby at colbyconsulting.com (jwcolby) Date: Tue, 05 Jul 2011 04:56:04 -0400 Subject: [dba-VB] Sourcegear vault free two developer license Message-ID: <4E12D1A4.1010809@colbyconsulting.com> I ran across this today. http://www.sqlservercentral.com/articles/Red+Gate+Software/74579/ http://promotions.sourcegear.com/vouchers/new/ -- John W. Colby www.ColbyConsulting.com From rls at WeBeDb.com Tue Jul 5 09:17:54 2011 From: rls at WeBeDb.com (Robert Stewart) Date: Tue, 05 Jul 2011 09:17:54 -0500 Subject: [dba-VB] Silverlight Image in Listbox In-Reply-To: References: Message-ID: <5A357FDC-7B9A-405A-9581-55AB3A4EA646@holly.arvixe.com> Question: I have a silverlight listbox control. It is bound to data in a database, not an object. I have the URL for an image stored in each of the records returned from the database. I need to display that in the list box. < Image x:Name="imgPhoto" Height="30" Width="30" Source="{Binding Path=PhotoURL}" /> does not work by itself. The URL stored in the database looks something like this: "/images/1_0.jpg" Does anybody know how to get the image to display? Robert L. Stewart www.WeBeDb.com www.DBGUIDesign.com www.RLStewartPhotography.com From R.Griffiths at bury.gov.uk Tue Jul 5 11:39:53 2011 From: R.Griffiths at bury.gov.uk (Griffiths, Richard) Date: Tue, 5 Jul 2011 17:39:53 +0100 Subject: [dba-VB] Silverlight Image in Listbox In-Reply-To: <5A357FDC-7B9A-405A-9581-55AB3A4EA646@holly.arvixe.com> References: <5A357FDC-7B9A-405A-9581-55AB3A4EA646@holly.arvixe.com> Message-ID: <201107051640.p65Gdx1H016343@databaseadvisors.com> Hi this is what I do... if (this.ImgCoverMedium.Length>0) this.imgCover = new System.Windows.Media.Imaging.BitmapImage(new Uri(this.ImgCoverMedium, UriKind.Absolute)); Where imgCover is type : System.Windows.Media.Imaging.BitmapImage and ImgCoverMedium is the (string) path the image. HTH Richard -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Robert Stewart Sent: 05 July 2011 15:18 To: dba-vb at databaseadvisors.com Subject: [dba-VB] Silverlight Image in Listbox Question: I have a silverlight listbox control. It is bound to data in a database, not an object. I have the URL for an image stored in each of the records returned from the database. I need to display that in the list box. < Image x:Name="imgPhoto" Height="30" Width="30" Source="{Binding Path=PhotoURL}" /> does not work by itself. The URL stored in the database looks something like this: "/images/1_0.jpg" Does anybody know how to get the image to display? Robert L. Stewart www.WeBeDb.com www.DBGUIDesign.com www.RLStewartPhotography.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com ----------------------------------------------------------------- Why not visit our website www.bury.gov.uk ----------------------------------------------------------------- Incoming and outgoing e-mail messages are routinely monitored for compliance with our information security policy. The information contained in this e-mail and any files transmitted with it is for the intended recipient(s) alone. It may contain confidential information that is exempt from the disclosure under English law and may also be covered by legal,professional or other privilege. If you are not the intended recipient, you must not copy, distribute or take any action in reliance on it. If you have received this e-mail in error, please notify us immediately by using the reply facility on your e-mail system. If this message is being transmitted over the Internet, be aware that it may be intercepted by third parties. As a public body, the Council may be required to disclose this e-mail or any response to it under the Freedom of Information Act 2000 unless the information in it is covered by one of the exemptions in the Act. Electronic service accepted only at legalservices at bury.gov.uk and on fax number 0161 253 5119 . ************************************************************* From jwcolby at colbyconsulting.com Wed Jul 6 06:46:07 2011 From: jwcolby at colbyconsulting.com (jwcolby) Date: Wed, 06 Jul 2011 07:46:07 -0400 Subject: [dba-VB] =?windows-1252?q?HASHBYTES_=96_A_T-SQL_Function_-_SQL_Mu?= =?windows-1252?q?sings_-_SQLServerCentral=2Ecom?= Message-ID: <4E144AFF.5010306@colbyconsulting.com> We were discussing hashes awhile back. -- John W. Colby www.ColbyConsulting.com http://www.sqlservercentral.com/blogs/steve_jones/archive/2011/6/28/hashbytes-_1320_-a-t_2D00_sql-function.aspx From df.waters at comcast.net Wed Jul 6 08:57:58 2011 From: df.waters at comcast.net (Dan Waters) Date: Wed, 6 Jul 2011 08:57:58 -0500 Subject: [dba-VB] More on SourceGear Message-ID: <002201cc3be4$b9dc5a30$2d950e90$@comcast.net> >From SourceGear's FAQ page: --------- Somebody said that Vault is FREE for a single user. Is this true? Yes. Vault is free for use by a single user. Simply install the product and do not enter any serial numbers at all. When no serial numbers are present, Vault behaves as if there is exactly one user license. Note that this free license does not apply when the product is used by more than one person. If you have two people who need to use Vault, you will need to purchase?two?initial licenses. If you enter a serial number containing only one license, then the product will?still?have exactly one license present. --------- The promotional pair of licenses does not include maintenance updates, but I'll guess that a single user license can be updated. Also, I wanted the Standard version instead of the Pro version. Dan From fhtapia at gmail.com Fri Jul 8 16:23:44 2011 From: fhtapia at gmail.com (Francisco Tapia) Date: Fri, 8 Jul 2011 14:23:44 -0700 Subject: [dba-VB] OO Programming Message-ID: Hey gang, This thread I wanted to start to help cover some best practices when it comes to programming, since we don't have a C# group I figured vb.net is close enough :). I was wondering how to approach my current scenario. I'm building a really rather simple windows service. It monitors a folder share on the network and whenever a new file is created it takes a look at it and streams the contents to read for particular pieces of data. Once the target data is obtained, the stream is closed and the data is then inserted into a Sql Server database. simple. I'm thinking that the threaded process should have some events it advertises that the gui can hook into right? the other way to get this to work would be to just eliminate the gui updating from the tread and have it read right off the log.txt file streamed in? what are your thoughts? -Francisco http://bit.ly/sqlthis | Tsql and More... From stuart at lexacorp.com.pg Fri Jul 8 17:36:03 2011 From: stuart at lexacorp.com.pg (Stuart McLachlan) Date: Sat, 09 Jul 2011 08:36:03 +1000 Subject: [dba-VB] OO Programming In-Reply-To: References: Message-ID: <4E178653.23831.499CCE7@stuart.lexacorp.com.pg> Best prectice is for a service to not interact with the desktop in any way. Your service and your GUI should be separate applications. The GUI and service should communicate with each other through some form of Inter Process Communication (IPC). If the server and GUI will always run on the same workstation a good choice would be file mapping using named shared memory, (See http://msdn.microsoft.com/en-us/library/aa366556%28v=VS.85%29.aspx ) The server can then use SendNotifyMessage() with HWND_BROADCAST to tell any active GUI to check for updated data in the mapped file. -- Stuart On 8 Jul 2011 at 14:23, Francisco Tapia wrote: > Hey gang, > This thread I wanted to start to help cover some best practices when > it > comes to programming, since we don't have a C# group I figured vb.net > is close enough :). I was wondering how to approach my current > scenario. > > I'm building a really rather simple windows service. It monitors a > folder share on the network and whenever a new file is created it > takes a look at it and streams the contents to read for particular > pieces of data. Once the target data is obtained, the stream is > closed and the data is then inserted into a Sql Server database. > > simple. > > I'm thinking that the threaded process should have some events it > advertises that the gui can hook into right? the other way to get > this to work would be to just eliminate the gui updating from the > tread and have it read right off the log.txt file streamed in? what > are your thoughts? From michael at ddisolutions.com.au Fri Jul 8 20:32:59 2011 From: michael at ddisolutions.com.au (Michael Maddison) Date: Sat, 9 Jul 2011 11:32:59 +1000 Subject: [dba-VB] OO Programming References: <4E178653.23831.499CCE7@stuart.lexacorp.com.pg> Message-ID: <99266C61B516644D9727F983FAFAB465086569@remote.ddisolutions.com.au> Hi, I agree the service should have no UI component. Use a config file to set paremeters. It seems to be a filewatcher --> parser --> database updater service. Another option for notifying the user UI application is SQLDependency. http://msdn.microsoft.com/en-us/library/a52dhwx7%28v=vs.80%29.aspx I'm using this approach for the app I'm currently building (does not use a service, though I did consider that.). A bit quirky to set up but so far so good! Using this approach means that the service is completely separated from any client UI apps. The UI's are notified by the SQL database when the data changes or is inserted. No polling required either. Cheers Michael M Best prectice is for a service to not interact with the desktop in any way. Your service and your GUI should be separate applications. The GUI and service should communicate with each other through some form of Inter Process Communication (IPC). If the server and GUI will always run on the same workstation a good choice would be file mapping using named shared memory, (See http://msdn.microsoft.com/en-us/library/aa366556%28v=VS.85%29.aspx ) The server can then use SendNotifyMessage() with HWND_BROADCAST to tell any active GUI to check for updated data in the mapped file. -- Stuart On 8 Jul 2011 at 14:23, Francisco Tapia wrote: > Hey gang, > This thread I wanted to start to help cover some best practices when > it > comes to programming, since we don't have a C# group I figured vb.net > is close enough :). I was wondering how to approach my current > scenario. > > I'm building a really rather simple windows service. It monitors a > folder share on the network and whenever a new file is created it > takes a look at it and streams the contents to read for particular > pieces of data. Once the target data is obtained, the stream is > closed and the data is then inserted into a Sql Server database. > > simple. > > I'm thinking that the threaded process should have some events it > advertises that the gui can hook into right? the other way to get > this to work would be to just eliminate the gui updating from the > tread and have it read right off the log.txt file streamed in? what > are your thoughts? _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com ----- No virus found in this message. Checked by AVG - www.avg.com Version: 10.0.1388 / Virus Database: 1516/3751 - Release Date: 07/08/11 From fhtapia at gmail.com Mon Jul 11 09:27:03 2011 From: fhtapia at gmail.com (Francisco Tapia) Date: Mon, 11 Jul 2011 07:27:03 -0700 Subject: [dba-VB] OO Programming In-Reply-To: <4E178653.23831.499CCE7@stuart.lexacorp.com.pg> References: <4E178653.23831.499CCE7@stuart.lexacorp.com.pg> Message-ID: thanks for this advise. I am going to do some reading and see if I can implement some of this, this afternoon. -Francisco http://bit.ly/sqlthis | Tsql and More... On Fri, Jul 8, 2011 at 3:36 PM, Stuart McLachlan wrote: > Best prectice is for a service to not interact with the desktop in any way. > Your service and > your GUI should be separate applications. > > The GUI and service should communicate with each other through some form of > Inter > Process Communication (IPC). If the server and GUI will always run on > the same > workstation a good choice would be file mapping using named shared memory, > (See http://msdn.microsoft.com/en-us/library/aa366556%28v=VS.85%29.aspx ) > The server can then use SendNotifyMessage() with HWND_BROADCAST to tell > any active > GUI to check for updated data in the mapped file. > > -- > Stuart > > On 8 Jul 2011 at 14:23, Francisco Tapia wrote: > > > Hey gang, > > This thread I wanted to start to help cover some best practices when > > it > > comes to programming, since we don't have a C# group I figured vb.net > > is close enough :). I was wondering how to approach my current > > scenario. > > > > I'm building a really rather simple windows service. It monitors a > > folder share on the network and whenever a new file is created it > > takes a look at it and streams the contents to read for particular > > pieces of data. Once the target data is obtained, the stream is > > closed and the data is then inserted into a Sql Server database. > > > > simple. > > > > I'm thinking that the threaded process should have some events it > > advertises that the gui can hook into right? the other way to get > > this to work would be to just eliminate the gui updating from the > > tread and have it read right off the log.txt file streamed in? what > > are your thoughts? > > > _______________________________________________ > dba-VB mailing list > dba-VB at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-vb > http://www.databaseadvisors.com > > From fhtapia at gmail.com Mon Jul 11 09:32:13 2011 From: fhtapia at gmail.com (Francisco Tapia) Date: Mon, 11 Jul 2011 07:32:13 -0700 Subject: [dba-VB] OO Programming In-Reply-To: <99266C61B516644D9727F983FAFAB465086569@remote.ddisolutions.com.au> References: <4E178653.23831.499CCE7@stuart.lexacorp.com.pg> <99266C61B516644D9727F983FAFAB465086569@remote.ddisolutions.com.au> Message-ID: this is also a great lead! Thanks Michael! -Francisco http://bit.ly/sqlthis | Tsql and More... On Fri, Jul 8, 2011 at 6:32 PM, Michael Maddison < michael at ddisolutions.com.au> wrote: > Hi, > > I agree the service should have no UI component. Use a config file to > set paremeters. > > It seems to be a filewatcher --> parser --> database updater service. > Another option for notifying the user UI application is SQLDependency. > http://msdn.microsoft.com/en-us/library/a52dhwx7%28v=vs.80%29.aspx > I'm using this approach for the app I'm currently building (does not use > a service, though I did consider that.). > > A bit quirky to set up but so far so good! > Using this approach means that the service is completely separated from > any client UI apps. The UI's are notified by the SQL database when the > data changes or is inserted. > No polling required either. > > Cheers > > Michael M > > Best prectice is for a service to not interact with the desktop in any > way. Your service and your GUI should be separate applications. > > The GUI and service should communicate with each other through some form > of Inter > Process Communication (IPC). If the server and GUI will always run on > the same > workstation a good choice would be file mapping using named shared > memory, (See > http://msdn.microsoft.com/en-us/library/aa366556%28v=VS.85%29.aspx ) The > server can then use SendNotifyMessage() with HWND_BROADCAST to tell > any active GUI to check for updated data in the mapped file. > > -- > Stuart > > On 8 Jul 2011 at 14:23, Francisco Tapia wrote: > > > Hey gang, > > This thread I wanted to start to help cover some best practices when > > it > > comes to programming, since we don't have a C# group I figured vb.net > > is close enough :). I was wondering how to approach my current > > scenario. > > > > I'm building a really rather simple windows service. It monitors a > > folder share on the network and whenever a new file is created it > > takes a look at it and streams the contents to read for particular > > pieces of data. Once the target data is obtained, the stream is > > closed and the data is then inserted into a Sql Server database. > > > > simple. > > > > I'm thinking that the threaded process should have some events it > > advertises that the gui can hook into right? the other way to get > > this to work would be to just eliminate the gui updating from the > > tread and have it read right off the log.txt file streamed in? what > > are your thoughts? > > > _______________________________________________ > dba-VB mailing list > dba-VB at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-vb > http://www.databaseadvisors.com > > > ----- > No virus found in this message. > Checked by AVG - www.avg.com > Version: 10.0.1388 / Virus Database: 1516/3751 - Release Date: 07/08/11 > > _______________________________________________ > dba-VB mailing list > dba-VB at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-vb > http://www.databaseadvisors.com > > From gustav at cactus.dk Tue Jul 19 16:07:39 2011 From: gustav at cactus.dk (Gustav Brock) Date: Tue, 19 Jul 2011 23:07:39 +0200 Subject: [dba-VB] DatePart "WW" (C#: Extension of DateTime) Message-ID: Hi all Now, would you believe this _old_ bug has survived A2010 and .Net 4 / Visual Studio 2010! So - as someone brought up a long-winded solution - I had to post my version of the extension method for DateTime of C# at CodeProject: http://www.codeproject.com/Tips/227801/DateTime-extension-method-to-give-Week-number /gustav >>> Gustav at cactus.dk 24-05-2007 16:44 >>> Hi Mark If you are looking for ISO week numbers, use these constants: bytWeek = DatePart("ww", datDate, vbMonday, vbFirstFourDays) However, DatePart has always - since Access 1.0 - been buggy for week number 53. Thus, for serious business use, use a function like this which I have posted many times: Public Function ISO_WeekNumber( _ ByVal datDate As Date) _ As Byte ' Calculates and returns week number for date datDate according to the ISO 8601:1988 standard. ' 1998-2000, Gustav Brock, Cactus Data ApS, CPH. ' May be freely used and distributed. Const cbytFirstWeekOfAnyYear As Byte = 1 Const cbytLastWeekOfLeapYear As Byte = 53 Dim bytWeek As Byte Dim bytISOThursday As Byte Dim datLastDayOfYear As Date bytWeek = DatePart("ww", datDate, vbMonday, vbFirstFourDays) If bytWeek = cbytLastWeekOfLeapYear Then bytISOThursday = WeekDay(vbThursday, vbMonday) datLastDayOfYear = DateSerial(Year(datDate), 12, 31) If WeekDay(datLastDayOfYear, vbMonday) >= bytISOThursday Then ' OK, week count of 53 is caused by leap year. Else ' Correct for Access97/2000 bug. bytWeek = cbytFirstWeekOfAnyYear End If End If ISO_WeekNumber = bytWeek End Function /gustav >>> markamatte at hotmail.com 24-05-2007 16:14 >>> Hello All, I'm using datepart to get the week. 12/31/2006 I am having an issue...No matter what optional constant I use or change...I get Day1 of week 53... and 1/1/2007 shows as Day2 of week 1. How do I get Day1 of Week1? Thanks, Mark A. Matte From df.waters at comcast.net Wed Jul 20 19:13:56 2011 From: df.waters at comcast.net (Dan Waters) Date: Wed, 20 Jul 2011 19:13:56 -0500 Subject: [dba-VB] Problem with LinqToSQL, a listbox, a textbox, and SubmitChanges Message-ID: <006a01cc473b$167e99e0$437bcda0$@comcast.net> In a simple test form, I have a listbox and a textbox. The form is bound to a datacontext, which has a single table. The listbox has two items, and is not bound. The textbox is bound to the datacontext. When I select an item from the listbox, the following code runs: txtTest.Text = lstTest.SelectedItems(0).ToString Then when I push my Save button, the following code runs: Me.TextDC.SubmitChanges() But - the database field which the textbox is bound to is NOT updated. If I manually type in a value into the textbox and then push the Save button, the database field IS updated. I've been trying to solve this on and off for several days, and I finally made this very simple text form to confirm or deny what was happening. No errors occur. So, for some reason SubmitChanges() does not recognize that the textbox needs to be updated if it's .Text property has been updated from the listbox, but does recognize that it needs to be updated if I manually type in a value. What's the difference? Dan From michael at ddisolutions.com.au Wed Jul 20 19:52:16 2011 From: michael at ddisolutions.com.au (Michael Maddison) Date: Thu, 21 Jul 2011 10:52:16 +1000 Subject: [dba-VB] Problem with LinqToSQL, a listbox, a textbox, and SubmitChanges References: <006a01cc473b$167e99e0$437bcda0$@comcast.net> Message-ID: <99266C61B516644D9727F983FAFAB465086626@remote.ddisolutions.com.au> I havn't confirmed this but the same would happen when binding with ADO objects as well. I assume it's a part of the binding process. IIRC you need to update the underlying entity and it will update the text property. I can't test now but I think that should work. Cheers Michael M -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Dan Waters Sent: Thursday, 21 July 2011 10:14 AM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: [dba-VB] Problem with LinqToSQL, a listbox, a textbox,and SubmitChanges In a simple test form, I have a listbox and a textbox. The form is bound to a datacontext, which has a single table. The listbox has two items, and is not bound. The textbox is bound to the datacontext. When I select an item from the listbox, the following code runs: txtTest.Text = lstTest.SelectedItems(0).ToString Then when I push my Save button, the following code runs: Me.TextDC.SubmitChanges() But - the database field which the textbox is bound to is NOT updated. If I manually type in a value into the textbox and then push the Save button, the database field IS updated. I've been trying to solve this on and off for several days, and I finally made this very simple text form to confirm or deny what was happening. No errors occur. So, for some reason SubmitChanges() does not recognize that the textbox needs to be updated if it's .Text property has been updated from the listbox, but does recognize that it needs to be updated if I manually type in a value. What's the difference? Dan _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com ----- No virus found in this message. Checked by AVG - www.avg.com Version: 10.0.1390 / Virus Database: 1518/3777 - Release Date: 07/20/11 From fhtapia at gmail.com Thu Jul 21 14:19:04 2011 From: fhtapia at gmail.com (Francisco Tapia) Date: Thu, 21 Jul 2011 12:19:04 -0700 Subject: [dba-VB] iOS and Sql Server Message-ID: Is anybody here working on mobile apps? Today I ran into this link from redgate for helping to get access to sql servers in your organization using iOS's mobile platform... http://mobilefoo.com/ProductDetail.aspx/iSql -Francisco http://bit.ly/sqlthis | Tsql and More... From df.waters at comcast.net Fri Jul 29 12:38:32 2011 From: df.waters at comcast.net (Dan Waters) Date: Fri, 29 Jul 2011 12:38:32 -0500 Subject: [dba-VB] Setting a Textbox Variable Message-ID: <002b01cc4e16$56dc31a0$049494e0$@comcast.net> In VB.Net, I'm trying to pass a listbox object into a procedure, get part of the name of that listbox, and then set a textbox object to a specific textbox using the partial name of the listbox. In Access it's easy: Public Sub XXX(lst As ListBox) Dim txt As TextBox Dim stg as String stg = "txt" & Mid(lst.Name, 4) Set txt = Me.Controls(stg) End Sub Part of the answer is: stg = "txt" & lst.Name.Substring(0, 4) But I don't know how to actually 'set' the textbox variable to a specific textbox. Thanks! From michael at ddisolutions.com.au Fri Jul 29 21:05:50 2011 From: michael at ddisolutions.com.au (Michael Maddison) Date: Sat, 30 Jul 2011 12:05:50 +1000 Subject: [dba-VB] Setting a Textbox Variable References: <002b01cc4e16$56dc31a0$049494e0$@comcast.net> Message-ID: <99266C61B516644D9727F983FAFAB46508667C@remote.ddisolutions.com.au> Hi Don, Your code seems to work as is. Are you sure you have a textbox with that name? Cheers Michael M -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Dan Waters Sent: Saturday, 30 July 2011 3:39 AM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: [dba-VB] Setting a Textbox Variable In VB.Net, I'm trying to pass a listbox object into a procedure, get part of the name of that listbox, and then set a textbox object to a specific textbox using the partial name of the listbox. In Access it's easy: Public Sub XXX(lst As ListBox) Dim txt As TextBox Dim stg as String stg = "txt" & Mid(lst.Name, 4) Set txt = Me.Controls(stg) End Sub Part of the answer is: stg = "txt" & lst.Name.Substring(0, 4) But I don't know how to actually 'set' the textbox variable to a specific textbox. Thanks! _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com ----- No virus found in this message. Checked by AVG - www.avg.com Version: 10.0.1390 / Virus Database: 1518/3797 - Release Date: 07/29/11 From shamil at smsconsulting.spb.ru Sat Jul 30 05:24:47 2011 From: shamil at smsconsulting.spb.ru (Shamil Salakhetdinov) Date: Sat, 30 Jul 2011 14:24:47 +0400 Subject: [dba-VB] Setting a Textbox Variable In-Reply-To: <99266C61B516644D9727F983FAFAB46508667C@remote.ddisolutions.com.au> References: <002b01cc4e16$56dc31a0$049494e0$@comcast.net> <99266C61B516644D9727F983FAFAB46508667C@remote.ddisolutions.com.au> Message-ID: Yes, Don, your code should work as is - there are several other options (VS2010): Dim txt As TextBox txt = Me.Controls("TextBox1") or txt = Me.Controls.Item("TextBox1") or txt = CType(Me.Controls.Find("TextBox1", False)(0), TextBox) ... Thank you. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Michael Maddison Sent: 30 ???? 2011 ?. 6:06 To: df.waters at comcast.net; Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] Setting a Textbox Variable Hi Don, Your code seems to work as is. Are you sure you have a textbox with that name? Cheers Michael M -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Dan Waters Sent: Saturday, 30 July 2011 3:39 AM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: [dba-VB] Setting a Textbox Variable In VB.Net, I'm trying to pass a listbox object into a procedure, get part of the name of that listbox, and then set a textbox object to a specific textbox using the partial name of the listbox. In Access it's easy: Public Sub XXX(lst As ListBox) Dim txt As TextBox Dim stg as String stg = "txt" & Mid(lst.Name, 4) Set txt = Me.Controls(stg) End Sub Part of the answer is: stg = "txt" & lst.Name.Substring(0, 4) But I don't know how to actually 'set' the textbox variable to a specific textbox. Thanks! _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com ----- No virus found in this message. Checked by AVG - www.avg.com Version: 10.0.1390 / Virus Database: 1518/3797 - Release Date: 07/29/11 _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Sat Jul 2 12:29:27 2011 From: jwcolby at colbyconsulting.com (jwcolby) Date: Sat, 02 Jul 2011 13:29:27 -0400 Subject: [dba-VB] SQL Server - SSD / Rotating media - Side by side test results Message-ID: <4E0F5577.9060206@colbyconsulting.com> This morning I set out to do a little bit of real world testing to see what my SSD investment buys me. The following are some results. BTW if a SQL Server guru wants to actually gain remote access and run tests on my system I would welcome that. I am obviously not very talented as a SQL Server DBA and so a real DBA who has an interest is welcomed to tune and test. Anyway, I have a pair of databases that I will be testing with. One is my infamous "database from hell" called HSID, containing 51 million records with about 600 fields. The other is my HSIDAllAdults containing about 65 million Name and address fields. HSIDAllAdults is child to HSID, IOW it has a foreign key which contains the PK of HSID. Both databases have a clustered index on their autonumber PK. So... I have both of these databases on a four SSD RAID 0. I backed them up last night and restored them to the same name + _Rotatingmedia on my RAID6 volumes. So I have identical databases on a 4 SSD Raid 0 and a 6 disk RAID 6. I am now doing some comparative A/B runs of rather standard queries - similar to things I do routinely. I backed up the two databases last night just before upgrading the server. I restored both tha HSID and HSIDAllAdults this AM to the same rotating media location I normally hold the databases. I did not defrag the rotating media before doing the restore. I include the counts so that we can be assured that the actual data is identical between the SSD and rotating media DBs. HSIDAllAdults - has a pair of cover indexes each of which includes Address valid DBCC DROPCLEANBUFFERS SELECT AddrValid, COUNT(PK) AS Cnt FROM dbo.tblAllAdultNameAddr GROUP BY AddrValid SSD: 12 seconds ANK 635917 E 2918652 INV 936058 MOV 112093 PO 3780131 V 59074768 Rotating: 52 seconds ANK 635917 E 2918652 INV 936058 MOV 112093 PO 3780131 V 59074768 DBCC DROPCLEANBUFFERS SELECT COUNT(_DataHSID.dbo.tblHSID.PKID) AS Cnt, dbo.tblAllAdultNameAddr.AddrValid FROM dbo.tblAllAdultNameAddr INNER JOIN _DataHSID.dbo.tblHSID ON dbo.tblAllAdultNameAddr.PKHSID = _DataHSID.dbo.tblHSID.PKID GROUP BY dbo.tblAllAdultNameAddr.AddrValid SSD: 35 seconds 635917 ANK 2918652 E 936058 INV 112093 MOV 3780131 PO 59074768 V DBCC DROPCLEANBUFFERS SELECT COUNT(_DataHSID_RotatingMedia.dbo.tblHSID.PKID) AS Cnt, dbo.tblAllAdultNameAddr.AddrValid FROM _DataHSID_RotatingMedia.dbo.tblHSID INNER JOIN dbo.tblAllAdultNameAddr ON _DataHSID_RotatingMedia.dbo.tblHSID.PKID = dbo.tblAllAdultNameAddr.PKHSID GROUP BY dbo.tblAllAdultNameAddr.AddrValid Rotating: 1:00 635917 ANK 2918652 E 936058 INV 112093 MOV 3780131 PO 59074768 V The following appears to be a table scan which would be a "worst case". I just picked a field from HSID which we use occasionally. DBCC DROPCLEANBUFFERS SELECT COUNT(PKID) AS Cnt, Household_Occupation_code FROM dbo.tblHSID GROUP BY Household_Occupation_code Rotating: 7:06 35481479 NULL 7143021 10 11480 11 9780 12 37452 13 115093 20 2266292 21 501715 22 23724 23 1039660 30 1325728 40 1183311 50 8271 51 70318 52 2566 60 33157 61 28595 62 15305 70 511464 80 739340 90 609317 91 Rotating media: 1:05 35481479 NULL 7143021 10 11480 11 9780 12 37452 13 115093 20 2266292 21 501715 22 23724 23 1039660 30 1325728 40 1183311 50 8271 51 70318 52 2566 60 33157 61 28595 62 15305 70 511464 80 739340 90 609317 91 DBCC DROPCLEANBUFFERS SELECT COUNT(PKID) AS Cnt, Narrow_Income_Band FROM dbo.tblHSID GROUP BY Narrow_Income_Band SSD: 8 seconds 13824508 NULL 3762511 1 1675853 2 1015899 3 2307736 4 1031640 5 2595759 6 1069374 7 2662509 8 1100049 9 1055216 A 1026910 B 4285629 C 941494 D 862906 E 831573 F 2443917 G 738328 H 676959 I 478582 J 423856 K 1168819 L 371413 M 333796 N 249064 O 204771 P 708189 Q 193265 R 189413 S 2927130 T Rotating media: 10 seconds 13824508 NULL 3762511 1 1675853 2 1015899 3 2307736 4 1031640 5 2595759 6 1069374 7 2662509 8 1100049 9 1055216 A 1026910 B 4285629 C 941494 D 862906 E 831573 F 2443917 G 738328 H 676959 I 478582 J 423856 K 1168819 L 371413 M 333796 N 249064 O 204771 P 708189 Q 193265 R 189413 S 2927130 T I am going to stop for now. I have the rotating media copies and will leave them in place for awhile. If any real DBA wants to do some testing let me know. Obviously I have to know you. :) -- John W. Colby www.ColbyConsulting.com From jwcolby at colbyconsulting.com Sat Jul 2 13:36:42 2011 From: jwcolby at colbyconsulting.com (jwcolby) Date: Sat, 02 Jul 2011 14:36:42 -0400 Subject: [dba-VB] [dba-SQLServer] SQL Server - SSD / Rotating media - Side by side test results In-Reply-To: References: <4E0F5577.9060206@colbyconsulting.com> Message-ID: <4E0F653A.7070503@colbyconsulting.com> Arthur, There are definite cases where the gains are minimal, others where they are significant. The other thing is that I am intentionally clearing the cache before each test. The cache further minimizes the differences as it turns out. That is to be expected of course. This just goes to show the old axiom that throwing memory at SQL Server does a world of good. Without a shadow of a doubt, one thing that SSDs (and faster / better hardware in general) do is minimize the impact of ignorance and sloth. ;) I am not an accomplished DBA, and I simply do not have the time to become one. As a result I am unable to correctly tune my system. By throwing cores, memory and SSDs at the problem I manage to achieve respectable results in spite of myself. Hardware is cheap. My entire server cost somewhere in the neighborhood of $5K. Additionally I have dragged disk and RAID controllers forward through many upgrades. Back around 2005 I spent the then enormous sum of $1600 for three Areca raid controllers which I am still using today. I bought 10 1 TB drives back when they were $150, but I am still using them today. What I upgrade are the motherboards and more frequently the processors. In 2004 I started with single core AMD 3800 processors using Windows2003 X32 and 4 gigs of RAM. I built two systems for $4000! Moving up to dual and then quad cores, and Windows / SQL Server X64 and 8 GB RAM, then 16 gigs of ram. My latest motherboard / processor cost me (my client of course) about $700 (8 cores, with 24 cores possible) and 32 gigs of ram was about $1000. I was looking last night and another 32 GB of RAM (same modules) is now only $600! And... I am using my entire old server (quad core / 16 gigs ram) for a VM server. The point really is that while it is not a trivial amount spent over the years making these upgrades, over that same period I billed a couple of hundred thousand dollars. All these upgrades make me more and more productive, faster and faster getting the results back to the client. The client *loves me* precisely because he gets results back in hours instead of a week as his previous provider gave him. I program custom C# solutions (and bill him for the programming) which have enabled me to do orders literally in hours which (back in 2006) took me a full day or even two to get out. Counts which took an hour in 2004 now take my custom program 2 minutes. *AND* I have developed a system which allows him to send emails with zip lists as attachments. A program running on my server strips off the CSV attachment, generate counts, build a count spreadsheet, attach it to an email and send it back to him literally within 5 minutes of him pressing send *without* my doing anything. Again those counts used to take me an hour back when I did everything by hand. Now I log that a count came in and put a small charge in my billing database! The lesson for me is that my time is worth much more than the cost of the electronics and my response time is what makes me valuable to the client. I fully understand than everyone cannot solve all their problems by throwing hardware / custom software at it, but for a sole proprietor it just might be the only way! I don't have the time to be good at all the hats I wear! And so I do things like spend a thousand on SSDs on an educated guess that they will make a significant difference for an uneducated sloth. :) And finally, because the client loves me, he is sending me a *ton* more work! MORE CORES! MORE MEMORY! More SSDs! :):):) John W. Colby www.ColbyConsulting.com On 7/2/2011 1:48 PM, Arthur Fuller wrote: > I would be happy to assist. Judging by your IMO rather narrow result-gap (measured in a few > seconds), my initial guess would be that the SSHDs are not gaining you much over your investment in > CPU and RAM. However, that remains to be determined. Could be that table-scans or some other factor > are causing this lag. Should be that SSHD retrieves ought to be an order of magnitude quicker, but > according to your posted measurements they lag significantly behind that thumbnail benchmark. > > And besides all that, how are you? What's new with you and your family? > > A. From jwcolby at colbyconsulting.com Sun Jul 3 11:56:54 2011 From: jwcolby at colbyconsulting.com (jwcolby) Date: Sun, 03 Jul 2011 12:56:54 -0400 Subject: [dba-VB] SSD, The Game Changer - SQL Man of Mystery - SQLServerCentral.com Message-ID: <4E109F56.809@colbyconsulting.com> -- John W. Colby www.ColbyConsulting.com http://www.sqlservercentral.com/blogs/sqlmanofmystery/archive/2009/04/14/ssd-the-game-changer.aspx From jwcolby at colbyconsulting.com Tue Jul 5 03:56:04 2011 From: jwcolby at colbyconsulting.com (jwcolby) Date: Tue, 05 Jul 2011 04:56:04 -0400 Subject: [dba-VB] Sourcegear vault free two developer license Message-ID: <4E12D1A4.1010809@colbyconsulting.com> I ran across this today. http://www.sqlservercentral.com/articles/Red+Gate+Software/74579/ http://promotions.sourcegear.com/vouchers/new/ -- John W. Colby www.ColbyConsulting.com From rls at WeBeDb.com Tue Jul 5 09:17:54 2011 From: rls at WeBeDb.com (Robert Stewart) Date: Tue, 05 Jul 2011 09:17:54 -0500 Subject: [dba-VB] Silverlight Image in Listbox In-Reply-To: References: Message-ID: <5A357FDC-7B9A-405A-9581-55AB3A4EA646@holly.arvixe.com> Question: I have a silverlight listbox control. It is bound to data in a database, not an object. I have the URL for an image stored in each of the records returned from the database. I need to display that in the list box. < Image x:Name="imgPhoto" Height="30" Width="30" Source="{Binding Path=PhotoURL}" /> does not work by itself. The URL stored in the database looks something like this: "/images/1_0.jpg" Does anybody know how to get the image to display? Robert L. Stewart www.WeBeDb.com www.DBGUIDesign.com www.RLStewartPhotography.com From R.Griffiths at bury.gov.uk Tue Jul 5 11:39:53 2011 From: R.Griffiths at bury.gov.uk (Griffiths, Richard) Date: Tue, 5 Jul 2011 17:39:53 +0100 Subject: [dba-VB] Silverlight Image in Listbox In-Reply-To: <5A357FDC-7B9A-405A-9581-55AB3A4EA646@holly.arvixe.com> References: <5A357FDC-7B9A-405A-9581-55AB3A4EA646@holly.arvixe.com> Message-ID: <201107051640.p65Gdx1H016343@databaseadvisors.com> Hi this is what I do... if (this.ImgCoverMedium.Length>0) this.imgCover = new System.Windows.Media.Imaging.BitmapImage(new Uri(this.ImgCoverMedium, UriKind.Absolute)); Where imgCover is type : System.Windows.Media.Imaging.BitmapImage and ImgCoverMedium is the (string) path the image. HTH Richard -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Robert Stewart Sent: 05 July 2011 15:18 To: dba-vb at databaseadvisors.com Subject: [dba-VB] Silverlight Image in Listbox Question: I have a silverlight listbox control. It is bound to data in a database, not an object. I have the URL for an image stored in each of the records returned from the database. I need to display that in the list box. < Image x:Name="imgPhoto" Height="30" Width="30" Source="{Binding Path=PhotoURL}" /> does not work by itself. The URL stored in the database looks something like this: "/images/1_0.jpg" Does anybody know how to get the image to display? Robert L. Stewart www.WeBeDb.com www.DBGUIDesign.com www.RLStewartPhotography.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com ----------------------------------------------------------------- Why not visit our website www.bury.gov.uk ----------------------------------------------------------------- Incoming and outgoing e-mail messages are routinely monitored for compliance with our information security policy. The information contained in this e-mail and any files transmitted with it is for the intended recipient(s) alone. It may contain confidential information that is exempt from the disclosure under English law and may also be covered by legal,professional or other privilege. If you are not the intended recipient, you must not copy, distribute or take any action in reliance on it. If you have received this e-mail in error, please notify us immediately by using the reply facility on your e-mail system. If this message is being transmitted over the Internet, be aware that it may be intercepted by third parties. As a public body, the Council may be required to disclose this e-mail or any response to it under the Freedom of Information Act 2000 unless the information in it is covered by one of the exemptions in the Act. Electronic service accepted only at legalservices at bury.gov.uk and on fax number 0161 253 5119 . ************************************************************* From jwcolby at colbyconsulting.com Wed Jul 6 06:46:07 2011 From: jwcolby at colbyconsulting.com (jwcolby) Date: Wed, 06 Jul 2011 07:46:07 -0400 Subject: [dba-VB] =?windows-1252?q?HASHBYTES_=96_A_T-SQL_Function_-_SQL_Mu?= =?windows-1252?q?sings_-_SQLServerCentral=2Ecom?= Message-ID: <4E144AFF.5010306@colbyconsulting.com> We were discussing hashes awhile back. -- John W. Colby www.ColbyConsulting.com http://www.sqlservercentral.com/blogs/steve_jones/archive/2011/6/28/hashbytes-_1320_-a-t_2D00_sql-function.aspx From df.waters at comcast.net Wed Jul 6 08:57:58 2011 From: df.waters at comcast.net (Dan Waters) Date: Wed, 6 Jul 2011 08:57:58 -0500 Subject: [dba-VB] More on SourceGear Message-ID: <002201cc3be4$b9dc5a30$2d950e90$@comcast.net> >From SourceGear's FAQ page: --------- Somebody said that Vault is FREE for a single user. Is this true? Yes. Vault is free for use by a single user. Simply install the product and do not enter any serial numbers at all. When no serial numbers are present, Vault behaves as if there is exactly one user license. Note that this free license does not apply when the product is used by more than one person. If you have two people who need to use Vault, you will need to purchase?two?initial licenses. If you enter a serial number containing only one license, then the product will?still?have exactly one license present. --------- The promotional pair of licenses does not include maintenance updates, but I'll guess that a single user license can be updated. Also, I wanted the Standard version instead of the Pro version. Dan From fhtapia at gmail.com Fri Jul 8 16:23:44 2011 From: fhtapia at gmail.com (Francisco Tapia) Date: Fri, 8 Jul 2011 14:23:44 -0700 Subject: [dba-VB] OO Programming Message-ID: Hey gang, This thread I wanted to start to help cover some best practices when it comes to programming, since we don't have a C# group I figured vb.net is close enough :). I was wondering how to approach my current scenario. I'm building a really rather simple windows service. It monitors a folder share on the network and whenever a new file is created it takes a look at it and streams the contents to read for particular pieces of data. Once the target data is obtained, the stream is closed and the data is then inserted into a Sql Server database. simple. I'm thinking that the threaded process should have some events it advertises that the gui can hook into right? the other way to get this to work would be to just eliminate the gui updating from the tread and have it read right off the log.txt file streamed in? what are your thoughts? -Francisco http://bit.ly/sqlthis | Tsql and More... From stuart at lexacorp.com.pg Fri Jul 8 17:36:03 2011 From: stuart at lexacorp.com.pg (Stuart McLachlan) Date: Sat, 09 Jul 2011 08:36:03 +1000 Subject: [dba-VB] OO Programming In-Reply-To: References: Message-ID: <4E178653.23831.499CCE7@stuart.lexacorp.com.pg> Best prectice is for a service to not interact with the desktop in any way. Your service and your GUI should be separate applications. The GUI and service should communicate with each other through some form of Inter Process Communication (IPC). If the server and GUI will always run on the same workstation a good choice would be file mapping using named shared memory, (See http://msdn.microsoft.com/en-us/library/aa366556%28v=VS.85%29.aspx ) The server can then use SendNotifyMessage() with HWND_BROADCAST to tell any active GUI to check for updated data in the mapped file. -- Stuart On 8 Jul 2011 at 14:23, Francisco Tapia wrote: > Hey gang, > This thread I wanted to start to help cover some best practices when > it > comes to programming, since we don't have a C# group I figured vb.net > is close enough :). I was wondering how to approach my current > scenario. > > I'm building a really rather simple windows service. It monitors a > folder share on the network and whenever a new file is created it > takes a look at it and streams the contents to read for particular > pieces of data. Once the target data is obtained, the stream is > closed and the data is then inserted into a Sql Server database. > > simple. > > I'm thinking that the threaded process should have some events it > advertises that the gui can hook into right? the other way to get > this to work would be to just eliminate the gui updating from the > tread and have it read right off the log.txt file streamed in? what > are your thoughts? From michael at ddisolutions.com.au Fri Jul 8 20:32:59 2011 From: michael at ddisolutions.com.au (Michael Maddison) Date: Sat, 9 Jul 2011 11:32:59 +1000 Subject: [dba-VB] OO Programming References: <4E178653.23831.499CCE7@stuart.lexacorp.com.pg> Message-ID: <99266C61B516644D9727F983FAFAB465086569@remote.ddisolutions.com.au> Hi, I agree the service should have no UI component. Use a config file to set paremeters. It seems to be a filewatcher --> parser --> database updater service. Another option for notifying the user UI application is SQLDependency. http://msdn.microsoft.com/en-us/library/a52dhwx7%28v=vs.80%29.aspx I'm using this approach for the app I'm currently building (does not use a service, though I did consider that.). A bit quirky to set up but so far so good! Using this approach means that the service is completely separated from any client UI apps. The UI's are notified by the SQL database when the data changes or is inserted. No polling required either. Cheers Michael M Best prectice is for a service to not interact with the desktop in any way. Your service and your GUI should be separate applications. The GUI and service should communicate with each other through some form of Inter Process Communication (IPC). If the server and GUI will always run on the same workstation a good choice would be file mapping using named shared memory, (See http://msdn.microsoft.com/en-us/library/aa366556%28v=VS.85%29.aspx ) The server can then use SendNotifyMessage() with HWND_BROADCAST to tell any active GUI to check for updated data in the mapped file. -- Stuart On 8 Jul 2011 at 14:23, Francisco Tapia wrote: > Hey gang, > This thread I wanted to start to help cover some best practices when > it > comes to programming, since we don't have a C# group I figured vb.net > is close enough :). I was wondering how to approach my current > scenario. > > I'm building a really rather simple windows service. It monitors a > folder share on the network and whenever a new file is created it > takes a look at it and streams the contents to read for particular > pieces of data. Once the target data is obtained, the stream is > closed and the data is then inserted into a Sql Server database. > > simple. > > I'm thinking that the threaded process should have some events it > advertises that the gui can hook into right? the other way to get > this to work would be to just eliminate the gui updating from the > tread and have it read right off the log.txt file streamed in? what > are your thoughts? _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com ----- No virus found in this message. Checked by AVG - www.avg.com Version: 10.0.1388 / Virus Database: 1516/3751 - Release Date: 07/08/11 From fhtapia at gmail.com Mon Jul 11 09:27:03 2011 From: fhtapia at gmail.com (Francisco Tapia) Date: Mon, 11 Jul 2011 07:27:03 -0700 Subject: [dba-VB] OO Programming In-Reply-To: <4E178653.23831.499CCE7@stuart.lexacorp.com.pg> References: <4E178653.23831.499CCE7@stuart.lexacorp.com.pg> Message-ID: thanks for this advise. I am going to do some reading and see if I can implement some of this, this afternoon. -Francisco http://bit.ly/sqlthis | Tsql and More... On Fri, Jul 8, 2011 at 3:36 PM, Stuart McLachlan wrote: > Best prectice is for a service to not interact with the desktop in any way. > Your service and > your GUI should be separate applications. > > The GUI and service should communicate with each other through some form of > Inter > Process Communication (IPC). If the server and GUI will always run on > the same > workstation a good choice would be file mapping using named shared memory, > (See http://msdn.microsoft.com/en-us/library/aa366556%28v=VS.85%29.aspx ) > The server can then use SendNotifyMessage() with HWND_BROADCAST to tell > any active > GUI to check for updated data in the mapped file. > > -- > Stuart > > On 8 Jul 2011 at 14:23, Francisco Tapia wrote: > > > Hey gang, > > This thread I wanted to start to help cover some best practices when > > it > > comes to programming, since we don't have a C# group I figured vb.net > > is close enough :). I was wondering how to approach my current > > scenario. > > > > I'm building a really rather simple windows service. It monitors a > > folder share on the network and whenever a new file is created it > > takes a look at it and streams the contents to read for particular > > pieces of data. Once the target data is obtained, the stream is > > closed and the data is then inserted into a Sql Server database. > > > > simple. > > > > I'm thinking that the threaded process should have some events it > > advertises that the gui can hook into right? the other way to get > > this to work would be to just eliminate the gui updating from the > > tread and have it read right off the log.txt file streamed in? what > > are your thoughts? > > > _______________________________________________ > dba-VB mailing list > dba-VB at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-vb > http://www.databaseadvisors.com > > From fhtapia at gmail.com Mon Jul 11 09:32:13 2011 From: fhtapia at gmail.com (Francisco Tapia) Date: Mon, 11 Jul 2011 07:32:13 -0700 Subject: [dba-VB] OO Programming In-Reply-To: <99266C61B516644D9727F983FAFAB465086569@remote.ddisolutions.com.au> References: <4E178653.23831.499CCE7@stuart.lexacorp.com.pg> <99266C61B516644D9727F983FAFAB465086569@remote.ddisolutions.com.au> Message-ID: this is also a great lead! Thanks Michael! -Francisco http://bit.ly/sqlthis | Tsql and More... On Fri, Jul 8, 2011 at 6:32 PM, Michael Maddison < michael at ddisolutions.com.au> wrote: > Hi, > > I agree the service should have no UI component. Use a config file to > set paremeters. > > It seems to be a filewatcher --> parser --> database updater service. > Another option for notifying the user UI application is SQLDependency. > http://msdn.microsoft.com/en-us/library/a52dhwx7%28v=vs.80%29.aspx > I'm using this approach for the app I'm currently building (does not use > a service, though I did consider that.). > > A bit quirky to set up but so far so good! > Using this approach means that the service is completely separated from > any client UI apps. The UI's are notified by the SQL database when the > data changes or is inserted. > No polling required either. > > Cheers > > Michael M > > Best prectice is for a service to not interact with the desktop in any > way. Your service and your GUI should be separate applications. > > The GUI and service should communicate with each other through some form > of Inter > Process Communication (IPC). If the server and GUI will always run on > the same > workstation a good choice would be file mapping using named shared > memory, (See > http://msdn.microsoft.com/en-us/library/aa366556%28v=VS.85%29.aspx ) The > server can then use SendNotifyMessage() with HWND_BROADCAST to tell > any active GUI to check for updated data in the mapped file. > > -- > Stuart > > On 8 Jul 2011 at 14:23, Francisco Tapia wrote: > > > Hey gang, > > This thread I wanted to start to help cover some best practices when > > it > > comes to programming, since we don't have a C# group I figured vb.net > > is close enough :). I was wondering how to approach my current > > scenario. > > > > I'm building a really rather simple windows service. It monitors a > > folder share on the network and whenever a new file is created it > > takes a look at it and streams the contents to read for particular > > pieces of data. Once the target data is obtained, the stream is > > closed and the data is then inserted into a Sql Server database. > > > > simple. > > > > I'm thinking that the threaded process should have some events it > > advertises that the gui can hook into right? the other way to get > > this to work would be to just eliminate the gui updating from the > > tread and have it read right off the log.txt file streamed in? what > > are your thoughts? > > > _______________________________________________ > dba-VB mailing list > dba-VB at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-vb > http://www.databaseadvisors.com > > > ----- > No virus found in this message. > Checked by AVG - www.avg.com > Version: 10.0.1388 / Virus Database: 1516/3751 - Release Date: 07/08/11 > > _______________________________________________ > dba-VB mailing list > dba-VB at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-vb > http://www.databaseadvisors.com > > From gustav at cactus.dk Tue Jul 19 16:07:39 2011 From: gustav at cactus.dk (Gustav Brock) Date: Tue, 19 Jul 2011 23:07:39 +0200 Subject: [dba-VB] DatePart "WW" (C#: Extension of DateTime) Message-ID: Hi all Now, would you believe this _old_ bug has survived A2010 and .Net 4 / Visual Studio 2010! So - as someone brought up a long-winded solution - I had to post my version of the extension method for DateTime of C# at CodeProject: http://www.codeproject.com/Tips/227801/DateTime-extension-method-to-give-Week-number /gustav >>> Gustav at cactus.dk 24-05-2007 16:44 >>> Hi Mark If you are looking for ISO week numbers, use these constants: bytWeek = DatePart("ww", datDate, vbMonday, vbFirstFourDays) However, DatePart has always - since Access 1.0 - been buggy for week number 53. Thus, for serious business use, use a function like this which I have posted many times: Public Function ISO_WeekNumber( _ ByVal datDate As Date) _ As Byte ' Calculates and returns week number for date datDate according to the ISO 8601:1988 standard. ' 1998-2000, Gustav Brock, Cactus Data ApS, CPH. ' May be freely used and distributed. Const cbytFirstWeekOfAnyYear As Byte = 1 Const cbytLastWeekOfLeapYear As Byte = 53 Dim bytWeek As Byte Dim bytISOThursday As Byte Dim datLastDayOfYear As Date bytWeek = DatePart("ww", datDate, vbMonday, vbFirstFourDays) If bytWeek = cbytLastWeekOfLeapYear Then bytISOThursday = WeekDay(vbThursday, vbMonday) datLastDayOfYear = DateSerial(Year(datDate), 12, 31) If WeekDay(datLastDayOfYear, vbMonday) >= bytISOThursday Then ' OK, week count of 53 is caused by leap year. Else ' Correct for Access97/2000 bug. bytWeek = cbytFirstWeekOfAnyYear End If End If ISO_WeekNumber = bytWeek End Function /gustav >>> markamatte at hotmail.com 24-05-2007 16:14 >>> Hello All, I'm using datepart to get the week. 12/31/2006 I am having an issue...No matter what optional constant I use or change...I get Day1 of week 53... and 1/1/2007 shows as Day2 of week 1. How do I get Day1 of Week1? Thanks, Mark A. Matte From df.waters at comcast.net Wed Jul 20 19:13:56 2011 From: df.waters at comcast.net (Dan Waters) Date: Wed, 20 Jul 2011 19:13:56 -0500 Subject: [dba-VB] Problem with LinqToSQL, a listbox, a textbox, and SubmitChanges Message-ID: <006a01cc473b$167e99e0$437bcda0$@comcast.net> In a simple test form, I have a listbox and a textbox. The form is bound to a datacontext, which has a single table. The listbox has two items, and is not bound. The textbox is bound to the datacontext. When I select an item from the listbox, the following code runs: txtTest.Text = lstTest.SelectedItems(0).ToString Then when I push my Save button, the following code runs: Me.TextDC.SubmitChanges() But - the database field which the textbox is bound to is NOT updated. If I manually type in a value into the textbox and then push the Save button, the database field IS updated. I've been trying to solve this on and off for several days, and I finally made this very simple text form to confirm or deny what was happening. No errors occur. So, for some reason SubmitChanges() does not recognize that the textbox needs to be updated if it's .Text property has been updated from the listbox, but does recognize that it needs to be updated if I manually type in a value. What's the difference? Dan From michael at ddisolutions.com.au Wed Jul 20 19:52:16 2011 From: michael at ddisolutions.com.au (Michael Maddison) Date: Thu, 21 Jul 2011 10:52:16 +1000 Subject: [dba-VB] Problem with LinqToSQL, a listbox, a textbox, and SubmitChanges References: <006a01cc473b$167e99e0$437bcda0$@comcast.net> Message-ID: <99266C61B516644D9727F983FAFAB465086626@remote.ddisolutions.com.au> I havn't confirmed this but the same would happen when binding with ADO objects as well. I assume it's a part of the binding process. IIRC you need to update the underlying entity and it will update the text property. I can't test now but I think that should work. Cheers Michael M -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Dan Waters Sent: Thursday, 21 July 2011 10:14 AM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: [dba-VB] Problem with LinqToSQL, a listbox, a textbox,and SubmitChanges In a simple test form, I have a listbox and a textbox. The form is bound to a datacontext, which has a single table. The listbox has two items, and is not bound. The textbox is bound to the datacontext. When I select an item from the listbox, the following code runs: txtTest.Text = lstTest.SelectedItems(0).ToString Then when I push my Save button, the following code runs: Me.TextDC.SubmitChanges() But - the database field which the textbox is bound to is NOT updated. If I manually type in a value into the textbox and then push the Save button, the database field IS updated. I've been trying to solve this on and off for several days, and I finally made this very simple text form to confirm or deny what was happening. No errors occur. So, for some reason SubmitChanges() does not recognize that the textbox needs to be updated if it's .Text property has been updated from the listbox, but does recognize that it needs to be updated if I manually type in a value. What's the difference? Dan _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com ----- No virus found in this message. Checked by AVG - www.avg.com Version: 10.0.1390 / Virus Database: 1518/3777 - Release Date: 07/20/11 From fhtapia at gmail.com Thu Jul 21 14:19:04 2011 From: fhtapia at gmail.com (Francisco Tapia) Date: Thu, 21 Jul 2011 12:19:04 -0700 Subject: [dba-VB] iOS and Sql Server Message-ID: Is anybody here working on mobile apps? Today I ran into this link from redgate for helping to get access to sql servers in your organization using iOS's mobile platform... http://mobilefoo.com/ProductDetail.aspx/iSql -Francisco http://bit.ly/sqlthis | Tsql and More... From df.waters at comcast.net Fri Jul 29 12:38:32 2011 From: df.waters at comcast.net (Dan Waters) Date: Fri, 29 Jul 2011 12:38:32 -0500 Subject: [dba-VB] Setting a Textbox Variable Message-ID: <002b01cc4e16$56dc31a0$049494e0$@comcast.net> In VB.Net, I'm trying to pass a listbox object into a procedure, get part of the name of that listbox, and then set a textbox object to a specific textbox using the partial name of the listbox. In Access it's easy: Public Sub XXX(lst As ListBox) Dim txt As TextBox Dim stg as String stg = "txt" & Mid(lst.Name, 4) Set txt = Me.Controls(stg) End Sub Part of the answer is: stg = "txt" & lst.Name.Substring(0, 4) But I don't know how to actually 'set' the textbox variable to a specific textbox. Thanks! From michael at ddisolutions.com.au Fri Jul 29 21:05:50 2011 From: michael at ddisolutions.com.au (Michael Maddison) Date: Sat, 30 Jul 2011 12:05:50 +1000 Subject: [dba-VB] Setting a Textbox Variable References: <002b01cc4e16$56dc31a0$049494e0$@comcast.net> Message-ID: <99266C61B516644D9727F983FAFAB46508667C@remote.ddisolutions.com.au> Hi Don, Your code seems to work as is. Are you sure you have a textbox with that name? Cheers Michael M -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Dan Waters Sent: Saturday, 30 July 2011 3:39 AM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: [dba-VB] Setting a Textbox Variable In VB.Net, I'm trying to pass a listbox object into a procedure, get part of the name of that listbox, and then set a textbox object to a specific textbox using the partial name of the listbox. In Access it's easy: Public Sub XXX(lst As ListBox) Dim txt As TextBox Dim stg as String stg = "txt" & Mid(lst.Name, 4) Set txt = Me.Controls(stg) End Sub Part of the answer is: stg = "txt" & lst.Name.Substring(0, 4) But I don't know how to actually 'set' the textbox variable to a specific textbox. Thanks! _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com ----- No virus found in this message. Checked by AVG - www.avg.com Version: 10.0.1390 / Virus Database: 1518/3797 - Release Date: 07/29/11 From shamil at smsconsulting.spb.ru Sat Jul 30 05:24:47 2011 From: shamil at smsconsulting.spb.ru (Shamil Salakhetdinov) Date: Sat, 30 Jul 2011 14:24:47 +0400 Subject: [dba-VB] Setting a Textbox Variable In-Reply-To: <99266C61B516644D9727F983FAFAB46508667C@remote.ddisolutions.com.au> References: <002b01cc4e16$56dc31a0$049494e0$@comcast.net> <99266C61B516644D9727F983FAFAB46508667C@remote.ddisolutions.com.au> Message-ID: Yes, Don, your code should work as is - there are several other options (VS2010): Dim txt As TextBox txt = Me.Controls("TextBox1") or txt = Me.Controls.Item("TextBox1") or txt = CType(Me.Controls.Find("TextBox1", False)(0), TextBox) ... Thank you. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Michael Maddison Sent: 30 ???? 2011 ?. 6:06 To: df.waters at comcast.net; Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] Setting a Textbox Variable Hi Don, Your code seems to work as is. Are you sure you have a textbox with that name? Cheers Michael M -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Dan Waters Sent: Saturday, 30 July 2011 3:39 AM To: 'Discussion concerning Visual Basic and related programming issues.' Subject: [dba-VB] Setting a Textbox Variable In VB.Net, I'm trying to pass a listbox object into a procedure, get part of the name of that listbox, and then set a textbox object to a specific textbox using the partial name of the listbox. In Access it's easy: Public Sub XXX(lst As ListBox) Dim txt As TextBox Dim stg as String stg = "txt" & Mid(lst.Name, 4) Set txt = Me.Controls(stg) End Sub Part of the answer is: stg = "txt" & lst.Name.Substring(0, 4) But I don't know how to actually 'set' the textbox variable to a specific textbox. Thanks! _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com ----- No virus found in this message. Checked by AVG - www.avg.com Version: 10.0.1390 / Virus Database: 1518/3797 - Release Date: 07/29/11 _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com