July 2005 - Posts
What do you get when you cross SharpZipLib and XPBurn and another 30 lines of code? My own personal back up system. Since I have setup Subversion on my system for my personal projects I decided it was time to also have a backup system in place.
All it does is take a folder which I point it at, zip's it up with the current date time, and then burns it to the disc in the cd-rom.
Chad Myers posted some feedback to my previous post regarding C# and Subversion. He indicated that the company he is with has a .NET plug-in architecture for Subversion, the post-commit hook. Well I decided to throw this together, with the intent to share it out to everyone (just in case Chad cant share his stuff out).
The code includes a basic Email plug-in and the beginnings of a plug-in for FlexWiki.
If your into this sort of thing, grab a copy of the source and leave me some feedback.
I have plans on investigating the other hooks at some point in time...
One thing I noticed yesterday when setting up Subversion is that it has
"Hook Scripts". "A
hook is a program triggered by some repository event, such as the creation of a new revision or the modification of an unversioned property. Each hook is handed enough information to tell what that event is, what target(s) it's operating on, and the username of the person who triggered the event. Depending on the hook's output or return status, the hook program may continue the action, stop it, or suspend it in some way."
In the doc it mentions...
"Windows, however, uses file extensions to determine whether or not a program is executable, so you would need to supply a program whose basename is the name of the hook, and whose extension is one of the special extensions recognized by Windows for executable programs, such as
.exe or
.com for programs, and
.bat for batch files."
This has to be too easy. So I whipped up a quick C# Console Executable:
"post-commit.cs" Source Listing:
----------------------------------
using System;
namespace post_commit {
class Class1 {
[STAThread]
static void Main(string[] args) {
System.IO.StreamWriter sw = new System.IO.StreamWriter(@"f:\PostCommit.txt", true, System.Text.Encoding.Default);
sw.Write(System.DateTime.Now.ToString() + ":" + string.Join("|", args));
sw.Close();
}
}
}
----------------------------------
Now build it, "csc post-commit.cs"
Built it, and placed the .exe into the Project\Hooks\ Folder. Now commit any file into the repository; you should see a file f:\PostCommit.txt created. Inspect the contents.
I wonder what cool things are being done with Hooks and subversion. Obvious examples (in the Doc's) include triggering backups, and sending emails.
I have this semi-open-source project that I work on with a few others which I needed version control for so I decided to setup Subversion with Apache this evening. Things went well, it was a farily easy install process.
You can download installers for both products on their respective sites. Make sure you read up on the Subversion docs exactly how to integrate with Apache, with the Modules and Authentication if you need it (http.conf). Since IIS is my Web Server of choice, I simple chose to run Apache on a non-standard port, its a no brainer in the http.conf file. Oh, and make sure you install Apache as a service.
I think the hardest thing was to get used to the way that Subversion does its job.
I successfully imported the entire project and even integrated the entire thing with VS.NET 2003 via this plugin. So far, it is much nicer that Visual Source Safe and appears to have much more capabilities as well.
Check out the difference here:
1st Ave and Victoria Drive as Google see's it 1st Ave and Victoria Drive as Microsoft see's it Now for each map, switch over to the Arial/Satellite view.
I also like the fact, that with Google, all I need to do is punch in a Postal Code or Zip code and the map centers on that location. I cant seem to find this similar functionality with Microsoft's product.
Take a guess which one I will be using?
I just wanted to throw out some ideas that I had regarding the new MSN, whenever it is slated to arrive. These are in no particular order...
1. Managed (.NET) Plug-in Support. UI changes, functionality changes, allow us to trap the generic events OnRawReceived(), OnMessageReceived(), OnMessageBeforeSend() etc.. and manipulate those messages going in either direction.
2. Abilty to minimize to tray, no popups, and just flash in the tray on message received (of course flesh out some useful options and setting alternatives here)
3. Group conversation windows (tab placement, amount of conversations per tab, etc. should all be configurable)
4. Alias people's display names, and allow for grouping of contacts
5. Be able to view/download Display pictures from contacts
6. Be able to customize incoming message events (like different sounds for each contact, could be done via a plugin easily)
7. Allow slash commands, for example "/me ...". Similar to IRC
8. Allow ability to ignore colors/formatting/etc..
9. Time Stamps on messages and log files
10. Multiple, and seperate, accounts in a single instance
11. Skin support?
I guess you could simply download
Gaim and
Trillian and steal as many ideas out of them as you can.
So I have a method which I can call with just a filename and some other meta data and it will go out, open that file and return back a recordset. Sounds easy, right?
During this import process you actually can use OLEDB, and ADO to do the work for you. New up an Adodb.Connection, passing the properly formatted connection string, and then select * from your datasource.
So what do I do with this connection object once I have selected all of the data out?
Well I would just love to disconnect the recordset, the same old fashion that I have been doing for YEARS in a typical environment (non-text drivers). What you simply need to do is set the "CursorLocation" of the recordset to adUseClient, PRIOR to actually opening/populating it with data. And then once its all loaded up, you can Set the "ActiveConnection" to nothing, which results in our disconnected recordset. From there, make sure to .Close() and set your connection object to nothing (proper housekeeping, of course).
Read more on the different types of Cursors So, when I change my cursor to adUseClient I see the error:
"Data provider or other service returned an E_FAIL status error"
A quick google on it turns up the real reason (thank god it is a simple solution) for this error. It has to do with the data types of the source and how OLEDB and ADO maps that into your recordset. For example, lets say your selecting from an excel document and you had a phone number field, and the first few values were seen as:"6043359632" the resulting recordset will treat that as a numeric. But what happens when further down the list someone used the format: "604-335-5639", that simply will not map easily into any sort of a numeric field, so the result is the annoying E_FAIL status error when using a client sided cursor.
Specifically what I was doing, was mapping the field names in my source data file to the very specific list of fields in my destination, like this:
select '' as [Notes], [CityName] as [City], [AreaCode] + [Phone] as [Phone]
Notice that i used a "+" to concantenate those two fields. My bad. It would have attempted to add those fields numerically and treat the final field as a numeric. I switched it over to use "&" to do the concantenation and all is well.
Luckily this specific project is coming to a close soon enough. I have had enough.
Navigate to: http://www.start.com/myw3b/
In the search box, type C#
and then hit the search button
A funny conversation we had about wincv.exe
http://iceglue.com/tranqy/HowTheHellDidIMissThisForYears.aspx You see, it pays to listen in sometime, you might just learn something.
[Edit]
Follow up conversation
[10:55] <Pir8> wtf is wincv.exe ?
[10:55] <NothingMn> start, run, wincv.exe
[10:55] <NothingMn> you must have the .net sdk in your path
[10:56] <Pir8> no dice
[10:56] <Pir8> aaaah
[10:56] <NothingMn> go to the vs.net command prompt window
[10:56] <Pir8> f*ck nice!
[10:57] <Pir8> HOLY MOTHER OF ALL SH*T!
I'm writing some import code, working with excel and the OLEDB driver via ADO, and I started to see this error:
Run time error '-2147467259 (80004005)' : [Microsoft][ODBC Excel Driver]Selected collating sequence not supported by the operating system
After a few minutes with my pal Google, here is the MSFT KB url:
PRB: Collating Sequence Error Opening ADODB Recordset the First Time Against an Excel XLS
SYMPTOMS
Opening an Microsoft Excel spreadsheet from within Visual Basic in Visual Studio 6.0 Service Pack 3 (or later) Integrated Development Environment (IDE) with the Excel/ODBC/ISAM driver generates the following run-time error:
Run time error '-2147467259 (80004005)' : [Microsoft][ODBC Excel Driver]Selected collating sequence not supported by the operating system
This problem occurs every time that you run the code within the Visual Basic IDE.
NOTE This error does not occur if the all the fields are selected in the SQL statement, for example:
SELECT * FROM ...
Also, this problem does not occur within a compiled EXE.
A solution to this problem? None. Just remember when debugging in the IDE and you see an error, just re-run the select statement, second time through it works fine.
Next. Have you ever tried using the Jet/OleDB driver to open a Tab Delimited Text file, without using Schema.ini? From what I can tell (googling and too much testing for what it is worth), you CANT. You must write out to the same folder as the data, a
Schema.ini which is properly formatted for what you would like.
Ugly, since most of us like to run as non-administrator it really sucks when we are not sure if we can even write to that same folder, so now we are forced to check for write permissions, attempt to write and if there are any failures kindly let the end user know that they must move the file to a "better" location. Why oh why!?
The second option would be to overwite the default Format option in the registry; a quote from
a article on MSDN reads:
"Admittedly, opening the Registry, changing the value of Format, running the script, re-opening the Registry, and then changing the value back again can be a bit tedious, to say the least. But remember, you can change the registry from within your script."
It indicates NOTHING about security and running as non-administrator. Sounds like a support nightmare to me.
More Posts
Next page »