Thursday, January 17, 2013

Utah Code Camp

Time to get ready for Utah Code Camp. It's going to be on March 23rd this year.

http://www.utahcodecamp.com/

If you're at all interested in becoming a better programmer, you need to be at this event.

Responsive Design

I want to learn the basics of Responsive Design. Anybody have good resources or suggestions?

Friday, January 11, 2013

I Like it LESS

I know I am late to the game but I like LESS. LESS is a dynamic stylesheet language. It makes CSS a whole lot smarter and easier to use. I won't go into all the specifics of it but LESS has made my CSS work so much better. With its ability to use mixins (functions) and variables makes CSS much more modular and reusable.

I'd recommend any web developer to take a look at LESS or the similar SASS.

Here's some things I use LESS for:
  • Reusable variables for color and other attributes
  • A mixin that properly handles the CSS to round corners for all browsers
  • A mixin that will handle the different browsers to get a gradient background
  • Nested styling
  • darken and lighten functions to get borders and gradients a certain percentage difference from a base color
  • Applying the attributes of an existing CSS class to another CSS class
There are two ways to get LESS to work: client-side compilation or server-side. The client-side compilation will download the LESS syntax and use JavaScript  to compile the syntax to a dynamically loaded stylesheet. This is probably the best way to do it while you're learning and figuring things out.

The server-side can be done two ways: on-the-fly or compilation. Both options are enabled by the dotLESS framework. On-the-fly uses an HTTP handler to convert the syntax on the server as it is requested by on the client. The compilation method is a "manual" process of telling dotless compiler to actually create a CSS file that you can then reference in your page.

Tuesday, July 10, 2012

VB6 DLL Failed to Load on Windows x64

I ran into a problem today that I struggled with for a couple of hours. I just had my machine upgraded from a Windows XP x86 (32 bit) to a Windows 7 x64 machine. We have some legacy custom applications that require a VB6 dll to be registered. Everytime I ran the regsrv32 command on the DLL to register it, I got the below error:


The module "MyVB6.dll" failed to load.

Make sure the binary is stored at the specified path or debug it to check for problems with the binary or dependent .DLL files.

The specified module could not be found.

I found posts that talk about making sure I run the command with adminstrator rights but it didn't help. I finally found the below URL:

http://social.msdn.microsoft.com/Forums/en-US/sbappdev/thread/91cf3127-70fe-4726-8a27-31b8964430c5/

It says that I need to make sure that the DLL does not sit in the System32 folder like we did on WinXP. Because the DLL is a 32 bit DLL, you need to use the 32 bit version of regsvr32 and that is in the SysWOW64. I even tried to run the command from SysWOW64 but leave the DLL in System32 and still got the same error. The DLL must sit in the SysWOW64 folder and be registered by the regsvr32.exe in the SysWOW64 folder.

Tuesday, March 27, 2012

Getting Rid of Some SQL Cursors

I had a need to find a way to take a single column result set and put it into a single varchar variable. I did not want to go through the hassle or the overhead of doing a cursor for this. With a little Googling, I found the below article:

http://stackoverflow.com/questions/822615/what-is-the-best-way-to-collapse-the-rows-of-a-select-into-a-string

It shows a very nice way of solving my problem :

 DECLARE @A VARCHAR(max)
SET @A = ''
SELECT @A = @A + ISNULL(mt.ColA, '') + ', '
FROM dbo.MyTable AS mt
ORDER BY mt.ColA
SET @A = SUBSTRING(@A, 1, LEN(@A) - 2)
SELECT @A

I thought this was a pretty nice way to do what I was doing but then I thought of how we are constantly having to do cursors to generate files and realized that we could use this method to generate a file without using a cursor. The below code will add a line at a time to the variable and then the variable can be written to file.

 DECLARE @A VARCHAR(max) 
SET @A = '' 
SELECT @A = @A + ISNULL(mt.ColA, '') + ',' + ISNULL(mt.ColB, '') + CHAR(10) 
FROM dbo.MyTable AS mt 
ORDER BY mt.ColA
SELECT @A 
--Write @A to a file

Using the above method reduces considerably the code required to generate a file and makes it a lot easier to read. Look over it and let me know if you have any comments or recommendations.

Update: Found an issue with the above method. We were using this at work with a process that would work sometimes and not in at other times. After a bunch of playing and searching, I found the below queries:
  • http://blog.sqlauthority.com/2009/09/29/sql-server-interesting-observation-execution-plan-and-results-of-aggregate-concatenation-queries/
  • http://www.simple-talk.com/sql/t-sql-programming/concatenating-row-values-in-transact-sql/
The first link essentially says that using the order by statement may cause unexpected results inconsistently.  Meaning that it will work one time but may not the next.

The second link gives the alternative by using a FOR XML PATH query hint. Very helpful

Tuesday, October 04, 2011

Javascript Fiddling

I found a neat web development tool this morning. It's called jsFiddle. It allows you to play with HTML, javascript, and CSS on the fly. It also lets you save your "fiddles" for later. They also give each of your fiddles a unique URL so you can share them. Great for posting on forums and blogs. I'm very excited for this. Check out my very cool and complex fiddle:

http://jsfiddle.net/codyschouten/gSp8M/

Tuesday, September 06, 2011

Linked Server "String data, length mismatch"

So I have a TSQL problem that has been bothering me for a few months now. I have a stored procedure that runs nightly via a SQL scheduled job. It has failed almost everynight since April. The stored procedure is still in test and has been in low priority so I have dabbled with figuring it out. Our DBAs really didn't have a clue what the problem was and I couldn't find an answer through search engines. The annoying part is that I could run it development just fine and it would only sporadically fail in the test environment for me. I finally got tired of it and started pulling the 2900+ lines of SQL. Here's the error that I got:

 OLE DB provider "SQLNCLI" for linked server "MySQLServer01" returned message "String data, length mismatch". 
Msg 7421, Level 16, State 2, Line 1
Cannot fetch the rowset from OLE DB provider "SQLNCLI" for linked server "MySQLServer01". .
So part of problem had to do with the fact that I was trying to join two bits of data from different servers. I had a join that tried to join a VARCHAR(30) field from one SQL Server to a NVARCHAR(MAX) field on another SQL Server. I know that this isn't going to be the fastest of JOINS but it was a requirement. Seems that there is a problem with joining the MAX to something in another server. Once I did a CONVERT(VARCHAR(30) to the VARCHAR(MAX) field, my query completed beautifully.

I'm not sure how I would resolve this issue if I had to really join VARCHAR(MAX) to VARCHAR(MAX), but I guess I'll handle that in the future if that day comes.

Thursday, August 18, 2011

Configuration Error System.Web.Extensions

Keep in mind that it has been a year or two since I've really played with creating and configuring websites via IIS. This is something I've done before but for some reason didn't recognize the error. I created a new website the other day and got a Configuration Error page that indicated that there was a problem with my setup that was not allowing the System.Web.Extensions namespace to load. A quick Google search revealed that I just needed to point the website's ASP.NET version should be 2.0.50727 instead of 1.1.4322.

Found the reminder here:

http://codeproject.wordpress.com/2008/01/17/configuration-error-systemwebconfigurationsystemwebextensionssectiongroup/


Thursday, July 28, 2011

Samsung Galaxy S2

This is the phone I really want:

CNET
PhoneArena

It really makes me happy thinking about it. It's been available since April but not in the U.S. Supposedly it will come out this August just ahead of the next iPhone announcement. A buddy at work bought the European version without contract for a lot of $$$. I can't justify doing that so I have until AT&T releases an American version with contract. I really should get over my tech porn problem.

Does anybody have this phone or seen others with it? Any impressions?

Fall 2011 Utah Code Camp

I'm planning on attending this fall's Utah Code Camp. It will be my first time attending but I have heard great things about it. Best part is that it's free.


http://utahcodecamp.com/