text:
Q: Proxmox VE: How to create a raw disk and pass it through to a VM I am searching for an answer on how to create and pass through a raw device to a VM using proxmox. Through that I am hoping to have full control of the disk including S.M.A.R.T. stats and disk spindown.
Currently I am using passthrough using the SATA passthrough offered by proxmox.
Unfortunately I have no clue how to create a raw disk file from my (empty) disk). Furthermore I am not entirely certain on how to bind it to the VM.
I hope someone knows the relevant steps.

Side notes:
This question is just a measure I want to try out to achieve a certain goal. For the sake of simplicity I posed my question confined to the part above. However, if you have a better idea, feel free to give me a hint. So far I have tried a lot of things to achieve my ultimate goal.
Goal that I want to achieve:
I am using Proxmox VE 5.3-8 on a HP Proliant Gen 8 server. It hosts several VMs among which OMV should serve as a NAS. Since the files will not be accessed too often, I opt for a spindown of the drives.
My goal is reduction of noise and power savings.
Current status:
I passed through two disks by adding them to
/etc/pve/nodes/pve/qemu-server/vmid.conf
sata1: /dev/disk/by-id/{disk-id}
Through that I do see SMART stats and everything except disk spindown works fine. Using virtio instead of SATA does not give me SMART values.
using hdparm -y to put a drive to sleep does not work inside the VM. Doing the same on the proxmox console result in a sleep, but it wakes up a few seconds later.
Passing through the entire HBA is currently not an option.
I read in a forum that first installing Debian and then manually installing the proxmox packages resulted in a success. However that was still for Debian jessie and three years ago.
Install Proxmox VE on Debian Stretch
Before I try this as a last resort, I want to make sure if passing the disk through as a raw file will lead to the result.
Maybe someone has an idea on how to achieve my ultimate goal.

A: I do not have a clear answer to your question, as per "passing through" the disk, but i recently found a good enough solution for my use case.
I have an HDD that i planned to use as a backup dir for VMs, but i also wanted to put any kind of data on it, and share that disk with any VM that would like to.
The solution i found is to format the disk using ZFS, then creating mount points for different usage (vzdump backup, shared nas folder accross VMs + ISO mounting point etc...). I followed this guide: https://forum.level1techs.com/t/how-to-create-a-nas-using-zfs-and-proxmox-with-pictures/117375
I ended up installing samba on proxmox host itself, with a config to share some folder/mount point of the disk, via SMB. Now the device appears as a normal disk over the network, with excellent read/write speed as everything is local.
Sorry that this post does not "answer" your question (no SMART data or things low level like that :'( ) BUT shared storage ^^'


text:
Q: What is the name of this oscillator topology? What is the name of the topology of the oscillator shown below?
I try to understand how it works and what are the design equations. But in order to find that, I first have to know the name of the things. (There is no schematics entry on google...)

Or maybe someone has time to thoughtfully explain the system...
EDIT:
I am convinced now: the load is part of the oscillator. I edited the schematics and included it.
I added a name to each net as suggested.
The source is a Youtube chain of French EE that does fancy stuff:
Four à induction : Incroyables Expériences [81]
The schematics can be seen at the very end of the video.
I have also simulated it on LtSpice. The slight imbalance between R1 and R2 start the oscillation. Equal resistors do not work (at least in simulation) but nothing is really equal in the real world...
This takes time to start (~10 ms) but it oscillates at 100Khz as expected (by the youtubers).

A: I don't know the name of this oscillator, but the operation seems relatively straight forward.

*

*Assume current flows through L1 at the beginning and M1 is shutting off. This generates a voltage spike at Vout-, which is large enough to overcome the reverse-breakdown voltage on D2.

*This voltage spike hits the gate of M2 and turns it on for a short time. This creates a current pulse through L2 and M2.

*When M2 begins to shut off, L2's inductance causes a voltage spike at Vout+. That gets sent to the gate of M1 through D1 once again by action of the reverse-breakdown voltage.

*M1 begins to generate a pulse current through it and L1 and we're back at step one.

This works because of the inductors creating voltage spikes higher than the 24V input and because the Schottky diodes are rated at 30V for reverse-breakdown. R1 and R2 are there to start up the oscillations. Without them, M1 and M2 would never turn on at all. They're also different values which supports the idea that they're just there to start the oscillations by allowing one side to temporarily override the other side.
The reason the Schottky diodes don't get fried is due to the capacitance of the FET's gate being the only path to ground. The capacitance blocks excessive current from flowing through the Schottky. Excessive current during reverse-breakdown is the mechanism of failure in them due to the heat that would be generated. That never happens here because there's never enough heat buildup to cause failure.
A basic simulation of the circuit topology shows this works. I've used different values and modeled the Schottky's as Zener's because that's more accurate use in this case because this simulator doesn't have an input for reverse-breakdown voltage:

Circuit topology simulation. Green waves are voltage while yellow is current. Vdd is only 5V.

A: What you have there appears to be a Multivibrator:

A multivibrator is an electronic circuit used to implement a variety of simple two-state systems such as oscillators, timers and flip-flops. It is characterized by two amplifying devices (transistors, electron tubes or other devices) cross-coupled by resistors or capacitors. )

You have two cross-coupled amplifying devices, bridged by RC, so it "quacks like a duck and walks like a duck".
(The multivibrator is further classified by the stability that it exhibits. If yours indeed oscillates, then it is qualified as an astable multivibrator.)

A: I could see this thing oscillating with the inductors in resonance with the drain capacitance of the MOSFETs. Imagine M1 has just turned off (with some current flowing through the inductor just before turn-off) and M2 is on.. the voltage on the drain of M1 increases sinusoidally to a peak, then falls, when it has decreased below the threshold voltage of M2 minus a Schottky diode drop, M2 turns off and M1 turns on, then it's rinse and repeat in the other direction.
Start-up could be ugly, but at several hundred amperes the "On" MOSFET will come out of saturation inevitably (assuming ideal power supply and ideal inductors), and oscillation should start (perhaps involving destructive avalanching of the "On" MOSFET as Dave Tweed said in his comment), but it may latch up in real life and fry one of the inductors-- those are pretty hefty MOSFETs.
Edit:
With the load, this is about as close as I can get to making it oscillate, with some resistance added to the inductors and a switch opening at 1usec to kick it. The current is 200A (!).

A: Normally this is a bistable circuit (FF) but addition of drain inductance with the diode capacitance yields a second order effect  to get 180deg of phase shift to form negative feedback for biasing.
Thus it becomes an LC diode Astable circuit.

A: I have found:
This is a variation of a ZVS usually found in Flyback controllers such as:

Original design by Vladmiro Mazilli.
Notice that if you remove the zener diode that are here to protect the N-MOSFET and the 10k resistors that seem to be small pull down for discharging the gates, you end up with almost the same design. There is also a separated inductor for the supply instead of the center point of the transformer.

A: The circuit is in  a muddled form. I have seen it on rubbish like "circuits gallery"   .      It is flawed and will eat fets for breakfast lunch and tea            .People have had problems with this circuit and that is how I got to hear about it            .When done properly it has been called the following names :           ZVS royer .Tuned collector oscillator .Dynatron .Its an oldie but a goodie and in its origional form it  has BJTs .People have wanted to use mosfets because they are faster but the "designer " did not understand start up biasing .If you iron out the bugs you can have something  will have    low EMC and low switching losses .

redpajama_set_name: RedPajamaStackExchange


text:
Q: What is the proper name of the 3D shape of a teardrop? A circle is 2D.
A sphere is a 3D circle.
A "teardrop" 2D shape (bottom half circle, top-half kindof diamond shape) probably has a name (I don't know - someone suggested squircle which I love - because it's half square, half circle...). Maybe a lachrymaform? Maybe a symmetrical airfoil?
Anyhow - what's the name of a 3D one of these? bottom-half sphere, with the top half terminating in a sharp point?


text:
Q: CSR algorithm/size is incorrect.Expected RSA 2048 I am trying to integrate apple pay with braintree. I have followed up the following instructions to enable apple pay in the brain tree. In the first step, if you click on certificate signing request, it downloads a braintree_app_pay.certSigningRequest file which is used in the apple membership.

When I choose to create payment process certificate, I am getting the following error.

A: Full disclosure: I work at Braintree. If you have any further questions, feel free to contact our Support team.
Make sure you're selecting the Apple Pay Certificate option under Production (even if this is for a Sandbox; see the Braintree Apple Pay configuration docs for details) when choosing the type of certificate to add in the Apple Developer portal. Apple Pay CSRs should be generated with ECC, not RSA.
Here's what the CSR prompt screen should look like. Although you'll be uploading the CSR obtained from Braintree instead of generating one, note Apple's specifications for the key:

A: Please follow below steps[If use Apple Pay with stripe or any other payment gateway]:

*

*Double click on CSR (Downloaded from Stripe), [It will open Certificate Assistant]

*Click on Continue

*Select 'Request a certificate from an existing CA', and Continue

*In Certificate Information screen, Enter User Email Address, Common Name, Leave CA Email Address empty, Select 'Saved to disk & checked Let me specify key pair information' [Select your specific location and save]

*In Key Pair Information screen, select 'ECC' algorithm & select Key size : 256 bits and continue.

Now use this CSR in your payment processing certificate.

A: This issue is not specific to Apple Pay or Braintree - I ran into the same issue when trying to create a CSR for getting a Safari certificate from Apple.
What's important to know is that you need to select the iCloud keychain before using the Request Certificate from Certificate Authority command. If you don't, another keychain may be active, causing wrong keys to be used.

A: From Apple Developer Forum

Within the Keychain Access drop down menu, select Keychain Access >
  Certificate Assistant > Request a Certificate from a Certificate
  Authority.

*

*In the Certificate Information window, enter the following information:

*

*In the User Email Address field, enter your email address.

*In the Common Name field, create a name for your private key (e.g., John Doe Dev Key).

*The CA Email Address field should be left empty.

*In the "Request is" group, select the "Saved to disk" option.

*Select "Let me specify key pair information".

*Click Continue within Keychain Access and select the file location.

*Set the Key Pair Information to the following:

*

*Algorithm: ECC

*Key Size: 256 bits Click

*Continue within Keychain Access to complete the CSR generating process.

A: complimenting what @zepp said, you need to specify when creating CRS, and you can that by following the process below

*

*Go to Keychain Access

*Click on Certificate Assistance

*Click on Request Certificate from Certificate Authority (click for image)

*Enter all information and click on "Let me specify key pair Information"checkbox, then click on Continue

*Select KeySize to be 256 and Algorithm to be ECC (click for image)

*Then click on continue.

A: I don't get it, because it's said You must use the CSR we provide. Do not create a CSR file yourself on braintree website.
And with this CSR file, it's always failed on apple's upload page.
Edit:
I finally upload success with follow steps of @anjali-jariwala 's answer.
Just in last step, I choose RSA & 2048 as alert requirement.

A: For me I accidentally chose Yes when asked Will payments associated with this Merchant ID be processed exclusively in China?
Choosing No solved the issue for me

A: I had the same error. The mistake on my part was choosing the wrong type of certificate while creating it in the Apple developer portal. I used 'Apple Pay Merchant Identity Certificate', but I needed to use 'Apple Pay Payment Processing Certificate', which solved the issue.


text:
Q: How to make a continuous gradient? I have multiple  and I wanted to have a gradient that goes through all of them without breaking. I've made a jsfiddle to be more explicit, in that jsfiddle the gradient is starting and finishing in the same  but I wanted to begin in the first one and end in the last.

body{
      background: lightgray;
   }
   .tabs{
    margin: 3% 0 0 3%;
 }

 .tab {
    text-decoration: none;
    color: white;
    background: linear-gradient(to left,#006680, #00b8e6);
    padding: 0.5% 2% 0.5% 2%;
    border: 1px solid black;
 }

 .tab:hover {
   text-decoration: underline;
}

tab1
tab2
tab3
tab4
tab5
tab6

A: To build on the comment, you can try to work some magic with having a parent background go through all of these links, or you can just write a different gradient for each one that has all of the stop points.
.tab:nth-of-type(1) {
  background: linear-gradient(to left,#00ACD7,#00B8E6);
}
.tab:nth-of-type(2) {
  background: linear-gradient(to left,#00A1C9,#00ACD7);
}
.tab:nth-of-type(3) {
  background: linear-gradient(to left,#0095BA,#00A1C9);
}
.tab:nth-of-type(4) {
  background: linear-gradient(to left,#0089AC,#0095BA);
}
.tab:nth-of-type(5) {
  background: linear-gradient(to left,#007D9D,#0089AC);
}
.tab:nth-of-type(6) {
  background: linear-gradient(to left,#00728F,#007D9D);
}

You could probably have this be generated somewhat by Sass using a colour function and a for loop but I'm not sure how specific you'd be able to be.
https://jsfiddle.net/m61es0rv/
btw I got each gradient point from here https://meyerweb.com/eric/tools/color-blend/#006680:00B8E6:6:hex

A: Here's what I came up with:
If you want to use a single gradient, you're going to have to give the gradient to the parent element and go from there. I did just that and added some span elements to separate the buttons with the grey background color you chose.
The other option as Sergey rightfully stated would be to chop the gradient up and put different gradients on each block individually.

body{
      background: lightgray;
}

.tabs{
    background: linear-gradient(to left,#006680, #00b8e6);
    display: flex;
}

.tab {
    text-decoration: none;
    color: white;
    display: inline-block;
    border: 1px solid black;
    padding: 0.5% 2% 0.5% 2%;
}

.tab:hover {
   text-decoration: underline;
}

.separator {
display: inline-block;
width:10px;
background: lightgray;
}

tab1

tab2

tab3

tab4

tab5

tab6


text:
Q: How to get the items when swapping muuri-react? I am trying to use muuri-react to build a masonry gallery that supports videos, images, doc and pdf. On the backend i am storing the position of the item when the user drags it to some position so i want to get the two item when they swap so i can send the updated positions to the backend.
Looking at this example i couldn't figure out how can i do that i didn't find anything in the documentation either
<MuuriComponent
  dragEnabled
  dragFixed
  sort={sort}
  dragSortPredicate={{
    action: "swap",
  }}
  dragSortHeuristics={{
    sortInterval: 0,
  }}
>
  {items}
</MuuriComponent>

I want to be able to do something like this
const onSortEnd = ({ oldIndex, newIndex }) => {
  setSwap([
    {
      id: items[oldIndex].id,
      // make sure to assign old indexes ID to new order
      position: newIndex,
    },
    {
      id: items[newIndex].id,
      // make sure to assign new indexes ID to old order
      position: oldIndex,
    },
  ]);

  const array = items;
  const tmp = array[newIndex];
  tmp.position = oldIndex;
  array[newIndex] = array[oldIndex];
  array[newIndex].position = newIndex;
  array[oldIndex] = tmp;
  setItems(array);
};

like we do in react-sortable-hoc


text:
Q: Why call function A_GetUSBBufferLen() from winppla.dll doesn't work on Delphi Tokyo? I'm trying to work with Argox printer OS-214 Plus in Windows 10. I've connected the printer and Windows 10 recognized it but I haven't installed any driver.
I've downloaded Command-Library-V409 and extracted Delphi 2009 example from path ..\Command Library V409\PPLA\Example\Win32\Delphi_2009. There is a folder called release with a compiled exe called Delphi_2009.exe. I put in release the dll's WinPort.dll and Winppla.dll extracted from ..\Command Library V409\PPLA\Library\32-bit. Finally, I run Delphi_2009.exe and it worked as expected, showing the message bellow before print:

So I've tried to run the example bellow in Delphi Tokyo:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

    var dpCrLf : AnsiString = chr(13)+chr(10);
    var szSavePath : String = 'C:\Argox';
    var szSaveFile : AnsiString = 'C:\Argox\PPLA_Example.Prn';
    var sznop1     : AnsiString = 'nop_front' + Chr(13) + chr(10);
    var sznop2     : AnsiString = 'nop_middle' + Chr(13) + chr(10);
    function  A_Bar2d_Maxi(x:integer; y:integer; primary:integer; secondary:integer; country:integer;
              service:integer; mode:char; numeric:integer; data:AnsiString):integer;stdcall;
              external 'WINPPLA.DLL';
    function  A_Bar2d_Maxi_Ori(x:integer; y:integer; ori:integer; primary:integer; secondary:integer;
              country:integer; service:integer; mode:char; numeric:integer; data:AnsiString):integer;
              stdcall;external 'WINPPLA.DLL';
    function  A_Bar2d_PDF417(x:integer; y:integer; narrow:integer; width:integer; normal:char;
              security:integer; aspect:integer; row:integer; column:integer; mode:char;
              numeric:integer; data:AnsiString):integer;stdcall;external 'WINPPLA.DLL';
    function  A_Bar2d_PDF417_Ori(x:integer; y:integer; ori:integer; narrow:integer; width:integer;
              normal:char; security:integer; aspect:integer; row:integer; column:integer; mode:char;
              numeric:integer; data:AnsiString):integer;stdcall;external 'WINPPLA.DLL';
    function  A_Bar2d_DataMatrix(x:integer; y:integer; rotation:integer; hor_mul:integer;
              ver_mul:integer; ECC:integer; data_format:integer; num_rows:integer; num_col:integer;
              mode:char; numeric:integer; data:AnsiString):integer;stdcall;external 'WINPPLA.DLL';
    Procedure A_Clear_Memory();stdcall;external 'WINPPLA.DLL';
    Procedure A_ClosePrn();stdcall;external 'WINPPLA.DLL';
    function  A_CreatePrn(selection:integer; filename:AnsiString):integer;stdcall;
              external 'WINPPLA.DLL';
    function  A_Del_Graphic(mem_mode:integer; graphic:AnsiString):integer;stdcall;external 'WINPPLA.DLL';
    function  A_Draw_Box(mode:char; x:integer; y:integer; width:integer; height:integer; top:integer;
              side:integer):integer;stdcall;external 'WINPPLA.DLL';
    function  A_Draw_Line(mode:char; x:integer; y:integer; width:integer; height:integer):integer;
              stdcall;external 'WINPPLA.DLL';
    Procedure A_Feed_Label();stdcall;external 'WINPPLA.DLL';
    function  A_Get_DLL_Version(nShowMessage:integer):PAnsiChar;stdcall;external 'WINPPLA.DLL';
    function  A_Get_DLL_VersionA(nShowMessage:integer):integer;stdcall;external 'WINPPLA.DLL';
    function  A_Get_Graphic(x:integer; y:integer; mem_mode:integer; format:char; filename:AnsiString):integer;
              stdcall;external 'WINPPLA.DLL';
    function  A_Get_Graphic_ColorBMP(x:integer; y:integer; mem_mode:integer; format:char;
              filename:AnsiString):integer;stdcall;external 'WINPPLA.DLL';
    function  A_Get_Graphic_ColorBMPEx(x:integer; y:integer; nWidth:integer; nHeight:integer;
              rotate:integer; mem_mode:integer; format:char; id_name:AnsiString; filename:AnsiString):integer;
              stdcall;external 'WINPPLA.DLL';
    function  A_Get_Graphic_ColorBMP_HBitmap(x:integer; y:integer; nWidth:integer; nHeight:integer;
              rotate:integer; mem_mode:integer; format:char; id_name:AnsiString; hbm:HBITMAP):integer;
              stdcall;external 'WINPPLA.DLL';
    function  A_Initial_Setting(Type_Renamed:integer; Source:AnsiString):integer;stdcall;
              external 'WINPPLA.DLL';
    function  A_WriteData(IsImmediate:integer; pbuf:AnsiString; length:integer):integer;stdcall;
              external 'WINPPLA.DLL';
    function  A_ReadData(pbuf:PAnsiChar; length:integer; dwTimeoutms:integer):integer;stdcall;
              external 'WINPPLA.DLL';
    function  A_Load_Graphic(x:integer; y:integer; graphic_name:AnsiString):integer;stdcall;
              external 'WINPPLA.DLL';
    function  A_Open_ChineseFont(path:AnsiString):integer;stdcall;external 'WINPPLA.DLL';
    function  A_Print_Form(width:integer; height:integer; copies:integer; amount:integer;
              form_name:AnsiString):integer;stdcall;external 'WINPPLA.DLL';
    function  A_Print_Out(width:integer; height:integer; copies:integer; amount:integer):integer;
              stdcall;external 'WINPPLA.DLL';
    function  A_Prn_Barcode(x:integer; y:integer; ori:integer; type_Renamed:char; narrow:integer;
              width:integer; height:integer; mode:char; numeric:integer; data:AnsiString):integer;
              stdcall;external 'WINPPLA.DLL';
    function  A_Prn_Text(x:integer; y:integer; ori:integer; font:integer; type_Renamed:integer;
              hor_factor:integer; ver_factor:integer; mode:char; numeric:integer; data:AnsiString):integer;
              stdcall;external 'WINPPLA.DLL';
    function  A_Prn_Text_Chinese(x:integer; y:integer; fonttype:integer; id_name:AnsiString; data:AnsiString;
              mem_mode:integer):integer;stdcall;external 'WINPPLA.DLL';
    function  A_Prn_Text_TrueType(x:integer; y:integer; FSize:integer; FType:AnsiString; Fspin:integer;
              FWeight:integer; FItalic:integer; FUnline:integer; FStrikeOut:integer; id_name:AnsiString;
              data:AnsiString; mem_mode:integer):integer;stdcall;external 'WINPPLA.DLL';
    function  A_Prn_Text_TrueType_W(x:integer; y:integer; FHeight:integer; FWidth:integer;
              FType:AnsiString; Fspin:integer; FWeight:integer; FItalic:integer; FUnline:integer;
              FStrikeOut:integer; id_name:AnsiString; data:AnsiString; mem_mode:integer):integer;
              stdcall;external 'WINPPLA.DLL';
    function  A_Set_Backfeed(back:integer):integer;stdcall;external 'WINPPLA.DLL';
    function  A_Set_BMPSave(nSave:integer; pstrBMPFName:AnsiString):integer;stdcall;
              external 'WINPPLA.DLL';
    function  A_Set_Cutting(cutting:integer):integer;stdcall;external 'WINPPLA.DLL';
    function  A_Set_Darkness(heat:UINT):integer;stdcall;external 'WINPPLA.DLL';
    function  A_Set_DebugDialog(nEnable:integer):integer;stdcall;external 'WINPPLA.DLL';
    function  A_Set_Feed(rate:char):integer;stdcall;external 'WINPPLA.DLL';
    function  A_Set_Form(formfile:AnsiString; form_name:AnsiString; mem_mode:integer):integer;stdcall;
              external 'WINPPLA.DLL';
    function  A_Set_Margin(position:integer; margin:integer):integer;stdcall;external 'WINPPLA.DLL';
    function  A_Set_Prncomport(baud:integer; parity:integer; data:integer; stop:integer):integer;
              stdcall;external 'WINPPLA.DLL';
    function  A_Set_Prncomport_PC(nBaudRate:integer; nByteSize:integer; nParity:integer;
              nStopBits:integer; nDsr:integer; nCts:integer; nXonXoff:integer):integer;stdcall;
              external 'WINPPLA.DLL';
    function  A_Set_Sensor_Mode(type_Renamed:char; continuous:integer):integer;stdcall;
              external 'WINPPLA.DLL';
    function  A_Set_Speed(speed:char):integer;stdcall;external 'WINPPLA.DLL';
    function  A_Set_Syssetting(transfer:integer; cut_peel:integer; length:integer; zero:integer;
              pause:integer):integer;stdcall;external 'WINPPLA.DLL';
    function  A_Set_Unit(unit_Renamed:char):integer;stdcall;external 'WINPPLA.DLL';
    function  A_Set_Gap(gap:integer):integer;stdcall;external 'WINPPLA.DLL';
    function  A_Set_Logic(logic:integer):integer;stdcall;external 'WINPPLA.DLL';
    function  A_Set_ProcessDlg(nShow:integer):integer;stdcall;external 'WINPPLA.DLL';
    function  A_Set_ErrorDlg(nShow:integer):integer;stdcall;external 'WINPPLA.DLL';
    function  A_Set_LabelVer(centiInch:integer):integer;stdcall;external 'WINPPLA.DLL';
    function  A_GetUSBBufferLen():integer;stdcall;external 'WINPPLA.DLL';
    function  A_EnumUSB(buf:PAnsiChar):integer;stdcall;external 'WINPPLA.DLL';
    function  A_CreateUSBPort(nPort:integer):integer;stdcall;external 'WINPPLA.DLL';
    function  A_CreatePort(nPortType:integer; nPort:integer; filename:AnsiString):integer;stdcall;
              external 'WINPPLA.DLL';
    function  A_Clear_MemoryEx(nMode:integer):integer;stdcall;external 'WINPPLA.DLL';
    Procedure A_Set_Mirror();stdcall;external 'WINPPLA.DLL';
    function  A_Bar2d_RSS(x:integer; y:integer; ori:integer; ratio:integer; height:integer;
              rtype:char; mult:integer; seg:integer; data1:AnsiString; data2:AnsiString):integer;stdcall;
              external 'WINPPLA.DLL';
    function  A_Bar2d_QR_M(x:integer; y:integer; ori:integer; mult:char; value:integer; model:integer;
              error:char; mask:integer; dinput:char; mode:char; numeric:integer; data:AnsiString):integer;
              stdcall;external 'WINPPLA.DLL';
    function  A_Bar2d_QR_A(x:integer; y:integer; ori:integer; mult:char; value:integer; mode:char;
              numeric:integer; data:AnsiString):integer;stdcall;external 'WINPPLA.DLL';
    function  A_GetNetPrinterBufferLen():integer;stdcall;external 'WINPPLA.DLL';
    function  A_EnumNetPrinter(buf:PAnsiChar):integer;stdcall;external 'WINPPLA.DLL';
    function  A_CreateNetPort(nPort:integer):integer;stdcall;external 'WINPPLA.DLL';
    function  A_Prn_Text_TrueType_Uni(x:integer; y:integer; FSize:integer; FType:AnsiString; Fspin:integer;
              FWeight:integer; FItalic:integer; FUnline:integer; FStrikeOut:integer; id_name:AnsiString;
              data:PWideChar; format:integer; mem_mode:integer):integer;stdcall;external 'WINPPLA.DLL';
    function  A_Prn_Text_TrueType_UniB(x:integer; y:integer; FSize:integer; FType:AnsiString; Fspin:integer;
              FWeight:integer; FItalic:integer; FUnline:integer; FStrikeOut:integer; id_name:AnsiString;
              data:PWideChar; format:integer ; mem_mode:integer):integer;stdcall;external 'WINPPLA.DLL';
    function  A_GetUSBDeviceInfo(nPort:integer; pDeviceName:PAnsiChar; pDeviceNameLen:PInteger;
              pDevicePath:PAnsiChar; pDevicePathLen:PInteger):integer;stdcall;external 'WINPPLA.DLL';
    function  A_Set_EncryptionKey(encryptionKey:AnsiString):integer;stdcall;external 'WINPPLA.DLL';
    function  A_Check_EncryptionKey(decodeKey:AnsiString; encryptionKey:AnsiString;
              dwTimeoutms:integer):integer;stdcall;external 'WINPPLA.DLL';

procedure TForm1.Button1Click(Sender: TObject);
var
     ret,nLen,sw : integer;
     pbuf : array[0..127] of AnsiChar;
     ver : PAnsiChar;
     strmsg : string;
     len1,len2 : integer;
     buf1,buf2 : AnsiString;
     buff1 : array[0..127] of WideChar;
     himage : HBITMAP;
begin
     // Test code start
     // open port.
     // dll version.
     ver := A_Get_DLL_Version(0);

     // search port.
     nLen := A_GetUSBBufferLen() + 1;
     strmsg := 'DLL ' + ver + dpCrLf;   // only sample coding, not smart.
     If nLen > 1 then
     begin
         len1 := 128;
         len2 := 128;
         SetLength(buf1,len1);
         SetLength(buf2,len2);
         A_EnumUSB(pbuf);
         A_GetUSBDeviceInfo(1, PAnsiChar(buf1), @len1, PAnsiChar(buf2), @len2);
         sw := 1;
         If 0 < sw then
                ret := A_CreatePrn(12, PAnsiChar(buf2)) // open usb.
         else
                ret := A_CreateUSBPort(1); // must call A_GetUSBBufferLen() function fisrt.
         If 0 < ret then
             strmsg := strmsg + 'Open USB fail!'
         else
         begin
             SetLength(buf1,len1);
             SetLength(buf2,len2);
             strmsg := strmsg + 'Open USB:' + dpCrLf+ 'Device name: ';
             strmsg := strmsg + buf1;
             strmsg := strmsg + dpCrLf+ 'Device path: ';
             strmsg := strmsg + buf2;
             //sw := 2;
             If 2 = sw then
             begin
                //get printer status.
                pbuf[0] := #$01;
                pbuf[1] := #$46;
                pbuf[2] := #$0D;
                pbuf[3] := #$0A;
                A_WriteData(1, pbuf, 4);   //<SOH>F
                ret := A_ReadData(pbuf, 2, 1000);
             end;
         end;
     end
     else
     begin
         CreateDirectory(PChar(szSavePath), nil);
         ret := A_CreatePrn(0, szSaveFile);   // open file.
         strmsg := strmsg + 'Open ' + szSaveFile;
         if 0 < ret then
             strmsg := strmsg + ' file fail!'
         else
             strmsg := strmsg + ' file succeed!';
     end;
     ShowMessage(strmsg);
     If 0 < ret then
         exit;

     // sample setting.
     A_Set_DebugDialog(1);
     A_Set_Unit('n');
     A_Set_Syssetting(1, 0, 0, 0, 0);
     A_Set_Darkness(8);
     A_Del_Graphic(1, '*');   // delete all picture.
     A_Clear_Memory();   // clear memory.
     A_WriteData(0, sznop2, StrLen(PAnsiChar(sznop2)));
     A_WriteData(1, sznop1, StrLen(PAnsiChar(sznop1)));

     // draw box.
     A_Draw_Box('A', 10, 10, 380, 280, 4, 4);
     A_Draw_Line('A', 200, 10, 4, 280);

     // print text, true type text.
     A_Prn_Text(20, 30, 1, 2, 0, 1, 1, 'N', 2, 'PPLA Lib Example');
     A_Prn_Text_TrueType(20, 60, 30, 'Arial', 1, 400, 0, 0, 0, 'AA', 'TrueType Font', 1);   // save in ram.
     A_Prn_Text_TrueType_W(20, 90, 20, 20, 'Times New Roman', 1, 400, 0, 0, 0, 'AB', 'TT_W: 多字元測試', 1);

     StringToWideChar('TT_Uni: 多字元測試', buff1, 128);  // Converts double-byte characters to UNICODE(wide characters).
     buff1[13] := #$0000;   // null.
     A_Prn_Text_TrueType_Uni(20, 120, 30, 'Times New Roman', 1, 400, 0, 0, 0, 'AC', buff1, 1, 1);   // UTF-16

     buff1[0] := #$FEFF;   // UTF-16.
     StringToWideChar('TT_UniB: 多字元測試', buff1+1, 128);  // Converts double-byte characters to UNICODE(wide characters).
     buff1[15] := #$0000;   // null.
     A_Prn_Text_TrueType_UniB(20, 150, 30, 'Times New Roman', 1, 400, 0, 0, 0, 'AD', buff1, 0, 1);   // Byte Order Mark.

     // barcode.
     A_Prn_Barcode(220, 60, 1, 'A', 0, 0, 20, 'B', 1, '1234');
     A_Bar2d_QR_A(220, 100, 1, '3', 10, 'N', 0, 'QR CODE');

     // picture.
     A_Get_Graphic_ColorBMP(220, 150, 1, 'B', 'bb.bmp');   // Color bmp file to ram.
     A_Get_Graphic_ColorBMPEx(220, 170, 200, 150, 2, 1, 'B', 'bb1', 'bb.bmp');//180 angle.
     himage := LoadImage(0,'bb.bmp',IMAGE_BITMAP,0,0,LR_LOADFROMFILE);
     A_Get_Graphic_ColorBMP_HBitmap(300, 150, 250, 80, 1, 1, 'B', 'bb2', himage);//90 angle.
     If 0 <> himage then
         DeleteObject(himage);

     // output.
     A_Print_Out(1, 1, 2, 1);   // copy 2.

     // close port.
     A_ClosePrn();
end;

end.

I run it and the function A_GetUSBBufferLen() always returns 0 showing the following message:

That's the question. Why A_GetUSBBufferLen() didn't work? Did I forget something?


text:
Q: Adobe CQ5 : Dialog can store to a location but not retrieve properties from that location I have a dialog which is storing to a jcr:content level node, and that side is working OK. But when the user re-opens the dialog, it is empty (so original values can not be seen or deleted).
Has anyone had any success in populating the dialog field with the values already stored at that address?
For better/easier user experience, I am using a tag field on the author interface, rather than in page properties dialog, but want to store to the page props.
NB: This seems to be default behaviour of the out of the box Title component (Dialog "title" field is always empty).
Possibly a bug?

A: Found on Adobe Forums site:
https://forums.adobe.com/thread/1255836
Edited to use "loadcontent" as beforeloadcontent listener was not firing.
edited string munging using pop etc, as it was horrible, but here is the original code which got my tags into the dialog box.
Thanks to Rush Pawan
loadcontent="function(field, record, path) {
                                var targetField=field.getName().replace('../../','./');
                                var pathParts = path.split('/');
                                pathParts.pop();
                                pathParts.pop();
                                var jcrContentPath = pathParts.join('/');
                                var response = CQ.utils.HTTP.get(jcrContentPath +'.json');
                                eval('var data ='+response.responseText);
                                var originalPropName='cq:tags';
                                if(data[originalPropName]!=undefined){
                                    var originalPropVal=data[originalPropName];
                                    this.setValue(originalPropVal);
                                    return false;
                                }
                            }"


text:
Q: Transparent border is of white color See the fiddle: http://jsfiddle.net/vs32rb9w/
Why is there an 1px white border if i explicitly said border-color: transparent?
I checked that both in Chrome and FireFox - the border is white instead of being transparent.
And it becomes transparent - guess what - when I remove the background property (or make it transparent too).
Such a nasty bug?

A: After checking and making your collapsed div bigger, I realized what the problem was. The border is transparent, but its width is specified and the height is too small to differentiate from the background. The border is transparent, you just can't see it!

A: The border is transparent. Since you've set a border width, the model dictates that the height of the div is 1px. Then, since the bg color is set, it is showing. If you remove the background color then the div is still 1px, but the border is transparent so you don't see it with your eyes.


text:
Q: Pip install matplotlib fails on M1 Mac I'm having difficulties installing matplotlib through pip on my M1 Mac. I have Python 3.9.1 installed through Homebrew.
When running pip3 install matplotlib the installer tries installing the newest version, matplotlib 3.3.4. The installer gets stuck and prints a huge error message after some time. After this it tries installing version 3.3.3 after which the same happens again, and so on. What goes wrong?
Here is some of the error message:
    william@Williams-MacBook-Pro ~ % pip3 install matplotlib
Collecting matplotlib
  Using cached matplotlib-3.3.4.tar.gz (37.9 MB)
    ERROR: Command errored out with exit status 1:
     command: /opt/homebrew/opt/python@3.9/bin/python3.9 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/yb/rgjfc7ws25ddwd07x96f4fmw0000gn/T/pip-install-h7oltt2f/matplotlib_1ad1e28a38b14b40ae2bcaa7f9b01cab/setup.py'"'"'; __file__='"'"'/private/var/folders/yb/rgjfc7ws25ddwd07x96f4fmw0000gn/T/pip-install-h7oltt2f/matplotlib_1ad1e28a38b14b40ae2bcaa7f9b01cab/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/yb/rgjfc7ws25ddwd07x96f4fmw0000gn/T/pip-pip-egg-info-0jjax4jc
         cwd: /private/var/folders/yb/rgjfc7ws25ddwd07x96f4fmw0000gn/T/pip-install-h7oltt2f/matplotlib_1ad1e28a38b14b40ae2bcaa7f9b01cab/
    Complete output (2287 lines):
      ERROR: Command errored out with exit status 1:
       command: /opt/homebrew/opt/python@3.9/bin/python3.9 /opt/homebrew/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py build_wheel /var/folders/yb/rgjfc7ws25ddwd07x96f4fmw0000gn/T/tmp3p0is_vc
           cwd: /private/var/folders/yb/rgjfc7ws25ddwd07x96f4fmw0000gn/T/pip-wheel-5rqmhbah/numpy_cefeff1e3acc4faea4c06d0f4597b2da

A: *

*Install Miniforge for arm64 (Apple Silicon)latest installer here: installer here

*Now create a conda environment for whatever version you have (I'm running 3.9.2)
conda create -n cenv python=3.9.2
conda activate cenv
conda install matplotlib

You will drive yourself nuts trying to get all the different packages working if you try to go from wheels/pip, at time of writing.

A: python3 -m pip install cython
python3 -m pip install --no-binary :all: --no-use-pep517 numpy
brew install libjpeg
python3 -m pip install matplotlib

Worked for me, at this time it installed numpy 1.20.1.
Same Python version (3.9.1) from Homebrew.

A: Trying to install matplotlib on my M1 Macbook (Big Sur 11.6, python 3.9.7), I was getting:
Invalid configuration `arm64-apple-darwin20.6.0': machine `arm64-apple' not recognized`

I was able to resolve the issue and install matplotlib with help from this comment: https://github.com/matplotlib/matplotlib/issues/20661#issuecomment-889189712
Summary:
$ cat <<EOF > setup.cfg
[libs]
system_freetype = True
EOF
$ export MPLSETUPCFG=$PWD/setup.cfg
$ python -m pip install matplotlib


text:
Q: Stack Overflow error in Repository MVVM architecture I want to implement MVVM using Room db to my app. I followed this link https://codelabs.developers.google.com/codelabs/android-room-with-a-view/index.html?index=..%2F..index#13
I was getting an error to create an instance of view model. As I solved that I have ended up with new error as below :
     Process: com.example.dailyfaithapp, PID: 7341
    java.lang.StackOverflowError: stack size 8192KB
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
2020-04-28 18:10:23.865 7341-7341/com.example.dailyfaithapp E/AndroidRuntime:     at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
2020-04-28 18:10:29.491 7341-7356/com.example.dailyfaithapp I/e.dailyfaithap: Background concurrent copying GC freed 395507(38MB) AllocSpace objects, 1(3804KB) LOS objects, 5% free, 95MB/101MB, paused 337us total 142.457ms
2020-04-28 18:10:29.720 7341-7341/com.example.dailyfaithapp I/chatty: uid=10141(com.example.dailyfaithapp) identical 8100 lines
2020-04-28 18:10:29.720 7341-7341/com.example.dailyfaithapp E/AndroidRuntime:     at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
2020-04-28 18:10:29.720 7341-7341/com.example.dailyfaithapp E/AndroidRuntime:     at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.Repositories.FavouriteRepository.getAllFavourites(FavouriteRepository.java:25)
        at com.example.dailyfaithapp.ViewModels.FavouritesViewModel.<init>(FavouritesViewModel.java:26)
        at com.example.dailyfaithapp.FavouritesViewModelFactory.create(FavouritesViewModelFactory.java:25)
        at androidx.lifecycle.ViewModelProvider.get(ViewModelProvider.java:187)
        at androidx.lifecycle.ViewModelProvider.get(ViewModelProvider.java:150)
        at com.example.dailyfaithapp.Activities.FavouritesActivity.setUpUI(FavouritesActivity.java:72)
        at com.example.dailyfaithapp.Activities.FavouritesActivity.onCreate(FavouritesActivity.java:54)
        at android.app.Activity.performCreate(Activity.java:7802)
        at android.app.Activity.performCreate(Activity.java:7791)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1299)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3245)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3409)
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2016)
        at android.os.Handler.dispatchMessage(Handler.java:107)
        at android.os.Looper.loop(Looper.java:214)
        at android.app.ActivityThread.main(ActivityThread.java:7356)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)

I tried to increase heap size of the project, this is the  max i can increase
org.gradle.jvmargs=-Xmx2048M -Dkotlin.daemon.jvm.options\="-Xmx2048M"

Here is my view model
public class FavouritesViewModel extends AndroidViewModel {

        public FavouriteRepository mRepository;

        public LiveData<List<Favourites>> mAllFavourites;
        private MutableLiveData<List<Favourites>> favouriteSearchResults;

        public FavouritesViewModel (Application application) {
                super(application);
                mRepository = new FavouriteRepository(application);
                mAllFavourites = mRepository.getAllFavourites();
                favouriteSearchResults = mRepository.getFavouritesSearch();
        }
        public LiveData<List<Favourites>> getmAllFavourites() { return mAllFavourites; }

}

Repositry
public class FavouriteRepository {

    private MutableLiveData<List<Favourites>> favouritesSearch =
            new MutableLiveData<>();

    private LiveData<List<Favourites>> allFavourites;

    public LiveData<List<Favourites>> getAllFavourites() {
        return getAllFavourites();
    }

    public MutableLiveData<List<Favourites>> getFavouritesSearch() {
        return getFavouritesSearch();
    }
}

View Model factory
public class FavouritesViewModelFactory implements ViewModelProvider.Factory {
    private Application mApplication;
    private String mParam;

    public FavouritesViewModelFactory(Application application) {
        mApplication = application;
    }

    @Override
    public <T extends ViewModel> T create(Class<T> modelClass) {
        return (T) new FavouritesViewModel(mApplication);
    }
}

Database
@Database(entities = {Favourites.class}, version = 1, exportSchema = false)
public  abstract class FavouritesDatabase extends RoomDatabase {

        public abstract FavouritesDAO favouritesDAO();

        private static FavouritesDatabase INSTANCE;

        public static FavouritesDatabase getFavouritesDatabase(final Context context) {
            if (INSTANCE == null) {
                synchronized (FavouritesDatabase.class) {
                    if (INSTANCE == null) {
                        INSTANCE =
                                Room.databaseBuilder(
                                        context.getApplicationContext(),
                                        FavouritesDatabase.class,
                                        "favourites_database"
                                ).build();
                    }
                }
            }
            return INSTANCE;
        }
}

DAO
@Dao
public interface FavouritesDAO {

        @Query("SELECT * FROM favourites")
        LiveData<List<Favourites>> getAllFavourites();

        @Query("SELECT * FROM favourites")
        List<Favourites> loadAllFavorites();

        @Insert(onConflict = OnConflictStrategy.REPLACE)
        void insertAllFavourites(Favourites... favourites);

        @Insert(onConflict = OnConflictStrategy.REPLACE)
        public void insertFavourite(Favourites favourites);

        @Delete
        void delete(Favourites favourites);
}

As I debug I saw that the getAllFavourites() of repository method is getting called continuous and becase of that memory is getting full.
Here is my activity,
    public void setUpUI(){

        recyclerView = findViewById(R.id.recycler_view_favourites);
        constraintLayoutEmpty = findViewById(R.id.constraint_empty);
        imageViewBack = findViewById(R.id.imageView_back);

        imageViewBack.setOnClickListener(this);

        favouritesViewModel = new ViewModelProvider(this,
                new FavouritesViewModelFactory(getApplication())).get(FavouritesViewModel.class);

        favouritesViewModel.getmAllFavourites().observe(this,
                new Observer<List<Favourites>>() {
            @Override
            public void onChanged(@Nullable final List<Favourites> products) {

                favouritesArrayList = products;
            }
        });
}

setUpUI is called on onCreate of an activity.
Please help. Thank you.

A: In FavouriteRepository you are doing:
public LiveData<List<Favourites>> getAllFavourites() {
    return getAllFavourites();
}

Is this method calling itself.
You have to see what you need to get here instead of calling itself.
I think you have the same problem in the next method:
public MutableLiveData<List<Favourites>> getFavouritesSearch() {
    return getFavouritesSearch();
}

You need to fix those.


text:
Q: Creating threads that copy the arguments passed to them I'm currently using boost::thread, because it very conveniently allows me to pass an arbitrary number of arguments to the thread and copies them along the way, so I don't have to worry about them being deleted before the thread launches. Is there any other library that allows this, or a way to simulate it using pthreads? I'd like to wean myself off of boost, but I've never seen any other library do this.

A: I don't remember the details of Boost.Thread, but the general idea is something like this:
class thread_function_base
{
public:
    virtual ~thread_function_base(void) {}
    virtual void run(void) = 0;
};

template <typename Func>
class thread_function_0 : public thread_function_base
{
public:
    thread_function_0(const Func& pFunc) :
    mFunc(pFunc)
    {}

    void run(void)
    {
        mFunc();
    }

private:
    Func mFunc;
};

template <typename Func, typename A0>
class thread_function_1 : public thread_function_base
{
public:
    thread_function_1(const Func& pFunc, const A0& pA0) :
    mFunc(pFunc),
    mA0(pA0)
    {}

    void run(void)
    {
        mFunc(mA0);
    }

private:
    Func mFunc;
    A0 mA0;
};

// and so on to some limit, either
// generated either by hand (yuck), by
// Boost.PP (phew), or by C++0x's
// variadic templates (yay, no limit either)

class thread
{
public:
    template <typename Func>
    thread(const Func& pFunc)
    {
        std::auto_ptr<thread_function_base>
            threadFunc(new thread_function_0<Func>(pFunc));

        create_thread(threadFunc);
    }

    template <typename Func, typename A0>
    thread(const Func& pFunc, const A0& pA0)
    {
        std::auto_ptr<thread_function_base>
            threadFunc(new thread_function_1<Func, A0>(pFunc, pA0));

        create_thread(threadFunc);
    }

    // again, needs to be generated somehow

private:
    // noncopyable
    thread(const thread&);
    thread& operator=(const thread&);

    // signature needs to match implementations expectations:
    static void thread_function(void* pUserData)
    {
        std::auto_ptr<thread_function_base>
            pFunc(static_cast<thread_function_base*>(pUserData));

        // (A)

        pFunc->run();
    }

    void create_thread(std::auto_ptr<thread_function_base>& pThreadFunc)
    {
        // again, implementation specific function:
        if (create_thread(&thread_function, pThreadFunc.get(), ...))
        {
            // failed, do something (and return),
            // auto_ptr in constructor will free resources
            return;
        }

        // thread was created, so it now owns that resource
        pThreadFunc.release();

        // (B)
    }
};

Basically, everything needed to invoke the thread is copied into some dynamically allocated container, a pointer to that dynamic container is passed into the thread function (trivial), then ownership is transferred from outside the thread to inside.
You can make things safer by packing not only the thread_function_base into the user data, but also a (implementation-specific) signal handle. The threading function will block at (A) until the signal is raised at (B), indicated the main thread has given the worker thread full ownership of the resources. (And from there it's auto_ptr will eventually delete it.)
And so on, making it more sophisticated.

A: You would have to create a wrapper around pthread_create and pass in thread specific storage to pthread_create that contains an array of arguments, for example.  The wrapper would use form such as:
void *mythreadfunction(void *arg) {...}

pthread_create_wrapper(context ctx, ...) {
   Array *arr;
   pthread_t mythread;

   arr = new Array();

   // push arguments to array here
   blah blah ...
   // create thread and pass in argument list as thread data pointer.
   pthread_create(&mythread, NULL, mythreadfunction, (void *)arr);
}


text:
Q: How to install Chutzpah Test Adapter for the Test Explorer - version 3.2.6 in visual studio 2013 I tried searching all over the internet, but I couldn't find how to install Chutzpah Test Adapter for the Test Explorer version 3.2.6 for visual studio 2013. In Visual studio Extensions and Updates settings, I am able to see the latest version (4.0.1).
Any idea where I can get Chutzpah test Adapter 3.2.6 version?

A: You can find an older version of the VSIX here (https://github.com/mmanela/chutzpah/releases/tag/v3.3.1). This is version 3.3.1 which hopefully is good enough.


text:
Q: Why in my RelativeLayout the button gets partially hidden? This is part of my Layout:
<RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content" >

            <TextView
                android:id="@+id/name"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentLeft="true"
                android:text="Large Text"
                android:textAppearance="@style/LargeText" />

            <Button
                android:id="@+id/editname"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignBaseline="@+id/name"
                android:layout_alignParentRight="true"
                android:text="Edit"
                android:textAppearance="@style/LargeText" />
        </RelativeLayout>

In the result as you can see,

the Button gets partially hidden.
Please how do I solve this?
However,
this is the full layout:
 <?xml version="1.0" encoding="utf-8"?>
 <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <!-- Dummy item to prevent AutoCompleteTextView from receiving focus -->

    <LinearLayout
        android:layout_width="0px"
        android:layout_height="0px"
        android:focusable="true"
        android:focusableInTouchMode="true" />

    <com.google.android.gms.ads.AdView
        android:id="@+id/adView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        ads:adSize="SMART_BANNER"
        ads:adUnitId="xxxxxxxxxxxxxxxxx" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        android:padding="@dimen/updatetrackerativty_padding" >

        <View
            android:layout_width="match_parent"
            android:layout_height="@dimen/updatetrackerativty_space"
            android:background="@android:color/transparent" />

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content" >

            <TextView
                android:id="@+id/name"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentLeft="true"
                android:text="Large Text"
                android:textAppearance="@style/LargeText" />

            <Button
                android:id="@+id/editname"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignBaseline="@+id/name"
                android:layout_alignParentRight="true"
                android:text="Edit"
                android:textAppearance="@style/LargeText" />
        </RelativeLayout>

        <View
            android:layout_width="match_parent"
            android:layout_height="@dimen/updatetrackerativty_space"
            android:background="@android:color/transparent" />

        <View
            android:layout_width="match_parent"
            android:layout_height="1dp"
            android:background="@android:color/black" />

        <View
            android:layout_width="match_parent"
            android:layout_height="@dimen/updatetrackerativty_space"
            android:background="@android:color/transparent" />

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content" >

            <LinearLayout
                android:id="@+id/phonelayout"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                android:layout_alignParentLeft="true" >

                <TextView
                    android:id="@+id/textView1"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Phone Number"
                    android:textAppearance="@style/LargeText" />

                <TextView
                    android:id="@+id/phone"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Medium Text"
                    android:textAppearance="@style/SmallText" />
            </LinearLayout>

            <LinearLayout
                android:id="@+id/buttonlayout"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                android:layout_alignParentRight="true"
                android:layout_alignBaseline="@+id/phonelayout">

                <Button
                    android:id="@+id/editphone"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignParentRight="true"
                    android:text="Edit"
                    android:textAppearance="@style/LargeText" />
            </LinearLayout>
        </RelativeLayout>

        <View
            android:layout_width="match_parent"
            android:layout_height="@dimen/updatetrackerativty_space"
            android:background="@android:color/transparent" />

        <View
            android:layout_width="match_parent"
            android:layout_height="1dp"
            android:background="@android:color/black" />

        <View
            android:layout_width="match_parent"
            android:layout_height="@dimen/updatetrackerativty_space"
            android:background="@android:color/transparent" />

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical" >

            <TextView
                android:id="@+id/textView4"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Continuous Tracking"
                android:textAppearance="@style/LargeText" />

            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content" >

                <CheckBox
                    android:id="@+id/continuousckbx"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignParentLeft="true"
                    android:text="Yes"
                    android:textAppearance="@style/SmallText" />

                <TextView
                    android:id="@+id/secondstextview"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignBaseline="@+id/continuousckbx"
                    android:layout_alignParentRight="true"
                    android:text="seconds"
                    android:textAppearance="@style/SmallText" />

                <LinearLayout
                    android:id="@+id/seconds"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignParentTop="true"
                    android:layout_toLeftOf="@+id/secondstextview"
                    android:orientation="vertical" >

                    <EditText
                        android:id="@+id/intervaledittext"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:ems="3"
                        android:nextFocusLeft="@id/intervaledittext"
                        android:nextFocusUp="@id/intervaledittext"
                        android:numeric="integer" >
                    </EditText>

                    <TextView
                        android:id="@+id/thirtyand"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="(30-255)"
                        android:textAppearance="@style/SmallText" />
                </LinearLayout>

                <TextView
                    android:id="@+id/intervaltextview"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignBaseline="@+id/continuousckbx"
                    android:layout_alignBottom="@+id/continuousckbx"
                    android:layout_toLeftOf="@+id/seconds"
                    android:text="Interval:"
                    android:textAppearance="@style/SmallText" />
            </RelativeLayout>
        </LinearLayout>

        <View
            android:layout_width="match_parent"
            android:layout_height="@dimen/updatetrackerativty_space"
            android:background="@android:color/transparent" />

        <View
            android:layout_width="match_parent"
            android:layout_height="1dp"
            android:background="@android:color/black" />

        <View
            android:layout_width="match_parent"
            android:layout_height="@dimen/updatetrackerativty_space"
            android:background="@android:color/transparent" />

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical" >

            <TextView
                android:id="@+id/TextView03"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Record data"
                android:textAppearance="@style/LargeText" />

            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content" >

                <CheckBox
                    android:id="@+id/recorddata"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignParentLeft="true"
                    android:text="Yes"
                    android:textAppearance="@style/SmallText" />
            </RelativeLayout>
        </LinearLayout>

        <View
            android:layout_width="match_parent"
            android:layout_height="@dimen/updatetrackerativty_space"
            android:background="@android:color/transparent" />

        <View
            android:layout_width="match_parent"
            android:layout_height="1dp"
            android:background="@android:color/black" />

        <View
            android:layout_width="match_parent"
            android:layout_height="@dimen/updatetrackerativty_space"
            android:background="@android:color/transparent" />

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical" >

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="History"
                android:textAppearance="@style/LargeText" />

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="right"
                android:orientation="horizontal" >

                <Button
                    android:id="@+id/plot"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_toLeftOf="@+id/clear"
                    android:text="Plot"
                    android:textAppearance="@style/LargeText" />

                <Button
                    android:id="@+id/clear"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignParentRight="true"
                    android:text="Clear"
                    android:textAppearance="@style/LargeText" />
            </LinearLayout>
        </LinearLayout>

        <View
            android:layout_width="match_parent"
            android:layout_height="@dimen/updatetrackerativty_space"
            android:background="@android:color/transparent" />

        <View
            android:layout_width="match_parent"
            android:layout_height="1dp"
            android:background="@android:color/black" />

        <View
            android:layout_width="match_parent"
            android:layout_height="@dimen/updatetrackerativty_space"
            android:background="@android:color/transparent" />

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical" >

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Status"
                android:textAppearance="@style/LargeText" />

            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content" >

                <Button
                    android:id="@+id/activate"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignParentRight="true"
                    android:text="Activate"
                    android:textAppearance="@style/LargeText" />

                <TextView
                    android:id="@+id/status"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignBaseline="@+id/activate"
                    android:text="Inactive"
                    android:textAppearance="@style/SmallText"
                    android:textStyle="bold" />
            </RelativeLayout>
        </LinearLayout>
    </LinearLayout>
</LinearLayout>

</ScrollView>

A: Because you align your Edit Button with your name TextView Baseline , your TextView Baseline depends on it's content and height so in this case your first row has less height than your second so it's baseline is upper than second , because of this your Edit Button will align upper and it's height will cover by ceiling View. you can remove alignBaseline part and use android:layout_centerVertical="true"

A: Try this.
<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content" >

    <TextView
        android:id="@+id/name"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:text="Large Text"
        android:textAppearance="@style/LargeText" />

    <Button
        android:id="@+id/editname"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:text="Edit"
        android:textAppearance="@style/LargeText" />
</RelativeLayout>

A: remove below line on xml:-
            android:layout_alignBaseline="@+id/name"


text:
Q: Rendering Bitmap goes out of memory in WPF (Out of memory exception) Framework : .NET 3.5
Technology: WPF
While using RenderTargetBitmap.Render(Canvas), the canvas contains roughly 40-50 images. The rendering says OutOfMemoryException. Any possible resolution available?
I'm aware of CachedComposition from .NET 4.0, but since this is a lower framework - any equivalents available?

A: I think the problem is your canvas's size is too large or dpiX/dpiY used to render is over an acceptable threshold (it depends on RAM capacity of your computer). The default dpi is 96.


text:
Q: How to change the color scheme of CDateTimeCtrl in MFC? I need to change the colors of the background, the text, the color of the dropdown button of
CDateTimeCtrl in MFC. I created new class derived from CDateTimeCtrl and tried overwritten OnCtlColor and CtlColor, but these functions are never called (the message map has been added using the Class Wizard). How should I achieve this without writing a completely new datetimectrl class of my own?

A: You can try something like this:
// header
CBrush* m_pBkgBrush { nullptr };
COLORREF m_bkgColor { RGB(255, 255, 255) };

COLORREF SetBackgroundColor(BOOL bSysColor, COLORREF cr);

and implementation now:
CYourDateTimeCtrl::CYourDateTimeCtrl()
    : CDateTimeCtrl()
    , m_bkgColor(::GetSysColor(COLOR_WINDOW))
{
    m_pBkgBrush = new CBrush(::GetSysColor(COLOR_WINDOW));
}

CYourDateTimeCtrl::~CYourDateTimeCtrl()
{
    if (nullptr != m_pBkgBrush)
        delete m_pBkgBrush;
}

COLORREF CYourDateTimeCtrl::SetBackgroundColor(BOOL bSysColor, COLORREF cr)
{
    COLORREF color = m_bkgColor;
    m_bkgColor = bSysColor ? ::GetSysColor(COLOR_WINDOW) : cr;

    if (color != m_bkgColor)
    {
        delete m_pBkgBrush;
        m_pBkgBrush = new CBrush(m_bkgColor);
            Invalidate();
    }

    return color;
}

BOOL CYourDateTimeCtrl::OnEraseBkgnd(CDC* pDC)
{
    CBrush* pOldBrush = pDC->SelectObject(m_pBkgBrush);
    CRect rect;
    pDC->GetClipBox(&rect);
    pDC->PatBlt(rect.left, rect.top, rect.Width(), rect.Height(), PATCOPY);
    pDC->SelectObject(pOldBrush);
    return TRUE;
}

When you use, you do:
MyMonthCalCtrl.SetBackgroundColor(FALSE, RGB(255, 255, 0));

I hope it helps.


text:
Q: Что содержится в строке ? выводит пустоту Код:
char s = "some_text";

и как ее вывести?
  printf("%s", s);

Я пробовал использовать другие способы задания строки, но сейчас мне удобно использовать этот(наверное), да и узнать самому хочется как работать с подобной строкой.

A: Строки в Си это массив символов заканчивающийся терминальным нолём. Один char это один символ:
#include <stdio.h>

int main(int argc, char *argv[])
{
    char c = 'A';

    printf("Output: %c\n", c);

    return 0;
}

Создавать и выводить строку в Си можно таким способом:
#include <stdio.h>

int main(int argc, char *argv[])
{
    // Создаем массив символов с завершающим терминальным нолём '\0'
    char s[10] = "some_text";

    // Выводим строку в консоль
    printf("Output: %s\n", s);

    return 0;
}

Или так:
#include <stdio.h>

int main(int argc, char *argv[])
{
    char s[10] = {'s', 'o', 'm', 'e', '_', 't', 'e', 'x', 't', '\0'};

    printf("Output: %s\n", s);

    return 0;
}


text:
Q: Mozilla extension doc.referrer is not showing correct resilts I am developing Mozilla Extension (Legacy extensions) by using XUL. In this
window
        .addEventListener(
                "load",
                function(event) {
                    (function(loader) {
                        loader
                                .loadSubScript("chrome://cashbackurl/content/jquery-1.11.3.min.js");
                    })
                            (Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
                                    .getService(Components.interfaces.mozIJSSubScriptLoader));

                    // Your code goes
                    myExtension.init();

                }, false);

var myExtension = {
    init : function() {
        // The event can be DOMContentLoaded, pageshow, pagehide, load or
        // unload.
        if (gBrowser)
            gBrowser.addEventListener("DOMContentLoaded", this.onPageLoad,
                    false);
    },
    onPageLoad : function(aEvent) {
        doc = aEvent.originalTarget; // doc is document that triggered
        // the event
        var win = doc.defaultView; // win is the window for the doc
        // test desired conditions and do something
        // if (doc.nodeName != "#document") return; // only documents
        // if (win != win.top) return; //only top window.
        // if (win.frameElement) return; // skip iframes/frames
        // alert("page is loaded \n" + doc.location.href);
        if (win.top == win.self) {
            cburl.getDataLoder();
        }
    }
}

Here I am using "doc" element to get referrer of current url. I tried by using doc.referrer but I am not getting correct referrer. Any once suggest me how to resolve this issue.
Thank you.


text:
Q: sizeof((int)(float)(char)i)) when int is defined (int)(float)(char) i; #include<stdio.h>
double i;

int main()
{
    (int)(float)(char) i;
    printf("%d", sizeof((int)(float)(char)i));
    return 0;
}

The above outputs 4 on a Micrsoft compiler. Why?

A: sizeof is the size, in bytes, of the variable. In this case, i is being cast to an int which is 4 bytes.
These are the sizes of types on MS C++: http://msdn.microsoft.com/en-us/library/cc953fe1(v=vs.71).aspx

A: The last cast operation is to int, so u will get the sizeOf(int). Integer size differes form compiler to another, some return 2-bytes and onther return 4-bytes.

A: sizeof something tells you how many bytes it takes up in memory. Your platform and toolchain clearly has 32-bit integers; it's telling you that int, on your toolchain (compiler), takes up 4 bytes.


text:
Q: Animate transition on multiple objects with a single animation in KnockoutJS I use KnockoutJS 2.1 for a news application I'm currently working on. I've created a 4 by 2 grid, presenting 8 news articles at a time (see image below).

I've added paging to this grid, so when you click on the next-button, 8 new news-articles are presented. This works perfectly fine! However, what I would like is to add an animation to the transition, so when you click Next, 8 new articles slide in from the right hand side, pushing the previous 8 articles out of the screen to the left. Something like this:

I've seen the example on the Knockout website, using afterAdd and beforeRemove to apply animated transitions using jQuery. The problem with this approach is that the animation is applied to each individual news article. I need to animate all articles at the same time, with a single animation.
The idea I have, is that I would use a wrapper-element around all 8 news articles, with overflow: hidden. I could then add 8 new articles to the right of the current articles, the new articles would still be out of sight due to the hidden overflow. I could then slide all 16 articles to the left, so that the new articles are visible instead, and the old articles are out of sight to the left. I could then remove the 8 old articles from the DOM.
I'm not sure if that is even possible with Knockout, or if there might be a better approach to take.
How would you animate the transition of 8 articles being added to the DOM and 8 articles being removed from the DOM, through a single animation?

A: Could your Knockout template add them in groups of 8 to an overall container, then you animate the container left or right the width of a group? Something like this:

Title 1

Title 2

Title 3

    ...

Title 8

Title 9

Title 10

Title 11

    ...

Title 16


text:
Q: Can CRM Online 2013 use the CRM 2015 Email Router? Currently I'm using Microsoft Dynamics® CRM Online Spring '14
(6.1.3.119) (DB 6.1.1.1847) and we have installed the CRM Email router 2013, we are planning to upgrade to Dynamics CRM 2015.
Can I upgrade the CRM Email Router 2013 to 2015 while using Dynamics CRM Spring 14?
I found a link to do that(https://technet.microsoft.com/en-us/library/dn531069.aspx#BKMK_Upgrade2013) but it doesn't say if is backwards compatible also the link to downoad the Email Router 2015 says you need "Microsoft Dynamics CRM 2015" https://www.microsoft.com/en-us/download/details.aspx?id=45017

A: After waiting for some help I decided to answer my own question by installing  the Email Router Versoin 2015 from here https://www.microsoft.com/en-us/download/details.aspx?id=45017 in a new server, I pointed one of the profiles to CRM 2013 and the result was:
"Incoming Status: Failure -The Email Router service that is installed is not a supported version. The Email Router version is later than expected by  the Microsoft Dynamics CRM server at https://...organization".
Confirmed Email Router is not backwards Compatible with Microsoft Dynamics CRM Online.


text:
Q: Show that $\sum\limits_{i=1}^N\sin^2\frac{m\pi i}{N+1}=\frac{N+1}{2}$ I have recently found this excercise and was not able to solve it so far.
Show that
$$\sum_{i=1}^N\sin^2\frac{m\pi i}{N+1}=\frac{N+1}{2}\;,$$ where $m \in \lbrace1,2,...,N\rbrace$.
This was one of my attempts:
$$\sum_{i=1}^N\sin^2\frac{m\pi i}{N+1}=\sum_{i=1}^N\frac{1}{2}\left[\cos(0)-\cos\frac{2m\pi i}{N+1}\right]=\frac{1}{2}-\frac{1}{2}\sum_{i=1}^N\cos\frac{2m\pi i}{N+1}$$
It seems the last sum should be equal to $-N$. Can anyone give me a clue?

A: $$
   \sum_{k=1}^{n} \cos\left( \frac{2 m \pi k}{n+1}\right) = \Re \sum_{k=1}^{n} \exp\left( i \frac{2 m \pi k}{n+1}\right) = \Re\left( \sum_{k=1}^n z^k \right) = \Re\left( \frac{1-z^n}{1-z} z \right)
$$
where $z= \exp\left( i \frac{2 m \pi}{n+1}\right)$. Since $z^{n+1} = 1$:
$$
  \Re\left(\frac{z-1}{1-z}\right) = -1
$$

A: Note that $\cos x$ can be expressed in terms of the exponential function (i.e. Euler's formula), and so the sum of cosines is really the sum of a geometric series which is easily summable.


text:
Q: Determining the filetype of a file in C I am trying to figure out the file type of a file, without using external libs or the "file" command.
I have viewed a number of posts and threads, and they point to using the stat() function (unix man stat) and playing with the "st_mode" from the stat struct.
But I have no idea how to do this, nor am I able to find a good example of doing it.
For example the program takes in a file F, I want to be able to read F similar to the program below and give similar output.  And the filetype of F is a PDF, but it does not have the extension on it.
FURTHER EXAMPLE:  If I have foo.pdf, but I changed the extension to *.png (foo.png) I can pass my program "foo.png" and say it is infact a .pdf file.
When a file is created, it makes a "magic number", example with a PDF, the  magic number of PDF files start with "%PDF" (hex 25 50 44 46)."
How can I use the magic number to figure out the filetype.
I understand some type of table will need to be made at my end, to support files.  And I am only doing a small handful <10.
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

void errorInput()
{
    fprintf(stderr, "\nYou have received this message due to an error. \n");
    fprintf(stderr, "Please type 'filetype <file>' to properly execute the program.\n");
    fprintf(stderr, "Thank you and have a fine day! \n\n");
    exit(0);
}

int main(int argc, char *argv[])
{

  char command[128];

  if (argc == 2)
  {
    strcpy(command, "file ");
    strcat(command, argv[1]);
    system(command);
  }
  else
  {
    errorInput();
  }

  return 0;
}

Thank You in advance!

A: Like Jonathon Reinhart Pointed, don't try to reinvent the wheel use libmagic:
#include <stdio.h>
#include <magic.h>

int main(void) {
  struct magic_set *magic = magic_open(MAGIC_MIME|MAGIC_CHECK);
  magic_load(magic,NULL);

  printf("Output1: '%s'\n",magic_file(magic,"ValgrindOut.xml"));
  printf("Output2: '%s'\n",magic_file(magic,"program"));
  printf("Output3: '%s'\n",magic_file(magic,"Chapter9.pdf"));
  printf("Output4: '%s'\n",magic_file(magic,"test.txt"));
  printf("Output5: '%s'\n",magic_file(magic,"linux-3.17.tar.xz"));
  printf("Output6: '%s'\n",magic_file(magic,"gcc-5.2.0.tar.gz"));
  printf("Output7: '%s'\n",magic_file(magic,"/home/michi"));

  return 0;
}

Compile:
gcc -o program program.c -lmagic

Output:

Output1: 'application/xml; charset=us-ascii'
Output2: 'application/x-executable; charset=binary'
Output3: 'application/pdf; charset=binary'
Output4: 'text/plain; charset=utf-8'
Output5: 'application/x-xz; charset=binary'
Output6: 'application/gzip; charset=binary'
Output7: 'inode/directory; charset=binary'

A: First, you need to include sys/stat.h
Next, you need to declare a struct stat in your code:
struct stat s

Next, you pass a pointer to your stat structure along with the file/object name:
returnval = stat("filename", &s);

Check the return value, you'll get < 0 on error. If no error the object/file exists, we can use a macro function to determine the file type:
if (S_ISREG(s.st_mode))
    /* Regular text file... */
else if (S_ISDIR(s.st_mode))
    /* Is a directory.... */

I suggest you have a look at the man page (man 3 stat) and it will give you all of the types that st_type may potentially be (it can be used to identify files, directories, block devices, sym links, etc)
Another very useful member of the stat struct is st_size which gives you a files size in bytes.
ETA - the stat() system call won't tell you if a file is a PDF or anything like that - normally we'd use the extension, if there is no extension and you're trying to identify specific file formats then stat() won't be of much use to you.

A: Most files usually will have a portion called as Header/MetaData. It is in this portion/segments of the file which will contain details about the file it self.Also, these Headers/MetaData Segments will also contain the Signature to identify the file type. But be aware most of these Signatures will be in an Hex Signature format
Example
PDF Signature - 25 50 44 46(In Hex) or %PDF
JPEG Signature - Start FF D8 and end of file FF D9
So, Basically you need to open the file in a binary format and parse the file structure and compare it to see if it matches with any one of the file types you define in your program.Like suppose you wanna check if it's pdf file then you need to first open the file in binary mode then scan the file till you get the bytcode/hex code which matches the bytcode/hex code of a pdf file. Use the C fopen() function in binary mode i.e "rb".
Or you can open the file normally without binary mode like this,
unsigned int data;
data=fgetc(pfile);

You might want to look into this for further details,

*

*Magic Number

*File Signatures


text:
Q: Unity match 3 style game matching process with canvas images I am creating a game like bejeweled game. I am using canvas and my game objects are canvas images. My objects are in the grid correctly when the game started but I don't know how can I match and Destroy the same type objects(images).
What kind of code blocks I can use for this?
Here is structure:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class DynamicGrid : MonoBehaviour {

    public int col, row;
    public Image[] prefabs = new Image[6];
    private Image image;

    // Use this for initialization
    void Start () {

        RectTransform parent = gameObject.GetComponent<RectTransform> ();
        GridLayoutGroup grid = gameObject.GetComponent<GridLayoutGroup> ();

        grid.cellSize = new Vector2 (parent.rect.width / col, parent.rect.height / row);   //grid cell size (ex: 4x4 - 3x5 etc.)

        for (int i = 0; i < row; i++) {   //fill the rows
            for (int j = 0; j < col; j++) {   //fill the columns
                int num = UnityEngine.Random.Range (0, prefabs.Length);   //select a random number (from 0 to 6 each numbers for each different jewel images)
                image = (Image)Instantiate (prefabs[num]);   //create the randomly seleceted image
                image.transform.SetParent (transform, false);
            }
        }
    }

    // Update is called once per frame
        void Update () {

    }

}

A: Here's a link that might help you: https://dgkanatsios.com/2015/02/25/building-a-match-3-game-in-unity-3/
Have a look at the function GetMatches


text:
Q: Combinatorial interpretation of identity for stirling number of second kind I'm trying to find a combinatorial interpretation for the following identity
$$S(n+1, m+1)=\sum_{k=m}^{n}\binom{n}{k}S(k,m)$$.
And am having a lot of trouble thinking of one. Any pointers?

A: Hint: The Stirling number of the second kind is the number of ways to partition a set of $n$ objects into a collection of $m$ subsets.


text:
Q: TestFlight Won't Send Notification
*

*I've uploaded a new beta, version 6, build 1, of an active app.
I have two different emails set up as internal test accounts, in
case one works where the other won't.

*The uploaded beta is showing in the Internal Testing Screen, radio
button checked next to "Version 6 — Build 1 — Testing — Expires in
60 days"

*My Tester IDs are showing in the "Internal Testers" list below.

By all accounts, it should be working, but it does not. I read one post here where the solution was to toggle the TestFlight testing option on and off and a notification would automatically be generated and sent, but there is no place to do that. I've searched everywhere. Why can't there just be a simple "Send Notification" option somewhere?
Cayce

A: Just remove and add those internal testers again
Step 1: Go to ITC -> My Apps -> App -> Testflight -> Internal Testing
Step 2 (Remove tester information): Edit -> Select internal tester apple ids -> Remove -> Save
Step 3 (Add tester information again): Click on "+" button and add the internal testers you removed in step 2 again.
This will notify user.


text:
Q: Node cannot find the start module I am trying to set-up a very simple test with node. To do so, I have created the following package.json:
{
  "dependencies": {
    "express": "*"
  },
  "scripts": {
    "start": "node index.js"
  },
  "name": "course-43",
  "version": "1.0.0",
  "description": "Simple test",
  "main": "index.js",
  "devDependencies": {},
  "author": "",
  "license": "ISC"
}

Then I have installed the dependencies with "npm install" and I have executed the "node start" command which outputs the following error:
$ node start
internal/modules/cjs/loader.js:800
    throw err;
    ^

Error: Cannot find module 'C:\[...]\Course-43\start'
?[90m    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:797:15)?[39m
?[90m    at Function.Module._load (internal/modules/cjs/loader.js:690:27)?[39m
?[90m    at Function.Module.runMain (internal/modules/cjs/loader.js:1047:10)?[39m
?[90m    at internal/main/run_main_module.js:17:11?[39m {
  code: ?[32m'MODULE_NOT_FOUND'?[39m,
  requireStack: []
}

The node start command is executed in the same directory as my package.json file.
Can someone help me to understand why node.js is trying to load a file instead of the script in my package.json file ?

A: You have to run npm start instead of node start. If you want to use node directly, then you should use node index.js. But the npm start option will do the same in this case


text:
Q: The Black Formatter - Python I just started using the Black Formatter module with VSCode everything was going well till I just noticed that it uses double quotes over single quotes which I already was using in my code.. and it overrode that..
So, is there an Black Argument that I could add to VSCode which solves this problem?
Thanks.

A: I don't know how it works for you all of that:
 {
    ...
    "python.formatting.provider": "black",
    "python.formatting.blackArgs": [
        "--skip-string-normalization"
    ]
    ...
}

or
{
    ...

    "python.formatting.blackArgs": [
        "-S"
    ],
    ...
}

I've tried everything and THE ONLY works for me is:
"black-formatter.args": ["-S"]

And VSCode for some reason installed via pip install -U black , don't know it is crucial or not.

A: --skip-string-normalization or -S for short
{
    ...

    "python.formatting.blackArgs": [
        "-S"
    ],
    ...
}

A: You can use the --skip-string-normalization option at the command line, or in your VSCode options.
See here: https://black.readthedocs.io/en/stable/the_black_code_style/current_style.html#strings
For example:
{
    ...
    "python.formatting.provider": "black",
    "python.formatting.blackArgs": [
        "--skip-string-normalization",
        "--line-length",
        "100"
    ]
    ...
}

Good luck!