String.Trim method - Removes all occurrences of white space characters from the beginning and end of this instance. Trim(var) method - returns a string with no leading or trailing spaces Yes, there is a difference between these. The String.Trim will remove any non-visible characters such as line feeds and carriage returns. How I came across this was as a result of an odd exception I am getting from an application. Randomly the NameValueCollection after a postback will have an appended or prepended line feed. i.e. hidCustomerID: -1 hidCustomerNo: 0 hidCurrent: True hidOrderID: -1 When the codebehind tries to ctype(hidCurrent, Boolean) it recieves True or False with additional hidden line feeds. This is within an ASP.NET 2.x web application. I have yet to find the source of this problem but I am hoping the String.Trim() will help me out here. If you have any ideas please let me know what may be going on here.
The following is a SQL Script that can be run in a database to return all tables and columns where a particular value is present. This can be used for strings or values with a small modification. This type of thing is great when moving applications/products between servers. This is certainly a good script to include in your master table to be used over and over. DECLARE @value VARCHAR(64) DECLARE @sql VARCHAR(1024) DECLARE @table VARCHAR(64) DECLARE @column VARCHAR(64) SET @value = 'valuehere' CREATE TABLE #t ( tablename VARCHAR(64), columnname VARCHAR(64) ) DECLARE TABLES CURSOR FOR SELECT o.name, c.name FROM syscolumns c INNER JOIN sysobjects o ON c.id = o.id WHERE o.type = 'U' AND c.xtype IN (167, 175, 231, 239) ORDER BY o.name, c.name OPEN TABLES FETCH NEXT FROM TABLES INTO @table, @column WHILE @@FETCH_STATUS = 0 BEGIN SET @sql = 'IF EXISTS(SELECT NULL FROM [' + @table + '] ' --SET @sql = @sql + 'WHERE RTRIM(LTRIM([' + @column + '])) = ''' + @value + ''') ' SET @sql = @sql + 'WHERE RTRIM(LTRIM([' + @column + '])) LIKE ''%' + @value + '%'') ' SET @sql = @sql + 'INSERT INTO #t VALUES (''' + @table + ''', ''' SET @sql = @sql + @column + ''')' EXEC(@sql) FETCH NEXT FROM TABLES INTO @table, @column END CLOSE TABLES DEALLOCATE TABLES SELECT * FROM #t DROP TABLE #t
Back from vacation and back into the routine of work and I am ready to get in shape. City living and a ‘developers’ lifestyle has left my body in rough shape. My wife and I recently invested in some home exercise equipment and I assembled it today. I was scanning some blogs this evening and came across a couple of other individuals in similar modes. Rob Conery posted about the onehundredpushups ‘program’ and thought this is good timing. So my goal is to do my time (2 – 30 minute sessions) on our home equipment daily as well as the 100 pushup plan. I did the initial test and with sore arms I completing this post. For my friends out there, if you also get involved and do the program with me (and complete it) I will buy and have delivered your choice of merchandise from their site. Let me know if this sounds too good. I am serious. I start day 1 tomorrow. Let me know if you like my offer.
As you are listening to these realize that it is impossible not to think of someone you know. That is just funny. It Works on My Computer Guy - “dozens of dependencies”, “replace the production server with your development pc” - “all in a days work” Overly Complicated App Guy – “18 abstraction layers”, “what the hell were you thinking” Mr “I can build your own version of asp.net better than Microsoft” Guy – very very funny!!