Skip navigation

Category Archives: Uncategorized

I have been simply trying to find out what the cost of a Comcast, Internet-only, package would be for a good 30 minutes now. I find it quite interesting that they would make the decision to more-or-less hide information from existing customers trying to find pricing for their services. I remember before they did the re-design, I was able to find pricing information on their services, narrowed down to my area, and compare everything in a nice matrix…So, it was all in plain site before, and now it’s almost impossible to find? Kind of odd…

After doing some digging, and running my browser through a few different proxy servers, I’ve found that they are not allowing customers who are coming from an existing Comcast connection to view the pricing information for anything up-front, but rather will only show them pricing if they attempt to add a service to an existing account. They also don’t allow you to “downgrade” a package online either once you’re in this part of the site, which is quite funny since you can definitely “upgrade” said packages. (I also tested signed-in vs. signed-out vs. clearing cookies, cache, restarted browser, etc. to make sure they couldn’t know who I was before-hand as well)

To me this wreaks of a poor way of trying to not only hide factual pricing information from customers so they can’t compare pricing to the other competitors, but also getting people “just far enough along” that they’ll have to call  Customer Support to wrap things up, and in-turn have a chance to attempt an up-sell for a bunch of different packages (phone, then cable, then home security, then internet security, etc.) and wasting the customer’s time since they already know what they’re calling for at this point.

Could be poor web design, could be a bad business decision, could be both, who knows…I’ll let the people reading this decide.

Advertisements

I just wanted to share a workaround I found in dojo 1.6 for the uploader. My page is pretty complex in that it has a bunch of nested border containers and a tab container within a border container. The way I was including it in my template was like this:

 <input data-dojo-type="dojox.form.Uploader" data-dojo-props="label: 'Select a File'" data-dojo-attach-point="uploadNode" />

When I included the Uploader as a part of the template for one of my widgets, some odd things were happening. First off, the button was sized very oddly. It was taking up the entire width of the screen. Also, in flash mode (IE), clicking on the button did nothing. After playing around with it for a few hours, I decided to try adding the widget during the startup event of my widget like so:


    this.uploader = new dojox.form.Uploader({ 
        url: admin.rootUrl + "admin/cmsResource/uploadFile", 
        multiple: false, 
        label: "Select..." 
    });

    this.uploadContainerNode.appendChild(this.uploader.domNode);

This has solved the problem, now the uploader is sized properly and works just fine in IE!

I found a way to disable the infinitely annoying web development server that pops up for those of us who use IIS to develop ASP.NET applications. I often attach to the w3wp.exe process in order to debug my MVC controllers and whatnot and I always get a million little tray icons for the stupid web development server.

Now, I’m sure many people know you can click into the properties of each individual web application and set the project to run in IIS, or a custom web server. If you configure a project so that visual studio knows it’s an IIS application, visual studio becomes even more annoying. If you open a project that hasn’t been mapped in IIS it will bug you until you do it, and if you don’t the project will be unloaded. I say, screw you Microsoft, let me do my job. I know what I’m doing.

Now that I’ve gotten the rant out of the way, on to the solution. All you have to do is:

  1. Select all of the web projects in your solution.
  2. Open the properties pane if you don’t already have it open.
  3. Change the option “Always Start When Debugging” to false.

That’s it, say goodbye to 15 million development server icons in your tray.

For whatever reason…the GNOME people decided that menu / button icons were a usability problem.  I feel the opposite way.  I think the menu / button icons are absolutely a must have for usability. Icons make certain menu items stand out immediately.  The interface tab has now disappeared from the Appearance app in GNOME which means you have to manually enable the options to display icons.  This is easily done, just run gconf-editor in either the terminal or if you’re smart you have Gnome Do.

Once you’re there, navigate to Desktop -> Gnome -> Interface.  Check off buttons_have_icons and menus_have_icons.  These settings take effect as soon as you check off the options.  Enjoy.

I have been working with LINQ quite a bit for a contract I am working on.  And I have to say I’m not impressed.  I think Microsoft has continued to make poor decisions with the .NET framework.  Although I like the idea of a simple to use query language / ORM (Entity Framework), there are a number of problems.

  • The documentation is absolutely horrible.
  • It can be rather difficult to get the query language to do what you want it to do.
  • Exception messages are misleading and not informative.

I am originally a .NET guy.  I started my professional career working with C# and I really liked it.  Recently, I made the switch over to Java.  I liked the idea of Java because there is such a great open source community that has turned out a lot of really excellent and re-usable code.  In the open source community, the documentation is, in general, excellent.  Microsoft’s documentation has always been piss poor because how else would the publishers sell books?  In open source world, there are books available, but the documentation is usually sufficient.

I have run into a number of situations where the query language is very difficult to work with.  Specifically with reporting type queries where you’re getting into sub-selects.  Again, if the documentation were better I probably would have found a decent solution to my problem quickly.

My biggest trouble with the whole thing is when there is a problem and an exception is thrown, the messages are horrible.  For instance, I created a quick class to import some data from tab delimited files.  I set up some new data models and created my tables.  I gave the code a shot and I received an exception with this vague message: “System.Data.Linq.ChangeConflictException: Row not found or changed”.  All I can think of is “PC Load Letter, WTF does that mean?”  It turned out that one of my columns in the model design didn’t have the same data type as the column in the database.  Come on M$, how does that message make sense for that problem?  If it weren’t for someone else having that same problem in a forum, I could have lost HOURS hunting around trying to figure that out.

Again, I am a Java guy.  I am used to Hibernate which has been around for a while and is rock solid.  I feel like the open source community comes up with much better solutions compared to Microsoft.  Everything they do is always very specific, always a black box with very little insight, and generally has all kinds of annoyances that make the thing a pain to work with.

EDIT: Another thing…there is no way to batch insert.  Inserting seems to take far longer than it should…something that would take mere minutes with Hibernate / MySQL is going on an hour with LINQ / SQL 2005.

System.Data.Linq.ChangeConflictException: Row not found or changed

While we’re waiting for Firefox 4.0, which will bring significantly better compatibility with Windows 7, the Strata40 theme combined with StrataBuddy will make your Firefox 3.5/3.6 look pretty with Aero.  It is the best theme available for the current version of Firefox in my opinion.  StrataBuddy lets you customize the theme to your liking.  Check out the screenshot below.  Links are posted below the image.

The Strata40 theme makes Firefox look pretty on Windows 7!

Strata40 on Windows 7

Get the Strata40 theme

Get the StrataBuddy plugin

P.S. I didn’t mention Vista because Vista is CRAP.

I recently added functionality to the CMS I’ve been working on for my company.  It allows us to enter GSP tags into the content that is being posted to our Grails website.  These tags would then be properly rendered through Grails.

After searching around for hours, I thought I had found a solution to pass a string through the grails template engine:

new GroovyPagesTemplateEngine().createTemplate(attrs.templateString, “somepage.gsp”).make(attrs.model).writeTo(out)

This works great for our ${} style tags, however it does not work for anything in a tag library.  Again, I went to google and I could not find anything!  Finally, I found an obscure post describing how to build e-mails using GSP.  There isn’t any explanation as to how the template engine is acquired, but it seems to work.  In your tag lib, or controller create a member variable:

GroovyPagesTemplateEngine groovyPagesTemplateEngine

It seams as though you have to name it exactly as it is above.  You can then call the same method as before:

groovyPagesTemplateEngine.createTemplate(attrs.templateString, “somepage.gsp”).make(attrs.model).writeTo(out)

And bam, all of your tag libs are referenced properly!  Also, you can put whatever you want in “somepage.gsp”.  It doesn’t seem to matter.  However, I would assume for performance purposes, if the template is expected to be the same, make sure the page name is the same (so that grails can do its internal caching magic).

I’ve been working recently on a project that heavily relies on Hibernate.  I’ve learned a ton about Hibernate in the past few months.  Hibernate is excellent, it really saves a ton of time when it comes to dealing with data object persistence.  However, it can be difficult sometimes to get it to work exactly the way you want it to.

Some of the more advanced mappings are not quite as simple as the documentation, and even the excellent book Java Persistence with Hibernate will have you believe.  For instance, mapping Map collections properly.  The cleanest way to manage a collection of child objects is like this:

Parent parent = new Parent();

Child child = new Child();

parent.getChildren().put(“someChild”, child);

HibernateUtil.getSession().save(parent);

This works very well (with cascade = all) by default.  In order for the above example to work, the collection has to be mapped with the “inverse = false”.  The inverse flag is a matter of some confusion.  It simply tells Hibernate who will control the relationship between the parent and the child.  If inverse = false, the parent is the master, if it is true the child is the master.  This means, if the child is the master, the parent property MUST be set or the relationship will not be persisted, even if you add the child to the parent’s children collection.  If the parent is the master, the object must be added to its children collection, or the relationship will not be persisted.  Underneath it all, the inverse flag manages how the queries during inserts and updates are written.

The problem occurs when deletion of children needs to be managed as well.  Add this bit of code to the above example:

parent.getChildren().remove(“someChild”);

HibernateUtil.getSession().save(parent);

In order for this to work, the cascade option needs to be set to “all-delete-orphan.”  This instructs Hibernate to delete the children if they no longer belong to the parent.  An important thing to note is: if the collection is mapped with inverse=”true” all-delete-orphan DOES NOT DO ANYTHING.  This is something that I did not see in my reading (although I’m sure it’s there somewhere).  When the collection is mapped with inverse = true, you need to set the child’s parent property to null, or manually delete the object.

If you are using inverse=false, you may run into a weird issue with all-delete-orphan.  If your child’s parent foreign key relationship is set to not allow null values in the database, you will receive errors like “ParentFK cannot be null.”  This is because prior to deleting the child object Hibernate executes a query like this: “update Children set ParentFK = null where ChildID = 99;” .  Why it does this is beyond me.  However I do know how to fix the issue.  What you have to do is set the map’s key column to not null, and set update = true.  Then, in the child mapping, set the parent many to one to not insert or update.  You will need to do the same for the index of the map mapping.  Here’s what the mappings should look like:

<map name=”children” cascade=”all-delete-orphan” inverse=”false”>

<key column=”ParentFK” not-null=”true” update=”true” />

<index column=”Name” type=”string” update=”true” />

<element type=”Child” />

</map>

The child’s parent property should look like this:

<many-to-one name=”parent” column=”ParentFK” class=”Parent” update=”false” insert=”false” />

<property name=”name” column=”Name” updated=”false” insert=”false” />

This will get rid of the nasty issue of Hibernate trying to update the foreign key to null before it deletes children.  Another problem I ran into with map collections is when the index property for the child object did not exist on the child iteself, but on an object that the child references.  To fix this, all you need to do is change the index to a map-key, and use a formula like so:

<map name=”children” cascade=”all-delete-orphan” inverse=”false”>

<key column=”ParentFK” not-null=”true” update=”true” />

<map-key column=”o.Name” type=”string” formula=”(select o.Name from Catalog.OtherObjects o where o.OtherObjectID = OtherObjectFK)” />

<element type=”Child” />

</map>

Notice I included the catalog name before the table name, this is required if you do not select a default database in your hibernate configuration (I do this because we have multiple databases which our objects are stored in).

Well, hopefully these findings are helpful to others.  I’m sure they are not original, but I had a hard time digging this information up online.  As a matter of fact I did not find this information anywhere out there surprisingly.  I had to piece it together by going through the documentation and running unit tests.

If you are looking for a simple, easy to use and configure web framework for Java, Grails is the way to go.  I spent a ton of time looking around for Java web frameworks and I landed on Grails.  I am in the process of rebuilding my company’s public facing website as well as their intranet.  Because the two sites need access to the same data, I decided to build a common class library which handles all data access.  Although Grails is meant to handle all mapping and data acess for you, it was pretty easy to work in my existing data access project.

The first thing I would like to note about Grails is that there is virtually no configuration.  You will have to edit one or two configuration files if you want to customize certain aspects of the application, but unlike other frameworks, there is ZERO xml configuration.  I have run into a number of challenges as my website, like all websites, has a bunch of unique features.  Due to the excellent documentation for Grails I have had little to no trouble overcoming these challenges.

Because my application uses it’s own set of class factories, I was not able to simply drop my hibernate.xml.cfg and mapping files into grails.  I need to have complete control over how the objects are loaded and saved to the database.  This meant I would need something similar to the OpenSessionInViewFilter.  The problem with adding a fitler is that I didn’t want to open up sessions for every request, just requests that needed acess to the data.  After reading through the documentation I found that Grails has support for controller filters, here is a simple way to open up and close sessions for Hibernate in a grails filter.  Drop a file named HibernateFilters.groovy into the grails-app/conf directory:

public class HibernateFilters {
def filters = {
ensureSession(controller:’*’, action:’*’) {
before = {
HibernateUtil.getCurrentSession().beginTransaction();
}

afterView = {
HibernateUtil.getCurrentSession().getTransaction().commit();
}
}
}
}

Between tag libraries, templates and layouts, building UI in a Grails application is a breeze.  The UI code is so clean because of the way the rendering engine works.  There is no need for server side code in the views (although it is possible to put it there).

AJAX support is excellent in Grails.  It solves the common problem of rendering of UI on the server side as well as the client side.  It is simple to render a template or view and return it in an AJAX call.  This is huge, becuase you won’t find yourself writing the same UI code twice.  In my experience with .NET this was one of the most frustrating parts of building AJAX applications.  Also, Grails makes it really simple to render JSON and XML.  You can simply use “as JSON” or “as XML” in your render calls.

All in all, Grails is a quick and easy to use framework that provides all the tools a web developer needs to build a rich and dynamic web application with minimal headaches.  Out of the frameworks I’ve used (ASP.NET, CakePHP, Wicket, Tapestry), Grails is definitely at the top of the list (followed closely by CakePHP).

Check out the official grails website.

Recently I was tasked with building a pretty smiple CMS for my companie’s websites.  The major problem I ran into was picking a rich text editor that is easy enough to use with dojo.  There are a number of choices out there, but every single one has major problems.  These major problems include: cost, bugs, eas of use etc.  For instance, FCK is free, but it has a number of bugs.  TinyMCE is free as well, but it doesn’t play nicely with dojo.  Dojo has a built in rich text editor, but from what I understand building plugins for it is an absolute nightmare.  There are a ton of other free ones out there, but a lot of them seemed like they didn’t have very large user bases or very good support.

I decided to go with TinyMCE because it has a wide set of features and the plugins seem easy enough to develop.  The problem with TinyMCE at first glance was it didn’t look like it’d be easy to use with dojo.  The documentation is pretty poor in that it doesn’t have many examples.  I struggled for hours trying to find an example that would allow me to create a TinyMCE editor on the fly.  Finally (no thanks to the documentation), I came up with this:

dojo.provide("my.widgets.RichEditor");

dojo.require("dijit._Widget");
dojo.require("dijit._Templated");
dojo.require("dijit.form.Button");
dojo.require("dijit.form.TextBox");

dojo.declare("my.widgets.RichEditor", [ dijit._Widget, dijit._Templated ], {
	templatePath :dojo.moduleUrl("my", "widgets/layout/RichEditor.htm"),
	templateString :"",
	widgetsInTemplate :true,
	width: 600,
	height: 400,
	editor: null,
	value: "",
	editorNode: null,
	initialized: false,

	postCreate : function() {
		this.inherited(arguments);

		var ed = new tinymce.Editor(this.editorNode.id, {
			theme: "advanced",
			plugins : "safari,spellchecker,pagebreak,style,layer,table,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,media,searchreplace,print,contextmenu,paste,directionality,noneditable,visualchars,nonbreaking,xhtmlxtras",
			theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect",
			theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
			theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
			theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,spellchecker,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,blockquote,pagebreak,|,insertfile,insertimage",
			theme_advanced_toolbar_location : "top",
			theme_advanced_toolbar_align : "left",
			theme_advanced_statusbar_location : "bottom",
			theme_advanced_resizing : true,
		});

		setTimeout(function() { ed.render(); }, 50);

		this.editor = ed;
		this.editor.onInit.add(dojo.hitch(this, function() {
			this.initialized = true;
			this.setValue(this.value);
		}));
	},

	setValue: function(value) {
		if (this.initialized) {
			this.editor.setContent(value);
		} else {
			this.value = value;
		}
	},

	getValue: function() {
		if (this.initialized) {
			return this.editor.getContent();
		} else {
			return this.value;
		}
	},

	destroy: function() {
		this.inherited(arguments);
		this.editor.destroy();
		tinyMCE.remove(this.editor);
	}
});

That is a dojo widget that allows you to use TinyMCE.  I haven’t been brave enough to try and load the TinyMCE js on the fly, I will have to try that one later on…