Skip navigation

Deployment is always hard for me. All the files, modules, resources, DLL version… anything can go wrong. 

The DLL version of my log4net logging library somehow got me into trouble. The version suddenly don’t match the package. It took me a long time to figure out it is the version problem. But I have no idea where to edit the version of the reference libraries. I remove and add the library back but it won’t update. 

Also some libraries are automatically set to “Prerequisite” instead of “Include” in the Publish setting. I have no idea why. When installing on a test machine the error said the library expected to be in the Global Assembly Cache (GAC) as it is not included. Setting all the files and libraries as “Included” resolve the problem.

And also all the OS related issues, framework updates and SP… it really needs to be tested thoroughly to avoid deployment headaches.

End users are very different these days. 5 Years ago, internal application development projects were easy. You provide all the grey boxes and grids that tabulate data and allow for editing, that’ it. People won’t expect more. If it can get work done, it is acceptable.

Nowadays, everyone expect software and technology just works. Also everyone is expecting great user experience. All the mobile platforms and touch based devices which provide intuitive and easy to use user experience are educating everyone that software should be easy to use and easy to learn.

Fortunately, for most development platforms, especially the .net platform, there are tonnes of free and licensed UI components available to developers. This is really a life saver. Want a grid that not only tabulate data but provide Outlook like sorting, grouping and filtering? No problem, just a few lines of code you got it. Want a drag-and-drop enabled tiles with expandable view? No problem, just drag the control to the design surface. Need charting and sexy visual BI? Just provide the data source and baam, it automagically chart for you.

I am working on a copy of DevExpress for WPF and I am generally really satisfied with it. DevExpress provide good documentation and the forum is really helpful. The code sample generally could help get me started on any control, while the API documentation and the forum will get me further. I am currently mostly using the GridView,RadMap and the Charting controls and there is nothing I could complain about.

I was especially delighted by the RadMap control, which provide a great step by step tutorial for getting started. I was able to get  a map control which I could show off to my customer with 15 minutes of coding! That’s cool and helpful.

 

Noticed my previous blog post was 4 months ago … what have I done for the past 4 months? Did I just quit trying to write and learn code?

No way, I am more and more into it, sometimes just could not let go till its easily 3 or 4 in the morning.

For the past 4 months, I have successfully:

1. Start using Prism 

Prism really rocks! It has all those great services that I could easily use and achieve so much more so quickly once I get over the initial learning curve. Now I could manage all views and their viewmodel and navigate user to any region I want, easily with parameter passed. I could easily choose between creating a new instance (using tab region) or a create a completely new view if I wish. 

Also the application is designed to be modular, so all my functions are loosely coupled together. I could easily add or remove functions and deliver projects to different users without breaking anything. That is awesome.

2. MVVM and Repository Pattern + Entity Framework

Really forcing myself into the MVVM pattern, which initially was quite hard. Need to figure out how to model all the view’s data, behavior and states using properties instead of the quick and dirty code behind methods. Also using the Repository Pattern, I could move all my data access code to the repository base class, which reduce the code needed and also very clean.

3. WPF data binding

Interesting enough, all those pattern and services are not that difficult to learn, as long as I got the concept right. However, data binding is the real time consuming stuff for me. There were alot of trial and errors needed for me to the the data binding right. Even the binding is right, alot of time was used to troubleshoot the notification issues as the veiw won’t refresh alot of the time. This however I believe will certainly goes away as I spent more and more time on it.

4. Team Foundation Server Express

Although I code alone, there is no one around me in my team, I still found the TFS a real useful tool for me. It is free for the express edition, which is really great. It could keep all the check-in and history for me. I could easily compare and rollback the changes (especially in those late night where major stupid mistakes were made). The web interface for tracking all the bugs and work items are really cool too.

So after a few month, I am getting more and more comfortable with all these stuff. My first project will be delivered within a month, after that I will definitely evolve the project to a standalone product I am planning on.

Cheers!

It is much more difficult to write generalized code than code that will only work for a very particular scenario.

To write specific purposed code, it could just assume the name, type, data mappings are just  static. To write generalized code, all the cases need to be considered. Each type of data will be parsed to you, different class, properties name, nullable value etc… it is just much harder.

But I really believe taking the huge pain to write those generalized code will payoff in long run. When the code base get more complex, the number of scenarios increase, those code will be much more maintainable, and overall design will be much simpler.

Today after tens of hours of labor, a class that will read from a cache table, then insert into another table which have differnt schema, including the foreign keys.

It took sometime to figure out how to do a generalized loop thru the columns using the SQLHelper library. However, it is great to have a generalized class that will handle all of the future data retrieval from the cache tables.

WP_000867

Finally got my development desk all set in the way I really think best suits my work. Better yet, it does not really cost me a fortune to do so.

Chair: $ 90

First I need a good chair. Although I would really like to have one Aeron Chair from Herman Miller, but that will have wait till my IPO. My previous chair really is killing my back, so after a long struggle I finally bought this green one. It has great 3D cushion for my butt. Together with a curved back support to make sure my body will not be slipping forward and my back  not curled up.

L-Shaped Desk custom made: $ 180

Desk, man I really wish for a corner desk. It is the most productive setting as everything can be reached within arm length. I could have my mouse pad at my right and paper and pen at my left. My elbow also can rest on the top of the table at both sides which is very nice for long coding session.

Microsoft Ergo Keyboard: $ 20

Talk about the keyboard, this curved ergo keyboard I bought fits into this setting nicely. As my elbows will be resting on both sides, this curved keyboard reduce the wrist tension by almost no wrist bending. One complaint only, is the keys are a bit tight, not helping me as a touch typer.

Topcon Main Monitor: $ 120

My bought this one at a fire sale event, a Topcon 22W. As I have very little requirement for monitor color and contrasts and response speed etc .. (I am no gamer anyway) I just bought the biggest wide screen monitor within my budget.

Side Monitor: $ 13 !!

The side monitor at my right, as you can see has no bazel.  Yes, it is a LCD panel I rip off from a retired notebook. As I really would like to have a portrait mode monitor at the side for referencing programming books and websites, but I do not want to spend any more money. So I do a little research and find I could buy a LCD module with power supply. Basically I just unplug the panel from the notebook, notify the vendor with my panel code to make sure the plugs are fit and firmware is right and that’s it. Just make sure the computer display card has 2 ports to do a dual monitor setting though. You can see I am running a Windows 8 virtual machine there! I will try to turn it into a touch screen when I have time using this.

Asus Notebook: $ 450 and Development Machine: $ 1000

I best friend the Asus notebook UL30A. It is very light and has a very good battery life. When I go out to do on site job, I most could trust it without bringing my power with it. It is a bit slow now after 2 years of heavy use, but I need it to play music, run Outlook and Sharepoint, get my Youtube videos to pump me up for long coding nights! For $ 10 more I got a stand to make the screen vertically aligned with my main monitor and give me a bit more desk space.

Macbook: On Loan

A great friend loan me this MacBook for a iOS job I got. Also the iPad is from my customer for testing purpose (what a nice customer, give that a brand new iPad 2 for test while he use a iPad original).

Plantronics M155: $ 55

I still got a lot of phone calls during the day for support and enquiries. In the past I need to pick up a phone, stop my keyboard operation or use my neck and chin as a phone holder … very unproductive way to do phone calls. This wonderful Platronics connects to 2 bluetooth devices really seamlessly allows me to handle call very productively. My hands are not tied and can keep on working on doing remote support and administrative tasks while talking on the phone. A must have for those that need to engage with customer on a regular basis.

Synergy: FREE

Without synergy all these will not be productive and seamless. This great piece of open source software lets you control all the devices, in my case, 2 Windows 7 PC and 1 Macbook by just moving around the mouse! Install the server piece on my desktop development machine, and the client piece on the other notebook and you are ready to roam! Amazing productivity boast from this simple yet powerful software. For Mac it will be much easier to install the QuickSynergy client.

This is a long post, hope you find useful and so share you productivity thoughts so we all run faster! Until next time.

Just bought a new ebook from amazon on Programming Entity Framework: Code First, after reader the first few chapters, I felt this book is really great. It makes Entity Framework looks SO EASY.

Julia kept saying, yes, a few lines of code, you just finished the data access layer, and it actual is.

Originally I thought using Model First would be easy as I am starting a completely new project, turns out Code First is even better, as I could write my Class, and it will become my model, and all related details could more or less use DataAnnotation to make it work. I don’t have to get to other places like the edmx etc to get things work.

So far things there are a few stuff I have tried and basically get it working:

1. WPF basic layout and binding

2. C# code basic syntax and code organization like namespaces and projects and folders …

3. SQL Server synchronization (Update-Database !! works like magic in Code First Migration)

4. Entity Framework Code First Modeling usign DataAnnotation

5. Basic data access using Entity Framework

6. Hey, Clickonce is working too! I did not even do anything but Publish 開懷大笑

Using the Telerik Chart Controls probably the Sales Dashboard prototype will be ready in a week.

It took awhile to get to this point, and along the way I feel like I am crawling like so slow … but surely there is progress. Keep going!

The decision to write in c# gives me a bit of benefit. First it is much easier to find sample code and examples on the internet or even books. For any topics I could just search or flip over a book, there will be code sample I could use. Connecting a database, string operation, datareader etc..

However it does hold me back abit. The syntax is new to me, some concepts are new to me, and the project organization also I need to get myself thinking, instead of just flowing out code.

I know this is going to go away soon, as time goes by will get myself much more fluent with the language, but sometimes it just makes me feel frustrated, as I have to spent time looking for ways to do really small tasks.

Its tough to keep the I.T. support operation going, while finding the time to do the product development.

Finally get a few full days’ time to start working on the prototype. There are a few ideas in my mind I wish to flesh it out on a WPF project. In the past 3 days a WPF project was created to test out the idea.

First, I tried to layout the WPF UI. It is not that difficult. Just bump into a few issue, but most of them could be quickly resolved after a few googling.

The sequence of laying the controls in the xaml file makes a great difference. When to put that grid and splitter, and when to declare the rows and columns, all affect the final appearance of the UI.

CSS like global style is possible with a few approaches, the simplest will be to declare them in the app.xaml file, but similar the the CSS concept, the properties that are closer to the control will have the final say on how the control will be rendered.

To try to build a Dashboard with the MYOB file as data source, first a DSN was created in my development machine. With my 64-bit XP, turns out it has many problem with the 32-bit ODBC driver MYOB provided. So I spent many hours reinstalling my machine to a 32-bit XP, and recreated my development environment. That is worth the time I think to avoid many potential problems.

Then a DSNless connection was created, also by checking the name of the installed ODBC driver I could ensure the right version of the driver is used to match the version of the MYOB installed.

Finally, a linkserver was created in SQL Server 2008 using the ODBC driver. Accessing data this way would have the best performance and also makes the solution more neat.

The MYOB sales data can now be pumped into some Telerik Charts for some Dashboard stuff to impress some people. Like the progress so far, thoguht it will take me some time to pick up the c# syntax and all the new stuff, but is really surprised by the progress in these few days.

Keep going, and I expect to have a fully working Dashboard by the end of next week.

Comments? Feedback? Anything welcomed. Until next time.

Today I got my first WPF working by using a simple Datagrid control. Although the WPF form Datagrid is binded directly to the collectionviewsource, instead of using more sophisticated pattern like adding a data access layer or viewmodel.

First I need to get my context right. It took me some time to get my context working, as I forgot to instantiate the context. I just declare it but it will only work after I use the new keyword to instantiate. The context needs to be in the form class, in order to be used by all the objects within the form class.

Secondly I need to create the object data source in the project by clicking Data > Add New Data Source, select the project namespace, and add the object I need for the grid. In the Data Source window you can select what default control to present this data source (a Datagrid for this case). Then I just drag the Data Source to the XAML surface and it will create the grid for me.

There are some code auto generated by this drag and drop action. In Window_Loaded event, code is auto generated for me and comments are inserted to remind me to  use the ViewSource.Source method to load data. By using the ToList method I created a list and assign it to the ViewSource.

Finally I need let user update the form. By using the Datagrid.SelectedItem property I could instantiate an object for the row user selected in the grid. Using the AddObject method I could easily add the current selected object/row to the context, then quickly do a SaveChanges.

That’it for my first working WPF form with a Datagrid control. Nothing fancy here, but glad I get it working. Next task for me will be to create a proper MVVM project for a single Entity Type. Let’s see how it goes. Cheers!

I have just finished reading up the first three chapters of the In The Box MVVM Training. The training series use a very innovative delivery approach. All the material, code and solution reference are integrated into Visual Studio. In that way there is very little time wasted in flipping through code, samples, or try running applications as it is all “In the box”. Really good stuff.

Initially the MVVM pattern could be a little difficult to grasp especially for a very green developer like me. However, I have my “eureka” moment which is really interesting as I could find a very bizarre analogy which I really understand.

As a guy grow up in Hong Kong watching Hong Kong ganster movies, I have some understand about how drug dealers operate. They have people who is responsible for receiving drugs from high power speed boat (big fly in Chines). People who move the incoming stock into the workshop for further processing and packing, and then people for distribution.

All these different people needs to communicate with each other, but never met and know each other. They will use prepaid SIM (space card in chinese), pager, untraceable IM accounts etc to communicate with each other, they will never meet each other or have any knowledge of the people before and after the supply chain. This reduce the risk of being traced by police and undercovers (two five boy in Chinese).

WPF with MVVM is exactly this. Each layer don’t know each other. They operate by using loosely coupled communication channel. All they know is the protocol but not the name. If one of them disappear, it can still work (highly testable!)

OK, just to share an interesting view on this subject. Got to get back reading during the weekend, cheers!