I am working on a web app that consists of a treeview on the left and content on the right. The basic layout is a table with the height of the content determining the overall height of the table.

This basically means the treeview has to be scrollable, since it’s possible that the table height is less than the tree height. Simple enough…put the treeview inside a DIV and change its “height” style attribute to 100%.

Works in IE6 but does not in FireFox. After Googling for hours and not finding a good solution, I devised a function to make this work. In my function, the params are the ID’s of the main table and the DIV containing the treeview. The code first sets the height of the scrollable DIV to 0. This allows the main table to adjust to its normal height. Then the DIV’s height is set to the same as the table height.

Works in IE6 and FireFox.

function setScrollerHeight(mainTableId, explorerScrollerId)

         var mainTable = document.getElementById(mainTableId); 
         var scroller = document.getElementById(explorerScrollerId); 
         if (!scroller) return; 
         if (mainTable.clientHeight > 0) 
         { 
                  scroller.style.height = “0px”; 
                  scroller.style.height = mainTable.clientHeight; 
         }
         else 
                  scroller.style.height = “500px”; }

Das Blog has its own skinning solution which consists of “themes” defined in web.config, corresponding to theme sub-folders that contain templates. The templates are basically HTML fragments with tokens that indicate where content will reside. I have been tinkering with the templates quite a bit to make sure I understand all their capabilities as I progress in making Das Blog work with DNN.

One thing that already caught my eye is that the Das Blog skinning solution is not very granular, so skinning flexibility is limited. For instance, you can specify where a blog entry will appear in one template and in another, you can specify the layout for the item. However, there is no mechanism to control what appears between individual items or if you would like a different appearance for alternating items. Having this capability does not have much appeal in general, but there are some specific situations where I think it would be useful — displaying ads in-line, automatically displaying related items using the Technorati API etc. Now the latter is clearly not something that belongs in the skinning department, however, even if implemented in the BL, there is no mechanism to skin it differently from the blog item.

One really neat thing about DasBlog is that most of the user-facing aspx pages are just shells for user controls. This is promising because it makes the process of conversion to DNN modules that much easier. I think I should be done with my skinning analysis in another 3–4 days, at which time I will continue the code conversion.

 

The current DotNetNuke release (3.0.11) is quite stable and I think it will not be very long before we see a Release Candidate.

This is the first release for which I have been a Core Team member from start to release and I have found the experience to be nothing short of amazing. The thing that fascinates me the most is how effective IM/Email/Forums are for team collaboration. If ~40 people, spread out all over the world in different timezones can collaborate to create such a fantastic product, it begs the question, is this a fundamentally better way to work in a global economy?

I know face time is important and that in certain businesses, it is essential. But maybe in the software industry, greater productivity gains are possible through online collaboration. And of course, savings too since you won’t need as many Aeron chairs.

Before I became a Core Team member, I always imagined that there was a lot of behind-the-scenes “bureaucracy” and structure with secrets and such. Now I know that this is far from the truth. The Core Team is really just a group of people with a shared vision, operating under some well-defined, but broad guidelines. Each person contributes to the extent her/his time and talent allows. Then thanks to a devoted few of the senior members, things magically fall into place. There are no mission statements, UML diagrams, team-building exercises and most important, no monetary compensation. Makes you wonder, doesn’t it?

 

I have had it with designing cross-browser web pages without tables.

OK, I get it. An HTML table was never intended to be used for pixel-perfect design layouts. For that matter, HTML was never intended to be used for pixel-perfect design layouts, period.

But, I have tried to go with the flow. The design gurus say, don’t use tables…use CSS. But from a productivity standpoint, that stinks. I have spent countless hours trying to get CSS-based

elements to do my bidding. And you know what. I am done. I will try and use CSS-based layouts when possible, but if I have to spend more than a few minutes trying to get things to position properly, I am back to using tables.

Now, I am no designer, but then I am not completely clueless about CSS either. I tell you, with the number of workarounds/hacks that you have to use to get cross-browser layouts to work using CSS only, I am surprised that people still continue to pursue this type of design. Doesn’t productivity matter more than “View source…”?

There is nothing inherently wrong with tables in HTML unless your overall page is one giant table. Then the user is going to wait until the browser can figure out how to lay the table out. For intermediate content, I don’t see how using tables is a big problem if my targeted browsers are IE and Firefox and I use them for layout of elements within the page. (Yes…I am aware that there are other browsers, but just as people have a choice of browser, I have a choice of the browsers I will support.)

I develop web applications. If my app enables the user to complete the task it was intended for quickly and easily, then as far as I am concerned, tables or no tables, my app is a success. So until all the browser developers get their act together, I am going to keep my tables.

 

 

.Net allows you to do some amazing things with graphics using GDI+. Its handling of image meta data leaves something to be desired though. It’s like they started to do something, but then abandoned it mid-way. In working on the Speerio File Manager Pro (for ASP.Net and DotNetNuke) product’s imaging functions, after considerable research, I decided that Omar Shahine’s PhotoLibrary was the best fit. It has some excellent functions especially in the EXIF area.

After playing with it for a while, I was disappointed to find that it, like just about every other EXIF-handler Google can find, does not preserve EXIF data on resize and rotate operations. I saw some commercial .Net components did it, so I knew could be done. But hours of searching later, all I knew for certain is that GDI+ can read EXIF data, but cannot write it to a new image. Bummer!

Not being one to give up easily, I experimenting a bit, and am pleased to have come up with a solution. Here is my JPEG resizing code which preserves EXIF data:

public static void ResizeJpeg(string filePath, int width, int height)
{
try

{

System.Drawing.Image imgPhoto = System.Drawing.Image.FromFile(filePath);

int sourceWidth = imgPhoto.Width;

int sourceHeight = imgPhoto.Height;

if (height == -1)

height = (int) ((float) sourceHeight * ((float) width/ (float) sourceWidth));

if (width == -1)

width = (int) ((float) sourceWidth * ((float) height/ (float) sourceHeight));

int sourceX = 0;

int sourceY = 0;

int destX = 0;

int destY = 0;

float nPercent = 0;

float nPercentW = 0;

float nPercentH = 0;

nPercentW = ((float)width/(float)sourceWidth);

nPercentH = ((float)height/(float)sourceHeight);

//if we have to pad the height pad both the top and the bottom

//with the difference between the scaled height and the desired height

if(nPercentH < nPercentW)

{

nPercent = nPercentH;

destX = (int)((width – (sourceWidth * nPercent))/2);

}

else

{

nPercent = nPercentW;

destY = (int)((height – (sourceHeight * nPercent))/2);

}

int destWidth = (int)(sourceWidth * nPercent);

int destHeight = (int)(sourceHeight * nPercent);

Bitmap bmPhoto = new Bitmap(imgPhoto, width, height);

bmPhoto.SetResolution(imgPhoto.HorizontalResolution, imgPhoto.VerticalResolution);

Graphics grPhoto = Graphics.FromImage(bmPhoto);

grPhoto.InterpolationMode = InterpolationMode.HighQualityBicubic;

grPhoto.DrawImage(imgPhoto,

new Rectangle(destX,destY,destWidth,destHeight),

new Rectangle(sourceX,sourceY,sourceWidth,sourceHeight),

GraphicsUnit.Pixel);

grPhoto.Dispose();

try

{

foreach (PropertyItem propertyItem in imgPhoto.PropertyItems)

{

try

{

bmPhoto.SetPropertyItem(propertyItem);

}

catch{}

}

}

catch{}

System.Drawing.Imaging.Encoder enc = System.Drawing.Imaging.Encoder.Quality;

System.Drawing.Imaging.EncoderParameters encParms = new EncoderParameters(1);

System.Drawing.Imaging.EncoderParameter encParm = new EncoderParameter(enc,100L);

encParms.Param[0] = encParm;

ImageCodecInfo[] codecInfo = ImageCodecInfo.GetImageEncoders();

ImageCodecInfo codecInfoJpeg = codecInfo[1];

bmPhoto.Save(filePath+“.tmp”,codecInfoJpeg, encParms);

bmPhoto.Dispose();

imgPhoto.Dispose();

FileInfo fileInfo = new FileInfo(filePath);

fileInfo.Delete();

fileInfo = new FileInfo(filePath+“.tmp”);

fileInfo.MoveTo(filePath);

}

catch{}

}