Posts

Visual Studio 2017 Code Snippet INotifyPropertyChanged

Image
This is an update to the vs2010 code snippet:  https://aaron-hoffman.blogspot.com/2010/09/visual-studio-code-snippet-for-notify.html Code can now be found here:  https://gist.github.com/aaronhoffman/c821acf4bb3b3beb0759e93bbe3a2402 Hope this helps, Aaron

NYSE Historical Stock Price Data From Quandl

Image
Quandl  is a great resource for historical stock price data. I thought I'd pull some meta-data out of the " Wiki EOD Stock Prices " data set in order to help future developers. First, here is the table structure I used to insert the CSV flat file into SQL Server: CREATE TABLE [dbo].[SymbolHistory]( [ticker] [varchar](5) NULL, [date] [date] NULL, [open] [decimal](16, 6) NULL, [high] [decimal](16, 6) NULL, [low] [decimal](16, 6) NULL, [close] [decimal](16, 6) NULL, [volume] [decimal](26, 15) NULL, [ex-dividend] [decimal](22, 18) NULL, [split_ratio] [decimal](21, 19) NULL, [adj_open] [decimal](25, 18) NULL, [adj_high] [decimal](25, 18) NULL, [adj_low] [decimal](25, 18) NULL, [adj_close] [decimal](25, 18) NULL, [adj_volume] [decimal](25, 18) NULL )  Second, here is a list of all 3,194 NYSE symbols in the Quandl flat file as of 2017-11-06, and the min and max dates that they appeared. https://gist.github.com/aaronhoffman/9ef359cbf39f2eefdf5

Generate Random AES Encryption Key

Image
I was looking for a way to quickly generate a random AES key online, but couldn't find anything. I looked into a couple methods using JavaScript, but determined that a C# solution would be better. I needed to base64 encode the key array to store that value in a config file. Here's the code I ended up with: https://gist.github.com/aaronhoffman/09b56f77a95205fe10365bde2f4a02e5 UPDATE Using Visual Studio's "C# Interactive" screen you can generate a key in a single line: var keyArray = new byte[32]; (new System.Security.Cryptography.RNGCryptoServiceProvider()).GetBytes(keyArray); Convert.ToBase64String(keyArray) Hope this helps! -Aaron

Sync Gmail Contacts Between Accounts

Image
For the last few years I've needed a way to easily sync contacts between gmail accounts. The only method previously supported by Google is to export to csv then re-import the contact list . This may work for some, but clearly there is a desire for something else. I finally found some time to dig into the Google Contact APIs  and created a site to perform this sync operation easily, without needing to install any software: https://www.mycontactsync.com/ Steps to sync:  1. Authorize your gmail account  2. Link an second gmail account (up to 5 currently)  3. Compare two accounts to see which email addresses and phone numbers will be created.  4. Click the Sync Accounts button to initiate the sync! It's that easy! Hope this helps, Aaron links: product hunt note: this website was previously named "gmail contacts sync". The name was changed to verify the google api use.

Hide Main Menu for Visual Studio 2017

Image
To improve my development experience, I disable as many windows and toolbars in Visual Studio as possible. The one toolbar that you can not disable via the IDE itself is the "main menu" toolbar (File, Edit, View, etc.). There is an extension that I've used in previous versions of Visual Studio that hides this menu until the user presses the `alt` key. Here is a link to that extension in the gallery: old --  https://marketplace.visualstudio.com/items?itemName=MatthewJohnsonMSFT.HideMainMenu  -- old For whatever reason, that extension does not appear available in 2017, so I've published my own extension to complete the same task:  https://marketplace.visualstudio.com/items?itemName=AaronHoffman.HideMainMenu2017 I will gladly take mine down if Matthew Johnson ever updates his extension. Hope this helps! Aaron

git - protect local master branch, prevent commit and push

Image
If you've worked with a remote git hosting service like github , you're likely familiar with the concept of protecting a branch . Other remote git hosting services ( vsts , bitbucket , gitlab , etc) also support the concept. It's a good idea to protect your remote in this way, but why stop there? You can also protect your local dev environment from human error by using git hooks . A new git repo (`git init`) comes with various hook examples in the `.git/hooks/` directory. We can tie into two of those hooks, `pre-commit` and `pre-push`, to prevent commits to your local master branch, and to prevent attempting to push to the remote master branch (even from a local feature branch). Place the two files found in the gist linked below in your repo's .git/hooks directory to prevent the two actions described above: https://gist.github.com/aaronhoffman/ffbfd36928f9336be2436cffe39feaec Hope this helps, Aaron