Saturday, August 31, 2019

How to prevent an SSD from disappearing from BIOS

I've only recently upgraded my old machine to a new one with a brand new 60gb SSD as my boot drive and a 1TB main drive.



Paranoid about completely breaking my SSD, I read up on a lot of issues that I needed to watch out for, including making sure AHCI was turned on and trim enabled.



PC has been working fine for a few weeks now, until today. My wife was watching some TV on the machine when it started to act strange and eventually blue screened.



She rebooted and the boot mgr was missing. When I got home from work I checked the BIOS and the drive had disappeared. I panicked and looked up some possible fixes, and I discovered a large amount of people having problems with the drive firmware, especially on OCZ Vertex and Agility drives, and my drive is an Agility 3 drive.




The problems included blue screens followed by missing drives, and a solution was to reset the CMOS and try again. This worked, and now everything seems to be working fine.



My question is, is there any way to prevent this from happening? Am I missing a setting for my SSD? All of the posts I found were from early to mid-2011 nothing for the end of 2011 to 2012. So I am wondering if I've missed anything.



EDIT: Checked my drives firmware and it is 2.15, which has had issues reported by users.

windows 8.1 - Can dism /restorehealth be used to restore from a mounted 8.1 ISO?


On my x64 Lenovo z580 laptop with Windows 8.1 x64, I was trying to install KB2919355 when I encountered the error 80073712 which translates to component store corruption.


Since then, I have run the following commands copied here with results:




  1. sfc /scannow - result: no integrity violation

  2. dism /online /cleanup-image /checkhealth - component store is repairable

  3. dism /online /cleanup-image /scanhealth - component store is repairable

  4. dism /online /cleanup-image /analyzecomponentstore component store cleanup recommended: Yes

  5. dism /online /cleanup-image /restorehealth dism failed to perform any operation. Either the source is invalid or componentstore is not
    repairable Error code: 800f081f



Previously, I had upgraded to 8.1 using Windows Update. Now, I have downloaded the 8.1 ISO from here


Question: If I mount the 8.1 ISO to drive H:, Can I use the dism /online /cleanup-image /restorehealth /source:H:\sources\sxs /LimitAccess to repair my componentstore?


Answer



That error message is due to an issue with Windows Update. The DISM /online command uses Windows Update for it's file source. The article for KB 957310 should help you to resolve that error message, and then the DISM /online command should work fine once again.


Hope this helps,


javascript - Pass unknown number of parameters to JS function




A pattern in some javascript libraries is to be able to pass any number of parameters to a function:




functiona(param1)
functiona(param1, param2, param3)
functiona(param1, param2)


I have an array of unknown length, and I'd like to pass all the array items as parameters to a function like functiona(). Is this possible? If so, what is the syntax for doing this?


Answer



What you want is probably Function.prototype.apply().



Usage:




var params = [param1, param2, param3];
functiona.apply(this, params);


As others noted, functiona declaration may use arguments, e.g.:



function functiona()
{
var param1 = this.arguments[0];

var param2 = this.arguments[1];
}


But it can use any number of normal parameters as well:



function foo(x, y)
{
console.log(x);
}

foo.apply(this, [10, 0, null]); // outputs 10

linux - grep with regex containing pipe character



I am trying to grep with regex that contains pipe character |. However, It doesn't work as expected. The regex does not match the | inclusively as seen in the attach image below.



enter image description here




this is my bash command



cat data | grep "{{flag\|[a-z|A-Z\s]+}}"



the sample data are the following



| 155||NA||{{flag|Central African Republic}}||2.693||NA||0.000||0.000||0.019||0.271||0.281||0.057||2.066
|{{flagicon|Kosovo}} ''[[Kosovo]]'' {{Kosovo-note}}
|{{flagicon|Somaliland}} [[Somaliland|Somaliland region]]
|{{flagicon|Palestine}} ''[[Palestinian Territories]]''{{refn|See the following on statehood criteria:



the expected output is



| 155||NA||{{flag|Central African Republic}}||2.693||NA||0.000||0.000||0.019||0.271||0.281||0.057||2.066


However, having tested it with Regex101.com, the result came out as expected.


Answer



It appears that grep accepts \| as a separator between alternative search expressions (like | in egrep, where \| matches a literal |).




Apart from that, your expression has other problems:-




  • + is supported in egrep (or grep -E) only.

  • \s is not supported within a [] character group.

  • I don't see the need for | in the character group.



So the following works for grep:-




grep "{{flag|[a-zA-Z ][a-zA-Z ]*}}" 


Or (thanks to Glenn Jackman's input):-



grep "{{flag|[a-zA-Z ]\+}}" 


In egrep the {} characters have special significance, so they need to be escaped:-




egrep "\{\{flag\|[a-zA-Z ]+\}\}" 


Note that I have removed the unnecessary use of cat.


linux - Maxiumum recovery of data from old floppy discs with padded bad sectors and multiple passes


I've a collection of old 3.5" floppy disks that I'm looking to recover as much data as possible from.


The issue is due to the structure of some of the files, I need the length of all the files to be maintained meaning any bad sectors should be padded (the tl;dr reason why is some files are Acorn ADFS files where data and code are combined. The code references the data as an offset from the start of the file. Reading ADFS format isn't an issue in linux, the padding of bad sectors is).


The discs haven't been read in 25 years so I'm expecting unpredictable reading, regular bad sectors and potentially rendering the disks unreadable - which I don't mind as long as data recovery is maximised.


To do this I'm expecting multiple passes to be needed to read as much as possible.


dd


I looked at dd, with this command promising for a first run:


dd if=/dev/fd0 of=adfs.img conv=noerror,sync

Followed by subsequent calls of


dd if=/dev/fd0 of=adfs.img conv=noerror,notrunc

Where:


noerror means errors are ignored


sync means bad sectors are padded with the null character


notrunc means the (already existing) output file is not truncated when dd is called.


However, as I read the man page and this explanation of notrunc, despite notrunc being set, dd overwrites the output each time resulting in output that still only represents what was read with the last pass. Any sectors previously read correctly but now bad eg due to degrading old floppy disk, will be overwritten with null.


So dd doesn't look suitable.


ddrescue


ddrescue looks promising in that it can be used with multiple passes as long as a logfile is used to record what was successfully written and then referred to when the next pass is done.


The first pass to only read non-error blocks


ddrescue -d -p --no-split /dev/fd0 output.img log/output.logfile

for the first pass and subsequent passes of to fill in the errors


ddrescue -d -r3 /dev/fd0 output.img log/output.logfile

Where


-d direct disk access. Ignore system cache


--no-split or -n do not try to split or retry failed blocks ie only read good blocks. This is to only get good data in the first run to avoid the disk failing while trying to recover bad blocks.


-p preallocate preallocates disk space before recovery ie the output file will be the same size as input file/device


-r3 retry bad sectors 3 times (used on 2nd pass onward)


but the gotcha is ddrescue seems not to pad bad sectors as they occur. With -p set, it seems to result in all the padding at the end of the file, not maintaining the offsets of data from the start of the file as required.


This seems to be the case as ddrescue is written to try hard to save disk space so bad sectors are truncated, then added to if the bad sectors are successfully read in subsequent passes. Setting -p just creates an output file the same size as the input file to save the space, not to pad the data. The contents of the output with -p set or unset will therefore be identical ie not padded until the end of the file.


Question


So my question is a three parter


1) is it correct that ddrescue does NOT pad the recovered file even with -p set?


2) Is there any way to get it to pad? In my internet searching, I read a comment (will find it again and add) that the log file created by ddrescue could be used by a script to pad the relevant places. Any idea how?


and


3) do you know any better command / program / script to do what I'm trying to do - maximum data recovery via multiple passes of reading a corrupt disk with padding of bad sectors?


I'm using Ubuntu 18.04, dd version is (coreutils) 8.28 and GNU ddrescue version is 1.22, both from the Ubuntu repositories.


Thanks as always for any help


Answer



GNU ddrescue is the right tool for the recovery you are attempting.





1) is it correct that ddrescue does NOT pad the recovered file even with -p set?



This presumption is incorrect. You might be confused by the manual saying this:



Ddrescue does not write zeros to the output when it finds bad sectors in the input, and does not truncate the output file if not asked to.



It just means that zeros aren't written in place of bad sectors. Whatever should be at those bad sectors just isn't filled in. If you're writing to a blank disk or a file, the unwritten areas at the destination will read back as zeros (null bytes).


Also, the -p/--preallocate option does not have anything to do with "padding". It means "preallocate". On supported file systems, the option ensures that you have enough disk space on the destination to store the source disk.





2) Is there any way to get it to pad?



The file output by GNU ddrescue is logically the same layout as the source disk. A block read from the source goes in the same position in the destination. You could even reverse the whole recovery (-R/--reverse) and the blocks will be filled in backwards, still in the right places.





3) do you know any better command / program / script to do what I'm trying to do - maximum data recovery via multiple passes of reading a corrupt disk with padding of bad sectors?



GNU ddrescue does exactly what you want. It can do multiple passes (-r/--retry-passes=n), and the desired "padding" of bad sectors is the default behavior of GNU ddrescue. From the manual:



If the output file is a regular file created by ddrescue, the areas marked as bad-sector will contain zeros.



To be perfectly clear and to address your concern that a successful read followed by a bad read would become "padded" with null, ddrescue will not try to re-read a successful read―there is no need to because the data has already been recovered. The mapfile is how ddrescue knows what it already recovered and failed to recover.


input - Java: Console class







Reading the java documentation, i found this statement about Console class





First, it suppresses echoing, so the password is not visible on the user's screen. Second, readPassword returns a character array, not a String, so the password can be overwritten, removing it from memory as soon as it is no longer needed.




Why a character array can be overwritten and a String not?
Or maybe a character array can be overwritted in a more simple way?

worksheet function - Excel Convert the correct Date type


I'm currently following the date type dd/mm/yyyy i need to have another row showing the month in mmm type. E.g. From 13/09/2014 to SEP


My formula is =Text(A2, "mmm") which is the correct formula,


However it reads the text as mm/dd/yyyy thus having an error. How do I tell the excel to read it in dd/mm/yyyy format.


The format of the dd/mm/yyyy field is General - No specific format


Answer



If you want it to apply for just this Excel formula, Overmind's answer covers how. If you want it to apply always to everything, you have to change the system's date format.


Note that this will change every date displayed that uses system settings as well as changing how you must type in dates. For instance, if you change the system short date format to d/M/yyyy and then type 9/13 into Excel, it'll assume you meant September 1, 2013, because 13 doesn't make sense as a month so it must be a year and that means that 9 must be the month.


Here are the screenshots showing how to change the system's time format on Windows 7.


Right-click on the time in the system tray and click Adjust date/time


Screenshot 1


Click on Change date and time...


Screenshot 2


Click on Change calendar settings


Screenshot 3


Change the format as desired and click OK


Screenshot 4


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