Monday, March 19, 2007

I downloaded an XNA project from codeplex http://www.codeplex.com. The demo does not run. I get the following error message:

Microsoft Visual C# 2005 Express Edition
The project file FarseerDemo1 cannot be opened.
The project was saved with an incompatible version of XNA Game Studio Express or the project has become corrupted.

Anyone know what's going on here and how to fix?

3/19/2007 11:15:43 AM (Pacific Daylight Time, UTC-07:00)  #    Disclaimer  |  Comments [0]  |  Trackback
 Sunday, March 18, 2007

We’re going to write a game using Microsoft’s XNA.  I joined a group (9 or 10 people) who want to do this. We had one meeting which was largely brainstorming.

After the meeting I downloaded Microsoft’s Visual C# Express Edition, its SP1, and the XNA Game Studio. I’m not even sure if I got all the official names of this sw correct, but anyway it loads and runs just fine and does not conflict with the Pro versions.

However, the SpaceWar example does not work on my IBM laptop. I get the following error message.

No SuitableGraphicsDevice

“Could not find a Direct3D device that has a Direct3D9-level driver and supports pixel shader 1.1 or greater.”

 

But it works OK on my Dell D800 Latitude laptop. Here’s a file that contains more detail about what I did along with some screenshots.

Spacewar.pdf

3/18/2007 11:59:24 PM (Pacific Daylight Time, UTC-07:00)  #    Disclaimer  |  Comments [0]  |  Trackback
 Tuesday, December 19, 2006

Here's that console app, and if you don't know what it is, it isn't for you.

ConsoleApp.ZIP (23.08 KB)
12/19/2006 8:52:25 PM (Pacific Standard Time, UTC-08:00)  #    Disclaimer  |  Comments [1]  |  Trackback

What I want to do is access MySQL from PHP5 using the PEAR DB library. Pretty basic stuff, but new to me.

I'm reading Programming PHP by Rasmus Lerdof, Kevin Tatroe, and Peter MacIntyre. This is one of those classic books; Lerdof is the creator of PHP.

So what I've done is basically just run one of the examples in this book. This is not as trivial as it sounds. First of all, I want to understand what the example does. Second, what's described in the book isn't exactly correct, or rather it was at one time, but not now. I have the second edition, April 2006. My PHP is 5.1.4, which is now already old; 5.2 is out.

The tasks discussed here are creating a database using mysql, ensuring that PHP has access to the PEAR DB library, and running a simple application that accesses this data through the Internet using the PEAR DB library. My OS is Ubuntu Dapper.

The file below (written in OpenOffice 2.0) describes what I did.

CreateDB.ZIP (181.45 KB)
12/19/2006 8:12:44 PM (Pacific Standard Time, UTC-08:00)  #    Disclaimer  |  Comments [2]  |  Trackback
 Saturday, November 25, 2006

Here's a summary of what I've done so far. I installed apache, mysql, and PHP. Then I went through a PHP example that implements a discussion forum. Limited object-oriented capabilities became available with PHP4. With PHP5, I'm told, object orientation is available in full plumage.

So I'm reading Object-Oriented PHP by Peter Lavin. The last example I showed from PHP, MySQL, and Apache by Julie C. Meloni used only procedural PHP. I want to go through an object-oriented example and I chose the example from Chapter 6 of Lavin's book.

I wanted to stop putting everything in /usr/local//apache2/htdocs. I made the directory /usr/local/apache2/htdocs/oophp. And then under that I made a directory called chap06 for the example from Chapter 6.

What I want to do is describe what the example does and show it running; and then, go through the code showing how the example does what it does. The point here is that this code uses PHP's object-oriented capabilities.

LAMP002.doc (210 KB)
11/25/2006 1:43:24 PM (Pacific Standard Time, UTC-08:00)  #    Disclaimer  |  Comments [0]  |  Trackback

I'm still looking at open source tools, trying to understand how it feels to work in the open source environment.

Here's what I did. A while back I started making web pages with C#, Visual Studio, and SQL Server. I started when the .Net Framework was at 1.1, and now it's at 2.0. Recently, though, I wanted to experience how one might do similar things on Linux.

Right now (this may change) but right now I'm more interested in development environments than in the end result. I'm not looking at portability or interoperability between Linux and Windows. I wanted to experience how it feels to work in one environment or the other exclusively.

 I chose to build a discussion forum under both Windows and Linux. This is a very basic discussion forum, by no means ready for prime time. It's just meant to be a structure on which to hang some design and code. As I've said so many times before, it's the journey, not the destination I'm interested in.

Here is a Word doc that describes how I set up a simple LAMP environment. I'm running Ubuntu Dapper (not yet Edgy, sorry) as a virtual machine on my WIndows laptop using the free version of VMware

LAMP001.doc (824.5 KB)
11/25/2006 12:30:30 PM (Pacific Standard Time, UTC-08:00)  #    Disclaimer  |  Comments [0]  |  Trackback
 Monday, October 09, 2006

Introduction

As with most things I do, my purpose is not obtaining the result but understanding the journey. What I want to do write a winform so that I can  

·       Investigate the properties of the DataGridView control in Visual Studio 2005.

·       Configure the TableAdapter object so that the DataGridView control shows values from a database.

·       Use the DataGridView control to navigate and update the database.

The actual database I use is not that important. I chose to write a simple database in Access that records my household budget. Access for me is a comfort zone, but I think the database could just as easily be in SQL Server 2005. I may later migrate it to SQL Server 2005, but right now my interest is in the DataGridView control and not in the database software.

It turns out you can get an application running by just dragging and dropping and configuring property screens. You don’t really have to write any code at all. It’s designed to be “quick and easy.” But here’s a quote from Pro ADO.NET 2.0 by Sahil Malik. “… your application is just as good as the amount of effort you put into it. You can’t expect drag-and-drop applications to help you create a well-architected enterprise-level application …” The drag-and drop method is good for prototyping, and you can learn a bunch by reading the auto-generated code.

The Database

Here is how my database looks initially. I may expand on it as I develop my application, adding entries to tables, adding new tables, setting relationships between the tables.

Building the Winform

Just make a winform application. And click on Add New Data Source …

Then, click Next>.

I already had a connection from a previous attempt at this, and so I chose it. Click Next>.

Click Next>. The connection string gets saved in app.config.

Select Tables. I chose not to select Views. I don’t know how easy it would be to add them later. Hopefully, one would not have to start from scratch.

Click Finish. You now see a Data Source window with the generated DataSet.

 

Select Checks and drag it onto the form You see a DataGridView. Notice the navigation controls at the top and the components in the IDE footer.

You can now build and run the winform, and this is what you see. Note that CategoryID, Location, and BankID appear as integers. This is not what I want. I’d like to have a lookup table in a dropdown list.

Back in Visual Studio, select the DataGridView and expand the Smart Tag.  Then click Edit Columns …

Do the following for the three columns: CategoryID, Location, and BankID. Highlight the column in Selected Columns:.  On the right, in Bound Column Properties,

·       Go to Design à ColumnType. Drop down the list for its value and choose DataGridViewComboBoxColumn.

·       Go to Data à DisplayMember. Drop down the list for its value and choose Name.

·       Go to Data à DataSource. Drop down the value list. Expand Other Data Sources. Expand Project Data Sources. Expand ExpensesDataSet. Select the table corresponding to the column you originally selected. This is Category, Bank, or Location.

·       Go to Appearance à HeaderText. Type in the value field what you want to appear in the header of the table.

For each column that you do this to, you get two more components in the IDE footer.

Do it for the Category column and you get categoryBindingSource and categoryTableAdapter.

Do it for the Location column and you get locationBindingSource and locationTableAdapter.

Do it for the Bank column and you get bankBindingSource and bankTableAdapter.

Now I want to add a textbox that also binds and moves with the TableAdapter navigator. In the Data Sources pane expand ExpensesDataSet and then expand Category. Drag CategoryID onto the form.

Then, select the textbox, right-click and choose Properties. In the Properties window, expand (DataBindings). Select Text. Drop down the value and select CategoryID under checksBindingSource. Notice that the CategoryID changes as you navigate through the table.

Also, note that Update works.  Select a record. Double-click in a field. Edit the field. Then, click on the diskette symbol on the toolbar. Check that the record is updated either by looking in Access itself or by exiting the winform and reinvoking it.

 

10/9/2006 4:44:55 PM (Pacific Daylight Time, UTC-07:00)  #    Disclaimer  |  Comments [6]  |  Trackback
 Thursday, September 21, 2006

Here's the summary for a talk I gave at Portland's Linux Advanced Topics User's Group.

This talk is an introduction to Eclipse 3.2. It assumes that you know what Eclipse is and may even have installed it and cruised its menus, that you have not done anything serious with it, but that you might want to. Eclipse is both an IDE and an RCP (a starting platform for your own applications). Although I'll mention and define RCP, the talk is about using Eclipse as an IDE. I'll show how to use Eclipse to build a simple Java console application. As an IDE, it allows you to add your own plug-ins. The talk will also show how to add a simple plug-in. This talk is cribbed from various books; little if any of it is original.

Here are the notes.

AdvancedTopicsTalkPart1.doc (1.44 MB)

AdvancedTopicsTalkPart2.doc (1.08 MB)
9/21/2006 3:28:16 PM (Pacific Daylight Time, UTC-07:00)  #    Disclaimer  |  Comments [0]  |  Trackback
 Wednesday, September 20, 2006

Here are photos from a hike that I took in the Wallawas last month with a couple of friends.

Photos from hike

9/20/2006 11:12:21 AM (Pacific Daylight Time, UTC-07:00)  #    Disclaimer  |  Comments [0]  |  Trackback
 Saturday, August 05, 2006

More from the CodeCamp talk, fixed up and edited somewhat.

I went to OSCON (just the hall pass) and then to LANG .NET. Both conferences were much fun, and I left excited and motivated. I think it's time to get back into thinking about functional languages! But I'm going backpacking first; Lory stays home this time; she said she could get back into it, but a week on the mountain is too much for a start.

Running the SWT Application Standalone

That last example runs from within Eclipse. How do you run this application outside of Eclipse?

First, you have to set the CLASSPATH variable appropriately.

In addition, you must specify the java.library.path. This is the location of the java native SWT and GTK libraries. These are shared Linux libraries that end in so.

I specify this on the command line.

But this is not enough!

You must also specify the location of the native libraries.

Where are these native libraries?

Remember, when you added SWT to the workspace. This put the directory org.eclipse.swt under your workspace.

But that’s not the only place those libraries exist.

Under the Build Path for the project …

So I could specify java.library.path using those hidden directories, and it works just as well.

8/5/2006 10:45:28 AM (Pacific Daylight Time, UTC-07:00)  #    Disclaimer  |  Comments [0]  |  Trackback
 Monday, July 24, 2006

This is an excerpt from my talk at CodeCamp 2.0 on 7/22.

Adding the Visual Editor

The Visual Editor is in fact a plug-in. And one you’re going to want if you plan to develop a win form.

I understand with Eclipse 3.2, Callisto makes installation simpler. But with 3.1.2, this is what I did. I chose Help à Software Updates à Find and Install.

1.    Select the Search for New features to install. Click Next

2.    Click on the New Remote Site … button and add http://update.eclipse..org/tools/ve/updates/1.0. Name it VE.

3.    Click on the New Remote Site … button and add http://update.eclipse.org/tools/emf/updates. Name it EMF.

4.    Click on the New Remote Site … button and add http://update.eclipse.org/updates/3.0 . Name it Old Eclipse.

5.    Select VE, EMF, and Old Eclipse. Click Finish.

 

 

 

 

How do you know the Visual Editor is installed? Open Eclipse, type Ctrl+N and look under the Java node to see Visual Class.

 

SWT, Swing, AWT

I’m going to show a little example using the Visual editor with SWT.  I don’t have much experience with these GUI libraries. From what I’ve read, I like SWT best, but I understand that Swing has strong adherents. I’d rather respect the differences than argue them.

SWT is the Standard Widget Toolkit. It’s the foundation for the Eclipse user interface from IBM. Originally IBM used Smalltalk internally, but it had deployment and configuration problems.

Sun wanted a portable widget API and wrote AWT, the Abstract Windowing Toolkit. Many considered it overly complex. Sun abandoned AWT in favor of JFC, the Java Foundation Classes, also known as Swing.

AWT suffered from a “lowest common denominator (LCD)” approach. To remain faithful to “write once, run anywhere” AWT offered only features supported by all the native windowing operating systems.

Swing solved the LCD problem by using no native code and no native widgets. Swing has “pluggable look and feels.” By default Swing adopts the native platform’s look and feel.

Some people maintain that Swing has not lived up to its promise. Reasons are speed (actually lack thereof) and look and feel. Swing devotees bristle at these statements. Swing performance has greatly improved (especially with JDK 1.4), but I read that it continues to be somewhat more sluggish than native applications. (I don’t really know; I haven’t done any performance studies.) About the look and feel … well, you can plug in whatever you want, but Swing may always be a step behind the latest GUIs because support for the GUI must be written explicitly into the Java library.

OTI (Object Technology International, who created widget interfaces for OTI Smalltalk and is now part of IBM) set out to create another GUI library and correct the faults of AWT and Swing. This was SWT. It uses native functionality when available, Java implementation when not.

Installing SWT

SWT is distributed as an archive file; I downloaded swt-3.1.2-gtk-linux-x86.zip. Then, open Eclipse and select File à Import … à Existing Projects Into Workspace.

 

 

 

The result is that org.eclipse.swt appears in the Package Explorer.

Writing a Simple Win Form with VE and SWT

Open Eclipse. Select File à New à Project … à Java Project. Click Next. Type in a Project Name and click Next, then Finish.

 

 

In the Package Explorer, under the Project Name, select src, right-click. Select New à Other à Visual Class. Type in a package name and a class name.

 

The class appears in the Visual Editor.

 

Drop down the Bean toolbar. Choose SWT Controls à Button. Release the mouse, then click on the win form. A button appears. Resize it. Then, select the button and right-click. Choose Set Text and type in the text you want to be displayed on the button. Using this same technique, make a textbox.

Then select the button and right-click. Select Events à Add Events … Choose “implements: …” and select Finish.

 

Then, add code in the button handler to write the textbox.

 

Now select the containing package in the Package Explorer and right-click. Choose Run As … à SWT application.

 

 

7/24/2006 9:31:52 AM (Pacific Daylight Time, UTC-07:00)  #    Disclaimer  |  Comments [0]  |  Trackback