Code - EAR
Coding Notes, Observations, Tips, and Frustrations
Sunday, November 8, 2009
SQL EXIST Command saves Disk I/O...sometimes
Did you know that using the SQL EXISTS fuction against an Index field saves on disk access because it actually does not return a value other than TRUE or FALSE. In this respect the disk pages storing the record can be ignored and only the index is scanned.
Rested and Relaxed...yeah right!
After a week's vacation, I am back to work now this first week of Nov. Only 78 unanswered email and 17 voicemails. I've been working with Serialization more and more. I really have not had a use for it since nearly all of my programs talk to a database and store information that way. However we are moving to using webservices and as such I will need to be able to serialize objects.
Below is an example of serialization that should be helpful to anyone that needs to convert an object into someting that can be saved to disk or sent via stream
Below is an example of serialization that should be helpful to anyone that needs to convert an object into someting that can be saved to disk or sent via stream
Tuesday, October 20, 2009
Date Time Formats
I am forever tryring to remember these date time formats strings. It seems like every other program I write requires something different.
Did you know that MMMM is the format string to get the whole month? Now you do.
MSDN Help
Did you know that MMMM is the format string to get the whole month? Now you do.
MSDN Help
Wednesday, October 7, 2009
Last Day of the Month
So I finally got tired of using my old method to determine the Last Day of the Month. Which invovled adding a month to the date and them backing into the last day.
And now instead I will just use the built in function Date.DaysInMonth(year, month)!
Dim iLastDay as Integer = Date.DaysInMonth(2009,9)
iLastDay would equal 30.
And now instead I will just use the built in function Date.DaysInMonth(year, month)!
Dim iLastDay as Integer = Date.DaysInMonth(2009,9)
iLastDay would equal 30.
Tuesday, September 29, 2009
SQL - Compare Records in Two Tables
I recently needed to compare records in a Production database with that of our Development Enviroment. Some recent learning on the topic of Unions and the use of the MINUS (Oracle) and EXCEPT (SQLServer) operators has led me to the following example:
(SELECT * FROM old_table
MINUS
SELECT * FROM new_table)
UNION ALL
(SELECT * FROM new_table
MINUS
SELECT * FROM old_table)
Oracle SQL by Example. Rischert. ISBN: 0-13-145131-6. pg. 405-6
This searches for missing records two tables (in both directions) then merges the results. This could replace some custom logic that reads records sequentially for a farily elegant SQL solution.
For SQL Server users (like me!) replace the MINUS operator with EXCEPT.
Happy Coding.
(SELECT * FROM old_table
MINUS
SELECT * FROM new_table)
UNION ALL
(SELECT * FROM new_table
MINUS
SELECT * FROM old_table)
Oracle SQL by Example. Rischert. ISBN: 0-13-145131-6. pg. 405-6
This searches for missing records two tables (in both directions) then merges the results. This could replace some custom logic that reads records sequentially for a farily elegant SQL solution.
For SQL Server users (like me!) replace the MINUS operator with EXCEPT.
Happy Coding.
Sunday, September 20, 2009
Infragistics - Custom Grid Summary
I am currently working on an application for my company. It contains a rather complicated grid that shows items and transactions. I was asked to added multiple custom summaries to the grid under the quantity column.
Infragistics allows you to use Custom Summary Calculators to basically perform any type of formula. In this case I needed a Quantity * Price and Quantity * Weight.
Below is an example of one of the classes I made along with the code needed to add it to the grid.
Infragistics allows you to use Custom Summary Calculators to basically perform any type of formula. In this case I needed a Quantity * Price and Quantity * Weight.
Below is an example of one of the classes I made along with the code needed to add it to the grid.
Sunday, September 13, 2009
CodeEAR - The Beginning
CodeEAR is a personal project of Eric A. Rupp. The goal of CodeEAR is to share, learn, and vent about programming and the trials and tribulations that accompany my job/hobby.
This blog will focus on:
Note: Names have been changed to protect the innocent or at least my job.
Warning: I use words wrong and I spell horribly. I apologize for this upfront.
This blog will focus on:
- .NET(language independent)
- SQL Server
- Citrix Presentation Server
- Infragistics Development Controls
- Anything else that I find interesting or fun
Note: Names have been changed to protect the innocent or at least my job.
Warning: I use words wrong and I spell horribly. I apologize for this upfront.
Subscribe to:
Posts (Atom)