Web Design Nottingham Header
Web Design RSS Feed

Agilis Software Blog

Current Work

Wednesday 16 July 2008

Agilis are in progress with a few websites currently. These are mostly utilising .NET 3.5, which has shown a marked improvement in time taken to build the sites which in turn has reduced our lead times and costs.

Once dynamic data has been officially released we will aim to incorporate this into our new websites.

We are also finishing off a windows application for the malachi trust which is in testing currently. This project utilised sql CE 3.5 along with linq.


Linq and Paging

Friday 27 June 2008

Whilst working on a website, we had to implement paging on a list of images, so you could browse thumbnails. The list of images is never going to be very large, so we wondered if we could utilise Linq to achieve this.

We first created a repeater with an image in the ItemTemplate, something like this:

<asp:Repeater ID="Repeater1" runat="server">
    <ItemTemplate>
    <img src='Uploads\Thumbs\<%#Eval("Thumbnail") %>' width="100" />
    </ItemTemplate>
</asp:Repeater>

We then found some nice Linq features (Skip & Take). These allow you to skip the first number of items and take the specified next items. We stored the current index in ViewState and then bound the repeater to Linq code like this:

using (DataClassesDataContext context = new DataClassesDataContext())
{
            List<Portfolio> portfolios = (from p in context.Portfolios
                                                 where p.IsVisible == true
                                                 orderby p.Priority descending
                                                 select p).ToList();

            IEnumerable<Portfolio> ports = portfolios.Skip(int.Parse(ViewState["skip"].ToString())).Take(pageSize);

            this.Repeater1.DataSource = ports;
            this.Repeater1.DataBind();
}

We have further added to this code by disabling/enabling the navigation buttons at appropriate points. We would not recommend this solution for large collections as it is in memory paging which will not perform as well as SQL paging, but for small collections it works great as a quick solution.

As a further addition we wrapped the repeater and navigation buttons in an Ajax update panel, which gives the user a better experience as no postbacks happen when the user pages the images.


Freetextbox image upload

Thursday 19 June 2008

We have utilised freetextbox as a tool for our bespoke content management systems for a number of years now.

One issue we had involved the image gallery control that enables you to upload images to the server and reference them in freetextbox, it does not physically resize the image. This meant that novice users would sometimes upload 2MB images and the resulting page that was displayed took a long time to download the images.

Thankfully we found an alternative image upload component on the freetextbox forum that allows the user to specify the size of the image and the control will resize the physical image.

This was good but the resize wasn't done using a good interpolation mode which results in poor quality images like this:

clip_image002.jpg

Therefore, we altered the source code to resize the image using High Quality Bicubic interpolation, which produces better quality like this:

clip_image002s3.jpg

We also only allow the user to specify a width or height for the image as the resultant image should retain the aspect ratio. The code below does the resizing. I will upload all the files in a few days.

Note there seems to be a bug with the high quality bicubic resize as it leaves a black line on the top and left of the resultant image, I got around this by starting at -1,-1 on the redraw (System.Drawing.Rectangle(-1, -1, width + 1, destHeight + 1)).

private System.Drawing.Bitmap MakeImage(System.Drawing.Bitmap bmOrig, int width, string savePath)
{

int destHeight = bmOrig.Height * width / bmOrig.Width;

System.Drawing.Bitmap bm = new System.Drawing.Bitmap(width, destHeight,

System.Drawing.Imaging.PixelFormat.Format24bppRgb);

bm.SetResolution(bmOrig.HorizontalResolution,

bmOrig.VerticalResolution);

System.Drawing.Graphics grPhoto = System.Drawing.Graphics.FromImage(bm);

grPhoto.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;

grPhoto.DrawImage(bmOrig,

new System.Drawing.Rectangle(-1, -1, width + 1, destHeight + 1),

new System.Drawing.Rectangle(0, 0, bmOrig.Width, bmOrig.Height),

System.Drawing.GraphicsUnit.Pixel);

grPhoto.Dispose();

bm.Save(savePath);

return bm;

}


Dynamic Data

Monday 16 June 2008

90% of bespoke software we create at Agilis often involves the mundane task of  creating CRUD operations on multiple database tables. This has been helped largely by Linq2Sql, which I mention in my previous post:

http://www.agilissoftware.co.uk/WebDesignNewsItems.aspx?newsid=22

This has helped in minimising the time taken to map our relational database into our OO coding model.

Unfortunately, we still have to create admin screens which manage the objects and perform the CRUD operations. We have standard CSS templates we use now and it has almost become second nature, but it still takes time better spent on implementing the logic of the project. So it is great news to hear that Microsoft are releasing something called 'Dynamic Data'. This will essentially take your LINQ2SQL mapping class and build web pages to manage the entities.

It will also put validators on fields if they are nullable and by default not show foreign/primary keys as well as provide hooks and integration points. All of this logic can be altered and you can give dynamic data templates to use for each data type. This will save us a lot of time in implementing admin screens to manage our data models.

Instead of providing a run-through, it is better to look at the folllowing blog which provides good examples as well as a more detailed overview.

http://weblogs.asp.net/scottgu/archive/2007/12/14/new-asp-net-dynamic-data-support.aspx

We are hoping this kind of RAD development will enable us to be more cost efficient on bespoke small-medium sized software projects


Back from holiday

Thursday 12 June 2008

Its back to work after a lovely break in Portugal. Agilis have won a couple more website projects and are quoting on two large projects for us. I will post more information shortly, when I get back into work mode.

On another point, SP1 for Visual Studo 2008 will be available this summer. Check out Scott Guthries blog for the exciting new features:

http://weblogs.asp.net/scottgu/archive/2008/05/12/visual-studio-2008-and-net-framework-3-5-service-pack-1-beta.aspx


1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |

Is Domain Available?

  www.
 

Quotes

"Excellent service, at an affordable price. Thank you."
Sue Baxter (Director) - Internet Gardener

Latest Projects

Angel Wings web design Labarde web design Internet Gardener web design ECFG web design Build Investment Jewellery web design

Developer Certifications

MCTS logo MCPD logo

Partners

Comodo logo protx logo

Coding Standards

XHTML CSS

Agilis Software Limited | 25 Shandwick Close, Arnold, Nottingham. NG5 8AZ
Registered in England No. 5688723. VAT No. 886 4538 70
Tel: 07973 766989
Email: enquiries@agilissoftware.co.uk