Fremus.co.za

Demistifying Life and Web Development

Archive for the 'Web Development' Category

using System.Web.UI.DataVisualization.Charting;

Ok so I recently got a request to do a project that uses all kinds of pretty charts, and initially the development team wanted to use Open Flash Charts, but the developer I was working with on the project was on leave for two days and in that time I decided to check out New ASP.NET Charting Control: . First thing you need to do is download the free Microsoft Chart Controls and install that on your machine. Note that once installed it creates a folder under Program Files called Microsoft Chart Controls, with another folder called Assemblies under that, which contains DLL’s for both web and application. Once you have installed Microsoft Chart Controls you can choose to add the VS 2008 add-on if you are going to be doing web-forms development, but if like me you use a lot of web services and AJAX, you may not need it. So how do you get to use it then otherwise? By adding these two lines in your web.config file:



You then have access to a range of classes by typing the fully qualified namespace like this:

System.Web.UI.DataVisualization

Once you have access to the classes you can do all sorts of interesting things. You get to choose from 35 different chart types, that you can format with colours, 3D effects. And you can also use data with it very easily with a datareader, which impressed me. You can also save your charts as images.

  • Share/Bookmark
posted by fr3dr1k in ASP.NET,C#,Web Development and have No Comments

HTML 5 and other new web technologies

Read the spec here. The most interesting aspect of HTML 5 to me is this:

HTML 5 will be great step forward, standardizing things like dragging and dropping elements on web pages, in-line editing of text and images on sites and new ways of drawing animations. There’s also support for audio and video playback without plug-ins, a boon for usability and a worrisome sign for Adobe’s Flash, Microsoft’s Silverlight and Apple’s QuickTime. The language will also give a boost to web apps, as there are new controls for storing web data offline on your local machine.

Source.

  • Share/Bookmark
Tags:
posted by fr3dr1k in Web Development,Web Technologies and have No Comments

On that Session-less shopping cart issue

In my post yesterday I mentioned that I would like to develop a session-less shopping cart through the use of web services and classes. Well, I changed my mind a bit because I am not sure if AJAX can maintain state. Can it? How will AJAX retain state? I’m not sure yet, so sessions it is.

There are some important reading bits that need to be covered before you can get stuck into sessions, and its always better to try and understand something as far as possible before you simply jump in and implement it. The first article that proves invaluable (and very important) is the ASP.NET Page Lifecycle where after I can recommend you read the State Management Overview Article to understand the difference between Client side and Server side state management and what each offers. Why is state management such an issue? Well firstly because HTTP is stateless, after you make a request to a web server for a web page there is no further communication between you and that server. So to create a state, you use a state management technique, which can either be client or server side. With either technique you have several options and each option has some advantages and disadvantages.

My fear with session state management was the performance hit my server might take, but I have not really tested it enough to make that assertion.

  • Share/Bookmark
Tags:
posted by fr3dr1k in ASP.NET,Web Development,Web Technologies and have No Comments

Thoughts on PHP

WordPress runs on PHP, and PHP runs on Apache, this blog uses PHP and Apache to serve up content, and .NET doesn’t. So whats the point then? Well, for all intents and purposes I have a technology that can be used to develop and maintain large commercial websites without having to change to a .NET hosting provider. The point being that while I love .NET I cannot really develop commercially websites with it unless I pay for extra hosting and in these lean economic times I cannot see myself paying more money for hosting. That means that I have to rely on technologies such as PHP.

I have been reluctant to use PHP simply because the software tools available cost money, such as Zend Studio, but I did find PHP Development Tools as part of Eclipse and today I started doing some basic PHP stuff, and its amazing to see how easy it is to adapt to PHP if you have used C#. The syntax is very similar. One of the biggest differences between PHP and .NET is the way pages are handled. .NET uses postbacks, and all the .NET code is compiled, not interpreted. PHP on the other hand interprets its code and the way it basically works is that Apache passes a request over to PHP if it detects any PHP. The PHP interpreter then executes the PHP. As far as syntax goes PHP is similar to most programming languages. Features such as assignment operators and conditional statements are similar.

  • Share/Bookmark
Tags:
posted by fr3dr1k in Web Development,Web Technologies and have No Comments

jQuery and Microsoft

I susbscribe to The Code Project’s newsletter and today I got some great news, jQuery will be supported in Visual Studio 2008. Now this is some awesome news. Makes one wonder if the Microsoft AJAX library will become redundant.

You can read the full article on Scott Gu’s website.

  • Share/Bookmark
posted by fr3dr1k in AJAX,ASP.NET,Web 2.0,Web Development and have No Comments

Re-usable code for a Gridview and DropdownList

Both the GridView and DropdownList server controls provided in ASP.NET have DataSource and DataBind methods. This means that you could write the same code to populate both controls with data from a database. So first you would create a method for a class like this:

public DataTable GetData()
{
string strSQL = "select * from tblTest";
using(SqlConnection myConn = new SqlConnection(ConfigurationManager.ConnectionStrings["MyDB"].ToString()))
{
    using(SqlCommand myCmd = new SqlCommand(strSQL, myConn))
    {
           myConn.Open();
           using(SqlDataReader myReader = myCmd.ExecuteReader())
           {
                 DataTable myTable = new DataTable();
                 myTable.Load(myTable);
                 myConn.Close();
                 return myTable;
           }
    }
}
}

And then in the codebehind for the page that contains the GridView or DropDownList controls you create a new instance of the class you created above and set the DataSource property for the control. So if you created a class called myClass your code for the Gridview would look like this:

        myTestClass myClass = new myTestClass();
        gvMyGrid.DataSource = myClass.GetData();
        gvMyGrid.DataBind();

The only difference for the DropDownList would be setting the DataTextField and the DataValueField.

  • Share/Bookmark
posted by fr3dr1k in ASP.NET,C#,Web Development,Web Technologies and have No Comments

ASP.NET Navigation and Content Management

At the moment it feels like I am re-designing a navigation system that has probably already been built before. The reason for saying this is because the navigation controls provided to you by Visual Studio 2008 produce table-based layouts, which is not what I want for my website. I want my website to generate valid XHTML and use CSS for layout. So what do I need? I need a navigation system that generates valid CSS and XHTML and that is easy to administer and update without having to meddle in C#, XHTML or CSS code. How do I achieve this goal? Would I have to write my own custom navigation system? It seems so for now. The basic structure of the navigation system would allow for a maximum of three levels of navigation:

  • A top level
  • A second level
  • A third level

The navigation system will at all times make the user aware of where they are in the website, which can be achieved with a breadcrumb navigation system. Each navigation item will display its own associated content. Second level navigation items will have top level navigation item parents and third level navigation items will have second level navigation item parents. The navigation system will also act as a source for creating the site map structure. If a visitor clicks on any item in the top navigation area then content associated with that item will be displayed and the active top level navigation item will show its active. The second level navigation items that are displayed will be associated with the top level item. If a visitor clicks any of the second level navigation items the one that is clicked will become active and content associated with the second level navigation item will be displayed and the second level navigation item that is clicked will show that is active. If the second level navigation item has third level navigation items associated with it then those items will be displayed. If a visitor clicks on the third level navigation item then that item becomes active and content for it will be displayed and that third level item shows that it is active.

The next step is to create an object-oriented design from this structure. Using an object-oriented approach would allow for easy re-use throughout. So lets say we create a class called “section” and give it the following fields:

  • ParentSectionField – This will indicate if there is a parent item
  • SectionField – This will indicate what the current section is
  • SectionHierarchy – This will indicate where in the navigation hierarchy the section item belongs.

The other issue that is a concern for me is content management, and understanding why it is important. Content management is important because it alleviates the need to mess with the code in your website. If your website has a decent content management system you will have a consistent look and feel throughout the website and you will be able to change that look and feel with a few clicks. WordPress is a perfect example of just that. WordPress allows you to easily change themes by uploading it to a directory and by changing it in your admin panel. WordPress is a clear example of design being a layer on top of the underlying function. Content management systems are ideally defined as a layer of functionality or business logic with another layer of presentation logic on top of that. Content management systems are also characterised by its development frameworks. Development frameworks can be seen as large collections of functionality assembled into one component. ASP.NET is an example of a framework technology, because it provides a whole host of features and functionality that you do not have to re-develop to make use of. The ASP.NET Roles and Membership functionality comes to mind, and is not too difficult to implement and administer without having to write much code. The advantage of this is that these features take advantage of the framework features across the whole website. The Roles and Membership feature in ASP.NET is an example of this, because you could easily manage more than one website’s user base from a central administrator control panel. You would not have to re-code the model for each website.

  • Share/Bookmark
posted by fr3dr1k in ASP.NET,Content Management Systems,Web Design,Web Development,Web Technologies,Wordpress and have No Comments

Don’t Take My Gems

I recently updated my Google Alerts and came across a really funny video clip. “I forgot to tell you about this other feature we have, it’s called suing you for everything you have.” lol

Originally found here

  • Share/Bookmark
posted by fr3dr1k in Web Development,Web Technologies and have No Comments

Web Development is not easy

Writing simple programming instructions is an easy task, but taking those simple tasks and putting them to work in a complete framework requires a lot of thinking and problem solving. Its also way easier to define solutions on a conceptual level than it is to take those concepts and implement them on a technology platform. That being said a solution is nothing without a plan, you cannot jump into writing programs without understanding what the end solution will be. I guess its all about commitment in the end, both from the concept and solution perspective.

Silverlight uses a pretty intense Java Script programming model, and I initially thought that with Silverlight 2.0 you could get away not having to deal with JavaScript, but I guess thats not entirely true. A lot of functionality is still accessible through JavaScript, and C#. On Friday I found a WordPress blog with a few great Silverlight tutorials. I managed to create my own skinned media player.

  • Share/Bookmark
posted by fr3dr1k in Web Development and have No Comments

The Need for Content Management

So there I was today trying to understand why the Script Manager code and the Silverlight Javascript didnt want to work together. I soon realised and figured out that in your Script Manager tag you have to specify all the references to the Silverlight Javascript files. After I did this everything worked perfectly, and I was relieved, because I wanted to use Silverlight as a feature on a project I am developing.

The Silverlight issue, though, was not the issue that occupied my mind the most. What occupied my thinking and strategising the most was to understand why content management for a website is so important, and particularly why it is important. The most important reason or benefit for that matter of content management on a website is that you can separate business logic and presentation logic and in so-doing alter the presentation logic more easily. That is the single most important benefit of content management. If you look at a content management system such as WordPress or Drupal it is easy to see that the presentation and business logic has been separated, hence the reason people are able to create themes for these content management systems and interchange them without losing the content. Content management systems present one caveat – the content is consistent but makes it difficult to implement uniquely designed pages without breaking the content management system.

  • Share/Bookmark
posted by fr3dr1k in ASP.NET,Silverlight,Web 2.0,Web Development,Web Technologies and have No Comments
Get Adobe Flash playerPlugin by wpburn.com wordpress themes