Thursday, July 27, 2006

Pushing Volts Along a Highway

There has been recent press discussion about the movie "Who killed the electric car," focusing on the demise of the General Motors EV1. I was always a large fan of the EV1, and personally thought that it would have helped the environment and reduce our dependence on foreign oil. It would not be too far fetched to invision a world with nuclear reactors generating power for the cities, and electric cars and trucks keeping society functioning.

People do have problems with a nuclear reactor nearby and immediately become NIMBY (not in my backyard) at the proposition, but if you tell them that on a 100 degree F day that they cannot run their air conditioning I think they would quickly change their opinions. The GM EV1 has problems. It had a very limited range, two seat capacity and would only be leased to customers, not purchased.

The EV1 despite its problems, was still a car that would have been perfect for the short trips that the majority of Americans drive each day. The market didn't exist partly to the lack of marketing on GM's part, and the low price of oil. People were not going to pay $500/month for a car when others could be purchased or leased at the time for $300/month, and give a substantial increase in comfort level.

Long after the remaining EV1s have been crushed by GM, and destroyed forever we have a new electric car that pushes the envelope in range, styling and efficiency. It is the Tesla Roadster from Tesla Motors. The sleek two seater has a top speed of 130mph, a sleek carbon fiber body, and range of 250 miles. This is far greater than any previous electric car that will be practical for replacing a segment of the automotive market.

The Tesla Roadster is new and may little has been proven regarding its longevity, but it will be available in 2007 for $100,000 and cost zero in gas costs. This is relative like many things in the world, since it doesn't require gasoline fuel, but electric fuel. If you live in an area that gets a reasonable amount of sun, you may be able to equip yourself with a solar panel system , generating additional power to charge a Tesla Roadster.

The car is very fast and in a recent test drive of a prototype given to the Governor of California, it proved to win him over. The car will initially be available in major markets in California, and may reach other areas. One problem that I see now is the extreme colds that can be found in various areas that will adversely effect battery life. Despite the company saying that the batteries are heated, they will still lose continuous power if they have to run a heater to keep the batteries warm in a cold climate. This isn't a problem if you take into account that even if the range drops to 100 miles, the car would still be more than practical.

I think that the cost of $100,000 will be the only detrimental aspect of the car. The world will still have to wait for an alternative electric car for the masses. If an electric car would cost $25,000 if could possibly find its way onto many highways and roads around the country.

Labels:

Wednesday, July 26, 2006

Apple Mighty Mouse

Apple has once again come out with a masterpiece of design and engineering. They have taken the simple mouse and pushed it to another level with the introduction of the Mighty Mouse.

Some of the features of the Mighty Mouse are:
  • Touch sensitive top shell for left and right button activation.
  • Bluetooh wireless.
  • Laser tracking.
  • Force sensitive side buttons.
  • Works on one or two AA batteries.
The cost through the Apple store is $69.00.

Wednesday, July 12, 2006

C# Blog

Checking permission to view a page

As we start to build the blog, we also need to know whether someone is authorized to view a page that requires administrative functions. This is going to come into play a little later when we create a simple section to add a blog entry.

Remember this is the .NET framework, so we are not going to have a lot of code to write. All we will need is the following:


if (Request.IsAuthenticated == false)
{
Response.Redirect("login.aspx");
}

This checks the that the request being made is authorized, if not send it back.



Creating a blog entry


So now we have a database a database for posts. This is not useful until we add two pieces of code to handle creating a blog entry and displaying a blog entry. Let's first quickly put together a page to handle adding a post.

We can quickly create a connection to the database for the blog by using a data source control. This is one of the key features of .NET we rapidly build what we need to build.

Monday, July 10, 2006

C# Blog


We have two tables that are currently in place: comments and posts. Now, the next step is managing the users. In building a multi-user application on .NET we can save ourselves quite a bit of work by utilizing the built-in user management functions.


Master Pages

In Visual Studio we are going to first make use of Master Pages to help take care of some of the redundency in building a website. We can use Master Pages to help with the initial layout.

Multiple master pages can be created for different sections.




A master page is designed with a content place holder which is where code that is specific for each page will go.




Elements placed above or below the content placeholder will remain on consistent throughout.






Using our master page we can place a logo which will stay on every page, our copyright, about us information and a wide variety of other information above or below our content. But wait...Master pages are more powerful than just that. We can create multiple master pages for different sections of our website, allowing us the ability to provide a wide variety of customization. The cascading style sheet is still available, and can be integrated with master pages, allowing even more customization in developing a site.






Role Management

In developing websites the question always comes up as to when a user is added, can we give them different roles? The answer from every developers is yes. The next portion of the discussion goes like something like this "..it would take time to develope such roles, the tables necessary, and code to query the database, and associated discussions" and then the question would be asked can we find a better way?

We don't have to, .NET has taken care of that for us, a .NET developer only has to add the following code to handle displaying a menu if the poster is a user or administrator. We do not want to give the same functionality to a user as we do an administrator, so users will only be able to delete posts on their own blog(s), not others. An administrator on the other hand would be able to delete posts on all blogs (this is needed if content is questionable, such as pornographic material, or just outright inappropriate...you can use your own imagination).

We could therefore use the following code:


if (Roles.IsUserInRole("administrator") == true)
{
deletePostMenu();
}



Let's go through the code. The Roles.IsUserInRole("administrator") is all the code a .NET developer needs to determine the role of a user and grant them appropriate permission.

So in only a few lines of code we have accomplished what would take others many more lines to do, but we as .NET developers have more time to work on other sections of the site.

Sunday, July 09, 2006

C#Blog

The previous installment I created the table to hold the main data of the posts. The next step is to add some additional tables that we will need. The next step will be a comment table.

The comment table will contain:

  1. Id: unique identifier.
  2. Text: comment text.
  3. Date: comment creation date .
  4. Post_id: the blog post that the comment is associated with.
  5. Author: the name of the poster of the comment. This name is one that is defined by an anonymous user.
  6. Status: whether the post is active/inactive.

Labels:

Saturday, July 08, 2006

The past couple of days I have been working on a variety of programming projects. I started working on a C# blog that I am going to design and document on my blog. There are so many other blogs that exist, but few written in C#. I am going to follow the development of the software from start to finish. I think that there are few blogs that actually follow the development of software from the beginning to the end.

The blog. The basic concept of a blog is simple, a user posts a message and it is displayed for other users to read. I start out with a table of posts that has:
  1. unique_post_id: A unique id for tracking comments to posts.
  2. post_date: The date the post was made.
  3. modified_date: The date the post was modified.
  4. author_id: The author id. This will be important for a multi-user blog system.
  5. text: The text of the blog entry.
  6. status: Whether the post is active or inactive.
That is it. A simple blog table. There really isn't anything fancy or special about this one, but it can be expanded upon very easily with more customization if needed.

Labels:

Thursday, July 06, 2006

Ken Lay has died.

I have been hearing this throughout the entire day that he died of a heart attack. There have been numerous people that have said that his death is an escape from the jail sentence that he was facing, while another group say that he is being punished. The people who have lost their retirement funds may never see any form of restitution since he was never sentenced.

So we should have pity on Ken Lay and his family, but not forget the thousands of others who are hurt because of his actions.

First Post

This is the first post that I am making to my blog. I may be the only techie person who has waited so long to come out with one. So finally here is my first blog.