text:
Q: Function if else statements read from different data sets I am very new to R. I am trying to get my function to take output a table with the columns I designate in my function when a user inputs a date (mm/dd/yy) and season (yyyy/yy). I am confused as to how to set up my initial data frame.
So there are 3 seasons I am pulling from (3 urls). My IF statement should be reading into one df (called it dfmess, cuz its a mess). How would I do this, hopefully that makes sense and someone can help me.  I would be very grateful if someone can sort out this mess for me...
    Season_2015_16 <- read.csv("http://www.football-data.co.uk/mmz4281/1516/E0.csv", stringsAsFactors = FALSE)
    Season_2014_15 <- read.csv("http://www.football-data.co.uk/mmz4281/1415/E0.csv", stringsAsFactors = FALSE)
    Season_2013_14 <- read.csv("http://www.football-data.co.uk/mmz4281/1314/E0.csv", stringsAsFactors = FALSE)

    **dfmess <- read.csv("http://www.football-data.co.uk/mmz4281/1516/E0.csv", stringsAsFactors = FALSE)
    dfmess <- read.csv("http://www.football-data.co.uk/mmz4281/1415/E0.csv", stringsAsFactors = FALSE)
    dfmess <- read.csv("http://www.football-data.co.uk/mmz4281/1314/E0.csv", stringsAsFactors = FALSE)**

    EPL_Standings <- function(Standingdate, season){
      Standingdate <- as.Date(Standingdate, format = "%m/%d/%Y")
      Standingdate <- as.Date("08/30/15", format = "%m/%d/%y")
      if (season == "2015/16"){

        read.csv("http://www.football-data.co.uk/mmz4281/1516/E0.csv", stringsAsFactors = FALSE) -> dfmess

      } else if (season == "2014/15") {
        read.csv("http://www.football-data.co.uk/mmz4281/1415/E0.csv", stringsAsFactors = FALSE) -> dfmess

      } else if (season == "2013/14"){
        read.csv("http://www.football-data.co.uk/mmz4281/1314/E0.csv", stringsAsFactors = FALSE) -> dfmess

      }

    dfmess[dfmess$Date <= Standingdate, 2:6]
  #Team Record

  ddply(dfmess,
        .(HomeTeam)
        , summarize
        , win = sum(FTR == "H")
        , Loss = sum(FTR == "A")
        , Draws = sum(FTR == "D")
  ) -> homewins1    #Homerecord
  ddply(dfmess,
        .(AwayTeam)
        , summarize
        , win = sum(FTR == "A")
        , Loss = sum(FTR == "H")
        , Draws = sum(FTR == "D")
  ) -> awaywins1  #Awayrecord

  merge(homewins1, awaywins1, by.x = "HomeTeam", by.y = "AwayTeam", all = TRUE) -> homeawayrec

  #homeawayrec
  (homeawayrec$win.x + homeawayrec$win.y) -> homeawayrec$totalwins #adds away and home wins together, then puts on table. renamed column later
  (homeawayrec$Loss.x + homeawayrec$Loss.y) -> homeawayrec$Total.Losses #same as above, but Losses. Named consistently with what I changed too after I changed above column.
  (homeawayrec$Draws.x + homeawayrec$Draws.y) -> homeawayrec$Total.Draws #same as above, but with Draws.
  #names(homeawayrec) <- c("Teams","Home.Wins", "Home.Losses", "Home.Draws", "Away.Wins", "Away.Losses", "Away.Draws", "Total.Wins") #Name all columns. make sure name right thing.

  #homeawayrec[, c("Teams", "Total.Wins", "Total.Draws", "Total.Losses")] -> WDL

  #Need to make home and away record, should be easy.

  #homewins1 #homerecord
  #awaywins1 #awayrecord

  #Matches Played

  (homeawayrec$totalwins + homeawayrec$Total.Draws + homeawayrec$Total.Losses) -> homeawayrec$MatchesPlayed
  #homeawayrec

  #homeawayrec[, c("Teams", "MatchesPlayed")] -> Matches.Played
  #Matches.Played #number of matches played
  #POINTS (need to make it per match)

  #ddply(dfmess,
  # .(HomeTeam)                    #DDPLY Points was eliminated because multiplying the wins by 3 and draws by 1 was easier.
  #  , summarize
  #   , win = 3*(sum(FTR == "H"))
  #    , Loss = 0*(sum(FTR == "A"))
  #     , Draws = 1*(sum(FTR == "D"))
  #) -> HomePoints   #team points at home

  #ddply(dfmess,
  #     .(AwayTeam)
  #    , summarize
  #   , win = 3*(sum(FTR == "A"))
  #  , Loss = 0*(sum(FTR == "H"))
  #      , Draws = 1*(sum(FTR == "D"))
  #) -> AwayPoints   #team points on road

  #merge(HomePoints, AwayPoints, by.x = "HomeTeam", by.y = "AwayTeam", all = TRUE) -> Pointshomeaway

  #(HomePoints$win +HomePoints$Draws + AwayPoints$win + AwayPoints$Draws) -> Pointshomeaway$TotalPoints

  #names(Pointshomeaway) <- c("Teams", "HomeWinPoints", "HomeLossPoints", "HomeDrawPoints", "AwayWinPoints", "AwayLossPoints", "AwayDrawPoints", "TotalPoints")

  #Pointshomeaway[, c("Teams", "TotalPoints")] -> Points.standings #table with just total points, total points standings.
  #homeawayrec
  (3*(homeawayrec$totalwins)+(1*(homeawayrec$Total.Draws))) -> homeawayrec$Points

  #points per match and point percentage %
  #homeawayrec
  (3*(homeawayrec$totalwins)+(1*(homeawayrec$Total.Draws)))/(homeawayrec$MatchesPlayed) -> homeawayrec$PPM

  #homeawayrec[, c("Teams", "PointsPerMatch")] -> PointsPer.Standings #standings with teams and points per match.

  #Point Percentage
  (homeawayrec$Points)/(3*(homeawayrec$MatchesPlayed)) -> homeawayrec$PtPct
  #homeawayrec
  #Goals Scored

  ddply(dfmess,                           #THIS WORKED, make sure HomeTeam and FTHG/AwayTeam and FTAG match up. Goals allowed will be the inverse for each.
        .(HomeTeam)
        , summarize
        , goalsscored1 = sum(FTHG)
  ) -> Homegoalmade1
  ddply(dfmess,
        .(AwayTeam)
        , summarize
        , goalsscored1 = sum(FTAG)
  ) -> Awaygoalsmade1

  merge(Homegoalmade1, Awaygoalsmade1, by.x = "HomeTeam", by.y = "AwayTeam", all = TRUE) -> goalsmade1 #merged home/away goalsmmade1 THIS WORKED
  (goalsmade1$goalsscored1.x + goalsmade1$goalsscored1.y) -> goalsmade1$allgoalsmade1 #total goalsmade

  #goalsmade1

  goalsmade1[, c("HomeTeam", "allgoalsmade1")] -> GS

  merge(homeawayrec, GS, by.x = "HomeTeam", by.y = "HomeTeam", all = TRUE) -> homeawayrec1
  #homeawayrec
  #homeawayrec1

  #Goals Scored Per Match
  ((homeawayrec1$allgoalsmade1)/(homeawayrec1$MatchesPlayed)) -> homeawayrec1$GSM
  #homeawayrec1

  #Goals Allowed
  ddply(dfmess,                           #THIS WORKED, make sure HomeTeam and FTAG/AwayTeam and FTHG match up. Goals scored will be the inverse for each.
        .(HomeTeam)
        , summarize
        , goalsscored1 = sum(FTAG)
  ) -> Homegoalallowed1
  ddply(dfmess,
        .(AwayTeam)
        , summarize
        , goalsscored1 = sum(FTHG)
  ) -> Awaygoalsallowed1

  merge(Homegoalallowed1, Awaygoalsallowed1, by.x = "HomeTeam", by.y = "AwayTeam", all = TRUE) -> goalsallowed1

  (goalsallowed1$goalsscored1.x + goalsallowed1$goalsscored1.y) -> goalsallowed1$GA

  #goalsallowed1

  goalsallowed1[, c("HomeTeam", "allgoalsallowed1")] -> GoalsAllowedall

  merge(homeawayrec1, goalsallowed1, by.x = "HomeTeam", by.y = "HomeTeam", all = TRUE) -> homeawayrec2

  #Goals Allowed Per Match

  ((homeawayrec2$GA)/homeawayrec2$MatchesPlayed) -> homeawayrec2$GAM
  names(homeawayrec2)
  #putting columns in correct order
  #if I rename columns the function gets confused and won't work?
  homeawayrec2[, c(1, 8, 10, 9, 2, 4, 3, 5, 7, 6, 11, 12, 13, 14, 15, 16, 19, 20)]
  #Last 10 matches played
  ((tail(homeawayrec2$totalwins, n=10)) (tail(homeawayrec2$Total.Draws, n=10)) (tail(homeawayrec2$Total.Losses, n=10)))
  tail(homeawayrec2[, c("totalwins", "Total.Draws", "Total.Losses")], n=10)
  homeawayrec2
  print(homeawayrec2)
  return(dfmess)
}
      ((homeawayrec2$GA)/homeawayrec2$MatchesPlayed) -> homeawayrec2$GAM
      names(homeawayrec2)
      homeawayrec2[, c(1, 8, 10, 9, 2, 4, 3, 5, 7, 6, 11, 12, 13, 14, 15, 16, 19, 20)]
      print(homeawayrec2)
      return(dfmess)
    }
    A <- EPL_Standings("09/26/14", "2013/14") #example numbers, placeholders.
    head(A)

A: Here's a start. In general, it is best to keep similar data in the same table.
library(dplyr)
library(lubridate)
library(magrittr)

data =
  data_frame(start_season = c(2013, 2014, 2015)) %>%
  mutate(url =
           (start_season - 2000) %>%
           paste0(., . + 1) %>%
           sprintf("http://www.football-data.co.uk/mmz4281/%s/E0.csv", . ) ) %>%
  group_by(start_season) %>%
  do(read.csv(.$url)) %>%
  mutate(Date = dmy(Date) %>% as.Date) %>%
  arrange(Date)

cutoffs =
  data %>%
  group_by(start_season) %>%
  summarize(start_date = first(Date))

EPL_Standings = function(specific_date) {

  specific_date = mdy(specific_date) %>% as.Date

  this_season_so_far =
    cutoffs %>%
    filter(specific_date > start_date) %>%
    last %>%
    left_join(data) %>%
    filter(Date <= specific_date)

  # some sort of processing here
}


text:
Q: ecma 6 + onclick, access to this class I use to ecma6. I have problem with access to method in class, when I use onclick.
I would like to induce method, which can induce other method in class.
This works:
class Menu{
     nextIteration(){...}

     init(){
       var that = this;
       //...

       buttonStart.onclick = function () {
                if(!that._start) {
                //...
                    that.nextIteration();
                } else if(that._start && that._pause) {
                //..
                    that.nextIteration();
                }
            };
    }
}

Now I tried:
class Menu{
    nextIteration(){...}

    init(){
    //...
       buttonStart.onclick= clickStart;
    }

    //...
    clickStart(){
            var that = this;
            if(!that._start) {
    //...
                that.nextIteration();
            } else if(that._start && that._pause) {
    //...
                that.nextIteration();
            }
        }
  }

In my opinion event is not beautiful. I prefer induce method in class. I tried addEventListener and "this" refer to element DOM.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Is it possible to create a file that cannot be copied? To restrict the scope, let assume we are in Windows world only.
Also assume we don't want to play with permission policy.
Is it possible for us to create a file that cannot be copied?
Thank  you in advance.

A: Any file that can be read can have its contents written to another location (such as another file, i.e. copied).
The only thing you can do is limit who/what can read the file.

A: What is the motivation behind? If it is a read-only file, you can have it as embedded resources within your assembly.

A: Nice try, RIAA.
But seriously, no you can not. It is always possible to copy, you can just make it it more difficult for people to make sense of the file or try to hide it using like encryption. Spotify does it.
If you really try hard thou, you cold make a root-kit for windows and use it to prevent windows from even knowing about the file and also prevent copies. The file will still be there and copy-able by other tools, or Linux accessing the ntfs.

A: If in a running process you open a file and hold an exclusive lock, then other processes cannot read the file until you close the handle or your process terminates. However, as admin you could forcibly remove the lock handle.

A: "Trying to make digital files uncopyable is like trying to make water not wet." ~ Bruce Schneier

A: No. You can't create a file that a SYSADMIN can't copy. You could encrypt it, though.

A: Well, how about creating a file that uses up more than 50% of the total space on that machine and that is not compressible?
For instance, let us assume that you want to save a boolean (true or false) in such a fashion.
Depending on its value, you could then write a bit stream of ones or zeroes and encrypt said stream using some kind of encryption algorith, such as AES in CBC mode. This gives you the added advantage of error correction. Even in case of massive data corruption, you should be able to recover your boolean by checking whether ones or zeroes are prevalent in the decrypted stream.
In that case you cannot copy it around (completely) on the machine...
Of course, any type of external memory that can be added to the system would pose a problem in this scenario. But the file would be already encrypted, so don't worry about it too much...

A: Short answer: No.
You can, of course, use security settings to limit who can read the file. But if someone can read it, then they can copy it. Even if you found some operating system trick to disable "ordinary" copying, if someone can read the file, they can extract the contents, store it in memory, and then write it somewhere else.
You can encrypt the contents so it's only useful to your own program, that knows how to decrypt it.
That's about it.

A: When using Windows 7 to copy some files from a hard drive, certain files popped up a message saying they could not be copied in their entirety; certain data would be omitted from the copy.  I suspect that had something to do with slack space at the end of the files, though I thought the message was curious.  I would have expected the copy operation to just ignore the slack space.

A: If you are running old (OLD) versions of windows, there are certain characters you can put in the filename that make it invalid, not listed in folders, etc.  They were used a lot in the old pub ftp days of filesharing ;)

A: In the old DOS days, you used to be able to flag disk sectors as bad and still read from them. This meant the OS ignored the sector in question but your application would know where to look and be able to get the data. Not sure this would work these days.
Another old MS-DOS trick was to put a space character in the middle of the filename (yes, spaces were valid characters for filenames). Since there was no method on the command line to escape a space, the file couldn't be copied using the DOS commands.

A: This answer is outside Windows so yeah
Dont know if its already been said but what about a file that is an inseperable part of the firmware so that it is always on AND running, perhaps it has firmware that generates a sequence that is required for the other .  AN incedental effect of its running is to prevent any 80% or more of its code from being replicated.  Lets say its on an entirely different board, protected by surge protectors, heavy em proof shielding and anything else required to make it completely unerasable.
If its possible to make a program that is ALWAYS on and running as long as the copying software is running then yes.
I have another way and this IS with windows. I will come to your house and give you a disk, i will then proceed to destroy every single computer you put the disk into.  This doesnt work on XP

A: Well technically you could create and write to a write-only network share.


text:
Q: How to display or move sprite in as3 side scroller? I have a sprite in my library called myRocket but it won't show up.
I made my sprite a movie clip then I deleted it off the actual page so it was just in the library. I thought using this code, the sprite would appear once I started up the game but it does not.
import flash.display.MovieClip;

stop() ;

           removeChild(myButton);
           var myReturn:Return=new Return();
           addChild(myReturn);
           myReturn.x=390;
           myReturn.y=10;
           myReturn.addEventListener(MouseEvent.CLICK, return1Function);

           var up:Boolean;
           var down:Boolean;
           var left:Boolean;
           var right:Boolean;

           var speed:int;

           function return1Function(evt:MouseEvent):void{
               gotoAndStop("menu");
           }

           var myRocket:MovieClip;
           addChild(myRocket);
           myRocket.x=200;
           myRocket.y=150;

            function KeyboardDemo() {

                 myRocket.x = 200;
                 myRocket.y = 100;
                 addChild(myRocket);

                 stage.addEventListener(KeyboardEvent.KEY_DOWN, keyPressedDown);

               }

function keyPressedDown(event:KeyboardEvent):void {
  var key:uint = event.keyCode;
  var step:uint = 5
  switch (key) {
      case Keyboard.LEFT :
        myRocket.x -= step;
        break;
      case Keyboard.RIGHT :
        myRocket.x += step;
        break;
      case Keyboard.UP :
        myRocket.y -= step;
        break;
      case Keyboard.DOWN :
        myRocket.y += step;
        break;
  }
}

A: You need to initialize your object before you place it to the stage. You have only declared a variable at the line "var myRocket:MovieClip;" instead it should at least (not sure about whatever logic you have there" read like above with "Return" whatever it was: var myRocket:MovieClip=new Rocket(); Here "Rocket" is the library name of the sprite.


text:
Q: Draw Circle Jimp JavaScript I'm trying to draw a circle in JavaScript with Jimp using the code below.
const Jimp = require("jimp");

const size = 500;
const black = [0, 0, 0, 255];
const white = [255, 255, 255, 255];
new Jimp(size, size, (err, image) => {
    for (let x = 0; x < size; x++) {
        for (let y = 0; y < size; y++) {
            const colorToUse = distanceFromCenter(size, x, y) > size / 2 ? black : white;
            const color = Jimp.rgbaToInt(...colorToUse);
            image.setPixelColor(color, x, y);
        }
    }
    image.write("circle.png");
});

It produces this.

Problem is, when you zoom in, it looks really choppy.

How can I make the circle smoother and less choppy?

A: You need to create anti-aliasing. This is easily done for black and white by simply controlling the level of gray of each pixel based on the floating distance it has to the center.
E.g, a pixel with a distance of 250 in your setup should be black, but one with a  distance of 250.5 should be gray (~ #808080).
So all you have to do, is to take into account these floating points.
Here is an example using the Canvas2D API, but the core logic is directly applicable to your code.

const size = 500;
const rad = size / 2;
const black = 0xFF000000; //[0, 0, 0, 255];
const white = 0xFFFFFFFF; //[255, 255, 255, 255];

const img = new ImageData(size, size);
const data = new Uint32Array(img.data.buffer);

for (let x = 0; x < size; x++) {
  for (let y = 0; y < size; y++) {
    const dist = distanceFromCenter(rad, x, y);
    let color;
    if (dist >= rad + 1) color = black;
    else if (dist <= rad) color = white;
    else {
      const mult = (255 - Math.floor((dist - rad) * 255)).toString(16).padStart(2, 0);
      color = '0xff' + mult.repeat(3); // grayscale 0xffnnnnnn
    }
    // image.setPixelColor(color, x, y);
    data[(y * size) + x] = Number(color);
  }
}
//image.write("circle.png");
c.getContext('2d').putImageData(img, 0, 0);

function distanceFromCenter(rad, x, y) {
  return Math.hypot(rad - x, rad - y);
}
<canvas id="c" width="500" height="500"></canvas>

A: I'm sorry to says this but the answer is that you can't really do it. The problem is that a pixel is the minimal unit that can be drawn and you have to either draw it or not. So as long as you use some raster image format (as opposed to vector graphics) you can't draw a smooth line at a big zoom.
If you think about it, you might blame the problem onto the zooming app that doesn't know about the logic of the image (circle) and maps each pixel to many whole pixels. To put it otherwise, your image has only 500x500 pixels of information. You can't reliably build 5,000x5,000 pixels of information (which is effectively what 10x zooming is) from that because there is not enough information in the original image. So you (or whoever does the zooming) have to guess how to fill the missing information and this "chopping" is a result of the simplest (and the most widely used) guessing algorithm there is: just map every pixel on NxN pixels where N is zoom factor.
There are three possible workarounds:

*

*Draw a much bigger image so you don't need to zoom it in the first place (but it will take much more space everywhere)

*Use some vector graphics like SVG (but you'll have to change the library, and it might be not what you want in the end because there are some other problems with that)

*Try to use anti-aliasing which is a clever trick used to subvert how humans see: you draw some pixels around the edge as some gray instead of black-and-white. It will look better at small zooms but at big enough zooms you'll still see the actual details and the magic will stop working.


text:
Q: Bypass Magento cart on click of regular save button and redirect to onepagecheckout I want to bypass the magento cart by clicking on a normal save button which submits the form via ajax and then redirects to onepage checkout by bypassing cart (like using windows.location.href)....please help

A: Sonam,
You can create an observer for this purpose as follows :
Your config would look something like this:
<frontend>
<events>
<checkout_cart_add_product_complete>
         <observers>
         <packagename_modulename_observer>
              <type>singleton</type>
              <class>packagename_modulename/observer</class>
              <method>addToCartComplete</method>
         </packagename_modulename_observer>
         </observers>
     </checkout_cart_add_product_complete>
 </events>
</frontend>

You could create an observer listening for the checkout_cart_add_product_complete event and in there you could do something like the following:
public function addToCartComplete(Varien_Event_Observer $observer) {
// Send the user to the Item added page
$response = $observer->getResponse();
$request = $observer->getRequest();
$response->setRedirect(Mage::getUrl('checkout/onepage'));
Mage::getSingleton('checkout/session')->setNoCartRedirect(true);
}

Second and fairer simpler would be :
Go to app/code/core/Mage/Checkout/controllers/ in CartController.php
Copy this File and search method
protected function _goBack()

change
$this->_redirect('checkout/cart');

to
$this->_redirect('checkout/onepage');

hope these methods help you complete the process as you want.

A: I have been trying to do the same. I recommend SKVs second solution (editing the CartController) but of course you shouldn't edit the core. And overriding a controller is not as simple as, say, overriding a model object.
While you can copy for example app\code\core\Mage\Checkout\Model\Cart.php to app\code\local\Mage\Checkout\Model\Cart.php, make your edits and just be done with it, overriding a controller class is not that simple. To the best of my knowledge, you have to do it in your own module. Here's what I did.
Made a module: app\code\local\Companyname\Checkout.
Added a etc\config.xml to this module:
<config>
    <modules>
        <Companyname_Checkout>
            <version>0.1.0</version>
        </Companyname_Checkout>
    </modules>
    <frontend>
        <routers>
            <checkout>
                <args>
                    <modules>
                        <Companyname_Checkout before="Mage_Checkout">Companyname_Checkout</Companyname_Checkout>
                    </modules>
                </args>
            </checkout>
        </routers>
    </frontend>
</config>

Added a controllers\CartController.php to my module. This is a copy of the core CartController but I changed
class Mage_Checkout_CartController extends Mage_Core_Controller_Front_Action

to:
require_once(Mage::getModuleDir('controllers','Mage_Checkout').DS.'CartController.php');
class Pixelkracht_Checkout_CartController extends Mage_Checkout_CartController

Finally, make the changes in the _goBack function as suggested by SKV.


text:
Q: How to show quick hint exports interface my code

types

I'm trying to see what type I'm exporting, if you hover the mouse, you can't see anything, you need to hold down alt to see the incoming type in the specified interface.
how to cook properly?
example: index.ts
import { NEW_TYPE } from './types';

const example = ({ one, two }: NEW_TYPE) => {
    console.log(`[LOG] two`, `<${typeof two}>`, two);
    console.log(`[LOG] one`, `<${typeof one}>`, one);
};

example: types.d.ts
export interface NEW_TYPE {
   one: number;
   two: string;
 }


text:
Q: A little Access VBA help? Validating against duplication of a non key field? I am adding a part name to the database using a form, What code do I put behind the Add part button to validate against duplicate part names? (part number is the primary key) I think I need another recordset to search and compare the table but i'm a bit lost, any help would be great.
Private Sub btn_add_Click()
rs_parts.AddNew

With rs_parts
!partrno = lbl_partno.Caption
!Name = txt_name
rs_parts.update
end with

A: I've discussed my approach to this before, and given an example form for adding a new record.
I use an unbound form to collect the information needed to create the new record, and have it check for duplicates, and present a list of them to the user so the user can decide what to do.
In this case, it sounds like a unique index is in order, so you won't really need to worry about close matches. I would probably still use an unbound form to capture the new value and run the check before even attempting to add it. In that case, I'd just notify the user that it's a dupe.

A: Should you add a unique index to the part name field?
If you want, you can create a query on your part table with one column for the name and a parameter for the criteria they've entered in txt_name.  Then pass the value they entered as a parameter to the query and see if you get any results.


text:
Q: Prove $abc+abd+acd+bcd\le\frac{1}{27}+\frac{176abcd}{27}$ for $a+b+c+d=1$
Let $a,b,c$, and $d$ be four positive reals satisfying $a+b+c+d=1$. Show that
$$abc+abd+acd+bcd\le\frac{1}{27}+\frac{176abcd}{27}.$$

I tried the inequality between $27abc$ and $(a+b+c)^3$ but it didn't help me

A: Inspired by https://math.stackexchange.com/a/1748125/823641.

Define $f(a,b,c,d) = abc+abd+acd+bcd - \frac{1}{27} - \frac{176abcd}{27}$.
We have $f(1/4,1/4,1/4,1/4) = 0$.
We shall show that $f(1/4,1/4,1/4,1/4)$ is the maximum among all $a,b,c,d$ satisfying the conditions.
Suppose not, and assume that another value of $(a,b,c,d) = (x,y,z,w) \neq (1/4,1/4,1/4,1/4)$ corresponds to the maximum $f(x,y,z,w)$.
WLOG, we assume that $x \neq y$.
We have
\begin{align}
&f(\frac{x+y}{2},\frac{x+y}{2},z,w) - f(x,y,z,w) \\
=~&(x-y)^2(z+w)/4 - \frac{176zw}{27 * 4}(x-y)^2 \\
=~& \frac{(x-y)^2}{4}(z+w-\frac{176zw}{27}),
\end{align}
where
$$\frac{(x-y)^2}{4} > 0.$$
If $z+w-\frac{176zw}{27} > 0$ then we are done because in that case we have $f(\frac{x+y}{2},\frac{x+y}{2},z,w) > f(x,y,z,w)$, completing the proof by contradicting the assumption of maximality.
Now, we assume that
$z+w-\frac{176zw}{27} \leq 0$,
then we have
$$f(x,y,z,w) = xy(z+w - 176zw/27) + (x+y)zw - 1/27$$
$$\leq (x+y)zw - 1/27 \leq (1 - t)t^2/4 - 1/27,$$
where we have used the Cauchy–Schwarz inequality and $t = z+w$.
Let $g(t) = (1 - t)t^2/4 - 1/27$.
It is easy to check (by $g'(t)$) that $g(t)$ achieves its maximum at $t = 2/3$ with $g(t) = 0$.
Therefore, we have $f(x,y,z,w) \leq 0$, completing the proof.

A: We rewrite the inequality as :
$$f(a,b,c,d)=-\left(\ln\left(a\right)+\ln\left(b\right)+\ln\left(c\right)+\ln\left(d\right)+\ln\left(\frac{1}{a}+\frac{1}{b}+\frac{1}{c}+\frac{1}{d}-\frac{176}{27}\right)\right)\geq -\ln\left(1/27\right)$$
We use the equal variable method corollary 1.5 as :
$$a+b+c+d=1$$
$$\frac{1}{a}+\frac{1}{b}+\frac{1}{c}+\frac{1}{d}=constant$$
$$f\left(x\right)=-\ln\left(x\right)$$ define :
$$g\left(x\right)=f'\left(\frac{1}{\sqrt{x}}\right)$$
then we have :
$$g''(x)>0$$
So the $f(a,b,c,d)$ is minimal for $d\geq c\geq b \geq a>0$ and $d=c=b=x$
Remains to show the inequality for $x\in[0,1/3)$ :
$$x^{3}\left(1-3x\right)\left(\frac{3}{x}+\frac{1}{1-3x}-\frac{176}{27}\right)-1/27\leq 0$$
Or :
$$1/27(3x-1)(4x-1)^{2}(11x+1)\leq 0$$
Can you end now ?

Adding remark for another proof :
For $0<a\leq b\leq c \leq d$, $a+b+c+d=1$ and $b=c=0.25$ we have the inequalities :
$$\left(abcd\left(\frac{1}{a}+\frac{9\left(1+\frac{5\left(a-0.25\right)^{2}}{1+a}\right)}{1-a}\right)-\frac{1}{27}-\frac{176}{27}abcd\right)\geq abcd\left(\frac{1}{a}+\frac{1}{b}+\frac{1}{c}+\frac{1}{d}\right)-\frac{1}{27}-\frac{176}{27}abcd$$
Wich is a one variable inequality .
Now and again fixing $b=c=0.25$ and introducing the variable $u,v>0$ such that $a+u+v+d=1=a+b+c+d$ and $0<a\leq b\leq c \leq d$ we have :
$$abcd\left(\frac{1}{a}+\frac{1}{b}+\frac{1}{c}+\frac{1}{d}\right)-\frac{1}{27}-\frac{176}{27}abcd\geq auvd\left(\frac{1}{a}+\frac{1}{u}+\frac{1}{v}+\frac{1}{d}\right)-\frac{1}{27}-\frac{176}{27}auvd$$
using the previous inequality .
Now it misses one equality case so to be continued...
Edit 01/09/2022 :
We have the following inequalities for $0<a<0.3\leq b \leq c \leq d$ and $a+b+c+d=1$ :
$$0\geq \left(abcd+\frac{a^{2}\left(0.25-a\right)^{2}}{2\left(2-4a\right)}\right)\left(\frac{1}{a}+\frac{9}{\left(d+c+b\right)}-\frac{176}{27}\right)-\frac{1}{27}\geq abcd\left(\frac{1}{a}+\frac{1}{b}+\frac{1}{c}+\frac{1}{d}-\frac{176}{27}\right)-\frac{1}{27}$$
And we can use the same strategy fixing two new variable $u,v$


text:
Q: .htaccess redirect specific length random value Looking for .htaccess code to make this happen.
Have:
http://example.com/0af31a48-562d-33d2-a75d-1931ba37a2d3

Need it to redirect to:
http://example.com/load.php?id=0af31a48-562d-33d2-a75d-1931ba37a2d3

The variable will always be a UUID (36 characters).
And, obviously, I need it to not redirect other things such as:
http://example.com/
http://example.com/profile/
http://example.com/account/
http://example.com/yadda-yadda-yadda

So, looking for the specific length of 36 characters -- because I will never have a directory nor individual file that is 36-characters in length.

A: You can use this rule:
RewriteEngine On

RewriteRule ^([a-f0-9-]{36})$ load.php?id=$1 [L,NC,QSA]


text:
Q: Simple JS/JSON not working with Angular I'm starting to learn Angular JS, and I wrote the following code to display name, age and profession. I'm using Angular 1.5.

 {{author.name}}

{{author.age + " " + author.profession}}

Any help would be much appreciated.

A: You need to add a module:
var app = angular.module("main", []);
app.controller("MyController", MyController);

 {{author.name}}

{{author.age + " " + author.profession}}

working example:
http://codepen.io/nilestanner/pen/YWmWNo

A: What you are missing is angular module and ng-app directive in your HTML.
Simply follow this free course.
https://www.codeschool.com/courses/shaping-up-with-angular-js
Simple sample code:

 {{author.name}}

{{author.age + " " + author.profession}}


text:
Q: Gitlab Self-Hosted: ERROR: Uploading artifacts as "archive" to coordinator... 308 Permanent Redirect I am trying to visualize test coverage using jacoco for my Android application with Kotlin and I am following this article for our Gitlab (self-hosted) instance:
https://docs.gitlab.com/ee/ci/testing/test_coverage_visualization.html#gradle-example
For some reason, Gitlab can't upload the artifacts. Here are some of the errors:
./app/build/reports/jacoco/testDebugUnitTestCoverage/testDebugUnitTestCoverage.xml: found 1 matching files and directories
WARNING: Uploading artifacts as "archive" to coordinator... 308 Permanent Redirect  id=811458 responseStatus=308 Permanent Redirect status=308

WARNING: Retrying...                                context=artifacts-uploader error=invalid argument
WARNING: Uploading artifacts as "archive" to coordinator...

Any ideas?


text:
Q: Python and selenium: choose option from dropdown in table I am still new to Python and Selenium. I would like to choose a certain option from a dropdown that is contained in an html table. However I can not get it to work. What am I doing wrong? Any help is appreciated?
Snippet of HTML-Code:

Prod1:

<select name="ctl00$ContentPlaceBody$DropDownListUnitType"            onchange="javascript:setTimeout('__doPostBack(\'ctl00$ContentPlaceBody$DropDownListUnitType\',\'\')', 0)" id="ctl00_ContentPlaceBody_DropDownListUnitType" class="StdDropDownList330" Class="option">
    <option selected="selected" value="#">- nothing -</option>
    <option value="P">Dummy1</option>

</select>

I tried the following to select the value "Dummy1"
Python Code:
dropdown1 =
browser.find_element_by_id('ctl00_ContentPlaceBody_DropDownListUnitType')
select = Select(dropdown1)
select.select_by_value("P")

What am I missing or doing wrong? Any help is much appreciated.
EDIT
I get an error on the IPython console in Anaconda with Python 3.6:
NoSuchElementException: Unable to locate element:
[id="ctl00_ContentPlaceBody_DropDownListUnitType"]

EDIT2
I checked whether the problem is due to different iframes as mentioned by comments and in other questions here on stackoverflow. I used the idea mentioned in this https://developer.mozilla.org/en-US/docs/Tools/Working_with_iframes to check for iframes and tried with the example of Alibabas login page. There two different iframes where shown. In the page I am trying to use with selenium there is only one iframe.

A: It seems, Webdriver is having difficulty in directly reaching to the drop down using its id. You may need to first locate the table and then reach to the drop down. Try following and let me know, whether it works.
 dropdown1 =
 browser.find_element_by_xpath("//table[@class='StdTableAutoCollapse']/tr[1]/descendant::select[@id='ctl00_ContentPlaceBody_DropDownListUnitType'][1]")
 select = Select(dropdown1)
 select.select_by_value("P")

A: The problem was that I was trying to use Selenium 3.0.2 with Firefox 45. This creates issues and thus I could not select the dropdown values.I downgraded to Selenium 2.5.x and the problem went away. The issue was not the select was in a table as I first thought. I hope this helps somebody else in the future.Please see also the following question: Python, Firefox and Selenium 3: selecting value from dropdown does not work with Firefox 45


text:
Q: Jquery get a part of ID I have different elements with same id part:

etc..
i need extract number of id post and add in div a new button with the  value equal to "number-post".

...

    <button value="32">click here</button>

I tried with this code but return me for each post, as many buttons as there are posts.
$("[id^='post-']").each(
    function() {
        var id = $(this).attr("id").split("-")[1];
        var r  = $('<button type="button" id="add" value"'+id+'" name="test">Entra</button>');
        $(".myclass").append(r);
    }
);

A: This is just whatever...

$("[id^='post-']").each(
    function() {
        var id = $(this).attr("id").split("-")[1];
        var r  = $('
<button type="button" id="add-'+id+'" value="'+id+'" name="test['+id+']">Entra</button>
');
        $(this).prepend(r);
    }
);
.myclass{display:inline-block;}

The quick brown

fox jumps over

the lazy dog

A: Is this what you are trying to do?
$("[id^='post-']").each(
   function() {
      var id = $(this).attr("id").split("-")[1];
      var r  = $('<button type="button" id="add-' + id + '" value"'+id+'" name="test-'
      + id + '">Entra</button>');
      $(this).append(r);
  }
);

A: So, I think the solution is the following:
var divs = document.querySelectorAll( 'div[id^="post-"]' );
var myClassDiv = jQuery( document.querySelector( 'div.myclass' ) );

if ( 0 < divs.length && myClassDiv ) {
    divs.forEach(
        function ( item ) {
            var itemID = item.id.split('-')[1];
            var button = document.createElement('button');

            button.type = 'button';
            button.id = 'add'; // you should normally use a unique ID here.
            // button.id = 'add-' + itemID; in order to have a unique button ID
            button.value = itemID;
            button.name = 'test';
            button.innerText = 'Entra'

            myClassDiv.append( jQuery( button ) );
        }
    );
}


text:
Q: Why i am getting No associated state error in below example. Could anyone tell any reason?
In below program i am getting error std::future_error: No associated
state error.could anyone help why i am facing this error

#include <iostream>
#include <thread>
#include <future>
#include <chrono>
#include <functional>

void task(int& var, std::future<int>& refFuture)
{
    std::packaged_task<int()> mytask{ [&](){var = 25; return var;}};
    auto future = mytask.get_future();
    mytask.make_ready_at_thread_exit();
    refFuture = std::move(future);
}

int main()
{
    int variable = 10;
    std::future<int> future;
    std::thread t1(task, std::ref(variable), std::ref(future));
    std::future_status status = future.wait_for(std::chrono::seconds(0));
    if(status == std::future_status::ready)
    {
        int myOutput = future.get();
        std::cout << "Myoutput :" <<  myOutput << std::endl;
    }

    t1.join();
}

A: You are not waiting for the thread to actually execute refFuture = std::move(future); before you wait on future in the main thread, so the future in main does not have any associated state to wait on at that point.
I am not sure what you are intending to do here, but you are supposed to prepare the std::packaged_task in the main thread, obtain the future from it in the main thread as well and then move the std::packaged_task into the thread to execute it there (per operator() or per make_ready_at_thread_exit). See e.g. the example at https://en.cppreference.com/w/cpp/thread/packaged_task/packaged_task.


text:
Q: Pipeline not substituting array object I am trying to change my logging url and api key for different environments. For this, I am using the Variables, in my Azure release pipeline. At the moment, I have the database connection string working well.

However, I am struggling to get the logging variables to work. Now,there is an array, and I bvelieve you reference an array as field.child.1.field (So, that would assign the 2nd array objets's field.
I have this:
 "Serilog": {
    "MinimumLevel": {
      "Default": "Debug",
      "Override": {
        "Microsoft": "Warning",
        "System": "Warning"
      }
    },
    "Enrich": [ "FromLogContext", "WithMachineName", "WithProcessId", "WithThreadId" ],

    "WriteTo": [
      {
        "Name": "Console",
        "Args": {
          "outputTemplate": "[{Timestamp:HH:mm:ss.fff} {Level:u3}] {Message:lj}{NewLine}{Exception}"
        }
      },
      {
        "Name": "Seq",
        "Args": {
          "serverUrl": "myUrl",
          "apiKey": "myApiKey"
        }
      }
    ]
  }

I am trying to substitute the serverUrl and apiKey.
In my pipeline lok, all I see is:

*

*2021-03-15T01:24:13.1988119Z Compressed: 17363747

*2021-03-15T01:24:13.2942311Z Applying JSON variable substitution for **/*.json

*2021-03-15T01:24:13.3272676Z Applying JSON variable substitution for D:\a_temp\temp_web_package_8357506149\appsettings.json

*2021-03-15T01:24:13.3275828Z Substituting value on key: ConnectionString

*2021-03-15T01:24:13.3717239Z Applying JSON variable substitution for D:\a_temp\temp_web_package_8357506149\MyApp.WebAPI.deps.json

*2021-03-15T01:24:13.3819830Z Applying JSON variable substitution for D:\a_temp\temp_web_package_8357506149\MyApp.WebAPI.runtimeconfig.json

*2021-03-15T01:24:13.3822015Z JSON variable substitution applied successfully.

It does the ConnectionString one well, but doesn't do the others. What am I missing?

A: You understand it correctly. Your fault is the uppercase letter "L" in SeriLog.WriteTo.1.Args.apiKey. It should be "Serilog.WriteTo.1.Args.apiKey". The mistake is in both variables apiKey and serverUrl.


text:
Q: Expose Kubernetes cluster behind a pfSense I installed a Kubernetes cluster on a Bare-metal sever.
This server contains a Proxmox hypervisor, I have the following virtual machines

*

*a pfSense (192.168.9.254)

*two masters for the Kubernetes cluster (192.168.9.11, 192.168.9.12)

*two nodes for the Kubernetes cluster (192.168.9.21, 192.168.9.22)

The masters and nodes are both using CoreOS
I provisionned the Kubernetes cluster using Kubespray:

*

*Kubernetes version: 1.15.3 kubernetes

*CNI Calico

*CRI Docker

I managed to install MetalLB, my configuration is the following one
apiVersion: v1
kind: ConfigMap
metadata:
  namespace: metallb-system
  name: config
data:
  config: |
    address-pools:
    - name: default
      protocol: layer2
      addresses:
      - 192.168.9.240/28

I also installed nginx-ingress with the mandatory.yaml file and a simple service
kind: Service
apiVersion: v1
metadata:
  name: ingress-nginx
  namespace: ingress-nginx
  labels:
    app.kubernetes.io/name: ingress-nginx
    app.kubernetes.io/part-of: ingress-nginx
spec:
  type: LoadBalancer
  selector:
    app.kubernetes.io/name: ingress-nginx
    app.kubernetes.io/part-of: ingress-nginx
  ports:
    - name: http
      port: 80
      targetPort: http
    - name: https
      port: 443
      targetPort: http

Then I applied the yaml file to verify nginx-ingress is working properly
apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-nginx
spec:
  selector:
    matchLabels:
      run: my-nginx
  replicas: 2
  template:
    metadata:
      labels:
        run: my-nginx
    spec:
      containers:
      - name: my-nginx
        image: nginx
        ports:
        - containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
  name: my-nginx
  labels:
    run: my-nginx
spec:
  ports:
  - port: 80
    protocol: TCP
  selector:
    run: my-nginx
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: nginx-app-ingress
  annotations:
     nginx.ingress.kubernetes.io/rewrite-target: /
     nginx.ingress.kubernetes.io/ssl-redirect: "false"
spec:
  rules:
  - http:
      paths:
      - path: /test
        backend:
          serviceName: my-nginx
          servicePort: 80

When I use the command, kubectl get ingress, I get this answer
NAME                   HOSTS                        ADDRESS         PORTS   AGE
nginx-app-ingress      *                            192.168.9.240   80      19h

I can access the simple nginx server on this URL when connected to the VPN 192.168.9.240/test
Now I would like to be able to access this "website" from the outside world.
I am not sure what to do since there is the pfSense in front of the Kubernetes cluster.
I am thinking about using a reverse proxy like this:

*

*An user type in his web browser myDomainName.com

*it redirects to 192.168.9.240/test

But I am not truly not sure about this solution, as I don't know if it is the best solution for this problem.

A: One option may be to setup HAProxy in PFSense. This would allow you direct traffic to your cluster via a external DNS url. I use cloudflare for my DNS and have setup Dynamic DNS since I am running behind a dhcp connected to fiber for the WAN in pfSense. I have an article on this here


text:
Q: Eclipse: Use user libraries from another project I have three Eclipse projects in my workspace. Two of them depend on the third one which contains common classes and libraries the other two both use:
project_X
  +src
project_Y
  +src
project_commons
  +src
  +lib

I can access and import all src classes from the commons project but the libraries are not found. Is there a way to automatically reference them in project_X and project_Y? If possible I'd like it that if I add a library to the commons project, the other two can automatically use it as well.

A: You just have to export those libraries on the common project:
Project -> Properties -> Java Build Path -> Order and Export

A: Make a Shared Library in you're Web-sphere console, with the path to where you have you're common classes, then include this shared library to any application you wish to share those classes to.
From you're Web-sphere Console, log in , then go to :
Environment-> shared Library's


text:
Q: How to solve loading rdlc? When I call the .aspx file to show the report, the rdlc report is loading,
and not showing the report; the loading start when I set parameters on .aspx file?
How do I solve this?
var data = db.Database.SqlQuery<MPWAttReportVM>(@"exec getting data").ToList();

        TestRV.SizeToReportContent = true;
        TestRV.LocalReport.ReportPath = Server.MapPath("WebForm3.rdlc");
        TestRV.LocalReport.DataSources.Clear();

        ReportParameter[] paras = new ReportParameter[3];
        paras[0] = new ReportParameter("FromDate", "2019-01-01");
        paras[1] = new ReportParameter("ToDate", "2019-04-20");
        paras[2] = new ReportParameter("Days", Days);
        TestRV.LocalReport.SetParameters(paras);
        ReportDataSource ds = new ReportDataSource("MinistryAttReportDT", data);
        TestRV.LocalReport.DataSources.Add(ds);
        TestRV.LocalReport.Refresh();

Resulting image:
[]

A: I think its styling issue espically in google chrome browser.
try this solution
Set this attribute in your ReportViewer tag inside aspx page :

*

*ZoomMode="PageWidth"

*SizeToReportContent="True"
example :
<your_reference_name:ReportViewer ID="rptView" runat="server" Width="100%" Height="100%" ZoomMode="PageWidth" SizeToReportContent="True"></your_reference_name:ReportViewer>


text:
Q: User granted creator owner permissions on files/folders he creates We're trying to eliminate the creator owner permission from our shared files in a Windows Server 2016 DFS environment. We have removed the creator owner permission from shared folders, but when users create files and folders downstream, they are still granted the creator owner permission on those objects.
I read somewhere that we need to remove creator owner from the root of the hard drive on the server. is this correct ? I can't seem to find any documentation on this issue anywhere...


text:
Q: C# Google Drive API Error " Google.Apis.Services.BaseClientService.Initializer' does not contain a definition for 'Authenticator' " I am trying a sample code with domain wide delegation of authority.  I am implementing the code specified in this link: https://developers.google.com/drive/web/delegation
    private DriveService GetService(String userEmail)
    {

        X509Certificate2 certificate = new X509Certificate2(SERVICE_ACCOUNT_PKCS12_FILE_PATH, "notasecret", X509KeyStorageFlags.Exportable);

        var provider = new AssertionFlowClient(GoogleAuthenticationServer.Description, certificate)
        {
            ServiceAccountId = SERVICE_ACCOUNT_EMAIL,
            Scope = DriveService.Scope.Drive.GetStringValue(),
            ServiceAccountUser = userEmail,
        };

        authenticator = new OAuth2Authenticator<AssertionFlowClient>(provider, AssertionFlowClient.GetState);

        return new DriveService(new BaseClientService.Initializer() { Authenticator = authenticator, ApplicationName = "sample" });

    }

When i compile it i am getting an error saying "'Google.Apis.Services.BaseClientService.Initializer' does not contain a definition for 'Authenticator' ". i think its because of a recent change to the API. So can someone please suggest as to how to overcome this error?

A: I would like to recomend you use the Google dot net client library.
NuGet command
PM> Install-Package Google.Apis.Drive.v2

Sample code:
using Google.Apis.Auth.OAuth2;
using System.Security.Cryptography.X509Certificates;
using Google.Apis.Services;
using Google.Apis.Drive.v2;

var serviceAccountEmail = "539621478859-imkdv94bgujcom228h3ea33kmkoefhil@developer.gserviceaccount.com";
ServiceAccountCredential certificate = new X509Certificate2(@"C:\dev\GoogleDriveServiceAccount\key.p12", "notasecret", X509KeyStorageFlags.Exportable);

ServiceAccountCredential credential = new ServiceAccountCredential(
           new ServiceAccountCredential.Initializer(serviceAccountEmail)
           {
               Scopes = new[] { DriveService.Scope.DriveReadonly }
           }.FromCertificate(certificate));

// Create the service.
var service = new DriveService(new BaseClientService.Initializer()
        {
            HttpClientInitializer = credential,
            ApplicationName = "Drive API Sample",
        });

All your requests are then run though service.   If you din't already make sure that you have both the Drive API and Drive SDK selected in your developer console application application.


text:
Q: Subscribing to event but wanting to get initial value I have a question about prism. I have the main app with ViewModel and a module with business logic. I have set up events in the module for properties that I want to be updated in the main apps ViewModel. On ViewModel load, I subscribe to all the events that are in the Module. I want to get those initial values of the in those properties when they got published on the Module Initialization but I am not sure how to do that. Could someone help me understand how it's supposed to be done?

A: You cannot receive events that were published before you subscribed. But you should have a service that provides the current values, anyway, so just inject it into the view model and get the initial values from there.


text:
Q: Question regarding Maximum Likelihood Estimation Say if we wanted to conduct MLE to obtain the parameter estimate for a simple linear regression model
e.g.
wage = β1educ
I understand that we first find the joint probability of y taking on certain values (given certain x values).
E.g. if we had a sample of data with the following results: wage=10 and educ=2, wage=15 and educ=4, wage=20 and educ=6, etc, etc.
The first step of MLE would be to compute the joint probability of all these sample values occurring.
If we have assumed that the errors are normally distributed then I have been taught that we do:

Notably, the equation inside the product operator is the formula for the PDF.
Finally, my question is:
If we can't use a PDF to say that the probability of y is exactly equal to something, then why are we doing that here?
In my example to compute the MLE we would be essentially saying that the P(y=10|x=2) is equal to some exact value given by the PDF, P(y=15|x=4) is equal to some exact value given by the PDF, etc, etc... and then obviously we multiply these probabilities together to get the likelihood. So my confusion is around the fact that we are saying that an exact probability of something occurring is given by a value on a PDF when I thought that was impossible.

A: The likelihood doesn't deal with probabilities of exact values unless the sample space of the "Y" is discrete. A probability density, like the normal PDF, doesn't give us probabilities of exact values, but I know that a density of 0.25 is more "likely" than a density of 0.1. That is the quantity we maximize.


text:
Q: Efficient way to model the data for SwiftUI I am exploring SwiftUI+Combine with a demo app BP Management.
Homescreen has a provision to take bp readings(systolicBP, diastolicBP, pulse & weight).
Button "Next" is enabled only when all 4 fields are filled.
control should fall to the next textfield when a valid input is entered. (input is valid when it falls between the range specified by the placeholder - refer the image below)
On tapping next, on the detail screen user can edit the bp values (taken in the HomeScreen), additionally he can add recorded date, notes...
Thought enums would be best model this so I proceeded like
enum SBPInput: CaseIterable {
//name is a Text to indicate the specific row
    typealias Field = (name: String, placeholder: String)

    case spb, dbp, pulse, weight, note, date
    var field: Field {
        switch self {
        case .dbp: return ("DBP", "40-250")
        case .spb: return ("SBP", "50-300")
        case .pulse: return ("Pulse", "40-400")
        case .weight: return ("Weight", "30-350")
        case .note: return ("Note", "")
        case .date: return ("", Date().description)
        }
    }

// Here I am getting it wrong, - I can't bind a read only property
    var value: CurrentValueSubject<String, Never> {
        switch self {
        case .date:
            return CurrentValueSubject<String, Never>(Date().description)
        case .spb:
            return CurrentValueSubject<String, Never>("")
        case .dbp:
            return CurrentValueSubject<String, Never>("")
        case .pulse:
            return CurrentValueSubject<String, Never>("")
        case .weight:
            return CurrentValueSubject<String, Never>("70")
        case .note:
            return CurrentValueSubject<String, Never>("")
        }
    }
}

class HomeViewModel: ObservableObject {

    @Published var aFieldsisEmpty: Bool = true
    var cancellable: AnyCancellable?
    var dataSoure = BPInput.allCases

    init() {

        var bpPublishers = (0...3).map{ BPInput.allCases[$0].value }
        //If a field is empty, we need to disable "Next" button
        cancellable = Publishers.CombineLatest4(bpPublishers[0], bpPublishers[1], bpPublishers[2], bpPublishers[3]).map { $0.isEmpty || $1.isEmpty || $2.isEmpty || $3.isEmpty }.assign(to: \.aFieldsisEmpty, on: self)
    }
}

The idea is to create HStacks for each datasorce(sbp,dbp,pulse,weight) to look like this
struct HomeScreen: View {
    @ObservedObject var viewModel = HomeViewModel()
    var body: some View {
        VStack {
            ForEach(Range(0...3)) { index -> BPField in
                BPField(input: self.$viewModel.dataSoure[index])
            }
            Button("Next", action: {
                print("Take to the Detail screen")
            }).disabled(self.viewModel.aFieldsisEmpty)
        }.padding()
    }
}

struct BPField: View {
    @Binding var input: BPInput
    var body: some View {
        //implicit HStack
        Text(input.field.name)
        BPTextField(text: $input.value, placeHolder: input.field.name)//Error:- Cannot assign to property: 'value' is a get-only property
        // input.value being read only I can't bind it. How to modify my model now so that I can bind it here?

    }
}

And my custom TextField
struct BPTextField: View {
    let keyboardType: UIKeyboardType = .numberPad
    var style: some TextFieldStyle = RoundedBorderTextFieldStyle()
    var text: Binding<String>
    let placeHolder: String
    //    var onEdingChanged: (Bool) -> Void
    //    var onCommit: () -> ()
    var background: some View = Color.white
    var foregroundColor: Color = .black
    var font: Font = .system(size: 14)
    var body: some View {
        TextField(placeHolder, text: text)
            .background(background)
            .foregroundColor(foregroundColor)
            .textFieldStyle(style)
    }
}

A: your problems are not there, what SwiftUI tells you.
but you should first compile "small parts" of your code and simplify it, so the compiler will tell you the real errors.
one is here:
BPTextField(text: self.$viewModel.dataSoure[index].value, placeHolder: viewModel.dataSoure[index].field.placeholder)

and the error is:
Cannot subscript a value of type 'Binding<[BPInput]>' with an argument of type 'WritableKeyPath<_, _>'
and of course you forgot the self ....


text:
Q: Ratio vs Difference in terms of growth Suppose we have the following data:
  start date      end date       quantity
  01/05/2014       07/05/2015        5
  07/06/2015       02/06/2016        8

What is the logic of the following expression: $$ \left[\left(\frac{8}{5} \right)^{360/215}-1 \right] \times 100 \% = 1.197 \%$$
Assume that a year is $360$ days. Intuitively I want to find the percentage difference between the two quantities for a year. When I do the following:
$$ \frac{\frac{8-5}{5}}{215/360} \times 100 \% = 1.005 \%$$
I get a percentage that is close to the above but not the same. Maybe I can take the logarithm of the first expression to get something similar to the second expression?
Note that  215  is the number of days between  07/06/2015  and  02/06/2015 .

A: You have two different models for the growth.  The one you ask about assumes the growth is a geometric series, that it starts at $5$ and is multiplied by some number $r$ each day.  The second day you would have quantity $5r$, the third $5r^2$ and the $216$th day $5r^{215}$.  They are then calculating $r$ and extending the growth to a year.  On the first day of the new year the quantity is $5r^{360}=5\left(\frac 85\right)^{(360/215)}\approx 10.984$  which is about $2.197$ times the first day.    The calculation of the increase is not correct and should yield $119.7\%$.
Your formula assumes the growth is an arithmetic series, that it grows by a fixed amount each day.  The first day you have quantity $5$, the second $5+d$, the third $5+2d$ and the $216$th day $5+215d$.  On the first day of the new year year you will have quantity $5+360d$.    You can calculate $d=\frac {8-5}{215}\approx 0.014$, giving a quantity on the first day of the new year of about $10.023$, which would be an increase of about $100.5\%$  You should not be dividing the growth in $215$ days by $5$ if you consider it an arithmetic series.
Which model of growth is correct (if either) is not a mathematical question.


text:
Q: cakePHP force download of ical I have the following in a layout file;
<?php
$Filename = "TheEvent.vcs";
header("Content-Type: application/force-download");
header("Content-Disposition: inline; filename=$Filename");
echo $content_for_layout;
?>

Now in the controller I have this layout defined and it is working as I can see the text of my ical file. The only problem is the download isn't being forced on the client.
I followed the following guide though I am using cakePHP 2.0
http://labs.iamkoa.net/2007/09/07/create-downloadable-ical-events-via-cake/
Thanks
Ash

A: you can use the new 2.0 request features to download right away:
$this->response->download($filename);

http://www.dereuromark.de/2011/11/21/serving-views-as-files-in-cake2/
You can use file() and the other documented ways of serving files - see http://book.cakephp.org/2.0/en/controllers/request-response.html#cakeresponse

A: This is because the "Content-Type: application/force-download" is used and not recognized by your HTTPd server.
Thus your php script is an unknown type of content and your browser got the signal to download the file and save it :)

A: The accepted answer got me Method download does not exist.
Here's what worked for me:
$this->response->download($filename);

Note request replaced with response.
Source: class-CakeResponse.html.


text:
Q: Changing the color of existing titlebar and icons I am developing a desktop application in which I want to change the color of the title bar in tkinter. enter image description here

A: Tkinter doesn't provide the ability to change the color of the titlebar.


text:
Q: Implement a Proxy Pattern for a Tastypie Resource I have a FooResource that is related to a BarResource through a toOneField as my FooModel has a FK to BarModel. What I'm really interested in is BlahModel represented through the BlahResource. So I can logically get to a BlahModel from a BarModel, how should I handle this with Tastypie, so that when there's a
bar = fields.ToOneField(BarResource, 'bar', full=True)

in the FooResource, I actually get the data from a BlahModel instead of the BarModel?
I know I can't use a ToOneField in BarResource to BlahResource as there is no corresponding FK in the model. I would prefer not to end up in a complicated dehydrate hack as well. What is the easiest way to implement a Proxy Pattern in a Tastypie ModelResource?


text:
Q: dual-stack ipv6/ipv4 on localhost I have an ipv4 server that only accepts connections over localhost (using INADDR_LOOPBACK).  I'd like to convert this server to be dual-stack ipv6/ipv4.  However, using in6addr_loopback only accepts connections to ::1.
I've found that I can accept ipv4 and ipv6 connections simultaneously using in6addr_any, but as this also allows connections from anywhere it's not useful for my particular case.
Is it possible to bind to ipv6 localhost (::1) and ipv4 localhost (127.0.0.1) simultaneously?

A: AFAIK, that is not possible.
What you will need to do is create two sockets, one bound to INADDR_LOOPBACK and one bound to in6addr_loopback.  You can then wait on both of them simultaneously using your multiplexer of choice (poll, select, epoll, etc0).
Update
Just came up with some work-arounds that you may want to consider.  In both of these work-arounds, you bind to in6addr_any.

*

*When a connection is established, check the remote address and if it's not 127.0.0.1 or ::1, close it.  While the behavior of connecting on an IP address is not ideal (connections are established/immediately closed instead of being refused), the nice thing it that this can be done purely in your application.

*Adjust the settings of your OS's IP stack to refuse connections to your port from non loopback IP's.  This is definitely doable on Linux with iptables.  While the behavior is more ideal, it requires configuration external to your application.

A: Just because your server is dual-stack, does your localhost-only app really need to be? Can you just pick one and go with it?


text:
Q: Set button:before to dimensions of button in css I'm messing around with CSS animations with pseudo elements for the first time.
I have a button that I want a ripple effect on click, without javascript. I'm almost there, but my button's ':before' element keeps setting itself to the width of the container rather than the width of the button.
Is there any way that I can set the dimensions of the buttons ':before' to the dimensions of the button without JavaScript? Also, I'm having trouble with the actual positioning of the :before element, ideally I would like it to perfectly overlap with the button's border. So any advice with that would help a lot!
Here's the codepen (uses sass): https://codepen.io/NotDan/pen/qvKvQv

*

*the effect is working the way I want it to, it's just the alignment and sizing of the :before element that I need help with

Here's the css:
.custom-btn-primary {
    display: block;
    background: rgba(0, 0, 0, 0);
    color: #d98324;
    border: 2px solid #d98324;
    padding: 0.5rem 1.5rem;
    text-transform: uppercase;
    transition: all 0.5s ease-in-out;
}
.custom-btn-primary:hover {
    color: #e5a864;
    border: 2px solid #e5a864;
    transition: all 0.5s ease-in-out;
}
.custom-btn-primary:before {
    content: "";
    background-color: rgba(0, 0, 0, 0);
    border: 2px solid #d98324;
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
}
.custom-btn-primary:focus {
    outline: 0;
    background-color: #d98324;
    color: #230007;
    font-size: calc(1em + 2px);
    border: 0;
}
.custom-btn-primary:focus:before {
    animation: ripple-out 0.5s ease-out;
}

Here's the html:

        <button class="custom-btn-primary">primary</button>

        <button class="custom-btn-secondary">secondary</button>

        <button class="custom-btn-light">light</button>

A: I played around with your codepen and found that you just need to add position: relative; to your .custom-btn-#{$color} class.
Your :before pseudo element is already position: absolute but it's currently positioning itself to the column instead of the button itself.


text:
Q: How to concat all columns of a table with different types with their values by identity in SQL query? I want to have a function to get Table Name and Row ID and return a nvarchar type, for example I have a table A like this:
TABLE A
(
    ID INT IDENTITY,
    Name NVARCHAR(50) NOT NULL,
    Active BIT NULL,
    Date DATE NULL
)

For example first row value is:
1,'jon',true,'06/08/2018'

This function should return this output:
ID:'1', Name:'jon', Active:'true', Date:'06/08/2018'

More explaining:
I have a log table that while a row is deleted from any other table,want to copy all columns with their values as text into log table as above.

A: As discussed with comment,UDF is not work because the below query deals with dynamic SQL. Although I am not recommending this solution for longer run as this involves much dynamic queries.
The code is self explanatory. First get the columns converting into NVARCHAR and columns list. Then get the data unpivoting Column Name and Value. Then concatenate the result as desired.
Create a procedure like this,
CREATE PROC uspGetLogString(@TABLE VARCHAR(50), @ID INT)
AS
    BEGIN
    DECLARE @RETURNVALUE NVARCHAR(MAX) = ''
    DECLARE @WHERECLAUSE NVARCHAR(MAX) = 'ID = ' + CONVERT(NVARCHAR(50), @ID)
    DECLARE @COLUMNSWITHTYPE NVARCHAR(MAX) = ''
    DECLARE @COLUMNS NVARCHAR(MAX) = ''

    SELECT @COLUMNSWITHTYPE  = @COLUMNSWITHTYPE +
        CASE
            WHEN CL.DATA_TYPE = 'BIT' THEN 'CONVERT(NVARCHAR(50), CASE WHEN ' + CL.COLUMN_NAME + ' = 1 THEN ''True'' ELSE ''False'' END) AS ' + CL.COLUMN_NAME + ''
            WHEN CL.DATA_TYPE != 'NVARCHAR' THEN 'CONVERT(NVARCHAR(50), ' + CL.COLUMN_NAME + ') AS ' + CL.COLUMN_NAME + ''
            ELSE CL.COLUMN_NAME
        END  + ', ' FROM INFORMATION_SCHEMA.COLUMNS CL WHERE TABLE_NAME = @TABLE
    SELECT @COLUMNS  = @COLUMNS + CL.COLUMN_NAME + ', ' FROM INFORMATION_SCHEMA.COLUMNS CL WHERE TABLE_NAME = @TABLE

    SELECT @COLUMNSWITHTYPE = LEFT(@COLUMNSWITHTYPE, LEN(@COLUMNSWITHTYPE) - 1)
    SELECT @COLUMNS = LEFT(@COLUMNS, LEN(@COLUMNS) - 1)
    SELECT @COLUMNSWITHTYPE = 'SELECT ' + @COLUMNSWITHTYPE + ' FROM ' + @TABLE + ' WHERE ' + @WHERECLAUSE

    DECLARE @DynamicSQL NVARCHAR(MAX) = ''

    SELECT @DynamicSQL = 'DECLARE @RESULT NVARCHAR(MAX) = ''''
    SELECT @RESULT = @RESULT + TAB.COLUMN_NAME + '':'' + U.ColumnValue +'', ''
    FROM INFORMATION_SCHEMA.COLUMNS TAB
    INNER JOIN
        (
            SELECT ColumnName, ColumnValue
            FROM (' +  @COLUMNSWITHTYPE + ')
            AS P
            UNPIVOT
            (
                ColumnValue FOR ColumnName IN (' + @COLUMNS + ' )
            ) as unpvt
        )
         as U ON U.ColumnName = Tab.COLUMN_NAME
    WHERE TAB.TABLE_NAME = ''' +  @TABLE + ''';
    SELECT @RESULT = LEFT(@RESULT, LEN(@RESULT) - 1)
    SELECT @RESULT
    '
    EXEC SP_EXECUTESQL @DynamicSQL, N'@OUTPUT NVARCHAR(MAX) OUT', @RETURNVALUE
END
GO

Then call it like,
EXEC dbo.uspGetLogString 'EMPLOYEE', 1

A: Since these things should be done in front-end or in your application layer still an answer I would suggest would be having an inline-table valued function for this. (note don't use a scalar function since it's not really a good performant.)
CREATE FUNCTION dbo.itvf_concata (
                                       @id INT
                                 )
RETURNS TABLE
RETURN SELECT 'ID:''''' + CONVERT(VARCHAR(12), id)
              + ''''', Name:''''' + name
              + ''''', Active:'''''
              + CASE
                      WHEN Active = 1 THEN 'TRUE'
                      ELSE    'FALSE'
                END
              + ''''', Date:''''' + CONVERT(VARCHAR(10), [Date],101) + ''''
       FROM   a
       WHERE  id = @id;

A: I changed the @Selva TS answer to correct errors and finally get to this:
CREATE PROC dbo.SP_GetLogString (@TABLE VARCHAR(50), @ID INT)
AS
BEGIN
DECLARE @RETURNVALUE NVARCHAR(MAX) = ''
DECLARE @PKey NVARCHAR(50) = (SELECT
  column_name AS PRIMARYKEYCOLUMN
FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS AS TC
INNER JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE AS KU
  ON TC.CONSTRAINT_TYPE = 'PRIMARY KEY'
  AND TC.CONSTRAINT_NAME = KU.CONSTRAINT_NAME
  AND KU.table_name = @TABLE)
DECLARE @WHERECLAUSE NVARCHAR(MAX) = @PKey + ' = ' + CONVERT(NVARCHAR(50), 1000)
DECLARE @COLUMNSWITHTYPE NVARCHAR(MAX) = ''
DECLARE @COLUMNS NVARCHAR(MAX) = ''

SELECT
@COLUMNSWITHTYPE = @COLUMNSWITHTYPE +
CASE
  WHEN CL.DATA_TYPE = 'BIT' THEN 'CONVERT(NVARCHAR(max), CASE WHEN ' +            CL.COLUMN_NAME + ' = 1 THEN ''True'' ELSE ''False'' END) AS ' + CL.COLUMN_NAME + ''
  WHEN CL.DATA_TYPE = 'float' THEN 'CONVERT(NVARCHAR(max), CONVERT(numeric,' + CL.COLUMN_NAME + ')) AS ' + CL.COLUMN_NAME + ''
  ELSE 'CONVERT(NVARCHAR(max), ' + CL.COLUMN_NAME + ') AS ' + CL.COLUMN_NAME + ''
END + ', '
FROM INFORMATION_SCHEMA.COLUMNS CL
WHERE TABLE_NAME = @TABLE
AND CL.DATA_TYPE <> 'image'
SELECT
@COLUMNS = @COLUMNS + CL.COLUMN_NAME + ', '
FROM INFORMATION_SCHEMA.COLUMNS CL
WHERE TABLE_NAME = @TABLE
AND CL.DATA_TYPE <> 'image'

SELECT
 @COLUMNSWITHTYPE = LEFT(@COLUMNSWITHTYPE, LEN(@COLUMNSWITHTYPE) - 1)
SELECT
@COLUMNS = LEFT(@COLUMNS, LEN(@COLUMNS) - 1)
SELECT
@COLUMNSWITHTYPE = 'SELECT ' + @COLUMNSWITHTYPE + ' FROM ' + @TABLE + ' WHERE ' +   @WHERECLAUSE

DECLARE @DynamicSQL NVARCHAR(MAX) = ''

SELECT
@DynamicSQL = 'DECLARE @RESULT NVARCHAR(MAX) = ''''
SELECT @RESULT = @RESULT + TAB.COLUMN_NAME + '':'' + U.ColumnValue +'', ''
FROM INFORMATION_SCHEMA.COLUMNS TAB
INNER JOIN
    (
        SELECT ColumnName, ColumnValue
        FROM (' + @COLUMNSWITHTYPE + ')
        AS P
        UNPIVOT
        (
            ColumnValue FOR ColumnName IN (' + @COLUMNS + ' )
        ) as unpvt
    )
     as U ON U.ColumnName = Tab.COLUMN_NAME
 WHERE TAB.TABLE_NAME = ''' + @TABLE + ''' and TAB.DATA_TYPE<>''image'';
 SELECT @RESULT = LEFT(@RESULT, LEN(@RESULT) - 1)
   SELECT @RESULT'  EXEC SP_EXECUTESQL @DynamicSQL  ,N'@OUTPUT NVARCHAR(MAX)OUT',@RETURNVALUE
END
GO


text:
Q: Which Class has to be reimplemented for custom Selection in QTableWidget? QTableWidget consists of several Selection Modi, which are selectable with the method
setSelectionMode (QAbstractItemView::SelectionMode mode)

None of the given modi fits the type of interactive selection i want to have. I want to implement a selection mode where when a user clicks in one table cell, and then shift+clicks in another table cell, the resulting selection is not a sum of columns and rows between these two, but starts from the first clicked cell, goes in read direction along row by row, ending by the second click. I hope i made clear what i want to do.
Do i need to overwrite the QItemSelectionModel or the QTableWidget?
Where are the user clicks for selection are processed?

A: You need to create a descendant of QItemSelectionModel and reimplement select.
virtual void select(const QModelIndex & index, QItemSelectionModel::SelectionFlags command)
virtual void select(const QItemSelection & selection, QItemSelectionModel::SelectionFlags command)

When reimplementing select you can call QItemSelectionModel::select with different arguments to achieve the needed result.
Then assign an instance of the selection model to QTableWidget with setItemSelectionModel.


text:
Q: Interactive C# Process Communication I've developed a C# program which I'm using as a child process of a parent process ( which is written in a different programming language than C#, namely: Smallworld Magik ). Standard I/O Channels to the C# program are used to communicate.
The meaning is to communicate with the C# program from the Smallworld Magik process. So, the C# program should receive commands from the Smallworld Magik process, and the Smallworld Magik process should receive the results/updates of the C# program.
The C# program initially receives the arguments by the main method of the program.
The C# program writes the results/updates to the Output Channel and the Smallworld Magik process receives and handles them.
No problems till here.
The problem is located in receiving input commands from the Input Channel ( System.Console.In ) by the C# program. I'm using the System.Console.ReadLine() method to get the input command. Calling this method blocks further Program execution.
Does someone have a "non-blocking" solution to this?
Since I'm a rooky C# developer, keep it low-level :).

A: You could use Threading, and since you say you're a rooky i'm gonna direct you to the tutorial because threading is tricky and you should know what you're doing: http://msdn.microsoft.com/en-us/library/aa645740(v=vs.71).aspx
Next thing you do is create a seperate thread for the ReadLine and invoke the result back to the main thread. Like this:
void Start()
{
    Thread T = new Thread(ThreadMethod);
    T.IsBackground = true;
    T.Start();
}

void ThreadMethod()
{
    string s = System.Console.ReadLine();

    this.Invoke(DoStuffInMain, s);
}

void DoStuffInMainThread(string s)
{
    //
}


text:
Q: Strange behaviour while trying to add element to a JPA entity list : only the first element persist sorry for my English in advance.
I trying to add elements in an entity list and only the first element stay in this list.
Here an example :
Project project = project_facade.find(1L);
Machine machine = machine_facade.find(1L);

for(int i=0;i<3;i++){
    Test test = new Test();
    test.setName("Test "+i);

    test.setProject(project);
    test.setMachine(machine);

    project.getTestList().add(test);
    machine.getTestList().add(test);
}

project.getMachineList().add(machine);
machine.getProjectList().add(project);

project_facade.edit(project);

After this, in the database, the project and the machine are linked correctly (through a mapping table), but the Test table contains only the record "Test 0" (the project_id field and machine_id field are correct).
I don't understand why it's work for the first element only...
Thanks for your help !!!
Project entity:
@Entity
public class Project implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Long id;

    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 45)
    @Column(name = "name")
    private String name;

    @ManyToMany(mappedBy = "projectList", cascade = CascadeType.ALL)
    private List<Machine> machineList;

    @OneToMany(mappedBy = "project", cascade = CascadeType.ALL *SOLUTION : ,fetch = FetchType.EAGER* )
    private List<Test> testList;

    //constructor, getters, setters
}

Machine Entity:
@Entity
public class Machine implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Long id;

    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 45)
    @Column(name = "name")
    private String name;

    @JoinTable(name = "project_machine", joinColumns = {
        @JoinColumn(name = "machine", referencedColumnName = "id")}, inverseJoinColumns = {
        @JoinColumn(name = "project", referencedColumnName = "id")})
    @ManyToMany
    private List<Project> projectList;

    @OneToMany(mappedBy = "machine",cascade = CascadeType.ALL)
    private List<Test> testList;

    //constructor, getters, setters
}

Test Entity:
@Entity
public class Test implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Long id;

    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 64)
    @Column(name = "name")
    private String name;

    @JoinColumn(name = "project", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Project project;

    @JoinColumn(name = "machine", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Machine machine;

    //constructor, getters, setters
}

Then all my facades extends AbstractFacade where edit method is:
public void edit(T entity) {
        getEntityManager().merge(entity);
    }

A: I found the answer !!!!! I have added "fetch = FetchType.EAGER" on the OneToMany annotation of Project entity !


text: Q: How to set the playback speed of TMediaPlayer? I'm using Delphi 10.4 for developing an Android mobile application. I'm using the TMediaPlayer component for playing MP3 files. I need to set the playback speed of the media files as 1x, 2x, and 4x. I did not find any sample code regarding this. How can I implement this feature?