Andrew MacNeill - AKSEL Solutions

Sunday, November 23, 2008

Hardware choices

I'm in a quandry (and not because I haven't posted in a while - I have a number of posts in draft form that need to come).

I'm looking at new machines but I'm unsure. Do I invest in a better server to handle better VMs and possibly Hyper-V and then simply RDP into it when needed or do I look at a laptop for more VPCs?

Ideally it would be both - but economics these days limit the potential. Server hasn't been upgraded for 4 years (Dell SC400) but neither really has the laptop (Dell5150)

Platform doesn't matter these days. Thoughts?

Labels:

Saturday, November 01, 2008

DevExpress Controls: Creating Characters Counters for Memo / Text boxes

I had to do this for a client so I thought I would share it. It uses the DevExpress ASPxGridView and Editor controls in an ASP.Net solution.

Here's some code to create a character counter for your text/memo boxes.  It's fairly common with regular javascript but it can be tricky with custom controls.

I used KeyUp because TextChanged only fires when you LEAVE the control.

Also note the use of GetText() to get the content. I struggled (stupidly!) with this trying to use the javascript text property.  The ASPxEditor javascript controls have their own javascript methods. GetText and SetText. (if you want to get scared, look at the amount of javascript that is generated when using an ASPxGridView control on a form)

<dxe:ASPxMemo ID="txtInfo" runat="server" Width="100%" Height="76px">
                <ClientSideEvents KeyUp="function(s,e){
                var ele = s.GetText();
                lblInfo.SetText(ele.length + '/4000 characters left');}" />
                </dxe:ASPxMemo>
<dxe:ASPxLabel ID="ASPxLabel1"  ClientInstanceName="lblInfo"  runat="server" Text="(maximum 4000 chars)">
                </dxe:ASPxLabel>

 Hope you find it useful. Here' s a link to my forum post.

 

HowTo: JavaScript Character Counters for Memo / Text boxes - Developer Express Inc.

Sunday, October 26, 2008

Super Useful Tips on Using DevExpress ASPxGridView

I've been using DevExpress's ASPxGridView on a fairly big ASP.Net project for the past few months. When I started using it, I was really frustrated. The documentation was written more like a class reference guide and the tutorials were fairly basic in nature.

The real MEAT of the controls didn't seem to be there - all this great potential but where?

The Community forums was a great place to look for details but as with many communities, it's hard to find all the answers. 

Hopefully, this post will help identify some of the areas where developers may be having some problems:

Fixing Edit Forms
1. Edit Form Column Layouts
The ASPxGridView lets you do direct "form" editing but when you first do it, the boxes usually go two per line. To resolve this, add
                              <SettingsEditing EditFormColumnCount="1" />
right under the grid definition.

2. Changing Edit Captions
You have a column that is titled Years but in the edit form, you want it to say "Years working for company". Within the column definition, add
<dxwgv:GridViewDataTextColumn FieldName="Years" Caption="Years"/>
          <EditFormSettings Caption="Years working for the company " />
</dxwgv:GridViewDataTextColumn>


Grouping Grids
The ASPxGridView lets you group the grids automatically.

1) Call grid.ExpandAll( ) right after the DataBind (or the Page_Load) to automatically open the groups (by default, they are closed)

2) The Group header starts by showing the name of the Group a colon and then the name. In the Grid definition, add"
Settings-GroupFormat="{1} {2}"

Commands
One thing I didn't like about the Grid View was that it would add New/Edit/Delete buttons on each row. Why show New on each one? I originally put a hyperlink on the top of the grid but instead, I've started to use the HeaderTemplate option instead.

Here's my initial Column set:
                    <Columns>
                        <dxwgv:GridViewCommandColumn VisibleIndex="0">
                            <NewButton Text="New" Visible="false">
                            </NewButton>
                            <EditButton Text="Edit" Visible="true">
                            </EditButton>
                            <DeleteButton Text="Delete" Visible="true">
                            </DeleteButton>
                            <HeaderTemplate><dxe:ASPxHyperLink ID="lblNew" runat=server Text="New" Font-Underline=true Cursor=pointer><ClientSideEvents Click="function(s,e){officers.AddNewRow();}" /></dxe:ASPxHyperLink></HeaderTemplate>
                        </dxwgv:GridViewCommandColumn>

The end result looks like this


Grid Form Validation
You can easily make a field mandatory in a grid by setting the IsRequired property to true. But there are two gotchas with this. By default, this puts a little exclamation mark by the field when you hit the Update button. The ErrorText property is then put into the tooltip.

Set the ErrorDisplayMode property to Text instead of the default which is ImagewithTooltip.

Another way to better manage this process is to put the validation settings directly into the code instead of the property settings.

loCol = grid.Columns(0)

            With locol.PropertiesTextEdit.ValidationSettings
                .RegularExpression.ValidationExpression = regexp
                .ErrorDisplayMode = DevExpress.Web.ASPxEditors.ErrorDisplayMode.Text
                .RegularExpression.ErrorText = msg
                .RequiredField.IsRequired = True

            End With

The above code also shows one of the other cool tips - instead of trying to validate the text after, by setting the ValidationExpression property, the input can be immediately validated via Regular Expression.

Column Widths
By default, the ASPxGridView will resize the widths based on the content. Some of our users found this disorienting when they edited the grid - because it would constantly change. Solution? Explicitly set the widths of each column.

I'm sure there are a lot more and some of the above are likely pretty obvious but I wish I had known about them when I first got started. I'll be adding to this post (or creating new ones) as I move forward.

The other cool part about devExpress is that a number of their developers are on Twitter, making it easier to find them and get help.

Labels:

New Rule: Don't develop with Fingerprint Reader!

Who would have thought developers fingers could cause crashes?

I was working with my VS 2008 ASP.Net application and added some javascript to my default.aspx page when I started to get TypeLibBuilder crashes. WTF? Maybe it was my code --- maybe there was something going on in VS 2008 that I was missing. I shrugged and continued - because after all, when you get weird Windows crashes and you're working on a project, you do the obvious: restart your machine, pray to the Seattle gods and continue on your way.

Then I searched for it -

Big Problem Solved - No More TypeLibBuilder.exe Crashes!

Whoa! Killed DpAgent.exe in my Task Manager and no more errors.

Apparently my new MS Fingerprint Reader doesn't like JavaScript! Who knew?

Labels: , , ,

Saturday, October 25, 2008

FoxShow #59: Profiling and Refactoring

The latest episode of The FoxShow features one of my sessions from Southwest Fox 2008: Profiling and Refactoring, a discussion on how to refactor and how the VFPX Code Analyst can help.

This session was given twice : this was the second time around. It was a good discussion including a back and forth on the benefit of comments. I, of course, took the controversial position that all comments should be banned from code except when they explain WHY something was done.

Labels: , , , , ,

Thursday, October 23, 2008

The Fox Index

Here's a fun little piece from Southwest Fox 2008 where Ken Levy floats the idea of the Fox Index, a great use of those remaining copies of Visual FoxPro and then of course, Craig Boyd takes it one step further.



Labels: , , , , ,

FoxShow Extra: Morning discussion with Alan Stevens on Agility

One of the great things about Southwest Fox was the open discussions that were had almost every minute. Thankfully, some discussions and "discussers" let them be recorded.

Here's a discussion Alan Stevens and I had one morning about his sessions on Agility and Ignorance as well as XML handling - a little FoxShow extra. It's short (about 16 minutes) but fun.

Enjoy!

Labels: , ,

Tuesday, October 21, 2008

Looking for VFP work?

If you're in the market for working full-time for a vertical market (transportation industry) company with a product family written in VFP 9 with lots of add-on modules (http://www.mtihorizon.com), and a migration path to SQL Server, drop me a line at amacneill @ meltech.com.

Will: communicate with customers regarding support problems, develop new solutions based on client needs, enhance product in both VFP and web environments

Requirements: VFP 9 experience, enthusiasm, good OOP background, DBF/SQL
Nice to have: C#, web development, EDI experience, mobile communication, transportation industry

Location: anywhere but need to be available during the regular day (EDT) - we do lots of remote stuff (thank you SourceOffSite!)

If interested, drop me a line at amacneill @ meltech.com.

Monday, October 20, 2008

A Little Performance Art...

A little performance art piece from Southwest Fox...(if it says unavailable, it's still being processed)




Labels: , , , , ,

Saturday, October 18, 2008

SWFox: Evil Mastermind Wins Again!

One of the great sponsor giveaways at Southwest Fox was a 5-user license of SourceGear's Fortress. I've used Vault and Fortress but still stick with Source OffSite as our main development is handled through SourceSafe. Both work great with VFP. But the best part was in the conference bag: Evil Mastermind 2nd Exciting Issue!

Best quotes:
"You're a sales guy...if anyone understands evil, it's a sales guy"

"I want...I want...I want....and I want 5000 t-shirts!"

"We've got lots of masterminds using our products...I'm sure at least some of them are a little bit evil...I guess"

Kudos to Eric and the SourceGear team for another fun issue and great job, Southwest Fox team (was that you, Rick?) at getting the great swag!

SourceGear | Fortress

Labels: , , , ,



 
milf big naturals cumfiesta mike's apartment