Tuesday, November 17, 2015

Visual Basic Implements Error

The other day a coworker was getting a strange error in Visual Studio:

Statement is not valid inside a method/multiline lambda.

 The code causing the problem looked this this:

Public Function GetSupplyList() As IEnumerable(Of SupplyItemDto)
                                    Implements IReadData.GetSupplyList


It took us a minute to realize that in Visual Basic.NET the Implements on a function has to be on the same line as the function. You can also use a line continuation character ("_") to fix the issue.


Of course, this is the exact opposite of  Implements on a class where the Implements keyword has to be on the next line or you'll get "End of statement expected".


Friday, January 9, 2015

Slow Mac? Check Your Disk Permissions

For a while, my MacBook Pro had been running really slow. Programs would take a long time to start up and I couldn’t figure out why. Googling around I found people saying to check the memory, CPU usage and hard drive space. I had plenty of hard drive space available and Activity Monitor (Mac’s version of the Task Manager) indicated no problems with memory pressure or CPU cycles. 

 

Finally one day l was Googling the problem again and someone said to check the disk permissions. So I went into the Disk Utility, selected my hard drive and clicked on Verify Disk Permissions. After running for a while (~20 minutes) the system showed several permission errors. I ran the Repair Disk Permissions option. Then I rebooted and now my Macbook Pro is running much faster. So if you’re having problems with your Mac and you know your have plenty of memory, hard drive space and no CPU problems, check your disk permissions.