Sunday, April 9, 2017

WiFi connected but network not reachable? Reboot the access point

I recently dealt with a computer that couldn't reach the network while connected to a WiFi network. All the other machines around were working perfectly fine, but this one couldn't even get an address from DHCP. Rebooting and resetting the WiFi adapter did nothing. Eventually, I logged on to the web management panel of the Linksys LAPN600 access point to check for connections. The machine was there, and all access point settings looked right. I noticed that the device wanted a firmware update, so I had it install that, and in the process it rebooted. When it came back up, the problem was fixed. I'm not sure exactly what happens to APs after long uptimes, but apparently sometimes reboots are helpful.

Saturday, April 8, 2017

Policy Plus meets the world

Today I showed Policy Plus at my school's Tech Fair. There were a total of sixteen projects presented there, from students of all grade levels. One judge looked at programming and 3D art projects, while the other judge looked at everything else. When my time came, I demonstrated as many aspects of the application as possible while also making sure to briefly look at my non-program materials (FAQ document and outline of the standard workflow).

I also gave a brief edition of my spiel to various other people attending the event. A few seemed fairly impressed; one even planned to download and see about using it. In my spare time, I looked at some other projects. I was pleasantly surprised by their quality.

When I received my project's evaluation sheet, I was pleased to see that the judge wasn't very concerned about comments. The code file I showed (PolicyProcessing.vb, my personal favorite) only had short summaries of each chunk's purpose, but the comments rubric entry had the highest state circled, as did the rest of the relevant entries. My project earned one of ten slots to proceed to the regional version of this event.

Friday, April 7, 2017

Policy Plus - Sprinkle comments everywhere

The Tech Fair that I'm presenting Policy Plus at tomorrow wants all the programs to have commented code. I hadn't been commenting unless there was something weird going on that I would need a note to understand, so there were very few comments. So today, I went through and sprinkled comments everywhere explaining why each section is there. It's not nearly "understandable by a non-programmer" as the Fair seems to want, but that's to be expected.

I also put the two helpful documents (the lexicon and listing of components) in the GitHub repository; all these changes are live.

Thursday, April 6, 2017

How do programs create enormous temporary files so quickly?

Somebody wondered how Photoshop manages to create a 2GB temporary file immediately upon startup with virtually none of the disk thrashing one would expect from writing out gigabytes. The Windows function for doing that is SetEndOfFile, which sets the length of the file to the current position. That function updates the file metadata with the new length and commits the physical space on the disk, but the space is not zeroed out until data is written beyond the valid data length (which is not changed by this function).

For paging-esque storage, this method is to be preferred over sparse files, which do not commit the space ahead of time and therefore could produce out-of-disk-space errors in the middle of something important.

Wednesday, April 5, 2017

PowerShell bot for Stack Exchange chat

Some chat rooms on the Stack Exchange network have bots that post predefined messages in response to certain triggers. (A surprisingly high proportion of these resources are links to adorable cat pictures.) As a fun challenge for myself, I tried to write one such bot in PowerShell, and successfully made something functional though minimal. It's on GitHub.

I made sure to not use any parts that require Internet Explorer components, so the script works fine on non-Windows OSes. The few HTML parsings that need to be done are handled by regex.

Sunday, April 2, 2017

Converting ESD to WIM

Today I needed to deploy a Windows 10 image downloaded with the Media Creation Tool to a machine. Lacking a flash drive large enough to hold the ISO, I tried to use Windows Deployment Services. Unfortunately, the install image inside the ISO was in ESD format, not WIM, and therefore incompatible with WDS. Last time I hit this problem, I downloaded an Enterprise version from TechNet (which does include a WIM) because the only ESD conversion solution I could find involved a rather sketchy third-party utility.

Today, though, I found a wonderfully easy method that uses only Microsoft utilities. Once I extracted install.esd, this command did the job:
dism /export-image /SourceImageFile:install.esd /SourceIndex:1 /DestinationImageFile:install.wim /Compress:max /CheckIntegrity

The integrity-checking flag might not be strictly necessary. If the ESD holds multiple images (as mine did), DISM can list them and their indexes with:

dism /get-wiminfo /wimfile:install.esd

Note that older OSes' versions of DISM might not have the functionality needed for these commands to work. For example, Windows 7's doesn't seem to have /export-image. I tested these on Windows 10.

Saturday, April 1, 2017

When Windows claims "\WINDOWS\" is missing or corrupted

I have recently been trying to repair a Windows 10 machine that suddenly decided to stop booting, failing at startup with a message stating that a required file was missing or corrupted, with the error code 0xC000000D. What's strange is that it said \WINDOWS\ was the missing file. That directory is definitely there. None of these things helped:

  • Startup Repair
  • System Restore from a recovery environment (failed with an unspecified error)
  • chkdsk (made corrections but didn't change the error)
  • sfc offline
  • dism offline
  • Replacing the EFI files from a nearly-identical machine
  • Recreating the BCD store
I am at a loss as to what to do here. Currently the best option seems to be a reinstall - all the data is safe and has been copied off.