text:
Q: Deforming a rectangular image into an irregular shape I've been looking around the net on how to deform regular shaped to irregular shapes. So far i have only found resources regarding making things follow a curved path or simmilar.
I am looking to do a full shape transformation. Turning a regular rectangle into a irregular shape, efficiently. My ideal goal is to use this for simple 2D cloth simulation animation.

Are there any existing resources on the web that i have not managed to find? Or do any of you know how i would go about creating an algorithm to deal with this type of deformation.
My initial guess would be to deform my shape sequentially axis by axis, but i fear this may lead to a lot of distortion. Any ideas?

A: Yes, you can do it by breaking the image up into rectangles (and then each rectangle into two triangles) and then using graphics.drawImage(..) after setting an AffineTransform to the graphics (which is a different transform for each triangle).
I've done it in this applet: http://nik-sergeev.com/trees.html
(If you click through the various warnings about Java applets that come up nowadays), then what you will see when you click on pages or bookmarks in the applet is a "page turning" effect, which is done as described above. (It's an applet that is supposed to look like a book.)
Any mapping that is locally affine can be achieved this way. (Which is most of the ones you would ever care about.)
To find the six parameters that define the AffineTransform for each triangle, you have to ray-trace for the three corners of each triangle. (If you're not familiar with "ray tracing", it's much easier than it sounds. You just have to specify where the point maps from and where it maps to.) Then solve for the affine transform parameters using some basic maths.


text:
Q: Kubernetes - node capacity I'm running a small node in gcloud with 2 pods running. Google cloud console shows all resources utilization
<40% cpu utilization
about 8k n\w bytes
about 64 disk bytes.
When adding the next pod, it fails with below error.
FailedScheduling:Failed for reason PodExceedsFreeCPU and possibly others
Based on the numbers I see in google console, ~60% CPU is available. is there anyway to get more logs? Am I missing something obvious here?
Thanks in advance !

A: As kubernetes reserve some space if more cpu or memory is needed you should check the capacity allocated by the cluster instead of the utilization.
kubectl describe nodes
You can find a deeper description about the capacity of the nodes in: http://kubernetes.io/docs/user-guide/compute-resources/

A: In your helm chart or Kubernetes yaml, check the resources section. Even if you have free capacity, if your request would put the cluster over, even if your pod etc wouldn't actually use that much, it will fail to schedule. The request is asking for a reservation of capacity. IE:
spec:
  serviceAccountName: xxx
  containers:
  - name: xxx
    image: xxx
    command:
    - cat
    tty: true
    resources:
      requests:
        memory: "256Mi"
        cpu: "250m"
      limits:
        memory: "256Mi"
        cpu: "250m"

If the value for cpu there could make the cluster oversubscribed, it won't schedule the pod. So make sure your request reflect actual typical usage. If your requests do reflect actual typical usage, then you need more capacity.

redpajama_set_name: RedPajamaStackExchange


text:
Q: *ngIf condition is not getting evaluated HTML code below has a date input field and unordered list of bootstrap class list-group. Based on the template variable for date input html field, i need to load the unordered list. However, the ul is always getting rendered/displayed. what am i missing in the code below?

                <input
                  #queryInvoiceDate
                  (change)="filterInvoiceSingleDate(queryInvoiceDate.valueAsDate)"
                  type="date"
                  class="form-control"
                  style="width:100%"
                  placeholder="Enter date:" >

Service fee deducted: {{filteredServiceAmountTotal | number:'1.1-2' | currency:'USD'}}

Revenue made by Venue: {{filteredVenueRevenueTotal | number:'1.1-2' | currency:'USD'}}

Total Revenue: {{filteredTotalRevenue | number:'1.1-2' | currency:'USD'}}

A: I would put something in to filterInvoiceSingleDate like dateSelected=true and use it in the ngIf
html:

ts:
dateSelected=false
filterInvoiceSingleDate(){
this.dateSelected=true
//your code
}


text:
Q: Better way to get property from derived class i have next class
public class MainClass
{
   public ClassA someProp { get; set; }
}

public class ClassA
{
   public virtual Type Types => Type.None;
}

public class ClassB:ClassA
{
   public override Type Types => Type.Default;

   public string FieldName { get; set; }
}

i want get FieldName from ClassB
var result = entities.Where(x => x.someProp != null).Select(x => x.someProp).ToList();

and than i get
var fields = (from ClassB in result select t.FieldName).ToList();

what is better way get FieldName from ClassB
I don't think this is the best solution. Maybe there are some best practices for my question?

A: You've to filter the entities and get only those that are ClassB, then read the property as usual.
var values = entities
      .Select(mainClass => mainClass.SomeProp)
      .OfType<ClassB>()
      .Select(classB => classB.FieldName)

A: You can try this:
var fields = entities
    .Where(item => item.someProp is ClassB)
    .Select(item => item.someProp)
    .Cast<ClassB>()
    .Select(item => item.FieldName).ToList();

A: This is a shorter way, you can try cast ClassB from someProp:
var result = lst.Where(x => x.someProp != null).Select(x => (ClassB)x.someProp).Select(x => x.FieldName).ToList();


text:
Q: Geometric meaning of the $L^p$-norm of $|A|$ Let be $M$ an oriented smooth surface on $\mathbb{R}^3$, $|A|$ the norm of the second fundamental form of $M$ and $dV$ the element of area. I would like to know if there is a geometric meaning for the quantity $|| \ |A| \ ||_p^p = \int_M |A|^p dV$? I saw this appears in "A compactness theorem for surfaces with $Lp$-bounded second fundamental form" by Joel Langer and this seems an important quantity since the integrand $|A| = \sqrt{4H^2 - 2K}$ and the quantities $H$ and $K$ are invariant under change of the basis. I looked for an explanations about the $L^p$-norm of $|A|$ in Riemannian Geometry's textbooks and in Differential Geometry's textbooks, but I couldn't find nothing.
More generally, if $M$ is an oriented smooth $n$-manifold immersed on $\mathbb{R}^{n+1}$, $|A|$ the norm of the second fundamental form of $M$ and $dV$ the element of volume, then there is an geometric meaning for the quantity $|| \ |A| \ ||_p^p = \int_M |A|^p dV$? Again, it seems that there is an intepretation since $|A|^2 - \frac{H^2}{n} = \sum_{i < j} (\lambda_i - \lambda_j)^2$, where $\lambda_i$ are the principal curvatures of $M$.
Thanks in advance!


text:
Q: KDE Plasma Application Launcher is opening in the middle of the screen I'm not sure what I did, but for some reason, my application launcher menu now opens in the middle of the screen. It only happens when I select "application launcher" from the "show alternatives" menu.
I'm 100% sure I've selected "application launcher" and not "application dashboard". The behavior isn't like the dashboard. It is a smaller window, although much larger that the standard application launcher right panel.

Is this a setting or a bug? If it's a setting, I can't find it.
Any help is appreciated.

A: Okay, I have this solved with much help from the comments above.
KDE Plasma 5 treats the application launcher like a window, and it can be resized and moved.

*

*To move the application launcher: Super + Left-Click and hold

*To resize the application launcher: Super + Right-Click and hold

*To change the width of the left sidebar: Right-click the launcher icon and select "configure application launcher." Under layouts, make sure the "resizable sidebar" is selected. Then, hover over the sidebar border and drag to resize.

If you make the left sidebar thin enough, it will hide the text for the categories.
I hope this helps someone!


text:
Q: Color contrast setting on dataLabels style parameter using Highcharts 5 is not working on some colors Below is a simple chart. With datalable style settings. Notice the lighter colors are setting to white (when they should set to black) making it an item of complaint with my clients because they can't see them well.
Here is the code (note the style parameter block):
$(function () {
Highcharts.chart('containera', {
  chart:{ type:'column' },
  xAxis: {
    categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
  },
  plotOptions: {
    series: {
    colorByPoint: true,
      dataLabels: {
        enabled: true,
        inside:true,
        style: {
          fontWeight: 'bold',
          color: 'contrast',
          textShadow: false
        }
      }
    }
  },
  series: [{
      data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
  }]
  });
});

Here is the Fiddle (also in the fiddle it is ignoring the textshadow:false):
http://jsfiddle.net/franktudor/98Ldn972/
Here is the image (note the green and orange):

What are the thresholds for contrast? Can they be altered as a global? Because that would be handy. I have 200 charts would like to fix what the highcharts engine considers light and dark colors for contrast labels globally if possible.

A: The current contrast function looks like this:
    /**
     * Returns white for dark colors and black for bright colors.
     *
     * @param {ColorString} rgba - The color to get the contrast for.
     * @returns {string} The contrast color, either `#000000` or `#FFFFFF`.
     */
    getContrast: function(rgba) {
        rgba = color(rgba).rgba;
        return rgba[0] + rgba[1] + rgba[2] > 2 * 255 ? '#000000' : '#FFFFFF';
    },

You could extend highcharts and override that function to control the contrast however you'd like.  I changed the test from rgba[0] + rgba[1] + rgba[2] > 2 * 255 to  rgba[0] + rgba[1] + rgba[2] > 500 and it solves your stated problem.  But, there is probably some better color logic you could apply.
  // override getContrast function
  (function(H) {
    H.Renderer.prototype.getContrast = function(rgba) {
      rgba = H.Color(rgba).rgba;
      return rgba[0] + rgba[1] + rgba[2] > 500 ? '#000000' : '#FFFFFF';
    };
  }(Highcharts));

http://jsfiddle.net/98Ldn972/3/
Edit:
Just noticed the textShadow part of the question.  I think what you want to remove is the textOutline
style: {
    fontWeight: 'bold',
    color: "contrast",
    textOutline: false
}

http://jsfiddle.net/98Ldn972/4/


text:
Q: Java: Enum parameter in method I have a method lets say:
private static String drawCellValue(
    int maxCellLength, String cellValue, String align) { }

and as you can notice, I have a parameter called align. Inside this method I'm going to have some if condition on whether the value is a 'left' or 'right'.. setting the parameter as String, obviously I can pass any string value.. I would like to know if it's possible to have an Enum value as a method parameter, and if so, how?
Just in case someone thinks about this; I thought about using a Boolean value but I don't really fancy it. First, how to associate true/false with left/right ? (Ok, I can use comments but I still find it dirty) and secondly, I might decide to add a new value, like 'justify', so if I have more than 2 possible values, Boolean type is definitely not possible to use.
Any ideas?

A: This should do it:
private enum Alignment { LEFT, RIGHT };
String drawCellValue (int maxCellLength, String cellValue, Alignment align){
  if (align == Alignment.LEFT)
  {
    //Process it...
  }
}

A: I like this a lot better.
reduces the if/switch, just do.
private enum Alignment { LEFT, RIGHT;

void process() {
//Process it...
}
};
String drawCellValue (int maxCellLength, String cellValue, Alignment align){
  align.process();
}

of course,
it can be:
String process(...) {
//Process it...
}

A: Even cooler with enums you can use switch:
switch (align) {
   case LEFT: {
      // do stuff
      break;
   }
   case RIGHT: {
      // do stuff
      break;
   }
   default: { //added TOP_RIGHT but forgot about it?
      throw new IllegalArgumentException("Can't yet handle " + align);

   }
}

Enums are cool because the output of the exception will be the name of the enum value, rather than some arbitrary int value.

A: Sure, you could use an enum.  Would something like the following work?
enum Alignment {
    LEFT,
    RIGHT
}

private static String drawCellValue(int maxCellLength, String cellValue, Alignment alignment) { }
If you wanted to use a boolean, you could rename the align parameter to something like alignLeft. I agree that this implementation is not as clean, but if you don't anticipate a lot of changes and this is not a public interface, it might be a good choice.

A: You could also reuse SwingConstants.{LEFT,RIGHT}. They are not enums, but they do already exist and are used in many places.

A: I am not too sure I would go and use an enum as a full fledged class - this is an object oriented language, and one of the most basic tenets of object orientation is that a class should do one thing and do it well.
An enum is doing a pretty good job at being an enum, and a class is doing a good job as a class.  Mixing the two I have a feeling will get you into trouble - for example, you can't pass an instance of an enum as a parameter to a method, primarily because you can't create an instance of an enum.
So, even though you might be able to enum.process() does not mean that you should.

A: You can use an enum in said parameters like this:
public enum Alignment { LEFT, RIGHT }
private static String drawCellValue(
int maxCellLength, String cellValue, Alignment align) {}

then you can use either a switch or if statement to actually do something with said parameter.
switch(align) {
case LEFT: //something
case RIGHT: //something
default: //something
}

if(align == Alignment.RIGHT) { /*code*/}


text:
Q: How to color specific row in excel table? I create excel file using NPOI dll's.
I have this code that create excel table  from List<someObjects> :
IWorkbook workbook = new XSSFWorkbook();
ISheet sheet1 = workbook.CreateSheet("Sheet 1");
IRow header = sheet1.CreateRow(0);

header.CreateCell(0).SetCellValue("Id");
header.CreateCell(1).SetCellValue("Name");
header.CreateCell(2).SetCellValue("E-Mail");
header.CreateCell(3).SetCellValue("PhoneNumber");

for (int i = 0; i < list.Count(); i++)
{
   IRow row = sheet1.CreateRow(i + 1);
   row.CreateCell(0).SetCellValue(list[i].id);
   row.CreateCell(1).SetCellValue(list[i].name);
   row.CreateCell(2).SetCellValue(list[i].email);
   row.CreateCell(3).SetCellValue(list[i].phoneNumber);
 }

Then I make each cell bordered in the table created above.
Here is the code:
    public void setBorderExcel()
    {

        XSSFCellStyle myStyle = (XSSFCellStyle)workbook.CreateCellStyle();
        myStyle.BorderBottom = BorderStyle.Medium;
        myStyle.BorderTop = BorderStyle.Medium;
        myStyle.BorderLeft = BorderStyle.Medium;
        myStyle.BorderRight = BorderStyle.Medium;

        for (int i = 0; i < 7; i++)
        {
            for (int j = 0; j < 4; j++)
            {
                workbook.GetSheetAt(0).GetRow(i).GetCell(j).CellStyle = myStyle;
            }
        }
    }

Then I make each odd row in the table created above colored.
Here is the code:
    public void setColorExcel()
    {
        for (int i = 0; i < 7; i++)
        {
            for (int j = 0; j < 4; j++)
            {
                if (i % 2 == 0) continue;

                workbook.GetSheetAt(0).GetRow(i).GetCell(j).CellStyle.FillForegroundColor = HSSFColor.Grey25Percent.Index;
                workbook.GetSheetAt(0).GetRow(i).GetCell(j).CellStyle.FillPattern = FillPattern.SolidForeground;

            }
        }
    }

And here is the result that I get:

As you can see the color applied to all rows in the table while, I wanted to color only the odd rows.
My question is why I get colored all rows? And how can I make colored only specific rows?

A: I think I understand it.  You have applied the same XSSFCellStyle instance to all cells' Style property in (setBorderExcel).  So, now they all have the same instance, so when you change a property on the CellStyle of one of the cells, it's changing the CellStyle instance which is associated with all cells.
You'll most likely need two XSSFCellStyle instances.  One for odd rows and another for even rows.

A: I tried it out, and although I'm not sure why your way doesn't work, there is an easier way with less lines (simply declare another CellStyle with grey background, and use that instead of myStyle):
XSSFCellStyle myStyle = (XSSFCellStyle)workbook.CreateCellStyle();
myStyle.BorderBottom = BorderStyle.Medium;
myStyle.BorderTop = BorderStyle.Medium;
myStyle.BorderLeft = BorderStyle.Medium;
myStyle.BorderRight = BorderStyle.Medium;

XSSFCellStyle myStyleGrey = (XSSFCellStyle)workbook.CreateCellStyle();
myStyleGrey.BorderBottom = BorderStyle.Medium;
myStyleGrey.BorderTop = BorderStyle.Medium;
myStyleGrey.BorderLeft = BorderStyle.Medium;
myStyleGrey.BorderRight = BorderStyle.Medium;
myStyleGrey.FillForegroundColor = HSSFColor.Grey25Percent.Index;
myStyleGrey.FillPattern = FillPattern.SolidForeground;

for (int i = 0; i < 7; i++)
{
    for (int j = 0; j < 4; j++)
    {
        if (i % 2 == 0)
            workbook.GetSheetAt(0).GetRow(i).GetCell(j).CellStyle = myStyle;
        else
            workbook.GetSheetAt(0).GetRow(i).GetCell(j).CellStyle = myStyleGrey;
    }
}

You can remove your code for setColorExcel() and it should work as expected, setting odd rows to grey.


text:
Q: Is recommended to use Sherlock Action Bar? I'm working on an android project, in which i'm going to implement the tab layout, with TabHost, Fragment, and ViewPager.
By the way, I found some tutorial about the Sherlock Action Bar, and here is my question:
Is better the "native" code, or use this library?
What's your experience about this topic? And what's your suggestion?
Thanks.

A: If you're going to target an Android SDK version < 11 (Honeycomb 3.0), ActionBarSherlock is definitely better than ActionBarCompat, the official solution for backwards compatibility offered by Google. Otherwise if you're developing using only APIs >= 11 use the default ActionBar because ABS implements nothing more than that.
Here you can find an article written by Jake Wharton (the developer of ABS) where he discusses different ActionBar solutions pros and cons.

A: Short Answer:
If you want your application to look the same, including the action bar... then yes. It is NOT frowned upon, and Google mentions ABS all the time. From Google I/O to meetups in New York. ABS is always a recommended way to get compatibility with older devices/versions.

A: The Sherlock Action Bar is only to provide backwards support for API 10 and below. Above that you should use Action Bar since it was added in API 11 (3.0). So to answer your question, if you are targetting API 11 and up, use the native Action Bar, otherwise you will HAVE to use Action Bar Sherlock to get that look.
Here are the websites to both:
Action Bar
and
Action Bar Sherlock


text:
Q: Saving windows wireless profile credentials Is there any way to replicate the functionality of "Save credentials" button in the "802.1x settings" menu using Windows API? Or some other way to permanently save the PEAP credentials for the wireless profile.
I've tried the WlanSetProfileEapXmlUserData function to set MsChapV2:Username and MsChapV2:Password. It caches the credentials but does not save them permanently.
UPD: Managed to locate the userdata stored in HKLM\SOFTWARE\Microsoft\Wlansvc\UserData\Profiles\{GUID} but it is encrypted. I guess CryptProtectData is used to encrypt it. If only I knew what kind of salt is used.

A: HKLM\SOFTWARE\Microsoft\Wlansvc\UserData\Profiles\{GUID}\MSMUserData contains the data related to PEAP credentials.
It is encrypted with CryptProtectData. Decryption gave us a binary blob which is luckily easy to understand. It contains username and possibly logon domain in plain text. Password info is encrypted again with CryptProtectData function and placed towards the end of the blob.
Encryption is done without LOCAL_MACHINE flag so only Local System user can generate new credentials data. After you place it into the registry key, Windows thinks that you have a saved set of credentials and will never ask for them even in case of failed authentication.

A: You can find more information on WPA2-Enterprise credentials encryption scheme of MSMUserData in my answer https://superuser.com/a/1259271/780533 to the "How can I find Protected EAP credentials of a wireless network stored on Windows 7?" question. In particular, the "unreadable characters" (note that them begin with 01 00 00 00 d0 8c 9d df ...) following the username in the decrypted MSMUserData are the encrypted password so you need to decrypt again using CryptProtectData.


text:
Q: "Met" vs. "met up" Do these two terms mean two different things? as in:

I met up with Julie when I went to town/I met Julie when I went to town.

A: It can mean exactly the same thing, but can also be used differently.
You would say "I met..." when the meeting might have been brief or accidental, as opposed to "I met up..." where you can assume previous appointment.

A: "Met up" always indicates some kind of arrangement. "Met" does not import one way or another whether the meeting was pre-arranged, accidental, or otherwise.

A: Basically the meaning is the same, the NOAD and the Collins agree on this.
The OALD is slightly more specific, and regarding "to meet up (with somebody)":

*

*It is especially referred to a meeting by arrangement and not casual (like I met her while I was going to the supermarket);

*It's classified by the OALD as rather informal.

While "to meet (someone)":

*

*It is mostly casual, as you can see in that example above.


text:
Q: How to create a function in UE5 that can only be called from widget blueprint How to create a function in UE5 that can only be called from widget blueprint
I tried deriving class from UUserWidget But that doesnt seem to work as i can still call function from otherbl;ueprints


text:
Q: Auto Move Specific Data from Google Form Response after Submission of Google Form I have Google form which is linked to Form Response Sheet. I want to Move data from "Discrepency Report - Outlet" to "Vaishali Nagar - DTR" Sheet on each day after one submit the Google Form.
I am using script which is mentioned below the Question. The problem I am facing it runs on specific date.
Link of Spreadsheet is:
https://docs.google.com/spreadsheets/d/1MhCdwFscPqskeeM2Hza-t2VXoVkI6sq3XRCNybMm4NM/edit?usp=sharing
function copyrange() {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var sheet = ss.getSheetByName('Discrepency Report - Outlet'); //source sheet
  var testrange = sheet.getRange('I:I');
  var testvalue = (testrange.setNumberFormat("@").getValues());
  Logger.log(testvalue);
  var ds = ss.getSheetByName('Vaishali Nagar - DTR'); //destination sheet
  var data = [];
  var j =[];
  var dt = new Date();
  var today = Utilities.formatDate(new Date(), 'GMT-0', 'dd/MM/yyyy')

  //Condition to check in I:I, if true, copy the same row to data array
  for (i=0;i<testvalue.length;i++) {
    if (testvalue[i] == today) {
    data.push.apply(data,sheet.getRange(i+1,1,1,8).getValues());
  //Copy matched ROW numbers to B
    j.push(i);
}
}
  //Copy data array to destination sheet

  var start_row=ds.getRange('B7:B').getValues().filter(String).length +6; //calculate max row

  ds.getRange(start_row+1,1,data.length,data[0].length).setValues(data);
}

A: Considerations
.getValues() method returns a multidimensional array which indexes are respectively values[column][row].
When looping through this array you will have to keep this in mind, especially when you build if-else blocks:
  for (i=0;i<testvalue.length;i++) {

// -------------------------
// Let's focus on this

    if (testvalue[i] == today) {  // -> [ 'dateString' ] == 'dateString'

// Even if 'dateString' is the same,
// it won't never be true because testValue[i] is an array.
// --------------------------

    data.push.apply(data,sheet.getRange(i+1,1,1,8).getValues());
    j.push(i);
}

Solution
In this case since you are looping through the same column's rows you can just use the 0 index to access the correct 'dateString' value:
if (testvalue[0][i] == today) {  // -> [ 'dateString' ] == 'dateString'

Otherwise you will have to loop through the columns and build a nested for-loop for the rows.
Reference
getValues()


text:
Q: Playground Crash: "error: Execution was interrupted, reason: signal SIGKILL." Seeking techniques to simplify code My project involves creating a table of data with a row for each of the 12 months of the year. The user of the app will define their monthly pay and percentage of pay they want to contribute to his/her 401k. The table shows in which month the user has reached the IRS contribution limit ($22,500) and consequently cannot contribute any more until next year.
I'm using Xcode playground to test my formulae.  Since each month from February through December must look back at contributions and sums from the previous months, there is a considerable amount of looping which drives excessive execution time.  I have a computed variable titled "personal401kContributionMonthly" which computes what the user has defined for their desired percent of monthly pay to contribute to their 401k.  This computed property ran 4,940,531 times before the playground crashed with the following error: "error: Execution was interrupted, reason: signal SIGKILL. [12211:365921] Unable to quarantine process. (Error: -1.)"
I am seeking for advice/techniques to simplify the code to avoid the crash.
var monthlyPay = 15203.0
var personal401kLimit = 22500.0
var personal401kPercentage = 10.0
var roth401kPercentage = 10.0
var personal401kContributionMonthly: Double {
    monthlyPay * (personal401kPercentage/100)
}
personal401kContributionMonthly

var persTradContJan: Double {
    personal401kContributionMonthly <= personal401kLimit ? (personal401kContributionMonthly * (1 - (roth401kPercentage/100))) : personal401kLimit * (1 - (roth401kPercentage/100))
}
persTradContJan
var persRothContJan: Double {
    roth401kPercentage == 0.0 ? 0.0 : personal401kContributionMonthly <= personal401kLimit ? personal401kContributionMonthly * (roth401kPercentage/100) : personal401kLimit * (roth401kPercentage/100)
}
persRothContJan
var pers401ksumFeb: Double {
    persTradContJan + persRothContJan
}
var persTradContFeb: Double {
    pers401ksumFeb + personal401kContributionMonthly <= personal401kLimit ? personal401kContributionMonthly * (1 - (roth401kPercentage/100)) : pers401ksumFeb < personal401kLimit ? (1 - (roth401kPercentage/100)) * (personal401kLimit - (pers401ksumFeb)) : 0.0
}
persTradContFeb
var persRothContFeb: Double {
    roth401kPercentage == 0.0 ? 0.0 : pers401ksumFeb + personal401kContributionMonthly <= personal401kLimit ? personal401kContributionMonthly * (roth401kPercentage/100) : pers401ksumFeb < personal401kLimit ? (roth401kPercentage/100) * (personal401kLimit - pers401ksumFeb) : 0.0
}
persRothContFeb
var pers401ksumMar: Double {
    persTradContJan + persRothContJan + persTradContFeb + persRothContFeb
}
var persTradContMar: Double {
    pers401ksumMar + personal401kContributionMonthly <= personal401kLimit ? personal401kContributionMonthly * (1 - (roth401kPercentage/100)) : pers401ksumMar < personal401kLimit ? (1 - (roth401kPercentage/100)) * (personal401kLimit - (pers401ksumMar)) : 0.0
}
persTradContMar
var persRothContMar: Double {
    roth401kPercentage == 0.0 ? 0.0 : pers401ksumMar + personal401kContributionMonthly <= personal401kLimit ? personal401kContributionMonthly * (roth401kPercentage/100) : pers401ksumMar < personal401kLimit ? (roth401kPercentage/100) * (personal401kLimit - pers401ksumMar) : 0.0
}
persRothContMar
var pers401ksumApr: Double {
    persTradContJan + persRothContJan + persTradContFeb + persRothContFeb + persTradContMar + persRothContMar
}
var persTradContApr: Double {
    pers401ksumApr + personal401kContributionMonthly <= personal401kLimit ? personal401kContributionMonthly * (1 - (roth401kPercentage/100)) : pers401ksumApr < personal401kLimit ? (1 - (roth401kPercentage/100)) * (personal401kLimit - (pers401ksumApr)) : 0.0
}
persTradContApr
var persRothContApr: Double {
    roth401kPercentage == 0.0 ? 0.0 : pers401ksumApr + personal401kContributionMonthly <= personal401kLimit ? personal401kContributionMonthly * (roth401kPercentage/100) : pers401ksumApr < personal401kLimit ? (roth401kPercentage/100) * (personal401kLimit - pers401ksumApr) : 0.0
}
persRothContApr
var pers401ksumMay: Double {
    persTradContJan + persRothContJan + persTradContFeb + persRothContFeb + persTradContMar + persRothContMar + persTradContApr + persRothContApr
}
var persTradContMay: Double {
    pers401ksumMay + personal401kContributionMonthly <= personal401kLimit ? personal401kContributionMonthly * (1 - (roth401kPercentage/100)) : pers401ksumMay < personal401kLimit ? (1 - (roth401kPercentage/100)) * (personal401kLimit - (pers401ksumMay)) : 0.0
}
persTradContMay
var persRothContMay: Double {
    roth401kPercentage == 0.0 ? 0.0 : pers401ksumMay + personal401kContributionMonthly <= personal401kLimit ? personal401kContributionMonthly * (roth401kPercentage/100) : pers401ksumMay < personal401kLimit ? (roth401kPercentage/100) * (personal401kLimit - pers401ksumMay) : 0.0
}
persRothContMay
var pers401ksumJun: Double {
    persTradContJan + persRothContJan + persTradContFeb + persRothContFeb + persTradContMar + persRothContMar + persTradContApr + persRothContApr + persTradContMay + persRothContMay
}
var persTradContJun: Double {
    pers401ksumJun + personal401kContributionMonthly <= personal401kLimit ? personal401kContributionMonthly * (1 - (roth401kPercentage/100)) : pers401ksumJun < personal401kLimit ? (1 - (roth401kPercentage/100)) * (personal401kLimit - (pers401ksumJun)) : 0.0
}
persTradContJun
var persRothContJun: Double {
    roth401kPercentage == 0.0 ? 0.0 : pers401ksumJun + personal401kContributionMonthly <= personal401kLimit ? personal401kContributionMonthly * (roth401kPercentage/100) : pers401ksumJun < personal401kLimit ? (roth401kPercentage/100) * (personal401kLimit - pers401ksumJun) : 0.0
}
persRothContJun
var pers401ksumJul: Double {
    persTradContJan + persRothContJan + persTradContFeb + persRothContFeb + persTradContMar + persRothContMar + persTradContApr + persRothContApr + persTradContMay + persRothContMay + persTradContJun + persRothContJun
}
var persTradContJul: Double {
    pers401ksumJul + personal401kContributionMonthly <= personal401kLimit ? personal401kContributionMonthly * (1 - (roth401kPercentage/100)) : pers401ksumJul < personal401kLimit ? (1 - (roth401kPercentage/100)) * (personal401kLimit - (pers401ksumJul)) : 0.0
}
persTradContJul
var persRothContJul: Double {
    roth401kPercentage == 0.0 ? 0.0 : pers401ksumJul + personal401kContributionMonthly <= personal401kLimit ? personal401kContributionMonthly * (roth401kPercentage/100) : pers401ksumJul < personal401kLimit ? (roth401kPercentage/100) * (personal401kLimit - pers401ksumJul) : 0.0
}
persRothContJul
var pers401ksumAug: Double {
    persTradContJan + persRothContJan + persTradContFeb + persRothContFeb + persTradContMar + persRothContMar + persTradContApr + persRothContApr + persTradContMay + persRothContMay + persTradContJun + persRothContJun + persTradContJul + persRothContJul
}
var persTradContAug: Double {
    pers401ksumAug + personal401kContributionMonthly <= personal401kLimit ? personal401kContributionMonthly * (1 - (roth401kPercentage/100)) : pers401ksumAug < personal401kLimit ? (1 - (roth401kPercentage/100)) * (personal401kLimit - (pers401ksumAug)) : 0.0
}
persTradContAug
var persRothContAug: Double {
    roth401kPercentage == 0.0 ? 0.0 : pers401ksumAug + personal401kContributionMonthly <= personal401kLimit ? personal401kContributionMonthly * (roth401kPercentage/100) : pers401ksumAug < personal401kLimit ? (roth401kPercentage/100) * (personal401kLimit - pers401ksumAug) : 0.0
}
persRothContAug
var pers401ksumSep: Double {
    persTradContJan + persRothContJan + persTradContFeb + persRothContFeb + persTradContMar + persRothContMar + persTradContApr + persRothContApr + persTradContMay + persRothContMay + persTradContJun + persRothContJun + persTradContJul + persRothContJul + persTradContAug + persRothContAug
}
var persTradContSep: Double {
    pers401ksumSep + personal401kContributionMonthly <= personal401kLimit ? personal401kContributionMonthly * (1 - (roth401kPercentage/100)) : pers401ksumSep < personal401kLimit ? (1 - (roth401kPercentage/100)) * (personal401kLimit - (pers401ksumSep)) : 0.0
}
persTradContSep
var persRothContSep: Double {
    roth401kPercentage == 0.0 ? 0.0 : pers401ksumSep + personal401kContributionMonthly <= personal401kLimit ? personal401kContributionMonthly * (roth401kPercentage/100) : pers401ksumSep < personal401kLimit ? (roth401kPercentage/100) * (personal401kLimit - pers401ksumSep) : 0.0
}
persRothContSep
var pers401ksumOct: Double {
    persTradContJan + persRothContJan + persTradContFeb + persRothContFeb + persTradContMar + persRothContMar + persTradContApr + persRothContApr + persTradContMay + persRothContMay + persTradContJun + persRothContJun + persTradContJul + persRothContJul + persTradContAug + persRothContAug + persTradContSep + persRothContSep
}
var persTradContOct: Double {
    pers401ksumOct + personal401kContributionMonthly <= personal401kLimit ? personal401kContributionMonthly * (1 - (roth401kPercentage/100)) : pers401ksumOct < personal401kLimit ? (1 - (roth401kPercentage/100)) * (personal401kLimit - (pers401ksumOct)) : 0.0
}
persTradContOct
var persRothContOct: Double {
    roth401kPercentage == 0.0 ? 0.0 : pers401ksumOct + personal401kContributionMonthly <= personal401kLimit ? personal401kContributionMonthly * (roth401kPercentage/100) : pers401ksumOct < personal401kLimit ? (roth401kPercentage/100) * (personal401kLimit - pers401ksumOct) : 0.0
}
persRothContOct
var pers401ksumNov: Double {
    persTradContJan + persRothContJan + persTradContFeb + persRothContFeb + persTradContMar + persRothContMar + persTradContApr + persRothContApr + persTradContMay + persRothContMay + persTradContJun + persRothContJun + persTradContJul + persRothContJul + persTradContAug + persRothContAug + persTradContSep + persRothContSep + persTradContOct + persRothContOct
}
var persTradContNov: Double {
    pers401ksumNov + personal401kContributionMonthly <= personal401kLimit ? personal401kContributionMonthly * (1 - (roth401kPercentage/100)) : pers401ksumNov < personal401kLimit ? (1 - (roth401kPercentage/100)) * (personal401kLimit - (pers401ksumNov)) : 0.0
}
persTradContNov
var persRothContNov: Double {
    roth401kPercentage == 0.0 ? 0.0 : pers401ksumNov + personal401kContributionMonthly <= personal401kLimit ? personal401kContributionMonthly * (roth401kPercentage/100) : pers401ksumNov < personal401kLimit ? (roth401kPercentage/100) * (personal401kLimit - pers401ksumNov) : 0.0
}
persRothContNov
var pers401ksumDec: Double {
    persTradContJan + persRothContJan + persTradContFeb + persRothContFeb + persTradContMar + persRothContMar + persTradContApr + persRothContApr + persTradContMay + persRothContMay + persTradContJun + persRothContJun + persTradContJul + persRothContJul + persTradContAug + persRothContAug + persTradContSep + persRothContSep + persTradContOct + persRothContOct + persTradContNov + persRothContNov
}
var persTradContDec: Double {
    pers401ksumDec + personal401kContributionMonthly <= personal401kLimit ? personal401kContributionMonthly * (1 - (roth401kPercentage/100)) : pers401ksumDec < personal401kLimit ? (1 - (roth401kPercentage/100)) * (personal401kLimit - (pers401ksumDec)) : 0.0
}
persTradContDec
var persRothContDec: Double {
    roth401kPercentage == 0.0 ? 0.0 : pers401ksumDec + personal401kContributionMonthly <= personal401kLimit ? personal401kContributionMonthly * (roth401kPercentage/100) : pers401ksumDec < personal401kLimit ? (roth401kPercentage/100) * (personal401kLimit - pers401ksumDec) : 0.0
}
persRothContDec

UPDATE 1:
The intent of this 401k project is to also incorporate employer direct contributions and "back-door-Roth" overflow into a 401a account.  Consequently I believe I will need to store and initialize the sum of contributions month-to-month because this running total will need to be referenced for calculating each month's 401a contributions.
For example, some employers offer the "back-door" option which allows an employee who has reached the individual contribution limit ($22,500) to continue contributing that year but those funds are deposited into a 401a (not 401k).  But once the sum total of a) personal contributions, b) company contributions (match or direct deposit) and c) 401a "back-door" contributions reach the IRS limit for combined contributions ($66,000), then an employee can no longer contribute to his/her 401a account.
In order to show how much an employee would contribute to their 401a account for Jan, Feb, Mar, etc., I need to reference the previous month totals.  For example, for the February print iteration, the formula for 401a contributions needs to reference the sum total of personal contributions in January and February.  Using the wonderful example of code provided by Chip Jarred (thank you!!), if we set the value of monthly to 15203.0 and the personal401kPercentage to 100% (for demonstration purposes only), this would be the result:

The sum total of $1,520, $13,683, $730, & $6,567 equals $22,500.  But the sum of February only ($730 & $6,567 = $7,297) is less than the amount the employee would like to contribute (100% of monthly pay: $15,203).   Consequently, in February the 401a deposit should be $7,906 ($730 + $6,567 + $7,906 = $15,203).
In my view, the first step in achieving this functionality is to store and set in the initializer the cumulative totals for personal contributions for each month.  (Later we will probably need the cumulative totals for company AND personal contributions in order to know when we've reached $66,000 in order to stop contributing the 401a account.  But we can probably address that later).
Here is my attempt at adding a yearToDate property to MonthlyContributions....
extension MonthlyContributions
{
var total: Decimal { roth + traditional }

init(combinedAmount: Decimal, rothPercentage: Decimal)
{
    let roth = roundToNearestPenny(
        percentage: rothPercentage,
        of: combinedAmount
    )
    self.init(roth: roth, traditional: combinedAmount - roth)
}
}
extension MonthlyContributions
{
var yearToDate: Decimal { total }

init(combinedAmount: Decimal, limit: Decimal)
{
    let totalContributions = calculateCombinedContribution(
        monthlyContribution       : total,
        annualContributionLimit   : limit,
        contributionsSoFarThisYear: yearToDate
    )
}
}

Unfortunately this was unsuccessful as using
    print("    Total      : $\(curContribution.yearToDate)")

only prints singular month totals, not a running cumulative total.

A: Your playground crashes because all those computed variables reference other computed variables in ways that explode the call tree exponentially, so as @matt, with tongue in cheek, pointed out in comments, it's a literal stack overflow.  Computed variables are just syntactic sugar for function calls.  Were you intending lazy assignment instead?
In any case, you asked about refactoring the code.
I think your example is the kind of thing that wants to be in a data structure where you index by the month rather than having individually named computed variables.  As is often the case, it can be accomplished multiple ways.  What follows is one way.  I'll break into part.
I'm going to assume that your playground is intended as a sort of prototyping environment for some code that you want to use in a real app.  If it's just a learning exercise, using Double to represent money is fine, but binary floating point types can't exactly represent all decimal numbers.  See here for examples and why this is the case. For this reason it's better to use Decimal, so that's what I'll do.
Unfortunately Decimal is slow compared to Double or Float, and doesn't have the most fully supported API in Swift. Actually its Objective-C counterpart, NSDecimalNumber is pretty crufty in Objective-C too.  Still, it is the best standardly available type to do financial computations.
Next I don't see any explicit rounding in your code example, and as far as I know fractional penny contributions to 401ks (or IRAs) are not a thing, so you need a way to round to whole pennies.  It's probably the most awkward code I'm going to present, so let's get it out of the way first.
There are two ways to do rounding on Decimal, and unfortunately neither of them are especially convenient. Unlike Double, Decimal does not provide .rounded() method.
One way is to call the NSDecimalRound free function, which requires getting a pointer to the value to round.  I'd probably use that way in my own code, but let's avoid pointers.
The second way is to make use of the fact that Decimal bridges to NSDecimalNumber which provides a rounding(accordingToBehavior:) method.  That requires creating a NSDecimalNumberBehaviors instance that configures how the rounding will be done... Did I mention the API is crufty?  We have to cast to NSDecimalNumber then call rounding(accordingToBehavior:) and then cast back to Decimal.  It looks like this:
import Foundation

let pennyRoundingBehavior = NSDecimalNumberHandler(
    roundingMode: .bankers,
    scale: 2,
    raiseOnExactness: false,
    raiseOnOverflow: true,
    raiseOnUnderflow: true,
    raiseOnDivideByZero: true
)

/**
 Computes `dollarAmount * percentage`, rounded to the nearest penny.

 Uses "Banker's" rounding: If truncated digits represent a value greater than
 half a penny, the result is rounded up.  If it's less than half a penny, the
 result is rounded down.  If it's exactly half a penny, the value is rounded to
 the nearest even penny.  So `10.015 is rounded to `10.02`, while `10.025` is
 also rounded to `10.02`.

 - Parameters:
    - percentage: `Decimal` value in the range 0...100
    - amount: `Decimal` to which `percentage` is applied.
 */
func roundToNearestPenny(percentage: Decimal, of dollarAmount: Decimal) -> Decimal
{
    assert((0...100).contains(percentage))

    let x = ((dollarAmount * percentage / 100) as NSDecimalNumber)
    return x.rounding(accordingToBehavior: pennyRoundingBehavior) as Decimal
}

Fortunately, all the other math we need to do with Decimal can be done just like for Double.
Since you want contributions per month, I define an enum to represent months:
enum ContributionMonth: Int, CaseIterable
{
    case January, February, March, April, May, June,
         July, August, September, October, November, December

    static var count:Int  { allCases.count }
}

I represent the contributions for a given month as a struct
struct MonthlyContributions
{
    var roth        : Decimal = 0
    var traditional : Decimal = 0
}

extension MonthlyContributions
{
    var total: Decimal { roth + traditional }

    init(combinedAmount: Decimal, rothPercentage: Decimal)
    {
        let roth = roundToNearestPenny(
            percentage: rothPercentage,
            of: combinedAmount
        )
        self.init(roth: roth, traditional: combinedAmount - roth)
    }
}

Note the init in the extension computes the contribution distribution, which will simplify later code.
Since I'll be storing instances of MonthlyContributions in an Array with elements that correspond to the months starting with January it would be nice to just index that array by the month.  To do that I extend Array when it holds MonthlyContributions as elements:
extension Array where Element == MonthlyContributions {
    subscript (index: ContributionMonth) -> Element { self[index.rawValue] }
}

An alternative would be to use a Dictionary instead of an Array.  For this example, I think Array is slightly simpler, but it doesn't really matter much.  With Dictionary you wouldn't need the extension, but adding a value requires using both a key and a value, whereas with Array I can just append.  Dictionary would be the way to go if you don't want to populate it with contributions for all months.
So next up, for a given month, we need to adjust combined contribution so that total annual contributions will be capped to the legal limit:
func calculateCombinedContribution(
    monthlyContribution        monthly    : Decimal,
    annualContributionLimit    limit      : Decimal,
    contributionsSoFarThisYear cummulative: Decimal) -> Decimal
{
    min(max(0, limit - cummulative), monthly)
}

Now all of that is used to compute a whole years worth of monthly contributions:
func computeMonthlyContributions(
    monthlyPay            : Decimal,
    contributionPercentage: Decimal,
    rothPercentage        : Decimal,
    contributionLimit     : Decimal) -> [MonthlyContributions]
{
    assert((0...100).contains(contributionPercentage))
    assert((0...100).contains(rothPercentage))
    assert(monthlyPay >= 0)
    assert(contributionLimit >= 0)

    var totalContributions  : Decimal = 0
    var monthlyContributions: [MonthlyContributions] = []
    monthlyContributions.reserveCapacity(ContributionMonth.count)

    let monthlyContribution = roundToNearestPenny(
        percentage: contributionPercentage,
        of: monthlyPay
    )

    for _ in ContributionMonth.allCases
    {
        let combinedAmount = calculateCombinedContribution(
            monthlyContribution       : monthlyContribution,
            annualContributionLimit   : contributionLimit,
            contributionsSoFarThisYear: totalContributions
        )

        let contribution = MonthlyContributions(
            combinedAmount: combinedAmount,
            rothPercentage: rothPercentage
        )

        monthlyContributions.append(contribution)
        totalContributions += contribution.total
    }

    return monthlyContributions
}

The assertions are just there to validate basic numeric assumptions, at least in DEBUG builds.  For each month we determine how much the combined contribution will be for that month, which takes into account whether the total contributions have reached the legal annual limit, then create a MonthlyContributions instance, which distributes the amount internally between roth and traditional, append it to the array, and update the total contributions.
Now we can call it with some values, and print out the calculated monthly contributions:
var monthlyPay            : Decimal = 15203.0
var personal401kLimit     : Decimal = 22500.0
var personal401kPercentage: Decimal = 10.0
var roth401kPercentage    : Decimal = 10.0

let monthlyContributions = computeMonthlyContributions(
    monthlyPay            : monthlyPay,
    contributionPercentage: personal401kPercentage,
    rothPercentage        : roth401kPercentage,
    contributionLimit     : personal401kLimit
)

for month in ContributionMonth.allCases
{
    let curContribution = monthlyContributions[month]
    print("Contribution for \(month)")
    print("    Roth       : $\(curContribution.roth)")
    print("    Traditional: $\(curContribution.traditional)")
    print()

}

This just uses the values you provide.  The output is:

Contribution for January
    Roth       : $152.03
    Traditional: $1368.27

Contribution for February
    Roth       : $152.03
    Traditional: $1368.27

Contribution for March
    Roth       : $152.03
    Traditional: $1368.27

Contribution for April
    Roth       : $152.03
    Traditional: $1368.27

Contribution for May
    Roth       : $152.03
    Traditional: $1368.27

Contribution for June
    Roth       : $152.03
    Traditional: $1368.27

Contribution for July
    Roth       : $152.03
    Traditional: $1368.27

Contribution for August
    Roth       : $152.03
    Traditional: $1368.27

Contribution for September
    Roth       : $152.03
    Traditional: $1368.27

Contribution for October
    Roth       : $152.03
    Traditional: $1368.27

Contribution for November
    Roth       : $152.03
    Traditional: $1368.27

Contribution for December
    Roth       : $152.03
    Traditional: $1368.27

As you can see the annual contribution limit isn't triggered by that monthlyPay value, so increasing it to 30000.0 does trigger it:

Contribution for January
    Roth       : $300
    Traditional: $2700

Contribution for February
    Roth       : $300
    Traditional: $2700

Contribution for March
    Roth       : $300
    Traditional: $2700

Contribution for April
    Roth       : $300
    Traditional: $2700

Contribution for May
    Roth       : $300
    Traditional: $2700

Contribution for June
    Roth       : $300
    Traditional: $2700

Contribution for July
    Roth       : $300
    Traditional: $2700

Contribution for August
    Roth       : $150
    Traditional: $1350

Contribution for September
    Roth       : $0
    Traditional: $0

Contribution for October
    Roth       : $0
    Traditional: $0

Contribution for November
    Roth       : $0
    Traditional: $0

Contribution for December
    Roth       : $0
    Traditional: $0

Update
In comments, it became known that a year-to-date value needed to be stored in MonthlyContributions.  I proposed adding the year-to-date value as another stored property, and pass it's value in as another parameter to the init in the extension, but thinking on it more, that creates an API that's either not clear as to whether the value should include the current month's contributions or to make it clear would be unnecessarily wordy.  Super-long variable names are almost as bad overly short ones.  So the way I'd do it is to use the existing MonthlyContributions to create the one for the next month.
To do that I'd update MonthlyContributions like this:
struct MonthlyContributions
{
    var roth        : Decimal = 0
    var traditional : Decimal = 0
    var yearToDate  : Decimal = 0 // <-- ADDED THIS
}

extension MonthlyContributions
{
    var total: Decimal { roth + traditional }

    // CHANGED INITIALIZER TO INSTANCE METHOD
    func nextMonth(
        combinedAmount: Decimal,
        rothPercentage: Decimal) -> Self
    {
        let roth = roundToNearestPenny(
            percentage: rothPercentage,
            of: combinedAmount
        )
        return Self(
            roth: roth,
            traditional: combinedAmount - roth,
            yearToDate: combinedAmount + yearToDate
        )
    }
}

Then I'd change computeMonthlyContributions to create an empty (zeroed) MonthlyContributions, which is used in each iteration of the loop to create the MonthlyContributions for the next month.  The totalContributions variable is no longer needed because each month already has the total in it:
func computeMonthlyContributions(
    monthlyPay            : Decimal,
    contributionPercentage: Decimal,
    rothPercentage        : Decimal,
    contributionLimit     : Decimal) -> [MonthlyContributions]
{
    assert((0...100).contains(contributionPercentage))
    assert((0...100).contains(rothPercentage))
    assert(monthlyPay >= 0)
    assert(contributionLimit >= 0)

    // Start with a zeroed MonthlyContributions
    var contribution = MonthlyContributions()

    var monthlyContributions: [MonthlyContributions] = []
    monthlyContributions.reserveCapacity(ContributionMonth.count)

    let monthlyContribution = roundToNearestPenny(
        percentage: contributionPercentage,
        of: monthlyPay
    )

    for _ in ContributionMonth.allCases
    {
        // Apply limits to `contribution.yearToDate`
        let combinedAmount = calculateCombinedContribution(
            monthlyContribution       : monthlyContribution,
            annualContributionLimit   : contributionLimit,
            contributionsSoFarThisYear: contribution.yearToDate
        )

        contribution = contribution.nextMonth(
            combinedAmount: combinedAmount,
            rothPercentage: rothPercentage
        )

        monthlyContributions.append(contribution)
    }

    return monthlyContributions
}

If you like you can now add the year-to-date contributions in the print loop:
for month in ContributionMonth.allCases
{
    let curContribution = monthlyContributions[month]
    print("    Roth        : $\(curContribution.roth)")
    print("    Traditional : $\(curContribution.traditional)")
    print("    Year-To-Date: $\(curContribution.yearToDate)")
    print()
}


text:
Q: Font Awesome 5: Differences fa-svg-with-js.css / fontawesome.min.js / fontawesome-all.min.js I've read the official documentation but I didn't get much information regarding fa-svg-with-js.css
Currently, I'm using fontawesome-all.min.js and that's all I need to get going. However, the file size is ridiculously big (680kb).
I noticed there was another folder with a file named fa-svg-with-js.css what is this for? Do I need it?
I also notice there's another file called fontawesome.min.js with a much smaller file size (27kb). How do I use this and why is it smaller than the svg one.
I don't want to use the webfont version. Any suggestions?


text:
Q: How to use the chrome devtools push debug feature? The Chrome Browser developer tools have under the application tab an option to test push notifications. I have a registered service worker running that can handle received push notifications but it doesn't receive any from it.
How to test push notifications with it correctly?

A: go test your code with edge devtools in this case; until chrome is update this bug.


text:
Q: Java PIT classpath issue I am having a folder "mutant" which contains a text file with just a single line called java.utils.Collection. I have generated test cases using Randoop and saved them in the same folder. The test cases have names RegressionTest*.java
I am trying to run PIT now to generate mutants. The command that I am typing as per http://pitest.org/quickstart/commandline/ is the following---
    java -cp C:\Users\happy\OneDrive\Desktop\pitest-1.4.3.jar;C:\Users\happy\OneDrive\Desktop\pitest-command-line-1.4.3.jar;C:\Users\happy\OneDrive\Desktop\pitest-entry-1.4.3.jar;C:\Users\happy\OneDrive\Desktop\junit-4.10.jar;C:\Users\happy\OneDrive\Desktop\testng-6.8.5.jar

org.pitest.mutationtest.commandline.MutationCoverageReport
--reportDir C:\Users\happy\OneDrive\Desktop\report
--targetClasses myclasses.*
--targetTests mutant.Regression*
--sourceDirs C:\Users\happy\OneDrive\Desktop\mutant

and the error I am getting is Exception in thread "main". org.Pitest.help.PitHelpError: No mutations found. This probably means there is an issue with either the supplied classpath or filters
I believe that problem is associated with targetClasses. Anyone has any idea?

A: Collection is in java.util, not java.utils.
You can check that there is indeed generated tests.
Furthermore, I think the tested code you want Pitest to mutate should have it's source code indicated by --sourceDirs.


text:
Q: How does the ISP resolve or determine the root servers for a particular Zone? Let us say I am trying to find out the delegated subdomains for superuser.com
When I perform dig +trace, I get this result:
dig +trace superuser.com A

; <<>> DiG 9.2.1 <<>> +trace superuser.com A
;; global options:  printcmd
.                       6245    IN      NS      g.root-servers.net.
.                       6245    IN      NS      j.root-servers.net.
.                       6245    IN      NS      k.root-servers.net.
.                       6245    IN      NS      m.root-servers.net.
.                       6245    IN      NS      l.root-servers.net.
.                       6245    IN      NS      f.root-servers.net.
.                       6245    IN      NS      c.root-servers.net.
.                       6245    IN      NS      e.root-servers.net.
.                       6245    IN      NS      a.root-servers.net.
.                       6245    IN      NS      b.root-servers.net.
.                       6245    IN      NS      h.root-servers.net.
.                       6245    IN      NS      i.root-servers.net.
.                       6245    IN      NS      d.root-servers.net.
;; Received 505 bytes from x.x.x.x#53(x.x.x.x) in 1 ms

com.                    172800  IN      NS      e.gtld-servers.net.
com.                    172800  IN      NS      k.gtld-servers.net.
com.                    172800  IN      NS      h.gtld-servers.net.
com.                    172800  IN      NS      c.gtld-servers.net.
com.                    172800  IN      NS      b.gtld-servers.net.
com.                    172800  IN      NS      m.gtld-servers.net.
com.                    172800  IN      NS      g.gtld-servers.net.
com.                    172800  IN      NS      a.gtld-servers.net.
com.                    172800  IN      NS      i.gtld-servers.net.
com.                    172800  IN      NS      d.gtld-servers.net.
com.                    172800  IN      NS      j.gtld-servers.net.
com.                    172800  IN      NS      f.gtld-servers.net.
com.                    172800  IN      NS      l.gtld-servers.net.
;; Received 491 bytes from 192.x.x.x#53(g.root-servers.net) in 231 ms

superuser.com.          172800  IN      NS      ns-245.awsdns-30.com.
superuser.com.          172800  IN      NS      ns-1699.awsdns-20.co.uk.
superuser.com.          172800  IN      NS      ns-cloud-d1.googledomains.com.
superuser.com.          172800  IN      NS      ns-cloud-d2.googledomains.com.
;; Received 269 bytes from 192.y.y.y#53(e.gtld-servers.net) in 137 ms

superuser.com.          300     IN      A       151.x.x.x
superuser.com.          300     IN      A       151.y.z.a
superuser.com.          300     IN      A       151.y.1.a
superuser.com.          300     IN      A       151.y.z.b
superuser.com.          172800  IN      NS      ns-1699.awsdns-20.co.uk.
superuser.com.          172800  IN      NS      ns-245.awsdns-30.com.
superuser.com.          172800  IN      NS      ns-cloud-d1.googledomains.com.
superuser.com.          172800  IN      NS      ns-cloud-d2.googledomains.com.
;; Received 229 bytes from 205.z.z.z#53(ns-245.awsdns-30.com) in 15 ms

l.gtld-servers.net
e.gtld-servers.net
b.gtld-servers.net

How does the ISP Resolve which root servers need to be queried to? Here it picked g.root-servers.net. Is this random? Is the similar Logic applied to genericTLDs too?

A: All authoritative servers for the same zone have the same contents. So you don't need to determine anything; you can just pick one NS record and go with it.
(Don't think of the root or TLD zones as special. They're ordinary zones with ordinary NS records, and their authoritative servers work the same way. The root zone looks like this.)
Therefore it doesn't matter if you ask the A-root, or the G-root, or the L-root: if the question was "who's authoritative for the com. zone", all of them will give you the correct answer.

(Though, as you can see from the other thread which @Anakasunaman linked to, many recursive resolvers will eventually settle on the "fastest" server – however, that's purely for performance reasons and does not affect the final result. One-shot tools like dig don't bother with this.)


text:
Q: Why am I getting "does not support archiving" in my NSWindow subclass? I have the following class:
@interface SpWindow : NSWindow <NSCoding> {
  BOOL _editMode;
  SpBgView *bgView;
} ...

... which I then call archive on. My encode method is as follows:
- (void) encodeWithCoder:(NSCoder *)aCoder {
  NSLog(@"encodeWithCoder CALLED FOR SpWindow");
  [super encodeWithCoder:aCoder];
  NSLog(@"SpWindow's encodeWithCoder got past the super call");
  [aCoder encodeObject:bgView forKey:@"bgView"];
  [aCoder encodeBool:_editMode forKey:@"_editMode"];
}

... however the [super encodeWithCoder:aCoder]; bit results in the following in the console log:
encodeWithCoder CALLED FOR SpWindow
<SpWindow: 0x20009f660> does not support archiving
*** -[NSKeyedArchiver finalize]: warning: NSKeyedArchiver finalized without having had -finishEncoding called on it.

... according to the NSWindow documentation the class conforms to the NSCoding protocol, so I have no idea why I'm seeing this issue.
Any ideas ?
--- EDIT: The class reference for NSWindow shows:
Conforms to NSCoding (NSResponder)

... NOT just "Conforms to NSCoding" - so I guess does this mean that only the NSResponder bits conform to NSCoding ?

A: Straight from the NSWindow documentation:

Note: Although the NSWindow class inherits the NSCoding protocol from NSResponder, the class does not support coding. Legacy support for archivers exists but its use is deprecated and may not work. Any attempt to archive or unarchive an NSWindow object using a keyed coding object raises an NSInvalidArgumentException exception.

A: Does your class implement the entire protocol or just encodeWithCoder? Methods marked "required" are not optional.

A: OK, it looks like I'm a victim of my meddling with the MVC-model - NSview & NSWindow don't do the NSCoding thing.


text:
Q: Lie derivative formula for time dependent differential forms. I am new to the topic and I am trying to show the Lie derivative formula for time dependent differential forms, i.e.,
$\frac{d}{dt} \phi_t^* \alpha_t = \phi_t^* \mathcal L_X \alpha_t + \phi_t^* \frac{d}{dt}\alpha_t$
with $\phi_t$ the flow of the vector field $X$ and $\alpha_t$ some time-dependent differential form. To do this I take the derivative on the left-hand side
$\frac{d}{dt} \phi_t^* \alpha_t = \lim_{h\to0}\frac 1 h ( \phi_{t+h}^* \alpha_{t+h} - \phi_t \alpha_t)=$
$\lim_{h\to0}\frac 1 h ( \phi_{t+h}^* \alpha_{t+h} - \phi_{t+h}^* \alpha_{t} + \phi_{t+h}^* \alpha_{t} - \phi_t \alpha_t) = $
$ \phi_t^* \mathcal L_X \alpha_t + \phi^*_t( \lim_{h\to0} \frac 1 h \phi^*_h [ \alpha_{t+h} - \alpha_t ])$
I am stuck here. It seems that you can just apply the limit at $\lim_{h\to 0}\frac 1 h\phi_h=id$ separately and write the rest as the derivative of $\alpha_t$. How is this possible?!

A: I think it's easiest to think about this as a "diagonal derivative": if we define $$\omega(s,t) = \phi_s^* \alpha_t$$ then $$\frac{d}{dt}\phi_t^* \alpha_t|_p = \frac{d}{dt}\omega(t,t)|_p$$ is just the directional derivative of $\omega(s,t)|_p$ (considered as a function $\mathbb R^2 \to \Lambda^k T^*_p M$) in the direction $(1,1)$ evaluated at the point $(t,t).$ Thus, assuming everything is nicely behaved, we can use the formula for the directional derivative in terms of the partial derivatives:
$$\frac{d}{dt} \omega(t,t)|_{p} = \partial_s\omega(t,t)|_p + \partial_t\omega(t,t)|_p. \tag{1}$$ These partial derivatives are easy to compute: for fixed $t$ we find $$\partial_s\omega(s,t) = \partial_s \phi_s^* \alpha_t = \phi_s^* \mathcal L_X \alpha_t$$ by the definition of the Lie derivative, while for fixed $s$ we find $$\partial_t \omega(s,t) = \partial_t \phi_s^* \alpha_t = \phi_s^* \partial_t \alpha_t=\phi_s^* \frac d{dt} \alpha_t$$ by the linearity of the pullback $\phi_s^*.$ Evaluating these both at $s=t$ and plugging in to $(1)$ yields the formula you're looking for.
We still need to show things are actually nicely behaved; i.e. that $\omega(s,t)|_p$ is fully (not just partially) differentiable. It suffices to show that this function has continuous partial derivatives. We computed these above; and looking at them, we see that (assuming smoothness of $X$) it suffices for the family $\alpha_t$ to be continuously differentiable on its domain $M \times \mathbb R.$


text:
Q: Looking for window resize color in ubuntu.css I changed themes, but a few of the parts remained on ubuntu orange.
Found a post directing me to ubuntu.css and was able to change most of my color concerns there, except the color that started it all, the window resize color (see image). I was even able to change the border, but can't seem to find the window color itself.
How to change color of unity workspace border, and window resize
In the above post, further down after all the compiz settings, someone mentions the gtk.css file. However, when I open that, it's not settings that are modifiable, like the ubuntu.css file. It's just an url.
Anyone have an idea which file contains the color value for the window resize value? Or the heading I should be searching for in ubuntu.css? (PS, don't want to use compiz).

A: In general, you should search for this content in the css file.
/* Tiled window previews */
.tile-preview {
  background-color: rgba(27, 106, 203, 1);
  border: 1px solid #1b6acb; }

.tile-preview-left.on-primary {
  border-radius: 6px 0 0 0; }

.tile-preview-right.on-primary {
  border-radius: 0 6px 0 0; }

.tile-preview-left.tile-preview-right.on-primary {
  border-radius: 6px 6px 0 0; }

Change the background-color: line with any valid color..


text:
Q: How to put a delay that stops the code without stop the HTML render? I need to stop my code in a for loop, a sleep() function that stalls time does not work because my HTML does not render in that time and a setTimeout function will continue the loop before doing the set code.
For example, this will display alerts with 1,2,3 before 3 alerts with Stop.
function test(){
  for (var i = 1;i<4;i++) {
    alert(i);
    setTimeout(function(){alert("Stop");},1000);
  }
}

How could I wait until continuing with my loop while letting the HTML render ?

A: Use the DOMContentLoaded event to check once your HTML is fully rendered:
<script>
  document.addEventListener('DOMContentLoaded', function(event) {
    alert('html loaded');
  });
</script>

A: In your example you could instead just use confirm instead to show a message, and when the user clicks then you use the next setTimeout to show the next message.
But, I think this is not what you are actually looking for.
There are many ways to do asynchronous javascript that doesn't impact html rendering, such as using Web Workers, or pass functions inside of setTimeout and those can use closures to help track where you are, but, have the next setTimeout be called after some processing, and after some event, as these will allow the rendering to continue until certain events or time happens.


text:
Q: git-flow release finish rejected because develop is ahead I am using git-flow to manage our release process.  after doing git-flow init, etc., I create a release candidate branch with
git-flow release start <label>

All is fine. While I am testing the RC branch other developers are usually working on the next release in the develop branch.  When the RC branch is declared good to go, I use
git-flow release finish –p <label>

but then I sometimes (not always) get an error
 ! [rejected]        develop -> develop (non-fast-forward)
error: failed to push some refs to <repo-address>
hint: Updates were rejected because a pushed branch tip is behind its remote
hint: counterpart. Check out this branch and integrate the remote changes
hint: (e.g. 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
Could not push to develop from origin.

Naturally, it is going to be behind the tip since the developers were working on develop. Should I be telling git-flow not to merge back into develop?  If so, how? If not, what is the correct work-flow?

A: You definitely want to merge back into develop, but before you do, you will want to pull from develop. From your description, it looks like git-flow does not automatically do this, yet it is automatically pushing develop, which is odd. Anyway, I would make the following your workflow:
git checkout develop
git pull
git checkout <release-branch>
git-flow release finish –p <label>


text:
Q: Selecting text by whole words using mouse click Is there a way, using AHK or otherwise, to select "only words" and not individual letters, like in Adobe Acrobat Reader?
It should be such that even if the mouse pointer begins to select text at the middle of a word, it must autofill the unselected text on the left. Similarly if the pointer ends with an incomplete selection of the word, it must fill the leftover on the right.
Thank you.

A: Press F1 to select the word under the mouse pointer, even if the window under the pointer isn't active:
#If (A_Cursor = "IBeam") ; the mouse pointer is over selectable text

    $F1:: click 2  ; double click

#If


text:
Q: What is faster? Two list comprehensions or one and a list.copy()? Which of the following is faster?
a = ['' for _ in range(len(x))]
b = ['' for _ in range(len(x))]

or
a = ['' for _ in range(len(x))]
b = a.copy()

Thanks in advance!

A: You can see for yourself easily with a timing decorator:
from functools import wraps
from time import time

def timing(f):
    @wraps(f)
    def wrap(*args, **kw):
        ts = time()
        result = f(*args, **kw)
        te = time()
        print(f'func:{f.__name__} args:[{args}, {kw}] took: {te-ts} sec')
        return result
    return wrap

x = 10000000
@timing
def a(x):
    a = ['' for _ in range(x)]
    b = [i for i in a]
@timing
def b(x):
    a = ['' for _ in range(x)]
    b = a.copy()

a(x)
b(x)


text:
Q: Realm Kotlin migration Android String Can't find an answer.
I'm trying to migrate Realm database. Need to create a table DBRequest with 2 fields: Int and String
if (oldVersion == 5L) {
    val s = scheme.create("DBRequest")
    s.addField("apiCode", Int::class.java)
}

And that's ok! But if I'm trying to add String type as well
    s.addField("jsonRequest", String::class.java)

it throws an error:

Caused by: io.realm.exceptions.RealmMigrationNeededException: Migration is required due to the following errors:
      - Property 'DBRequest.jsonRequest' has been made required.

I have no idea how to sort it out. I've tried smth like this:
s.addField("jsonRequest", String::class.javaPrimitiveType!!)
-or-
s.addField("jsonRequest", String::class.javaObjectType)

Nothing helps :(

A: Add this to the migration
s
    .addField("jsonRequest", String::class.java)
    .setRequired("jsonRequest", true)

A: Another option for the non-primitive type of String:
s.addField("jsonRequest", String::class.java, FieldAttribute.REQUIRED)

For required Int though, you'd normally use int.class or Integer.class, which is why you use javaPrimitiveType or javaObjectType accordingly.


text:
Q: Телеграм бот выводит в сообщении с датой и числом символ "\." Пишу бота на python, использую библиотеку aiogram. При отправке в сообщении даты или числа в формате 11.12.2020 или 345.23 или 11-12-2020 или 345,23 бот перед знаком точка или дефис ставит обратный слеш, получается вот так 11\.12\.2020 или 345\.23.
Подскажите, в чем может быть причина?
пример кода:
number = "%.2f" % float(number)
text = code(f"Число: {number}")
message.reply(text, parse_mode=ParseMode.MARKDOWN)

A: Бот их экранирует, т.к. это не совсем обычные символы. То же самое должно происходить с \, ', " и еще много с какими. Попробуйте боту передавать дату в виде сырой строки r'11.12.2020'.

A: Помогло вместо markdown использовать разметку HTML, код получился такой:
number = "%.2f" % float(number)
text = f"<code> + Число: {number} + </code>")
message.reply(text, parse_mode=ParseMode.NTML)


text:
Q: React Native: 'componentWillReceiveProps' clearing Dropdown Selected Value I have created a form which consists of two drop down list fields (amongst other form elements), using React Native Modal Dropdown plugin. The two dropdowns are:

*

*Country List

*States list (filtered by the what country that was selected above)

I am currently having a problem with the States Dropdown, which recieves a countryId value from state that is set when a item is selected from the the Country Drop Down. This is then used to pass to my State Drop Down.
It's worth noting that the two dropdown's I have listed above have been seperated into components for reusability.
Code for Form:
static propTypes = {
    navigation: PropTypes.object
};

state = {
    countryId: 0,
    stateId: 0
}

componentWillMount() {
}

onCountryDropDownSelected = (val) => {
    this.setState({ countryId: val });
}

onStateDropDownSelected = (val) => {
    this.setState({ stateId: val });
}

render() {
    return (
        <Container>
            <StatusBar barStyle="default" />
            <CountryDropDownList onSelect={this.onCountryDropDownSelected} />
            <Text>Country: {this.state.countryId}</Text>
            <StateDropDownList onSelect={this.onStateDropDownSelected} countryId={this.state.countryId} />
        </Container>
    );
}

Code for StateDropDownList component:
class StateDropDownList extends Component {
    static propTypes = {
        countryId: PropTypes.number,
        onSelect: PropTypes.func
    };

    state = {
        data: [],
        errorMessage: '',
        isLoading: false
    }

    componentWillReceiveProps(nextProps) {
        if (nextProps.countryId != undefined) {
            return this.populatePicker(nextProps.countryId);
        }
    }

    populatePicker(countryId) {
        // This method fetches data from the API to store in the 'data' state object.
    }

    dropDownRenderRow(rowData, rowID, highlighted) {
        let evenRow = rowID % 2;

        return (
            <TouchableHighlight underlayColor='cornflowerblue'>
                <View style={{backgroundColor: evenRow ? 'lemonchiffon' : 'white'}}>
                    <Text style={{color: 'black'}}>
                        {rowData.name}
                    </Text>
                </View>
            </TouchableHighlight>
        );
    }

    dropDownRenderButtonText(rowData) {
        console.log('dropDownRenderButtonText', rowData);
        return rowData.name;
    }

    dropDownRenderSeparator(sectionID, rowID, adjacentRowHighlighted) {
        return (<View key={rowID} />);
    }

    dropDownOnSelect(rowID, rowData) {
        // Get the selected value and pass to parent component through onSelect() event in parent.
        this.props.onSelect(rowData.id);
    }

    render() {
        return (
            <View>
                <Text>Home State</Text>
                {this.state.data && this.state.data.length > 0 ?
                    <ModalDropdown defaultValue='Select one'
                          style={{flex:1}, {marginTop: 10}}
                          options={this.state.data}
                           onSelect={(rowID, rowData) => this.dropDownOnSelect(rowID, rowData)}
                          renderButtonText={(rowData) => this.dropDownRenderButtonText(rowData)}
                          renderRow={this.dropDownRenderRow.bind(this)}
                          renderSeparator={(sectionID, rowID, adjacentRowHighlighted) => this.dropDownRenderSeparator(sectionID, rowID, adjacentRowHighlighted)} />
                    :
                        <Text>No regions for country.</Text>
                }
            </View>
        );
    }
}

What I am noticing is that the 'componentWillReceiveProps' function is stopping my dropdown from having a selected value. But unfortunately, I need this function in order for the props to update when passing in the countryId value from the parent.
When I remove the this.props.onSelect(rowData.id); line in this dropDownOnSelect() function, the dropdown value gets set correctly. I guess this is the case, since I am not setting an prop value.
I can see what the issue is, but not a way to get around it.
Any help is appreciated!

A: I resolved the problem. Made a simple error to check if the nextProps.countryId is not the same as props.countryId, which now makes sense:
componentWillReceiveProps(nextProps) {
    if (nextProps.countryId && nextProps.countryId != this.props.countryId) {
        return this.populatePicker(nextProps.countryId);
    }
}


text:
Q: Why does the string return "@" or mess up my "Z"? char convertalphas(char s) {

switch (s){
    case 'A':
        return '0';
        break;
    case 'B':
        return '1';
        break;
    case 'C':
        return '2';
        break;
    case 'D':
        return '3';
        break;
    case 'E':
        return '4';
        break;
    case 'F':
        return '5';
        break;
    case 'G':
        return '6';
        break;
    case 'H':
        return '7';
        break;
    case 'I':
        return '8';
        break;
    case 'J':
        return '9';
        break;
    case 'K':
        return '10';
        break;
    case 'L':
        return '11';
        break;
    case 'M':
        return '12';
        break;
    case 'N':
        return '13';
        break;
    case 'O':
        return '14';
        break;
    case 'P':
        return '15';
        break;
    case 'Q':
        return '16';
        break;
    case 'R':
        return '17';
        break;
    case 'S':
        return '18';
        break;
    case 'T':
        return '19';
        break;
    case 'U':
        return '20';
        break;
    case 'V':
        return '21';
        break;
    case 'W':
        return '22';
        break;
    case 'X':
        return '23';
        break;
    case 'Y':
        return '24';
        break;
    case 'Z':
        return '25';
        break;
 }
}

int main()
{

char astring[10];
int i = 0;
int flag = 0;
int startedalpha = 0;
//check if there is a digit input or not
int nodigit = 0;
char cell[10];
int col;
scanf( "%s", &astring );
for ( i = 0; i < 10; ++i )
{
if(astring[i] != '\0') {

//check whether letter is capital or small
 if (astring[i] >= 65 && astring[i] <= 90)
 {
        startedalpha = 1;

        //printf( "%c\n", astring[i] );
        cell[i] = convertalphas(astring[i]);

        printf("cell is %s\n", cell);
 }

What im trying to do is to concatenate all of my conversions for a later use. when I put "AB" it returns "01@" and when I put "Z" it returns something else than "25". I don't know what is wrong but it is driving me crazy! I want to be able to input "ABZ" and it saves all of my values into the variable cell. For example, "ABZ" "0125"
Thanks!
I'm confused with this forum. Obviously, I posted the question because there is something I don't know and I'm not a guru as many of you! So, why would I get -2? I already posted what I tried. I thought it is about helping not being condescending!
Thanks for those who replied anyway!
Edit --
I converted my switch statement to int but now how can I concatenate the integers in variable cell?

A: According to the C Standard (6.4.4.4 Character constants)

*...The value of an integer character constant containing more than one
  character (e.g., 'ab'), or containing a character or escape sequence
  that does not map to a single-byte execution character, is
  implementation-defined.All

All return values of the function starting from '10' to '25' inclusively are imolementation defined and you can get the result that you did not expect to get.
You need to write a function that would be declared like
char * convertalphas( const char *s );

Or
char * convertalphas( char *dest, const char *source );

By the way it will be difficult to make the reverse conversion. For example what does "25" mean? Whether it is "CF" or "Z"?:)

A: One of things I noticed is that you have a char returning function, and is returning something else than a char, like '10'. It will return an unexpected value. You can, for example, set the return of this function to integer.
So it will look like this:
int convertalphas(char s) {
  switch (s){
    case 'A':
        return 0;
    case 'B':
        return 1;
    case 'C':
        return 2;
    case 'D':
        return 3;
    case 'E':
        return 4;

  return -1;
}

And then, change inside the loop in main function:
sprintf(auxvar, "%d", convertalphas(astring[i]);
for( jj = 0; jj < strlen(auxvar); jj++)
  cell[i++] = auxvar[jj];

I hope it can help you somehow!
Good Luck.

A: Apart from the values returned by chars 'K' thru 'Z' (as mentioned by others) there are some other errors with the use of cell
Each character returned from your function is written into cell[] and then you print cell as a string. But there is no string terminator. You either need to fill cell[] with zeros first, or write a 0 into the next character
cell[i] = convertalphas(astring[i]);
cell[i+1] = 0;

But the problem with this is that cell[i] is skipped when the char is not a capital letter. You need to maintain a separate index into cell[]
cell[j++] = convertalphas(astring[i]);
cell[j] = 0;

One more problem is cell[] is not long enough for the final string terminator. You need to declare it as
char cell[11];

A: To summarize, your problem is:

*

*A char function cannot return anything other than a single character. If you try to return something like '12', it just simply doesn't work. You need to rethink your algorithm. Implementing this using ints should be very straightforward.

*Is this a homework assignment requiring the use of the switch statement? If not, and if you follow the advice to return int instead of char, a simple s-65 would do the trick, you don't need a 78-line switch.

*Since cell is a char array, each element of cell can also only store a single character.
It is not very clear what you are trying to achieve, so I will try to comprehend it in two ways:
3.1. You want to store each character's value separately in cell.
Example: for input "ABZ", you want cell to be {0, 1, 25}.
This is easy. Change cell to an int array, and output them using %d format specifier in your printf.
3.2 You treat cell as a string rather than an array of characters, and you concatenate the string for every character's value.
Example: for input "ABZ", you want cell to be "0125", or in other words, {'0', '1', '2', '5'}. This means that you won't be able to differentiate between "ABZ" and, say, "AMF", as others have pointed out.
If this is what you want to achieve, firstly 10 elements is not enough for cell - each character must be stored separately, and you cannot store "25" as two characters in a single element of cell.
You can assign it with, say, 21 elements (2 max for each alphabet, one extra for the terminating '\0' byte). After each alphabet is converted to its value in int, implement a counter and some conditionals to fill cell one character at a time. Example, if an alphabet's value is stored in val:
char cell[21];
int i=0;
if(val < 10) {
    cell[i] = val + '0';
    i++;
} else {
    cell[i] = val / 10 + '0';
    i++;
    cell[i] = val % 10 + '0';
    i++;
}

I'll leave the implementation of this into a loop as an exercise for you...


text:
Q: How to register generic class with AutoFac that requires parameters? AutoFac lets you register generic classes with builder.RegisterGeneric(Type type), however it does not accept parameters for construction. The description of the method even says:

Register an un-parametrized geenric type

However, what if I have a generic interface IService implemented by Service, which requires some parameters?
Currently I have it registered like this:
builder.Register(c =>
    new Service<Class1>(
        parameter1,
        parameter2))
    .As<IService<Class1>>();

In registration I have to specify the exact type of T (Class1 in this case). Can I do it more generically, so that I have one registration working for any T?

A: Every thing is documented here: https://autofaccn.readthedocs.io/en/latest/register/parameters.html
Basically, you can keep using RegisterGeneric and use the WithParameter
builder.RegisterGeneric(typeof(Service<>))
       .WithParameter("nameOfParam1", parameter1)
       .WithParameter("nameOfParam2", parameter2)
       .As(typeof(IService<>));

A: And for the ones looking for with multiple Ttypes (like me).
builder.RegisterGeneric(typeof(BaseGeneralCrud<,,>)).As(typeof(IBaseGeneralCrud<,,>)).InstancePerLifetimeScope();

and here is the class definition looks like:
public class BaseGeneralCrud<TEntity, TDto, TIdType> : IBaseGeneralCrud<TEntity,TDto,TIdType>
        where TEntity : class, IHasIdColumn<TIdType>
        where TDto : IHasIdColumn<TIdType> , new()
        where TIdType : notnull
{
    private readonly IRepository<TEntity,TIdType> _repository;

    private readonly IMapper _mapper;

    public BaseGeneralCrud(IRepository<TEntity,TIdType> repository, IMapper mapper)
    {
        _repository = repository;
        _mapper = mapper;
    }

    // there are some methods defined here..

}


text:
Q: getBackingBean() in OmniFaces I'm probably too blind and too new to OmniFaces, and could not find a basic method in the API to retrieve a backing bean instance. Where can I find such a method if there is one? Like this one:
public static Object getBackingBean(String name) {
    FacesContext context = FacesContext.getCurrentInstance();
    Application app = context.getApplication();
    ValueExpression expression = app.getExpressionFactory()
      .createValueExpression(context.getELContext(), String.format("#{%s}", name), Object.class);
    return expression.getValue(context.getELContext());
}

Or a more dynamic version with generics:
public static <T> T getBackingBean(String name) {
    FacesContext context = FacesContext.getCurrentInstance();
    Application app = context.getApplication();
    ValueExpression expression = app.getExpressionFactory()
      .createValueExpression(context.getELContext(), String.format("#{%s}", name), Object.class);
    return (T) expression.getValue(context.getELContext());
}

A: We have a method that's nearly like that, but it can evaluate (and get) any kind of expression not just a simplified root expression.
It's Faces.evaluateExpressionGet.
You use it as follows:
MyBean myBean = Faces.evaluateExpressionGet("#{myBean}");

With MyBean being e.g. defined as follows:
@ViewScoped
@ManagedBean
public class MyBean {
    // ...
}


text:
Q: How to get price for Stripe subscription product with volume pricing? How do I get the price for a subscription product in Stripe where there is volume pricing?  The Pricing API docs are here.
For example, in the Stripe dashboard I create a single subscription product priced at $10/month for the first 5 units, $5 thereafter.  So if the user enters 5 into a numeric input on a webpage then I want to display $50. If the user enters 6, I want to display $30.  I want the value from Stripe, not try and calculate it in the browser.
The Stripe docs on subscriptions don't seem to cover anything other than multiple tiered products, each with a fixed price.
When I create the subscription I can set the quantity, but I want to display the price before the user commits to buying.
Note: this question specifically relates to using the Stripe API and is not about getting the price by using a vendor product.

A: You can use the Upcoming Invoice API for this. In particular, you'd want to provide pricing & quantity with the subscription_items parameter to simulate a new subscription:
curl https://api.stripe.com/v1/invoices/upcoming \
  -u sk_test_123: \
  -d customer=cus_456 \
  -d 'subscription_items[0][price]=price_789' \
  -d 'subscription_items[0][quantity]=10'

If this is for a new customer, you'll need to create a Customer to use with the API, as the customer parameter is required. You can create a customer with just a description -- it's not necessary to collect personal details up front.


text:
Q: What data type should I use to represent money in C#? In C#, what data type should I use to represent monetary amounts? Decimal? Float? Double? I want to take in consideration: precision, rounding, etc.

A: Use System.Decimal:

The Decimal value type represents
  decimal numbers ranging from positive
  79,228,162,514,264,337,593,543,950,335
  to negative
  79,228,162,514,264,337,593,543,950,335.
  The Decimal value type is appropriate
  for financial calculations requiring
  large numbers of significant integral
  and fractional digits and no round-off
  errors. The Decimal type does not
  eliminate the need for rounding.
  Rather, it minimizes errors due to
  rounding.

Neither System.Single (float) nor System.Double (double) are precise enough capable of representing high-precision floating point numbers without rounding errors.

A: Use decimal and money in the DB if you're using SQL.

A: In C#, the Decimal type actually a struct with overloaded functions for all math and comparison operations in base 10, so it will have less significant rounding errors.  A float (and double), on the other hand is akin to scientific notation in binary.  As a result, Decimal types are more accurate when you know the precision you need.
Run this to see the difference in the accuracy of the 2:
using System;
using System.Collections.Generic;
using System.Text;

namespace FloatVsDecimal
{
    class Program
    {
        static void Main(string[] args)
        {
            Decimal _decimal = 1.0m;
            float _float = 1.0f;
            for (int _i = 0; _i < 5; _i++)
            {
                Console.WriteLine("float: {0}, decimal: {1}",
                                _float.ToString("e10"),
                                _decimal.ToString("e10"));
                _decimal += 0.1m;
                _float += 0.1f;
            }
            Console.ReadKey();
        }
    }
}

A: Decimal is the one you want.

A: Consider using the Money Type for the CLR.  It is a custom value type (struct) that also supports currencies and handles rounding off issues.

A: In C# You should take "Decimal" to represent monetary amounts.

A: For something quick and dirty, any of the floating point primitive types will do.
The problem with float and double is that neither of them can represent 1/10 accurately, occasionally resulting in surprising trillionths of a cent. You've probably heard of the infamous 10¢ + 20¢. More realistically, try calculating a 6% sales tax on three items valued at $39.99 each pre-tax.
Also, float and double have values like negative infinity and NaN that are of no use whatsoever for representing money. So decimal, which can represent 1/10 precisely would seem to be the best choice.
However, decimal doesn't carry any information about what currency we're dealing with. Does the amount $29.89, for example, equal €29.89? Is $29.89 > €29.89? How do I make sure these amounts are displayed with the correct currency symbols?
If these sorts of details matter for your program, then you should either use a third-party library or create your own CurrencyAmount class (or whatever you want to call it).
But if that sort of thing doesn't matter to the program, you can just use a floating point type. Or maybe even integers (e.g., my blackjack implementation in Java asks the player to enter a wager in whole dollars).


text:
Q: iOS YUCIRGBtonecurve : Cannot use sRGB texture binding with format BGRA8 for sampler 0 in kernel 'filterKernel' I'm using YUCIRGBToneCurve library , this class keep crashing my camera .
At the moment camera start capturing/
Cannot use sRGB texture binding with format BGRA8 for sampler 0 in kernel 'filterKernel'.

My custom view rendered with CIContext created by EAGLContext
I have tried  sRGB Linear & deviceRGB , both gave me no luck.
 self.openGLContext = [[EAGLContext alloc]initWithAPI: kEAGLRenderingAPIOpenGLES2];
    self.openGLView = [[GLKView alloc]initWithFrame:view.frame context:self.openGLContext];
    self.coreimageContext = [CIContext contextWithEAGLContext:self.openGLContext];
    self.coreimageContext = [CIContext contextWithEAGLContext:self.openGLContext options:@{kCIContextWorkingColorSpace:(id) CFBridgingRelease(CGColorSpaceCreateDeviceRGB())}];


text:
Q: Can valgrind report a segmentation fault + coredump when there isn't? I am writing a program which use the library openssl. My program is functionnal, but when i try to execute it with valgrind, I have a segmentation fault. When I try to juste execute it (on the os), there is no problem, even when I use gdb.
I red my code many times and I don't see where the error is.
Is it possible that there are no mistakes in my code ? thank you.

A:
Can valgrind report a segmentation fault + coredump when there isn't?

Not likely.
The problem is probably in you coder, and the additional instrumentation provided by Valgrind exposes the bug.
Valgrind should be telling you where the problem is. With OpenSSL, the trick is differentiating the "benign findings" from the "bad findings". That's not easy because some of the OpenSSL devs don't care about clearing the benign findings. So the benign findings mask the bad findings.
As Sebastian said, if you provide more information you will likely get better answers.


text:
Q: Manage multiple azure subscription using single email id My organization provides Managed Services to our clients. We have 5 different clients. Currently, we log into an individual subscription with client's org id.
Example:
client1's ID would be - manju@client1.com, client 2's Id would be - manju@client2.com etc.,
We are worried, if the number of client increases (which is happening), it would be difficult to manage them to keep logging in every time (different ID for different subscription) to manage their environment.
Does Azure have any mechanism such that - I can have a single ID (like a master tenant) that I can use to switch between the subscriptions? Like the one AWS has - switch role feature.

A: The client can add your Azure AD account as a guest to their Azure AD tenant.
They can then add rights for that user in subscriptions.
You would then be able to switch tenants from the top-right in the portal.
So they would not create a user for you, but instead invite your existing user there.


text:
Q: How to convert this cURL to wp_remote_*? My function below includes a cURL call which throws a text string at a Google Cloud text analysis API, returning a response object, which we then parse to get a specific piece.
It has been recommended to me that I switch the cURL PHP statement to use WordPress' wp_remote_get.
I have read the docs for that but, to be honest, I don't understand how my cURL header fields should map to wp_remote_get arguments. Or even if it should be wp_remote_post rather than wp_remote_get.
How can I try and understand what to do here?
    function get_entity_type(
        $text_to_analyse,           // passed string to be handed to GCloud NLP
        $entity = 'type'            // part of each "entities" result to return
    ) {

        // Google Cloud API key
        $options = get_option( 'cxt_settings' );
        $google_nlp_api = $options['cxt_gcloud'];

        // Supply data payload in JSON format
        $data = '{
          "document":{
            "type":"PLAIN_TEXT",
            "content":"'.$text_to_analyse.'"
          },
          "encodingType":"UTF8"
        }';
        $payload = $data;

        // Call the API endpoint, with API key
        $url = 'https://language.googleapis.com/v1/documents:analyzeEntities?key='.$google_nlp_api;

        // Prepare to get results using cURL
        $ch = curl_init($url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLINFO_HEADER_OUT, true);
        curl_setopt($ch, CURLOPT_POST, true);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
        // Set HTTP Header for POST request
        curl_setopt($ch, CURLOPT_HTTPHEADER, array(
                'Content-Type: application/json',
                'Content-Length: ' . strlen($payload))
        );

        // Submit the POST request
        $result = curl_exec($ch);

        // Store result in array
        $arr = json_decode($result, true);

        // Close cURL session handle
        curl_close($ch);

        // Pluck out the first value from the response object
        $ent_val = $arr['entities'][0][$entity];

        return $ent_val;
        // List of possible entities: https://cloud.google.com/natural-language/docs/reference/rest/v1/Entity#Type
        // UNKNOWN
        // PERSON
        // LOCATION
        // ORGANIZATION
        // EVENT
        // WORK_OF_ART
        // CONSUMER_GOOD
        // OTHER

    }

A: /* ########################################################################## *
 *
 *   DETERMINE ENTITY, via native wp_remote_post() call
 *
/* ########################################################################## */

function get_entity_type_via_wp(
    $text_to_analyse,           // passed string to be handed to GClouD NLP
    $entity = 'type'            // part of each "entities" result to return
) {

    // Google Cloud API key
    $options = get_option( 'cxt_settings' );
    $google_nlp_api = $options['cxt_gcloud'];

    // Call the API endpoint, with API key
    $url = 'https://language.googleapis.com/v1/documents:analyzeEntities?key='.$google_nlp_api;

    // Request payload
    $payload = '{
      "document":{
        "type":"PLAIN_TEXT",
        "content":"'.$text_to_analyse.'"
      },
      "encodingType":"UTF8"
    }';

    // Call Goolge NLP API via wp_remote_post();
    // cf. https://wordpress.stackexchange.com/questions/349271/how-to-convert-this-curl-to-wp-remote?noredirect=1#comment510738_349271
    //
    $result_full = wp_remote_post(
        $url,
        array(
            'method'      => 'POST',
            'timeout'     => 45,
            'redirection' => 5,
            'httpversion' => '1.0',
            'blocking'    => true,
            'headers'     => array(
                'Content-Type' => 'application/json; charset=utf-8'
            ),
            'body'      =>  $payload,                       // Payload, text to analyse
            'data_format' => 'body'
        )
    );

    // Just the "body" bit
    $result_entities = $result_full['body'];

    // Store result in array
    $arr = json_decode($result_entities, true);

    // Pluck out the first value from the response object
    $ent_val = $arr['entities'][0][$entity];

    return $ent_val;

    // return $ent_val;
    // List of possible entities: https://cloud.google.com/natural-language/docs/reference/rest/v1/Entity#Type
    // UNKNOWN
    // PERSON
    // LOCATION
    // ORGANIZATION
    // EVENT
    // WORK_OF_ART
    // CONSUMER_GOOD
    // OTHER

}