so every friday at work I share my links w/ fellow developers on our sharepoint site… so im gonna post this here today too…
.net 3.0 more extension methods
so every friday at work I share my links w/ fellow developers on our sharepoint site… so im gonna post this here today too…
.net 3.0 more extension methods
so when I started fooling around w/ asp.net ajax... back when it was called atlas... I would talk w/ fellow developers and say "well it seems like a hack, but it works". We even talked about starting an asp.net ajax blog... and calling it that... because atlas felt like a total hack when ever you wanted to do something out of their "hey drop it in an update panel" mantra.
well today I found something that reminded me very much of that feeling.... it kind of goes along w/ the key up issue that came up last week. This time I'm making a custom control, to do essentially what the titles on pageflakesdo, allow some one to click on a section of text, edit it, on blur flip it back to text, and fire an ajax postback.... I had done this a while ago... but guess didnt test it so much... because i just found that if you didnt change the text, but just blured it wouldnt fire the event. Essentially what I found was the "ontextchange" event was doing exactly as described, it would only fire when the control was blured, and changed.
so I hacked this.
doh
so I was having some problems getting log4net integrated with a site I was working on... for no reason It was not writing to the AdoNetAppender.
This is what I had as the adapter
this is what I had when I constructed it in the wrapper object
it worked just fine for the rolling adapter... I was stumped. Then I found this little nugget in the faq
at the end of the day, for one reason or another log4net couldn't resolve the domain of the sql box... If it werent for the debug pumping an error out to the console I would never have seen this and just keep hitting my head on the desk. good times
So one thing which has really threw me for a loop since ive been working in M$ exclusive dev shops for the past couple years, is how different people in this circles view of open source is. This came to a head w/ me this week w/ a couple people at work and from blogument I had with this guy. Mostly these arguments come down to.... well who supports it? Then my response is normally, well... when the bit you got from M$ fails, who supports it? My experience is who evers fault it is , myself or another developer has to fix it reguardless. I think there are allot of reasons for this sentiment, but im not so much for looking back at why, but more looking forward and saying "hey guys you need to change".
Especially considering the winds they are a blowing. asp.net ajax open source from bits to js, fox pro is now going open source, then you have all the awesome community driven stuff which is pushing the movement in the community ( monorail, log4net, nvelocity,nant,nunit), and these are all aside from the open source stuff that just about every web developer should be using now from desktop tools to js libraries.
I'm not the only person thinking about this. In the java world, developers dont sit around saying, well we cant use that we need to wait for an answer from sun. If that were the case no one would have moved bast ejbs. Yet in the ms world, the answer always seems to be ... "well, we'll wait for the ms answer". Yet due to the slow pace of corporate software development this can take years. The web works in a timespan of minutes. Whats hot w/ the web right now... frameworks like ruby on rails and user experiences using front to back design for rias and ajax, how long has this been the hotness, mmm... about a year, and in a year it will evolve. So my suggestion to fellow develoeprs in ms environments, take a look around, learn from the php/java/ruby/js/ria community you cant learn if you dont look around.
so I got a question from some one via the cmap group, for some help with a kind of tricky asp.net ajax problem. So they had been using a pagemethod, to retrieve a list from a web service to update a datalist. Sounds simple enough... but the problem w/ using web services from client code in asp.net ajax is that the page method, which although it exists in the codebehind of a page, and used to be accessable from the instance of the page in atlas, now has to be static... anywho.... so the problem is if you call a webservice in client js, its hard to do things like bind a datalist...
so my solution/kludge was to add the postback js call of a control, to the onkeyup js event of the textbox. Basicly forcing the textbox to do a asp.net postback on a keyup (really this should be only posted back like every 3 key ups...)
heres the aspx
and here is the cs
so yah kind of kludgy, but is an option in general for doing something in js, which will force a asp.net ajax updatepanel postback... for example, add a button somewhere, have it w/ a style display:none;, then on serverside create a js function that calls its postback function.
so when I was doing lots of cf on a daily basis, I would long for strongly typed data and a real ide w/ real integrated debugging tools... now doing .net dev day in day out , I have those things, and surely appreciate it... but... I miss cfdump. You needed to see in a page what a variable was at any given point, there you had it.... I had a problem the yesterday where a problem only existed on a production server. No nice debugger / ide on a production server, just little old notepad, and me. So I whipped up some reflection code, heres a snippet
So I know, cf no "real" data types, makes the writting of such stuff much easier, exctly why var_dump exists for php, but man, I wish I had something like that.... which stard me thinking I need an Ndump tag.... throw it on a page, and it dumps a variable / complex object in a session etc... I started working on some basic functionality for it today.... Have a Basic Library written, when I get time ill clean it up, put it in a custom tag and post it on up... emphasis on when I get TIME, what is this TIME I speak of.
UPDATE: so i spent some time today and have a working prototype of an Ndump tag/control if any one wants it just ask...
so when me and mr elfie first started playing w/ asp.net ajax the big thing we wanted was to be able to do custom composite controls. In atlas, this was a pain, and we could never make it work right. We ended up deciding that a user control would do just fine for us. Luckily w/ the release of 1.0 this has been solved. To get this to work you need to do a little work up front. First an update panel requires a contenttemplate , so we create an object which implements ITemplate and inherits from TemplateControl, which really just accepts an array of controls and slaps them in the template.
then in your custom control you add a template to your update panel. Where you pass to it all the controls you want in the update panel. In this case I have 2 panels which contain several other controls. This way I can control the formating etc.
only other catch, which I have not found a work around for yet, but honestly haven't had a ton of time to fool around w/ it, is how to have the custom controls add a scriptmanager if one is needed in the page. In the mean time I just have a base asp.net ajax page that includes it, and just inherit from this page for any page which is going to implement asp.net ajax stuff....
so I need to get back on my posting horse, and sadly for family alot of my posts are going to be geek related... my goal is to post at least 1 technical thing a day.... to both get posting again, and to contribute to the dev resources out there, I get so much from reading tech blogs i might as well contribute a bit. so in short.. sorry good friends and family, but your going to end up reading allot of code / geeky discussion you dont care about....
so had to do something interesting for work that I thought would be usefull for others... 2 servers on each coast... need to write the same time, but code does not know which server its running on... so I use gmt to figure out the right time....
heres the solution in sql and c#... sql is useful , as that you could set the default of a datetime field in sql to dbo.fn_GetEastCoastTime(getdate().getutc())
folding bike survivalists.