Permanently turning off Google Instant (update)

If anyone noticed, the Google instant configuration has now changed since the last time. Looks like it was very recent.

Before it was simply an on off switch, the setting of which sometimes Google remembered, but most of the time didn’t. Now you have more options.

Clicking on the gear on the top righthand bar will bring up this page…

Never, you bastards!

I don’t know if this time it would make any difference at all, but the last time, the setting only lasted as long as you didn’t use any other Google service (E.G. Gmail) and then logout.

It’s 3:09AM right now, so I’m not going to bother testing this. Let’s just hope that this time they took a hint from all the feedback.

Permanently turning off Google Instant

Don’t know about the rest of you, but I really do enjoy using the “Back” button. It helps me keep track of what I already searched and, in my old “almost 30″ age, I need to save my sanity as much as I can.

I put up with this for a long time now, but apparently all the new changes to the Google homepage came with an auto-falconpunchtogroin-reset feature.

I was going into the search settings and changing this, but if I check my Gmail, logout, and go back to a Google search, whatever settings I saved are all gone. It also seems to randomly change back at times.

So here’s the next best solution; instead of http://www.google.com, make the following your homepage URL instead :

http://www.google.com/webhp?complete=0

(Edit 12/22 : You can also use the Firefox start page instead which is much leaner and still be able to keep the autocomplete, which I did find useful at times.)

This way, you don’t have to bother with settings or punching your screen in frustration, which I have to be really careful about with my girly hands and all.

It strikes me as odd that a company that allegedly prides itself in “Dogfooding” (I.E. eating its own dogfood — a term used internally in the company when releasing new services and features) would find no one in the office that would consider this asinine in the extreme.

Also, I seem to be correct that this HTML5 trend is pushing more and more client-side scripting junk on the browser and Google among others are forgetting the fact that part of the reason it became famous (aside from search accuracy) was that it was simple.

Dev Team : Need more monkeys

Sorry we’re out. Will trap recruit more at next Developer Conference.

- Human Resources

And they think I’m grouchy on weekends for no reason. Let’s bring in some perspective, shall we?

Needed :

  • User management
  • Article management
    • Comment management
  • Discussion board
    • Forum management
    • Topic/Post management
  • Document management
    • Granular privileges/Edit restrictions

Most mortals will look at this list and think “Portal”. Well, that’s essentially what it is with some minor tweaks. It was for an intranet and the deadline is a week.

Are we using something off the shelf?
Nope.
Are we using something appropriate?
Nope.

Are we going to waste time/money/people (literally) trying to build something from scratch that will try to do things 10x longer than that list?
You betcha!

2 Programmers alone could have finished all of this in a day with time to spare for meals and coffee, but since we’re a “team”, I have to put up with the most inane BS ever to come out of an orifice… on a face. I feel lucky though, since I’m only handling data access, I won’t be dealing with the brunt of the feature flood though I’m sure I’ll have to write some OR/Mapper because “off-the-shelf” is “untrustworthy”. Yay me!

I swear, the vast majority of projects that fail are directly the result of bosses and project managers not knowing what the devil it is they are doing. I propose mandatory Ritalin® prescriptions for these people so we don’t get interrupted every hour by “Ooh shiny new feature. We must implement it!!”

I’ve been trying to convince people to stay focused for most of this year with no effect.

The next time you’re given a list of requirements and a programmer and/or project manager stands up to insist on a new feature before the core is complete, put him in a straight jacket and throw him out the window.

I will guarantee the liability and injury costs will be nothing compared to how much money will be saved by not having him aboard.

Disclaimer

Eksith Rodrigo isn’t actually a licensed lawyer, but he does know throwing someone out of a window in a straight jacket might constitute grounds for a lawsuit.

Reader discretion is advised.

Removing junk markup from web controls

As delighted as I am that Microsoft has courteously created a half-witted solution to their own problem markup, CSS Friendly control adapters (otherwise known as code-bloat), sometimes you just need to solve it yourself.

Microsoft considers it a favor, apparently, to stick <span>s <br />s and a myriad of other nonsense markup amid your carefully designed <itemtemplates> in web controls.

Solution : Roll out your own inherited control.

This example is for a DataList control, but the principle is the same for all other DataBound controls.

namespace DX.Controls
{
 [ToolboxData("<{0}:DXDataList runat=server></{0}:DXDataList>")]
 public class DXDataList : DataList
 {
  public DXDataList() { }

  public override void RenderControl(HtmlTextWriter writer)
  {
     base.RenderControl(writer);
  }

  public override void RenderBeginTag(HtmlTextWriter writer)
  {
     //base.RenderBeginTag(writer);
  }

  public override void RenderEndTag(HtmlTextWriter writer)
  {
     //base.RenderEndTag(writer);
  }

  protected override void Render(HtmlTextWriter writer)
  {
     base.Render(writer);
  }

  protected override void RenderContents(HtmlTextWriter writer)
  {
     foreach (DataListItem li in this.Items)
     {
        // Select each item inside and re-render
        li.RenderControl(writer);
     }
  }
 }
}

This should clean up most of the garbage. It will still leave a few <span> tags in there. Remember to set your DataList to TableLayout=”Flow” to keep things clean.

Now I need to find a way to type code on TinyMCE and not have it blow up.

Update 03/11

I recieved a few emails asking some questions about this code.

To use the code, you basically create a blank .cs file in your App_Code folder or compile one into the Bin directory via Visual Studio. I wrote the above code in Notepad and put it into the App_Code folder.

Just make sure to include the following directives before typing this code:

using System;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;

The Security and HtmlControls namespaces are there if you intend to use special permssions and other custom controls inside your inherited control. You will not need them for basic functionality.

To use the code, make sure you have registered this control on the top of your page or master page. In my case, since I’ve called my namespace “DX.Controls” :

<%@ Register TagPrefix="DX" Assembly="__code" Namespace="DX.Controls" %>

Now when I need to call this control on my page :

<DX:DXDataList ID="ContentList" runat="server" TableLayout="Flow" 
DataSourceID="[YourDataSource]"></DX:DXDataList>

Here is an example DataGrid class that has the same effect… This is handy if you want DataGrid functionality, but intend on creating all your controls yourself…

namespace DX.Controls
{
 [ToolboxData("<{0}:DXGrid runat=server></{0}:DXGrid>")]
 public class DXGrid : GridView
 {
   public DXGrid()
   {
    //
    // TODO: Add constructor logic here
    //
  }

  protected override void RenderContents(HtmlTextWriter writer)
  {
    base.RenderContents(writer);
  }

  public override void RenderBeginTag(HtmlTextWriter writer)
  {
    writer.WriteLine();
  }

  public override void RenderEndTag(HtmlTextWriter writer)
  {
    writer.WriteLine();
  }

  public override void RenderControl(HtmlTextWriter writer)
  {
    foreach (Control t in this.Controls)
    {
      foreach (Control c in t.Controls)
      {
        foreach (Control m in c.Controls)
        {
          foreach (Control k in m.Controls)
          {
            k.RenderControl(writer);
          }
        }
      }
    }
  }

  protected override void Render(HtmlTextWriter writer)
  {
    base.Render(writer);
  }
 }
}

If someone can please show me a way to type code on the WordPress text editor without giving myself a seizure, please let me know. Apparently disabling the WYSIWYG editor doesn’t work either.

5 Useless things, used often in web apps

Except for a select few, I get the feeling people use these, just because they are there. Even more-so than Microsoft cramming them down programmers’ throats. Let’s leave aside the fact that Microsoft encourages its developers to not think when designing (especially web) applications and instead use their own semi thought out solutions, why is it that developers have a tough time seeing these features for what they are? Useless bloat!

When I say useless, I mean for 80%-90% of cases out there, but still implemented as default because it’s a “Best practice”. I wonder if developers have an equivalent for a Kuik-E-Mart guru who lives on top of a mountain where they get this information.

And without further ado :

ApplicationName

This little menace causes more trouble for developers and end users than any other “feature” in ASP.NET 2.0+. Why is it there? What’s the point? Aren’t the vast majority of users more likely to have just one application.  And why can’t the existing apps use the root virtual path (“/”) when not specified? Because the programmers who wrote it believe their users will have multiple web apps running on multiple virtual directories.  Which is not the case, as most of us living in the real world would know, with many if not most web hosts.

What’s worse, Visual Studio and Web Developer Express insist on creating your test run on a virtual directory (which is a pain to get rid of in Visual Studio), that will obediently be used by all the default SQL providers. Then you have the delightful emails claiming “your program doesn’t work” because you forgot to change the applicationName in the web.config or they forgot to change it back.

Aren’t you more likely to use a seperate database for your web app anyway? Do we even need an ApplicationID in our database?

AJAX

“What? They’re using their own libraries? You say, they work across all browsers and Operating Systems? And they don’t need to be installed, just uploaded and called on a few pages? And they’re 1/8 the size of our code?! The bastards!!! We’ll show them!! From now on all ASP.Net pages will have AJAX by default!”

GUID

Giant Ugly Interfering Demon, also known as a Globally Unique Identifier, which doesn’t even make sense since it isn’t global anyway or, for those of us who realized the Internet existed before IIS, UUID (Universally Unique Identifier).

The only conceivable use for this thing is when you have to replicate your database across multiple servers. But since most of us are content with one database on one server, why is this monster forced down our throat? All it does is add extra complexity to the Data Access Layer.

Even MySQL doesn’t have to put up with this kind of nonsense.

I had to salvage a botched application for a non-profit organization recently, and I couldn’t imagine the level of garbage that was introduced into the DAL. The previous programmers allegedly “rescued” this program from SQLite (ironic, since I consider SQLite to be a far superior product in many ways than almost all of the free and non-free products out there) and converted it to SQL Express.

Here’s a little food for thought…
I need a way to uniquely identify a user.  The users will have a unique ID and a unique user name.  As such, the user name will be matched against the database to see if there are any duplicates. The ID will always be harder to remember than the user name as it is globally unique and non-incremental. The ID will never be referred to in the open anywhere in the web app (I.E. /users/username.aspx).  Other users can, thus, type the URL into the browser manually, if they are unsure and the app will search the DB if there are no exact matches. Are both of these two things necessary or only one?

Stored Procedures

As all true achievers would know at this point stored procedures are bad m’kay? But what do all default SQL providers that come with ASP.NET use?

There’s a time and a place to use any tool. Grandma’s cooking recipe page (as adapted from the Personal Site Starter Kit) is not one of them.

CSS Friendly Adapters

OK, I’ll give you a moment to collect yourself from the belly laugh at seeing “CSS” in a Microsoft product.
Instead of pumping you full of menial rage, I’ll give you a small sample of the output generated by the “CSS Friendly” portion…

<div class="AspNet-DetailsView-Data">
  <ul>
    <li class="AspNet-DetailsView-Alternate">
      <span class="AspNet-DetailsView-Name">Title</span>
      <span class="AspNet-DetailsView-Value">
        <input name="ctl00$ContentMain$DetailsView1$ctl02" type="text" title="Title" />
      </span>
    </li>
    <li>
      <span class="AspNet-DetailsView-Name">Description</span>
      <span class="AspNet-DetailsView-Value">
        <input name="ctl00$ContentMain$DetailsView1$ctl03" type="text" title="Description" />
      </span>
    </li>
  </ul>
</div>

Notice any <label> or <fieldset> tags? Notice any class name shorter than 20 characters?
I didn’t think so. Goodbye accessibility, hello “CSS Bloat”… er… I mean “Friendly”.

Here’s the same code as rendered properly

<div class="DetailsView">
  <ul>
    <li class="Alt">
      <label>Title
        <input name="Title" type="text" title="Title" />
      </label>
    </li>
    <li>
      <label>Description
        <input name="Description" type="text" title="Description" />
      </label>
    </li>
  </ul>
</div>

I might as well have written a custom control from scratch.

Man, I miss Notepad so much!

…………………………

I’m thinking about creating a simple framework for web apps that don’t use any of this nonsense and releasing it into the Public Domain. If anything, it will at least help out some people who want to start fresh and free from the above plagues. Honestly, I don’t even care if anyone gives me credit. I just don’t need another heart attack from wading through all this garbage.