Hopefully this won’t be an issue forever, but still
Hopefully this won’t be an issue forever, but still
When fiddling with database relations in an Azure database you quickly notice you are on your own in terms of tooling in a way that you’re not used to from Microsoft. Metadata however is available so you can work around these things relatively easily.
So: when you are dropping and recreating tables as you design them – here’s a quick snippet to see which columns are depending on the particular table you are editing now:
create procedure show_referencing_relations
@schemaname sysname,
@tablename sysname
as
select
[DropSQL] = 'ALTER TABLE [' + @schemaname + '].['
+ ptbl.name + '] DROP CONSTRAINT [' + fks.name + '];',
[AddSQL] = 'ALTER TABLE [' + @schemaname + '].['
+ ptbl.name + '] ADD CONSTRAINT [' + fks.name +
'] FOREIGN KEY (' + pcol.name + ') REFERENCES ['
+ @schemaname + '].[' + @tablename + '] (' + col.name + ')', [ConstraintName] = fks.name,
[Source Column Name] = col.name,
[Parent Table Name] = ptbl.name,
[Parent Column Name] = pcol.name
from sys.foreign_keys fks
inner join sys.all_objects ao on fks.referenced_object_id = ao.object_id
inner join sys.foreign_key_columns fkc on
fks.object_id = fkc.constraint_object_id
inner join sys.all_columns col on
col.object_id = ao.object_id and
fkc.referenced_column_id = col.column_id
inner join sys.all_objects ptbl on fkc.parent_object_id = ptbl.object_id
inner join sys.all_columns pcol on
fkc.parent_column_id = pcol.column_id and
pcol.object_id = fkc.parent_object_id
--inner join sys.all_objects pcol on fkc.constraint_column_id = pcol.object_id
where ao.name = @tablename
Run it with schema and table names, and you get some SQL to use before and after your planned change. First one to remove the constraints and the second one to restore them. The results of the stored procedure show the name of the constraint, the column in your table that is being referenced plus the parent table and column involved in the relationship.
Then you can quickly write code to drop and recreate these relations.
After the Build conference, the key takeaways, in my most humble opinion, were vastly improved performance and features in multi-monitor, multi-DPI support in XAML in Windows 8.1 as well as the enormous paradigm shift in ASP.NET 4.5.1 which unifies all view engines and paradigms into one ASP.NET, which will help users cherry pick the things they need to create apps that leverage all things that comprise ASP.NET. WebForms, MVC, SignalR and WebApi.
To demonstrate those things from Build, Mads Kristensen, Sr. Program Manager on the Web Platforms & Tools team, will grace us with his presence and do a talk entitled What’s new in Visual Studio 2013 for Web Developers, while one of our old favourites, Tess Ferrandez will return to do a session called What is new in XAML for Windows 8.1.
We will also, as you may have read on the Internets, feature keynotes from Anna Beatrice Scott, Randall Munroe and Jens Bergensten have been added to the lineup.
In other words, we are pretty excited about our conference, and believe you would be too, so get started with your reservations.
I had to google myself silly and the page I ended up finding was so hard to find I couldn’t actually find it again to link to it properly. The below code is not my idea, so if you feel wronged, submit your link and I shall attribute properly.
The problem is: I want to be able to navigate, or find my way back if you will, to a certain MultiPage and TabStrip that is nested inside a Telerik RadGrid. As it is a view and not a state change, I would like the querystring to handle this. However, to be nice, or obnoxious, depending on how you see it, Telerik will resubmit the same querystring when you navigate the tabs yourself, which will make it so that after changing tabs via querystring once, you cannot navigate to a different page by clicking anymore.
Anyway: People on the Internet, especially Telerik forums tell you to do Request.QueryString.Clear(), but that just doesn’t work because it is a readonly Collection and although it compiles, you will get a runtime error. So: What to do?
The post that I found simply used violence and Reflection to force the collection into being Read/Write, and then when Telerik reads from Request.Querystring to needlessly resubmit the exact previous query, it actually, accidentally, posts the correct, cleaned querystring. This enables my expected scenario where you by using GET can change tabs in a TabStrip/MultiPage.
private void ClearQueryStringParam(string paramName)
{ Continue reading Tip: Clearing QueryString when using RadControls and ASP.NET WebForms
Early Bird campaign ends in two weeks, Aug 15
We are proud of the program we have put together for Øredev 2013 and we are quite confident you will find the content interesting enough to at least consider coming to Malmö in November.
The thing is, our very lucrative early bird campaign is ending in two weeks, so if you are on the fence, this is the time to pull the trigger and make that reservation. It is easier to beg accounting for forgiveness than to ask for permission. It can’t hurt to at least ask.
I have noticed some people come to this blog for reference on using Castle Windsor together with NHibernate and ASP.NET MVC, so I have to mention a few things that have happened since I last posted about it several years ago. First of all ,there is an excellent sample application that shows the simplicity with which you can hook these things up.
The sample shows you how to register Castle in an MVC application. how to add logging and how to hook up NHibernate 3.2 . This is far, far easier than what I described years ago thanks to improvements in all involved frameworks, really.
The important things to remember are:
Castle Windsor + NHibernate + log4net + ASP.NET MVC Sample
Windsor tutorial ASP.NET MVC 3-application To-be-Seen
Scott Hanselman on Glimpse:
If you’re not using Glimpse…
As a reaction to my earlier blog post on the Actor Model, Microsoft has allowed the public to get preview access to their Actor Model framework Orleans that they use to power Halo on XBox Live.
http://research.microsoft.com/apps/video/?id=198324
http://research.microsoft.com/en-us/projects/orleans/
Will this be awesome or will it be Entity Framework 1.0? What do you think?
One of my colleagues at Jayway launched a functional puzzle and solicited responses via Github gists. The challenge was as follows:
Of course, me being an F# n00b I ended up at StackOverflow within hours of trying my hand at this, and I also asked among code monkeys on Facebook, so I will not submit an answer is it wouldn’t be my own. My colleagues went ahead and figured out solutions on their own rather than use Google engineering like I did.
Anyway, as you can imagine, the first bit is the hard one. With higher order functions, delegating the actual filtering is done easily thereafter by supplying the comparer function as a parameter.
So what do you do? I looked at many solutions, but couldn’t manage to use the comme il faut solution with a permutation tree, but went with a list of permutations instead which I then could trivially recurse through to see if I ever find a match.
If you are using Google engineering to solve F# problems, be aware that the old function Seq.map_concat has been renamed Seq.collect, which is a clear improvement.
In my case I found my permutation function on StackOverflow, provided by the excellent Tomáš Petříček, see blogroll, and just added my c0dez to find matches. This is from a console app, so hence the EntryPoint business.
let rec permutations list taken = seq { if Set.count taken = List.length list then yield [] else for l in list do if not (Set.contains l taken) then for perm in permutations list (Set.add l taken) do yield l::perm } let rec isMakingZero acc lst = match lst with | [] -> false | a :: tail -> (acc + a = 0) || isMakingZero (acc + a) tail let rec testpaths pathlist = if Seq.length pathlist = 0 then false else isMakingZero 0 (Seq.head pathlist) || testpaths (Seq.skip 1 pathlist) [<EntryPoint>] let main argv = printfn "First %A" (testpaths (permutations [1; -2; 3; -5] Set.empty)) printfn "Second %A" (testpaths (permutations [1; -3; 2; -5] Set.empty)) 0 // return an integer exit code
As you can imagine, you just supply a function to testpaths that then gets passed down to isMakingZero, which should be renamed, in order to solve the remaining tasks.
This is a follow-up on my post on the Actor Model, as I was very generous in my definition of F# Agents as a full-fledged Actor framework. F#:er s have been wanting something like the Akka framework for Scala. Colin Bull from whom I also reblogged the F# and Raven post below, posted about a framework on his blog that will provide this, and it also explains what the difference is and what the requirements are for an Actor framework.