- 8 Week Game
- Quick Ref
Archive for December, 2010
Just done some reading on the new dynamic typing stuff in .net 4 and it occured to be you could use this to assist using TDD “Test First” approach, where you write code to test methods that you’ve not yet written. Unless you stub the method, you get compile errors, however using dynamic, the compiler doesn’t evaluate your call until run time, so your test will actually compile and you will get the expected red cross until you’ve actually implemented your method. Turns out I’ve been beaten to this conclusion though; check out this post on Peter Gfader’s blog
Any app’s you create now which need to post to twitter programmatically, will need to do so using oAuth, for which you will need to register your app with twitter- this can be done @ http://dev.twitter.com/apps/new Once registered you will be taken to a page with your consumer keys (a key value and a secret value)- to get your access token, click the button on the right of that page (a token and a secret) and you should now have all 4 values you need to perform oAuth authentication prior to interacting with twitter.
Previously, on Shawson.co.uk..
So following on from my last MVC post I posed my question to Scott Hanselman himself via email, and he took the time to write me a very helpful response;
Interesting solution. Good job getting it working.Take a look at maybe using some cleaner JS on the client…check out my last podcast on Knockout and check out this demo: http://knockoutjs.com/examples/contactsEditor.html
Just had an hour or so’s worth of ball-ache from this issue! Working on an MVC2 site, i wanted to move the default membership out of the aspnet mdf file and into the sites main MDF file. This should be a pretty simple web.config change, and a matter of running aspnet_regsql against the database. I read an article mentioning that you can do this straight from the command line to your MDF file, but I had no success with this method- it simply created another database for me with a name equal to the full path of the database i had requested. So I found I had to attach my database to my local sqlexpress instance, then run it against that; so in sql;
EXEC sp_attach_db 'mydb', N'E:\_Dev\5imply\5imply-MVC2\BackOffice\App_Data\5imply.mdf'
Then you can just run aspnet_regsql in the same way you would for any other database; In my example I just wanted Membership, roles and profiles
C:\Windows\Microsoft.NET\Framework\v2.0.50727>aspnet_regsql.exe -S .\SQLEXPRESS -d mydb -A mrp -E Start adding the following features: Membership Profile RoleManager .. Finished. C:\Windows\Microsoft.NET\Framework\v2.0.50727>
Then once you’re done, you can detach again;
exec sp_detach_db 'mydb'
Also- one other gotcha I found was that I had to do all this using SQL Management studio, having started it using “Run as Administrator”- I’m not sure if this is something specific to Windows 7, as I would have expected to already be an administrator? But I spent ages wondering why SQL refused to attach my database- Just kept getting an error “create file encountered operating system error 5″ I eventually ran procmon and found it just didn’t have permisisons to the file under the account it was running under.