Would a tautological law have any effect?

Question: Is there any case where a law saying something like "Any person who commits theft is guilty of theft" would have any effect?
Comment: Why would it have any effect? As written this law has no consequences for being guilty of theft.
Answer:
"Any person who commits theft is guilty of theft"

This is not tautological. "Any person who commits theft commits theft" or perhaps "Any person who commits theft is a thief" is tautological. But the hypothetical law as written makes theft something that someone can be guilty of, that is, theft is an offence and illegal. The exact consequences depend on other provisions and the legal system itself.
If a common law jurisdiction abandons common law offences in favour of a criminal code and such code does not contain "any person who commits theft is guilty of theft", then theft would be legal (or at least not criminalized by such code).
Theft has to have an operable definition for the law to be effective, but the definition does not have to be explicit in the statutes when there are other sources of laws. The courts are meant to interpret the words in law reasonably, relying on ordinary definitions of expressions, the discernible intention of the legislature, history and social development.
There can be unconstitutionally (or otherwise unacceptably) vague laws, but in common law jurisdictions, at least the usual crimes like theft and murder have been interpreted by the courts over hundreds of years with a rich body of case law and legal literature. Crimes like piracy benefit from a multitude of internationals conventions and case laws in many jurisdictions, for example, the Canadian definition of piracy is almost a tautology:

74 (1) Every one commits piracy who does any act that, by the law of nations, is piracy.

Of course, the operative provision is exactly the one with the words "is guilty of"

(2) Every one who commits piracy while in or out of Canada is guilty of an indictable offence and liable to imprisonment for life.
Comment: Colorado used to have an adultery law written that way.
Answer: Some German laws are written almost that way

Section 211 (German) Murder under specific aggravating circumstances (Mord)
(1) Whoever commits murder under the conditions of this provision incurs a penalty of imprisonment for life.
(2) A murderer under this provision is someone who kills a person
out of a lust to kill, to obtain sexual gratification, out of greed or otherwise base motives,
perfidiously or cruelly or by means constituting a public danger or
to facilitate or cover up another offence.

The definition here is defining someone commits murder if he is a murderer... for which they do provide a definition, which is very akin to Murder 1st degree in many states of the US.

Section 212 (German)
Murder (Totschlag)
(1) Whoever kills a person without being a murderer under the conditions of section 211 incurs a penalty of imprisonment for a term of at least five years.

And in 212 they define that someone commits still murder if they kill someone but are not a murderer - in Germany that's technically called Totschlag, in US law that's often considered something like murder in the 2nd or 3rd degree. Which is again different from less serious case of murder (minderschwerer Totschlag, StGB §213), killing by neglect (Fahrlässige Tötung, StGB §222), bodily harm resulting in death (Körperverletzung mit Todesfolge, StGB §227)...
Comment: The English translation only seems this way because of the translation choices -- in the German version, the two words Mord and Totschlag are defined distinctly, but in the English version the word murder is used for both terms, and the translators apparently invented the phrase "under specific aggravating circumstances" specifically to distinguish between the two German words, though it's a bit confusing, since the phrase was not also added to "murderer" as well in the English. I suppose "murder-under-specific-aggravating-circumstances-er" would have been more accurate, but too unwieldy.
Comment: I probably would have opted for different terms in the translation. E.g. murder/homicide or murder/manslaughter, but I see now that this is easier said than done, for reasons of style and grammatical use. In German it's easy to grammatically connect the action Mord and an actor Mörder, just like pairing Totschlag with Totschläger but in English this doesn't always work well, e.g. pairing murder and murderer works fairly naturally in English, but pairing homicide and 'homicider'? Doesn't sound good. Manslaughter and 'manslaughterer'? Also very strange.
Comment: @Brandin In german it is "Mord  - Mörder wird [so] bestraft - Mörder ist wer [X]", so the act (Mord) is defined via the actor (Mörder), who is defined.  The (official(!)) English translation is somewhat crude in that regard...
Answer: In order for a law like this to have any effect, it would need to be accompanied by a clear definition of what constitutes theft. For example, the law could stipulate that theft is taking something without the owner's consent, with the intent to permanently deprive the owner of its use. This would provide a clear and objective standard against which to measure alleged instances of theft. Without such a definition, the law would be little more than a empty statement. Furthermore, even if the law was accompanied by a clear definition of theft, it is doubtful that it would have much of an impact. After all, those who are inclined to commit theft are unlikely to be deterred by the existence of a law against it. In short, while a law against theft might theoretically have some effect, it is unlikely to be significant.
Comment: unless there's an earlier paragraph that says "all crimes in this chapter are to be punished by *X years*"
Comment: Why would the law have to be accompanied by a clear definition? Courts routinely make up any definitions they need if words in a law are not explicitly defined. As long as the word theft has a generally understood meaning courts should be able to find some reasonable definition.


How feasible is it to wire into common household measuring instruments with a solid grasp of electrical engineering?

Question: I'm studying up on EE and I have a budding grasp of circuits and ohms law so far. As I continue I wonder how feasible would it be for me to read data from existing electronic devices such as this  temperature/humidity gauge. My end goal would be to wire this into my arduino. I realize there are existing plug ins for the arduino for this purpose but having the knowledge to do this with my existing devices seems very exciting. So are manufactured electronics like this hard to wire into? What would that involve?
Answer: The question is very open ended as it really does depend on the individual thing you are trying to hack into. Sometimes they have every chip in a nice big DIP package with all the markings plain to see, with the pcb nicely labeled. Other times you get Chip-On-Blob packages with nothing labeled, no accessible test points, no markings, smd chips so small that you can't easily connect a wire to it or bga packages where the pins are underneath the chip body.
The easiest thing to do is open it up, and take a look. Google any part numbers you see, look for projects that access them, look for datasheets. That's the real starting point.
Then there is the question on if you are simply trying to repurpose the item (easier), or if you are trying to read data without affecting how it works (harder). Sometimes you go about it a different way, can't access the raw chip data, how about accessing the lcd's memory and figuring out what is being displayed. There are multiple ways, but you need to know what it has first to be able to come up with them.
Comment: haha got it!! :D
Comment: Thanks! Great advice, I'll take it apart! (insert evil laugh?)
Comment: @stormist you should only add a evil laugh when you are holding a screwdriver to the gizmo's face. Makes you seem less crazy and more menacing like that ;D
Answer: For a relatively simple gizmo like the gauge in the O.P., the from-scratch approach is more feasible.  You can get individual components (such as sensors, displays) by themselves or as Arduino shields.  You'll have fewer black boxes to deal with.  Industrial design is just about the only advantage one can get from hacking/hijacking a gadget like that gauge.
Exception:  There are gadgets which have already been hacked, and proceedings have been posted on the web.  Subscribe to a site like hackaday.com, and eventually you might come across something that looks appealing and doable for you.
Answer: If you're trying to learn, buy one and take it apart.  You will get at least $10 of education from figuring out how it works.  Even if you don't use it directly, reverse-engineering the sensors will give you a head start on designing your own.


Read/Write binary files overflow

Question: I am wanting some help with some code please. Here is my code:
<code>    Public Function ReadBinaryFileLarge(strFilename As String) As Byte()
    Dim position As Integer = 0
    Dim bufferSize As Integer = 4096
    Dim bytes() As Byte

    Using fsOpen As FileStream = New FileStream(strFilename, FileMode.Open)
        ReDim bytes((fsOpen.Length) - 1)
        Do
            If (position + bufferSize) > fsOpen.Length Then
                fsOpen.Read(bytes, position, fsOpen.Length - position)
                Exit Do
            Else
                fsOpen.Read(bytes, position, bufferSize)
            End If

            position += bufferSize

            Application.DoEvents()
        Loop
    End Using

    Return bytes

End Function

Public Sub SaveBinaryFileLarge(strFilename As String, bytesToWrite() As Byte)
    Dim position As Integer = 0

    Using fsNew As FileStream = New FileStream(strFilename, FileMode.Create, FileAccess.Write)
        Do
            Dim intToCopy As Integer = Math.Min(4096, bytesToWrite.Length - position)
            Dim buffer(intToCopy - 1) As Byte
            Array.Copy(bytesToWrite, position, buffer, 0, intToCopy)
            fsNew.Write(buffer, 0, buffer.Length)

            position += intToCopy

            Application.DoEvents()

        Loop While position < bytesToWrite.Length

    End Using

End Sub
</code>
My problem is that with large files, the byte array cannot be declared that large. I am needing to load it into a byte array to do some encryption work on the byte array. I am playing around with this code:
<code>    Public Function ReadBinaryFileTest(strFilename As String) As Byte()()
    Const SIZE As Integer = &H1000 '4096 <-experiment with this value
    Dim bytes()() As Byte

    Using fsOpen As FileStream = New FileStream(strFilename, FileMode.Open, FileAccess.Read, FileShare.Read, SIZE)
        Dim ubound = (fsOpen.Length / SIZE) - 1
        bytes = new byte(ubound)()
        Dim read As Integer = 0

        For index As Integer = 0 To ubound
            bytes(index) = New Byte(SIZE - 1)
            read = fsOpen.Read(bytes(index), 0, SIZE)
            If read <> SIZE Then
                Array.Resize(bytes(index), read) 'this should only happen once if at all
            End If
        Next
    End Using

    Return bytes

End Function
</code>
However I am getting these errors:

bytes = new byte(ubound)()

'{' expected
and

bytes(index) = New Byte(SIZE - 1)

Type 'Byte' has no constructors.
Is this the correct way to go about this problem? If not, how should I attack it?
Answer: You have to use ReDim,
<code>ReDim bytes(ubound-1)
</code>
Or
<code> bytes = New Byte(ubound)() {}
</code>
Comment: How about: bytes(index) = New Byte(SIZE - 1)
Comment: Put {} -  bytes(index) = New Byte(SIZE - 1) {}

Read/Write binary files overflow


Factory reset when enabling and disabling OEM Unlock in one session?

Question: I accidentally enabled "OEM Unlock" on my old Pixel 3a. I instantly disabled "OEM Unlock" again. Will the phone forcefully factory reset when I reboot?
Comment: No your phone will not perform a factory reset. Enabling that option is just the first step for bootloader unlocking it simply say "I allow bootloader unlocking" but the actual unlocking procedure has to be performed on a different point in system.
Comment: OEM Unlock is not the same as bootloader unlocking procedure - it is prerequisite
Comment: @Robert that's good news. You should write an answer so I can mark it once I verified your statement.
Answer: I've finally decided to restart my phone. Robert was right, no factory reset has happened.


Fault tolerant RAID6 / RAID10 design for home server - not performance critical

Question: I want to balance disk space against fault tolerance. I would like fault tolerance to be able to handle multiple disk failures (as I may not be able to afford replacements disks or have the time for weeks possibly)
The main purpose of the home Linux server shall be a place to backup other machines too, store/share large amounts of data. So the data will be re-creatable most of the time. Storage of media (ie backup of my DVD's, Cd's etc)
I had a RAID10 array of 6 x 1.5TB but due to operator incompetence and laziness, I now have 6 empty disks :-) and a clean start.
One of the disks is definitely failing (over 55 error from smartctl and short and long test errors) so it will be sent away for warranty replacement - but I would still like to include it in the final array. Lets call the bad disk /dev/sdc
Machine has 6 sata ports and 2 IDE (with 2 CD drives). Dual Quad core Xeon, 16Gb RAM. And really 1 user most of the time.
[NB I may be able to remove a CD drive and add a 7th IDE disk just for the OS only to separate data/OS] Otherwise plan is to save 100GB partition and put the OS there (maybe mirror between disks)
Option A)
RAID 6 sd[abdef], sdc as hot-spare (but gets sent for replacement soon) raid-devices=5 spare=1
Option B)
RAID 6 sd[abdef], sdc as missing (but gets sent for replacement soon)
raid-devices=6 spare=0
Option C) RAID 10 sd[abdef], sdc as hot-spare (but gets sent for replacement soon) raid-devices=5 spare=1
Option D) RAID 10 sd[abdef], sdc as missing (but gets sent for replacement soon) raid-devices=6 spare=0
Option A is seeming to be the best at the moment because I'll get 4.5TB of space and room for 3 disk failures if I calculate it correctly.
This will all be done with mdadm soft raid.
Which do you recommend or are there better possibilities layouts that I could use?
Answer: Raid10 may not be able to handle two disks failing, so raid6 would be more reliable.  It also gives more storage capacity.  Option A only can handle the third failure if it happens after the rebuild onto the hot spare completes, but you only get 50% of the total space.
The odds of having 3 out of 6 disks fail are very slim, so I would be inclined to think that the loss of space ( and throughput ) is not worth having a hot spare.  What you could do as a compromise is run without a hot spare, and in the event that you have a failure, and know you can not replace it for some time, and are worried that you might have two more failures, you could then reshape the array to a 5 disk raid6 and be back to being able to handle two more failures.
This requires that you use a filesystem that you can shrink since reshaping the array will reduce its capacity.
Comment: Good point about having 3 failed disks.
Answer: I recommend you check out Robin Harris (StorageMojo)'s blog Dear StorageMojo: cheap home bulk storage?. Robin, who writes about the data storage industry, thinks he should change his storage server "from RAID 5 to multiple RAID 0 stripes for speed and capacity." But read the 50 comments for other opinions.

ZFS to administer the file system and drives. But, "stay AWAY!! from ZFS unless you are a sysadmin type or SUN customer. I'm on zfs-discuss and the sheer number of problems people run into for simple stuff is mind-boggling", says another commenter
Drobo, but "too expensive per gigabyte"
"mini-atx PC (the size of a breadbox) running either openfiler or freenas"
Solaris 11 Express
"RAID 0 is bad news and when it fails you will have major corruption issues."
'"The folks asking this question aren't full time sysadmins.." Soon as I read this I thought "Get a NAS".', e.g. 'QNAP 659 Pro+ with 6x 2 TB drives in a RAID-6 configuration.'
"what is wrong with just high grade SATA spindles, an a mirror copy, same spec? Things like WE4 do not even power up unless needed.... And suddenly, for

I don't claim this picks one of the options you put forward. But it is food for thought.
Me, I chose a NAS, with 2x1 TB drives in Raid-1 (mirrored). Every now again I rotate one of the drives to off-site storage and plug the previous off-site drive into the NAS.
Comment: Thanks but I already have all the hardware - for a few years now - plus I run Virtual Machine and large compiles on the server too. So its making best use of what I have


How can I add auto bed leveling before print?

Question: I want to add auto bed leveling before each print. When I enable auto bed level in configuration.h, it only shows auto bed in menu. I found this code in cardreader.cpp
void CardReader::openAndPrintFile(const char *name) {
    char cmd[4 + strlen(name) + 1]; // Room for "M23 ", filename, and null
    sprintf_P(cmd, PSTR("M23 %s"), name);
    for (char *c = &cmd[4]; *c; c++) *c = tolower(*c);
    enqueue_and_echo_command(cmd);
    enqueue_and_echo_commands_P(PSTR("M24"));
}

and changed it to
void CardReader::openAndPrintFile(const char *name) {
    char cmd[4 + strlen(name) + 1]; // Room for "M23 ", filename, and null
    sprintf_P(cmd, PSTR("M23 %s"), name);
    for (char *c = &cmd[4]; *c; c++) *c = tolower(*c);
    enqueue_and_echo_command("G28");
    enqueue_and_echo_command("G29");
    enqueue_and_echo_command(cmd);
    enqueue_and_echo_commands_P(PSTR("M24"));
}

Now before each print, the printer does auto bedding two times but when print starts the auto bedding is ignored and printer acts like before doing auto bed.
Please help me solve this.
I'm using Marlin Firmware 1.1.0.
Comment: @HadiBarak If configured correctly, you will have an option to auto level the bed before manually starting a print. This will be under Prepare -> bed leveling (or whatever the option is called). Adding it to the start G-code is the best solution. But make sure you put it after G28 (auto homing) You are not able to automatically run the command when printing something because this is controlled by the starting G-code.
Comment: Why don't you just add the auto leveling commands to your start G-code (in your slicer)?
Comment: I want it to be automatic, some times I only have g-code file and it's not possible to edit all of them
Comment: @HadiBarak you can edit Gcode with any TXT editor, is just needed to add G29 after G28.
Answer: Rather than modifying the firmware to handle this, have you considered a pre-processing script on your computer, greping for a G29 in the G-code, then adding a G28/G29 pair at the start of the file if no G29 is found?
Comment: After re-reading the question, it seems this is maybe the only way to solve the problems in this case, unless Octoprint can do the same as a preprocess.
Comment: @SeanHoulihane I've added an [answer](https://3dprinting.stackexchange.com/a/6777/5740) that describes how to do that with the use of OctoPrint
Answer: Another answer that does exactly what you want involves the use of a print server. A print server is an application that runs the instructions to the printer over a USB connection from another device, this can be your computer/laptop, or a dedicated Raspberry Pi (a small and affordable computer). One such application described here further is OctoPrint (this may very well be done with other applications, but this needs to be checked first!), this print server application allows integration of many third party plug-ins next to the extensive feature set it already has out-of-the-box. One such feature is GCODE scripts (intently spelled this way to match the option in the Octoprint settings menu); this screenshot shows some details:

As can be seen from the image, there are specific "events" available to process G-code commands at specific event occurences like e.g. just before the print starts. You could use that envent to insert your leveling commands.

Please note that in the image you will find strange G-code commands like OCTO100 and OCTO110 which is a feature of the plugin called "GCODE System Commands" which allows running shell scripts to schedule the fan. I just kill the power to the fan when the printer is idle to get rid of the noise when the printer is just idling, the fan is only needed when the hotend is at elevated temperature.
Answer: With Marlin 1.1.0, you can automatically run a G-Code file when powering on the printer with a SD card already present.
Add a file named auto0.g at the root of your card, containing the following G-Code:
G28 ;Auto-homing
G29 ;Bed leveling

Normally the bed leveling map should be reused for all subsequent prints, until the printer is turned off.
It is possible to provide up to 10 files, from auto0.g to auto9.g.
Comment: Would you like to post this (or a derivative thereof) as an answer to the question [Can G-code scripts be run automatically on inserting an SD card when using Marlin Firmware?](https://3dprinting.stackexchange.com/questions/6778/can-g-code-scripts-be-run-automatically-on-inserting-an-sd-card-when-using-marli)
Answer: Rather than placing the G28 (Home) and G29 (bed level) in the configuration, I would place it in the G-code generating slicer as pre-print code. This will automatically add this to the start of any G-code sliced, enforcing the homing and leveling whenever the G-code is run.
Answer: I'm not that fluent in G-code, but at Modern Machine Shop: Understanding G27, G28, G29 and G30 I found these descriptions of the G28 and G29 codes you added:

G28: For any axis letter addresses included in the G28 command, the machine first will move (at rapid) to an intermediate position in those axes. Then, it will rapid to the zero return position in the commanded axes.
G29: G29 is also a two-step command. First, it causes the machine to move (in the axes commanded) to the intermediate position used in the most recent G28 command. Second, it causes the machine to move to the position included in the G29 command.

So it sounds to me like you only need one of those two commands. It seems that the code you modified runs separately on startup, rather than for each separate print. I would first try your modification with each G command separately, so you can see exactly what the difference is on your hardware.
I don't know my way around the code involved, but it looks like you'd need to make the modification in another place, such as just before whatever loop sends successive commands to the printer.
Hope that's helpful despite my limited fluency...
Comment: These descriptions you found relate to the G28/G29 commands on professional CNC machines. In 3D printer firmware, they have been (mis-)appropriated for other uses. G28 performs a homing sequence to the endstops (this kind of - but not really - corresponds to your description), while G29 initiates auto-bed leveling.


Does the phrase correct here?

Question: "We've given up saying we only kill to eat; Kraft dinner and freeze-dried food have put paid to that one"
It should be 'kill to only eat'?
'Have put paid to the their leaving of saying they only kill to eat'?
Comment: The question should be "Is the phrase correct here?", the word *correct* is not a verb, hence we use the auxiliary *be* to form questions and negatives, e.g. "It is not correct"
Answer: Your question is somewhat confusing but it sounds like you don't understand what the author is saying:

...we only kill to eat;"

This is the correct word order. It means that the only reason the author kills is so that he can have food to eat. It's NOT "kill to only eat".
Kraft is a company that makes ready made food. put paid to is an expression that means putting an end to something.
In essence, what the author is saying is that in the past, people could justify killing [animals & plants] by saying "well, we need to eat, so we have to kill", but that today, with ready-made food like Kraft's and frozen meals, that excuse to kill is no longer valid.
(Although one may wonder where the author thinks Kraft food products come from.)
Hope this clears it up.

Does the phrase correct here?


What is the best and fastest way to check if the image is valid in PHP?

Question: What is the best and fastest way to check if the image is valid in PHP ?
I need it to be able to check GIF, JPG as well as PNG images.
Comment: What do you mean by "valid"? Checking if the image file is in the correct format?
Comment: @MichałWojciechowski to prevent end user from uploading harmful file, disgusing as image file
Answer: exif_imagetype is a better solution.
This method is faster than using getimagesize. To quote php.net "The return value is the same value that getimagesize() returns in index 2 but exif_imagetype() is much faster."
if(exif_imagetype('path/to/image.jpg')) {
    // your image is valid
}

Update:
After reading that getimagesize can be unreliable I tried to find some more info on what file types can give false positives but could not find any more info so performed a brief test (using exif_imagetype):
PowerPoint-survey-results.pptx - N
LRMonoPhase4.wav               - N
TestWordDoc.doc                - N
drop.avi                       - N
test.dll                       - N
raw_data_sample.sav            - N
text.txt                       - N
Excel-survey-results.xlsx      - N
pdf-test.pdf                   - N
simplepie-1.5.zip              - N
Word-survey-results.docx       - N
centaur_1.mpg                  - N
Test.svg                       - N
multipage_tif_example.tif      - Y
200.gif                        - Y
Test.png                       - Y
test.jpg                       - Y

I realise this is not exhaustive however at least show that with common file types the results are as expected.
Comment: Of course this only works when EXIF extension is enabled. In my case it's not the case and I have no control over this :(
Comment: Sadly if you run the function on a truncated png for example the return value is still the constant for the png, even if the file is not a valid png.
Comment: since exif_imagetype returns same as getimagesize and getimagesize is supposingly "unreliable", anyone can confirm exif_imagetyle is safe to use in production to determine file is jpeg/png?
Comment: @SomeoneSpecial exif_imagetype is NOT safe to use. You should also check extension of the file, or at least set it yourself when uploading. the exit data could be spoofed and you only have to insert a few bytes into your file to make it "look" like a png type
Answer: As recommended by the PHP documentation:
"Do not use getimagesize() to check that a given file is a valid image.Use a purpose-built solution such as the Fileinfo extension instead."
Here is an example:
$finfo = finfo_open(FILEINFO_MIME_TYPE);
$type = finfo_file($finfo, "test.jpg");

if (isset($type) && in_array($type, array("image/png", "image/jpeg", "image/gif"))) {
    echo 'This is an image file';
} else {
    echo 'Not an image :(';
}

Comment: This method is insecure and could be exploited. An attacker could spoof the MIME type, and upload files with a .php extension
Answer: I guess getimagesize:
list($width, $height, $type, $attr) = getimagesize("path/to/image.jpg");

if (isset($type) && in_array($type, array(
    IMAGETYPE_PNG, IMAGETYPE_JPEG, IMAGETYPE_GIF))) {
  ...
}

Comment: Read documentation: Do not use getimagesize() to check that a given file is a valid image. http://php.net/manual/en/function.getimagesize.php
Answer: exif_imagetype is much faster than getimagesize and doesn't use gd-Lib (leaving a leaner mem footprint)
function isImage($pathToFile)
{
  if( false === exif_imagetype($pathToFile) )
   return FALSE;

   return TRUE;
}

Answer: I use this:
function is_image($path)
{
    $a = getimagesize($path);
    $image_type = $a[2];

    if(in_array($image_type , array(IMAGETYPE_GIF , IMAGETYPE_JPEG ,IMAGETYPE_PNG , IMAGETYPE_BMP)))
    {
        return true;
    }
    return false;
}

Answer: I use this function... it checks urls too
function isImage($url){
   $params = array('http' => array(
                'method' => 'HEAD'
             ));
   $ctx = stream_context_create($params);
   $fp = @fopen($url, 'rb', false, $ctx);
   if (!$fp)
      return false;  // Problem with url

  $meta = stream_get_meta_data($fp);
  if ($meta === false){
      fclose($fp);
      return false;  // Problem reading data from url
  }
 }


Apple Earpod one-click/Double-Click not working on Sony Xperia Z1, Android 4.4.2 Kitkat

Question: I have Sony Xperia Z1 loaded with Android 4.4.2 Kitkat. My Apple earpods were working fine on Android Jelly Bean ie one-click will pause/play & double-click will play next song (Volume controls don't work on Android), but after upgrade to Android 4.4.2 Kitkat the one-click doesn't pause/play & double-click doesn't play next song. Please help me out. I don't want to miss the awesome sound from my apple earpods.
Answer: Try this:
hold the volume down button in earpod while inserting


How to make bootable CDROM for BIOS-less computer?

Question: my Mac is the 2015 model that only supports UEFI.
I'd like to create a bootable CDROM based on a bootable floppy disk image.
Is this possible?
Answer: Yes, it's possible. Before proceeding, though, you should understand that CDs generally boot with the help of an El Torito image, which is a FAT filesystem stored on the CD alongside its normal ISO-9660 or UDF filesystem. Thus, you must prepare both an El Torito FAT filesystem and an ISO-9660 or UDF filesystem. That said, the ISO-9660/UDF part might conceivably be empty or nearly empty (and is likely to be so in your case). Broadly speaking, there are three steps to do this:

Prepare the OS to be booted by setting up a directory holding all the files. In your case, this image might be empty; or for convenience, you might copy out the contents of the disk image so that you can access it from the CD-R without using special tools. In a broader case, this might contain a more major OS installation to be run from the CD-R.
Create a bootable FAT filesystem image. Note that this image must be bootable in the EFI sense, not in the BIOS sense. That is, it should have an EFI boot loader at EFI/BOOT/bootx64.efi, and that boot loader should do whatever is required to boot the OS stored on the CD. In your case, this would be your existing floppy image. It's worth checking now to see if it has the EFI/BOOT/bootx64.efi file. (Note that filename case is irrelevant.)
Prepare the disc, storing the FAT filesystem image as an El Torito alternate image and the rest of the files (if any) in the main ISO-9660 or UDF filesystem.

Since you say you've got a bootable floppy disk image, much of your work is likely done for you -- at least if it's EFI-bootable (more on that shortly). I do something similar to this to prepare the CD-R image of my rEFInd boot manager. The command I use to prepare a .iso file is:
mkisofs -A "Bootable rEFInd" -V "rEFInd" -volset "rEFInd" \
    -J -r -v -x ./lost+found -o ../refind-cd.iso \
    -eltorito-alt-boot -efi-boot refind-bin.img -no-emul-boot ./

This example uses the mkisofs (or genisoimage) command, which comes with all major Linux distributions. I assume there's a version for OS X, but I haven't looked for it. This command prepares a disc image from the contents of the directory in which it's typed (the ./ at the end of the command). The key point for this discussion is the last line, which sets it up so that EFI systems will treat the refind-bin.img file as if it were an EFI System Partition (ESP). You'd specify your EFI-bootable floppy image rather than refind-bin.img. Once the command spits out an image file (../refind-cd.iso in this example), you can burn it to a CD-R just like any other such file.
The same thing is likely to be possible with other programs, but I don't happen to know the details for anything but mkisofs -- and I'm not really an expert even at that. (I'm just copying a command that I cobbled together and that works for me.)
Note that I've emphasized that the FAT disk image must be bootable in EFI mode. Many bootable floppy disk images are instead bootable in BIOS/CSM/legacy mode. Such images can be turned into bootable CD-Rs, too, but the details of what commands you'd use are different. Macs can boot BIOS-bootable CDs, and this boot mode may be perfectly acceptable to you, but your question emphasizes EFI-mode booting, so I assume you have a reason for this. (Maybe that's a bad assumption, though.)
If your floppy disk image lacks the EFI/BOOT/bootx64.efi file, then it cannot be booted in EFI mode, at least not as-is. (It might be modified with the addition of an EFI-mode boot loader, but the details depend on the OS the floppy contains. Not all OSes are bootable in EFI mode.) If this is the case, then something similar to the preceding command might work, but you'll need to modify it to make a BIOS-bootable image rather than an EFI-bootable one.
Answer: well it depends what the bootable floppy disk image is but if your motherboard can boot off the floppy image the yes. burn the contents of the image to the cd and insert the cd into the mac. restart and on the chime hold the option key and select the disk. if that doesn't work you can select the startup disk in System Preferences> Startup Disk select it from there and select restart from in the window.


Find the value of a+b+c

Question: If $x+1$ is a factor of $ax^4 + bx^2 + c$, find the value of $a + b + c$?
I know that it is equal to zero, but I have to know How to do it.
Answer: All you need here is the following fact:
If $(x-r)$ is a factor of the polynomial $P(x)$, then $P(r) = 0$.
Answer: Hint: Try dividing $ax^4+bx^2+c$ by $x+1$ through long division. What is the remainder? What should it be?
Answer: If you are familiar with synthetic division, you can use that technique to divide $ax^4 + bx^2 + c$ by $x+1$ and find the remainder. Otherwise, you could use long division.
Regardless of what technique you use, for $x+1$ to cleanly divide $ax^4 + bx^2 + c$, then the remainder must be zero. Once you find the remainder, assign values to $a, b, c$ in order to make that remainder zero.
EDIT: Leaving this here as an alternate solution. TonyK's approach is far superior.
Answer: As a shortcut for the long division, note that if $x+1$ is a factor of $ax^4+bx^2+c=0$, then $x-1$ is also a factor. Divide $ax^4+bx^2+c$ by $(x+1)(x-1)=x^2-1$ to get the remainder $a+b+c$, which must be equal to $0$.
Answer: Let $p(x)=ax^4+bx^2+c$.  We are given $p(x)=(x+1)q(x)$ for $q(x)$ some cubic polynomial.  Now evaluate it at $x=-1$ and we get $p(-1)=a(-1)^4+b(-1)^2+c=a+b+c=0\cdot q(x)=0$ so $a+b+c=0$

Find the value of a+b+c


Is there any image application that can crop images that is faster/lighter than GIMP?

Question: From a screenshot I want to cut only the part that is important. I do know I can do it using GIMP, but GIMP is very slow to start. Is there any image application that can do it faster?
Answer: To crop images with Shotwell (the default picture viewer) just open the image and choose Crop from the Photo -> Tools menu. This will give you a highlighted frame you can drag with your mouse.
Comment: Pinta also supports it
Comment: Right on the money! I was just about to instal GIMP solely for the reason of cropping images.. you saved me a lot of time.
Answer: You can use Shotwell which comes installed by default. just right click an image and select Open With from the context meny and then select Shotwell. Shotwell comes with a CROP feature so you can select which part of the image you want.
Answer: If its something you want to do more than once (say from multiple screenshots) then its best to Alt-Print Screen to perform the image cuts and then use Imagemagick convert as follows:
<code>convert -crop 400x300+50+200 screenshot.png test.png
</code>
will generate a 400x300 image as a subset of the original screenshot.png offset by 50 pixels east and 200 pixels south.
Its slow to sort the first time, but once you have done it once the other images can be put into a batch using a bash script.


Cache Types are Invalid. How can i resolve this permanently?

Question: Error: One or more of the Cache Types are invalidated: Configuration, Page Cache. Please go to Cache Management and refresh cache types.
How can i resolve this permanently?
Answer: If you don't ever want to clean cache manually, there is a watcher developed by Vinai Kopp which will clean it for you when the cache invalidates. Just a heads up that it is developed in node js so you'll have to install that to run it.
You can find the documentation and source of the watcher here - https://github.com/mage2tv/magento-cache-clean
Answer: Is not an issue , but a magento notice .
When you make updates on admin , you need to clean cache configs.
You need to Flush Magento Cache
System -> Cache Management ->  Flush Magento Cache

If you dont want those messages to show up in the admin :
You need to disable Magento_AdminNotification module .
Check this for more https://blog.landofcoder.com/disable-magento-2-admin-notification/
Comment: Every time we have to do this ? Is there any automation in that ?
Comment: updated my answer
Comment: I would advise against disabling admin notification as this will affect other modules to, instead look at removing the cacheOutdated message from the messagelist https://github.com/magento/magento2/blob/2.4-develop/app/code/Magento/AdminNotification/etc/adminhtml/di.xml#L13
Answer: Make sure whether you have nodejs
The following instructions may be helpful to you.
Global Installation: composer global require mage2tv/magento-cache-clean
PATH Setting:

Open terminal run

gedit ~/.bashrc

Add the following command at end of the line.  (this may differ in your system)

   export PATH="$PATH:$HOME/.config/composer/vendor/bin"

Save and close the file.
Answer: There is no problem to solve here. Magento will flush the caches according to its own logic, as long as cron jobs are correctly configured on the server.
If you must have changes reflected on the frontend immediately, you can flush the caches manually. However, frequent cache flushing defeats the entire purpose of the cache and reduces performance for front end users.


How to generate a certificate signature on the iPhone?

Question: If I had a private certificate file and a string on the iPhone, how do I use them to generate a signed string that can be verified by a server with the matching public key? What library should I use on the iPhone?
Answer: I would take a look at Certificate, Key, and Trust Services Reference on Apple's website. You can import the PKCS #12–formatted blob with SecPKCS12Import and sign the data with SecKeyRawSign.


Duplicate Corporate Sync Account "Null"

Question: My organization just switched to the Droid Razr Maxx, one of the phones is having an issue with adding a corporate sync email account.  Whenever we try to add the account it says that it can't add because of duplicate account "Null".  I don't see this "Null" account anywhere, so i can't seem to remove it.  I'm not really sure what we can do, besides doing a reset and would only do that as a last course of action.  We are running android version 4 and using office 365 exchange.
Answer: Try clearing Cache and Data for the following apps under Settings -> Apps -> All (tap on each app and then tap Clear data and Clear cache buttons where available):

Email
Exchange Services
Google Account Manager

This should clear all the accounts (including the GMail one), and should allow you to add the Corporate account.

Duplicate Corporate Sync Account "Null"


Eclipse Juno - unable to attach Android API documentation archive file

Question: I am trying to attach Android API documentation Archive file (docs-15_r02.zip) in my Eclipse Juno as shown in the snapshot below (using Project -> Properties):

The documentation page opens successfully form the archive file if I click Open in Browser.
When i click OK then following error is encountered:

Error occurred while associating the source. See error log for more
  details.

The archive documentation won't be attached, that is, documentation will be fetched from online source.
If I restart eclipse, following error message is displayed:

If i try to click, right click  or expand my eclipse project (java or android) following error message is displayed and I am not able to use the android projects. Now, I have to recreate eclipse workspace again to be able to use eclipse.

An Internal error occurred during: "Initializing Java Tooling".
  java.lang.NullPointerExcption

Note: I am using Android 4.0.3, API version 15. But, I am able to attach JAVA API documentation using similar technique. I tried this procedure many times cleaning my eclipse workspace but the same problem is replicated again and again.
Any help please?
Answer: Just go to the project in which u need this api... And copy the zip file into the Android Dependencies in project explorer. It may works...
Sorry if not.


Is there a way for a group of users to upload documents but don't download them?

Question: I would like to know if you know if there is a way for users to be able to upload documents to a certain folder but not read documents that other users upload.
For instance:
      I upload a spreadsheet into SharePoint and then you upload another spreadsheet but you cannot see mine and I cannot see yours. (it would have to be the same folder)
Answer: I presume you want something like this: Item level security settings for document libraries. But the answer isn't clear if it really works.
An other option is to write a event-receiver which updates the security on an item level as soon as it is uploaded.
Comment: Yes it works (it did in 2010), You can set Item-Level security in a Document Library with Powershell. The option is not available in the UI. I used this to distribute personal HR documents from an external system; PS script matched documents with AD accounts so everyone could only see their own reviews.
Answer: you have several option:
The easiest way is to use only the ui in SP 2013. But be aware, if users have the direct link they will still be able to see the items, hovever not by just clicking through the ui.
Following Steps:

Go to Site Settings and to Site Permissions under Users and Permissions
Create a new Permission Level and make sure that "Manage Lists"Personal Permissions" are not checked. Save it with a name
Go to the List and break the permission inheritance and add a Group which has this permission level.
Put user which should only see their documents in that group (make sure that those users are not in any group that has the previous permissions activated)
create a new view which filters the items by "created by" with the [ME] placeholder

with that users should only see their documents and are not able to crete a personal view which let them see their other documents.
Thex next option is using a list 2013 workflow. every time a list item is created and breaks the inheritance of that item and sets it's own (to be precise, it sets the permission to the user who uploaded the document and maybe the manager or a manager group). This is described also here:
Set list item permissions in Workflow 2013
And the last option i know is already mention by Dribbel


How to rough bath sink drain to maximize drawerspace

Question: I am roughing in the plumbing for a bathroom sink that I am going to build a vanity for. I'd like to have the drain only impact a top drawer and take up as little space as possible.  The drawer back will wrap around the plumbing. How close can the drain be to the bottom of the counter with a vessel sink?  In other words, how high can I rough in the drain? The supplies will be on either side and tight together. Thanks for any thoughts.
Comment: Faced with the same question (but for the aesthetics of a wall-hung sink), I just bought the sink and test-fit it. My initial plan was to put the trap behind the wall (there is access on the other side), but the trap arm actually sat higher and was less visually intrusive than a 90* elbow and straight pipe would have been.
Answer: Your vanity plan should have front side doors in line with where the sink is located. Then the drawers should be off to the left or right side where there is plenty of height and space toward the back to accommodate their placement.
There are multiple reasons to not put drawers in the vanity under the sink area:

People stand in front of the vanity at the sink. It is extremely inconvenient to have drawers opening out at knee height where the you want to stand.
You cannot place any sort of drawer directly in front of the sink and drain because there is just not enough depth from the front face of the vanity to accommodate the drawer. Any drawer placed below the bottom level of the sink would have cabinet face framing running across in front of the cabinet that would make it difficult to make access to the space under the sink.
Having drawers in the space under the sink will restrict access to the water shutoff valves keep it from being possible to quickly inspect the drain area in the case of suspected leaks.

So I really recommend that you not put drawers in this part of the vanity cabinet. You will find plenty of things to store in the area under the sink behind the doors.


Getting text box to stay put in CartoDB?

Question: I'm trying to label two areas of my map in CartoDB. The base map labels two of them already but there are two other regions that need to be labeled. Every time I put a text box over one of the regions, and then move around on the map, the text box moves too.
Comment: Can you explain the problem? The base map is your layer or a cartodb base layer? How are you putting text boxes? These text boxes are labels? Your layer is a polygon layer?
Answer: In the CartoDB editor if you "add element" -> "add annotation item" the result will move with the map (e.g. if you place it next to "city x", it will always be next to "city x" even when you pan and zoom the map).
If you "add element" -> "add text item" (or title) the result will be fixed relative to your screen (e.g. if you place it in the upper right corner of the screen it will always be in the upper right corner).


How to write data to HA Hadoop QJM using Apache FLUME?

Question: How flume will identify active namenode so that data will be written to HDFS? Without High Availability Hadoop we will have namenode ip configured in flume.conf so that the data will be easily directed to HDFS. Whereas in our case, Flume should identify active and standby namenodes and thereby data should be directed to active one.
Answer: AFAIK it is not possible in a direct way. The HDFS sink configuration has only room for one Namenode.
Nevertheless, I think you can configure two HDFS sinks (and two channels), each one pointing to a Namenode. The source will put a copy of each event in both channels due to the default Replicating Channel Selector. So, each sink will try to persist the data by itself; the one pointing to the standby Namenode will not persist anything until the active one falls down and the standby becomes active.
HTH!
Answer: With respect to Pilgrim's answer you can place only hdfs-site.xml config file to your flume classpath. Simply copy this file to $APACHE_FLUME_HOME/conf/ directory or add FLUME_CLASSPATH="/where/is/your/hdfs-site.xml" to flume-env.sh
You have to be sure about hadoop nameservice configuration is suitable for this.
Answer: This works for me(hadoop 2.7.1, flume 1.6.0):
Place hadoop  *-site.xml config files to you flume classpath
Not sure which of them works, I placed core-site, hdfs-site, yarn-site, mapred-site) but settings for cluster name are in core-site.xml


Does Reverse Gravity affect creatures with Flight?

Question: Say a wizard casts reverse gravity, if creatures with Flight are caught in the radius, are they affected by the pull?
Answer: To answer this question, in my opinion, you first need to establish the type of flight. Flight gained from "wings", flight gained through "magic", and finally, flight gained from "magic items"
Creatures with wings would be affected by Reverse Gravity, because they gain flight through pushing they wings against the pull of gravity. Reversing that pull would cause them to fall upwards in the same way as a creature without flight. The Dexterity Save would allow these creatures, rather than grab hold of something, to adjust their flight to the new gravitational pull. In other words, reverse themselves to fly upside-down.
However, creatures that use magic to fly, use forces to "defy" gravity, no matter if it is reversed or not. So they would be unaffected by Reverse Gravity.
And lastly, you have creatures that use magical items such as the "Broom of Flying", or a "Flying Carpet" to fly. The Reverse Gravity may not affect the item that is defying gravity, but it still affects the user of that item, because they essentially are now sitting on the wrong side of the item to be save from the gravitational pull. However, if a magic item were to give the user the ability to fly rather than fly upon, such as a "Potion of Flying", then they defy gravity rather than the item, and are thus unaffected by Reverse Gravity, just like the creatures who have their own means to defy gravity through magic.
This to me seems the most logical approach to ruling on the effects of Reverse Gravity on creatures with flight. However, in no means is this an official answer.
Answer: Yes.
Reverse Gravity states:

All creatures [...] that aren't somehow anchored to the ground in the area fall upward...

It says nothing about flying creatures being unaffected. Therefore they are affected.
Comment: @SirTechSpec -- it's a condition where the ocular and vestibular horizons disagree, which ties into some really nasty questions about "can D&D flying creatures fly stably while blinded or presented with a false horizon?"
Comment: Presumably, though, it would affect them a little *differently*, in that depending on the source of their flight and their maneuverability, they could mostly avoid the effects - a giant eagle would probably "fall", but magically flying creatures with sufficient control could probably hold steady, no?
Comment: I think that this answer requires a distinction between magical flying and non magical flying, and then the whole "innate" flying of a number of beings from other planes (is that magical or not?).  Our current world's laws of physics do not translate over one-for-one into the default DnD world (FR) so any answer would be better if it accounts for that.
Answer: Flying creatures will not fall
Creatures with flight are able to escape gavity's pull and stay aloft. If you flip the direction of gravity with reverse gravity, they will be affected by the spell but will still not fall. The spell says:

This spell reverses gravity in a 50-foot-radius, 100-foot high cylinder centered on a point within range. All creatures and objects that aren't somehow anchored to the ground in the area fall upward

The new gravity is not tougher than the old one, it's the same amount, just reversed. The affected creatures fall upward as a result. Here are the falling rules for flying creatures from the PHB, p. 191

If a flying creature is knocked prone, has its speed reduced to 0, or is otherwise deprived of the ability to move, the creature falls, unless it has the ability to hover or is being held aloft by magic, such as the fly spell.

Since the creatures are not knocked prone by the spell, their speed is not reduced to 0, and they are not deprived of their ability to move, none of the conditions that would make them fall apply, and they will not fall in reversed gravity.
Your DM might consider that they are surprised by the effect, and being unprepared for it, cannot adjust in time and "fall" for one round in case the are using natural means to fly and are not able to hover or held aloft by magic such as a fly spell. This however would be a ruling, over the rules as written.
Comment: Assuming that PHB, p. 191 list of things that can make creatures fall seems unwarranted to me. Nothing says that these are the *only* things that make a creatures fall, and by the *specific beats general*, if specific spell makes a creatures fall, it makes creatures fall.
Comment: @Mołot Thanks for explaining the downvote. I think the spell makes them fall due to reversing gravity and they have no problem to fly in gravity, so I'll stick to my guns here.


LEDs in series without resistor

Question: Say I have an ideal situation (good quality functioning power source and components) - 12V source and 3V (each) LEDs. Can I wire these 5 LEDs in series to the 12V source without a series resistor and expect that 4 of them would lit strong and one dim (or this one not lit at all), or all would light up dimmed ? Without burn, and etc as expected for an over voltage situation  - like wire 1 3v led to a 4V source  and etc.
Comment: Another reason it's a bad idea is that LED forward voltage will vary with temperature.  You might find that at your coldest temperature they'll be dim or off (even with 4 LEDs) and at the highest one they'll burn out.  And lighting LEDs burns power and as such dissipates heat, giving you a potential runaway situation.  A constant current supply is what you want here.  If you want one dimmer, put a parallel resistor across it.
Comment: 5 x 3 = 15. None would illuminate very well. Check the data sheet to see what the current might be if the voltage was 2.4 volts. Never not use a current limiting method.
Comment: You would want 4 x 3.0V LEDs for a 12.0V power supply, not 5 LEDs.
Comment: What  is the recommended current for each LED? and what level did U want?  Each white LED has a 3V Zener like quality factor
Answer: None of the above. If you wire LEDs in series, all of them will receive the same amount of current. They must, since current is number of electrons flowing through a wire per second, and the electrons must pass through all the LEDs in a series circuit.
If they all get the same amount of current, identical LEDs will all light with the same brightness. (If you have a mixture of different types of LEDs in a series circuit they will always still receive the same amount of current but that current might cause them to glow with different intensities.)
Comment: I did this recently. battery powered 30 led set was cut up to 20 instead. Power was by default 2x AA cells. A bit brighter but perversely the power seemed to drain faster , could be mistaken on that though. I have not been with basic electronics for years so guess they were taking too much. Point here I am is out of the four colours when the battery got weak you would lose blue first then amber follow by red and final green. I say "lose" as in not showing noticeable light output. Out of random I then tried a temp 6v supply, kept an eye on them but two burned quite quickly! A bad idea!
Answer: On the topic of powering LEDs with a constant voltage:
LEDs have a negative temperature coefficient.  This means that their resistance decreases as temperature increases.  Providing a constant voltage will cause an ever increasing current until an equilibrium is reached.  As a result, LEDs are recommended not to be used without some form of current control.  The purpose of a series resistor in a string of LEDs is to compensate for this property with a suitably large positive temperature coefficient from the resistor and provide a form of current control.
With an LED connected directly to a constant voltage, as current passes through the LED, the LED heats up.  This causes its resistance to decrease, resulting in a larger current flowing and more heating of the LED.  If current is not regulated, it will continue to increase until either the LED burns out or if the LED is adequately cooled, an equilibrium will be reached where the LED becomes hot enough that the heat conducted/radiated away from it(which increases as temperature increases) matches the heat produced by the current flow.  If the thermal path (heatsink and/or fan) from the LED to it's environment is good enough and the drive voltage low enough, the LED will not burn out, but if the LED should ever become separated from the thermal path, vibrated loose, become unglued, an air vent blocked, whatever, it will suffer thermal runaway and burn out.
With an LED connected to a voltage source in series to a sufficiently large resistor, such that the temperature coefficient of the resistor exceeds that of the LED, when the voltage is applied, the current will heat both the LED and resistor, and as the resistance of the LED decreases, the resistance of the resistor will increase, preventing increase in current and thermal runaway.  Using a resistor this way amounts to a very crude (inaccurate and power wasting) form of current control and protects the LEDs.  Power losses from this setup can be mitigated by using more than one LED in series with the resistor, but because there is a minimum resistance at which the resistor will have a sufficiently large positive thermal coefficient, there is a limit to how efficient this can be.
Resistors are typically used in low power applications, for example running a single 3.3V LED indicator light at 5mA off a 5v source.  At only 5mA, a resistor dropping 1.7V will only use 1.7V*.005A=.0085W or 8.5 mW of power.  Roughly 1/3 of total power is being wasted in heating the resistor, but total power is so small you may not care.  If you were running a power LED, say 500mA at 3.3V, the resistor dropping the same 1.7V will use 1.7V*.5A=0.85W, almost a full watt wasted in heating up a resistor just to provide current control.
To save the power being wasted in providing current control with a resistor, current controlled LED drivers exist that regulate applied voltage to provide a constant current regardless of LED temperature and changes in resistance.  A decent one of these drivers will be 80 to 95% efficient, saving you the bulk of the power a resistor would be wasting.
In conclusion, you must always run LEDs in such a way as to compensate for thermal runaway or they will burn out.
Adequately cooling the LED will work, but LEDs will burn out if the thermal path is ever disturbed or becomes inadequate.  You can't always control the factors involved(ambient temp, dust, blocking of an air vent, mechanical damage, etc.) so this method is usually considered inadequate.
Using a series resistance is low cost and inefficient, but will provide current control and prevent thermal runaway when cooling is inadequate and is typical for indicator lights and other low power LEDs.
Using a current controlled switching regulator to drive the LEDs costs a lot more than a resistor, but controls current and prevents thermal runaway with a smaller percentage of total power being wasted as heat.
One other notable advantage to using a resistor in series with an LED is that the resistor can function as a cheap fuse.  Sometimes if you take apart commercial LED products, you will find that the resistor wattage is chosen so that if current becomes too high the resistor will burn out and open the circuit before the LED is exposed to a damaging current.
In the example of the indicator light LED above, the resistance that would limit current to 5mA is 1.7V/0.005A=340\$\Omega\$.  If a 350\$\Omega\$, 0.01W resistor is used, a flow of more than
\$P=I^2R\$
\$I=\sqrt{(P/R)}\$
\$I=\sqrt{(0.01W/350\Omega)}=0.00534522A\$
about 5.35 mA will burn out the resistor and cut power to the LED.  If you applied an incorrect voltage(too high specifically), the resistor would burn out and the LED would stop working, but you would have a comparably easy repair, just replacing a tiny <1c resistor rather than having to identify, color match and bin and replace the LED.

LEDs in series without resistor


Change lead status to 'Closed - Converted' without creating an opportunity, account and contact

Question: I am manually creating opportunity from lead and changing lead status as 'Closed - Converted'. I can prevent opportunity creation using setDoNotCreateOpportunity(Boolean) method. but there is no method  available for account and contact. Is there any way to prevent creation of account and contact while converting lead?
Answer: Yes, on the conversion screen at the account interaction section make sure you're selecting 'Attach to existing' instead of 'Create new' in the dropdown. Then just use the magnifying glass to select which exact account you'd like to merge into. Then proceed and you'll be presented with a contact merge screen as well, so you won't have to create a duplicate contact. I hope this helps
Answer: Use Database.LeadConvert.setAccountId and Database.LeadConvert.setContactId to link to an existing Account and Contact. You must either link to an existing record, or create a new record. There is no option to simply set the Lead Status to a Converted value without either of these paths.


How to disable CUPS spooling and print directly?

Question: On my machine runs cups. I have setup a few printers which are provided by a printserver (VPSX). When I print a few jobs they are stored in the local (CUPS) printspooler and only one job is sent. The next one is sent not until the latter is finished. I want to achieve that they are all just sent to the printserver, which should take care of spooling. How can I achieve this?
Answer: You should be able to use the CUPS options waitjob and waitprinter, as I described in an answer to a similar question on Stackoverflow: https://stackoverflow.com/questions/27156489/cups-send-multiple-jobs-to-ipp-printer


Schmidt decomposition manages to write a pure state using just d terms

Question: Suppose $|\psi\rangle$ $\in \mathrm{H_A}\otimes\mathrm{H_B}$ is a pure state and we can write a representation of $|\psi\rangle$  like $|\psi\rangle = \sum_j |\alpha_j\rangle|\beta_j\rangle$, where $|\alpha_j\rangle$ and $|\beta_j\rangle$
are un-normalized states for systems A and B, respectively. How can I prove that the numbers of terms in such representation are greater or equal to the terms in a Schmidt decomposition? My attempt is to begin using the partial trace but I don´t get anything.
Answer: Start by writing your state $|\psi\rangle$ in terms of the Schmidt decomposition
$$
|\psi\rangle=\sum_i\sqrt{p_i}|u_i\rangle|v_i\rangle
$$
where $|u_i\rangle$ and $|v_i\rangle$ are orthonormal bases.
You want to evaluate the partial trace
$$
\text{Tr}_2|\psi\rangle\langle\psi|.
$$
Remember that when you take the trace, you can select any orthonormal basis that you want. It's particularly convenient to select $\{|v_i\rangle\}$ in this case,
$$
\text{Tr}_2|\psi\rangle\langle\psi|=\sum_i(I\otimes\langle v_i|)|\psi\rangle\langle\psi|(I\otimes |v_i\rangle)=\sum_ip_i|u_i\rangle\langle u_i|
$$
(I've deliberately skipped a step or 2 in that calculation, that you'd want to fill in for yourself.)
What does this tell you? The rank of the reduced density matrix is $d$, the number of non-zero Schmidt coefficients.
Now, assume you have a decomposition of $|\psi\rangle$ where the set $\{|\alpha_j\rangle\}$ comprising $d'<d$ elements. The reduced density matrix is
$$
\sum_j|\alpha_j\rangle\langle\alpha_k|\langle\beta_k|\beta_j\rangle.
$$
The dimension of this matrix cannot be larger that $d'$, and hence is not equal to $d$. Such a decomposition is impossible.
Comment: I don´t understand why this decomposition is impossible if d' is not equal to d
Comment: Take a special case, with $d=3$. Now imagine that $d'=2$ and that $|\alpha_1\rangle$ and $|\alpha_2\rangle$ are in the span of $|0\rangle$ and $|1\rangle$) (they must always be in some two-dimensional span). If you write out the partial trace, it *must* be a $2\times 2$ matrix because the only non-zero components are $|0\rangle\langle 0$, $|1\rangle\langle 0$, $|0\rangle\langle 1$ and $|1\rangle\langle 1$. It has rank at most 2. So it certainly doesn't have rank $d=3$.
Answer: The question is equivalent to asking why the rank of a matrix $A$ (i.e. the number of its nonzero singular values) equals the smallest number of terms in any decomposition of $A$ in unit rank factors.
To state this more precisely, observe that any matrix $A$ can be written as a sum of unit-rank terms. If $A$ is $n\times n$, then a trivial decomposition using $n^2$ terms is
$$A = \sum_{ij=1}^n A_{ij} |i\rangle\!\langle j|.$$
The SVD tells you you can also always write $A$ using only $\operatorname{rank}(A)\le n$ terms:
$$A = \sum_{k=1}^{\operatorname{rank}(A)} s_k |u_k\rangle\!\langle v_k|,\tag1$$
with $\mathbb{R}\ni s_k\ge0$ the singular values and $\{|u_k\rangle\},\{|v_k\rangle\}$ orthonormal systems.
Now the question is: suppose we have some decomposition of the form
$$A = \sum_{k=1}^m c_k |a_k\rangle\!\langle b_k|,\tag 2$$
for some $c_k\in\mathbb{C}$ and $|a_k\rangle,|b_k\rangle$. Can we conclude from this that $m\ge \operatorname{rank}(A)$?
To see that this is so, observe that (1) also implies that the support of $A$ (i.e. the orthogonal complement to its ker, i.e. the dimension of the space of vectors which are not sent to $0$ by $A$) has dimension $\operatorname{rank}(A)$. This is because its support is comprised of all and only the vectors writable as linear combinations of $|v_k\rangle$ with $k=1,...,\operatorname{rank}(A)$.
Now, suppose we have (2) with $m<\operatorname{rank}(A)$. This means that the support of $A$ is comprised of all and only the vectors in the span of $m$ vectors. This space is bound to have dimensional smaller than $\operatorname{rank}(A)$. Which means there are up to $\operatorname{rank}(A)$ orthogonal vectors not in the ker of $A$. But that's a contradiction, because from the SVD we now that there are $\operatorname{rank}(A)$ orthogonal vectors not in the ker of $A$.


Is it usable to start application with asking the user to turn Location services?

Question: I am designing an app for online grocery, the app asks the user to choose the city and the region these data will be used to filter the markets and for the delivery address.
In the case the delivery service is not supported yet in his city or region, he is asked to vote for his region to support delivery there.
Is it usable to make sure that the user votes for his region is to ask him to turn on the GPS ? Because I do not want him to vote for other regions.
In the case yes, what will happen if the user refuses to turn the GPS?
Comment: Bear in mind that a phone or sim enabled table often knows it's location thanks to the data/cellular signal. Not as accurate as GPS, but often more than accurate enough, so it's not necessarily the end of the world if they don't turn on their GPS.

Make sure you take that possibility into account when designing your user journey.
Comment: @Nathanael and that can be turned off as well.
Answer: If you can, let the user know why you're going to ask for permissions before asking. "Sharing your location will help you [better accomplish a goal]. Please accept on the next screen." Or similar. Then they are not surprised by the request and understand how it will benefit them and their use of the app.
In the case mentioned above, I would not see a strong enough use case to accept sharing my location with the app. I might also note that not everyone is in their home location all the time or may want to vote for the location they feel useful for someone else - "my mother would like this.. I'll vote for her location" or they may  be traveling and want to vote for a location they are not in currently.
Comment: A big +1 for manual location -- the supermarket delivery apps here all let you set your password, for example, similarly I might want my pizza delivered to my home and not the train (at least until delivery drones are available).
Answer: It is fine to prompt them to switch on GPS, but it should be easy (i.e. you prompt them, they click "Ok" and then it is switched on for them. It isn't so nice if they have to leave the application and navigate through their settings to switch it on before returning to the application.
If the above is easy, you could order the actions this way to ensure accurate voting:

Prompt user to turn on location services
If they don't, prompt user to manually select their city / region
If service not available in that region, allow voting for selected / detected region.
Comment: It can be a little "intimidating" for a user if the first thing he sees of your app is a permission prompt to grab your data. If it's possible, it would be better to let him use your app as far as it goes without the permission and only then ask for it.
Comment: @Big_Chair Good point, though for the app in question location is needed before we know if the service is even available, so you couldn't get far without it. To make it less intimidating, it might help to put a little explanation of why the service needs your location, and let them choose automatic or manual configuration of location on the same screen.
Answer: Most of the time it's not a good idea to do this as user gets annoyed but you can keep some things in mind to handle it better.
Use whatever suits you best from below...

If the App is available only in couple of cities or a few cities, considered just showing this info and asking the user to vote for his city.
If all you need is just the City where the user is at then, you don't necessarily  need to turn location services on. The same can be achieved by Wifi or GSM info
Don't take the user to another screen to turn on the services but ask in the app and do it for him if s/he accepts. Most Cab/taxi apps do the same (Surprisingly Uber, in my country, takes me to settings and I have to turn on manually)
Consider the need: When the app relies heavily/continuously on GPS for its main functionality, GPS need to be turned on everytime but if not consider other options as well. User's won't mind if you ask them to turn on GPS for tracking service but ask the same in a news app, things will not be same.
If the app gives slightly better results/experience with GPS than without GPS, mention this within app at the right place and ask users to turn on GPS subtly at the right time.


Magento 2.3.4 order and comment email stops working after upgrading from PHP 7.1 to 7.2

Question: I'm having an issue when upgrading my PHP version to 7.2 to get ready for a system upgrade to Magento 2.4 and the backend email system stops working.  I don't receive new order emails and can't send out comment emails to customers.  Any ideas?
Answer: If you are using any SMTP Module such as Mageplaza SMTP for the Emails then update those modules with the new one, because they having some updated files for the Magento 2.4 Version.
Mageplaza SMTP:
https://github.com/mageplaza/magento-2-smtp
Also the Mageplaza Core:
https://github.com/mageplaza/module-core
If it works then do share an update.
Thanks!
Sid


Create anchor links in Evernote

Question: In Google Docs, you can insert a bookmark in the middle of the document and link to it. I don't think you can do this with Evernote. Am I wrong? I have some saved articles, and I want to be able to link to an exact paragraph of the article. Is there a way to do that?
Comment: If you've found the answer, please add it as an answer; don't add it to the question. Also, questions asking for app or tool recommendations are off-topic here. You'll want to try [softwarerecs.se].
Answer: Anchor links have not been implemented officially by Evernote yet.
A work around is :

Create a sub-note for each of the paragraphs you want to (anchor) link to.

Create a Note Link ( Hyper link) to each of these SubNotes.

In the original note, you can create a Table of Contents at the top with the note links ( hyperlinks ) to all of your sub-notes.

From the other notes, you can either directly link to the sub notes you created , or refer to the index number in the Table of Contents at the top of your main note and link to it.

Not as neat as true HTML-like anchor links, but works decently well.

Create anchor links in Evernote


Novel about humans on a frozen planet

Question: I'm trying to remember the title of a science fiction novel I read years ago about a frozen planet onto which some Earth explorers crash land. The natives don't smile except as an act of aggression(?) and the humans and aliens build a large ice ship with which to explore the planet. There was also a sequel to it, in which they explored even farther afield on the planet.
Comment: Welcome to Science Fiction & Fantasy! This question would be improved by going through the checklists here ; [How to ask a good story-ID question?](https://scifi.meta.stackexchange.com/questions/9335/how-to-ask-a-good-story-id-question)
Comment: @Alice: There is now an answer. If you think it is the correct one, you can accept it by clicking on the checkmark by the voting buttons.
Comment: Were the natives descended from a bird-like species?
Answer: This sounds a lot like Alan Dean Foster's Icerigger.
A ship is crashed on Tran-Ky-Ky and Ethan Fortune and Skua September lead the humans to a base using an iceraft.  The sequels are Mission to Moulokin and The Deluge Drivers.
The point is made explicitly that the native Tran do not show their teeth when smiling.
Comment: I concurr.  I re-read these books recently.  Everything matches the question here, apart from the "exporers crash landing" part, it was a couple of criminals, the people they kidnap, and acouple of  innocent parties who ejected from a larger ship and crash landed their escape pod.  But yes, this is the answer.
Comment: That's it!!!! Thank you so much for the answer! I didn't even know there were 2 sequels.

Novel about humans on a frozen planet


How to navigate to Salesforce Account record on clicking the Google Map marker

Question: I am displaying all account record close to my current location on Google Maps. I need to navigate a user to the particular account record in Salesforce once he chooses a marker on the map and clicks on it. Any ideas how to achieve this?
Thanks
Roger
Answer: Welcome to SF.SE Roger. Have you looked at any of the Docs related to the use of mobile cards in SF1? Obviously, you'll need to build on the Google API that's used in the examples provided in the Force.com Workbook and in the Salesforce1 Mobile App Developer Guide.
I would recommend taking the target location and passing it to the user's mobile device's Navigation App rather than creating your own navigation page results taken from the User's location. Otherwise, you'll need to call up Google Map directions from a Flex Page by sending the User's location along with the destination the User has selected, and use the Google API to return directions to the destination based on the User's GPS current location. You'll need to create a mobile app of some kind to do that.
BTW, to help with what you want to accomplish, there's a free app on the app exchange called Address Geolocator 1.0 which allows locating the address of selected entity records on a Google map.


What compound could life use to get sulfur from to use as an oxidant?

Question: I'm working on a planet which has a biosphere that breathes sulfur as an oxidant. What is the most efficient gaseous (By "gaseous" I mean gaseous at the temperature of my planet, which is on average 26°C) sulfur-based compound to use to get sulfur from to use as an oxidant? I've considered disulfur, but that stuff is unstable, and likely wouldn't stay in the atmosphere for very long. It also has to be common enough (or easy enough to produce) that it makes up ~30% of an atmosphere that has ~1.5 times the pressure that earth has at sea level on a planet which has a gravity of ~1.3g. The sulfur compound should take minimal amounts of energy to break the sulfur out of, or be able to be used as an oxidant.

I don't have a lot of knowledge in chemistry, so let me know if I contradicted myself or if there's something that doesn't make sense. Also, I am aware that this seems similar to this post but that was asking about more exotic life, I'm asking about carbon-based life that uses water and similar proteins and nutrients to Earth life.

I'm fine with a "no" as then I can just use oxygen, which would be a bit boring, but I could do some other things to spice it up!
Answer: Sadly, there is no compound which matches these criteria. The only sulphur molecule simple and stable enough to be plausible in an atmosphere and gaseous at roughly Earth temperatures is H2S, hydrogen sulfide. It is not an oxidising agent, rather it is a good reducing agent eg. fuel.
It is however quite compatible with carbon based life, playing a crucial part in the metabolism of many bacteria. For some photosynthetic bacteria, it plays a role analogous to CO2 for plants, and others produce it from elemental sulphur when decomposing organic matter. This makes its inclusion in a potential alien biosphere not just possible but a bit uncreative, as it is a molecule which is proven to work well in that role.
Some resources on this:
https://sci-hub.se/10.1016/j.tim.2006.09.001
Answer: Sulfur dioxide
This isn't a wonderful candidate (it's normally a weak reducing agent), but it's at least possible.
It's stable and can be reduced to S (0) or H2S (i.e. S (-2)) biologically.
I believe people have speculated that this is occurring on Venus.
For anyone wondering, while SO3/H2SO4 can't be an oxidising agent, it's so thermodynamically and kinetically stable that it's just not doing much at all. SO2 is more feasible.


Why are second order linear PDEs classified as either elliptic, hyperbolic or parabolic?

Question: Is there a geometric interpretation of second order linear partial differential equations which explains why they are classified as either elliptic, hyperbolic or parabolic, or is this just a naming convention? That is, do they have any relation with actual ellipses, hyperbolas and parabolas?
Comment: Feels related to my own question on [the term "elliptic"](http://math.stackexchange.com/q/1548001/35416), currently without an answer. I realize that I failed to mention PDEs in that list, and probably forgot some other uses as well.
Answer: Yes, there is. In elliptic case, we have that $A:=(a_{ij})$, the matrix corresponding to second derivatives, is positive definite. Psitive definiteness implies that $$v^t.A.v$$ is positive for all $v\neq 0$ and zero for $v=0$. If one draws all the $v$'s which satisfy $ v^t.A.v =c$ for a constant $c$, it will be an oval-like shape, an ellipsis (in n-dimension of course.) So, the term elliptic.
Case of parabolic: The are defined as having their "symbol" of the form $\frac{d}{dx_n}-\{an \ elliptic \ part\}$. In view of above, think of the elliptic part as ($x_1^2+x_2^2+x_3^2+...+x_{n-1}^2$). The general case will be same but with positive weights behind each squared term. Anyway, what will shapes defined as
$$x_n-(x_1^2+x_2^2+x_3^2+...+x_{n-1}^2)=c,$$ $ c$  a constant look like? A parabola.
The hyperbolic case: The symbol is of the form
$$\frac{d^2}{dx_n^2}-\{an\  elliptic \ part\}$$
Solutions to
$$x_n^2-(x_1^2+x_2^2+x_3^2+...+x_{n-1}^2)=c,$$ are hyperbolas.
BUT, they don't classify them simply because of this. They do, because all elliptic operators share many qualitative behavior. All parabolic ones, although similar to elliptic, have some other common features. And finally, the hyperbolic ones are totally different in behavior. It is interesting that changing a + in an elliptic to a - (making it hyperbolic) does such a drastic change to the PDE.
BUT, again! Many important PDE's do not fall within any class, in fact. However, understanding the basic cases is always the first step in math. That is why people spent so much time investigating these cases in a kind of isolated fashion.
Comment: I have no idea except that I know in differential geometry hyperbolic means negative curvature. I don't know if from this we get a hyperbolic PDE, but I think not.
Comment: Interesting, thank you! Just out of curiosity, do hyperbolic PDEs have anything to do with hyperbolic geometry? (I'm wondering about this because, in physics, some hyperbolic PDEs, like the electromagnetic wave equation, are invariant under Lorentz transformations, which are geometrically hyperbolic rotations of the 4-dimensional Minkowski space. Is this just coincidence?)


How to electrically shift the phase of a signal?

Question: Let's say I have a sine wave and I would like to shift it by varying degrees, like 90, 180, and 270. How would I do this?
Comment: you delay it by 0.25, 0.5, 0.75 of a cycle. there are various ways to delay a signal, including: 1) pure digital, A/D + memory + D/A, 2) pure analog, e.g. all pass filter or wide band filter, 3) discrete (continuous in value but discrete in time), "bucket brigade device", 4) physical: electrical or acoustic delay lines, etc....
Comment: opamps can do this quite easily using inverted input.
Comment: If the frequency is fixed, and the wavelength is not too long, you can use delay lines.
Answer: An op amp integrator will give 90 degree phase shift. Integrate again for 180 etc.
If you want, say, unity gain and you know the frequency, \$\omega\$, then choose \$\small RC =\large \frac{1}{\omega}\$
Comment: A simple analog inverter will deliver a 180 ° phase shift, just an amplifier with v=-1.
Comment: @Uwe, but it won't do 90, 270, etc
Answer: It depends - on the frequency, the bandwidth you need to operate over, whether you want a phase shift or a time shift (different when a wider band is involved), whether you are generating the signal yourself, and quite a few other things.
A classic way is to build a low pass filter including varactor diodes, and vary the voltage on them.
Another is to use a quadrature hybrid, with a pair of varactor diodes as the loads.
Another is to put the signal into a pair of SSB mixers, and change the local oscillator phases.
Another is to digitise and regenerate the signal with an ADC and DAC pair, with delay or more complex DSP processing in between.
And quite a few more, tapped delay lines, all-pass networks ...
These will have different domains of applicability, and different strong and weak points. Pick your operating situation, and pick your method accordingly.
Answer: if it's a pure sine wave, then an easy digital way is to multiply the signal by:
$$ e^{i\phi}$$
to achieve the desired phase shift. This can be done without the need of huge banks of memory. But as a consequence you need a fairly fast processor to do this in real time (frequency dependant of course).


If a man divorces his wife, does his daughter become halal for him to marry?

Question: If a man has a daughter with a woman and then many years later, he divorces the woman, does his daughter become halal for him to marry?
Comment: No she doesn't, the daughter remains his daughter even though he divorced the mother. Mahrams established by blood relations do not ever become non-mahrams.
Answer: It's forbidden; the Qur'an is clear on this:

Prohibited to you [for marriage] are ... your daughters ... and your step-daughters under your guardianship [born] of your wives unto whom you have gone in. -- Qur'an 4:23

She remains his daughter after divorce, and the father retains his rights and responsibilities as a father ("at all times, the father of the child is responsible for maintaining the child" -- Mufti Muhammad ibn Adam).
The Qur'an even goes further to forbid marrying step-daughters (see above).
Comment: and what if the man divorces the mother of the step-daughter? she is no longer his step-daughter
Comment: @JimKite A step daughter remains a permanent mahram, unless the divorce was given before the marriage was consummated.  From 4:23 "... and your step-daughters under your guardianship [born] of your wives unto whom you have gone in. But if you have not gone in unto them, there is no sin upon you."