Legacy BIOS bootloader to bootstrap real-mode code in second stage

Question: I am working on writing my own operating system. So far, my code exceeds 512 bytes, which is too large to fit in a simple boot sector.
I understand that I now have to write a bootloader that reads arbitrary code that may or may not be greater than a single 512-byte sector.
The bootloader would need to:

Function as a boot record with disk signature 0xaa55.
Read a second stage (the test code) start from LBA 1 (LBA 0 is boot sector) of arbitrary length starting at memory address 0x7E00.
Transfer control to it using a FAR JMP to 0x0000:0x7E00.
Be usable as a 1.44 MiB floppy disk image for use in emulators like QEMU, BOCHS, VirtualBox etc.
Can be transferred and used on a USB stick to test on real hardware with the BIOS set to boot USB using Floppy Disk Drive (FDD) emulation. Note: Some bootloaders do not work well when placed on USB drives.
Pass the boot drive to the second stage in DL.
Zero out all the segment registers and set SS:SP to 0x0000:0x7C00 (grows down from just under the bootloader).

This would also serve as a good starting point for asking questions on Stack Overflow that involve OS development. Programmers often struggle to create a Minimal, Complete, and Verifiable Example. A common boilerplate/template would allow other Stack Overflow users wishing to help to test the code with a limited amount of fuss.
How would I go about building such a reusable bootloader?
Comment: **Note:** [This question is being discussed on Meta](https://meta.stackoverflow.com/questions/380680/question-and-self-answers-not-canonical-that-start-with-an-off-topic-question). If you have an objection to its format, or suggestions on how to improve, please weigh in there. Limit discussion here to technical matters and clarifications about the question itself.
Comment: For an alternate implementation I've done something similar. Though it was done
a while back as I was learning different parts of x86. https://github.com/sherrellbc/realmode-loader
Answer: I have written such code as part of other answers but never had an opportunity to present a simple test harness that could be referenced from other Stackoverflow questions. What you are asking for is rather trivial. One can do this by writing a bootloader in NASM that includes a binary image of the assembled code you wish to test. This image would be read from disk starting at LBA 1 (first sector after the bootloader) using BIOS function Int 13/ah=2. Control would then be transferred to it via a FAR JMP to 0x0000:0x7e00.
The bootloader code would look like this:
bpb.inc:
global bpb_disk_info

    jmp short boot_continue
    nop

bpb_disk_info:

    ; Dos 4.0 EBPB 1.44MB floppy
    OEMname:           db    "mkfs.fat"  ; mkfs.fat is what OEMname mkdosfs uses
    bytesPerSector:    dw    512
    sectPerCluster:    db    1
    reservedSectors:   dw    1
    numFAT:            db    2
    numRootDirEntries: dw    224
    numSectors:        dw    2880
    mediaType:         db    0xf0
    numFATsectors:     dw    9
    sectorsPerTrack:   dw    18
    numHeads:          dw    2
    numHiddenSectors:  dd    0
    numSectorsHuge:    dd    0
    driveNum:          db    0
    reserved:          db    0
    signature:         db    0x29
    volumeID:          dd    0x2d7e5a1a
    volumeLabel:       db    "NO NAME    "
    fileSysType:       db    "FAT12   "

boot.asm:
STAGE2_ABS_ADDR  equ 0x07e00
STAGE2_RUN_SEG   equ 0x0000
STAGE2_RUN_OFS   equ STAGE2_ABS_ADDR
                                ; Run stage2 with segment of 0x0000 and offset of 0x7e00

STAGE2_LOAD_SEG  equ STAGE2_ABS_ADDR>>4
                                ; Segment to start reading Stage2 into
                                ;     right after bootloader

STAGE2_LBA_START equ 1          ; Logical Block Address(LBA) Stage2 starts on
                                ;     LBA 1 = sector after boot sector
STAGE2_LBA_END   equ STAGE2_LBA_START + NUM_STAGE2_SECTORS
                                ; Logical Block Address(LBA) Stage2 ends at
DISK_RETRIES     equ 3          ; Number of times to retry on disk error

bits 16
ORG 0x7c00

; Include a BPB (1.44MB floppy with FAT12) to be more compatible with USB floppy media
%ifdef WITH_BPB
%include "bpb.inc"
%endif

boot_continue:
    xor ax, ax                  ; DS=SS=0 for stage2 loading
    mov ds, ax
    mov ss, ax                  ; Stack at 0x0000:0x7c00
    mov sp, 0x7c00
    cld                         ; Set string instructions to use forward movement

    ; Read Stage2 1 sector at a time until stage2 is completely loaded
load_stage2:
    mov [bootDevice], dl        ; Save boot drive
    mov di, STAGE2_LOAD_SEG     ; DI = Current segment to read into
    mov si, STAGE2_LBA_START    ; SI = LBA that stage2 starts at
    jmp .chk_for_last_lba       ; Check to see if we are last sector in stage2

.read_sector_loop:
    mov bp, DISK_RETRIES        ; Set disk retry count

    call lba_to_chs             ; Convert current LBA to CHS
    mov es, di                  ; Set ES to current segment number to read into
    xor bx, bx                  ; Offset zero in segment

.retry:
    mov ax, 0x0201              ; Call function 0x02 of int 13h (read sectors)
                                ;     AL = 1 = Sectors to read
    int 0x13                    ; BIOS Disk interrupt call
    jc .disk_error              ; If CF set then disk error

.success:
    add di, 512>>4              ; Advance to next 512 byte segment (0x20*16=512)
    inc si                      ; Next LBA

.chk_for_last_lba:
    cmp si, STAGE2_LBA_END      ; Have we reached the last stage2 sector?
    jl .read_sector_loop        ;     If we haven't then read next sector

.stage2_loaded:
    mov ax, STAGE2_RUN_SEG      ; Set up the segments appropriate for Stage2 to run
    mov ds, ax
    mov es, ax

    ; FAR JMP to the Stage2 entry point at physical address 0x07e00
    xor ax, ax                  ; ES=FS=GS=0 (DS zeroed earlier)
    mov es, ax

    ; SS:SP is already at 0x0000:0x7c00, keep it that way
    ; DL still contains the boot drive number
    ; Far jump to second stage at 0x0000:0x7e00
    jmp STAGE2_RUN_SEG:STAGE2_RUN_OFS

.disk_error:
    xor ah, ah                  ; Int13h/AH=0 is drive reset
    int 0x13
    dec bp                      ; Decrease retry count
    jge .retry                  ; If retry count not exceeded then try again

error_end:
    ; Unrecoverable error; print drive error; enter infinite loop
    mov si, diskErrorMsg        ; Display disk error message
    call print_string
    cli
.error_loop:
    hlt
    jmp .error_loop

; Function: print_string
;           Display a string to the console on display page 0
;
; Inputs:   SI = Offset of address to print
; Clobbers: AX, BX, SI

print_string:
    mov ah, 0x0e                ; BIOS tty Print
    xor bx, bx                  ; Set display page to 0 (BL)
    jmp .getch
.repeat:
    int 0x10                    ; print character
.getch:
    lodsb                       ; Get character from string
    test al,al                  ; Have we reached end of string?
    jnz .repeat                 ;     if not process next character
.end:
    ret

;    Function: lba_to_chs
; Description: Translate Logical block address to CHS (Cylinder, Head, Sector).
;
;   Resources: http://www.ctyme.com/intr/rb-0607.htm
;              https://en.wikipedia.org/wiki/Logical_block_addressing#CHS_conversion
;              https://stackoverflow.com/q/45434899/3857942
;              Sector    = (LBA mod SPT) + 1
;              Head      = (LBA / SPT) mod HEADS
;              Cylinder  = (LBA / SPT) / HEADS
;
;      Inputs: SI = LBA
;     Outputs: DL = Boot Drive Number
;              DH = Head
;              CH = Cylinder (lower 8 bits of 10-bit cylinder)
;              CL = Sector/Cylinder
;                   Upper 2 bits of 10-bit Cylinders in upper 2 bits of CL
;                   Sector in lower 6 bits of CL
;
;       Notes: Output registers match expectation of Int 13h/AH=2 inputs
;
lba_to_chs:
    push ax                    ; Preserve AX
    mov ax, si                 ; Copy LBA to AX
    xor dx, dx                 ; Upper 16-bit of 32-bit value set to 0 for DIV
    div word [sectorsPerTrack] ; 32-bit by 16-bit DIV : LBA / SPT
    mov cl, dl                 ; CL = S = LBA mod SPT
    inc cl                     ; CL = S = (LBA mod SPT) + 1
    xor dx, dx                 ; Upper 16-bit of 32-bit value set to 0 for DIV
    div word [numHeads]        ; 32-bit by 16-bit DIV : (LBA / SPT) / HEADS
    mov dh, dl                 ; DH = H = (LBA / SPT) mod HEADS
    mov dl, [bootDevice]       ; boot device, not necessary to set but convenient
    mov ch, al                 ; CH = C(lower 8 bits) = (LBA / SPT) / HEADS
    shl ah, 6                  ; Store upper 2 bits of 10-bit Cylinder into
    or  cl, ah                 ;     upper 2 bits of Sector (CL)
    pop ax                     ; Restore scratch registers
    ret

; If not using a BPB (via bpb.inc) provide default Heads and SPT values
%ifndef WITH_BPB
numHeads:        dw 2          ; 1.44MB Floppy has 2 heads & 18 sector per track
sectorsPerTrack: dw 18
%endif

bootDevice:      db 0x00
diskErrorMsg:    db "Unrecoverable disk error!", 0

; Pad boot sector to 510 bytes and add 2 byte boot signature for 512 total bytes
TIMES 510-($-$$) db  0
dw 0xaa55

; Beginning of stage2. This is at 0x7E00 and will allow your stage2 to be 32.5KiB
; before running into problems. DL will be set to the drive number originally
; passed to us by the BIOS.

NUM_STAGE2_SECTORS equ (stage2_end-stage2_start+511) / 512
                                ; Number of 512 byte sectors stage2 uses.

stage2_start:
    ; Insert stage2 binary here. It is done this way since we
    ; can determine the size(and number of sectors) to load since
    ;     Size = stage2_end-stage2_start
    incbin "stage2.bin"

; End of stage2. Make sure this label is LAST in this file!
stage2_end:

; Fill out this file to produce a 1.44MB floppy image
TIMES 1024*1440-($-$$) db 0x00

To use this you would first generate a binary file called stage2.bin. After stage2.bin has been built you can build a 1.44MiB disk image without a BIOS Parameter Block (BPB) with this command:
nasm -f bin boot.asm -o disk.img

To build a 1.44MiB disk image with a BPB you can build it with this command:
nasm -DWITH_BPB -f bin boot.asm -o disk.img

The code in stage2.bin would have to be generated with the assumption that the ORG (origin point) is 0x07e00 in memory.

Sample Usage/Example
An example of code generated to a file called stage2.bin that can be loaded with this test harness:
testcode.asm:
ORG 0x7e00

start:
    mov si, testCodeStr
    call print_string

    cli
.end_loop:
    hlt
    jmp .end_loop

testCodeStr: db "Test harness loaded and is executing code in stage2!", 0

; Function: print_string
;           Display a string to the console on display page 0
;
; Inputs:   SI = Offset of address to print
; Clobbers: AX, BX, SI

print_string:
    mov ah, 0x0e                ; BIOS tty Print
    xor bx, bx                  ; Set display page to 0 (BL)
    jmp .getch
.repeat:
    int 0x10                    ; print character
.getch:
    lodsb                       ; Get character from string
    test al,al                  ; Have we reached end of string?
    jnz .repeat                 ;     if not process next character
.end:
    ret

Note: there is an ORG 0x7e00 at the top. This is important. To assemble this file into stage2.bin use:
nasm -f bin testcode.asm -o stage2.bin

Then create the 1.44MiB disk image with:
nasm -f bin boot.asm -o disk.img

The result should be a disk image exactly 1.44MiB in size, contains a copy of stage2.bin and has our test harness boot sector.
The file stage2.bin can be anything that has binary code written to be loaded and started at 0x0000:0x7e00. The language (C, assembly etc) used to create the code in stage2.bin doesn't matter. I use NASM for this example. When this test code is executed in QEMU using qemu-system-i386 -fda disk.img it would look similar to this:

Special Note: : Using -DWITH_BPB to enable a BPB is useful if you are booting from USB using FDD emulation. Some BIOSes that boot USB as a floppy will assume a BPB is is present and overwrite the area with drive geometry before transferring control to it at  physical address 0x07c00.
Comment: @Bogatyr : a side effect of updating the SS segment register is that the CPU turns off interrupts until after the instruction following the SS update. On a single core this has the effect of making the update of SS and SP atomic. This only works if the update to SS is immediately proceeded by the SP update. The only known situation this would fail is on a defective 8088 processor from the 1970s and 1980s (see https://www.pcjs.org/documents/manuals/intel/8086/)
Comment: @Bogatyr After SS:SP have been updated the stack grows down from 0x0000:0x7c00. When you do a push (manually or by an interrupt) the SP register is decremented first before data is placed on the stack. The stack doesn't grow up to clobber any data at addresses 0x7c00 or above.
Comment: You beat me to it.    I remembered that stack grows down just now and ran to delete my newbie comment, but you've answered (thanks!) so I'll leave it.   Yes I knew about the 1-instruction interrupts delay, but I was speaking to the stack growing into the code, which it obviously doesn't :).
Comment: I've seen the "mov sp, 0x7c00" in other bootloaders, in fact on some random USB flash drive I inspected.  At first it looks very clever, but are there any robustness issues with this?  In particular, what if an interrupt comes in one or two cycles after sp is updated?  Won't the push all of the interrupt handling trash the load_stage2 code?  Or if in the worst case we get a couple nested interrupts?    Would cli help here?   Why economize on RAM this way that leaves a window open for a race condition?  Or are there guarantees about no interrupts at this stage?  Inquiring minds want to know!
Answer: I modified my own boot sector loader to add a new protocol. It makes it set es = ds = ss = 0 and load the whole load file to address 07E00h, jumping to that at 0000h:7E00h. However, sp is left pointing somewhat below 7C00h.
And there's the big difference to the requirements in the question: This loader uses the (FAT12 or FAT16) filesystem to load the next stage. It loads from a file named KERNEL7E.BIN if found. The file name, like the entire load protocol, can be adjusted by editing the source file or passing defines on the NASM command line.
A limitation due to the code size is that only single-character error messages are output when an error occurs: R means disk Read error, M means the file to be loaded is too large (out of Memory). Another limitation is that the RPL (Remote Program Loader) protocol isn't used as it needs some more bytes.
To lessen the space pressure, the loader can be built with -D_CHS=0 -D_QUERY_GEOMETRY=0 (if to load via ROM-BIOS's LBA interface) or -D_LBA=0 (if to load via CHS interface).
To build the loader, clone the lmacros and ldosboot repositories, and put them next to each other. The loader is to be built from the ldosboot directory with NASM this way for FAT12:
$ nasm -I ../lmacros/ boot.asm -l boot7e12.lst -D_MAP=boot7e12.map -o boot7e12.bin -D_COMPAT_KERNEL7E

Or this way for FAT16:
$ nasm -I ../lmacros/ boot.asm -l boot7e16.lst -D_MAP=boot7e16.map -o boot7e16.bin -D_FAT16 -D_COMPAT_KERNEL7E

Here's how to install the loader into an existing already-formatted FAT12 or FAT16 file system image:
dd if=boot7e12.bin of=floppy.img bs=1 count=11 conv=notrunc
dd if=boot7e12.bin of=floppy.img bs=1 count=$((512 - 0x3e)) seek=$((0x3e)) skip=$((0x3e)) conv=notrunc

Instead of using an existing image, an entire image can be created by NASM. I wrote such a program at https://hg.ulukai.org/ecm/bootimg  It builds like this:
nasm -I ../lmacros/ -D_BOOTFILE="'../ldosboot/boot12.bin'" -D_MULTIPAYLOADFILE="'../ldebug/bin/ldebug.com','../ldebug/bin/lddebug.com'" bootimg.asm -o bootimg.img
Note how the long def has double quotes around single-quoted list entries. Each list entry is stripped to the basename (after the last slash or backslash), has its content added to the data area, and has a directory entry added to the root directory. Filenames are ASCII and in allcaps.
The ldosboot repo contains a two-sector FAT32 loader too, but I didn't modify it to support this protocol yet. With relocation, the FAT buffer should be at the top of memory already. That means the file can be loaded to 07E00h. However, ss will be at a high segment instead of zero. Other than that difference, the protocol can be specified with switches. The command to build this is nasm -I ../lmacros/ boot32.asm -l boot7e32.lst -D_MAP=boot7e32.map -o boot7e32.bin -D_RELOCATE -D_MEMORY_CONTINUE=0 -D_ZERO_DS -D_ZERO_ES -D_SET_BL_UNIT=0 -D_SET_DL_UNIT=1 -D_LOAD_ADR=07E00h -D_EXEC_SEG_ADJ=-7E0h -D_EXEC_OFS=7E00h -D_OEM_NAME="'KERNEL7E'" -D_LOAD_NAME="'KERNEL7E'" -D_LOAD_EXT="'BIN'"
There's also the instsect program (in its own repo) for DOS, which is built with loader images and installs them to a DOS drive.
Comment: I'm the upvote. I probably should add to my question the reasons why I had a specification that didn't involve using a file system. On Stackoverflow we get questions that span OSes (especially Windows and Linux). The spec was designed in such a way that simply having NASM could produce a floppy image that was usable without requiring more tools (to mount and unmount images - much more involved on Windows). Much easier in userspace on Linux with `mtools`. I'm actually partial to directing people to Alexey Frunze's (another SO user) BOOTPROG as well: https://github.com/alexfru/BootProg
Comment: I only briefly summed it up as _common boilerplate/template would allow other Stack Overflow users wishing to help to test the code with **a limited amount of fuss**._ at the bottom of my question. The target wasn't really for OS design but a method to help people potentially create better [mcve] when presenting their code on this site as many people doing OSDev neglect to show us their bootloaders.
Comment: @Michael Petch: I did actually work with alexfru's loader implementation too when I started developing the ldosboot collection. However, I eventually decided to use Chris Giese's. As for your requirements, I understand that the formatting and accessing of an image isn't always easy. Still I want to advertise my loader as an alternative. Thanks for the upvote!
Comment: Understood, there was nothing wrong with your answer which was why I was more than happy to upvote. I too have bootloaders that will read Fat12 etc. My first bootloader was in the late 1980s (I was doing work with Wendin DOS) and back then besides asking for help on places like Compuserv there wasn't a plethora of example bootloaders to draw inspiration from except to disassemble DOS ones.
Comment: @Michael Petch: I added a program (script ish) that uses NASM to build a file system image. I added the description to my answer. It lacks sophistication, but is certainly a sufficient alternative to your solution for anyone wanting to use only NASM.


Calling numerous Android loopj AsyncHttpClient HEAD requests, just a random number of them is being executed

Question: As the title says, I'm having a strange issue with loopj's AsyncHttpClient.
MyObject is a class that contains a link and a value and lista is a List containing 50 MyObject objects.
I need to retrieve header information from 50 links, so I've made a cycle like this:
<code>private static AsyncHttpClient client;

public MyClass(){
    client = new AsyncHttpClient();
    client.setURLEncodingEnabled(true);
}

....

public void foo(List<MyObject> lista){
    for (final MyObject c : lista) {

        client.head(c.getLink(), new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(int statusCode, org.apache.http.Header[] headers, byte[] responseBody) {

                Log.d("DBG", "retrieving informations");
                int contentlength = Integer.parseInt(headers[3].getValue());
                c.setValue(contentLength);

                Log.d("DBG", "retrivied");

                setView(lista);

            }

            @Override
            public void onFailure(int statusCode, Header[] headers, byte[] responseBody, Throwable error) {
                Log.d("DBG", "retrieving informations failed");
                Log.d("DBG", error.toString());
            }
        });
    }
}
</code>
At this point, if I try to exec the app and look at CatLog, I can see that just about 20 or 30 out of 50 request are executed, while the others do not give any feedback (i.e. no timeout exception, no "retrieving informations" debug message nor any other type of message).
If I try to exec again the app, just about 7 or 8 requests will be executed.
If I try to change anything in the code (for example adding a comment) and run it again, it even fails to install on the emulator with the following error:
<code>[2014-03-05 02:46:28 - Myapp] Failed to install MyApp.apk on device 'emulator-5554!
[2014-03-05 02:46:28 - MyApp] (null)
[2014-03-05 02:46:28 - MyApp] Launch canceled!
</code>
Having said that removing the aforementioned piece of code everything else works well, I hope someone could help me to solve it.
Any help would be apprecied.
Really thank you in advance!
Answer: I have face the same issue. It seems you are using loopj's version 1.4.4. They have this as a known issue in there 1.4.4 version on github. To resolve it you will have to take pull from latest master from : https://github.com/loopj/android-async-http.
Once you will pull the latest code, then compile it and generate jar file. Then use this jar instead of v1.4.4 jar. Unfortunately, they have not deployed latest jar with this fix as of now in there releases.
I figured out this issue after lots of research. You can check it on these urls :
    https://github.com/loopj/android-async-http/issues/455
https://github.com/loopj/android-async-http/issues/453
https://github.com/loopj/android-async-http/issues/397
https://github.com/loopj/android-async-http/issues/398
https://github.com/loopj/android-async-http/pull/425
https://github.com/loopj/android-async-http/commit/5ee354db6706562849710b6fcd9b8ec91a3916fd
Hope this will help you. If this answers your question or resolves your issue, please +1 this :)


Normalize histogram with different bin width?

Question: I know how to normalize histogram (so that the area =1) with the same bin width, but how to do it when the histogram has different bin width? Any idea?
Answer: The principle of a histogram is that for bins that touch (i.e. no overlaps or gaps), bar height should be proportional to bin frequency/bin width. If bin width is constant, then it can be left out of the calculation.
It's conventional to present histograms as showing frequencies, percents, or proportions, and that's all possible and legitimate with constant bin width.
With varying bin width, however, the choices include (a) probability density (b) frequency density (c) frequencies scaled to some standard bin width (really (b) with possibly differing magnitudes).
The principles transcend software choice, but more discussion, and some references, can be found in this Stata FAQ.
If you have varying bin widths, that has no impact on the principle that the total area of the bars represents total frequency or total probability of 1. If you draw the individual bars correctly, that will be satisfied.
Comment: +1 These principles are illustrated in some posts on our site that use histograms.  For instance, they show up in the generalization to 2D histograms I discuss at http://stats.stackexchange.com/a/24590.
Comment: @whuber Quite so, and thanks. For "area" read "volume" for the 2D case. In principle, a histogram could be defined for more dimensions, but I am having problems showing one within this comment box.


Melted electrical outlet

Question: I have an electrical outlet in my home that got hot and melted. My son shut main breaker off and took outlet out of wall and he separated the wires and wrapped electrical tape around the wires. Is this safe until I can hire an electrician?
Comment: I doubt the electrician will find anything wrong with the wiring. You removed the problem part already. If the wiring was bad, the outlet wouldn't get hot, the wiring would. Your problem was a poor connection between a high-draw appliance and the outlet. An empty outlet can't overheat; if the wiring to the outlet shorted, the breaker would trip before it melted. Could be backstabs slipping loose or just a dirty or partially-inserted plug. Replace the outlet and all should be fine, a quick and simple $1 DIY fix. Maybe drop $4 on the outlet and get a commercial-grade one this time.
Comment: I notice you don't mention ever turning the main breaker back on. Probably you did that and didn't mention it, but just in case: if you turn off the breaker for the circuit with this receptacle as the answers now posted suggest then you can turn the main breaker back on to have power to everything else while you wait for an electrician.
Answer: It is safe, as long as there is a cover (or the old outlet) covering the wires (even though they are taped up).  I personally hate tape and would use a connector block to isolate the different wires.  Then tape it up if you want.
You should find the breaker responsible for it and only switch that off.  And put tape across it so, that its is difficult to flick on.  Perhaps even put a note on it.
Answer: It's safe - as long as you only have adults in your household, that can be told not to touch the wires. If you have a youngster, it's dangerous as it allows tool-free access to live wires...
A better solution would be to find the breaker for that outlet and turn that one off.

Melted electrical outlet


where the STP works in Switches?

Question: I know how the Spanning tree protocol works ,but where its works whether in trunk port Scenario or access port?
 If works in trunk port how STP behave,then also how its behave in access port.
Answer: Trunk port is Cisco terminology and Cisco is one of the few vendors implementing Per VLAN Spanning Tree + (PVST+) which is the equivalent to 802.1D but with one spanning tree instance per VLAN. There is also Rapid Per VLAN Spanning Tree + (RPVST+) which is the equivalent of 802.1w but per VLAN. The plus means that STP is running over 802.1Q trunks as opposed to ISL.
On an access port, only one VLAN is allowed, hence only one instance of spanning tree will be running on the port and the Bridge Protocol Data Units (BPDUs) will be sent untagged. Normally access ports will connect to end devices and the port would be configured as an edge port to bypass listening and learning state and to not generate any Topology Change Notification (TCN) on link up/down. You could run an access port between switches as well but that is generally a waste because you will want to have several VLANs between the switches. So far everything is the same but Cisco runs PVST+/RPVST+ and other vendors run STP/RSTP.
On a trunk port (Cisco terminology) several VLANs will generally be allowed to traverse the trunk. On Cisco devices, every VLAN will in its own instance and different VLANs can be forwarding on blocking on the same physical port. On other vendors there will only be one instance running, even though several VLANs are traversing the trunk. This means that all VLANs most follow the same topology. It's not possible to any form of load sharing/traffic engineering.
Cisco devices will allow a different number of instances depending on what platform it is. Some will allow 32 instances, some 64 and some 128 and so on.
There is also the option of running Multiple Spanning Treee (MST) which does not do per VLAN Spanning Tree. Instead it groups VLANs together into instances which is more effective.
The advantage of PVST+/RPVST+ is that you can send VLANs on different paths and do traffic engineering. Also a change in one VLAN will not affect the others. The drawback is that it's less scalable if you have a lot of VLANs.
The reverse is true for STP/RSTP, it scales better but it does not offer load sharing and changes sourcing from one VLAN can affect the others.
Comment: It works exactly the same. STP does not behave differently on access or trunk ports. If you give me a scenario you are thinking of I could explain it better to you.
Comment: I Accept this but my confusion is how the STP blocking method(redundancy) works in access port.
Comment: i.e(1) if i have a pc that connected to single switch with two cat 5(2)switch1(1,2port)<-->switch2&switch3 with access mode,& switch 2 connected to 2pc's,and switch-3 connected to some pc's. it's not a real time scenario.in that how the stp works also explain the vlan behavior.

where the STP works in Switches?


I have Ubuntu 14.10 and it doesnt recognize my network controller

Question: I am brand new to Ubuntu and trying to learn as i go with this stuff. I can get online via ethernet but i can't figure out how to get wifi working. My network controller is the qualcomm atheros 003e(rev 20). I have also gotten 168c:003e. Under system settings/ network all i see is wired connection and network proxy. From the research i have done it seems that alot of people are having this issue but i cant seem to find a solution. Sorry for the lack of information but i don't have any idea what i am doing yet. Thank you in advance for the help.
Comment: possible duplicate of [Ubuntu 14.04 Wireless not working: no network interface](http://askubuntu.com/questions/661424/ubuntu-14-04-wireless-not-working-no-network-interface)
Comment: That's what I thought. Thank you for your time.
Comment: @Jeremy31: Could you please convert that to an answer so that schmucks like me who go around hunting for unanswered questions don't have to look at this one any more.  ;-)  (And I'll upvote if you drop me a note and it's a good one too!)
Answer: This device will see minimal support- basically be able to connect to unsecured networks  in kernel 4.0, I would suggest finding a different wifi card for now. I believe the card is the QCA6174 and the developers for ath10k are working on it but it might take some time for it to be fully supported
I think this is what made it into kernel 4.0 http://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/commit/drivers/net/wireless/ath/ath10k?id=d63955b33b3bee45d784ffdfafeb93076c765660 and you can watch the log in linux-next for new news
http://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/log/drivers/net/wireless/ath/ath10k
Comment: @Fabby Thanks, it is too bad these cards still aren't supported 100% in the newest kernels.  Some have got them to work according to this [bug report](https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1383184)
Comment: Going through my "schmucks" answers that didn't get any upvotes...  So finally you got one!  ;-)


What is this on sourdough starter?

Question: I have a sourdough starter which I feed roughly once every 2-3 days (throw away 95% of it, refill with water and flour).  Sometimes I forget and wait 5 days between feedings, and by that time it often has developed what looks to me like mold on the top.  It looks super interesting and I'd really like to know what it is.  A picture is below.  It's grown like this a few times, and the starter keeps rising and producing good bread, so it's definitely still alive and well.
Comment: @Rob No, the starter is about two inches deep, and that's certainly not flour
Comment: All I see is a coating of flour on top of partly dried starter in a nearly empty bowl.
Comment: I see the mold, and the safety-conscious thing to do is to recommend you stop using it. It's unlikely anyone outside of a lab can identify what type it is, though, so I doubt you'll get any other answers here. You might consider any moldy cheeses or other mold-produced foods as potential sources for contamination, otherwise this isn't a mold-friendly site lol.
Answer: That is Kahm yeast. Not harmful but can leave a bad taste in bread made with it. Remove 20g from the bottom and continue from there. Possibly from contaminated flour.
Comment: Yes, that is definitely it!!  Looks exactly like the pictures I find online of Kahm yeast.
Answer: I don't see anything that has grown there, except for the starter itself. The starter used to be more expanded, its skin dried up in the expanded state, then it fell back down and the skin tore in places and wrinkled up - this is what you are probably picturing as a growth. It also trapped some gas bubbles (the round warts). There also seems to be a layer of hooch formed under the skin. Where the skin is torn, a single untrapped bubble is also visible at roughly (45°, 0.2r).
If you had actually had a mold growing, I would have advised against baking with the starter, because it is unsafe, even if the bread rises.
Comment: If you zoom in, those lumps of "flour" have a definite fluff of white mold on them, which is slightly gray on the center. That grey and red discoloration is a bad sign as well..... Mine will oxidize to that grey color if I don't clean the container and it dries onto the side, but the fresh stuff never turned red in the middle...
Comment: The starter rises on day 1, falls on day 2-3, and this white layer only appears on day 5.  It's definitely not some "skin" which existed during the "rising and falling" stage.

What is this on sourdough starter?


Available Objects for Apex Sharing

Question: I was using Apex Sharing and it was working fine, but then I noticed that for some objects when I use CustomObject__Share it says 'Entity is not org-accessible'. I tried to google it, but wasn't able to find any info on why I can't access Apex Sharing Objects.
Answer: You can't share any objects where the Org-Wide Sharing Default for it is Public Read/Write. Similar to how you can't set the sharing default to that level if you already use Apex sharing.
From Set Your Organization-Wide Sharing Defaults:

The organization-wide default settings can't be changed from private to public for a custom object if Apex code uses the sharing entries associated with that object. For example, if Apex code retrieves the users and groups who have sharing access on a custom object Invoice__c (represented as Invoice__share in the code), you can't change the object's organization-wide sharing setting from private to public.
Comment: Thanks, my bad. Haven't thought that if Sharing Settings set to Public Read/Write it will result as an error. Thanks for help

Available Objects for Apex Sharing


I can't install Ubuntu 14.04.1 LTS alongside windows 7 system restarts

Question: I can't install Ubuntu 14.04.1 LTS because system restarts as I choose to install alongside windows 7 and press continue till then everything goes fine. I tried many times but I didn't get success. Please help as soon as possible.
Comment: What if you choose **Something Else** and select the partition manually?
Comment: @g_p what if it wipe out everything ?
Comment: It won't. Select the partition in which you want to install, format it if needed and install in it.
Comment: I dont have any  partition which I can format but I have space in where I want to install it best case would be installing it alongside windows 7 and if i try it says `no root file system is defined please correct this from the partitioning menu`
Answer: Do the following:
1-In windows 7 free up some space for Ubuntu. Keep at least 30 GB. Keep this space unallocated. Don't make it into a separate partition. You can create a separate partition using Disk Management utility of windows.
2-Now try installing but instead of choosing Install alongside Windows 7 choose Something Else
3-In there you locate the unallocated space, select it, and press the + button.
4-In the drop down list you will find option Swap Area or something like that, choose it, and make the size near about the size of your RAM, and click OK.
5-If you have a GPT disk you will have to create boot area. Not sure create anyway. It does no harm. For creating boot area select the remaining unallocated space,click +, choose Ext4 and choose the mount point as /boot. Give 1 GB max to /boot.
6-Now create the main root area. Select the remaining unallocated space, select '+', Choose Ext4, take the max size available, aand choose mount point as /.
7-Click next or continue. It might show a warning message or something. Click OK.
HOPE THIS HELPS.
Comment: Well, why alongside wont work ? Why it just keep restarting whenever you choose Install Alongside windows 7


Do miners check whether a transaction is segwit or non-segwit?

Question: When a transaction is pushed directly to a miner does it check whether the transaction is segwit or not, or only if it is valid?
Answer: The miner only determines if it is valid. Miners do not, in a sense, "discriminate" between Segwit or Legacy.
Comment: I think legacy miner(pre-segwit) needs to distinguish between anyone-can-spend transactions and legacy transactions for the simple reason that they can't validate segwit transactions.
Comment: @sanket1729 No, by definition they can't, as they don't even know about the existance of segwit. All they see is a weird but valid output that anyone can spend. They're not aware of the new rules that do not make them so trivial.
Comment: @PieterWuille, should there not be any policy in the legacy miners to not include transactions which contain anyone can spend outputs since they cannot risk creating an invalid block?
Comment: @sanket1729 Sure, there is; in the case of BIP141, that policy rule is the CLEANSTACK rule (which requires the final state of the stack after scriptPubKey execution to contain a single non-zero element): BIP141 scriptPubKeys push **two** elements for exactly that reason. But I still wouldn't quite call that discriminating between segwit and non-segwit, only discriminating based on an old policy rule, which segwit helpfully is designed to trigger.


Why does a hollow conductor does not have a electric field inside it when it is enclosing a charge?

Question: When a positive charge is enclosed in a thick hollow sphere which is a conductor, the inner surface gains a negative charge distribution and due to that the outer gains a positive charge distribution. So there should be electric fields through the walls of the sphere. But it is not possible because the potential difference in a conductor must be zero, the conductor should be a  equipotential surface. Please clear this doubt.
Comment: Are you familiar with the Gauss' Law?
Answer:
Why does a hollow conductor does not have a electric field inside it when it is enclosing a charge?

You can take this as a given in electrostatics.
You can also take this fact as derivable from your statement that "the potential difference in a conductor must be zero." The potential difference divided by the distance difference is the negative of the field value (E=-$d\phi/dx$). But negative zero is zero, so the field is zero.
If you want a further reason, you can consider what would happen if there were a free charge inside the conductor. If there were some free charge, that charge would be acted on by the field and would feel a force and would move (e.g., to the surface of the conductor). But now we have a moving charge, which means we are in the realm of electrodynamics not electrostatics. This latter comment is not really a reason, just kind of pointing out that to be internally consistent we can't have free charge moving around and still say we are doing electrostatics.

So there should be electric fields through the walls of the sphere.

No, you can think of the field "inside the walls" as coming from the "+q" in your picture and all the little "-" signs in your picture. These two fields exactly cancel each other inside the walls of the conductor.
Comment: but then what about the fields due to the positive charge of the outer surface?
Comment: They create a field outside the walls (all the way outside of the shell) that is not cancelled by the other two fields.
Answer: Within the conductor, there are two electric fields that cancell out. The one due to the charge enclosed by the spherical shell and the one due to the  charge seperation on the surfaces of the metal. These two oppose each othervand hence the net electric field is zero
Answer: The sphere is not positively charged. If the negative charges induced by positive ones, the sphere is neutral. Anyway, if there is an electric field inside the conductor there must occur an electric current that is absent in this case.


Can 'endear' be used for inanimate objects?

Question: Can "endear" be used for a country or some other inanimate object? For example is 'I have come to endear my country.' correct?
Comment: Following @user405662, another possiblity would be "my country has endeared itself to me". It's not clear from your question whose affections are being increased.
Comment: _endear my country_ to what? _endear myself to my country_ is perhaps what you are looking for.
Comment: I was going to add that. Thank you, @user888379.
Comment: To endear is either intransitive or reflexive.
Answer: The use of endear is particular, as you can see from dictionaries available online. It means

cause to be loved or liked.
Example: Flora's spirit and character endeared her to everyone who met her.

Collins agrees:

If something endears you to someone or if you endear yourself to them, you become popular with them and well liked by them.

I would rather say

I have come to cherish my country.


Cannot see graphs for IO Service time and IOstat in munin

Question: For some reason data & graphs for IO Service time and IOstat do not show up in munin. All other graphs are fine.
Can some one suggest me how to set munin to show the stats and graphs for these. Am I missing any packages?
Comment: Problem solved? If so, how did you solve it?
Comment: The issue is with the plugin. I did not see any values for those two plugins when I ran those at the terminal. Is there any other option to get those working other than reinstalling munin?
Answer: I ran into the same problem (on an EC2 instance running Ubuntu Lucid Lynx) and figured out the solution via a comment at the top of the plugin code.
Basically the plugin by default skips all hard drives which have a number in them. To avoid this you need to add the following lines to the plugin config file (/etc/munin/plugin-conf.d/munin-node for me - I needed to edit it as root):
[iostat]
env.SHOW_NUMBERED 1

Then restart munin:
sudo restart munin-node

Of course you also need to have made sure you have iostat available on your system (running iostat at the commandline should tell you). If not then it's pretty easy to install (on Ubuntu):
sudo apt-get install sysstat

Answer: I ran into this problem as well.  It is actually an issue with iostat not returning information about the state of the devices in the system.  If you run iostat from the command line, you should see something like this:
# iostat config
Linux 2.6.18-194.11.4.el5 (hostname.tld)    08/10/2011

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           0.06    0.04    0.05    0.05    0.00   99.81

Device:            tps   Blk_read/s   Blk_wrtn/s   Blk_read   Blk_wrtn

I was able to get the devices to show up by restarting my system.
Device:            tps   Blk_read/s   Blk_wrtn/s   Blk_read   Blk_wrtn
sda1             73.53      2532.05       142.72     255762      14416
sda2              0.29         8.08         0.00        816          0

Answer: You may need to install the sysstat package first.
On Ubuntu run sudo apt-get install sysstat
Then run iostat to check that stats are available.
Answer: do you get values by running the plugins in the terminal?

it's often: /etc/munin/plugins/plugin_here

If you do, continue and connect locally to port 4949 and try to fetch the plugins data

nc 127.0.0.1 4949

  fetch plugin_here

If the first step does not work, it's usually because of syntax errors, or it was written for another platform or so.
If the second step fails, it's often because of that munin runs as specific user (munin), and some plugins need uid 0 privileges so edit /etc/munin/plugins.d/munin.conf (or is it munin-node.conf?), and enter for example:

[munin]
  user=root

If all that works, go to the munin-graph.log (and munin-fetch.log) of the munin server to see what actually happens. tcpdumping can also tell you alot.


When it is said that air moves from warm object to a cold object, how is it possible that air moves from high pressure area to low pressure area?

Question: By air moving from high pressure area to low pressure area means that it's moving from colder area to a warmer area,  are they both not contradictory? I might have understood something in a wrong way, pls help.
Answer: You are correct that air generally moves along the surface from high pressure towards low pressure (not directly, but deflected due to the coriolis effect).
However, this does not imply that it is moving from a colder area to a warmer area. And, there is nothing contradictory in a cool air mass moving horizontally to displace a warm air mass.
Extratropical cyclones (a kind of low pressure system found in mid latitudes) are actually related to the movement of a cold front and a warm front, as part of a frontal wave. They drive cold and warm air masses to move.
Your claim that "air moves from warm object to a cold object" might be the root of your misunderstanding. That claim isn't true. It is true that heat will move from a warmer object to a cooler object through conduction and radiation. But that is not related to whether the air itself will move. A local effect called a "sea breeze" demonstrates the opposite scenario. A hot beach creates a warm, rising column of air (and a local area of low pressure), bringing in cooler air from the ocean to replace it.
You have conflated the transfer of heat with the movement of air and air masses.
Comment: In case of objects with different temperatures, the heat moves from hot body to cold body,  to maintain equilibrium.
Comment: I know that the air moves from high pressure to low pressure, but want to know how and why its movement
is contradictory to the movement of air from hot body to cold body.
Comment: Understood after reading -https://www.lordgrey.org.uk/~f014/usefulresources/aric/Resources/Teaching_Packs/Key_Stage_4/Weather_Climate/03.html
Comment: @user3747888 air does not move from hot to cold. Heat does move like that, but not air.


Encryption while logged in

Question: If I'm using full disk encryption on my home computer, and it's online, are the hard drive contents encrypted when I'm logged in and using the machine (from the perspective of an online attacker - no physical access - would only see encrypted data)?  Similarly, what about when the machine is locked?
Comment: As far as linux concerned the attacker will see the contents that belong to the user he hacked
Answer: In the perspecive of online-attacker, then FDE is nothing. FDE is designed to protect against a offline attacker who copies your drive or steals your computer. Once the FDE is "unlocked", it will be accessible, regardless of if the computer OS is locked (Win+L) or whatever. The only thing that can protect against online attacker is good security in the form of firewalls, IPS and anti-virus software.
The only way you can "lock" a FDE is to shut down the computer fully. Even Bitlocker wont "lock" when your inside Windows, only bitlocker does, is to ensure the boot path is uncompromised Before allowing decryption (secure boot + TPM), thus preventing circumventing the windows login process. If there security holes allowing online access to your data while your computer is logged off or locked, then your'e busted anyways.
Also encryption of indivual files is a good protection, provided you dont get a keylogger. Then you are smoked anyways. The most secure way you can protect a file against online-access, is to store it on a USB memory that is normally NOT connected to computer. Of course, you need to check everytime your computer is NOT compromised Before connecting this USB-drive. For the paranoid, I would suggest booting in a known secure OS, for example a OS that is placed inside a USB memory with a physical read-only button, or a live-CD. You dont need to encrypt the file if your threat scenario does not include offline attackers.
Answer: To decrypt your data the person would need to compromise your system. If the person who compromised your system managed to run a keylogger or another program with admin rights on your system he could preform a memory(ram) dump and extract encryption keys from your computer. Keylogging your system or preforming a memory dump would lead to decryption of your data.
Answer: In principle (whether you are encrypting the disks with LUKS or whatever), once you type in your passphrase the disks are decrypted and your security will no only depend on the security of your network.
Comment: Did you mean "LUKS"?

Encryption while logged in


How does the JVM use the "Main method" to start a Java program?

Question: main is not a keyword in java.  How does the JVM know to execute the main method as the starting point of any program?
Comment: Note that it isn't a keyword in C/C++ and C# either. Guess it's just a tradition.
Answer: main doesn't need to be a keyword in java in order for the JVM to look for it at the start of execution. There is no conflict with other methods or variables also called main. This is simply how the JVM spec was designed. It was most likely borrowed from the c language.
Java Specification References: keywords, invoking main.
Comment: +1 Note that it is not only the method name that matters, it also needs to be `static` (maybe `void`, too) and take a `String[]` as its only arguments.
Comment: Also Nothing prevents you of having multiple Main in the same project it all depends on how you launch your project
Comment: @Thilo: Correct. The method signature must be `public static void main(String[] args)` in order to be called at startup.
Comment: Back in the old Mac OS 7 (or 8?) days, where there was no command line, the Mac JVM would also allow a main without args. Thankfully, this has been unified now (does not work anymore).
Answer: It's just specified in the JLS.

12 Execution
...
A Java virtual machine starts up by loading a specified class and then invoking the method main in this specified class. Section §12.1  outlines the loading, linking, and initialization steps involved in executing main, as an introduction to the concepts in this chapter. Further sections specify the details of loading (§12.2), linking (§12.3), and initialization (§12.4).
...
12.1 Virtual Machine Start-Up
A Java virtual machine starts execution by invoking the method main of some specified class, passing it a single argument, which is an array of strings. In the examples in this specification, this first class is typically called Test.
...
12.1.4 Invoke Test.main
Finally, after completion of the initialization for class Test (during which other consequential loading, linking, and initializing may have occurred), the method main of Test is invoked.
The method main must be declared public, static, and void. It must accept a single argument that is an array of strings.
Comment: All of your links are broken now.
Answer: It invokes this method by using reflection. You could take a look into Java Web Start sources for example
Comment: When running jar file you specifying class name with main method, or, you could specify main class in within manifest in jar. In Java Web Start you specifying main class in jnlp file.
Comment: It invokes this method by using reflection. So this mean at run time it search for the class which has main method. is it right?
Answer: Basically every language was more or less similar to its predecessor. In C language it is the main() that executes at first but its not mandatory to happen all the time. Programs without main method can also be executed. So, Its just the convention by which the main method gets called at first.
please check:
Entry point for Java applications: main(), init(), or run()?
C program without a main function?
Answer: Main is basically a universal indicator of the central method so Java automatically makes it the central method when provided with public static
public static void main

Comment: I'm not sure what you mean... but to me it does not seem to answer the question.


How do I transfer pictures from OneDrive to my laptop?

Question: How do I transfer my pics from one drive into my laptop? I tried downloading but it didn't work and there are too many to do one at a time.
Comment: I'm voting to close this question as off-topic because this question has nothing to do with Windows phones.
Answer: You can do two things:
You can download the photos using the OneDrive client. Depending on what OS you have installed you just need to set it up (Windows 8, 10) as it's pre-installed. For Windows 7 or other systems go here.
You can also download all pictures through the browser as a single zip-file. Go into the folder you'd like to get and click the "download" link in the top bar.
Answer: If you are on a machine running Windows, the good thing is you have OneDrive preinstalled, and all you need to do is sign in with your Microsoft Account, and the photos will be downloaded onto your machine.
If you already have Windows running on this laptop you want your pictures on, and have already signed in with your Microsoft account, navigate to your user account's root directory, (C:\User\your_username), and you will find a folder named Onedrive:

In that folder, all the stuff that is on your OneDrive account will be syncronized into this folder. Everything thats on the cloud is downloaded automatically into this folder, so your photos will be in there as well.
Navigate to a folder named "Pictures", in the Onedrive directory. Under there, you will find all your photos from the cloud in there.
However, If you are using any alternative operating system, you have to visit onedrive.live.com, right click onto a folder that contains the photos you want, and click download, and the contents will be zipped and downloaded as just one compressed file, which you can then extract all the contents after the download has finished:


Is there a better way to jumper 3 terminals together?

Question: I can't find terminal block jumpers for sets of 3 and 5 terminals, just 10 and 2. So I took some 2-terminal jumpers and tried to accomplish what I needed to do but it looks unsightly and seems likely to fail due to the torque induced on adjacent blocks. Is there a better way to gang three and five terminal blocks together? See picture below:
Comment: There should be a tool for these kind of terminal blocks which helps you to clip a whole row onto the rail nicely. Check the manufacturer's catalogue.
Comment: Wago 222 series connectors.
Answer: I always use DIN-Rail terminal blocks that have a bussing feature across the top so that I don't have to double up on the wire entry connections.  Different manufacturers have both pluggable and screw down bussing arrangements.  As an  alternative to what you show in your photo, you can buy a comb bussbar that joins more than two at a time.  Buy a 10-position bussbar and then cut to length for less than 10.
Comment: would you mind recommending one with a bussing feature? still having trouble finding an actual match to the terminal blocks I have
Comment: Most major terminal mfrs. make these: Phoenix (ex: UK5, UT4), AB (ex:1492), Wago, etc.  If your business purchases enough of these you probably have a distributor saleperson visiting now and then...hit her up for specifics.  Otherwise check out online sources such as Allied, Mouser, DigiKey, AutomationDirect...


USB Camera with Rasperry Pi: Sending raw data from dev/video0 to PC through tcp/udp

Question: I want to send the raw USB data to my laptop to process it and then send it back (image processing). Is there any way I can just send the data through tcp/udp without raspi doing all the hard work?
Answer: You can't just issue a simple read() on /dev/video*. You have two options:

Use OpenCV to open the camera, something like this:
// includes, setup code, etc.
Mat frame;
VideoCapture cam(1);
for (;;) {
  cam1.grab();
  cam1.retrieve(frame);
  if (frame.empty() {
    continue;
  }
  // Serialize frame and send it over a network connection.
}

Use the usbip package to relay the raw usb data over to your other machine; this assumes that his other machine can also run the corresponding side of the usbip driver. This package is seriously buggy, I have never had good luck with it.

How you send data back to the Pi is up to you, of course!
Comment: I've tried installing OpenCV but it fails on RasPi(Something to do with ARM vs x86 architecture) . All the solutions are related to compiling OpenCV on the pi. Is there any other way?
Comment: I've used OpenCV on the Pi in the distant past. Why is compiling it a problem?


How can I see what command was actually run in the shell, through an alias or function

Question: I have a bash function (or alias), for instance function install() {sudo apt-get install $@}. When running the command install dicelab, what I expect will actually be run is sudo apt-get install dicelab. Where can I see what was actually run by the shell? I would like to make sure that my more complicated aliases are working as expected.
Comment: @AlonAviv, Good. :) Still, best get in the habit of quoting that `"$@"`, arguments with whitespace or glob characters will burn otherwise.
Comment: Is that `$@` part of your alias? Remember that aliases don't really support arguments, that will expand to the positional parameters (if any) of the context calling the alias. The usual way of running `somealias some args` works just by expanding the alias and leaving the arguments to follow it. If you actually want to be able to access the arguments, use a function, and quote the `"$@"`
Comment: My bad, I meant a bash function. I'll change it.
Answer: Use set -x in the shell.
$ alias hello='echo hello world!'
$ hello
hello world!

$ set -x
$ hello
+ echo hello world!
hello world!

Using set -x turns on the xtrace shell option (set +x turns it off) and should work in all Bourne-like shells, like bash, dash ksh93, pdksh and zsh.  This prompts the shell to display the command that gets executed after alias expansions and variable expansions etc. has been performed.
The output will be on the standard error stream of the shell (just like the ordinary prompt) so it will not interfere with redirections of standard output, and it will be preceded by a prompt as defined by the PS4 shell variable (often +␣ by default).
Example with a few functions:
$ world () { echo "world"; }
$ hello () { echo "hello"; }
$ helloworld () { printf '%s %s!\n' "$(hello)" "$(world)"; }

$ helloworld
hello world!

$ set -x
$ helloworld
+ helloworld
++ hello
++ echo hello
++ world
++ echo world
+ printf '%s %s!\n' hello world
hello world!

With your specific example (with syntax corrected and added quotes):
$ install () { sudo apt-get install "$@"; }
$ set -x
$ install dicelab
+ install dicelab
+ sudo apt-get install dicelab
bash: sudo: command not found

(I don't use or have sudo on my system, so that error is expected.)
Note that there is a common utility already called install, so naming your function something else (aptin?) may be needed if you at some point want to use that utility.

Note that the trace output is debugging output. It is a representation of what the shell is doing while executing your command. The output that you see on the screen may not be suitable for shell input.
Also note that I was using bash above. Other shells may have another default trace prompt (zsh incorporates the string zsh and the current command's history number, for example) or may not "stack" the prompts up like bash does for nested calls.

I'm running I used to run with set -x in all my interactive shells by default. It's nice to see what actually got executed... but I've noticed that programmable tab completion etc. may cause unwanted trace output in some shells, and some shells are a bit verbose in their default trace output (e.g. zsh).
Answer: You could use shell-expand-line, which is bound to
Control-Alt-e by default:
$ bind -p | grep shell-expand-line
"\e\C-e": shell-expand-line

Among other things, it will replace aliases in the current line with their definition so you can see a command you're still going to run. Example:
$ install dicelab # now press C-Alt-e
$ sudo apt-get install  dicelab # the above line will be replaced with this

Comment: this is a nice feature. do you know if zsh has an equivalent command to `shell-expand-line`?
Comment: Sorry, I don't because I don't use `zsh`. But some people have come up with their own ideas: https://wiki.math.cmu.edu/iki/wiki/tips/20140625-zsh-expand-alias.html
Comment: @the_velour_fog, see [Resolve all aliases in a zsh command line](//unix.stackexchange.com/a/150737)
Answer: Use builtin command type to see an alias or a function definition you are about to run
This solution doesn't require running the command
$ type ls
ls is aliased to `ls --color=auto -p'
$ type -a ls
ls is aliased to `ls --color=auto -p'
ls is /bin/ls

From help type: -a display all locations containing an executable named NAME; includes aliases, builtins, and functions, if and only if the `-p' option is not also used
$ function hello() { echo hello; }  # define function
$ type hello
hello is a function
hello ()
{
    echo hello
}

Answer: A simple approach for a specific alias is to try ps.
If you do ps -f, you will see the actual command adjacent to the process, not the alias name.  You can verify that by defining the following alias:
alias doSleep="sleep 100"

then do
ps -f | grep "sleep"

and you will see
username   14303    2409  0 15:16 pts/0    00:00:00 sleep 100

Unfortunately, the history command only shows the alias, so you couldn't use history to verify that the actual command ran; you could only search for the alias label in that case.
Comment: If you ran it with `doSleep&` and/or ^Z-ed out (which are the only ways you can see it in `ps` on the same terminal) then `jobs` (or `jobs %id` if you know/remember or guess the id) shows the expansion of an alias -- but not the contents of a function. which is the actual example in the question.


Need advice on new device regulatory requirements

Question: I have designed a product (device) that runs on 12 VDC (similar to a laptop). It is AC powered using a (table top), detachable switching power supply 100 VAC to 240 VAC, 50-60 Hz, again exactly like a laptop PC. The external Power supply with cord is already among many others, UL, CSA, CE  approved. Do I need to get any more regulatory approvals on the device? If not, can I tag the device with these approvals as self certified.
Comment: only if you do not modify the PS in any way.
Comment: Thank you for your reply.I take it that it is ok to tag my device with the regulatory symbols. Right?
Comment: @S.Chaoui No it is not okay, but feel free to check with UL/CSA on their opinion.
Comment: https://standardscatalog.ul.com/standards/en/standard_1310_6
Answer: You can't tag if you didn't test...
You cannot claim your device is approved by those standards bodies if you have not sought approval from them. The fact that your power supply is certified means that you will face much less difficulty getting your device approved (all of the AC standards have already been met and tested for you, yay!), but your device is not necessarily compliant with other relevant standards just because you used a good power supply.
There's more to certification than just the AC/DC power supply...
Depending on what your device actually does (medical, industrial, consumer) and what devices it actually contains (motors, electrodes, etc) and what voltages are present during operation and after power is disconnected, you will have to comply with relevant standards. Another set of standards to worry about concerns unintentional radiation (regulated by the FCC in the US and others worldwide).
So simple put, Power supply certification is insufficient to claim compliance and if you do so, you will be violating those laboratories trademarks and can be held liable for those damages.
Comment: Yes. Fan motors produce radiation (lots of it). Since you're over 70W, you'll have to have a Power-Factor-Correcting (PFC) equipped power supply. As to specific standards you'll have EMI/EMC (e.g. FCC rules) from the motor and the control board (which probably has a >1MHz oscillator on it), PFC Power Supply (EU rules), UL appliance and human factors standards to contend with (if you need UL/CSA/etc).
Comment: The device is a consumer table mount paint spray booth that uses a 12 VDC 80W, 9" diameter sealed motor fan and nothing else but a speed control board. What UL/CE standards should I consult?. In normal operation, the fan is turned ON to exhaust paint over spray through a set of 3 filters. Do fan motors produce radiation?


How to exclude Site Column from SharePoint Search Results

Question: I have created a site column which is a multi-text field. When I search on my Search Results Page, it is showing the List Items which has search keyword in this Site Column.
I removed the crawled property mapping for the automatically created managed property. I also updated the Searchable Columns to exclude this column.
I reindexed the List as well as Site after these changes. I want to avoid the full search crawl. Is there any else I am missing here?
Answer: Per my test, I exclude the custom site column in the searchable columns settings and start an incremental crawl, then the search result doesn't contain the list items which have this column value, but it still returns the list name which contains text.

Whether you encounter the same issue as me?
If so and not want to return the list name as result, as a workaround, try to filter to exclude the list result in the search result:
Go to Central administration site->Manage service applications->Search service application->Result sources->find the default result source in the list such as "Local SharePoint Results" and click Copy->click "Launch Query Build"->select Only return items and click Add keyword filter->save this result source and set as default.

Finally, the result not return the list as below:
Comment: Did you run full crawl post your changes?
Answer: Hope you have followed this one.
Exclude content in columns from search results
As a site owner you can control whether the content in specific columns in lists or libraries appears in search results. By default, all content is included in search results. This setting is useful when you want to prevent sensitive data from appearing in search results.
NOTE:  To change this setting, you must have the Manage Permissions permission level. This permission level is included in the "Site Name" Owner group.

Navigate to the site that contains the list or library.
Click Site Actions, and then click Site Settings.
Under Site Administration, click Searchable columns.
In the section Excluded Columns from Searching Indexing, under
Excluded check the box next to the Column Name for the column you
want to exclude in search results.

In Order to make any changes need to take effect from Crawled or Managed Properties, you need to have full index then only it will give you the exact result that you are looking for.
In case you are looking for some workaround then you can customise the search results templates to hide the data from showing but come up in the result.
Or you can try @hellofiona 's answer too.
Its worth looking at this post too. Sharepoint 2010 search - ignore a column
Reference: How to Exclude content in columns from search results


can I use two different lisp+slime/swanks from the same emacs?

Question: can I use common lisp and Clojure from within emacs at the same time?
I would like to have each lisp-REPL in its own buffer, and If i did this how could I controll which buffer sent its data to which lisp?
Comment: Yes.  Read the docs.  (C-u M-x slime ...)
Answer: Yes. In the documentation to Slime you will find slime-lisp-implementations. Here is how I have it defined in my .emacs:
(setq slime-lisp-implementations
   '((cmucl ("/usr/local/bin/lisp") :coding-system iso-8859-1-unix)
     (sbcl ("/usr/local/bin/sbcl" "--core" "/Users/pinochle/bin/sbcl.core-with-swank") :init (lambda (port-file _) (format "(swank:start-server %S :coding-system \"utf-8-unix\")\n" port-file)))
     (clozure ("/Users/pinochle/bin/ccl"))
     (clojure ("/Users/pinochle/bin/clojure") :init swank-clojure-init)))

You start up your lisps using M-- M-x Slime. It will ask you which Lisp to start up, and you use the name you defined in slime-lisp-implementations. In this example, I would use cmucl, sbcl, clozure or clojure.
You can switch the "active" REPL using the command C-c C-x c. For more info, see the Slime Documentation on controlling multiple connections.
Comment: if you are a truly a pinochle enthusiast, I would like to speak with you.  Find me at www.powerpinochle.com/forum/  ...Dear moderators, please permit this comment long enough for Pinochle to read.


Does voltage matter when using constant current PSU?

Question: Let's say I have 90W RGB LED module/plate (10 Series and 9 in Parallel internally). It has Voltages: R: 20~22V; G: 32~34V; B: 32~34V; Can I power all colors with 3 identical 30W constant current driver that has voltage of 30~36V? To what extent does voltage matter/not matter when using constant current psu?
Comment: That doesn't make a lot of sense. Picture of the specifications? Datasheet? Model number?
Comment: Yup, a [proposed] diagram of how the LEDs will be connected would make this question clearer.
Comment: See edit and included link to led module. LED module wil also be PWM controlled and dimmable (via led driver with arduino) in case it that matters.
Comment: Yes, it's the min/max voltage. The two values are examples of two different led drivers I am considering. Most drivers I see have similar voltage ranges, that's why I was hoping voltage didn't matter since then I could power the red led with same driver as blue and green.
Comment: @Phil, the overlapping range plainly means the minimum and maximum voltages it can work at.
Comment: @PhilFrost Oh you mean the `R: 20~22V; G: 32~34V; B: 32~34V` vs `30~36V`? The first set are the typical forward voltage ranges for each of the diode sets, and the second is the min/max of the supply they want to use.
Comment: Yes, first set are the color voltage ranges and the second is the proposed psu voltage range.
Comment: @Passerby no, I mean before the question was edited, it said "constant current driver that has voltage 26V-36V OR 30~36V?"
Answer: Yes, voltage matters. Just as a voltage source (as most power supplies are) have a maximum current and also a minimum current (usually assumed to be 0A, unless otherwise specified), a current source has a range of voltages over which it can work.
If required to work outside these ranges to supply the specified constant current, it may shut down, fail to supply the specified current, overheat, or spectacularly self-destruct.
I'm not sure what to make of the numbers you give. 26V-36V or 30V-36V doesn't make a lot of sense, because that's equivalent to just 26V-36V. Even so, if your red LEDs require 20V-22V, this is outside that range, which suggests this power supply will not work.
Furthermore, it sounds like you are thinking about driving multiple strings of LEDs in parallel with one supply. That won't work. Circuits in parallel have equal voltages. Circuits in series have equal currents. If you put multiple LEDs in parallel, and they don't each have some current regulation device (the simplest being a resistor), then the total current from the supply will be split between the parallel circuits. This is not what you want. See Why exactly can't a single resistor be used for many parallel LEDs?. Although that's about sharing a resistor, the question, and the answers, are just as applicable if you replace "resistor" with "constant current source".
Since your proposed LED modules are sold as a unit, we can probably assume they have some mechanism to equally share current among the internal parallel circuits. However, I see no datasheet, so we are taking it on faith. However, you will need a separate supply for each of those modules, or you can connect all the modules in series and find a current supply capable of supplying the sum of the voltages of each module.
Comment: Yes I am assuming it has the required mechanism (plenty of youtube videos running similar modules with the led drivers I am considering). I would use one led driver for each color as it will be PWM controlled and dimmable. The voltages given are for 2 different drivers, but I will edit that out as it's confusing.
Answer: Just a few thoughts.

The voltage of the LED should fall into the constant current region of the power supply.  Some LED power supplies have a wide constant current region (e.g. 3V to 36V).  Some have a narrower constant current region (e.g. 27V to 36V).
If you have an array of LEDs with 10 in series and 9 strings in parallel, you'll need a series resistor on each of the strings to facilitate current sharing.
Comment: First point makes sense. What would happen if I use 30-36V driver with 20-22V LED? Would it light up, be damaged, light up dimmer than normal etc...? Second point doesn't apply (see edit).
Comment: @DominicM  Revised my answer.  I wouldn't use a 30-36V supply with a 20-22V LED.  May be, the supply will detect that the LED voltage is "wrong" and shut off.  May be, it will toast the LED.  Probably, different models would handle this differently.
Answer:
Let's say I have 90W RGB LED module/plate (10 Series and 9 in Parallel internally). It has Voltages: R: 20~22V; G: 32~34V; B: 32~34V; Can I power all colors with 3 identical 30W constant current driver that has voltage of 30~36V? To what extent does voltage matter/not matter when using constant current psu?

To what extent does voltage matter/not matter when using constant current psu?
Perceived problem: 3 x psu, 3 x LED colours, one colour per psu. Vranges vary per colour ...
It is unusual for constant current drivers to have a high minimum voltage.
This may be done to limit dissipation and may assume a target load.
Your actual LED voltage at the specified current MUST lie within the CC driver voltage range for things to work as designed.  If VLEd at CC is > Vmax you will probably just get Vmax and < CCspec. If VLED at CC is < Vmin you will be aty the driver makers pleasure. Driver may fry or shut down. Worst , it may deliver Vmin and CC will be exceeded and LED smoke may not be RGB>
Also - SOME drivers are badly behaved. At no load a CC driver SHOULD output Vmax. When you apply a step load the driver should instantly drop Vout until CC is reached. You MAY get a brief blip of V > VLED at CC. Most LED strings will tolerate this if Vmax is not too much > VLED at CC.
If you load the CC and then turn it on it SHOULD step up V until CC is reached. I have seen supplies that step to Vmax or some other voltage while they get their brains running. Magix smoke may happen. Most device made to drive LEDs should not do this.
When using a 'lab' psu for this sort of task I set Vout to just higher than required., then set Ilimit (short leads and adjust or use dial if available and accurate) then deshort and apply to load. Or apply load and turn on as in most cases the supply will not step above Vset. Most.
ie horses for courses, YMMV, caveat emptor, test carefully, ... but the above should apply well enough.

3 identical 30W constant current driver
Technically, NO.
If all are identical they must be able to supply max I to red and max V to Blue & Green so you need 3 x ~= 50W supplies.
You can instead use 2 x ~= 35W supplies capable of about 1.2A for B & G and a ~= 35W supply capable of about 1.5A for Red. You need more than 30W per supply due to Vmin - Vmax range issues.
Detail:
You say 3 x identical 30W supplies.
Vmax x CC for highest string must be <= 30W with a 30W supply.
If you want 30W from red and have identical supplies then the B & G supplies must be capable of higher wattage than the red supply. The red supply is run at 20-22V and makes 30W. The other supplies run at higher V but lower I to make 30W. But the B&G supply are capable of higher V and red_i so are capable of higher wattage so the capability is unused. If you want equal wattage then you can use lower CC max supplies for B & G.
If so then lowest string wattage will be Red with Vstring MAY be 20V (worst case low) so Wred may be 30W x 20/34 = 17W !
If supplies are equal, to get red to 30W you need all psus able to give at least 30W x 34/17 =51W = say 50 Wsupplies.
Comment: I don't understand the last section. If the drivers are identical then voltage range and CC are the same too, they are the same identical devices after all. From other answers I gather that I cannot use lets say 30-36V supply to power 20-20V red LED. This means as I understand it that no I cannot use identical supplies and since there are no supplies I can find that fit my needs my project is not possible at all.
Comment: @DominicM Your project is very doable. You can definitely buy or make or use components that exist. | My point about 3 identical supplies is that they must be able to supply the highest voltage and the highest current. Red is high I and lower V, G&B are high V and lower I for the same Watts. A psu that must supply the highest I and the highest V is CAPABLE of more Watts than is needed by any LED string. || Yes, driver Vmin MUST be below or equal to LED Vmin that you intend to use. But eg if a psu worked OK for G & B but Vmin was too high for Red an external resistor or zener would fix this.
Comment: I didn't consider a resistor because of high power requirements of the LED. What kink of resistor would I need to bring down the voltage by 10V? I would think it would be a very large resistor that would end up wasting a lot of power.
Answer:
It has Voltages: R: 20~22V; Can I power it with a 30W constant current driver that has voltage of 30~36V?

You could, but you'd might fry the red diodes. Since your constant current driver has a stated range of 30v to 36v, it immediately tells you that it is out of manufacturer spec to try to drive it lower. It might have failsafes and just shut down. It might blow a fuse or overheat a part. It could catch on fire, horrible horrible fire. Or it might just work as designed, and will hold the line to 30v, forcing a higher voltage through your red diodes, causing a higher current draw than they like, blowing them.
Or it could just be an overly cautious label and the supply can work at ~20v 900mA without problem and you luck out. Or you simply have to change some stuff on the board to make it work like that.
In the end, do you want to risk the cost of the panels and/or the supplies?
Comment: Uncommented downvote...


What do we call the open part at the back of a snack pack?

Question: I'm writing a packing procedure report. And I don't know what the open part at the back of a pack should be called. Does anyone know this?
Comment: Can you elaborate or include a picture of what you're referring to?  An open part at the back of a pack isn't ringing any bells as to what you might be talking about.
Comment: I'm not familiar with a specific technical name for that and if there was, and you're writing for non-technical people, they might not be familiar with the term.  I'd be more inclined to just describe it.  Maybe refer to it as "the flap running down the back".
Comment: Perhaps the "back seam"?
Comment: This one is still escaping me.  On something like a pouch made from a sheet of paper or plastic film, the material is formed into a tube, which is flattened into a pouch,  and then the top and bottom of the tube are sealed to hold the contents.  Where the sides were joined to form the tube, it is often sealed a short distance from the edge.  The material between the seal and the edge becomes a flap that is folded flat against the pouch, usually running down the back of the pouch.  Is that flap the part you're referring to?
Comment: @fixer1234 picture added (y)
Comment: @fixer1234 yes, that is
Comment: @fixer1234 thank you, but i prefer a specific name cause this report is for company partner =)). anw, tks
Comment: seems legit. i will use it then. tks :)
Answer: If the opening in the back of the pack is one that can be opened and closed, especially if the packing is made of plastic, it could be called a ziplock.

having an interlocking groove and ridge that form a tight seal when pressed together a ziplock plastic bag

If it's a permanent fixture that must be broken to open and cannot be refastened, I would call it a seal.

2 a :  something that secures (as a wax seal on a document)
b :  a closure that must be broken to be opened and that thus reveals tampering

I would take a look at google image searches of these terms and see if they fit with what you're referring to.
Comment: tks, i supposed to use "seal" at first but i need something more detail to tell partner exactly which part i'm talking about (top, bottom, back). "back seam" seems a legit answer atm =)). tks for spending time (y)


Index was outside the bounds of the array

Question: Here is the scenario:
I have two dropdowns on the page. When you select an item in the first dropdown, second dropdown is populated. On the page is also Submit button & a reset button (with javascript code). All of these controls are inside Telerik RadAjaxPanel ( same as asp.net UpdatePanel). There is also a asp.net ajax ScriptManager on the page. Locally, on developer's machine when I click on the reset button, page resets just fine. when deployed on a QA machine, we get following error message.
Error message:

Exception information:
    Exception type: IndexOutOfRangeException
    Exception message: Index was outside the bounds of the array.
Request information:
    Request URL: http://000.000.000.000:8080/PageName.aspx
    Request path: /PageName.aspx
    User host address: 000.000.0.00
    User: department
    Is authenticated: True
    Authentication Type: Forms
    Thread account name: NT AUTHORITY\NETWORK SERVICE
Thread information:
    Thread ID: 6
    Thread account name: NT AUTHORITY\NETWORK SERVICE
    Is impersonating: False
    Stack trace:    at System.Security.Cryptography.RijndaelManagedTransform.DecryptData(Byte[] inputBuffer, Int32 inputOffset, Int32 inputCount, Byte[]& outputBuffer, Int32 outputOffset, PaddingMode paddingMode, Boolean fLast)
   at System.Security.Cryptography.RijndaelManagedTransform.TransformFinalBlock(Byte[] inputBuffer, Int32 inputOffset, Int32 inputCount)
   at System.Security.Cryptography.CryptoStream.FlushFinalBlock()
   at System.Web.Configuration.MachineKeySection.EncryptOrDecryptData(Boolean fEncrypt, Byte[] buf, Byte[] modifier, Int32 start, Int32 length, IVType ivType, Boolean useValidationSymAlgo)
   at System.Web.UI.Page.DecryptStringWithIV(String s, IVType ivType)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

Any help would be appreciated
Thanks,
Salil
Comment: How are you "resetting" the page?  Are you doing a response.redirect to the current url?
Answer: Use the telerik forums or support ticket system to submit the issue to them. Also test on a third machine to make sure that the QA machine is not with somewhat corrupted configuration.


What is that term to describe the wing motion range?

Question: What is that term naming the range of motion of the wings when on the ground (hanging/drooping) then bends upwards during flight?
Comment: [Wing flex](http://aviation.stackexchange.com/questions/14719/is-wing-flex-good) is the term you're looking for.
Answer: The term that you are looking for is Wing Flex. The extent of flex is a product of the material.The wing needs a stated definitive strength. With metal, that transforms into a given amount of flex. IOW, the flex, is basically just a by-product of the materials and high aspect ratio design and is not a design goal in itself. The benefit is, smooth ride during a turbulence.
Aerodynamically you do pay a penalty. However, to a certain extent this will be offset by lighter weight and the much superior strength, facilitates the high aspect ratio which more than make up for the loss due to the flex.
Comment: I came across that word once on the internet and couldn't find it again.  It starts with the letter "b".  Wing flex is probably one of the more common reference to it but that is not the word I'm trying to remember.
Comment: @DannLogue Ok. In that case I suspect you'll have to re word your question so that it captures the exact type of movement that you are referring to. My answer above is based on the question that you have asked. If the above answer is not of any help, please let me know if I should delete it. Thanks.


Can there be problems copying files from AFPS to other file systems?

Question: I have a simple question: I bought a NAS from Synology and I copy my files from macOS (my filesystem is AFPS) to the NAS with Samba, formatted in ext4. Sometimes I also copy files from AFPS to NTFS (I'm using the Paragon Software). I never had any problems, but I want to be sure: Can there be problems due to these different file systems for example that files won't be copied, because the target system doesn't support the filename? macOS would tell me, if this is the case?
Answer: Files content is just bytes and the FS job is to handle it and that's all, by copying a file you just copy the bytes and not how it being handled. SMB send the data as a raw data and the "other side" receive it as a raw data and handle this data according to it's rules.
So to answer your question, the FS does not matter.
Answer: This article suggests that the illegal character issue is a function of the OS, more than the file system. So you can write chars like * and | to an NTFS filename using MacOS, but it will cause trouble when viewed on a Windows platform.
Of course, NASes use an OS to serve the files: Synology uses a Linux-based system. As Unixy cousins, things should be similar. If Windows were in the mix somewhere, then there might be problems.
To answer your last question: MacOS can only tell you what the server OS provides to it. If the server OS misunderstands the filename and parses it differently, that may not necessarily generate an error, even if the file doesn't save as expected.
Another possible problem when passing files across different file systems and OSes is whether extended attributes remain associated with the file. I would expect a Synology NAS to handle this correctly, but it's worth checking.


Is the license for Dance Monkey free?

Question: I don't think so.
However, there are so many cover songs on YouTube.
So, are these copyright violations?
Or is Dance Monkey free, am I wrong?
Comment: You need to know that YouTube often doesn't remove videos with copyright infringements anymore. Nowadays, the ad revenue gets redirected towards the original content rights holders and the video can stay up, unless the rights holders don't want that.
Answer: Depending on your country, the website you're uploading to and your usage of both audio and video, the copyright-laws make it legal or illegal to use a specific song.
If you create a video-essay about music-production and must use the song as an example to show your point, you will, in many cases and places not break any laws. If you combine a still-image with the song and upload this in its entirety than you will break the law in almost every case and place.
Copyright to music is no black-and-white topic, and if you're considering using music from an artist, I would seriously recommend reading up on the laws that are applicable where you live, so to not risk a hefty fine.
Youtube has a special approach to this case, in which - when a video uses copyrighted music - the video's revenue (money from ads) will go directly to the artist. If, however, the music is not registered at a database (in germany it's the GEMA, to name an example), the video can be blocked everywhere and you will get a strike. 3 Strikes mean that your channel will be terminated.
So you will likely not risk getting sued when using music in a youtube-video, but I would recommend reading up on the laws or asking a lawyer nonetheless. Copyright should be taken very seriously.

Is the license for Dance Monkey free?


Progress on document Status

Question: Can anyone help with setting up a progress status on documents in a document library. I would love something similar to the attached.
Answer: The simplest way is to use a Calculated Column (set to datatype=Number!!! to output HTML)
=IF(NOT(OR([Task Status]="Not Started",[Task Status]="Completed"))
    , "
"
        &"
"
        &  [% Completed]
        &"%
"
      &"
"
    ,"")

Pros:

Works in 2010/2013 in any View (not on Forms)
No need for CSR files/JSlinks (2013)

Cons:

Displays HTML code as text in Alerts, CQWP, Content & Struture View
Adds this HTML for every ListItem (so not very mobile friendly)

The 2013 (CSR) Client Side Rendering way
See: jslink on Tasks % Complete field

Progress on document Status


Gen 2 Prius hesitates ... Is there a problem with the HV Battery?

Question:
Is there a problem with the HV Battery? Gen 2 Prius hesitates.
Comment: Welcome to Motor Vehicle Maintenance & Repair!
Answer: The graph presented in the image appears somewhat disconcerting, but when one considers the scale of the Y axis, it's not too bad. The text references a voltage difference of 0.07, seven one-hundredths of a volt across the entire pack. The internal resistance difference is also only one milli-ohm across the pack.
At a state of charge of slightly less than fifty percent, the indication is that the pack is getting very slightly out-of-balance as it discharges. Unless you are experiencing difficulties, or have specific reference material suggesting a problem, you appear to have none.
Consider to examine your pack in the same manner after a charge and also after a drive of a few miles, which will be more illuminating.


"you don't...without...."

Question: A and B are going to take a bomb-defusing class tomorrow.

A: I am going to dominate that class. You don't cross-stitch for 20
  years without developing a steady hand.
B: Wow, you really think that is a brag, don't you? 20 bucks says, I
  do better in that class than you do.
A: All right, you're on.

C is super drunk and A is offering to sober her up.

A: I got this. I'm a master at sobering up.
B: Are you sure?
A: Uh, you don't go to the Renaissance Faire every weekend in your 20s
  without learning how to handle your mead.
B: Great. Thanks, C

I hardly understand what these marked sentences mean. I definitely don't understand the construction, though. Why do they use "don't" here, not "didn't" or "haven't" ?
Those dialogues was taken from an sitcom.
Answer: Don't because they are general, timeless statements, for which we usually use the the present simple. "You" is here an indefinite pronoun, not the second person (addressee).

"you don't...without...."


Snapping Bones to Bones (In Other Armature)

Question: I am trying to scale and position the bones of one armature to another. And, I was wondering if there was a way to snap the position of the bones in one armature to the position of the bones in the other?
Thank you for your time!
Answer: I was looking for the same. I saw the UE folks do this and was trying to do it without their plugin. They show it happening here... (https://www.youtube.com/watch?v=F9cTXzO8wq0&list=PLZlv_N0_O1gaxZDBH0-8A_C3OyhyLsJcE&index=4&ab_channel=UnrealEngine)
It's a bit tricky since your cursor has to be in the correct place...

In object mode, select both armatures.
Go into 'Edit mode'
Enable 'Vertex Snapping' (refer to image below to see where to find the button to open the menu. (enable rotation/scale here if you'd like to)
Select the bone head/tail that you would like to move to the other.
** Tricky Part here: Ensure your cursor is inside (or near) the source head/tail before you start transforming.
Press G to transform the position of the tail/head.
Moving close to the other armature tail/head should snap to it.

** Also note that, if you move the tail of one bone, you will likely have to move the head of it's connected bone too.
Comment: You can just select the tail/head and press g, then the axis (x, y or z) and move the selection near the object aligned to the center. You don't need to place the cursor near the source.
Answer: Probably the easiest thing to do is to do it in pose mode, with copy transforms constraints, and then apply the pose as rest pose.  Interface for constraints is good enough that this is less work than doing it in edit (where you need to also match roll, btw) at least in most cases.
Make sure both armatures have no unapplied transforms.  Select snapping armature, enter edit mode, alt-p (clear parent) -> disconnect, then return to object mode.  Select both armatures and enter pose mode.  For each bone, select the snap-to bone, shift select the snapping bone, and shift ctrl c (add constraint with target) -> copy transforms.  The defaults for copy transforms are fine for what you want, so there's no need to enter the bone constraints tab.  You should see your bone snap, in pose mode, to the position of your other bone.  Repeat for all bones.  When you're done, still in pose, ctrl a (apply ) -> pose as rest pose; then select all bones and use the "clear pose constraints".
This procedure will orient the bones's axes and head positions correctly, but won't affect rest length.  Tail positions (and connected property) aren't that important, but if you need tail positions to be correct, you can follow the clear transforms constraint above with a stretch-to constraint, targeting an appropriate bone's head, or targeting the tail of the copied bone (which then requires editing bone constraint from defaults, thus making it more troublesome.)  If you use stretch-to, snap your bones from root outward to prevent having to recalculate rest pose length for these constraints.


Linux recycle bin script

Question: I'm creating a recycle-bin script in SH shell linux in three differant scripts, delete, trash and restore.
The first two scripts are working fine; 'Delete' moves the selected file to the recycle-bin while logging a text file called 'trashinfo' which shows the original path location of the file (to be later used in restore) and 'Trash' which removes everything in the recycle-bin.
The 'restore' script should take the logged path name gained in the delete script and return the file to its original location. I've spent more time than I'd like to remember on this and cant get the restore script to work properly!
Below is the script I've written, as far as I can make out I'm grepping for the filename variable in the text file that holds the pathname, eg 'restore testfile', this is then combined with the basename command, the testfile is then moved into the location thats been grepped and combined with the basename.
Anyone have any pointers on where I'm going wrong?
if [ "$*" != -f ]
then
path=grep "$*" /usr/local/bin/trashinfo
pathname=basename "$path"
mv "$path" "$pathname"

Answer: path=$(grep "$*" /usr/local/bin/trashinfo)
pathname=$(basename "$path")

Linux recycle bin script