function DiskFree($dir = "") { $wmiq = 'SELECT * FROM Win32_LogicalDisk WHERE Size != Null AND DriveType >= 2' $disks = Get-WmiObject -Query $wmiq [System.Collections.ArrayList]$newary = @() foreach ($disk in $disks) { # Write-Host "Processing " $disk.deviceId $used = ( $disk.Size - $disk.FreeSpace ) $percent = [math]::Round($used / $disk.size * 100,1) $freePercent = [math]::Round($disk.FreeSpace / $disk.size * 100,1) if ( ($dir -ne "" -and $dir -eq $disk.DeviceID) -or ($dir -eq "") ) { $dfObject = New-Object -TypeName psobject $dfObject | Add-Member -MemberType NoteProperty -Name Device -Value $disk.deviceId $dfObject | Add-Member -MemberType NoteProperty -Name Used -Value $used $dfObject | Add-Member -MemberType NoteProperty -Name UsedPercent -Value $percent $dfObject | Add-Member -MemberType NoteProperty -Name Free -Value $disk.FreeSpace $dfObject | Add-Member -MemberTYpe NoteProperty -Name FreePercent -Value $freePercent $dfObject | Add-Member -MemberTYpe NoteProperty -Name Total -Value $disk.size $res = $newary.Add($dfObject) } # Write-Host "Processed" $disk.DeviceId } $newary } function df($dir="") { DiskFree($dir) | Format-Table -Property Device,Used,UsedPercent,Free,FreePercent,Total -AutoSize }
Friday, February 15, 2019
Implementing "df" as a Powershell script
Wednesday, September 12, 2012
This is the droid you're looking for
So far it's mostly all good. Battery life is bad, but we already knew that. I tried several different home screen programs but I'm sticking with TouchWiz for now because the updated one for the Galaxy S3 works as well as anything else I tried, even the backported Jellybean launcher. It has lousy reception inside company HQ but so did the iPhone 4, just an AT&T thing I guess (my Verizon iPad has great reception inside company HQ). I'm still looking for a clean solution for automatically syncing my photos into iPhoto, but iSyncr is doing a reasonably good job of getting them onto my Macbook so I'm not too displeased.
Thus far I've found substitutes for everything I did on my iPhone except one: There is no good offline GPS program like the Magellan program that I used on the iPhone. Supposedly TomTom is going to be remedying that soon. We'll see.
So anyhow, I have found one bug in the Galaxy S3's ICS Android version: It does not handle exFAT very well. I found this out the hard way when my 64GB microSD card quit working and reported, "Damaged SD Card". Indeed, checking the Internet, it appears that random exFAT corruption is an epidemic on the Galaxy S3. This afflicts any microSD over 32GB, since Microsoft officially says FAT32 won't go over 32GB. This is, of course, a lie -- FAT32 is quite capable of handling terabyte-sized filesystems -- but because Microsoft enforces this limit in all their filesystem tools, nobody knew it was a lie until they actually looked at FAT32 and realized hey, this will work with bigger filesystems! (Though there is still that nasty 4GB limit on file size to contend with).
So how did I resolve this problem? First, I put the flash into a Windows 7 laptop and ran chkdisk on it. This found and fixed some problems. But when I put it back into the Galaxy S3 it *still* said "Damaged SD Card" despite the fact that Windows 7 said it was clean. So I resolved to reformat as FAT32. I copied the data off, and then had to go find a tool that would actually format a 64GB microSD card as FAT32 since the Windows disk manager won't do so: EaseUS Partition Master.
At that point it was just a matter of copying the data back on, which was very... very... slow since Windows operates SD cards in sync mode. As in, an hour slow. I know where the async flag lives in Windows and could have flipped it, but it was trash night so I did chores around the house instead. At the end of the process I inserted the microSD into the Sammy and... no more "Damaged SD Card".
Executive summary: If you buy a microSD card with greater than 32GB capacity, it is likely that it is formatted with Microsoft's proprietary exFAT filesystem and will not work well Android unless you reformat it, even if it appears to work correctly at first. exFAT support is not supported well because it is patented by Microsoft and thus does not have the magic of dozens of eyes of Open Source developers noticing and fixing bugs in it. So reformat it using the EaseUS tool above (NOT the internal Samsung formatter, it'll put the buggy exFAT filesystem back onto it) *before* you put stuff on it. Otherwise you'll be going through this whole time-consuming dance yourself sooner or later. Fun, it was not.
-ELG
Saturday, August 25, 2012
Windows 8 and taste
What brings this to mind is Windows 8, which I'm using to type this while eval'ing the RTM product. I'm not disclosing any NDA stuff here, it's pretty much the same product you downloaded earlier as the "Consumer Preview" with a few pieces of missing functionality filled in (and undoubtedly many bugs fixed). Windows 8 is Microsoft's attempt to re-invent the user interface, but fails primarily because of two reasons: A lack of courage, and a lack of that chief designer.
The lack of courage part is where Microsoft flinched at the notion of completely re-inventing the desktop. As a result, they have the "classic" desktop available by hitting a button on the "Modern" desktop. The end result is a bizarre mishmash of two different desktop environments in one, twice the amount of stuff to learn if you're a user because the "Classic" desktop environment doesn't *exactly* work the same as the well-known Windows 7 desktop environment, while the "Modern" desktop... well, it's entirely different, period. Twice the amount for end users to learn is user environment fail, period.
The lack of that chief designer, however, shows even more in the design of the "Modern" desktop. A good design is clean, looks simple (even if it isn't), everything's laid out in an obvious manner, there's a limited number of things for end users to learn in order to be productive, and, for lack of a better word, it is tasteful. It doesn't look like a mishmash of unrelated ideas from multiple independent teams all smashed together into one product.
That, however, doesn't describe the "Modern" desktop at all. One of the things I noted about Gnome 3 was that you had to basically know one gesture -- how to move your mouse pointer to the top left of the screen (or touch the top left of the screen on a touchscreen) -- to make it useful to you. Everything else is pretty obvious touch an icon or touch and drag an icon (or the click-on and click-on-and-drag with a mouse) or scroll up and down using the mouse wheel or two fingers. With the "Modern" desktop, every single corner of the screen does something -- and does something *different* (with the exception of the right-hand corners, which does something the *same*). Furthermore, moving to a corner, waiting for the hover timeout, then moving your mouse up and down does something even *different*. And right-clicking does something even *more* different. The confusing number of things you can do, indeed, need to know how to do to make the environment useful, are well past the three things you need to know how to do to use Gnome 3.
In essence, it's as if a bunch of geeks got together and decided to take every idea from every touchscreen environment ever created anywhere, and put them all into the same user interface. It's as if every geek critic of Gnome 3's tasteful design got together and designed their perfect touchscreen environment with every feature they could think of. It's as if Larry Wall designed the thing. Folks, Perl is many things, but clean and easy to use are not among those things -- it's an ugly, nasty, piece of work that will spit you in the eye if you look at it wrong just like the camel on the cover of the definitive book on the language. Like said camel it also happens to be very useful (thus why I wrote the virtualization management infrastructure for our virtualized product line in Perl, because it was the most reasonable way to parse the output of all the low-level virtualization-related utilities that the various virtualization systems use for their low-level management), but nobody has ever suggested that end users be given Perl as their user interface to their computers.
So the question is, will Windows 8 succeed? Well, define "success". The majority of personal computers in the world next year will ship with Windows 8 pre-installed. And because everything in post-Gates Microsoft is an API and Microsoft is quite open with their API's (Apple, not Microsoft, is the "Do Evil" company in the post-Gates era), sooner or later someone is going to come up with a means to tame this mess. But I have to say that Windows 8 is, in the end, a disappointment to me. Microsoft had an opportunity to re-define how personal computers worked, and they have all the pieces needed in Windows 8 to do so. They just needed a tasteful Chief Designer with the power to impose order and taste upon this mess -- and, alas, it appears they have no Jon Ives or Sergei Korolev to do so.
-ELG
Friday, March 2, 2012
Random notes on automating Windows builds
- Install the version control system of choice. In this case, bitkeeper, but any other CLI-drivable vc system will work.
- Check out your directory tree of the various products you are going to be building.
- Install the *real* Microsoft Visual Studio 10
- Create a solution (Microsoft-speak for "makefile" though it isn't) for each of the individual solutions you are building as part of your overall product and make sure each solution builds. This will be saved in the file Foo.vcxproj (for some solution named Foo) in each solution's root directory.
- Add the directory that 'devend' and 'nmake' lives in to your PATH in your system config. Control Panel->System->Advanced SYstem Settings->Environment Variables, edit user variable Path. My Path looks like: C:\Users\eric.green\bitkeeper;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE;C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin
- Create a standard Unix-style makefile in the parent directory that has a list of the subdirectories to recurse into, then in each subdirectory, a Makefile that has 'devenv /build Foo.vcxproj' to build and 'devend /clean Foo.vcxproj' to clean.
- Test your make file with 'make', make sure that the proper .exe files are produced in each of your subdirectories.
- With Visual Studio closed, install Wix and Votive
- Use Votive to build a WiX project file and "compile" it to XML.
- candle product.wxs
- light product.wixobj
Install Jenkins to integrate with the source control system, check from time to time for new checkins, then fire off a build via use of nmake when the checkins happen. Jenkins does run under Windows, with some caveats. See e.g. Setting up Jenkins as a Windows service. Biggest issue may be getting email to go out on Windows, will have to investigate that further once I get to that point.
--ELG
Wednesday, February 29, 2012
Microsoft and the epitomy of fail
Well, here's the deal that I've found out this past six weeks or so: Developing for Microsoft products is a painful and expensive process. What that means is that Microsoft has lost the student and hobbyist markets, and that's where the people who create new stuff come from -- they don't come from stuffy old companies that have $10K hanging around for Microsoft licenses for a single engineering team.
So anyhow, I recently created my first tray app. It used a couple of MFC functions where I could not find an equivalent anywhere else in the system that would do what I needed done. Because of that, it would not compile with Microsoft's "student and hobbyist" product, Microsoft Visual C++ Express. Once I did a workaround for that (temporary install of the demo version of the full Microsoft Visual Studio just to get access to the MFC include files and library), then there was another issue: Visual C++ Express won't create a .msi installer file for distributing your program. I worked around this by using an open source program called WiX to build an XML template for my package, and successfully managed to create a .msi file. I installed it. I used the control panel and uninstalled it. Yay.
But here's the problem. I'm a hobbyist when it comes to Microsoft software. As a hobbyist I only write Open Source software (if you want closed source software out of me I'm happy doing it, just pay me $$$, but that's not my thing with hobby software). As a hobbyist I don't release software that can't be compiled unless you pay Microsoft hundreds of dollars for the full Microsoft Visual Studio, or do possibly-illegal workarounds like installing demo versions on top of crippleware. So you'll never see this tray app and it's probably the last time I write anything for Windows that I'm not paid to write.
Multiply that decision by tens of thousands of hobbyists who look at the same situation and instead go write software for Linux, and you understand why Microsoft lost the Internet. I did this because I needed to learn how to work with Microsoft's software to do some stuff at work, but most people simply aren't as driven as me when it comes to learning new things. They take the easy path... and that's Linux.
Too bad, Microsoft... your stuff actually isn't that bad, it's ugly and a bit incoherent but then so is Linux. But if you make it hard for people to get used to writing software for your platform on a hobby basis, you lose. It's that simple. Microsoft Visual Studio Express is useless -- you can't write real programs for Microsoft without MFC, and creating MSI files should Just Work rather than having to go search for a third-party tool. With Linux, it Just Works -- fire up Eclipse and start developing C++ or Java programs, that simple. With MacOS, it Just Works -- fire up XCode and start developing Mac programs in Objective C or other supported languages, that simple. Windows? It's a painful experience trying to get around cripple-ware. And once that happens, there's one word to describe your company: Fail.
What's Microsoft's future? Microsoft really has no future other than as a legacy company. They lost the Internet and the Cloud because they preferred wringing money out of their devtools division (and it can't be a huge amount of money even) to fostering the next generation of innovators with free or inexpensive tools to use to write software for Microsoft's platforms, and they'll lose the next major innovation to happen in computing too. And one of these days, the accumulated sum total of these innovations will render Microsoft as irrelevant as Unisys -- just another legacy company milking its legacy products for service income long after they've become irrelevant to the majority of the industry.
-ELG
