I don't mean your own code. I mean the .Net Framework's code.
You have been able to do that for quite some time but now it is even easier.
Just go to http://referencesource-beta.microsoft.com/ and have fun! Also check http://blogs.msdn.com/b/dotnet/archive/2014/02/24/a-new-look-for-net-reference-source.aspx for some information.
Have you ever wanted to quickly evaluate an expression or test some code, like say try out different DateTime string formats or test a method or clear up some confusion (like what’s the difference between Uri.EscapeDataString and Uri.EscapeUriString or what new Random().Next(0) returns), or decode some string in Base64 or some other format?
C# Pad lets you easily do all those things and a whole lot more. This is what you get at http://csharppad.com/
Damn, February is short! Here I am on the last day of the month publishing my article.
In the last few weeks, I had to build a database connection dialog (a UI letting users select the SQL database server, the authentication method, and the database of their choice) for a special administration tool.
This article shows you how to inspect your system for database servers and databases on the selected server. It also shows how to create a SQL connection string using the SqlConnectionStringBuilder class.
You can read it from http://emoreau.com/Entries/Articles/2014/02/SQL-Connection-Builder-in-Net.aspx
I had a strange issue this week in a script upgrading fields of a database. I had to dig because it wasn’t obvious only by searching at error ID.
The purpose of the script was simple. It was only to change the datatype of one column from Text to NVarChar(MAX) but it failed. Notice that the error is not purely related to the datatype but to the fact that I was trying to change the datatype of a column having user-declared statistics!
For example, say I have a table named TestTable that has a column Name of data type VarChar(50).
Then somebody is creating a statistics on that column using this syntax (normally you let SQL Server creates its own statistics):
CREATE STATISTICS StatsTestTable ON dbo.TestTable(Name)
Then if you try to change the datatype using this script:
ALTER TABLE dbo.TestTable ALTER COLUMN Name NVARCHAR(50) NULL
You will get this error:
Msg 5074, Level 16, State 1, Line 1
The statistics 'StatsTestTable' is dependent on column 'Name'.
Msg 4922, Level 16, State 9, Line 1
ALTER TABLE ALTER COLUMN Name failed because one or more objects access this column.
How can you find out if you have any of these? I have built a query that list them. It also generate the statement to drop the statistics:
SELECT OBJECT_SCHEMA_NAME(stat.object_id) AS 'schema'
, OBJECT_NAME(stat.object_id) AS 'Object'
, scol.column_id) AS 'Column', stat.name AS 'Statistics'
, 'DROP STATISTICS ' + OBJECT_SCHEMA_NAME(stat.object_id) + '.' + OBJECT_NAME(stat.object_id) + '.' + stat.name
FROM sys.stats AS stat (NOLOCK)
inner JOIN sys.stats_columns AS scol (NOLOCK)
ON stat.stats_id = scol.stats_id
AND stat.object_id = scol.object_id
INNER JOIN sys.tables AS tab (NOLOCK)
ON tab.object_id = stat.object_id
AND tab.is_ms_shipped = 0
INNER JOIN sys.columns AS col (NOLOCK)
ON col.object_id = scol.object_id
AND col.column_id = scol.column_id
WHERE stat.user_created = 1 /* ONLY USER CREATED STATISTICS */
I have also found that if you are changing the datatype through the SSMS UI, the change will be done without any warning but your user-defined statistics will be silently dropped and not recreated!
Notice that the statistics generated by SQL Server are not causing any problems.
I just published a new article about using Json.Net.
I had to use it lately to parse strings returned by Google Finance.
You can read the article from http://emoreau.com/Entries/Articles/2014/01/Using-JsonNet.aspx
I may be late but I just discovered something I wasn't aware it was existing.
There is a public service that backups web sites daily!
This may be useful if you want to what the content of a particular web site was looking at a specific date in the past.
Check by yourself at https://archive.org/.
I just published my last article of 2013.
It is about device (computer) location and showing them on a map.
If you are targeting the .Net Framework 4.0 or better in your applications and your apps are running on Windows 7 or better, you have access to the System.Device.Location namespace which can help you find where you are.
The accuracy of your position will greatly vary according to the provider (such as GPS, Wi-Fi triangulation, cell phone tower triangulation) used by your computer to report its position.
You can read it from http://emoreau.com/Entries/Articles/2013/12/Net-Device-Location.aspx
As I have announced in my article of last month, here is my introduction to the Async and Await features of .Net.
One of the complaint about the Task class I have introduced last month, is that the code is not very linear. I strongly suggest that you (re)read last month’s article as we will build up on what was done in that article.
Async and Await features bring back some linearity while keeping the benefits of asynchronous code making the code more readable. You definitely need to understand task to correctly use Async and Await.
You can read this article from http://emoreau.com/Entries/Articles/2013/11/Async-and-Await-in-Net.aspx
L'événement a été cancellé. Il sera remis au printemps 2014. Désolé.
Ne manquez pas le lancement de VS2013 et TFS 2013 par la Communauté .NET de Montréal qui aura lieu le samedi 7 décembre prochain.
Joignez-vous à Etienne Tremblay et Vincent Grondin pour un tour d’horizon sur les nouveautés de cette suite de produits de développement dans l’écosystème Microsoft, incluant les fonctionnalités seulement disponibles dans le cloud. Cette journée vous offrira aussi un retour sur certaines fonctionnalités de la suite 2012 de ces mêmes produits.
Pour plus d'info et vous enregistrer :
I just finished reading Beginning Windows 8.1 by Mike Halsey published by Apress (http://www.apress.com/9781430263586).
Generally well written, this book is easy to read. Don't be intimidated by the number of pages, the many pictures helps making the reading a breeze. The author knows that not all readers will use a touchable device and takes time to explain the various ways (keyboard, mouse, gesture) for each actions.
On the cons side (because there are always some!), some chapters (only a couple) makes it very visible that this book was written for Windows 8 and then upgraded to 8.1. In these chapters, you will see references to Windows 8 where it should really be 8.1. I found myself reading these sentences twice to try to figure out if the author really means 8 or it is just a left over from the previous edition.
Some other chapters had all references from 8 replaced by 8.1. It makes it tough for somebody who used 8.0 for a while and looking for the differences between 8 and 8.1.
Be sure you are not reading this book while you are away from your computer. I am pretty sure that on every page you read, you will want to try a trick or two you just learned! A good example is when Mike explains how to use the Search in File Explorer in chapter 5. I tell you, you won’t be able to resist.
If you read the book cover-to-cover (pretty hard to with an electronic version but I did it), you will want to keep this book handy for a long time after your reading. You will surely use it as a reference guide especially for chapters like the one on virtualization that you might not use day 1.
That being said, this book is a must read for whoever jumping into Windows 8.1 from Windows 7 and older. Even current Windows 8 users will be able to find valuable content because I don’t know many people knowing the ins-and-outs of Windows like Mike Halsey.