Carlos 的个人资料Bigsibling's Place照片日志列表更多 ![]() | 帮助 |
|
9月20日 The Unit - season premierCBS' "The Unit" season 2 startsThe Unit on CBS (Tuesdays 20:00 hrs CDT) is the absolute best 60 minute commercial for the United States Army every created. The good guys go out to kill and/or capture the bad guys. They always accomplish their mission (despite how many times the mission objectives might change) and they always come home. AND when they get home, their wives and children are there waiting for them all happy to see them and so extremely supportive of how their men go off to keep the world safe and fight for truth, justice and the American way. Hey, I said it was a great commercial for the Army, I didn't say it was in any way realistic. But sometimes that's just what is needed. All of the great old TV shows (Charlie's Angels, Starsky & Hutch, etc) were not the least bit realistic. Too much realism started creeping into TV with shows like Hill Street Blues. It's good to get some shows that are not realistic, but simply entertaining. And this show is all that. The season opener didn't take up from last season's cliff-hanger where Jonas was shot and laying on the floor. It looks like it picked up about 6 or 8 months later. Jonas was all healed, the baby was born to the "newbs" and they were already in the field along the Pakistani/Afgan border. From there it just got better. It did leave you wondering if they folks who crashed the wedding party and did all the shooting last season were ever apprehended. I'm guessing not and that story arc will be taken up in the next two or three episodes. 9月19日 Criminality of the PopeWill Il Papa have the right to remain silent?As you know, Muslims from all over the world are violently angered that Pope Benedict quoted an old emporer who said that the only thing Mohammed brought was inhuman and evil. The peace-loving, tolerant and rational Muslims, while not burning and shooting at churches, are busy being hurt and offended by Il Papa's suggestiong that Islam is portrayed as a violent irrational religion. It is beyond me how anyone could see these people as "irrational".
Il Papa in hot waterPope's quotation of nearly ancient statement lands him in the hotseat.
The Pope is getting grief for speaking what many see as the truth about Islam. For those living in complete darkness, here is what Il Papa had to say in a speech in Germany: Of course, the muslims around the globe are criticizing the beloved pontiff. Such as the spiritual leader of Lebanon's Sunnis, the Grand Mufti Sheik Mohammed Rashid Kabbani:
But it is oft said that actions speak louder than words. For instance: And so it goes with the people who claim to subscribe to a religion of peace and tolerance. It does seem that the Indians (from India, not the Injuns from America) have it right:
9月13日 Getting drive information in C#Using System.Management and Win32_LogicalDiskIn my last post, I briefly spoke about finding drive information in a C# application. The problem I've been trying to solve is that I have a windows form that needs to run at the end of an install. The form allows the user to copy files from a specific location on the install DVD to the users machine. The files are about 1.3Gb, and I didn't really want to package all that data into one MSI file. A problem arose when the install was finished, and the little windows application was copied to the user's machine, how can I find the DVD drive? And after I found a DVD drive, how can I make certain it is the correct drive with the correct disk? I started out by importing the kernel32.dll and using the external GetDriveType(string drive). This worked, but I was really wanting to find a C# way to do this without having to import anything else. Enter System.Management - which allows a user to get all of this information natively in C# using Win32_LogicalDisk. Win32_LogicalDisk give you access to a plethora of information on all physical and mapped network drives. You can get the drive name, device id, volume name, serial number and on and on. In addition, you can run SQL type queries against the drive to get just the desired information from the desired drives or drive types or drive sizes and so forth. Since I am interested in finding CD/DVD drives, I had to find how to tell what kind of drive I was looking at. The following (from the above linked MSDN page) table was a great help:
Using System.Management.ManagementObjectCollection and System.Management.ManagementObjectSearcher I was able to create a collection of all drives with a device type of 5. ManagementScope ms = new ManagementScope(); ObjectQuery oq = new ObjectQuery("SELECT DeviceID, VolumeName FROM Win32_LogicalDisk WHERE DriveType= 5"); ManagementObjectSearcher mos = new ManagementObjectSearcher(ms,oq); ManagementObjectCollection moc = mos.Get(); Then I loop through the collection to check out each object's information: foreach (ManagementObject mo in moc) { if (moc["VolumeName"].ToString() == "myString") DirectoryInfo newDI = new DirectoryInfo(System.IO.Path.Combine(mo["DeviceID"].ToString(), "myPath")); } So now I have what should be the proper path to the files I want to install. Another route to this information is via the ManagementClass class. It is a little cleaner, and a bit quicker to code, but does give you more than you might need for your particular purpose. ManagementClass mc = new ManagementClass("Win32_LogicalDisk"); ManagementObjectCollection moc = mc.getInstances(); foreach (ManagementObject mo in moc) { // Your code here } Few less lines of code, but a much more generic return on the drive information. Windows Installer ExperiencesLaunching a windows application after install completes in Windows InstallerI was tasked at work to become the "install czar" so to speak. For this, I needed to learn some things about the Windows Installer. While there is a pretty good guide for the Windows Installer at Microsoft's MSDN site, much of the information was elusive. For instance, I needed information about custom actions. For one installation I created a windows forms application which would copy a boat-load of images from the install DVD to the client machine. The images were about 3Gb in total size, so I didn't want to package them in the install. The install contained a small sampling of the images, and it was bulging at 300+Mb - this takes such a long time to process, checkout, build etc. MS has a pretty good CustomAction Reference page, but it didn't cover everything I was looking at. I went into the setup project I had created in VS 2003, added the .EXE I had created and added it to the "Install" custom action. It seems to me, this should have worked, but it didn't. It appeared the EXE was never called. So I downloaded the Windows Platform SDK which comes with an ultra-cool tool called Orca which allows editing of the MSI tables. Looking at the tables, the EXE being called had a type of 1024. However, there was not 1024 type in the reference page. Long story short, I found this blog from some guy calling himself Boneman, which is an excellent tutorial for Custom Actions in the Windows Installer. I tried everything I could think of to get this stupid application to launch at the end of the install - nothing seemed to work. Then I went and revisited the Custom Actions section in the VS IDE. What I found was a property settings named "InstallerClass". I set that to "False" and voila! It worked! But my application was flawed. I didn't know exactly what the working directory would be, I thought it would be the directory from which the install was launched. I was wrong, it was the directory in which the application file was placed. Now I needed to find the correct DVD drive in order to get the images off of it. To accomplish this goal, I imported the kernel32.dll to access the GetDriveType and GetVolumeInformation methods. These two methods return to me the type of drive, and all of the drive information you think you might ever want. Well, actually, the GetDriveType returns a System.Long value, and you have to know what each value represents. Here is how I figured drive type: Now, figuring out that 5 is the CD drive took quite a bit of searching, but having the Platform SDK mentioned above sure helps. At any rate, I got the CD drive, then looked for the volume name that I named the DVD during creation. If it locates that and the proper directory is on that disc, then it copies the files. If not, I pop up a folder browse window to allow the user to determine where the image files are. 9月12日 9/11: 5 years laterWhere does the time go?
Sunday night I watched the 9/11 documentary aired on CBS. In fact, I made my two boys (11 & 13) watch it as well. It's a great show, and I recommend that every single American over the age of 10 watch this documentary. There is some bad language in it, but it is an accurate historical archive of that dreadful day, caught by French filmmakers, Jules and Gedeon Naudet completely by chance and happenstance. The two filmmakers were filming a documentary of an FDNY rookie, from entering the academy through his first 9 months on the job as a "probie" or probationary firefighter. The probie was housed at Ladder 1 Engine 7, several blocks from the WTC. It was chance and luck that the filmmakers were at that station, who were the very first responders to the disaster. They have actual footage (and I believe the only footage) from inside the WTC Tower 1. It doesn't quite feel like 5 years since the attacks on 9/11. It feel, in some ways like it was just last week - but in other ways it is so surreal it feels like it wasn't even in my lifetime. I don't fully know how to describe it. Living in fly-over country, it isn't very difficult to not think about that day. To just go about life like it never happened. To try and remember to pick the milk up on the way home from work, to help the kids with their homework, or mow the lawn or what not. But it's not something we normally wake up with every day. We don't pass ground-zero in the cab on the way to work. Most of us here in the middle lands didn't lose people in the attacks, and it wasn't very close to home really. We couldn't see the smoke or devestation except through the TV. I was appalled on the way to work today at how many businesses and houses did not fly the United States flag at half-mast. How quickly we all forget...or perhaps it is that they are afraid to offend people. I am still a bit uncertain how the American flag can offend those people living and working in America. And it is beyond my scope of understanding how companies can prohibit the display of the flag because some might be offended (this did happend shortly after 9/11 and again shortly after the invasion of Iraq). I'm interspersing this entry with pictures from 9/11. I think it's terribly important that people look at the pictures and videos frequently. The more we see them, the less likely we are to forget. |
|
|