Thursday, January 14, 2010
Saturday, January 09, 2010
I'm a great fan of Nick Parks and his Wallace and Grommit series. Over the holidays my boys and I found this very basic but free stop-motion-animation software on the internet: clayanimator.com. Using an old laptop and a webcam, in an hour or so my 7-year old was happily producing movies like this one. Not Nick Parks yet, but he's got time :)
A few days ago I received via email asking how vShadow library that I created manages to get the same code to run under multiple operating systems (XP/2008 Svr R1-64/2008 Svr R2-32, etc.).
The answer is that the code in question is a C DLL and that there are actually many flavors of that same C-DLL, one per operating system that I want to support. There's a managed code wrapper that determines which operating system it is running on and then uses the appropriate version of the C-DLL. The managed code that does this is on my web site, here.
Which leads me to a new year's resolution. It seems that Microsoft has introduced a file sync framework, the Microsoft.Files.Synchronization namespace. This seems like it could be very useful and I intend to learn more about what this framework can do. It may be that I don't need vShadow any longer. I do have lots of applications that move files back and forth or need to keep directories in several locations synchronized so I'm hoping that this framework will handle some of this for me.
My other new year's resolutions? Well, the usual such as get more exercise. But I've also resolved to bone up these of tech topics:
- Sharepoint.
This is the intranet framework at the company where I work, and my hope is to wrap the zillions of little web applications up using web parts and other sharepoint technnologies.
Using sharepoint should result in less proprietary code. I'm also hoping that I'll be able to use the Business Data Catalog functionality to make the data in my applications available to Enterprise Search. I think this could have a big impact if it works the way I hope it works. I've purchased a book, Sharepoint 2007 Development, which I am slowly working my way through. Next up, a Sharepoint 2007 development environment with which to try stuff out (essential to the learning process!) - Powershell.
I support a lot of batch processes. It can be really difficult to organize batch applications. They are typically not very complex but also not very standard, and there are lots of them.
Trying to wrap them all up in some sort of master application would be an exercise in complexity. Writing tiny little apps to automate each one works pretty well, but then one needs to be able to organize and manage the source code for many applications.
For example, let's say that there's a batch process that pulls data in from two servers, consolidates it and puts it on an FTP server for pickup by a client. Let's say that it works fine for two years and then all of a sudden on Saturday night at 2am it stops working. By then, any direct familiarity with the application would have faded into obscurity so the priority is: 1) how quickly can we review the flow of this application to determine why it has stopped working, and 2) how easily can we alter the flow to get it working again?
This is where I think powershell will really shine for me.
My idea is to have more-or-less standard applications which do things like move files to an FTP site (with logging and validation) and retrieve standard kinds of data from database servers. These applications will then be linked together in a powershell script that can trap errors and perform logging and, since it is a script, can be viewed with a text editor so those Saturday middle-of-the-night emergencies can be resolved with less effort.
I'm excited about this, and on the advise of an associate have purchased Bruce Payette's Powershell in Action. This looks to be a fine book and Bruce Payette is Powershell language dev lead. Powershell is built into Vista and 2008/Windows 7 so I look for it to be something that is stable and has long term support from Microsoft. XML, more specifically SQL Server support for XML.
Learning SQL is more of a vocation than an end in itself. One can always learn better, more efficient ways to structure a query and there are a zillion obscure techniques for making queries better/simpler/more efficient.
I firmly believe that XML and its attendant technologies (XSL/XQUERY/XPATH, etc.) will supplant SQL as the way that enterprise data is natively stored. SQL Server 2005 and 2008 have much improved support for XML and one of my goals is to gain a better understanding of the limitations and advantages of this support.
I know, for example, that XML data stored in a SQL Server 2008 column of type XML can be queried with XPath. This strikes me as really potent stuff. Have a bit of data with a lot of variation? Put it in XML then put the XML in your table, rather than creating a really complex relational schema.
Let's say that you're designing software to track employee parking passes. You need to store information about the type of vehicle for which the parking pass was issued. Moreover, let's say that that the information varies a lot: Some vehicles are personal cars, some are company cars and some are large trucks, and that the type of information that needs to be stored is different for each of those types.
The relational design for this could be complicated: A pass has a vehicle, but company vehicles have insurance info and large trucks have owner/registration info. Personal vehicles have neither.
Storing this vehicle info in XML could really simplify the database design. Just have a "vehicleInfo" XML column containing an XML document with the vehicle info. The schema of the XML document is different for each of the three types: company car, truck and personal vehicle, and stored procedures and applications can delve into this data.
I want to learn more about the performance impact of storing data in XML format in SQL databases, and about the limitations in querying and updating this data but the concept is really exciting.
Here's an example of an XML query that I'm using now.
select top 1
b.[name]
from
dbo.tApplication a
LEFT OUTER JOIN tReferral AS b ON b.[id]
= a.[xml].value('(//application/personal_information/@s1_referred)[1]','varchar(50)')
where
a.[companyid]=@CompanyID
and a.[isdeleted]=0
and a.[dateapplied] between dbo.WeekBeginning(@TodayDate) and dbo.WeekEnding(@TodayDate)
group by
b.[name]
order by
count(distinct a.[id]) desc
On the subject of XML, but not really a resolution: I've decided that XML works really well for web apps where you want to provide save/cancel and the data presented in the form is contained in multiple tables.
For example, let's say that you have an invoice with a list of purchased items. You want to enable the user to edit the invoice and the items (add a new item, delete an item, change a quantity, change the shipping address on the invoice, etc.) and you don't want *any* of the changes to take effect until the user clicks on "save".
The approach I've started using for this case is to use XML to pass the data back and forth to the database. My business layer gathers the data up from the various relational tables and packages it up as XML before passing it to the form. The form receives the data as XML and persists it. At save, the XML is updated and passed back to the business layer which breaks it back part into into its relational components and updates the database where necessary.
This seems to be working pretty well although I haven't really tried it yet on anything where performance issues would show up.
Sunday, November 29, 2009
I found Learning XML to be an easy read. It's an O'Reilly Press book and Erik Ray does a good job of presenting the content. I found his coverage of XLinks and CSS/XHTML to be of particular interest. He also covers DTDs and XSL. Recommended.
Eric Sink's book, The Business of Software, has been on my "to read" list for quite a while. I'm an avid follower of Joel Spolsky's The Business of Software forum which Eric Sink co-moderates and have already read "Micro-ISV", a book written by Bob Walsh, who is another Business of Software moderator.
Probably what I retained the most from the book were Eric's thoughts on "programmers" versus "developers". Eric defines programmers as folks who want to focus specifically on the software. They have no interest in other parts of the business such as marketing or the customers. Developers, in contrast, are flexible folks who, albeit with varying degrees of skill, are happy and eager to tackle most anything thrown at them.
As an example, Eric cites one fellow who accidentally slipped a nasty bug into one release of a shrink-wrap product. This fellow, a software developer (not a programmer), identified the bug himself and worked directly with affected customers to ameliorate any damage caused by the bug. By quickly identifying the bug and proactively notifying affected customers, he not only prevented the bug from causing any lasting harm at the customer installations but impressed the customers and increased their trust in the company.
Labels: books
Wednesday, November 18, 2009
The FTP transfer process just seems to stop, with no discernible error. If disconnected then restarted (using WS_FTP) I am able to continue transferring files using FTP so no error with either my own or the server's network.
Today I happened upon what I think is the solution: "keep-alive". FTP uses two IP ports. One is a control connection, the other a random high number port, is used for actually sending data. It seems that the problem might be that the connection for the port used as a control connection is timing out and that the solution is to periodically send some data (a "ping") to the control connection on the server so that the server doesn't decide that the control connection is no longer needed and close it down.
Fortunately, this "keep alive" functionality is built into WS_FTP under the "advanced options" on the "site options" dialog. WS_FTP accepts a value in seconds between 10 and 3600 with a default is 0 (no keep-alive message). I tried changing this parameter in WS_FTP then executing a transfer that had been problematic for me in the past, and the transfer succeeded without issue.
It looks like the WININET library might also include support for keep alive. The HttpOpenRequest function supports a INTERNET_FLAG_KEEP_CONNECTION flag. This flag is described as causing the connection to "use keep-alive semantics, if available". I'm not sure if this is the same thing as WS_FTP's keep-alive option but it seems likely and I intend to try it out.
Thursday, October 01, 2009
I use WS_FTP primarily with windows ftp servers and found that the WS_FTP sync would sometimes time out after a while, with large transfers. After a bit of dabbling, I discovered that setting "maximum transfer connections" to 0 (see ftp site properties for this), and setting "number of retries for failed transfers" to 0 (see tools/options/transfers for this) seemed to resolve the issue.
I'm using Windows Server 2008 R2 64-bit as a development platform. Server 2008 R2 is pretty much the same as Windows 7 64-bit, and I've had some issues. Although Nero and my scanner no longer work, I've found that for mounting ISO images, Virtual CloneDrive still works great.
If you're remote-desktoping into a Windows 7 PC with multiple monitors and you have windows you can't see (because they're on other monitors), you can
Finally, I found this great list of hints, tips and tweaks posted on Tim Sneath's blog: http://blogs.msdn.com/tims/archive/2009/01/12/the-bumper-list-of-windows-7-secrets.aspx
Wednesday, September 09, 2009
Just picked up a book on CSS and learned something right off the bat. A couple of cool and useful CSS tricks.
- >page-break-before: { always auto avoid left right inherit } ;
The page-break-before style can be used to force a page break before an element (say, a DIV). I often create printable versions of web pages (content minus menus) and have often wished that I could handle page breaks. Now I know how to. This is supported by IE5.5+, FireFox, Safari and Opera. - >If you are in an IE-only environment, then there are filters that allow for funky effects such as drop shadows and motion blur. Here's an example of motion blur:
.mydropshadow {
width: 200px;
color: red;
font-size: 28px;
filter:progid:DXImageTransform.Microsoft.MotionBlur(
strength=10,direction=310);
} - >selectors. I've known about attribute selectors, convenient for changing the font of text in hyperlinks when the cursor passes over them, and class selectors. But there are other types of selectors, including ID selectors, wild-cards, and combinators. I'm looking forward to improving my CSS skills. CSS is (as everyone already knows) powerfull stuff!

