Thursday, January 16, 2020

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 hundred bad sectors all clustered up in last couple of gigabytes on the hard drive. If I leave that part out unformatted, will it work right?


edit: This is the situation after testing. There is visible chaos at the end. All Sentinel or HDD Regenerator tests and repairs freeze when processes reaches 99%. It found additional 1 bad sector in the middle and a weird darker green pattern at the upper part of the image :)


Chkdsk with /f or /r also freezes at 99%. Done full windows format. People say that it should remap the bad sectors, but I'm not sure it did here any good.I will just try to make a 100 GB partition for system, and see how it works.


disk surface map

Tuesday, January 14, 2020

worksheet function - Multiple date formats in single column in excel


I have a csv file with a date column with dates in various forms as follows:


dd-mm-yyyy


yyyy-mm-dd


yyyy-mm


yyyy


This irregular data is in a single columns.


How do I convert all of them to the dd-mm-yyyy and extract the year from them using excel formula? The desired output is as follows:


Input       Output
25-03-1954 25-03-1954
22-09-1987 22-09-1987
1990-01-25 25-01-1990
1968-11-15 15-11-1968
1919-01 01-01-1919
1873-02 01-02-1873
1945 01-01-1945
1933 01-01-1933

Answer



If all that you really need is the Year, then use @robinCTS formula.


IF you want the result to be "real Excel Dates" and



  • if your data is TEXT and not real dates,

  • and if your regional date settings are DMY,

  • and the column is formatted as dd-mm-yyyy


then you could use this formula:


=IFERROR(IFERROR(IFERROR(DATEVALUE(A2),DATEVALUE(A2&"-01")),DATEVALUE(A2&"-01-01")),"illegal date format")

Note that dates prior to 1900 cannot be real dates in Excel, but could be represented as TEXT strings. I will leave it to you to tweak the formula.


If your output needs to be internationally aware to countries that have other date formats, then a VBA solution might be best. If that is not possible, helper columns to split the data and then reassemble appropriately, or a very complex formula to do the same, could be used.


Note that this UDF will output either the actual date, or just the year, depending on the second optional argument.


Option Explicit
Function ConvertToDate(S As String, Optional Yr As Boolean = False) As Variant
Dim V
Dim dtTemp As Date
V = Split(S, "-")
Select Case UBound(V)
Case 0
dtTemp = DateSerial(V(0), 1, 1)
Case 1
dtTemp = DateSerial(V(0), V(1), 1)
Case 2
If Len(V(0)) = 4 Then
dtTemp = CDate(S)
Else
dtTemp = DateSerial(V(2), V(1), V(0))
End If
End Select
If Yr = True Then
ConvertToDate = Year(dtTemp)
Else
If Year(dtTemp) < 1900 Then
ConvertToDate = Format(dtTemp, "dd-mm-yyyy")
Else
ConvertToDate = dtTemp
End If
End If
End Function

Both methods look at the first segment, and assume it is a year if LEN > 4, and then look at how many segments to decide whether to append the necessary -01's


The VBA solution will output dates prior to 1900 as a text string.


hard drive - BitLocker in Windows 7 Ultimate decryption of external HDD

I have locked my external hard disc using BitLocker. After formatting my computer I have lost all keys to open my external hard disc. Is there any way to unlock the external drive.

Display on TV using HDMI on laptop and TV

What settings on laptop are needed to get connection from Acer Travelmate 5730G hdmi port to hdmi tv to work. PC monitor works well with the laptop, but no luck with HDMI

microsoft excel 2007 - How to combine values from multiple rows into a single row

I have an Excel 2007 spreadsheet with 2250 rows and 19 columns. In these rows, I may have two rows of duplicate customer information that need to be combined, but only if the cell above is empty. I may also have rows of customer data that are not in need of combining. A unique customer member number can be used to identify the rows that need to be combined together. I'm struggling on developing the right VBA script to combine the unique customer data into the one row (on top) and delete the row that is remaining after combining. Is anyone willing to assist? It will save me hours/days of hand combining these rows and we are in the middle of a time sensitive audit.


Sample of our data:



MEMBER FIRST NAME MEMBER LAST NAME MEMBER # MVP SYSTEM ENTRY DATE ENROLL DATE MVP POINTS DRAWING ENTRIES ENROLL FORM? POINTS CORRECT? POINTS MISSED FINAL POINTS DRAWING ENTRIES SP Talon # WP Talon # BD DEPT EMPLOYEE NOTES DLR
Gene S 550061 3/2/2013 0 0 0 #N/A
Gene S 550061 3/2/2013 1539 137 MC MJ SP
Steve G 550087 3/2/2013 30019 1588 PA NR WP
Curtis S 550128 4/24/2013 5 0 5 #N/A
Curt S 550128 4/24/2013 358 47 MC MJ SP

Edit (not from OP) to add pipe/paragraph delimited version with underlines for spaces in headings:


MEMBER_FIRST_NAME|MEMBER_LAST_NAME|MEMBER_#|MVP_SYSTEM_ENTRY_DATE|ENROLL_DATE|MVP_POINTS|DRAWING_ENTRIES|ENROLL_FORM?|POINTS_CORRECT?|POINTS_MISSED|FINAL_POINTS|DRAWING_ENTRIES|SP_Talon_#|WP_Talon_#|BD|DEPT|EMPLOYEE|NOTES|DLR
Gene|S|550061|03/02/2013||0|0||||0|#N/A|||||||
Gene|S|550061||03/02/2013||||||||1539|137||MC|MJ||SP
Steve|G|550087||03/02/2013||||||||30019|1588||PA|NR||WP
Curtis|S|550128|4/24/2013||5|0||||5|#N/A|||||||
Curt|S|550128||4/24/2013||||||||358|47||MC|MJ||SP

windows 10 - I get the error: "Reboot and Select proper Boot device"



After I got a new and bigger SSD, I wanted to install Windows 10 on it. For some reason BIOS did not list my bootable USB device, with the Windows 10 installation. So I connected it thorugh SATA instead, and now it would let me install Windows 10. Problem is, everytime I disconnect the HDD where the Windows 10 installation is located, I get the error: "Reboot and Select proper Boot device" during boot. When I connect the HDD, it seems to boot from the installation HDD, and let me choose to open into Windows 10 (on the SSD). I can then use Windows 10 normally.



Som other info:



When the installation HDD is disconnected and I go into BIOS, the SSD is the only thing listed under boot devices. If I choose the SSD manually from BIOS, I get the same error message.



At first under the Windows 10 installation, I coulnd't install on the SSD because of it being a GPT-partition. I used Diskpart and then installed Windows 10.




I have tried to set the SSD as "active" with Diskpart.



BIOS Mode



MSInfo32 shows: Legacy



Title shown in BIOS menu: UEFI BIOS Utility - EZ Mode



BIOS when old and new SSD is connected. The old SSD (with working Windows 10) has the UEFI label.



Answer



So I found a USB drive that worked. I'm not sure what went wrong, when trying to connect. Now I got a fully functional Windows 10.


Monday, January 13, 2020

Our WSUS accidentally had Windows Insider updates turned on. How can I remove the 1909 update from my Windows Update screen without installing it?



There was a misconfiguration in my company WSUS and Windows Insider updates were accidentally included (our sysadmin checked the box for all Windows components and apparently Windows Insider was a part of that). I'm the only user with a Windows 10 machine (small shop of half a dozen people), and as such, my Windows Update recommends I install the 1909 feature update. Note that this machine is not enrolled in Windows Insider, has never been enrolled in Windows Insider and is not planned to ever be enrolled in Windows Insider. I'm not the sysadmin. Note that we use our WSUS only as a database of available updates, not to also distribute the updates themselves. We download the Windows updates themselves from the official Microsoft servers.



Our sysadmin has unchecked the Windows Insider box, but I still got that "Evaluation version of Windows Insider component update to version 1909 x64" update in my Windows update list. I've tried hiding the update through that one troubleshooting thing you can download, I've tried restarting the Windows Update service and I've tried deleting my SoftwareDistribution folder, but I can't figure out how to make this update go away. I've clicked the option to pause the updates for 7 days, but I don't know what else to do. I really don't want to accidentally install this update and then end up with an evaluation edition of Windows 10 1909 meant for betatesters.


Answer



I mentioned in my question that I paused updates for 7 days. I just resumed the looking for updates, and it checked for updates again and didn't find the Windows Insider update again (this was after our Sysadmin disabled the Windows insider box).



So I managed to solve my problem (how to remove the 1909 update from Windows 10 Windows Update settings screen without installing it) by first pausing Windows Updates for 7 days and then resuming the Windows updates immediately afterwards. This triggers a new search for Windows updates and indeed uses the new WSUS configuration for updates. Because at this point the Windows Insider updates were turned off, it didn't recommend it again during this check.


windows xp - Install XP(SP3) on laptop with SATA drive?


For testing purposes, I need to wipe out W7 from an Aspire 3810T laptop and install XP(SP3) on it.


Tried three different CD's, but they all failed, possibly because the drive is SATA. In the BIOS, changed AHCI to IDE, but it didn't work.


Next, downloaded the latest AHCI Intel SATA AHCI Driver (8.8.0.1009) from Acer's site, put the files on a USB drive, hit F6 when prompted to add drivers, but XP simply goes ahead without reading the USB drive.


Next, I figured maybe upgrading the BIOS would solve the issue, so ran Unetbootin to install FreeDOS on a USB key, downloaded and copied BIOS upgrade 1.28 onto the USB key, rebooted on the USB key, typed C: to switch to the USB key, hit F.BAT which calls "fla JM31.128", but got a crash:


DOS/4GW Professional error (2001): exception 0EH

Does someone know how to install XP on a laptop with SATA drive?


Thank you.


Answer



You can't load drivers into xp via a USB key - you have to use a floppy drive, or slipstream it with nlite.


windows 7 - Hard drive showing 333 MB of used space even though there are no files?

I've been using an external hard drive for quite some time, and recently I've upgraded to an internal drive and therefore moved all of my files from the external hard drive to the internal one.


Now my external hard drive is (obviously) empty. But at the same time it's not.


For some reason Windows and also Linux still show around 333-336 MB of used space, even though the drive is completely empty.


Yes, I am viewing hidden files. Yes, I am also viewing protected system files.
The only 2 folders remaining were a Recycle Bin folder, which is empty, and the System Volume Information folder.


So I went ahead and booted into Ubuntu, deleted both folders (which were only 1 MB in total), pressed CTRL+H in the file manager to view hidden files and yes, the drive is now really empty (some weird Trash folder appeared which I can't delete but its less than a KB big).


Yet Windows and GParted still say that 333 MB is in use.


How can that be?


The external HDD is made by Western Digitals, has 500 GB total space, and the partition is 500 GB big (NTFS).


Here's a screenshot:


enter image description here


In Windows 7:


enter image description here

Windows 7 Icon Placement

I have just moved to Windows 7 and I am rather bothered by the icon placement in the details view.


In every version of windows before 7 the Icon followed the name of the file. However, someone at Microsoft decided that it would be a better idea to place the icon at the beginning of the details view row.


I prefer to have size as my first column and I am not alone. When I move it there the Icon does not move with the name like it used to.


I am wondering if anyone knows of a way to change the icon position?


Here is a picture of what I am talking about:


enter image description here

macos - Disable clamshell mode in OS X Mountain Lion

I am running OS X 10.8.5 with an external monitor, and whenever I close the lid of my laptop it automatically goes into clamshell mode so that all the screen contents switch to the external monitor.


When I was running OS X 10.6.8, the machine will go into sleep when I close the lid so that the external monitor goes blank.


What setting(s) should I change in 10.8.5 to bring back the 'sleep' behavior?

Sunday, January 12, 2020

Understanding micro SD cards for camera


I am looking for a micro SD card for my point n shoot camera. I just know that better SD cards have better write/read speed.


I have following questions:



  • What do Class-10 and SDHC specify?

  • In the picture below, Samsung mentions that the card can be used for Digital Cameras but Scandisk does not say something like that. Does that mean, an SD card may or may not support a Digital Camera?

  • I understand that hardware recommendations cannot be asked but I am just wondering where "Toshiba Exceria" card stands in comparison to other cards in the picture below in terms of performance.


enter image description here


Answer



The SDHC is the format of SD interface (like SD v2.0). It's capable to provide capacities 2-32GB. For higher capacities there is the SDXC (up to 512 GB). Check what format your camera actually supports.


The Class 10 says that the guaranteed speed is 10MB/s or more. In general it should be sufficient for FullHD 1080p. The Class 10 cards are also marked as UHS Class 1.


windows 7 - How do I write a batch script that iterates through all png files in all subfolders and does an action?



I'm looking to build a small batch script that executes the command line of pngout.exe



So far I've got only this down




for %i in (*.png) do "g:\myfiles\_pngout.exe" "%i" /s0 /c6


However, for that to work I have to manually go to each folder where the pngs are and open up a cmd window from Win7 then copy and paste that line.



What I want is for that line to work say in C:\MyPNGs and it's sub-folders, like C:\MyPNGs\Avatars etc., it should iterate through all pngs and every time execute that "g:\myfiles\_pngout.exe" "%i" /s0 /c6



Any ideas?


Answer




You can use the following command from a dosprompt:



for /r %f in (*.png) do _pngout.exe "%f"


or the following inside a batch file:



for /r %%f in (*.png) do _pngout.exe "%%f"



For /r also has support to give a start directory. Otherwise it'll use the current directory and get every file in all subdirectories that match your filemask.


windows - Synaptics touchpad stops working randomly

I have two laptops. One dell Vostro and other Vaio Z. Both have Synaptics (Yes, I have checked, and the original drivers were from Synaptics as well). On both laptops, the touchpad scrolling stops working at some arbitrary time and nothing seems to solve it except a reboot. Sometimes, it randomly starts working again. I have downloaded all latest drivers from OEM.



Interestingly, when I run a program as Administrator, scrolling works in that window only.




This problem is very odd. It happens without any reason and I've not been able to find a fix for more than a year. I have seen some unusual suggestions on forums (e.g., to "restore windows to a previous working state") but never any fix that solves this issue properly. I have tried installing latest drivers and I DO NOT want to restore windows to a previous working configuration.



OS:
Windows 7 64 bit Professional (Sony Vaio Z - VPCZ128GG)
Windows 7 32 bit Professional (Dell)



EDIT: Temporary solution is to uninstall the synaptics driver and let Windows 7 use its default built in one. However, I really prefer the Synaptic driver because it activates the scroll button rather than the mouse wheel (useful in some apps)

Saturday, January 11, 2020

Windows "not genuine" after entering several commands

After entering these commands:
bootrec.exe /FixMbr
bootrec.exe/FixBoot
bootrec.exe/RebuildBCD
bcdedit /export C:\BCD_Backup
c:
cd boot attrib bcd -s -h -r
bootrec /RebuildBcd


My windows claims to be "not genuine" and I have 30 days to fix it... Does anyone know what I did to mess it up? and how I can reverse it?


Thank you.

macos - Mac: what permissions are granted for "allow the apps below to control your computer"?

I want to use an app from the mac app store (window tidy) but it wants me to give it control "over the computer". This setting is found under security & privacy > accessibility


This seems like a very big umbrella permission, and I can't seem to find out what this actually means in terms of what permissions it grants to apps.


What is the worst that can happen? Can it read my files? Can it make network calls to transfer my files, encrypted files, etc? Can it access contacts, and send emails as me?


I've looked online and this seems quite hard to answer. Does anyone know?


Thanks...


Update based on @teppic's comment below:


$ codesign -d --entitlements :- /Applications/Window\ Tidy.app
Executable=/Applications/Window Tidy.app/Contents/MacOS/Window Tidy




com.apple.application-identifier
34U5SFK3WS.com.lightpillar.Window-Tidy
com.apple.developer.team-identifier
34U5SFK3WS


Update 2


Continuing my curiosity, I installed the network monitoring tool Little Snitch to block and monitor outgoing communications. And in less than 1.5 hrs, Window Tidy (which is a simple app meant to resize windows) has reached out to connect over the network 3564 times. Definitely seems dangerous to have this app have access to read my files and control other apps...


enter image description here

windows 7 - Automatically extract and rename extracted file according to archive's name

I have a bunch of zip files in a folder. Each zip file has a file in it named exp_1.txt. I would like to unzip each zip file and rename the extracted file from each zip file to what the zip file was named.



The zip files names don't follow any pattern or date structure, but are all different. I have figured out how to get the exp_1.txt file extracted into the same directory as the zip file, but can't figure out the renaming of exp_1.txt to match what the zip file it was extracted from is named.



Once again in fewer words: from TuesdayReport.zip I want to extract the only file exp_1.txt and rename it to TuesdayReport.txt in the same directory as TuesdayReport.zip.




Currently I'm using 7z x to extract the file to the same directory the zip file is located in. I would prefer to be able to run this from a batch file.

How to remap keys under Linux for a specific keyboard only


I've recently bought a Unicomp keyboard that comes with swapped right-alt and Windows keys. The keyboard identifies like this on lsusb:


Bus 003 Device 002: ID 17f6:0822 Unicomp, Inc

Is there a way to have the kernel (i.e. not xmodmap-based) swap the right-alt and windows keys so every application sees them in the swapped places even if they get raw keyboard input (swapping stuff with xmodmap won't do that)? Is there a way to have that only for this one keyboard?


Answer



Yes, it's possible using XKB. Unlike xmodmap, XKB can remap your keys for individual devices.


Note: Make sure you have xkbcomp > 1.2.0


First list your devices with:


xinput list


You'll get something like this:


⎡ Virtual core pointer                      id=2    [master pointer  (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ Wacom Bamboo Pen Pen stylus id=11 [slave pointer (2)]
⎜ ↳ Wacom Bamboo Pen Finger touch id=12 [slave pointer (2)]
⎜ ↳ Logitech USB-PS/2 Optical Mouse id=13 [slave pointer (2)]
⎜ ↳ Wacom Bamboo Pen Pen eraser id=14 [slave pointer (2)]
⎜ ↳ Wacom Bamboo Pen Finger pad id=15 [slave pointer (2)]
⎜ ↳ GASIA USB KB V11 id=17 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
↳ Power Button id=6 [slave keyboard (3)]
↳ Power Button id=7 [slave keyboard (3)]
↳ G19 Gaming Keyboard id=8 [slave keyboard (3)]
↳ G19 Gaming Keyboard id=9 [slave keyboard (3)]
↳ Logitech G19 Gaming Keyboard id=10 [slave keyboard (3)]
↳ GASIA USB KB V11 id=16 [slave keyboard (3)]

Identify the string of your device and edit the following shell script, changing the sed line with one that fits your device's name. Then change the keys you need remapped.


Example: Load xev and press a key you want to remap. Suppose you find out it's keycode 84. Lookup 84 in https://gist.github.com/zoqaeski/3880640. The key name there is . Then lookup the key you want it replaced by (in the same link, farther below) and copy what's inside the brackets. Repeat the process for all the keys you want.


remote_id=$(
xinput list |
sed -n 's/.*GASIA.*id=\([0-9]*\).*keyboard.*/\1/p'
)
[ "$remote_id" ] || exit
# remap the following keys, only for my custom vintage atari joystick connected
# through an old USB keyboard:
#
# keypad 5 -> keypad 6
# . -> keypad 2
# [ -> keypad 8
# left shift -> left control
mkdir -p /tmp/xkb/symbols
# This is a name for the file, it could be anything you
# want. For us, we'll name it "custom". This is important
# later.
#
# The KP_* come from /usr/include/X11/keysymdef.h
# Also note the name, "remote" is there in the stanza
# definition.
cat >/tmp/xkb/symbols/custom <<\EOF
xkb_symbols "remote" {
key { [ KP_Right, KP_6, U2192, U21D2 ] };
key { [ KP_Down, KP_2, U2193, U21D3 ] };
key { [ KP_Up, KP_8, U2191, U21D1 ] };
key { [ Control_L ] };
};
EOF
# (1) We list our current definition
# (2) Modify it to have a keyboard mapping using the name
# we used above, in this case it's the "remote" definition
# described in the file named "custom" which we specify in
# this world as "custom(remote)".
# (3) Now we take that as input back into our definition of the
# keyboard. This includes the file we just made, read in last,
# so as to override any prior definitions. Importantly we
# need to include the directory of the place we placed the file
# to be considered when reading things in.
#
# Also notice that we aren't including exactly the
# directory we specified above. In this case, it will be looking
# for a directory structure similar to /usr/share/X11/xkb
#
# What we provided was a "symbols" file. That's why above we put
# the file into a "symbols" directory, which is not being included
# below.
setxkbmap -device $remote_id -print \
| sed 's/\(xkb_symbols.*\)"/\1+custom(remote)"/' \
| xkbcomp -I/tmp/xkb -i $remote_id -synch - $DISPLAY 2>/dev/null

Then source it (you can add it to your .xinitrc). All done! Now pressing the keys should generate the desired output, only for the device you specified.


Edit: Recently, I've noticed that, for some reason, the new configuration isn't applied immediately. You must first press a key on your other keyboard, then test the configured keys on your modified keyboard. I don't know why this happens, maybe some sort of cache.


How to Restart Windows Update Service in Windows 7?


I'm running into an issue with Windows Update on Windows 7 Professional. I am totally up to date in Windows Updates as of last week, but discovered this issue [today] during my Sunday morning PC maintenance ritual. In CONTROL PANEL -> SYSTEM & SECURITY -> Windows Update, when I select "Check for Updates", I get a pop-up stating:


"Windows Update cannot currently check for updates, because the service is not running. You may need to restart your computer."


I've re-started several times, checked that the service hadn't been disabled at start up, and I've googled extensively on the topic - but have come up with nothing. I know there must be some way to start the service from the cmd line, and I would like to know how to get the service to start at boot.


Please let me know if I have left any details out that may aid in formulating a response. Any of the community's excellent insights would be greatly appreciated!


Answer



You can try stopping and restarting Windows Update Service (wuauserv). Open a command line window (run as administrator) and enter the following lines:


net stop wuauserv
regsvr32 %windir%\system32\wups2.dll
net start wuauserv

If that does not help, try Microsoft's Fix It service to reset your Windows Update Components: How do I reset Windows Update components?


Deleting (Erasing) all Data from Failed SanDisk MicroSD Card

I've had two 32GB SanDisk MicroSD cards go bad recently. One I was able to temporarily revive using the kind advice offered in this thread: Recover Data from Card that cannot be read




When I insert the other into a reader, it registers as 30.6MB (that's MB, not GB).



I've tried all sorts of software and other techniques to revive this card and retrieve the important data off of it (including FindAndMount and TestDisk). Nothing has worked.



So I'm thinking of returning the card for a refund.



But first, I would like to make it unreadable by someone more skilled than myself. Is there any way to do this, given that I cannot even format the card or get it to be recognized as more than 30.6MB?



I am looking for a method that does not entail the kind of obvious physical destruction that would jeopardize obtaining a refund from the retailer. If Costco (where the card was purchased) accepts physically destroyed cards for return, then physical destruction is acceptable (but please have knowledge that they do).




Given two failures, I don't really want to send the card to SanDisk for replacement, because I no longer trust the reliability of their products.

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...