Sunday, November 30, 2003

Source: HumanCompiler - Erik Porter (.NET MVP) Blog

Whitespace screwing up your Templating?.

I worked yesterday on taking a layout for a client site made by my co-worker and moving it into a custom template (Inherit from BasePage, add menu and properties, etc) and ran into a problem with HTML being pretty horrible.  As Adam put it, “who thought it would be a good idea to render whitespace?”.  Good question...but we're unfortunately screwed for now.  The problem we had in our case was having a carriage return (and maybe tabs and spaces) after the beginning of a div tag with and image and then a table in it.  That extra white space left a small (maybe 4 pixel) gap above the table.  Not good for this particular site layout.  No problem, just remove the whitespace and butt the tags right up against each other.  Now, move it into the template and it gets much harder to keep that whitespace from coming back, especially since the ASP.NET designer puts it back everytime you go into design view of one of the ASPX's.  It's ok for us...we don't really need the designer, but our client may want to use it.  They're new to .NET and might not understand what's going on, so why not make it so the whitespace is “ignored“.  This is quick and dirty so there's probably a better way...

Protected Overrides Sub OnPreRender(ByVal e As System.EventArgs)
If TypeOf m_Template.Content.Controls(0) Is LiteralControl Then
Dim Temp As String = DirectCast(m_Template.Content.Controls(0), LiteralControl).Text
          Dim Current As Char = CType(Temp.Substring(0, 1), Char)

While Current = Chr(9) OrElse Current = Chr(10) OrElse Current = Chr(13) OrElse Current = " "c
Temp = Temp.Remove(0, 1)
Current = CType(Temp.Substring(0, 1), Char)
End While

DirectCast(m_Template.Content.Controls(0), LiteralControl).Text = Temp
End If

End Sub

m_Template.Content is a PlaceHolder where all the controls of the form are place for the template.  All this code does is grab the first literal and remove whitespace at the beginning.  There's probably some RegEx that's better than this, but I'm no RegEx expert!  :P  After this code is inserted into my base Page class, it doesn't matter what whitespace is on each page, it will be removed so there's no spacing problem.  Hope someone gets some use out of this!  :)

[HumanCompiler - Erik Porter (.NET MVP) Blog]
4:31:15 PM    trackback []     Articulate [] 

Source: HumanCompiler - Erik Porter (.NET MVP) Blog

New Network.

I picked up the Microsoft MN-700 Wireless 802.11g Base Station Router and got it installed.  The management interface is fantastic and easy to use.  I seriously would've had it installed in 10 minutes if it wasn't for an error on my part (read the wrong MAC Address that my ISP requires me to use).  It was super easy to setup everything I need like Port Forwarding so I can TS into my box from work if needed.

It has 4 10/100 ports for your machines that don't have a wireless card in it (my main computer and my longhorn machine).  It's backwards compatible with 802.11b so I can still connect to it with my TabletPC which has that built-in and is specially made to talk with the wireless adapter for XBox!  :o

If you're going to be setting up a wireless network at home, this is my recommendation...awesome!

[HumanCompiler - Erik Porter (.NET MVP) Blog]
4:19:21 PM    trackback []     Articulate [] 

Source: How to Save the World


wo recent editorials by economists suggest that private sector accountants aren't the only ones tempted to inflate and misstate the numbers to please their bosses:

US Unemployment Rate is Actually 8%

An economist at the University of Chicago argues that the US government, under both Republican and Democratic administrations, has been playing fast and loose with unemployment numbers to make themselves look better. Not only is the real unemployment rate 8% and still rising, but with temporary and part-time work making up most of the 'new' jobs, there is little doubt that under-employment, which no government dare develop an accurate measure of, has now soared past the 50% mark.

Productivity Data Assume We're Neither Working Harder Nor Exporting Jobs

The senior economist at Morgan Stanley reveals that the reported jobless economic recovery, which Bush officials are so euphoric about, not only ignores the impact of massive "offshoring" of service jobs to cheaper third world countries, but also uses 'nonsensical' data on the average work week. The data assume that the average worker spends the same 35 hours a week working as s/he did a generation ago, which is demonstrably wrong. In fact one of the factors exacerbating the joblessness of the recovery is that employers prefer to pay (or cajole) their employees to work longer hours, double shifts, and large amounts of overtime, rather than search for, train and provide benefits to new workers and then, if sales fall again, lay them off and pay severance. As a consequence, the average work week, which is the denominator on which productivity data is based, is wildly understated, and hence productivity data are wildly overstated.


...And the Collapse of the US Dollar Portends Worse to Come

The two charts above illustrate that the free fall of the US dollar against other currencies (the chart against the pound and yen is similar) continues unabated. While the Bush regime, always reliably thinking short term, seems to see no harm in this, it poses disastrous longer-term dangers for both the US and world economies, as I've reported earlier. Watch for the Euro to replace the US dollar as the global currency standard within a few months. Then watch all hell break loose. The staggering Bush-created US debt, which is behind all this, is pushing us to global economic collapse.
[How to Save the World]
4:11:51 PM    trackback []     Articulate [] 

Crimes against Nature

I thought I was unhappy with President Bush before, then I read this article about the eviseration of the environmental laws by the current administration for the benefit of corporate polluters.

10:50:15 AM    trackback []     Articulate []