Tuesday, September 20, 2005

Last week was the PDC 2005 in LA. Lots of pictures and stories on the Event. I have a busy week of catching up but when I am done I will start posting again.

Doc

posted on Wednesday, September 21, 2005 3:30:39 AM (GMT Daylight Time, UTC+01:00)  #    Comments [0] Trackback
Tuesday, August 30, 2005

It is 8:00am and I am not fully awake yet but have made it down to (or up to I guess since I came from California) the Microsoft Conference Center. I just have to say, I wish ALL conferences were this wired. Every seat has hook-ups for power and of course free Wi-Fi and an individual speaker at each seat.

 This makes it SOOOO easy.  We are waiting for Scott Guthrie to do the opening monologue (sorry, I mean keynote speech). As part of the registration for this conference, you had the ability to schedule a 1 on 1 with one of the Wintelect guys. I have mine set for 10:45 this morning. This is slightly odd because it is during one of the sessions. I guess  will have to walk in late. I tried to get advanced notice of when it would happen but did not find out until I registered.

Anyway, ...........

Well the keynote is done. It was a pretty cool talk. He went through the development cycle that is used at Microsoft, the methodologies they use (UML?? What's UML - Word Doc's very interesting) and the tools they use in the process.   

NEWS ALERT!!!

What really caught my ear was actually after his keynote. I was packing up to go to another room and I caught him talking about DotNetNuke. He was talking to someone about how much testing they are doing with DNN and the Whidbey Beta 2.  Cool. Looks like I smell a book re-write :)

OK. The rest of the day was spent with Jeffery Richter of Wintellect. I sat through his sessions on Exception handling, and building extensible applications. 

 

He went though stuff like hosting the .Net process, Remoting, Reflection and the like. Except for the fact that he went over each session by about 20 minutes, the presentations were fantastic. This is not one of those Fluff conferences. He really gets into the nitty griddy of code.

Great stuff.

So yesterday, I think I told you that they have a soccer field on the MS campus. Well on the way back to my room I found out that the field had more than one use. While I was crossing campus I came across a helicopter about to take off from the soccer field. So of course I thought that was cool and wanted to take a picture of it.

My guess is that it was Mr. Bill (Or someone else important) because when I tried to take these pictures, I was attacked ( well just kind of shooed away) by the MS Security team.

The picture is a bit blurry because I was actually shooting video when he chased me off. He was not running towards me but it was definitely almost a jog. :) I guess Bill is shy.


Anyway, it was a fun day. Unfortunately, I have to do some work tonight.

I am looking forward to tomorrow. HTTPModules, HTTPHandlers, & Threading.  You can never have too many sessions on these fun topics.

Happy Programing.

Doc

posted on Tuesday, August 30, 2005 8:15:54 PM (GMT Daylight Time, UTC+01:00)  #    Comments [0] Trackback

Well the Doc came early for the Devscovery conference and I took the time to take a trip around the Microsoft Campus. The first thing that struck me was how every single building looked EXACTLY the same. It must be really easy to get lost there (Well if you don't know how to count anyway, since all the building are numbered in order).

I wanted to find the Microsoft Conference center so that I knew where to go tomorrow. I am staying at the Homestead Suites which are pretty cool because they are like little apartments. With a full kitchen and everything.

So I took off from the pad and went looking for the conference center. There was not too much to take a picture of because everything looked exactly the same. Of course, I had to take a picture of the sign.



The one thing that was worth taking a picture of was next to what looked like the like the MS cafeteria.  They have stones set in the walkway that show the release of every product launch. Some stones are for the products themselves and some are for the years that the products came out. I took two pictures. One for the year of MS's first launch. This was pretty cool because it only had one item on it. BASIC.

The other one for the year I graduated high school (no comments).

It really makes me wish I would have taken this path when I graduated. But look at all the products released in good old 85.

Well I will be at the conference tomorrow. I will post more then

Happy Coding

DotNetDoc (Daniel N. Egan)

posted on Tuesday, August 30, 2005 10:04:46 AM (GMT Daylight Time, UTC+01:00)  #    Comments [0] Trackback
Sunday, August 28, 2005

Hey, I went to the the .Net Influential  BBQ today and had a great time. It was mostly relaxation but there was some business too!!  We have lots of events coming to town in the next couple of months.

.Net Rocks Roadshow November 4th

Dan Fernandez and Jay Roxe December 4th

Rocky Lohtka January

So Cal Code Camp January

Anyway. Here is part of the clan that was there.

 

From left to right.
Mike Vincent, Mark Rosenberg, ME, Scott Robertson, Art Villa, Dave Wells, Dave Foderick.

I will be in Redmond next week. I will post about the Devscovery Conference.

See Ya

Doc

posted on Sunday, August 28, 2005 9:03:55 AM (GMT Daylight Time, UTC+01:00)  #    Comments [0] Trackback
Saturday, August 27, 2005

Use JavaScript in Your Code Behind Files.

By Daniel N. Egan (DotNetDoc)

There are many new things that can be accomplished in ASP.Net that would take you quite a bit of coding if you were to try to accomplishthem in regular ASP. Among the advancements that ASP.net has brought to web programming is the use of code behind files. A Code behindfile helps us to separate our visual presentation layer from our business layer. If you programmed in ASP then you remember the spaghetticode that inevitably occurred when you added even the simplest functionality to your web pages. A code behind file gives you a wonderfulway of separating your code from your HTML tags. Even with its great power there are still times when you want action to happen on theclient-side of your web application (No trip to the server). For this you will want to use the tried and true web developer’s friend:JavaScript. You can still go into the HTML section and add JavaScript tags where you would like them to be; however, this still requiresdealing with spaghetti code, which makes things difficult to read and debug. A better solution in some situations is to add JavaScript toyour pages dynamically. That’s how the .Net framework classes do it. In this article I will show three scenarios in which you could useJavaScript to have client side functionality and I will show you how to do it in the code behind files.

Our first example is very simple. Here is the scenario:

When users click on a button or link on your aspx page, that is used to delete a record, you want to have a pop -up message ask them toverify if they are sure. In windows applications this is done with a MessageBox. But the messagebox class in not available to us in a webapplication. To accomplish this in an Asp.Net you will need to use a JavaScript confirm box. Instead of having to add an onClickattribute to your HTML tags, you can place them in your code behind file as shown below. To add a client side attribute to a button orlink on your form you can use the “Attrubutes.Add()” method of the control. It takes two parameters: the type of action, onClick,onBlur, etc..., and the JavaScript itself. This particular JavaScript will pop up a confirm box (Yes/No). The JavaScript functioncalled “Return” has two possible outcomes, true or false. The confirm box will return a true if “Yes” is pressed and false if “No” ispressed. If the users click on “No” then nothing happens. If they click on “Yes” then the application will proceed.

Our second scenario delves deeper into the process:

Most web sites have forms that users need to fill out. Some examples of this are comment forms and registration forms. When users reachthat page you want to make sure that the cursor in sitting in the correct textbox for them to start. This is a convenience for theusers. This eliminates the need to use their mouse to click in the textbox and also directs them to the place you want them to start.

The code below shows a sub procedure in a code behind file. It has a single parameter; “ctrl As System.Web.UI.Control”. All that isrequired to call this method is to pass the name of the textbox that you want to receive the focus. We begin by building the JavaScript.

This requires a little more code than our first example.

You will notice that the first thing I do is create a StringBuilder object. You could use a string to do this as well, but it is moreefficient using a StringBuilder. (StringBuilders will be covered in more detail in a later article). Suffice it to say that it is easyto use and is more efficient than concatenating strings. We start by creating the beginning script tag. The next line calls thedocument.getElementById function and concatenates it with the control that we are passing to the procedure. The third line is just theending script tag.

 

cmdDelete.Attributes.Add("onClick", "javascript:return confirm(' Sure You Wish To Delete?');")

 

You may have noticed that at the end of each line I have added a vbCrlf (Carriage Return Line Feed). This is so that when it writes outthe JavaScript to the page that is rendered it will put each part of the script on a separate line. This is not needed for scriptfunctionality but readability. With a short script like this it might not make much difference but as you create larger scripts you willwant to be able to read the script in case you need to debug it. Please remember, as opposed to Vb.Net, JavaScript is case -sensitive.Calling the method is simple. You just call SetFocus() in your Page_Load and pass it the name of textbox that you want to have thefocus. In the example below I have taken that just a bit farther. The aspx page loads the email that the user had entered into a cookie(code not shown). This is so that when users return to the page, they do not have to retype their email. When the page loads it checks to see if the cookie exists. If it exists, the password textbox receives the focus. If it does not exist then the email textbox receivesthe focus. This is to show you that you can set focus to a textbox dynamically in your code.

 

Private Sub SetFocus(ByVal ctrl As System.Web.UI.Control)

Dim s As New System.Text.StringBuilder

s.Append("<SCRIPT language=""javascript"">" & vbCrLf)

s.Append("document.getElementById('" + ctrl.ID + "').focus() " & vbCrLf)

s.Append("</SCRIPT>" & vbCrLf)

RegisterStartupScript("focus", s.ToString)

End Sub 'SetFocus

‘No carriage return’s

<SCRIPT language="javascript">document.getElementByI ('txtEmail').focus() </SCRIPT>

‘With carriage return’s

<SCRIPT language="javascript">

document.getElementById('txtEmail').focus()

</SCRIPT>

Our third scenario will complete the article:

You have a form where users submit information to you either by email or in a database. You want to be able to give them a confirmationbut you don’t want to send them to another page to do this. When they have submitted something successfully you would like to give thema message and then send them to the homepage. The sample below is overly simplified so that we can focus on the JavaScript itself. Ifthis was for a real application we would add more error checking. Please follow the comments in the code for a line by line detail ofwhat the code is doing.

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

'Put user code to initialize the page here

If Not Page.IsPostBack Then

Try

If IsDBNull(Request.Cookies("JGA_Email")) = False Then

email.Text = Request.Cookies("JGA_Email").Value

SetFocus(txtPassword)

Else

SetFocus(txtEmail)

End If

Catch

SetFocus(txtEmail)

End Try

End If

End Sub

Private Sub cmdUpdate_Click(...) Handles cmdUpdate.Click

' Boolean variable will flag if an error was encountered

Dim bNoError As Boolean = True

Try

' Your code would go here.

Catch ex As Exception

' This will catch your exception and change the Boolean flag to false

bNoError = False

Finally

' The Finally section of a Try Catch will run no matter what. Error or No Error

' First we need to create a StringBuilder object to hold our JavaScript

Dim sJSCode As New System.Text.StringBuilder

' If no error was encountered then ...

If (bNoError) Then

'Start creating our JavaScript by creating our opening tag.

sJSCode.Append(" <script language=""javascript"">" & vbCrLf)

' Here we are creating a variable to hold our message

sJSCode.Append(" var sMessage = 'Your Question has been submitted.';" & vbCrLf)

' In this line we are creating two JavaScript functionsan alert(OK Messagebox)

' that will show our message and a window location method that will send our user to

' the page we are looking to go. If you tried to add a

' Response.Redirect or a Server.Transfer here it would not work.

' Your alert script would never get processed

sJSCode.Append(" alert(sMessage);window.location = 'Home.aspx'" & vbCrLf)

' Here is our closing tag

sJSCode.Append(" </script>" & vbCrLf)

' We need to then register our code. This will make sure it runs when

' we do a postback

RegisterStartupScript("MyJSCode", sJSCode.ToString)

Else

' This code does the same thing but tells the user there was an error.

sJSCode.Append(" <script language=""javascript"">" & vbCrLf)

sJSCode.Append(" var sMessage = 'An error was encountered';" & vbCrLf)

sJSCode.Append(" alert(sMessage);window.location = 'Home.aspx'" & vbCrLf)

sJSCode.Append(" </script>" & vbCrLf)

RegisterStartupScript("MyJSCode", sJSCode.ToString)

End If

 

End Try

End Sub

I hope that this gives you a jumping-off point to start learning how to use JavaScript in your code behind files. Client Side

functionality will greatly enhance any Asp.Net application that you create.

DotNetDoc

posted on Saturday, August 27, 2005 7:11:59 AM (GMT Daylight Time, UTC+01:00)  #    Comments [6] Trackback
Wednesday, August 24, 2005

I am used to reading the reviews of my book on amazon.com but it is always great to come across them other places. This time I came across This Review on EggheadCafe.com.

I was really excited to read it for a couple of reasons.

1) It was a good review of my book ;)

2) It was from Peter A. Bromberg, Ph.D. I read his stuff on EggHeadCafe ALL the time. They are fantastic articles on many of the hard to find techniques in .Net. Every time I Google to find a solution to a particular problem, his articles always come front and center. The really cool thing is that he is a real hard core C# guy so the fact that he still liked my book was cool. Here is a quote from his review:

"I give this one a hearty "Thumbs Up" -- not only does it cover the subject extensively, it also promotes best-practices programming methodology. Pick up a copy of "Building Websites with VB.NET and DotNetNuke 3.0", by Dan(iel) Egan"

Cool!!!!!

Happy Programming

Doc

 

posted on Thursday, August 25, 2005 2:55:01 AM (GMT Daylight Time, UTC+01:00)  #    Comments [2] Trackback

Carl Franklin and the DotNetRocks Road trip will be stoping by our place in Southern California on November 4th. Stop by the SoCal DotNetRocs website for more information and to register for the event.

Doc

posted on Thursday, August 25, 2005 1:49:34 AM (GMT Daylight Time, UTC+01:00)  #    Comments [0] Trackback
Tuesday, August 23, 2005

DotNetNuke version 3.1.1 has been released.  I am installing it right now (well a clean install on my local box anyway) and I will let you know what I think. It is packed with many bug fixes and some cool new stuff as well.

They are supposed to release a new forums module today too. I will test it out, the beta was really nice. I wish they would work on a eCommerce module that comes default with DNN. This is the one thing that DNN is really missing.

Anyway, I will let you know what I think.

Doc

posted on Tuesday, August 23, 2005 8:06:09 PM (GMT Daylight Time, UTC+01:00)  #    Comments [0] Trackback
Monday, August 22, 2005

Well we finally have an "OFFICIAL" date for the Southern California Code Camp. We will be having a 2 Day event hosted at Cal State Fullerton the 21st and 22nd of Jan 2006. We already have some fantastic speakers lined up as well as some cool door prizes. Go to the Code Camp Site and register for more information. We will post updates on that site regularly.

See you all there!!!

Doc

posted on Tuesday, August 23, 2005 1:49:52 AM (GMT Daylight Time, UTC+01:00)  #    Comments [4] Trackback
Sunday, August 21, 2005

I know, I know this is another semi-worthless post but I just had to put this up here. I am usually one to hop onto the front end of new gadgets. Anything that would help out my general geekyness! New phones, headsets, batman utility belts, you get the picture. Well for some reason I was resisting the desktop search programs (Google or MSN). I mean, I could not live through my day without using Google to find something I need for one of my projects, so I don't know why I was resisting it.

Anyway, I was talking to Woody at the Indigo event the other night and we started talking about the desktop search. He uses the MSN one and was talking about all the cool features. But what really caught my ear was the fact that in addition to all of your normal files, it will also search your email!. Now this is not a "Review" post, this is just a "what was I thinking" post. I know, y'all have been using one of these for months now so this is no big deal to you, but MAN what the heck was I waiting for!!!  With a couple of clicks of my keyboard, I can have everything I need brought up before my eyes!!!

If by some really odd chance you have not downloaded one of these, you must do this now.

Doc

posted on Sunday, August 21, 2005 11:33:01 PM (GMT Daylight Time, UTC+01:00)  #    Comments [0] Trackback

I have been using Skype for quite a while. For those of you who have been sitting in a darkened room for a while, Skype is a FREE internet phone system. Yes, I said FREE!!  I use it to call my Publisher in the UK as well as others I know across the US.

It has cool stuff like Skype IN and Skype OUT that lets you use it like a real phone too. (But that costs of course)

Anyway, I went to their site (haven't been there in a while) and I noticed that they have some new cool stuff (Plug-ins and things). Included in this is the ability to show my status right on the website (Upper left hand corner). When I change my status, it will change on the site. So if you see me online, feel free to send an IM or Skype Call (Although I don't usually have a headset plugged in)

Anyway, Cool Stuff. Check it out.

Doc

posted on Sunday, August 21, 2005 9:29:39 AM (GMT Daylight Time, UTC+01:00)  #    Comments [0] Trackback