Tuesday, December 31, 2019

laptop - ATI Radeon HD 4650 poor performance in battery mode



I have an AHTEC Sense XHLB2 (a relabeled version of the Compal HLB2) that has a VGA ATI Radeon HD 4650.



When I switch off the power plug and run into battery mode the perfomance of the laptop is severely affected. After running some benchmarks I found that the VGA results are something between 35% and 200% slower.




How can I avoid the change of the VGA performance even If this makes my battery life shorter?



EDIT: Changed typo from 6450 to 4650.


Answer



ATI graphical cards on laptops are relying on the PowerPlay "technology".



It adjusts the frequencies from the GPU and its memory, to save power. You can deactivate this option in the Catalyst control center which should be installed with your drivers:



powerplay options




If you deactivate it simply, the card will be on maximum performance all the time. You can also enable it, and choose yourself which performance level should be used depending on the power status (if I remember good, there is also an intermediate step between max and min, on ATI power management, which could be eventually enough for some programs, and would allow to save power compared to the maximum, in battery mode).


Find and rename a folder Windows Batch


I have multiple directories with names of artists and within them can be one and many directories with names of albums. Example


Michael Jackson\Invincible (Album)
Michael Jackson\Thriller (Album)
Luciano Pavarotti\'O sole mio (Single)
Queen\Bohemian Rhapsody (Single)

I would like to rename all the folders that have " (Album)" and simply leave them the name of the album.


Leaving the previous example as


Michael Jackson\Invincible
Michael Jackson\Thriller
Luciano Pavarotti\'O sole mio (Single)
Queen\Bohemian Rhapsody (Single)

I have this code but I don't know how to search for folders that contain " (Album)" and delete that.


@echo off
setlocal disableDelayedExpansion
for /d %%A in (*) do (
set "folder=%%A"
setlocal enableDelayedExpansion
REM rename folder
endlocal
)

The truth is that I've never done anything so complex.
If anyone could help me, I'd really appreciate it.


Answer



A command to "search" for folders containing "(Album)" would be:


dir *(Album) /s /b /ad

See dir /? for more information. This could be the list to use in the for loop.


Just tried and this should work:


@echo off
setlocal enabledelayedexpansion
for /f "tokens=*" %%f in ('dir /s /b /ad "*(Album)"') do (
set "filename=%%~nf"
ren "%%f" "!filename:~0,-7!"
)

iTunes on Mac: How to use an external music library on a NAS (Windows share)?



I have a large music collection of mp3-encoded CDs stored on a NAS (Windows share). I can access the drive via SMB on the Mac. I'd like to change my default iTunes music library without importing the files to the local disk.



Please could somebody describe the procedure how to change that in iTunes. I see some options, but I'm not sure and I don't want to jeopardize my collection. Are there any caveats?


Answer



Hold the option (alt) key when opening iTunes and you'll be prompted to either create a library or choose an existing library.



You can then select the iTunes library that you have stored on the NAS share.




This method may require that the NAS share contains a iTunes library file. If it does, then you might be able to copy the default one created when iTunes starts for the first time and move it over to the NAS share.



The when you add music to iTunes, it will be written to the library file stored on the NAS share. YOu can turn off the options to make iTunes keep you music organised and turn off the copy files to iTunes Music Folder to prevent it from moving or creating dupes of your music files.


cooling - Why is my computer fan so loud?



Recently my home desktop computer has been reacting a lot more to heat levels. The fan starts maxing out just about any time the CPU is used, and it's very loud. It didn't use to do this - only in the last year or so (it's about 3 or 4 years old). I've removed all the dust I can find, but Speedfan shows it's running at about 130 degrees, and when it goes a tick above that the fan goes crazy.



Any ideas? Can the heat sink fail over time? Do I need to get better/quieter fans?



I'm not looking to put a lot of money into this system, so I'm hoping for any low cost ideas.


Answer




It sounds like the bearings on your fan have worn. The cheapest solution is to buy a new fan.



Remove the old one and take it down to your nearest computer parts shop and get one the same size and rating and with the same plugs to replace it.


Monday, December 30, 2019

windows 8 - Append to System PATH variable without including the User's PATH variable


Imagine the following environment variables:


System PATH = C:\Windows
Bob's User PATH = C:\Users\Bob


In a command prompt the PATH command returns C:\Windows;C:\Users\Bob


After running setx /m PATH "C:\Node;%PATH%"
System PATH = C:\Node;C:\Windows;C:\Users\Bob


In a new command prompt the PATH command returns C:\Node;C:\Windows;C:\Users\Bob;C:\Users\Bob


Another user, Alice, logs in.
Alice's User PATH = C:\Users\Alice


On a command prompt the PATH command returns C:\Node;C:\Windows;C:\Users\Bob;C:\Users\Alice


Bob has a duplicate path in his PATH variable, and Alice has Bob's paths in her PATH variable.


Is there a way to append to the System PATH without polluting it with the current user's PATH?


Answer



In Windows 7, you can look up the System Path with


reg query "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v path

If that still works on Windows 8, then use that to build the new value.


You'll have to figure out how to parse the output of reg query
Here's something that might work:


for /f "tokens=1,2*" %a in ('reg query "HKLM\…\Environment" /v path') do set currentValue=%c

where



  • the 'reg query "HKLM\…\Environment" /v path' string
    is the reg query command (given above) enclosed in single quotes.

  • a, currentValue, and c are variable names. 
    You can choose whatever variable names you want,
    with the constraints that the a and the c must be single letters, two letters apart
    (e.g., you could use n and p, or x and z).

  •                             for /f "options" %variable in ('command1') do command2
    runs command1, parses the output, assigns value(s) to the %variable(s) (%a, above; but see also below) and executes command2.

  • tokens=1,2* means that %a gets the first token (word) of each (remaining) line,
    %b gets the second word, and %c gets the rest of the line.



    • The first word is path (the value name).

    • The second word is REG_EXPAND_SZ (the value type).

    • The rest of the line is the value.


    (You could just use tokens=2* and then currentValue=%b.)



So, after executing the above, you should be able to do


setx PATH "C:\Node;%currentValue%" /m


  • If you do this in a script (a .BAT file), use %%a and %%c.

  • Be sure to test this with echo commands before you do it with setx.


Keyboard types by itself

I'm helping my sister and here is the issue she told me about:




When she puts the typing marker in a typing bar (i.e Google search bar) it automatically starts to type a certain key (to be exact "s") in a sequence. It doesn't stop no matter what. If typing option is available that's what happens.



Any one familiar with that issue? Is it a virus? For now I recommended her to check the keyboard circuit and to clean it (that recommendation I took from here about a bit different problem involving similar properties).



Thanks ahead

Sunday, December 29, 2019

Accessing secpol.msc on Windows 7 Home Premium?

How do I get access to secpol.msc the Local Security Policy Editor from Windows 7 Home Premium.


Do I need to install or enable this for accessing it on Windows 7 Home Premium?

windows 7 - Where is the " Clean up System Files" in "Disk Cleanup Wizard"?


I am trying to reduce the size of my WinSxS folder by following this article on How-To Geek:


http://www.howtogeek.com/174705/how-to-reduce-the-size-of-your-winsxs-folder-on-windows-7-or-8/


In there it says:



To clean up such update files, open the Disk Cleanup wizard (tap the
Windows key, type “disk cleanup” into the Start menu, and press
Enter). Click the Clean up System Files button, enable the Windows
Update Cleanup option and click OK. If you’ve been using your Windows
7 system for a few years, you’ll likely be able to free several
gigabytes of space.



Well, I have been using my Windows 7 (Ultimate, 32-bit, VMWare VM) for several years, running Windows Update regularly, but for some reason my Disk Cleaner wizard is not giving me the "Clean up System Files" button:


enter image description here


One may say, that this is because there is nothing to clean up but I have verified that my monstrous 5.7GB WinSxS folder indeed contains junk from prior years.


I also tried to use CCleaner but to no avail.


Any idea what I am missing?


== UPDATE ==


After @magicandre1981 kindly explaining how to find that button and that I was essentially already running as if the button were pressed (by virtue of running it as Administrator), I tried DISM:


DISM /online /cleanup-Image /spsuperseded

enter image description here


It appears that DISM does what Disk Cleanup does for system files. Is that so?


Answer



It already shows you all options to clean system files (system service pack cleanup and the dialog more options are a system task).


Running it as normal user doesn't show it and shwos the button:


enter image description here


This happens if you run %windir%\system32\cleanmgr.exe always as admin or disabled the UAC completely, here cleanmgr.exe always runs as admin.


memory - Can I find the exact type of RAM without looking inside?






There are similar questions but nothing exactly about this:


Without opening the computer, how can I determine what kind of RAM to buy?


I want to max out my RAM to get a cheap and simple performance improvement. I know I'm running a 32-bit OS and upgrading to 4GB will only give me 3GB, but I could consider going 64-bit later on so I really do want 4GB.


I've got the machine specs sort-of but not so precise that I can deduce the exact RAM format. I know I've got 4 slots, 2 of which are in use with 1GB in each.


I could open the machines (there are two different machines), count the pins, photograph the RAM sticks, and post everything here -- but I'd rather not unplug and open the machines because they're tucked a bit out of the way. I know I need to open the machines to install the RAM anyway, but I'd prefer to open them only once.


Is there another way to identify the RAM precisely enough to be able to order more RAM based on that information?


Answer



Go to Cruical.com and run their test. It will tell you.


You could alternatively use Speccy or some other alternative, there are plenty out there.


how to troubleshoot shutdown problems in windows 7

I have a desktop with windows 7 ultimate installed. Whenever I shut it down from the start button. The text that says that it is logging off and shutting down is present and the monitor blacks out and says no signal. But the lights in the RAM is still on and all the fans in the desktop is still spinning. Why is that? It seems like its not shutting down completely.
I have also got disk problems lately. Event id 175 and 50. Which I think is caused by the computer not shutting down completely. How do I troubleshoot this one?
Feel free to ask if you need more details, thanks.

partitioning - Slightly shrink a DD image for cloning


I have read several of the proposed solutions that appear to say that shrinking a image created with dd is simple using resizefs, but they simply don't work.


I need to shrink an image by only about 200MB as it is slightly too big to fit on some CF cards which vary very slightly in their capacity, even thought they are all 8GB cards.


I have a 8GB image with a single 7.8GB partition that was created using dd, and using fdisk it appears that the image is fine:


fdisk DISK.img
Welcome to fdisk (util-linux 2.33.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): p
Disk DISK.img: 7.8 GiB, 8375185920 bytes, 16357785 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xb8342d9e
Device Boot Start End Sectors Size Id Type
DISK.img1 * 2048 14649343 14647296 7G 83 Linux

I need to shrink this down by about 250MB and have tried using resizefs, but that fails:


# resize2fs DISK.img 7.8G
resize2fs 1.44.5 (15-Dec-2018)
resize2fs: Bad magic number in super-block while trying to open DISK.img
Couldn't find valid filesystem superblock.

What am I doing wrong?


Answer



TL;DR


Write the image to any card that declares capacity of 8 GB and ignore no space left on device. Warning: this is not a general answer to all similar problems.




Answer to explicit question



What am I doing wrong?



You're trying to operate on the entire image, while the filesystem starts with offset (it lives within a partition within the image). Your DISK.img is like /dev/sdx, while you should invoke something like resize2fs /dev/sdx1 …; but for now you have no analogue of /dev/sdx1 in the directory tree.


In general you can shrink the filesystem by mapping the partition with tools like kpartx or losetup. But in your particular case there is nothing you need to do.




Explanation


The partition that holds the filesystem ends at the sector number 14649343. Numbering starts at 0 and the logical sector size is 512 bytes. The partition table lives in the MBR which is sector 0, and (contrary to GPT) there is no metadata at the end of the image. The initial stages of bootloader (if any) are in MBR and before the first partition. This means only the first 14649344 sectors (14649344 * 512 = 7500464128 bytes) matter; anything beyond may be lost, overwritten, truncated etc. (unless the unpartitioned space at the end does indeed hold some useful data; this would be very unusual though and if you don't know it's the case then it probably isn't).


So the image can be written to any device that is at least 7500464128 bytes big and all the useful data will fit. This is about 7.5 GB or 7 GiB. The number you used (7.8G) specifies 7.8 GiB (see man 8 resize2fs), so it's even bigger than the filesystem you already have (this means you wouldn't be shrinking in the first place).


Just check (e.g. with fdisk) if your target device has at least 14649344 (logical) sectors of 512 bytes. (Note: for a device with 4096-byte logical sectors you would need to translate the partition table; but this may be a problem with some large HDDs, not CF cards).


After you check the target device is large enough to hold the useful data, copy the image to it (with dd, cp, cat, …). If the device is smaller than DISK.img, you will get no space left on device, but this only indicates that the unused space at the end of the image doesn't entirely fit.


Or you can truncate the image first, so there is no unused space at the end at all:


truncate -s 7500464128 DISK.img

Then fdisk -l DISK.img will tell you there are exactly 14649344 sectors. The last sector (with number 14649343) will still be the last sector of the partition but there will be no space after the partition. Now if you write the image to a device large enough, you won't even get no space left on device.


In theory the filesystem may be even smaller than the partition, but it probably isn't. If it was then adjusting the partition to the filesystem and truncating further would be possible. I won't cover this case here. The image you already have should fit into any card that declares capacity of 8 GB.


Saturday, December 28, 2019

laptop - Driving two 2560x1440 displays with Lenovo T430 and 433715U ThinkPad Mini Dock Series 3


I want to grab a second HP ZR2740w for use in my home office. I have a Lenovo T430 with an Intel HD4000 GPU, not the nVidia model.


The HP monitors come with Dual-Link DVI or DisplayPort for connectivity. The Lenovo dock has a single DisplayPort, a single-link DVI, and a VGA connector. The only output on the dock that supports 2560x1440 is the DisplayPort, which is in use by my current single monitor.


The options, as I see them, are:



  1. Get a second monitor and use a DisplayPort to mini-DisplayPort cable and plug it directly into my laptop's mDP port. According to random forums on the Internet, this will work, but I can't find an official support statement from Lenovo on this. It also defeats the purpose of the dock.


  2. Get a second monitor with a lower resolution and connect it to the dock's single-link DVI. This is a bummer, as there's a sweet deal going on near me for the HP monitor that I mentioned, and I already own one of them.


  3. Get some kind of DisplayPort splitter. I've seen some talk that electrically, a single DP connector can support two devices at 2560x1440. Is this true? Will these devices work on the dock that I've mentioned?



Unfortunately, it's not possible to get a new dock. They are work-issued. Also, if there are any options that I've missed, feel free to chime in!


Answer



I ended up biting the bullet and doing option #1 with a DP to mDP cable and connecting directly to the laptop's mini-DisplayPort for the second screen.


windows 7 - Can't boot after deleted System Reserved Partition

I only have Windows 7 installed. I accidentally deleted the System Reserved Partition and now I can no longer boot into Windows 7. The installation of Windows and all my files still exist in the partition, but without the System Reserved Partition I can no longer boot.


After I deleted the System Reserved Partition I moved left the primary partition to fill the space.


Is there any way I can "reinstall" that System Reserved Partition and the boot files?

internet - RDP connections keep dropping

I have an odd problem on my notebook (HP Pavilion dv7). My Internet connection seems OK for the most part. But lately I've been having trouble with Remote Desktop connections. While I can connect to remote computers, the connection is very flaky, and usually drops after a few seconds. Sometimes it'll successfully reconnect automatically, and sometimes not. But even after successful reconnection, it'll just drop again after a few seconds.


This appears to be independent of which RDP host I'm connecting to, and which network I'm connected to locally, whether wireless or wired.


Other remote control apps like TeamViewer and Ammyy seem to work fine.


Any ideas?

Friday, December 27, 2019

download - Mass downloading a set of URLs with login




I'm looking a mass-downloader to help me download the entire database from a site I have an account on. The requirements are simple:



  1. Login using my user and password (form-based login)

  2. Download all URLs of the form "http://site.com/ID", where ID is less than 1000.


What should I use?

Thursday, December 26, 2019

Telnet won't run from cmd prompt in windows 7


Edit:I am running windows 7, 64 bits.


I have Telnet Client installed, and if I go to c:\windows\system32 i do find the file "telnet.exe"; if I click it, telnet runs perfectly.


However, if I type telnet in cmd prompt, it gives me the "command not recognized" message.


I think it's because c:\windows\system32\cmd.exe is actually running files from windows\sysWOW64 (which also has a cmd.exe), and so I tried copying telnet.exe to this folder; When I type telnet in the cmd line (regardless of which cmd.exe i use) I no longer get an error message, and instead get... well, nothing. It just sits there, like when awaiting input, but if I type something (e.g., "quit") it once again does nothing and awaits input.


Finally, I tried, in windows\sysWOW64, deleting telnet.exe, creating a telnet.lnk shortcut to telnet.exe in system32, and creating a telnet.bat file in windows\sysWOW64, that runs telnet.lnk.
Now, if I double click telnet.bat, telnet start perfectly (in a system32\cmd.exe window); if I type telnet in cmd prompt (again, doesn't matter which) it runs telnet.bat whith no problems at all (checked this testing other commands), but returns "Acess denied" when opening Telnet.lnk.


So,


-- telnet is installed and runs when double clicking


-- shortcuts to it work perfectly if double clicked


-- neither telnet nor shortcuts (nor files calling shortcuts) can be run from either cmd prompt.


And that is how far i've gone. So, yeah... Any ideas?


Answer



It appears that on Win7 64 bit, telnet.exe is a 64 bit command. You can run it from 64 bit shell (or cmd prompt), but a 32 bit shell will attempt to load it from SysWOW64, and it won't be found there.


I suspect that you are running a 32 bit command prompt (for example, from SysWOW64). If you run 64 bit command prompt, telnet should work.


You can test this by going to Start Menu > Run, type cmd and then run telnet from this command prompt.


How are you starting your command prompt? If it's a link, take a look at the properties. If it's from another program, and that program is 32 bits, then that could be the issue.


What is the difference in "Boot with BIOS" and "Boot with UEFI"



Now Windows 8 supports the UEFI bootloader and I have read that its different from the BIOS, but it's unclear to me after many searches on the Google.



Some points in mind are below:-




  • As we all know, BIOS is an important part of accessing boot options. So UEFI will do that now? How?


  • How would I know that I'm booting with UEFI not with BIOS?


  • So what is the real difference in the "boot with BIOS" and "boot with UEFI"?




Answer





  • As we all know that BIOS is important part for accessing boot option. So now UEFI will do that? How?




BIOS boots by reading the first sector on a hard disk and executing it; this boot sector in turn locates and runs additional code. The BIOS system is very limiting because of space constraints and because BIOS runs 16-bit code, whereas modern computers use 32-bit or 64-bit CPUs. By contrast, EFI (or UEFI, which is just EFI 2.x) boots by loading EFI program files (with .efi filename extensions) from a partition on the hard disk, known as the EFI System Partition (ESP). These EFI boot loader programs can take advantage of EFI boot services for things like reading files from the hard disk.




As a practical matter, if you're using an OS like Linux that has complex BIOS-mode boot loaders, EFI-mode booting is likely to be similar to BIOS-mode booting, since GRUB 2 (the most popular BIOS-mode boot loader for Linux) has been ported to work under EFI, and many Linux distributions install GRUB 2 by default on EFI systems. OTOH, you can replace or supplement GRUB 2 with other EFI boot loaders. Indeed, the Linux kernel itself can be an EFI boot loader; code was added to do this with the 3.3.0 kernel. Used in this way, the EFI itself loads and runs the Linux kernel, or you can use a third-party boot manager like rEFInd or gummiboot to let you select which OS or kernel to boot.





  • How would I know that I'm booting with UEFI not with BIOS?




As Root says, there are clues in the firmware's user interface; however, those are unreliable and vary from one computer to another. The only way to be sure is to check to see how the computer booted. In Linux, for instance, the presence of a directory called /sys/firmware/efi is diagnostic. If it's present, you've booted in EFI mode; if it's not present, you've probably booted in BIOS mode. (This directory can be absent on an EFI-mode boot under some circumstances, though.) dmesg output that refers to EFI is also diagnostic of an EFI-mode boot. In Windows, the partition table of the boot disk is diagnostic; if it's GPT, you booted in EFI mode, and if it's MBR, you booted in BIOS mode.






  • So what is the real different in the "boot with BIOS" and "boot with UEFI"?




EFI can be faster, but that's not certain. The biggest speed difference is in hardware initialization early in the process. On my systems, this is a fraction of the total boot time, so a reduction in the hardware initialization time, while good, doesn't make all that much difference. It's not like I'm rebooting every ten minutes, after all.



UEFI supports a feature called Secure Boot that's intended, as the name suggests, to improve security. It does this by requiring a digital "signature" of boot loaders, which in turn should require signing of kernels, and so on up the chain. This should make it harder for malware authors to insert their code into the pre-boot process, thus improving security. This sounds good, but it also complicates dual-boot configurations, since code like GRUB and the Linux kernel must be signed. The major Linux distribution vendors are working on ways to make these requirements less of a burden for average Linux users, and they've got some preliminary stuff ready. At the moment, though, disabling Secure Boot is the easiest way to deal with it. This is a practical concern mainly for brand-new computers that ship with Windows 8, since Microsoft is requiring Secure Boot be enabled to get Windows 8 certification. Some people confuse UEFI and Secure Boot (the latter is just one feature of the former), but it deserves mention as a difference between BIOS and UEFI because it's causing some problems for new Windows 8 computers. If you've got an older system or are comfortable enough with firmware setup utilities to disable Secure Boot, this need not be a real problem.




Microsoft ties the boot disk's partition table type to the firmware type (MBR to BIOS; GPT to UEFI). Because MBR tops out at 2TiB (assuming standard sector sizes), this means that UEFI is a practical necessity to boot Windows on over-2TiB disks. You can still use such big disks as data disks under Windows, though, and you can boot some non-Microsoft OSes (such as Linux and FreeBSD) on big disks using GPT under BIOS.



As a practical matter if you're concerned about or interested in UEFI, the biggest issue is simply that UEFI is new enough that support for it is a bit spotty, particularly in some older and more exotic OSes. UEFI itself is new enough that most of its implementations are buggy, and those that aren't vary enough amongst themselves that it can be hard to describe things generally. Thus, using UEFI can be a challenge. OTOH, UEFI is the future. It's got some modest advantages, some of which will become more important in time (such as the 2TiB boot disk limit of Windows). Switching to a UEFI boot will change a few details of the boot process, but your overall computing experience won't change all that much once you overcome any boot issues you may encounter.






EDIT:




Could you expand on the OpRom settings (Option Rom). They seem to allow you choose between UEFI booting or "Legacy" booting and they apply to the Video card, Network card, and various other PCI devices.





Many plug-in cards provide firmware that interfaces with the firmware on the motherboard. The two types of firmware must be able to "talk" if the card's firmware is to do any good. This is necessary to use the card before an OS boots -- for instance, to display your firmware's options or a boot manager menu on a video card, to perform a network boot via a network card, or to boot from a hard disk connected to a disk controller card.



Just as with boot loaders, the code in a plug-in device's firmware is written to interface with either BIOS or EFI (although plug-in cards can support both, if I'm not mistaken). Some EFIs provide options to enable or disable this support on a fine-grained basis, as you've observed. In some cases, an EFI can use a card's BIOS-mode support to enable it to work in EFI mode, by "translating" the calls. (This is common with video cards, for instance; you can often plug in an old video card with nothing but BIOS support in its firmware and still use it to boot in EFI mode.)



I don't know precisely what each of the settings you note does. For instance, I don't know if "BIOS only" for one of these options would make the card work only in BIOS mode, "translate" so that the EFI can use the BIOS-mode calls in EFI mode, or something else. In fact, given the lack of standards in other EFI user interface areas, I would expect the details to differ from one EFI to another, so you may need to consult your computer's documentation or experiment if you need to know the details. I've seen some computers with very similar-sounding options in two different menus, which further complicates matters.


gnome - Change Ubuntu 11 scrollbars back to the old style



I've installed Ubuntu 11.04 and the new scrollbars in Nautilus, GEdit, etc. are driving me insane! How do I go back to the old (Ubuntu 10.10 and earlier) scrollbars?




In the Natty Nautilus you can't actually see a scrollbar normally. Instead you mouse over to where it should be (to the left of the border) and then it appears, but it doesn't appear under the mouse pointer! Instead it appears to the side (to the right of the border), so starting to scroll is now a fairly involved mouse manoeuvre. I don't know what UX genius came up with this, but I want none of it.


Answer



This site mentions a way to do this:



sudo apt-get remove overlay-scrollbar
sudo su
echo "export LIBOVERLAY_SCROLLBAR=0" > /etc/X11/Xsession.d/80overlayscrollbars


A system restart required







It's also possible to run:



sudo -i
apt-get remove overlay-scrollbar
echo "export LIBOVERLAY_SCROLLBAR=0" > /etc/X11/Xsession.d/80overlayscrollbars



Scrollbars instantly appeared! "sudo -i" puts the whole terminal window into an interactive root environment, so you only have to enter your password once. "sudo su" appears to do the same thing.


Wednesday, December 25, 2019

windows - How to remove a folder with a broken name?


I use Windows Live Mesh to keep my files backed up across many computers, but I have one folder (that I think came from a rar file), called px 2 (with what appears to be a space at the end). This file is being a pest as mesh is always throwing up errors about it saying it contains invalid characters. When I try to delete or rename it, an error comes up saying "Could Not Find This Item", and the same goes for deleting the parent directory. I tried going into the folder from cmd, but when I do DEL "*px*" it still doesn't delete it. Does anyone know how I can get rid of this "folder"?


Answer



The command for deleting a directory is RMDIR or RD. I'm not sure if DEL is supposed to remove directories.


windows 7 - Flash drive not recognized


I was copying some files to my flash drive and removed it from my laptop.  When I plugged it into my PC, it didn't recognize it and it doesn't show up in disk management, and I can't find it in device manager. It's the same on my PC and my laptop.  The only thing I can find online is assigning a drive letter from disk management, but like I said,  it's not there. Anyone know how I can fix it? The files are backed up but I need my flash drive


Answer



So this is not a common situation probably but here's what was happening. I had used that flash drive on a homebrew Wii a few days ago, and hadn't used it again. Apparently it hadn't been ejected properly on the Wii, and Windows read it but broke it trying to close it. Putting it back in the Wii and removing it properly fixed it. I figured this out when it happened with another drive again, I guess it's some bug in the Wii's USB deiver.


How can I assign Excel keyboard shortcuts for macros that use keys other than Ctrl + {alpha character}

I would like to assign keyboard shortcuts to Excel macros that use keys other than the standard Ctrl + {alpha character}. Based on this post it sounds like it is possible but I am not sure how:



There are 3 different kinds of keyboard shortcuts I know of:



  1. Ones like Ctrl-C for Copy

  2. Ones like Alt-E-S-V for Edit > Paste

  3. Special > Values A shortcut key combo you assign to your own macro

    . . .

    With #3 it's still the same as it was in earlier versions, just go
    into the Macro dialog and change the shortcut in Options. You only
    have the choice of Ctrl and one key, I believe. With VBA you can
    actually create longer combos like Ctrl-Shft-N (one of my favorites).




Link to original


Doug, would you mind providing additional detail?

windows - Converting Date Format with Batch file


I have a text file containing many date entries of the following format:


YYYY/MM/DD

How would you convert that to the following format?


YYYY-MM-DD

This file contain many date entries, so it should change the date format of all the entries...


Thanks


Answer



Very easily done using a hybrid JScript/batch utility called REPL.BAT that performs regex search and replace on stdin and writes result to stdout. The utility is pure script that runs on any Windows version from XP onward; no exe download required. REPL.BAT is available here. Full documentation is embedded within the script.


Assuming REPL.BAT is either in your current directory, or better yet, somewhere within your PATH:


@echo off
set "file=yourFile.txt"
type "%file%" | repl "(\d{4})/(\d\d)/(\d\d)" "$1-$2-$3" >"%file%.new"
move /y "%file%.new" "%file%" >nul

The regular expression can be adjusted as needed to make the search and replace as specific as is needed.


Windows Update on win7 refusing to install updates throwing codes C80003FA and 8024000E

I use Win7 Ultimate 64-bit on a Thinkpad t440p. This morning Windows Update prompted me to install KB4054852 and KB4054981. So I did, after restarting I checked Windows Update and found that it was throwing error 8024000E saying it can't get updates now. I tried the steps listed here:



How do I reset Windows Update components?



But I was not able to complete all of the re-registers list in step 6 because most failed. However I completed the instructions and restarted.



The error went away and I was prompted to install 5 very old updates. I installed them assuming that I'd need to reinstall all of them but windows seemed satisfied after those. After about 30 minutes of normal use my machine crashed with BSoD listing BAD_POOL_HEADER as the cause. IDK if that is connected but after windows finally rebooted windows update now states it can't search for new updates code C80003FA.



Does anyone have a solution for this that they have tried and actually works?




EDIT:



These where the only things I was able to re-register from step 6 in the link above:




  • regsvr32.exe atl.dll

  • regsvr32.exe urlmon.dll



After attempting the steps listed in the link above and restarted my machine my Windows Update history was totally blank that's when I was prompted to install updates the older updates. I don't know which updates they were because when I check my update history now It says that I'm current. Check this screen-cap for the latest listed;

win update scr shot

macos - Can't create user on Mac with dscl command



I was trying to create a postgres user using the command



sudo dscl . -create /Users/postgres


But failed. Got the following output



create: Invalid Path

DS Error: -14009 (eDSUnknownNodeName)


I had used dscl create and dscl delete commands prior to this failure.



sudo dscl . -create /Users/postgres
sudo dscl . -delete /Users/postgres


I think somehow I screwed up the system. How can I fix it?



Answer



Finally figured out that there is was one plist file left. Had to delete



/private/var/db/dslocal/nodes/Default/users/postgres.plist


then creating user was successful.


microsoft excel - remove leading 0 in front of decimal except when a a non-zero number precedes it




I have a column, which has a comma separated values inside each cell that look like this



0.1, 0.2,0.3, 0.4,0.5, 0.8,1.0
1.5, 1.6,2.0, 10.6,10.9, 15.2,30.75
20, 0.25,280.2, 0.29,300.2, 423,530.76


Like a text string.




The goal is to remove the leading zero in front of the decimal, but only when there is no other digit (including another 0) in front of it
I use the search replace function vba:


Option Explicit
Public Sub Replace0dot(Optional byDummy As Byte)
Columns("A").Replace What:"0.", _
Replacement:=".", _

LookAt:=xlPart, _
SearchOrder:=xlByRows, _
MatchCase:=False, _

SearchFormat:=False, _
ReplaceFormat:=False
Application.ScreenUpdating = True
End Sub


and I end up with this:



.1, .2,.3, .4,.5, .8,1
1.5, 1.6,2, 1.6,1.9, 15.2,3.75

2, .25,28.2, .29,30.2, 423,53.76


It removes all instances of leading 0. with ., so you see 10.6 becomes 1.6. But it should remain 10.6 How can I get a search replace equivalent that gives me:



.1, .2,.3, .4,.5, .8,1
1.5, 1.6,2, 10.6,10.9, 15.2,30.75
20, .25,280.2, .29,300.2, 423,530.76



??? Seems like there would have to be un-concatenate and re-concatenate to achieve the goal.


Answer



Here is a very simple approach:




  • if the string begins with 0. then drop the zero

  • if the string contains triplets like {space}0. then drop that zero

  • if the string contains triplets like ,0. then drop that zero




Select the cells and run this code:



Sub fixdata()
Dim r As Range, t As String

For Each r In Selection
t = r.Text
If Left(t, 2) = "0." Then t = Mid(t, 2)
t = Replace(t, " 0.", " .")
t = Replace(t, ",0.", ",.")

r.Value = t
Next r
End Sub


before:



enter image description here



and after:




enter image description here



If there are other triplets that must be changed, just add another Replace()



EDIT#1:



To avoid manual selection of the cells, we can have the macro do it.........here is an example for column A:



Sub fixdata2()

Dim r As Range, t As String

For Each r In Intersect(Range("A:A"), ActiveSheet.UsedRange)
t = r.Text
If Left(t, 2) = "0." Then t = Mid(t, 2)
t = Replace(t, " 0.", " .")
t = Replace(t, ",0.", ",.")
r.Value = t
Next r
End Sub



EDIT#2



In this version we append a ; to the end of each cell just before entering text into that cell:



Sub fixdata3()
Dim r As Range, t As String, Suffix As String
Suffix = ";"


For Each r In Intersect(Range("A:A"), ActiveSheet.UsedRange)
t = r.Text
If Left(t, 2) = "0." Then t = Mid(t, 2)
t = Replace(t, " 0.", " .")
t = Replace(t, ",0.", ",.")
r.Value = t & Suffix
Next r
End Sub



EDIT3#:



In this version the ; is appended only if it not already present in the cell:



Sub fixdata4()
Dim r As Range, t As String, Suffix As String
Suffix = ";"

For Each r In Intersect(Range("A:A"), ActiveSheet.UsedRange)
t = r.Text

If Left(t, 2) = "0." Then t = Mid(t, 2)
t = Replace(t, " 0.", " .")
t = Replace(t, ",0.", ",.")
If Right(t, 1) <> Suffix Then
r.Value = t & Suffix
End If
Next r
End Sub



EDIT#4:



This version will not affect empty cells:



Sub fixdata5()
Dim r As Range, t As String, Suffix As String
Suffix = ";"

For Each r In Intersect(Range("A:A"), ActiveSheet.UsedRange)

t = r.Text
If t <> "" Then
If Left(t, 2) = "0." Then t = Mid(t, 2)
t = Replace(t, " 0.", " .")
t = Replace(t, ",0.", ",.")
If Right(t, 1) <> Suffix Then
r.Value = t & Suffix
End If
End If
Next r

End Sub




EDIT#5:



This fixes the bug in the previous version:



Sub fixdata6()

Dim r As Range, t As String, Suffix As String
Suffix = ";"

For Each r In Intersect(Range("A:A"), ActiveSheet.UsedRange)
t = r.Text
If t <> "" Then
If Left(t, 2) = "0." Then t = Mid(t, 2)
t = Replace(t, " 0.", " .")
t = Replace(t, ",0.", ",.")
If Right(t, 1) <> Suffix Then

t = t & Suffix
End If
r.Value = t
End If
Next r
End Sub

Tuesday, December 24, 2019

windows 8 - Can't access BIOS and can't boot from USB when HDD is plugged in

I have a Samsung Ultrabook series 5 notebook (NP530U3C), and recently I've been tinkering with Linux distros. I've had a dualboot setup with Windows 8 and Linux on this computer before, and all went good until I installed Crunchbang.



After rebooting from the installation the Grub menu with Fedora (the previous distro, whose partition had since been occupied with Crunch) and Windows showed up. I went into the BIOS and changed the boot mode from UEFI to CSM (which I believe to be some sort of legacy mode). This allowed a different Grub menu with Crunchbang and Windows 8 to show up; however this was still not an optimal situation since Windows would not boot from this Grub menu (it did boot from the old "Fedora Grub"). Of course, I wanted a way to have both OSes boot from the same menu, and after some searching I came across and followed this tutorial: http://crunchbang.org/forums/viewtopic.php?id=21510



I must have screwed up, though, because at that point whenever I tried to access the BIOS again (F2 key), it would go straight to Grub. To make thing even worse, I believe the USB drive wasn't higher than the HDD/Windows bootloader in the boot device order at the time I lost access to the BIOS.



At last, I thought that deleting the Crunchbang and EFI partitions would allow me to break from this situation where I could neither boot from a USB drive not enter the BIOS to change the option that would allow me to. To delete them I put the HDD in another, older laptop and booted from a Gparted live USB.




As of now, when I boot the notebook with the HDD plugged in, I am redirected to a Grub-rescue terminal. If I turn the PC on without the HDD, I can boot from live USB drives, but so far I have not had success in hotplugging and having the live system recognize the HDD.



To sum this all up:
Can't access BIOS, no EFI partition, no Linux system.



Booting with HDD -> Can't boot from USB, cannot boot Windows 8, Grub-rescue prompt.



Booting without HDD -> Can boot live USBs.




If it is of any help, I can access the Windows recovery menu; however, I didn't have any luck solving my problem using it.



Thanks in advance.

Windows 7 Explorer: how to show total size of all files in current folder?

In Windows XP Explorer one can turn on Status Bar which shows, among other things, the total size of all the files in the current folder, or if the cumulative size of the selected files. How do I get the same at-a-glance information in Windows 7?




Selecting files doesn't count as it stops after 15 files, and it's rare that I'm concerned about total size with that few files (it's pretty easy to estimate in my head).



thanks.



UPDATE: Information derived from the context menu (select > r-click > properties) isn't "at a glance", and not as smooth as selecting files and clicking the details link at the bottom in any case. Thank you for fleshing out more of the available routes though.



Yes Q19232 is similar to this one, though it is not a duplicate. That question is about looking for easy free-space on disk stats and this one is easy used-space by contents of this folder stats.



The answer for both is the same though. You can't! Hopefully someone will figure how to get this lost feature back with a shell extension or something.

linux - Laptop already has 4 partitions - need an extra one

I am trying to dual-boot my laptop with linux, which requires you to add a partition where the OS will be installed, however, my laptop (which runs Windows 10) already has these 4 partitions (I have never added any):




  • 100mb - Healthy (EFI System Partition)


  • ACER (C:) - 465.20 GB NTFS - Healthy (Boot, Page File, Crash Dump, Primary Partition)

  • 500mb - Healthy (Recovery Partition)

  • Data (D:) - 465.71 GB NTFS - Healthy (Primary Partition)



Is it possible for me to delete any of these partitions, or is there a work around so I can add another partition for the linux boot?

Intuitive view of what's using the hard drive so much on Windows 7?


Sometimes my hard drive usage is near 100%, and I have no idea what is causing it. Are there any utilities that can help diagnose excessive hard drive usage and have as intuitive of an interface as Task Manager's Processes tab, which I can sort by CPU usage?


I am aware of using procmon, of adding columns to Task Manager's Processes tab like I/O Read Bytes and I/O Write Bytes, and using Resource Monitor's Disk tab. Too often, these don't give me useful information or clearly identify a single process that is hogging the disk.


EDIT: Some of you suggested Process Explorer, but it's not very useful here. My hard drive light was almost solidly on the entire time that this graph was being produced by Process Explorer, and you can clearly see it's barely registering any activity.
I/O monitor from Process Explorer showing minimal disk activity even though hard drive light has been almost solidly lit


Answer



The tool you are looking for is resmon.


Open Start menu and search for resmon or Resource Monitor to launch it.


Monday, December 23, 2019

Can I get my video card to output a DVI and VGA signal at the same time?



I've got:





  • a lovely 24" monitor, w/both DVI and VGA inputs,

  • a personal desktop w/a Radeon HD Pro 2400 video card (both DVI and VGA outputs)

  • a work laptop w/both outputs, and

  • a KVM switch that handles VGA only



Right now I've got laptop connected to the monitor's VGA, and the desktop connected to the DVI. This works, but requires me to switch the KVM and monitor input sources separately, which annoys me (I switch back & forth a lot to make skype calls & manage my music). I'd like to feed both VGA and DVI signals out of my desktop so I can do quick things on my desktop & switch right back, but then when I'm done working, switch the monitor over to DVI to get the crisper picture.



Alas, just attaching both VGA and DVI cables to my desktop's video card did not do the trick. Can this card be persuaded to output both signals at the same time?




Many thanks!



-Roy


Answer



You'll need to poke your Catalyst settings to enable cloning of the displays. If you're still using the stock driver then you'll need to install Catalyst.



Or use one of these on the DVI-I output.


Cannot update Google Chrome portable

It said that update server is not available when I hit about google chrome in the options. What do I do?

Sunday, December 22, 2019

hard drive - Windows XP machine not seeing external FAT32 partitions correctly


About 8 months ago my Windows XP laptop stopped being able to see FAT32 external drives when I plug them in... mostly. I will explain...


It happens with all my FAT32 drives, whether they be unpowered external hard drives, powered external hard drives, SDHC cards plugged directly into the machine's card reader, or SDHC cards plugged in via a separate USB card reader.


All of these drives/cards used to work fine on this machine. They all stopped working at about the same time.


NTFS volumes are not affected. If I plug in NTFS external drives they are recognized right away. I even have one external drive with two partitions on it, one is NTFS which is recognized, the other is FAT32, which is not recognized.


If I attach a FAT32 drive, then reboot, then the drive almost always becomes visible to the machine after the reboot.


Sometimes I can plug in a FAT32 drive and it works right away. Not often though. I'd say I get lucky more often with SDHC cards than hard drives. I'm developing a theory that I only get lucky with hard drives if I'm running Acronis Disk Director when I plug them in, though that usually doesn't work either - I need more data here, this may be a red herring. Getting lucky with a hard drive is really rare, usually I have to reboot.


When a FAT32 is recognized, either because I got lucky or because I rebooted, I can almost never safely disconnect it. It tells me "The device 'Generic volume' cannot be stopped right now. Try stopping the device again later". I can't seem to get around this. IIRC, I've tried closing every open window, and still no luck. Since I care about my data usually the only way to disconnect a FAT32 drive is to shut down the machine. As you can imagine, two reboots just to read a drive is getting pretty old...


When the machine fails to see a FAT32 drive it usually comes up with the appropriate drive letter and the words "Local Disk" in Windows Explorer instead of the correct partition name. If I click on it I get "J:\ is not accessible. The parameter is incorrect."


Before this problem arose I always clicked the "safely remove" button for everything, including SDHC cards where I think it's not necessary. I've known for a long time that this is the correct procedure for hard drives, so I don't think failing to do this was the cause of this problem (before someone asks :)


Any answers or suggestions most welcome.


Answer



The problem I describe above appears to have been associated with, if not directly caused by, the contents of a couple of registry keys used by both Acronis Disk Director (Version 10.0 for which I paid) and Acronis True Image WD Edition (Version 11.0, which was free) which I had installed.


A big clue came from this Microsoft Support article http://support.microsoft.com/kb/925196 which, under the "Let me fix it myself" subtitle, describes certain registry keys which if corrupt can cause hard drives to be unseen. Looking at these registry keys I found they contained the snapman driver, which Google revealed to be an Acronis product. This tied in with my Acronis observation mentioned in my question and the driver details visible under Device Manager->disk drives->(the disk in question)->Properties->Driver->Driver Details which showed snapman.sys as one of the drivers. I therefore deleted the registry keys as recommended by the Microsoft article (actually only the UpperFilters, I didn't have a LowerFilters), and also removed the snapman entry from the other keys in which it appeared following this Acronis Knowledge Base article http://kb.acronis.com/content/1620 Figuring this probably broke my Acronis products I then uninstalled both of them using Control Panel->Add or Remove Programs. With all of these steps completed my drive attachment/removal problem was fixed : I successfully attached a FAT32 mass storage device and safely removed it four times in a row. I then reinstalled Acronis Disk Director (the Complete program, for All Users) which put the snapman driver references back into the registry keys. Then I successfully attached and safely removed the same FAT32 mass storage device another three times. I've decided not to risk reinstalling Acronis True Image. I suspect it may install its own version of the snapman driver, which may conflict with Disk Director's, and make further changes to the registry keys. It can be run from a bootable disk, and since I only run it occasionally that's good enough for me.


I say associated rather than caused above because I'm pretty sure I had both Acronis products installed and was running them off and on for many months without any drive attachment/removal problems. While trying to solve this problem I Googled the search term '"is not accessible" "the parameter is incorrect"' without the single quotes and read the first 50 web pages returned. A theme that cropped up a few times was people facing this problem after having changed drive letters. This was interesting because I suspect that my own problem dates back to last July or so when I was repartitioning and changing drive letters on my backup drives. I was doing this using Acronis Disk Director. So I speculate that changing drive letters may somehow be involved in triggering this problem. This is speculation, but it does suggest another solution to the problem which might work, perhaps even for people who are not running Acronis, which is to do a system restore to the day before you were changing drive letters. I tried to do this myself before I zeroed in on the registry keys, but unfortunately my backups/restore points didn't go back far enough.


EDIT : I find I still have a problem with my machine's inbuilt card reader. When I insert an SDHC card (formatted FAT32) I can see it properly, but I cannot safely remove it. However, if I use a $2 card reader to turn the SDHC card into a USB drive then it attaches and safely removes without a problem.


windows 7 - Something uses 1GB RAM - cant tell what it is

I have a computer with 8GB of RAM installed and it is running Windows 7 Professional. I was curious why my memory usage is so high, so I quickly build summary using Powershell:


$(Get-Process | measure -Sum -Property VirtualMemorySize).sum/8/1024/1024
3147,34033203125

If I open resmon at the same time it says that 4430MB RAM are used. So there is more than 1GB "missing", please see the screenshot below. Can you help me find it? Taskmanager also shows the same memory value as resmon.


RAM usage powershell vs resmon


My prediction is about my usage of a RAMdisk and different programs for that purpose in the past. I observed the following: Currently I'm using "ImDisk" for creating the RAM Disk. I've added a 1GB RAM disk and taskmanager/resmon sees the new RAM Disk as used RAM, while powershell's get-process does not (please see second screenshot). So how can I determine the correct memory usage with powershell? And is it possible, that there is an old ram disk driver that I used in the past still somewhere hidden in the system occupying the missing amount of RAM? Does Powershell's get -process take system servies into account? Thank you for your help!


enter image description here


Update 1:
RAMMap Screenshot (1GB RAM Disk running):


enter image description here


Update 2:


Poolmom Screenshot (1GB RAM Disk running):


enter image description here

Saturday, December 21, 2019

Can you match a Windows XP product key to a service pack release?

I have a Windows XP product key on my PC, but I'm not sure which release of Windows XP it belongs to SP1, SP2, or SP3.


Is there a way I can tell without trying each one?


Note:
In this case, I have an old PC which had an OEM XP Pro license. I don't have the media for it any more. However, I do have a media for XP Pro (off the shelf non-OEM).


The Product Key on the case doesn't want to validate. So I'm presuming that there is something encoded in it as to the release it works with. I can get media, I just don't want to try each one.

graphics card - Monitors keep blacking out with "hardware disconnected" sound

For a couple of years, I've had trouble with my homebuilt dual-monitor PC. It's set up to shut off the monitors when not used for several minutes. The problem is, when I wake it up, about 5% of the time something goes wrong: only one monitor wakes up, or the computer bluescreens with an error in ati_something-or-other - obviously a display driver.


Recently I replaced one of the screens with a larger, significantly higher-resolution one, and now things are worse. Intermittently while using the computer, both screens will go black, and my computer will repeatedly make the "hardware removed" sound - you know, the one it makes any time you disconnect a USB device. Turning off the big monitor will allow the other one to come on, then I can sometimes turn the first one back on. Plugging in ONLY the big one seems to work fine. I've tried different cables and swapping ports. The monitor works fine on other computers, too.


UPDATE: it's gotten worse - now I can consistently only run one of the monitors at a time. When I connect both monitors, it's always the same one that shuts off (the newer, bigger one), regardless of which monitor is attached to which DVI port. But when I connect either one alone, it works fine.


My top theories so far:



  1. The video card is bad, and gets unstable when trying to drive that many pixels at once.

  2. The power supply is screwy, and fails to provide enough power to the video card when it's trying to drive two monitors.


That second one is a wild guess. It assumes that a video card needs more power to drive more pixels / more monitors / bigger monitors. Is this true? If it were a power issue, wouldn't GPU-heavy games cause problems too? (They don't.)


Specs:



  • Motherboard: Asus M5A99FX Pro R2.0

  • GPU: Gigabyte Radeon R7 260x 2GB

  • CPU: AMD FX-6300

  • Power: Rosewill Capstone 450

  • Monitors: Acer B273HU (2048x1152), Planar PL2010M (1600x1200)


UPDATE #2


I replaced the power supply with a (higher power, more reliable) 550W EVGA SuperNova G2, and the problem persists. The only remaining option I can see is the graphics card, but there's gotta be a better way to solve this than to keep spending money until I happen to replace the right part :)

windows - Combine Batch/WMIC + ANSI/UNICODE Output formatting



In creating an auditing tool for my network, I'm finding that WMIC is outputting with spaces in between each character when accompanied by echoing regular text. For example,



This:



@echo off
echo Foo >> "C:\test.txt"
wmic CPU Get AddressWidth >> "C:\test.txt"

wmic CPU Get Description >> "C:\test.txt"


Returns this:



Foo 
A d d r e s s W i d t h

6 4


D e s c r i p t i o n

I n t e l 6 4 F a m i l y 6 M o d e l 6 9 S t e p p i n g 1


If I remove (rem) the echo Foo line, the output is formatted nicely since there is only one output type:



AddressWidth  
64
Description

Intel64 Family 6 Model 69 Stepping 1


I'm reading that this is because WMIC outputs to UNICODE, while standard batch commands output to ANSI. Can both be joined to share a common format? Can someone please explain in more depth the different format types, why WMIC would output to a different type, and/or any other contributing factors to this output? I've found some bread crumbs, but nothing concrete.


Answer



Pipe the output from Wmic through more:
wmic CPU Get AddressWidth |more >> "C:\test.txt"



Edit for some more background: the issue you see is due to wmic output being unicode utf-16. This means that each character (or more correctly, most of them) is encoded in two bytes. wmic also puts a so called BOM (byte order mark) at the beginning of the output. See byte content below:



FF FE 44 00 65 00 73 00-63 00 72 00 69 00 70 00 ..D.e.s.c.r.i.p.




Those first two bytes (FF FE) specify endianness for UTF-16 and allow data processing tools to recognize the encoding [being UTF-16 little endian].
Obviously type does this check and if it finds the BOM then properly recognizes the encoding.
On the other hand, if you first echo text and then append Wmic output - there is no BOM at the beginning and you can see inconsistent encoding:
74 65 78 74 20 0D 0A 44-00 65 00 73 00 63 00 72 text ..D.e.s.c.r



If you put it through type it cannot infer how to interpret, /most likely/ assumes single byte ('ANSI') and this results in spaces produced for non printable characters (zeros, being in fact high order bytes of two byte character encoding).



more handles more (pun intended) cases and produces correct output for basic ASCII chars that's why it's commonly used as a hack for this purpose.



One additional note: some editors (notepad being simplest example) will properly display utf-16 encoded file if it is consistent - even without BOM. There is a way to force echo to produce unicode output (but beware it does not produce BOM) - using cmd /u causes output for internal commands to be unicode.



I can't really say why cmd unicode support is so limited (or as most would say - broken...) - probably historical/compatibility issues.




Last thing - if you need better unicode support (among many other benefits) I would recommend migrating to powershell


Can a power bank work as a laptop battery alternative?


So here's the thing. My laptops battery is almost dead and I'm planning to buy a new one. The problem is that where I live, the power shortage is a very normal issue.


I have a 15 inch basic laptop. I was just thinking, what if buy a 20000 maH power bank which supports my laptops power configuration and comes with the right charging pin for my laptop.


I use my laptop almost like a desktop so portability is not an issue. The real issue is power. So if there is no battery in my laptop and I plug-in that power bank, would it work as a laptop battery alternative.


And what about the back up. If a 20000 mAH power bank is tested to supply 16000 mAh power then the back up should be 12 hours because that is four times the 4400 mAh 6 cell battery provides, right?


Answer



It sounds like you are talking about the kind of thing that has USB power ports for charging cell phones and tablets. If that is the case, then no, you can't power a laptop with it. What you want is a UPS.


Also their power rating is usually expressed in terms of a single cell, so 16 Ah at 4 volts = 64 Wh. Laptop batteries normally tell the capacity of an individual cell and how many cells they have, so Your 6 cell 4400 mAh laptop battery holds 105.6 Wh.


A typical UPS has a 7 or 8 Ah 12V battery so it holds 84 Wh. Higher end ones have dual batteries for twice the capacity, and output mains power for your laptop charger to convert to whatever the laptop accepts.


command line - Move all files and directories to new subdirectory in Windows



I am reorganizing existing data, and I need create a new sub-directory to receive all existing files and directories. The purpose of this is to make room for a new product line, while at the same time improving the naming convention of existing data.




For example, data that currently looks something like this:



\root directory\
+-proj1357
+-closing binder
+-refi
+-compliance
+-proj2468
+-disbursements

+-compliance
+-proj3579
+-pre-close
+-compliance


Should actually look like this:



\root directory\
+-proj1357

+-dpl
+-closing binder
+-refi
+-compliance
+-proj2468
+-dpl
+-disbursements
+-compliance
+-proj3579
+-dpl

+-pre-close
+-compliance


The problem I am having is that I can't seem to get the right command without getting stuck in a recursive loop. While hacking this together, I frequently ran into the error, "cannot perform a cyclic copy".



The good news is that I've got a working solution, but it requires three separate commands, and custom syntax for each project directory.



command 1> ROBOCOPY G:\proj1357 DPL /E /MOVE
command 2> MOVE G:\proj1357\DPL\DPL\*.* G:\proj1357\DPL

command 3> RMDIR G:\proj1357\DPL\DPL\


As far as I can tell, command 1 moves all files and directories into the new sub-directory. It also causes a recursive problem by moving files in the project-level directory into a deeper sub-directory. So I rely on Command 2 to recover files that were once in the project-level directory. Then Command 3 removes the deeper sub-directory.



Is there a better way I can run a command or batch file through a Windows-based system? Ideally it would crawl through all the project-level directories, and move the contents to the new sub-directory. I'm looking at processing over a thousand projects, so I think it is worth the time figuring out how to loop it correctly.



For more visual context of what I'm up against, see screenshot below.
screenshot of Windows directory







UPDATED



After trying to make it work using the three-step command line method outlined above, I gave in and adapted jiggunjer's answer to fit my environment. Below is the MS batch file that I used. I've also added remarks to clarify the purpose of each line.



@echo off
rem run this batch file in top level directory
rem top level directory should contain all project number directories
rem assumes that all directories starting with a digit are project number directories


rem initialize the listing of all directories
set rootlist=dir /b /a:D

rem initialize numerical filtering
set filter=findstr "^[1-9]"

rem loop through all directories that comply with filtering (start with a digit)
rem use command extension /F to process (in this case) command output
rem identifies all project number parent-directories

rem assign parent-directories to variable %%P, as in 'Project'
FOR /F %%P in ('%rootlist% ^| %filter%') DO (
rem pass the variable %%P to the moveproject loop
call :moveproject "%%P"

rem move files that were ignored by the robocopy command
rem these are 'loose' files that were in the project number directory, but not saved in any subdirectory
rem assumes the robocopy command successfully creates the DPL directory
MOVE %%P\*.* %%P\DPL\
)


rem pause to review command log
pause

:moveproject
rem ensure that the parameter has value
rem converts variable %%P to parameter no. 1
if not [%1] == [] (

rem loop through all sub-directories under each project number

rem use command extension /D to process directories only
rem removing any surrounding quotes (") from parameter no. 1 by using optional syntax -- percent-tilde
rem assign sub-directories to variable %%O, as in 'Origin'
FOR /D %%O IN ("%~1\*") DO (
rem display values
echo project number %%P
echo directory origin %%O

rem delimit origin directory using backslash character
rem use command extension /F to process (in this case) strings

rem assign the second delimited piece to variable %%D, as in 'Destination'
rem effectively drops all text to the left of the first backslash character
FOR /F "tokens=2 delims=\" %%D IN ("%%O") DO (
rem display values
echo %%D
echo directory destination %%P\DPL\%%D

rem move all directories to DPL sub-directory
rem simultaniously creates the receiving DPL directory
robocopy /E /MOVE "%%O" "%%P\DPL\%%D"

)
)
)

Answer



In each of those 8 root directories run this command:



FOR /D %p IN ("*") DO robocopy /E /MOVE "%p" "%p/DPL"



Powershell 3.0+ version:



gci -dir -name | foreach-object{robocopy /E /MOVE $_ ($_ + '\DPL')}


OR



Based on your screenshot an all-in-one solution would be something like:



@echo off

REM Assume: Running in top level dir.
REM Assume: Only project parent fodlers start with a digit.
set rootlist=dir /b /a:D
set filter=findstr "^[1-9]"
FOR /f %%d in ('%rootlist% ^| %filter%') DO (
call :moveproject "%%d"
)

:moveproject
if not [%1] == [] (

FOR /D %%p IN ("%~1\*") DO robocopy /E /MOVE "%%p" "%%p/DPL"
)


Happy re-parenting!


Friday, December 20, 2019

printing - How can I stop OpenOffice from changing the page size?

I am designing a book in OpenOffice Writer. The book is 6x9, and that needs to be the page size -- the logical page size, if you will. But while working on it, I need to print pages on 8.5x11 paper, because that's what I have. (The published book will be printed by a printing company.)


Every time I try to print a page, OpenOffice changes the printer page size to Envelope C5. That means the edge of my page gets cropped off, because my printer can't handle the tiny margins it would take to print a 6x9 page on a C5 envelope.


How can I make OpenOffice print a 6x9 logical page on an 8.5x11 physical page without going into printer properties every single time I want to print a page, and without changing the logical page size to something other than 6x9?

How do I install Windows 10 across multiple business/school computers?

I have been researching this for a few days now, but I can't find a detailed answer to my question. I know that in order to install Windows 10 to multiple computers (all the same), you have to have a single ISO image that has all of the drivers and whatever applications you want to be on the computers by default. Then the image has to be deployed to all of these said computers at the same time and installed. After all of that, users have to be created like an administrator account and as many users as the business/school wants. Finally a Windows product key must be obtained for all units.


Let's say I am trying to install Windows 10 to a whole college library of outdated computers (They all have Windows 7). Each computer, while NOT needing to be monitored by a master computer, needs both an administrator account and a single user to be used by students. All computers in question have the same hardware (Dell), and all are connected on an LAN. How do I deploy Windows 10 to all of the computers, and how do I obtain a license for every one of the computers? Do they all need their own licenses, or does Microsoft have a program where multiple computers (about 75) can be under one license because these units are in a school library?

administrator - In Windows Vista Home Premium can an admin lock the machine so that no one one can "Switch User"?

Logged into an admin account, I am running a virus scan.



When I lock the machine, it allows other users to "Switch User" and log in. Is there a way I can temporarily prevent other users from loggin in?

linux - Pending sector count went down to zero without being reallocated?

A week ago I had a smartctl alert saying that the Current Pending Sector count went up to 1. The alert had repeated for 4 days, and stopped.


I was expecting for the sector to become reallocated, but in fact now both Current Pending Sector, Reallocated Sector, and Reallocated Event counts are zero! How could this be and what does this mean?


Disk in question is a year-old WD Caviar Green in a USB enclosure attached to a NAS. The disk is persistently monitored by smartd.

Windows update and SQL Server 2008 Service Pack 1

My o/s (vista ultimate 64) has been offering this up since it was published on 6/14. Three times I downloaded and installed it, along with the attendant restart!


Info from the SQL Server Mgt Studio is below - why isn't windows update getting this one right, and how do I help it along?


Cheers,
Berryl



  • Microsoft SQL Server Management Studio 10.0.2531.0

  • Microsoft Data Access Components (MDAC) 6.0.6002.18005

  • Microsoft MSXML 3.0 5.0 6.0

  • Microsoft Internet Explorer 9.0.8112.16421

  • Microsoft .NET Framework 2.0.50727.4214

  • Operating System 6.0.6002

how to find biggest files on disk on Mac






How can I find the largest files on my hard drive? I am using Mac OS X 10.5.


Answer



Have you tried GrandPerspectiv?


windows - Task Scheduler - Running a task logged off without admin rights

I have two user accounts, one is an admin and the other is a regular user, but only the second account has permissions to run a certain application.



Windows 8.1
User1: Admin
User2: Only user with access to run application X




Basically, I want to schedule a task to run the application each morning, but User2 is unable to run the tasks with "Run with highest privileges".



Is it possible to grant permission to User2 using User1? I've used icacls to grant permission to the Windows\Tasks and Windows\System32\Tasks folders to User2.



If only an administrator is able to run the task, is it possible to run a batch on User1 than runs application X as User2? Whilst logged off.



Thanks!

linux - Using wget to mirror a website and everything from the first level of external sites

I need to mirror a particular website (all the pages under that particular domain) any pages (but not whole sites) that the website links to.


I'm confused about the how to do this


wget -r --level=inf (or some other variant) will mirror the site.


wget -r -H --level=1 will get all the links (from all domains) to the first level.


Anyone have any ideas on how I could combine these, to get the entire of the main site and one level deep into external sites. I've been banging my head against the manual all afternoon.


Thanks

Thursday, December 19, 2019

mac - printing via commandline (CUPS) with photo printer


I'm having a problem printing a photo via commandline, using CUPS.
Im using Mac(tried on Mountain Lion and Mavericks) and Canon Selphy CP900 photo printer.
I have the correct drivers.


From the command line, here is my printer info:


$ lpstat -d


system default destination: Canon_CP900


$ lpoptions


copies=1 device-uri=usb://Canon/CP900?serial=C412070200000609 finishings=3 job-hold-until=no-hold job-priority=50 job-sheets=none,none marker-change-time=0 number-up=1 printer-commands=none printer-info='Canon CP900' printer-is-accepting-jobs=true printer-is-shared=false printer-location=ibomac printer-make-and-model='Canon CP900' printer-state=3 printer-state-change-time=1385005687 printer-state-reasons=none printer-type=2134028 printer-uri-supported=ipp://localhost:631/printers/Canon_CP900


$ lpoptions -l


PageSize/Page Size: *Postcard(4x6in) CP_L_size CP_C_size Custom.WIDTHxHEIGHT


If I view the photo.jpg via Preview app, it lets me print it without problem. here is the screenshot.


Preview Print Settings


Now if try it via commandline like this:


$ lp -o landscape -o fit-to-page -o media=Custom.4x6in photo.jpg


request id is Canon_CP900-18 (1 file(s))


It gets accepted and queued but I get the error:


enter image description here


My suspicion is because in the System Preferences | Printers Scanners, the settings doesnt have the 4x6 size in the list :


enter image description here


So what I did was, I opened Firefox browser, went to page setup, and added a custom size paper thru this dialog box:


enter image description here


I named it "Postcard".


So once I have that addition, going back to Printer Scanners settings, it now lists "Postcard" as one of the custom sizes.


I've tried the commandline print command again but I got the same error. I wasnt expecting Mac to be this hard when it comes to printing (or is it my sucky printer driver?). Pls help.


I want this commanline to work because I want to automate it with my custom program.
I use this CUPS documentation as reference.


Somebody help pls? :)


Answer



I also faced the same issue. Following your steps I manage to print with this command


lp -o media="Postcard(4x6in)" image.png

the media size is one of the listed size in the command


 lpoptions -l

PageSize/Page Size: *Postcard(4x6in) CP_L_size CP_C_size Custom.WIDTHxHEIGHT


note : you have to drop the ''


windows 7 - Deleted contents of winsxs folder and BSOD


What can I safely delete from the "C:\WINDOWS" folder?


I deleted the contents of that folder and my Windows 7 BSODs now.


Do I have to reinstall?


Answer



http://www.howtogeek.com/174705/how-to-reduce-the-size-of-your-winsxs-folder-on-windows-7-or-8/



The WinSXS folder contains all Windows system components. In fact,
component files elsewhere in Windows are just links to files contained
in the WinSXS folder. The WinSXS folder contains every operating
system file.



So, yes, you'll have to reinstall.


(I'm curious how you managed to delete those files. That's a system folder, at least some of them would have been in use, and it would've taken some effort to get them deleted.)


Wednesday, December 18, 2019

connector - Not sure what this DVI-like port on my PC is



I have a re-manufactured HP Compaq dc7700p Small Form Factor running Windows XP (for some reason inside the Windows Vista Boot Manager, instead of the WinXP NTLDR).



On the back of my PC, I have what looks like a DVI Port, and that's what I thought it was. When I bought a DVI to VGA Cable (to connect a second screen), it wouldn't fit. I took a look and found that the DVI connector was different to the port on my PC. I would love to post some pictures, but being a new user, I can't.



enter image description here
What I want to know is what port this actually is, so that I can find a suitable converter.




The only difference between this and DVI is at the end with the 4 square pins and the +-shaped pin. The + pin is still there, but instead of the 4 dots, I have two flat lines underneath the squares (above the +), which are of the length of 2 of the squares.


Answer



Just so you know, a DVI to VGA cable will not work without the two pins above and two pins below the "bar" or "plus"; that is what carries the analog signal


windows - recursively check folder to see if no files with specific extension exist

I have a setup where there is a watch folder, and folders with files are placed in it for processing. The app is great at recursively processing files in any subfolders, and moving the processed files to a final location, but it leaves behind the empty directories.


I wish to run a cmd prompt command/batch to scan these folders and then do something (echo output or create a txt file) if they are empty so we are aware that the processing has finished and emptied the folders, without looking inside every one.


Things I have tried:


Oneliner:


if not exist "Folder\*.file" echo "not"


This almost works exactly as I want, but only works when the files are directly in that folder, and there are no subfolders. Quite a lot of the folders being processed only have files in several subfolders, and so this fails the test in that instance.


Next I've modified a script from here that accepts the folder name as parameter:


echo off
echo 1: %1
setlocal enableDelayedExpansion
for /f %%i in ('dir /a:d /b /s D:\watch_folder\%1') do (
set _dir=%%i
echo _dir
if exist !_dir!\*.file (
echo .files exist here: !_dir!
) else (
echo No .files Here: !_dir!
)
)
endlocal

This again, almost works as expected - it will check subfolders and report back if they have the files in them or not, however if the files are in the folder itself, and not subfolders, it doesn't even check it, it only checks subfolders.


I then noticed another problem with the script - if there are two subfolders, one with no special .files and one with, it reports one as being empty and so would trigger the 'not exist' status


So I tried just scanning the watch_folder itself (dir /a:d /b /s D:\watch_folder) but this then scans every folder, which I don't really want it to do.


tl;dr Problem:
I want to recursively check a folder for files with a certain extension, that may or may not be in (a) randomly named subfolder(s) and get one result (not a list) as to whether any files that match the criteria exist within that tree, using this result I want to create a text file named as the original folder name such that:


original-finished.txt

Restrictions: command line/batch is prefereable as the app is restricted to using comspec


EDIT: Just had a thought - could I do a tree listing and somehow search that for the file extension (I'm imagining a situation similar to grepping the output in linux)


tree /F Folder | find /c ".file"

This brings back a count of all files matching that anywhere in the tree - How can push this output into an "if 0" type statement ?


I'm trying this at the moment:


for /f "delims=" %%a in ('tree /F D:\watchfolder\%1 | find /c ".mov"') do @set result=%%a
echo %result%

but it doesn't like the fact I've pipe tree into find

macos - Change function key behavior is OSX, but only for some f keys


I highly doubt this is possible, but it's worth a try...


I have a new MacBook Pro, and I find myself ( as a VIM user ) accidentally hitting the F1 ( decrease Brightness) key regularly, when trying to hit ESC to get back into normal mode. I have remapped F1 to ESC in my .vimrc, but it seems that the key doesn't register as F1 unless I have fn held down. I know how to change this behavior in the System Preferences, but there are some function keys, like the volume control keys, that I want left how they are.


Sorry if this confusing, basically what I would like to know is whether I can set the Brightness keys to be set to F1 and F2 by default, while keeping the volume control keys set to volume control by default....


Answer



You want FunctionFlip.


Tuesday, December 17, 2019

Expected lifespan estimate for SD card used in read only mode

I know that SD cards, like all things, have a limited lifespan and I know that they can handle a limited number of write cycles, which is usually what limits the lifespan. But what is an MTBF estimate for an SD card that is only wirtten to once and then used only for reads?



Here's why I'm asking. My car dealer is telling me that my navigation system is failing because the map SD card, which is set to read only, has gone bad after just a few years. I find this difficult to believe.

memory - Ram upgrade to 8GB on laptop with DDR2@333Mhz?


This is the current RAM information (1GB+1GB) for my laptop and it's DDR2. Is it possible to buy two new 4GB chips and upgrade my RAM to 8GB? Also, this RAM runs on 333MHz at the moment. Can I get 800MHz bus speed on the new chips and is that the max?
Ram upgrade


Update 01: Here are further details about my hardware:


Specs from the Manufacturer


Update 02: I do realize that it is apparent from the system specs above that the max RAM is 4GB. I would like to further clarify if I can add two 2GB chips each that run at 800Mhz bus speed to this laptop, thanks!


Answer



I build laptops in my company and you should try to find out and see if anyone else has managed to first.


There are very few laptop chipsets that support above 4GB and you can actually break the machine by inserting larger chips.


windows 10 - Enable a Local Group Policy Via Command Line?

I'm attempting to disable OneDrive on some new machines my client has acquired. They are all (about 200 in total) running Windows 10 Pro (unfortunately not enterprise). I'm trying to figure out a way to enable the "Prevent the usage of OneDrive for file storage" policy under "Local Computer Policy\Computer Configuration\Administrative Templates\Windows Components\OneDrive" from the command line. Unfortunately it's a bit time consuming to individually go into gpedit.msc browse through and enable it on each machine.


Any suggestions?

macos - OSX Keyboard Shortcuts in Dialogs?


On Windows, every dialog box includes underlined letters that you can activate using the Alt key. I use these "Alt" keyboard shortcuts all the time; I'm missing them as I'm trying to switch to OSX.


On OSX, all I can find is Tab navigation, which requires you to press Tab seven or eight times to get anywhere in most dialog boxes. (And even that is hidden by default: you have to enable "Full keyboard access" in the "Keyboard & Mouse" control panel to be able to Tab between buttons.)


Is there some way I can get something like the Windows Alt accelerators for OSX dialogs? I'm willing to write Automator code, download/purchase software, etc.


Specifically, I'm imagining maybe something where you do some shortcut command and then start typing the name of the button, and hit Enter to push the button...?


Answer



In OSX there's no such thing as the "_" for dialogs like in Windows. However, you have:


esc → defaults to no/cancel


cmd + deldon't save (cmd + d before OS X Lion)


entersave/OK


spacebarclick selected button (use tab to move).


A quick Google search for "osx keyboard shortcuts" will teach you way more than you can memorize in one day, but you should; there are dozens and some are very valuable.


You can always add more/change some existing ones by going to System Preferences -> Keyboard & Mouse -> Keyboard Shortcuts, exactly where you activated "all controls".


But as far as I know, there's no "underscore" thing in OSX.


hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...