Author Archives: pfb_admin

T-SQL: Trim after newline / carriage return

SELECT product_id,name,revision ,description = REPLACE( CASE WHEN CHARINDEX(CHAR(10),description,1) > 0 AND description LIKE ‘%’ + CHAR(10) + ‘%’ AND PATINDEX(‘%Alternate%’,description) > 0 THEN LEFT(description, CHARINDEX(CHAR(10),description,1)-1) ELSE description END , CHAR(13), ”) FROM qs_products Note: This query is somewhat case-specific. My … Continue reading

Posted in SQL Server | Leave a comment

save to DB & update DT+DGV, vs Total UI requery from DB

Here’s code for this… save to database + update local datatable + update local datagridview = faster than refreshing UI from database if (lblSerialNumberId.Text != “”) { MesQueries.SRUSheetCreation sru = new MesQueries.SRUSheetCreation(_mq); string serial_number_id = lblSerialNumberId.Text; string change_orders = txtChangeOrders.Text; … Continue reading

Posted in C#, Programming | Leave a comment

Meltdown and Spectre patches, via SQLServerCentral  

Posted in Linkdump, SQL Server, System/DB Administration | Leave a comment

SQL Server diagnostics notes

This week’s amusement: performance of a recently-implemented Stored Procedure dropped and dropped to intolerable levels. This system cannot be easily upgraded. Significant fragmentation is involved. Memory pressure is involved. Inserts to table variables in multiple stored procs are involved. This … Continue reading

Posted in Linkdump, Programming, SQL Server, System/DB Administration | Leave a comment

Enum tip: Initialized

When using a custom Enum to control features like application states, I always include an explicit Initialized state. This eliminates any uncertainty of which value to use for a necessarily-initialized variable that may not have a defined state- for example, … Continue reading

Posted in Uncategorized | Leave a comment

Tips for adjusting TableLayoutPanel

UI adjustments feel clumsy until you struggle through several, but there are some techniques that can help. It’s obviously better to see these in use, but a list is at least something to start with. TableLayoutPanel displays a flyout menu … Continue reading

Posted in C#, Musings, Programming | Leave a comment

tip: passive error and warning messages

It’s best to put error/warning messages in very passive, non-blaming language, especially if users might see them. Avoid exclamation marks unless something is seriously wrong and they need to take immediate action, and in that case tell them which actions … Continue reading

Posted in Business, Musings, Programming, System/DB Administration | Leave a comment

no comment.

So apparently the comment system is borked. I’ll need to fix it. Sorry about the inconvenience! This is what I get when posting a comment: 500 Internal Server Error Internal Server Error The server encountered an internal error or misconfiguration … Continue reading

Posted in Uncategorized | Leave a comment

Visual Studio Code

Posted in Uncategorized | Leave a comment

Windows 10 wireless displays Cool!

Posted in Linkdump, Musings, System/DB Administration | Leave a comment