text:
Q: WiFi Adapter and touchpad stop working after some time on batteries Ubuntu 22 Lenovo L13 I have been trying different solution, but I am getting desperate and I think I have to gather somehow to more information before doing more changes.
I have a Lenovo L13 Gen 2 with Ubuntu 22.04 on it.
Power up with the power supply attached works without problems.
Running on batteries it works good for sometime, but after a while 30 minutes to 1,5 hours the internet connection drops WiFi adapter does not connect to a network, and also the last two time the touchpad stops working.
Keyboard keeps working and if you attached a USB Mouse it also works.
If I restart the WiFi adaptor dissapear.
I have to turn off the Laptop and turn it on again and then everything works again.
I have following Operating System

*

*Operating System: Ubuntu 22.04 LTS

*Kernel: Linux 5.15.0-40-generic

I have following hardware

*

*Hardware Vendor: Lenovo

*Hardware Model: ThinkPad L13 Gen 2

lshw
Shows the following
*-network:0
             description: Wireless interface
             product: Wi-Fi 6 AX201
             vendor: Intel Corporation
             physical id: 14.3
             bus info: pci@0000:00:14.3
             logical name: wlp0s20f3
             version: 20
             serial: 8c:55:4a:da:30:d1
             width: 64 bits
             clock: 33MHz
             capabilities: bus_master cap_list ethernet physical wireless
             configuration: broadcast=yes driver=iwlwifi driverversion=5.15.0-40-generic firmware=66.f1c864e0.0 QuZ-a0-hr-b0-66.u ip=192.168.178.74 latency=0 link=yes multicast=yes wireless=IEEE 802.11
             resources: iomemory:600-5ff irq:16 memory:601d184000-601d187fff

lspci -knn | grep Net -A2
Shows
00:14.3 Network controller [0280]: Intel Corporation Wi-Fi 6 AX201 [8086:a0f0] (rev 20)
    Subsystem: Intel Corporation Wi-Fi 6 AX201 [8086:0070]
    Kernel driver in use: iwlwifi

I have checked following log file
grep wlp0 /var/log/kern.log
And I am getting the following errors (I guess just before crashing)
At 16:40 is the restart
Jul 10 13:30:20 jfdzar-thinkpad kernel: [ 1115.622995] wlp0s20f3: AP 50:d4:f7:49:aa:06 changed bandwidth, new config is 2427.000 MHz, width 1 (2427.000/0 MHz)
Jul 10 13:30:21 jfdzar-thinkpad kernel: [ 1116.541487] wlp0s20f3: AP 50:d4:f7:49:aa:06 changed bandwidth, new config is 2427.000 MHz, width 2 (2437.000/0 MHz)
Jul 10 13:30:35 jfdzar-thinkpad kernel: [ 1130.562376] wlp0s20f3: AP 50:d4:f7:49:aa:06 changed bandwidth, new config is 2427.000 MHz, width 1 (2427.000/0 MHz)
Jul 10 13:30:36 jfdzar-thinkpad kernel: [ 1131.584449] wlp0s20f3: AP 50:d4:f7:49:aa:06 changed bandwidth, new config is 2427.000 MHz, width 2 (2437.000/0 MHz)
Jul 10 13:30:50 jfdzar-thinkpad kernel: [ 1145.604328] wlp0s20f3: AP 50:d4:f7:49:aa:06 changed bandwidth, new config is 2427.000 MHz, width 1 (2427.000/0 MHz)
Jul 10 13:30:52 jfdzar-thinkpad kernel: [ 1147.548412] wlp0s20f3: AP 50:d4:f7:49:aa:06 changed bandwidth, new config is 2427.000 MHz, width 2 (2437.000/0 MHz)
Jul 10 16:18:17 jfdzar-thinkpad kernel: [11192.582225] wlp0s20f3: AP 50:d4:f7:49:aa:06 changed bandwidth, new config is 2427.000 MHz, width 1 (2427.000/0 MHz)
Jul 10 16:18:18 jfdzar-thinkpad kernel: [11193.607262] wlp0s20f3: AP 50:d4:f7:49:aa:06 changed bandwidth, new config is 2427.000 MHz, width 2 (2437.000/0 MHz)
Jul 10 16:25:52 jfdzar-thinkpad kernel: [11647.901870] p2p-dev-wlp0s20: Failed check-sdata-in-driver check, flags: 0x0
Jul 10 16:25:52 jfdzar-thinkpad kernel: [11647.902097] wlp0s20f3: deauthenticating from 50:d4:f7:49:aa:06 by local choice (Reason: 3=DEAUTH_LEAVING)
Jul 10 16:25:52 jfdzar-thinkpad kernel: [11647.902105] wlp0s20f3: Failed check-sdata-in-driver check, flags: 0x4
Jul 10 16:25:52 jfdzar-thinkpad kernel: [11647.902427] wlp0s20f3: Failed check-sdata-in-driver check, flags: 0x4
Jul 10 16:25:52 jfdzar-thinkpad kernel: [11647.902776] wlp0s20f3: Failed check-sdata-in-driver check, flags: 0x4
Jul 10 16:25:52 jfdzar-thinkpad kernel: [11647.903045] wlp0s20f3: Failed check-sdata-in-driver check, flags: 0x4
Jul 10 16:25:52 jfdzar-thinkpad kernel: [11647.903350] wlp0s20f3: HW problem - can not stop rx aggregation for 50:d4:f7:49:aa:06 tid 0
Jul 10 16:25:52 jfdzar-thinkpad kernel: [11647.903351] wlp0s20f3: HW problem - can not stop rx aggregation for 50:d4:f7:49:aa:06 tid 1
Jul 10 16:25:52 jfdzar-thinkpad kernel: [11647.903352] wlp0s20f3: HW problem - can not stop rx aggregation for 50:d4:f7:49:aa:06 tid 2
Jul 10 16:25:52 jfdzar-thinkpad kernel: [11647.903352] wlp0s20f3: HW problem - can not stop rx aggregation for 50:d4:f7:49:aa:06 tid 3
Jul 10 16:25:52 jfdzar-thinkpad kernel: [11647.903352] wlp0s20f3: HW problem - can not stop rx aggregation for 50:d4:f7:49:aa:06 tid 4
Jul 10 16:25:52 jfdzar-thinkpad kernel: [11647.903357] wlp0s20f3: Failed check-sdata-in-driver check, flags: 0x4
Jul 10 16:25:52 jfdzar-thinkpad kernel: [11647.903632] wlp0s20f3: Failed check-sdata-in-driver check, flags: 0x4
Jul 10 16:25:52 jfdzar-thinkpad kernel: [11647.904195] wlp0s20f3: Failed check-sdata-in-driver check, flags: 0x4
Jul 10 16:25:52 jfdzar-thinkpad kernel: [11647.904507] wlp0s20f3: failed to remove key (0, 50:d4:f7:49:aa:06) from hardware (-5)
Jul 10 16:25:52 jfdzar-thinkpad kernel: [11647.905063] wlp0s20f3: Failed check-sdata-in-driver check, flags: 0x4
Jul 10 16:25:52 jfdzar-thinkpad kernel: [11647.906539] wlp0s20f3: Failed check-sdata-in-driver check, flags: 0x4
Jul 10 16:25:52 jfdzar-thinkpad kernel: [11647.906892] wlp0s20f3: Failed check-sdata-in-driver check, flags: 0x4
Jul 10 16:25:52 jfdzar-thinkpad kernel: [11647.907199] wlp0s20f3: Failed check-sdata-in-driver check, flags: 0x4
Jul 10 16:25:52 jfdzar-thinkpad kernel: [11647.908352] wlp0s20f3: failed to remove key (1, ff:ff:ff:ff:ff:ff) from hardware (-5)
Jul 10 16:40:34 jfdzar-thinkpad kernel: [    4.158763] iwlwifi 0000:00:14.3 wlp0s20f3: renamed from wlan0

A possible issue I read was that maybe the power save function of the WiFi Adaptor was cousing error so I change this file
Previous: wifi.powersave = 3
New: wifi.powersave = 2
sudo nano /etc/NetworkManager/conf.d/default-wifi-powersave-on.conf
But it did not work
Does somebody have similar problems?
What are the next steps I could take to gather more information or to try other solutions?
I believe it should be something related with the power management but I am not sure about it
Thank you very much in advance


text:
Q: Javascript parseFloat parseInt I'm Learning Javascript.
What does it mean to have parseFloat & parseInt functions in javascript, when in fact, Javascript does not differentiate between float and integer--there is only the Numeric data type.
Seems like they should have created parseNumber to be in alignment with their data types.
Any comments?  Maybe somebody knows the reason.  It just seems very odd.

A: parseInt("1.0") will be same as parseInt("1.1")
parseFloat("1.0") will be different to parseFloat("1.1")

A: In JS, there exist Number not parseNumber - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number. It works with numeric value, no matter whether it's float or int.
parseInt or parseFloat are generally used to parse string to number.
In decimal number i:e 10.3 the parseInt only return the number before decimal and discard everything after it, whereas with parseFloat it does consider the digits after decimal.

const num = 10.3;

console.log(parseInt(num));
console.log(parseFloat(num));

A: These functions are basically to parse string data to the relative format so according to the conditions we can use them
The parseInt() function parses a string argument and returns an integer of the specified radix (the base in mathematical numeral systems).
The parseFloat() function parses an argument and returns a floating point number.

console.log(parseInt("1.11"))
console.log(parseFloat("1.11"))

A: parseFloat() and parseInt() is javascript functions which is basically use to convert string into Float or Integer number

var a = parseInt("10");
  var b = parseInt("10.00");
  var c = parseInt("10.33");
  var d = parseInt("34 45 66");
  var e = parseInt("   60   ");
  var f = parseInt("40 years");
  var g = parseInt("He was 40");

  var h = parseFloat("10");
  var i = parseFloat("10.00");
  var j = parseFloat("34 45 66");
  var k = parseFloat("10.33");
  var l = parseFloat("   60   ");
  var m = parseFloat("40 years");
  var n = parseFloat("He was 40");

 console.log("a : " + a);
 console.log("b : " + b);
 console.log("c : " + c);
 console.log("d : " + d);
 console.log("e : " + e);
 console.log("f : " + f);
 console.log("g : " + g);
 console.log("h : " + h);
 console.log("i : " + i);
 console.log("j : " + j);
 console.log("k : " + k);
 console.log("l : " + l);
 console.log("m : " + m);
 console.log("n : " + n);

redpajama_set_name: RedPajamaStackExchange


text:
Q: Is there evidence of dark matter in our galaxy? Is there evidence of dark matter in our galaxy?
How can we measure this, say, how many percent of the center of our galaxy is dark matter?
I did not find the answer in the question What's dark matter and who discovered it?

A: Piero Madau, professor of astronomy and astrophysics at the University of California, Santa Cruz says: "In previous simulations, this region was smooth, but now we have enough detail to see clumps of dark matter."
The results may help scientists figure out what dark matter is. So far it has been detected only through its gravitational effects on stars and galaxies. According to one theory, however, dark matter consists of weakly interacting massive particles (WIMPs), which can annihilate each other and emit gamma rays when they collide. Gamma rays resulting from the annihilation of dark matter could be detected with the recently launched Gamma-ray Space Telescope GLAST, the UW physicists helped build.
The dark matter halo that surrounds what we call the Milky Way stars and gas that can be viewed and grouped together in a spiral-shaped like a giant beach ball and quite deformed, U.S. astronomers say, the first to believe they have managed to measure its shape. Dark matter is so named because it is invisible because nobody knows what is formed. However, it is undetectable, because it obeys, like ordinary matter, laws of gravity and pull of small dwarf galaxies orbiting the Milky Way.

A: A star in the disk of our Milky Way galaxy orbits around the galactic center, much like planets in the solar system orbit the Sun, owing to the gravitational attraction of all the stars and other matter in the galaxy that are closer to the galactic center than the star in question. For our galaxy, the orbital speed for the Sun and other stars at the same distance from the galactic center as our Sun, is about 220 km/s, resulting in an orbital period of about 200 million years.
For our solar system, 99.9 % of the mass is in the sun, so the speed of the planets orbiting it drops off as the inverse square root of the distance from the Sun (a result easily derived from Newton's law of gravity, whereby the gravitational force drops off as the inverse square of the distance). Earth's orbital speed is 30 km/s, and Jupiter, 5.2 times further away, has an orbital speed of 13 km/s. The orbital speed also depends on the square root of the mass at the center, so if our Sun became four times as massive, the Earth's orbital speed would double.
For an extended object, such as our galaxy, it can be derived from Newton's law that the gravitational force from the whole galaxy acting on a star is just equal to what would be expected from all the matter closer to the galactic center than is the star. All forces from stars and matter further out from the center cancel themselves out.
If all the mass of our galaxy were at the center, then the orbital speed would drop off as the inverse square root of the distance from the center, just as for the solar system. But, since the galaxy's mass is extended, then the orbital speed will drop off more slowly than that. In fact, if the mass located within a given distance from the center goes up as the square of that distance (as it would for a flat disk of constant thickness and density), then the orbital speed will be more or less constant as we go further and further out. The same would be true for a spherical halo, where the density drops off as the 2/3 power of the distance from the center.
In the 1970's astronomers studying orbital speeds around the centers of other galaxies found that the orbital speed is indeed roughly constant, against all expectations. Around the same time, other astronomers studying radial velocities of distant stars in our galaxy found that to be true for our galaxy as well. And studies of the 21-cm of interstellar hydrogen have revealed that this constant speed continues way out from the centers of galaxies, much beyond the furthest stars that can be seen.
But it has been long known that the distribution of stars in all normal galaxies, whether spiral or elliptical, is strongly concentrated toward the center, and so it was expected that orbital speed would continuously decrease as we moved away from the center. The only explanation for the anomaly was that there was another source of matter beyond what we can see in stars and interstellar matter, that was responsible. This has become known as the 'dark matter'.
In fact, consequences of the dark matter had been seen as long ago as the 1950s when it was noticed that the speeds of galaxies milling about in distant clusters of galaxies was much higher than one would expect from the total masses of all the stars. But these were so far away that we couldn't be sure that there wasn't some faint matter component that was responsible. Having it in our own galaxy as well brings home the result that the matter causing the excess speeds is indeed dark.
It is difficult to measure the percentage of dark matter in our galaxy since, being inside it, we can't determine how far away from the galactic center the most distant clouds of neutral hydrogen are. It is easier to measure the distances to the edges of other galaxies and galaxy clusters. Best guesses are that about 80 % of the mass in our galaxy is dark matter.


text:
Q: Set button and imageview in gridview and how to set each of them listener Hi guys I need your help. I want to set listner imageview and button in gridview and when I click to imageview app should show dialog with image and when I click to button app should do something.
like this:
enter image description here

A: You need to create Custom Adapter for your GridView with Custom UI with ImageView and Button, and then inside the getVieew(){} you need to make click listener for Image and button, and there you can do your action with the help of position with your array list.
here I am posting demo adapter for your reference:
here you can change TextView to Button.
public class CustomAdapter extends BaseAdapter{

    String [] result;
    Context context;
 int [] imageId;
      private static LayoutInflater inflater=null;
    public CustomAdapter(MainActivity mainActivity, String[] prgmNameList, int[] prgmImages) {
        // TODO Auto-generated constructor stub
        result=prgmNameList;
        context=mainActivity;
        imageId=prgmImages;
         inflater = ( LayoutInflater )context.
                 getSystemService(Context.LAYOUT_INFLATER_SERVICE);

    }

    @Override
    public int getCount() {
        // TODO Auto-generated method stub
        return result.length;
    }

    @Override
    public Object getItem(int position) {
        // TODO Auto-generated method stub
        return position;
    }

    @Override
    public long getItemId(int position) {
        // TODO Auto-generated method stub
        return position;
    }

    public class Holder
    {
        TextView tv;
        ImageView img;
    }
    @Override
    public View getView(final int position, View convertView, ViewGroup parent) {
        // TODO Auto-generated method stub
        Holder holder=new Holder();
        View rowView;

             rowView = inflater.inflate(R.layout.program_list, null);
             holder.tv=(TextView) rowView.findViewById(R.id.textView1);
             holder.img=(ImageView) rowView.findViewById(R.id.imageView1);

         holder.tv.setText(result[position]);
         holder.img.setImageResource(imageId[position]);

         rowView.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub
                Toast.makeText(context, "You Clicked "+result[position], Toast.LENGTH_LONG).show();
            }
        });

        return rowView;
    }

}

ref:-https://caveofprogramming.com/guest-posts/custom-gridview-with-imageview-and-textview-in-android.html


text:
Q: Generate a link in R in a sentence While creating a vector  in R, can we make the links are highlighted. For example,
vector1 <- "This is the link https://stackoverflow.com/questions/45611862/url-generation-in-shiny\"

This is the vector
Expected output

A: You can do that but the link is not clickable:
library(crayon)
v <- paste0(
  "This is the link ",
  blue("https://stackoverflow.com/questions/45611862/url-generation-in-shiny")
)
cat(v)

You can also underline:
v <- paste0(
  "This is the link ",
  blue(underline("https://stackoverflow.com/questions/45611862/url-generation-in-shiny"))
)
cat(v)

In fact you can create a hyperlink:
v <- paste0(
  "This is the link ",
  hyperlink(
    text = blue(underline("Click here")),
    url = "https://stackoverflow.com/questions/45611862/url-generation-in-shiny"
  )
)
cat(v)

But this is not supported by the RStudio console:
has_hyperlink()
# FALSE

Otherwise, you can get a clickable link in the RStudio viewer:
library(htmltools)
browsable(
  tags$p(
    "This is the link: ",
    tags$a(
      href = "https://stackoverflow.com/questions/45611862/url-generation-in-shiny",
      "https://stackoverflow.com/questions/45611862/url-generation-in-shiny"
    )
  )
)

A: Adapted from Tonio Liebrand's answer:
library(DT)    # for datatable() function
library(shiny) # for tags$a() function

vector <- data.frame(link = paste0("This is the link: ",
                                 (toString(tags$a(href = "https://stackoverflow.com/questions/45611862/url-generation-in-shiny/","https://stackoverflow.com/questions/45611862/url-generation-in-shiny/")))))

datatable(vector, escape = FALSE);

You will find a clickeable link in Viewer.


text: Q: Замена background-image в email рвссылках Смотрел https://www.youtube.com/watch?v=TNCaCDFKJfc на 5:28 и на 13-й строке написано, что не нужно использовать background-image, потому что outlook не поддерживает. Что можно использовать вместо background-image?


text:
Q: How to create a variable conditional on a string in R I am trying to create the variable 'active' in a df conditional of values from a string in R (act_users). If the name from the variables scr_name and rt_name in the df is within the string, I would like the variable to take the value 1, if not 0.
df <- data.frame("screen_name" = c("august", "berit", "christopher", "david", "erica", "frank"), "rt_name" = c("berit", "august", "david", "erica", "frank", "christopher"))

act_users <- c("david", "august", "berit")

I have tried the following if else statements, but none of them work
'%!in%' <- function(x,y)!('%in%'(x,y))#create a function

df$active <- ifelse((df$screen_name %in% act_users) & (df$rt_name %in% act_users), 1,
                         ifelse((df$screen_name %!in% act_users) & (df$rt_name %!in% act_users), 2))

#attempts only with screenname
df$active <- ifelse(df$screen_name %in% act_users, "1", ifelse(df$screen_name %!in% act_users, "0"))

df$active <- if(df$screen_name %in% act_users){
  df$active == 1
} else {
  df$active == 0}

My last solution would be to make the active user string as a df, merge the results and match the colomns inside the dataframe, but my data is quite big, so it would be nice with a more efficient solution?
Thanks in adcvance!

A: If it is an exact match you can use:
df$active = apply(df,1,function(i)as.numeric(all(i %in% act_users)))

You take every row, and return a True / False whether each column is an element of act_users. All will give you 1 only if all booleans are true.
  screen_name     rt_name active
1      august       berit      1
2       berit      august      1
3 christopher       david      0
4       david       erica      0
5       erica       frank      0
6       frank christopher      0

A: Maybe you can use the code below to make it, which could be faster than apply(df,1,...) when you have many rows:

*

*Solution 1:

df$active <- Reduce("*",lapply(df, function(x) ifelse(x %in% act_users,1,0)))

*

*Solution 2:

df <- within(df, active <- ifelse(screen_name%in%act_users & rt_name%in%act_users,1,0))

Output
> df
  screen_name     rt_name active
1      august       berit      1
2       berit      august      1
3 christopher       david      0
4       david       erica      0
5       erica       frank      0
6       frank christopher      0

A: If you want to check only two columns, you can use %in% on both the columns and combine the result.
df$active <- +(df$screen_name %in% act_users & df$rt_name %in% act_users)
df

#  screen_name     rt_name active
#1      august       berit      1
#2       berit      august      1
#3 christopher       david      0
#4       david       erica      0
#5       erica       frank      0
#6       frank christopher      0

The + at the beginning of ifelse changes the logical values to integer value.


text:
Q: Passing a function parameter to change a div style properties I've been trying to solve this problem:  I want to pass a function parameter to select a div so I can change the style.top position with an interval.
var yPos = 0;
var divOne = document.getElementById("div1");
var divTwo = document.getElementById("div2");
var divThree = document.getElementById("div3");
.....

function jump(which){
    yPos++;
    (which).style.top = yPos + "px";
    var jumpTimeOut = setTimeout(jump,100,which);
    if(yPos > 500){
    clearTimeout(jumpTimeOut);
    }
}

jump("divOne");

I could use a switch statement for each div variable, but there is a lot of divs in the program, so I was wondering if there is a way to concatenate the div name with a function parameter. Needles to say I'm getting can't change properties style of NULL with the current code.
Any help is appreciated
---->> I found a solution, I passed the div name string "div1" as parameter inside the function, so I can get the div again with a inside variable:
var divOne = document.getElementById("div1");
var divTwo = document.getElementById("div2");

function jump(which){
    var jumpingDiv = document.getElementById(which);
    yPos++;
    jumpingDiv.style.top = yPos + "px";
    var jumpTimeOut = setTimeout(jump,100,which);
        if(yPos > 500){
        clearTimeout(jumpTimeOut);
    }
}

jump("div1");

Odd solution I think, but its working so.. hehe.


text:
Q: Unique column header public class ReportSummary
{
    public void CreateHeader()
    {
        var header = new List<KeyValuePair<string, string>>
        {
            new KeyValuePair<string, string>("Description", "Summary By Role*"),
            new KeyValuePair<string, string>("ColName1" , "Public"),
            new KeyValuePair<string, string>("ColName2" , "Non Public"),
            new KeyValuePair<string, string>("ColName3" , "Public"),
            new KeyValuePair<string, string>("ColName4" , "Non Public"),
            new KeyValuePair<string, string>("ColName5" , "Public"),
            new KeyValuePair<string, string>("ColName6" , "Non Public"),
            new KeyValuePair<string, string>("ColName7" , "Public"),
            new KeyValuePair<string, string>("ColName8" , "Non Public"),
            new KeyValuePair<string, string>("ColName9" , "Public"),
            new KeyValuePair<string, string>("ColName10" , "Non Public"),
            new KeyValuePair<string, string>("ColName11" , "Public"),
            new KeyValuePair<string, string>("ColName12" , "Non Public")
        };

        for (int index = 0; index < header.Count; index++)
        {
             row[index] = header[index].Value;
        }
        AddRow(_currentRow, row, rowStyleIndex);
    }

    void AddRow(int rowIndex, object[] cells, params int[] styleIndexes)
    {
        if (cells != null)
        {
            for (int columnIndex = 0; columnIndex < cells.Length; columnIndex++)
            {
                int styleIndex = 16;
                //If style idex is defined, pass it, or else pass the default style index 16, which is a bold header with white background
                if (styleIndexes != null)
                {
                    styleIndex = styleIndexes[columnIndex];
                }

                AddCell((uint)rowIndex, columnIndex + 1, cells[columnIndex], styleIndex);
            }
        }
    }
}`

class ExcelProcessor :
public class ExcelProcessor2010
{
    protected Cell AddCell(uint rowIndex, int columnIndex, object cellValue, int styleIndex)
    {
        //Removing the values for the Greyed out cell and Empty cell
        if (string.IsNullOrEmpty(Convert.ToString(cellValue)) || styleIndex == 33)
        {
            cellValue = " ";
        }

        Cell cell = AddCell(rowIndex, columnIndex, cellValue);
        cell.StyleIndex = (uint)styleIndex;
        return cell;
    }

    protected Cell AddCell(uint rowIndex, int columnIndex, object cellValue)
    {
        Cell cell = null;
        if (cellValue != null)
        {

            string cellValueAsString = cellValue.ToString();
            if (!string.IsNullOrEmpty(cellValueAsString))
            {
                cell = InsertCellInWorksheet(GetColumnName(columnIndex), rowIndex);
                if ((cellValue is bool || cellValue is bool?))
                {
                    cell.DataType = CellValues.Boolean;
                }
                else if (cellValue is DateTime || cellValue is DateTime?)
                {
                    cell.DataType = CellValues.Date;
                }
                else if (cellValue is string && !string.IsNullOrEmpty((string)cellValue))
                {
                    cell.DataType = CellValues.SharedString;
                }
                else if (cellValue is byte || cellValue is byte? ||
                            cellValue is sbyte || cellValue is sbyte? ||
                            cellValue is short || cellValue is short? ||
                            cellValue is ushort || cellValue is ushort? ||
                            cellValue is int || cellValue is int? ||
                            cellValue is uint || cellValue is uint? ||
                            cellValue is long || cellValue is long? ||
                            cellValue is ulong || cellValue is ulong? ||
                            cellValue is float || cellValue is float? ||
                            cellValue is double || cellValue is double? ||
                            cellValue is decimal || cellValue is decimal?
                    )
                {
                    cell.DataType = CellValues.Number;
                }

                if (cell.CellValue == null)
                {
                    cell.Append(new CellValue
                                    {
                                        Text =
                                            cell.DataType != CellValues.SharedString
                                                ? cellValueAsString
                                                : InsertSharedStringItem(cellValueAsString)
                                    });
                }
                else
                {
                    cell.CellValue.Text = cellValueAsString;
                }
            }
        }

        return cell;
    }

    protected string InsertSharedStringItem(string text)
    {
        // If the part does not contain a SharedStringTable, create one.
        if (SharedStringTablePart.SharedStringTable == null)
        {
            SharedStringTablePart.SharedStringTable = new SharedStringTable();
        }

        int i = 0;

        // Iterate through all the items in the SharedStringTable. If the text already exists, return its index.
        foreach (SharedStringItem item in SharedStringTablePart.SharedStringTable.Elements<SharedStringItem>())
        {
            if (item.InnerText == text)
            {
                return i.ToString();
            }

            i++;
        }

        // The text does not exist in the part. Create the SharedStringItem and return its index.
        SharedStringTablePart.SharedStringTable.AppendChild(new SharedStringItem(new Text(text)));
        //SharedStringTablePart.SharedStringTable.Save();

        return i.ToString();
    }
}

I am generating Excel file using OpenXML. I am trying to create a table in Excel as shown in image:

But its changing column headers from Public/NonPublic to Public1, NonPublic2, Public3, NonPublic4 etc... After some research understood that Excel is expecting unique column headers. But it's happening only when you create Excel using OpenXML. If you create Excel manually and set headers like these then it works fine.
Can anyone help me on this?


text:
Q: Conditional count and group by in R I would like to count how many rows there are per type if they meet the condition x == 0. Sort of like a group by in SQL
Here is an example of the data
  type    x
search    0
NULL      0
public    0
search    1
home      0
home      1
search    0

A: You could also use the sqldf package:
library(sqldf)
df <- data.frame(type=c('search','NULL','public','search','home','home','search'),x=c(0,0,0,1,0,1,0))
sqldf("SELECT type, COUNT(*) FROM df WHERE x=0 GROUP BY type")

which gives the following result:
    type COUNT(*)
1   NULL        1
2   home        1
3 public        1
4 search        2

A: You could also do this with the dplyr package:
library(dplyr)

df2 <- df %>% group_by(x,type) %>% tally()

which gives:
  x   type n
1 0   home 1
2 0   NULL 1
3 0 public 1
4 0 search 2
5 1   home 1
6 1 search 1

A: Given the data frame,
df=data.frame(type=c('search','NULL','public','search','home','home','search'),x=c(0,0,0,1,0,1,0))
If you want to know how many of each value in column 1 have a value in column 2 of zero then you can use:
table(df)[,1]
as long as you are only working with 1's and 0's to get the answer:
  home   NULL public search
     1      1      1      2

A: Given your data is structured as a data frame, the following code has a better running time than the answers given above:
nrow(data[data$x=="0"])

You can test your run time using:
ptm <- proc.time()
nrow(subset(data, x == "0"))
proc.time() - ptm

ptm <- proc.time()
nrow(data[data$x=="0"]))
proc.time() - ptm

In my case, the running time was about 15 times faster, with 1 million rows.

A: I am assuming that you want to find the number of rows when a particular condition (when a variable is having some value) is met.
If this is the case, then I suppose you have "x" as a variable represented in a column. "x" can take multiple values. Suppose you want to find how many rows are there in your data when x is 0. This could be done by:
nrow(subset(data, x=="0")

'data' is the object name for your dataset in R
EDIT:
I am seeing your edited dataframe now. You could use this to solve your problem:
table(data$type, data$x)


text:
Q: htaccess issue redirecting certain urls I have a bunch of .htaccess rules that follow this format
RewriteCond %{HTTP_HOST} ^www.lazygamer\.co.za$ [NC]
RewriteRule ^(.*)$ http://www.lazygamer.net/$1 [R=301,L]

Now I need to put in a new rule to include a category string in my URL and was given this code
RewriteRule ^/([^/]+)/$ /category/$1/ [R]

But it's not being fired for some reason, can someone please show me how to change the above string to match the rule further up.. so I check for some condition before executing the rule?
I only need this rule to fire if the url is in the format http://www.lazygamer.net/post-name/ and not when the url is in the format http://www.lazygamer.net/category/post-name/

A: RewriteCond %{REQUEST_URI} !^/category/.*$
RewriteRule ^([^/]+)/ /category/$1/ [R]

A: My htaccess file now looks like this and solves the problem
RewriteCond %{HTTP_HOST} !^images.lazygamer\.net$ [NC]
RewriteCond %{REQUEST_URI} !^/(wp-content|wp-admin|wp-includes|fixed|contact-details|advertise|about|category|submission|images|ps3|xbox-360|wii|other-news|video).*$
RewriteCond %{REQUEST_URI} !^\/$
RewriteRule ^(.*)$ http://www.lazygamer.net/fixed/$1 [R=301,L]

The second last line ignore the root folder which kept me up all night...


text:
Q: Numerical integration of a 2D advection equation with spacially varying coefficients. I am interested in a simple algorithm for solving this PDE for $f(x,y,t)$:
$$f_t + A y  f_x - B x  f_y =0$$
With $A,B>0$. The initial condition is some arbitrary smooth function (probably gonna use a gaussian) $$f(x,y,0)=g(x,y)$$
And $f$ vanishes at infinity.
I have very little experience in numerical methods for PDEs. I am interested in learning a simple (as simple as possible without being hopelessly inaccurate!) algorithm on how to deal with such a problem. I imagine I will be discretizing both time and the spacial variables and then replacing the derivatives with their approximations.
The Lax-Wendorff method (http://en.wikipedia.org/wiki/Lax%E2%80%93Wendroff_method) has been suggested to me, but I can't find any entry-level materials on this, and don't even see how to apply it here (i.e. how to transform what I have into the general form).
From what I've managed to find out, I will need to form some sort of grid for time and position. But first I would probably want to introduce dimensionless variables to replace $x,y$. Then, I will need to choose an appropriate step in the space variables and time (how do I know what to pick, so that my solution is stable?). And finally, I will be needing some sort of time step scheme, in the form
$$f^{t+1}_{i,j} = F(f^t_{i,j} \ ; \ f^t_{i+1,j} \ ; \ ... \ ; \ f^t_{i-1,j-1})$$
So that the value of the function at some node of the grid depends on its (and all 8 adjacent nodes') values in the previous time step.
In principle, this seems to be to be it, now I just need to find the appropriate discretization and scheme?

A: The simplest time-stepping method is a FTCS scheme (forward time, centred space).
I will denote $f(x_i,y_j,t_k)$ by $f_{i,j}^k$.
This method is explicit in time, and approximates the time derivative by
$$\left.\frac{\partial f}{\partial t}\right|_{x_i,y_j}^{t_k}=\frac{f_{i,j}^{k+1}-f_{i,j}^{k}}{\Delta t}.$$
The spatial derivatives are approximated by
$$\left.\frac{\partial f}{\partial x}\right|_{x_i,y_j}^{t_k}=\frac{f_{i+1,j}^{k}-f_{i-1,j}^{k}}{2\Delta x}$$
and
$$\left.\frac{\partial f}{\partial y}\right|_{x_i,y_j}^{t_k}=\frac{f_{i,j+1}^{k}-f_{i,j-1}^{k}}{2\Delta y}.$$
(Setting $\Delta x=\Delta y$ is probably going to be helpful)
And putting it together, you get
$$\frac{f_{i,j}^{k+1}-f_{i,j}^{k}}{\Delta t}=-Ay_j\frac{f_{i+1,j}^{k}-f_{i-1,j}^{k}}{2\Delta x}+Bx_i\frac{f_{i,j+1}^{k}-f_{i,j-1}^{k}}{2\Delta y},$$
which gives this time-stepping scheme
$$f_{i,j}^{k+1}=f_{i,j}^{k}-\frac{Ay_j\Delta t}{2\Delta x}\left(f_{i+1,j}^{k}-f_{i-1,j}^{k}\right)+\frac{Bx_i\Delta t}{2\Delta y}\left(f_{i,j+1}^{k}-f_{i,j-1}^{k}\right).$$
So you can calculate $f^{k+1}_{i,j}$ using 5 grid points from the $k$-th time step. You need boundary conditions to work out the boundary values of $f$, and initial conditions for $f^0_{i,j}$, and then at each time step just apply the scheme to each interior point.
Stability is tricky in 2D. Basically, keep your spatial steps small, and your time step s smaller, and you should be alright, but because you have $yf_x$ and $xf_y$ terms you will have more problems with stability when $x$ and $y$ are large, so bear that in mind.
I hope this helps, and it should help you implement other schemes of you need higher order convergence.


text:
Q: How can I prevent short figures with placement option p from being pushed to the end of the document? In the MWE below, the 3.65" x 2" figure is placed roughly in the middle of the document.  However when the caption is shortened by commenting out \lipsum[1][1-2] and commenting in \lipsum[1][1], the figure is pushed to the end of the document.  Why is this and how can the latter behavior be prevented?
\documentclass[550paper]{kdp}

\usepackage{lipsum}
\usepackage{graphicx}

\begin{document}

\lipsum[1-3]

\begin{figure}[!p]
\includegraphics{TestFig.pdf}
\caption{
\lipsum[1][1-2]
%\lipsum[1][1]
}
\end{figure}

\lipsum[1-3]

\end{document}

A: The p alternative means "push the float to a separate page, if needed", and an overlarge float will push all that follow to the end. LaTeX tries not to have too much of the page dedicated to floats.

*

*Reduce/split the large floats so they fit the page.

*Reorder text/floats, to get the float to fit into the page. Perhaps rewrite the surrounding text to make it fit, shorten long captions.

*You should reference them by number, not "the next figure", you can include them early in the source if it helps placing.

*Consider not using p, there are even (somewhat dirty) ways to force a float to be placed here.

A: Try this one, please.
\documentclass[a4paper,14pt]{extreport}

\usepackage{lipsum}
\usepackage{graphicx}

\begin{document}

\lipsum[1-3]

\begin{figure}[h!]
\includegraphics{example-image-a.pdf}
\caption{
\lipsum[1][1-2]
%\lipsum[1][1]
}
\end{figure}

\lipsum[1-3]

\end{document}


text:
Q: How do I automate share file functionality using XCUItest My application has ability to preview file which is shared by other application. I want to automate the share file testing using UI testing provided by Xcode.
How do I automate share file functionality using XC UI test in Xcode?


text:
Q: Unable to add RelativeLayout programmatically I am unable to add a RelativeLayout programmatically to existing xml layout. only xml layout is displaying. Sharing my code
fragment_home.xml:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.timetable.act.MainActivity$PlaceholderFragment"
android:id="@+id/homeLayout"
android:background="@color/white">

<ImageButton
    android:layout_width="70dp"
    android:layout_height="70dp"
    android:layout_marginTop="380dp"
    android:layout_marginLeft="240dp"
    android:background="@drawable/circle"
    android:id="@+id/addEvent"
    android:src="@drawable/ic_mode_edit_white_24dp"
    android:layout_gravity="right|bottom"
    android:contentDescription="@string/hello" />
</RelativeLayout>

PlaceholderFragment.java
@Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View rootView = null;

        switch (Integer.valueOf(getArguments().get(ARG_SECTION_NUMBER).toString())) {
        case 1:
            rootView = inflater.inflate(R.layout.fragment_home, container, false);
            displyAllEvent(rootView);

            break;
        case 2:
            rootView = inflater.inflate(R.layout.fragment_setting, container, false);
            break;
        default:
            rootView = inflater.inflate(R.layout.fragment_main, container, false);
            break;
        }
        return rootView;
    }
private void displyAllEvent(View mainView){
        Drawable drawableShadow = ContextCompat.getDrawable(getActivity(),R.drawable.tile_shadow);

        RelativeLayout tileLayout = new RelativeLayout(getActivity());
        RelativeLayout.LayoutParams rlp = new RelativeLayout.LayoutParams(
                RelativeLayout.LayoutParams.MATCH_PARENT,
                RelativeLayout.LayoutParams.WRAP_CONTENT);

        tileLayout.setBackground(drawableShadow);
        tileLayout.setPadding(R.dimen.tilePadding,R.dimen.tilePadding,R.dimen.tilePadding,R.dimen.tilePadding);
        tileLayout.setLayoutParams(rlp);
        tileLayout.setId(999);

        RelativeLayout.LayoutParams titleLayout = new RelativeLayout.LayoutParams(
                RelativeLayout.LayoutParams.MATCH_PARENT,
                RelativeLayout.LayoutParams.WRAP_CONTENT);

        TextView titleView = new TextView(getActivity());
        titleView.setText("Testing title with test");
        titleView.setId(111);
        titleView.setTextColor(R.color.white);
        titleView.setLayoutParams(titleLayout);

        tileLayout.addView(titleView);

        RelativeLayout.LayoutParams textLeftLayout = new RelativeLayout.LayoutParams(
                RelativeLayout.LayoutParams.WRAP_CONTENT,
                RelativeLayout.LayoutParams.WRAP_CONTENT);
        textLeftLayout.addRule(RelativeLayout.BELOW, titleView.getId());

        TextView startHView = new TextView(getActivity());
        startHView.setText("left Text");
        startHView.setId(222);
        startHView.setTextColor(R.color.white);
        startHView.setLayoutParams(textLeftLayout);

        tileLayout.addView(startHView);

        RelativeLayout.LayoutParams textRightLayout = new RelativeLayout.LayoutParams(
                RelativeLayout.LayoutParams.WRAP_CONTENT,
                RelativeLayout.LayoutParams.WRAP_CONTENT);
        textRightLayout.addRule(RelativeLayout.BELOW, titleView.getId());
        textRightLayout.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
        textLeftLayout.addRule(RelativeLayout.ALIGN_RIGHT, startHView.getId());

        TextView startMView = new TextView(getActivity());
        startMView.setText("Right Text");
        startMView.setId(333);
        startMView.setTextColor(R.color.white);
        startMView.setLayoutParams(textRightLayout);

        tileLayout.addView(startMView);

        RelativeLayout parentView = (RelativeLayout)mainView.findViewById(R.id.homeLayout);
        parentView.addView(tileLayout);
    }

output:

A: Instead of creating a relative layout during runtime, you could simply make a pre-existing one, with all its children, visible... E.g:
if (myCondition) {
    myLayout = (RelativeLayout) myContext.findViewById(R.id.myLayoutID);
    myLayout.setVisibilty(View.visible);
    myLayoutTextView = (TextView) myContext.findViewById(R.id.myTextView);
    myLayoutTextView.setVisibility(View.VISIBLE);
}

In case you also have a button in the layout that you want to become click-able when the layout is active, you can do:
Button myButton = (Button) findViewById(R.id.myButton);
myButton.setOnClickListener(new OnClickListener() {

    @Override
    public void onClick(View v) {
        if (myCondition) {
            //Do Stuff Here
        }
});


text:
Q: Java - using Point class to return values of locations in a 2D array I am writing a program where I have a 2D array of objects from a cell class, and I need to write a method where I pass a cell object as a parameter and I return an arraylist of cells that surround the cell(N, S, E, W).  Each cell is given a location from the Point class.  What I am having trouble with is how to use the locations that I know(x, y-1 is north) to produce a cell.  Any help on this is appreciated.  Thank you.

A: If (x,y) is your cell then the four surrounding cells to it is
(x+1, y)
(x-1, y)
(x, y+1)
(x, y-1)

and you might make assumptions that
+x axis is EAST
-x axis is WEST
+y axis is NORTH
-y axis is SOUTH

so
(x+1, y) is EAST to the cell,
(x-1, y) is WEST to the cell,
(x, y+1) is NORTH to the cell and
(x, y-1) is SOUTH

to the cell you pass as paremeter to your method.


text:
Q: How to write a DOS script to extract all the file name in a directory? I want to extract all the names and path of the file in a directory and its sub-directory into a text file. How can I do it by DOS scripting?
Thanks in advance.

A: dir * > t.txt

Or some other parameter to get your desired result.

A: you can do it with the dir command in in the windows-console
 dir /B /S /O > mylist.txt

A: Using dos batch programming you could use:
dir /B [fullpathtodirectory] > output.txt

to extract the list of the files in the specified direcotry.
With WSH (Windows Scripting Host) you can use the more powerfull FSO (File System Object):
Set oFSO = CreateObject("Scripting.FileSystemObject")
oStartFolder = "[full path to initial folder]"

Set oFolder = oFSO.GetFolder(oStartFolder)

Set Files = oFolder.Files
For Each oFile in Files
    'do stuff here
Next


text:
Q: How to send datadog the content of a JavaScript event through RUM I am only starting on DataDog, and what I want to accomplish is adding a few data to the events that DD_RUM collects. More specifically, I would like to sent to datadog the entire event object of any user triggered action from a React application. I had a look on beforeSend (I wasn't able to add the event to the payload). And I am aware that there is an addAction api to send to DataDog custom actions, but I am looking for a solution that would work for any action.
My current DD configs on the react application:
  datadogRum.init({
    applicationId: 'my-app-id',
    clientToken: 'my-token',
    site: 'datadoghq.eu',
    service:'react-datadog-poc',
    env:'dev',
    version: '1.0.0',
    sessionSampleRate: 100,
    sessionReplaySampleRate: 100,
    trackUserInteractions: true,
    forwardErrorsToLogs: true,
    trackFrustrations: true,
    trackResources: true,
    trackLongTasks: true,
    defaultPrivacyLevel:'allow'
  });

  datadogLogs.init({
      clientToken: 'my-token',
      site: 'datadoghq.eu',
      forwardErrorsToLogs: true,
      forwardConsoleLogs: "all",
      forwardReports: "all",
        sessionSampleRate: 100
  });
  datadogRum.startSessionReplayRecording();


text:
Q: Need Samples for Mono Zeroconf I'm trying to make a simple concept demonstration app the code of which I may use in the future. Specifically I want to have an iPhone running an app that sends XML data to a Bonjour service. I already have an Objective-C app that runs on mac and does this, but I need to make one on Windows with a strong preference for Mono Zeroconf because the project may involve the use of the Mono framework later on.
To this end I need a working sample of using the Mono Zeroconf library. The examples I could find on the website are not sufficient. ALl that they allow me to do is to register a service, but nothing after that. Specifically I have this:
RegisterService service = new RegisterService();
service.Name = "AirControlServer";
service.RegType = "_http.tcp.";
service.ReplyDomain = "local.";
service.Port = 3689;
service.Register();

And now I have absolutely no clue what to do. If someone could link me to some sample code or something, that would be really nice.
Thank you.

A: The Zeroconf is only used for announcing or discovering. That is, if you have some kind of service (for example, http server), you can use Mono.Zeroconf to announce it. The provided service is beyond the scope of the library, you have to provide it as usual. In other words, you can use the library to either answer questions like "What is the IP address of my service provider?" or announce such services ("Tell them that X.X.X.X has a service on port YY).
For the announcing part, you've already found the example, you can also look at this question. For the discovering, look here (at the "Listen for and resolve services" part).

A: In the Mono.Zeroconf source code, there is a sub-directory MZClient which contains good example code ZeroconfClient.cs for both publishing and browsing.


text:
Q: In Kubernetes, how can I detect that my pod is ready? I have a Kubernetes pod using a readiness probe, and tied with the service this ensures that I don't receive traffic until I'm ready.
I'm using Spring Actuator as the health endpoint for this readiness probe.
But i'd like to trigger some actions whenever the pod is deemed ready by the kubelet.
What would be the simplest way to do this?

A: Perhaps implement your own HealthCheck. When you find that everything is ok for the first time, run your code.
I use a static variable firstHealthCheckOK is checked. Your logic should run only once.
I am assuming you are running Spring-boot 2.x and are calling a readiness probe on http://localhost:8080/actuator/health
The health() method below is called when Kubernetes calls http://localhost:8080/actuator/health
import org.springframework.boot.actuate.health.Health;
import org.springframework.boot.actuate.health.HealthIndicator;
import org.springframework.stereotype.Component;

@Component
public class HealthCheck implements HealthIndicator {

    static boolean firstHealthCheckOK = false;

    @Override
    public Health health() {
        int errorCode = check(); // perform health check
        if (errorCode != 0) {
            return Health.down()
              .withDetail("Error Code", errorCode).build();
        }
        if (firstHealthCheckOK == false){
            firstHealthCheckOK = true;
            doStartUpLogic();
        }
        return Health.up().build();
    }

    private int check() {
        //some logic
        return 0;
    }

    private void doStartUpLogic() {
        //some startup logic
    }
}

A: You can use a post-install hook provided by helm charts (in case you are using helm to deploy your application). This will perform necessary actions/script/jobs after the pod becomes up and running.

A: As part of the pod lifecycle events, you may want to attach additional handlers such as podStart and build your custom logic to manipulate the event happening as need be.
Alternatively, you can also run your code to read REST response from
GET /api/v1/namespaces/{namespace}/pods/{name}/log
build any downstream logic to get pod status
Note, in controlled environments, it's good to not base any of your conditional logic on pods (individual pods) rather rely on deployments. The REST endpoint which you should rather focus on is
GET /apis/apps/v1beta2/namespaces/{namespace}/deployments/{name}/status


text:
Q: name not resolve in vmware client PC I have configured DNS server and DHCP sever on centos 6.2 vmware virtual machine. I have a windows xp vmware client machine.
nslookup command is work in server terminal But it won't work in windows xp machine
I checked my DHCP server assign correct ip address to my xp client is there additional configurations to make nslookup work in client side?
My server ip is 192.168.0.10
This is how client get ip drom my DHCP server
 Ethernet adapter Local Area Connection:

    Connection-specific DNS Suffix  . :
    Description . . . . . . . . . . . : VMware Accelerated AMD PCNet Adapt

    Physical Address. . . . . . . . . : 00-0C-29-41-6E-9D
    Dhcp Enabled. . . . . . . . . . . : Yes
    Autoconfiguration Enabled . . . . : Yes
    IP Address. . . . . . . . . . . . : 192.168.0.128
    Subnet Mask . . . . . . . . . . . : 255.255.255.0
    Default Gateway . . . . . . . . . :
    DHCP Server . . . . . . . . . . . : 192.168.0.10
    DNS Servers . . . . . . . . . . . : 192.168.0.10
    Lease Obtained. . . . . . . . . . : Monday, June 03, 2013 3:51:34 PM
    Lease Expires . . . . . . . . . . : Tuesday, June 04, 2013 3:51:34 AM

This is the output of client nslookup
DNS request timed out.
timeout was 2 seconds.
*** Can't find server name for address 192.168.0.10: Timed out
*** Default servers are not available
Server:  UnKnown
Address:  192.168.0.10

DNS request timed out.
timeout was 2 seconds.
DNS request timed out.
timeout was 2 seconds.
*** Request to UnKnown timed-out


text:
Q: Python - Solve for unknown value so that column minimum is equal to certain number I have a dataframe, where column B is an equation of value in column A and an unknown value x, eg. B= A^x. I would like to solve x, so that the minimum of column B is equal to certain number, say 0.001. It's easy to solve in Excel, but wondering how to solve this in python?? Thanks!
My thoughts are like below, but it doesnt work...
import sympy as sym

for i, row in df.iterrows():
    x = sym.symbols('x')
    row['B'] = row['A']**x
    f = sym.Eq(row['B'].min(), 0.001)
    sym.solve(f,x)


text:
Q: How to compile C code (or a 32-bit dll file) into 64-bit dll file? I want to compile my C code into 64-bit dll file. I used this command in cmd:
gcc main.c --shared -o main.dll

and it compiles my code into a 32-bit dll file. How should I compile it into 64-bit one? (or even is it possible to convert the 32-bit dll file into the 64-bit one?)
Note that I'm using windows 10 x64.

A: If you use MS C compiler, it does not have 64bit compiler.
GCC has both 32bit and 64bit compiler. So you can use 64bit compiler to run your program 64bit.
By the way, you can give a try to Clang compiler. It has also 64bit operations.
To install GCC and Clang your can use MinGW-w64.


text:
Q: HERE Android SDK Turn by turn instruction I am using HERE Android SDK to perform turn by turn navigation project. But I do not get the result similar to image.

I hava this code to get the current manauver
private NavigationManager.NewInstructionEventListener newInstructionEventListener = new NavigationManager.NewInstructionEventListener() {
    @Override
    public void onNewInstructionEvent() {
        Maneuver maneuver = navigationManager.getNextManeuver();

        if (maneuver != null) {
            if (maneuver.getAction() == Maneuver.Action.END) {

            }

            tvManeuver.setText(navigationManager.getNextManeuver().getTurn().name() + " " + maneuver.getIcon().value());
            ivTitle.setImageBitmap(maneuver.getNextRoadImage().getBitmap());
            tvStreet.setText(maneuver.getRoadName());
            tvMeters.setText("durante " + maneuver.getDistanceFromPreviousManeuver() + " m");

            if (maneuver.getDistanceToNextManeuver() == 0) {
                tvMeters.setVisibility(View.GONE);
            } else {
                tvMeters.setVisibility(View.VISIBLE);
            }
        }
    }
};

But I do not get the correct text of the maneuver. For example "Turn right at the next corner" and the and the corresponding arrow icon to put inside IMAGEVIEW.
can anybody help me?
Regards.

A: I assume the image you provided is from HERE Maps available on Google Store which is a custom implementation using the HERE SDK.
The instruction you can get from Maneuver  , check documentation
https://developer.here.com/mobile-sdks/documentation/android-hybrid-plus/topics_api_nlp_hybrid_plus/com-here-android-mpa-routing-maneuver.html#topic-apiref__getinstruction-void
Icon should also be retrieved from getIcon() , which gives an enumeration and you will need to create images for possible enumerations in the icon , check documentation
https://developer.here.com/mobile-sdks/documentation/android-hybrid-plus/topics_api_nlp_hybrid_plus/com-here-android-mpa-routing-maneuver-icon.html#topic-apiref

A: If you want to get the list of maneuvers, you can't get it on the NewInstructionEvent.
Since you are already in navigation you should already have your route object. On the route object you can just call getManeuvers(). That will give you all the list of maneuvers for the current route.
You can also refer to their UI Kit https://developer.here.com/blog/build-beautiful-interfaces-with-the-here-mobile-sdk-ui-kit-for-android-and-ios.
Hope this helps. I know this is an older thread.

A: HERE SDK Premium does not provide Maneuver Instructions pre- start of Navigation nor can you get a list of Maneuver Instructions at any point.
You however could get a list of Maneuver Instructions using the HERE Routing API.
https://developer.here.com/documentation/routing-api/dev_guide/topics/use-cases/actions.html
One more way is to get Instructions through the AudioPlayerDelegate.PlayText callback.


text:
Q: Handling authentication in a multi-tier architecture I'm writing an API, that will be used by a webapplication and native iPhone and Android apps.
The users will create accounts, login, logout etc, either through the webapplication or native apps. But all the business logic is in the API. Thus, the webapplication and the native apps are mostly thin layers containing only UI to integrate with the api.
Question:
What are some general ways/technologies used to authenticate users against the API, when you have this outer layer of either a webapplication or a native app.
Related questions
Authenticating users in iPhone app

A: Disclosure: I work at Auth0.
Tokens! Tokens! Tokens!
The most widespread approach to authenticate users in a Web API is through the use of token-based authentication. The procedure can be reduced to these steps:

*

*The client application includes a token in the request (Authorization header).

*The Web API validates the token and, if valid, processes the request in accordance to the information associated with the token.

This type of token is usually referred as a bearer token, because the only thing that an application has to to get access to an API protected resource is provide the token. The use of HTTPS with this type of authentication is vital in order to ensure that the token cannot be easily captured by an attacker when traveling from client to server.
The token can be classified further either as:

*

*by-value token - associated information is contained in the token itself

*by-reference token - associated information is kept on server-side storage that is then found using the token value as the key

A popular format used for by-value token is the JWT format (Get Started with JSON Web Tokens) given it's encoded in a Web friendly way and also has a fairly concise representation in order to reduce overhead on the wire.
Choosing between by-value or by-reference token is a matter of considering the pros and cons of each approach and review any specific requirements you may have. If you go with JWT, check jwt.io for reference on libraries supporting this format across a wide range of technologies.
How does my application get the tokens in the first place?
Setting up your API to authenticate users with tokens can be seen as the easiest part, although the need to think about all the usual security precautions still applies.
The biggest issue with token-based authentication system, is putting in place a system that can issue tokens to your different client applications that may use different technologies or be in completely different platforms.
The answer to this, as mentioned on another answers, is to rely on OAuth 2.0 and the OpenID Connect protocols and do one of the following:

*

*Implement an identity provider/authorization server system compliant with the mentioned protocols
   ⤷ time consuming and complex, but you're following standards so you're less likely to mess up and you'll also gain interoperability

*Delegate the authentication to a third-party authentication provider like Auth0
   ⤷ easy to get started, depending on amount of usage (the free plan on Auth0 goes up to 7000 users) it will cost you money instead of time

A: You should check out

*

*OpenID

*OAuth

and have an Identity Server set up.
Depends on what technology you are using, IdentityServer is widely available
one is IdentityServer4 on a .net platform
Please do not hesitate to ask more! :D

A: I agree with @Fabian Bettag and @WickStargazer.
You can use OAuth 2.0 which works very well with web-app, mobile client and java-script client. Also you can use OpenID Connect to verify the identity of the End-User based on the authentication performed by an Authorization Server, as well as to obtain basic profile information about the End-User in an inter-operable and REST-like manner.
OpenID Connect 1.0 is a simple identity layer on top of the OAuth 2.0 protocol.
Note :- You can also implement SOAP for login,registration and logout(Security sensitive APIs) to add more security to your app.
Hope this will help and let me know for any help. Happy coding!!!


text:
Q: Visual Studio studio custom template: Some usings are automatically parameters (they automatically change when imported) The MSDN on templates and template parameters is completely f****ng useless.. I can't even follow the instructions because it implies I have access to files that don't exist yet (like .vstemplate), and god forbid it provides some directories for this stuff.
Anyway I tried to make do and I thought I figured it out.. But apparently not:
I made a class file to export to a template that looks like this:
using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using NovaTech.Framework;
using NovaTech.Utilities;

namespace $rootnamespace$
{
    public class $safeitemname$ : BaseComponent
    {
        public $safeitemname$() : base()
        {

        }
    }
}

But when i export it to a template and reimport it, it looks like this:
using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using **NovaTech.NED.AssetComponents**.Framework;
using **NovaTech.NED.AssetComponents**.Utilities;

namespace NovaTech.NED.AssetComponents
{
    public class NEDComponent1 : BaseComponent
    {
        public NEDComponent1() : base()
        {

        }
    }
}

(EDIT: Those parts surrounded in ** ** were supposed to be bolded..)
EDIT: (fixed one of the problems I had, only 1 left):
Notice the two usings there changing despite them not being marked as parameters in the template. The two usings are not supposed to be parameters, yet for some reason it treats them like they are. How can I stop this from happening?

A: Managed to find a solution. I figured out that it replaces my usings with parameters (why, I still don't know) during EXPORTING, not importing. So I just exported the template, replaced the .cs file with a CORRECT one, and when I reimported it everything was as it should be.


text:
Q: How to Get Youtube Video URL Programmatically In Youtube Playlist, I have many Videos, now I would like to share Videos with others (using Video URL - which is playing right now)
I am using below code to play YouTube Playlist in an Android application:
public static final String PlayList_ID = "PLP7qPet500dfglA7FFTxBmB_snxCaMHDJ";

 @Override
 public void onInitializationSuccess(Provider provider, YouTubePlayer player,
   boolean wasRestored) {

  youTubePlayer = player;

  Toast.makeText(getApplicationContext(),
    "YouTubePlayer.onInitializationSuccess()",
    Toast.LENGTH_LONG).show();

  youTubePlayer.setPlayerStateChangeListener(myPlayerStateChangeListener);
  youTubePlayer.setPlaybackEventListener(myPlaybackEventListener);

  if (!wasRestored) {
   player.cuePlaylist(PlayList_ID);
  }

 }

A: Inside onLoaded() you can get id from that id you can create url.
You can you this way.
@Override
public void onInitializationSuccess(YouTubePlayer.Provider provider, YouTubePlayer player,
        boolean wasRestored) {

    player.setPlayerStateChangeListener(new PlayerStateChangeListener() {

        @Override
        public void onVideoStarted() {
        }

        @Override
        public void onVideoEnded() {
        }

        @Override
        public void onLoading() {
        }

        @Override
        public void onLoaded(String mVideoId) {
            String url = "http://www.youtube.com/watch?v=" + mVideoId
        }

        @Override
        public void onError(ErrorReason reason) {
        }

        @Override
        public void onAdStarted() {
        }
    });
}


text:
Q: Display math formulas with iosMath using swift 3 I am very new to app development, especially in iOS using Swift 3. For now, I want to display math formulas with swift using "iosMath".
I followed the steps from this "Using iosMath in Swift"
but I do not know what he means by creating a bridging header and don't know how to use iosMath in my code. For example, I want to enter a number and in the next line, the program shows the square root of the entered number. Here's an example of what I want to do:
import UIKit
import iosMath

class ViewController: UIViewController {

    @IBOutlet weak var numberField: UITextField!
    @IBOutlet weak var resultLabel: UILabel!

    @IBAction func computeTapped(_ sender: Any) {
        guard let numberValue = numberField.text else {
            return
        }

        let result = numberValue

        resultLabel.text = "The Square root of \(result) is \(result)"
        resultLabel.isHidden = false
    }
}

Hope you can help me :)
Thanks in advance!

A: If you already can import iosMath go to step2
Okay, to import iosMath you need to create a bridging header(however, my project imports iosMath without it, don't know why.) To create it just create a new objective-c file in your Project manilla folder , when you create it, bridging header will be added automatically, now you can delete obj-c file, but not the bridging header, then build project and import iosMath module.
Step 2
Basically, iosMath is used to draw(display) mathematical equations like this:
To create it:
let yourLabel: MTMathUILabel = MTMathUILabel()
yourLabel.latex = "x = \\frac{-b \\pm \\sqrt{b^2-4ac}}{2a}"
yourLabel.sizeToFit()

A program that you want will be like
 guard let numberValue = Int(numberField.text) else {
    return
 }
let result = numberValue
resultLabel.text = "The Square root of \(result) is \(result*result)"

And..
Bridging header is used to allow to access different classes by both languages(obj-c,swift).
If you accidentally delete the bridging header, go to build settings in your project, search 'bridging...' , select this line and press backspace, after that repeat the steps to create bridging header.


text:
Q: My Pokemon Go maps won't load I downloaded Pokemon Go 10 days ago and I caught my starter pokemon. After that the application gave me the following error message:"GPS signal not found" and the map won't load, so I just stand in a blue screen.
Some of my friends have the "GPS signal not found" error message too and suggested I download GPS enhancing apps. At first the GPS enhancing apps didn't work, but after I deleted and reinstalled my Pokemon Go app it works normally. Now Pokemon Go still showing "GPS signal not found" with a blue screen instead of a map of the area I am in.
I've tried downloading the offline maps, but that just didn't work.

A: Do not download any other application that involves GPS. For playing pokemon Go, you only need to download that app. Some third-party apps makes your Pokemon Go malfunction. I suggest reinstall to have a clean app after the GPS enhacing apps.
Also, the google maps offline option is not proved to work.

A: I had the same issue and found a workaround. Start the game with GPS location turned off. When the game loads and you find yourself standing in a blank lake, turn the GPS back on. This is working for me! Yay!

A: I just had this problem and fixed it. The problem was that I had accidentally turned GPS off on my phone. Reactivating fixed the problem completely.


text:
Q: Saving pdf with Date and name I have a file called quotes.tex. When I run it, it creates my quote for that date for a certain customer.
I now want to save this quote.pdf automatically as date_customer_quote. How can I do that?
\documentclass[a4paper,12p]{article}

%%% select the required data %%%%
\newcommand{\shop} {George's}
\newcommand{\product}{Green Apples}

%%%%%%% DON'T ALTER FROM HERE ONWARDS (except spacing)%%%%

\usepackage{graphicx}       %% allow graphics

\usepackage{xcolor}                   %% allow colour
\definecolor{teal}{RGB}{76,177,155}
\definecolor{light-gray}{gray}{0.4}

\usepackage[textwidth=450pt, textheight=680pt,top=3cm, left=2.5cm]{geometry} %margins

\usepackage{datetime} % dates - my altered dates below
\newdateformat{monthyeardate}{%
  \monthname[\THEMONTH] \THEYEAR} %just month written and Year

\newdateformat{normal}{%
  \longdate \ordinaldate{\THEDAY} \monthname[\THEMONTH] \THEYEAR} %normal date

\newcommand\twodigits[1] {\ifnum#1<10 0#1\else #1\fi}
\newdateformat{quoteNo}{%
   \THEYEAR--\twodigits{\THEMONTH}--\twodigits{\THEDAY} } % digit date for quote no.

\usepackage{advdate} % quote expiry

\usepackage[none]{hyphenat} % don't hyphenate

\begin{document}
\setlength{\parindent}{0pt} % never indent first line

 \normal \today \\
\vspace{-0.5cm}
\begin{center}
\scshape{Chris' \product \, Box \par}
\vspace{0.2cm}
    {\Large{Quote for \shop} \par}
\vspace{0.1cm}
{\large Quote No: \quoteNo \today --1 \par}
\vspace{0.2cm}
%image
\end{center}
\vfill
g

\newpage

{\hrulefill
\bigbreak

\begin{center}
\textbf{\huge{\color{light-gray} Price:  \qquad  \$\, 8,345 \quad plus GST}}
\end{center}

\bigbreak
\hrulefill}

\color{teal} {%
\subsubsection*{Options Included In Price:}
a

}
\color{black}
\vspace{0.4cm} % adjust spacing here
\hrulefill

\subsubsection*{Quoted price also includes:}

 \begin{itemize}
\item 1 year warranty
\end{itemize}

\vspace{-0.4cm} % adjust spacing here
\hrulefill %remove if necessary

\color{light-gray}{%
\subsubsection*{\underline{OPTIONAL ITEMS AVAILABLE}}
\vspace{0.4cm} % adjust spacing here
}

\textbf{Quotation expiry:}\normal{\AdvanceDate[28] \today}

\bigbreak
\hrulefill
\bigbreak

If you wish to place an order, would like additional options included in the quote or require any further details please contact me.\\

Kind regards,\\
 \bigbreak
\color{teal}{
Chris}

\end{document}

In my example, I would like to save as 200420_George_quote.pdf. Can that be done? How? (And please, if you try to explain something with write18, please explain the full code as I tried and failed)


text:
Q: LIFERAY 6.2 - Send a Web Content to another Portlet at another Page I'm using Liferay 6.2 and I'm having a hard time to show a web content of "portlet-journal-content-search", at another portlet "portlet-asset-publisher", that stays in another page.
My bigger difficult is the fact that I need after make my search of a web content, that the system shows all the results with a Link for their "display page", and to the portlet "portlet-asset-publisher". Each result must have a link being generated dynamically, because each result will have a different "display page".
I tryied to find in the code where the information about "display page" of the web content is, but I didn't found it.
I thought I would use the Liferay tag "renderURL" to do this, but I do not know how I'm going to send my content and how I could get the "display page" dynamically!
Today When I click at the link to be redirected to my content I go to the same page and to the portlet ".portlet-journal-content".
The code is like:

<%
PortletURL webContentPortletURL = PortletURLFactoryUtil.create(request,             targetPortletId, plid, PortletRequest.RENDER_PHASE);

webContentPortletURL.setParameter("struts_action", "/journal_content/view");
      webContentPortletURL.setParameter("groupId",

String.valueOf(articleGroupId));
      webContentPortletURL.setParameter("articleId", articleId);
%>

<a href="<%= webContentPortletURL.toString() %>"><%= StringUtil.shorten(webContentPortletURL.toString(), 100) %>

But I need to be redirected to the "Display Page" of my content ("TestandoPagina" name of the page of ScreenShot), and It must be showed at the portlet ".portlet-asset-publisher".
The code that I was trying to do, but It's not working, is:

<portlet:defineObjects />
<liferay-theme:defineObjects />
<%
String portletId = PortletKeys.ASSET_PUBLISHER;
long otherPlid = PortalUtil.getPlidFromPortletId(themeDisplay.getScopeGroupId(), portletId);
 %>

<liferay-portlet:renderURL var="testURL" plid="<%=otherPlid%>" portletName="<%=portletId%>">
<liferay-portlet:param name="groupId" value="<%= String.valueOf(articleGroupId) %>" />
<liferay-portlet:param name="articleId" value="<%= articleId %>" />
</liferay-portlet:renderURL>

<a href="<%= testURL %>"><%= StringUtil.shorten(testURL.toString(), 100) %>

Can someone helps me with it?
Thank you very much.
Here's some screenshots of How It's working now:
A Web Content example with his "Display Page" called "TestandoPagina"
Then I search for the web content at ".portlet-journal-content-search".
The result of my research with the "wrong" Links
What happens when I clickat this Link today, I stay at the same page "Processos" and my content is showed at ".portlet-journal-content", and I want to go to his "display page", at this example called "TestandoPagina" and the content be showed at the ".portlet-asset-publisher".

A: I made It !
The main point to do this was:
1st - Knows that the "layoutUuid" is the Id of the "Display Page" of a web content, so I could possible get informations like PLID, all the PortletIds that belongs to that page, etc.
2nd - Getting informations of the "Document" I could create a "AssetEntry".
This is how I get the informations of the "Display Page" :

<%
 ResultRow row = (ResultRow) request.getAttribute(WebKeys.SEARCH_CONTAINER_RESULT_ROW);
 Object[] objArray = (Object[])row.getObject();
 Document doc = (Document)objArray[1];

 String layoutUuid = doc.get("layoutUuid");

 Layout specificLayout = LayoutLocalServiceUtil.getLayoutByUuidAndCompanyId( layoutUuid, PortalUtil.getDefaultCompanyId() );

specificPlid = specificLayout.getPlid();
articleLayoutTypePortlet = (LayoutTypePortlet) specificLayout.getLayoutType();

List<Portlet> allPortlets = articleLayoutTypePortlet.getAllPortlets();
for (Portlet portlet : allPortlets){
         if ( PortletKeys.ASSET_PUBLISHER.equals( portlet .getRootPortletId() ) ) {
                portletId = PortletKeys.ASSET_PUBLISHER + PortletConstants.INSTANCE_SEPARATOR + portlet .getInstanceId();
                break;
         }
}
%>

After that, I create the AssetEntry to get the "assetEntryId" and then finally create the dinnamic link:

<%
 String className = doc.get("entryClassName");
 Long classPk = Long.parseLong( doc.get("entryClassPK") );

 AssetEntry assetEntry = AssetEntryLocalServiceUtil.getEntry(className, classPk);
 Long assetEntryId = assetEntry.getEntryId();

 webContentPortletURL = PortletURLFactoryUtil.create(request, portletId, specificPlid, PortletRequest.RENDER_PHASE);
 webContentPortletURL.setParameter( "struts_action", "/asset_publisher/view_content" );
webContentPortletURL.setParameter( "groupId", String.valueOf(articleGroupId) );
webContentPortletURL.setParameter( "type", "content" );
webContentPortletURL.setParameter( "assetEntryId", String.valueOf(assetEntryId) );
webContentPortletURL.setParameter( "articleId", articleId );
 %>

All the my changes I did at "journal_content_search/article_content.jsp"
I hope this helps many people!


text:
Q: Turn Regular Expression into Javascript input mask Ultimately I want a mask that only allows an integer to be entered, or if a decimal/period is entered: allow 0 - 2 digits after the decimal point.
Valid Input
1
1.
1.1
1.11
111111111
111111111.
111111111.1
111111111.11

Invalid Input
a
a.
1.a
1.111
1.1111

*

*string allows any number of digit characters, but only allows 1 decimal/period

*

*if a period/decimal exists: only allow 2 digit characters after the decimal

This regular expression does just that:
^\d*\.?([\d]){0,2}$

Now I need to apply this as a mask to an input.  I am using Robin Herbots' Inputmask.  I am really struggling making this work.
I am aware that there is the alias currency, but that does not work exactly as desired.  What I want is for the input to default to blank on focus/unfocus unless there is input.  currency defaults to 0.00.  I also want to allow the user to delete everything from the field so it will be blank.  currency does not allow you to leave the input blank.  Instead it will only allow you to leave the field 0.00.
$('.moneyfield').inputmask("999", {rightAlign: true, numericInput: true});

The specific mask should go in the "999" spot.  I could not figure out how to use the built in masks, so that was why I attempted to plug a regular expression into the mask.  So far I have been unsuccessful with both strategies.
Another attempt was to use the currency alias and then just override it to what I want it to do.  I wasn't successful with that either.  Here is the definition of the currency mask:
    currency: {
        prefix: "$ ",
        groupSeparator: ",",
        alias: "numeric",
        placeholder: "0",
        autoGroup: !0,
        digits: 2,
        digitsOptional: !1,
        clearMaskOnLostFocus: !1
    }

A: I figured it out.  You just need to override a couple fields within the currency alias:
$('.money_field').inputmask({alias: 'currency', rightAlign: true, placeholder: "", prefix: '', autoGroup: false, digitsOptional: true});


text:
Q: Shift pinescript series by one Suppose I have a pinescript series current that looks like this;
current = [1 0 0 1 0 0 1 0 0 1]

I want to shift this series backward by 1. The shifted variable will look like this;
shifted = [1 0 0 1 0 0 1 0 0 1 0]
The last sample of shifted will always be 0.
I am using pinescript v5

A: It depends on what you want to do with it next. If you just output a plot like this
plot(barstate.islast ? 0 : current, offset = -1)


text:
Q: Business rules as REST API or module I m building an application that contains :

*

*A front end angularjs

*A backend express application

The fact is that both are using the same business rules for validation, one time in front end, and the other, on the back part to maintain a good navigability (locking in front) and good business management (locking in back).
This way, I was wondering about a way to manage my business rules for both sides in one place.
This way, I've found two solutions :
- Create a npm module
PROS : This could work with versionning, accessible from both client and back side due to the javascript technology
CONST : Only available for javascript, and if I need, in the future, to add a new technology, I would have to make it for the technology concerned. There's also the fact that I have to make a remote request, and use the network. Exactly what I don't want to do with my client
- Create a REST API exposing only my business rules
PROS : accessible from both client and back side, from any technology
CONST : network latency, and need to manage another service from my client side
I was wondering what could be a good solution and why ?


text:
Q: Ho do i add animation to a widget in a stateful widget in flutter? I have a stateful widget where i have a button that controls the visibility of a container, when this button is tapped, the container is shown, and when tapped again, the container is hidden.
How do i add animation so when the container is being hidden and visible it appear like a dropdown menu?
For clarification i will add both picture and code
Image:

Above image, when you tap the drop down button again, the content details is hidden.
Code :
Padding(
                    padding: const EdgeInsets.only(
                        left: 22.0, right: 22.0, top: 15.0, bottom: 5.0),
                    child: Row(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      children: [
                        Text(
                          'Job details ',
                          style: GoogleFonts.poppins(
                              fontSize: 16,
                              fontWeight: FontWeight.w600,
                              color: Color(0xff34495E)),
                        ),
                        controller.isDropDownVisible.isFalse
                            ? IconButton(
                                onPressed: () {
                                  setState(() {
                                    controller.toggleDropDownVisibility();
                                  });
                                },
                                icon: Icon(
                                  Icons.expand_more,
                                ),
                                color: Color(0xff3498DB),
                              )
                            : IconButton(
                                onPressed: () {
                                  setState(() {
                                    controller.toggleDropDownVisibility();
                                  });
                                },
                                icon: Icon(
                                  Icons.expand_less,
                                ),
                                color: Color(0xff3498DB),
                              )
                      ],
                    ),
                  ),
                  Divider(
                    color: Color(0xff34495E).withOpacity(0.1),
                    thickness: 2,
                  ),
                  controller.isDropDownVisible.isTrue
                      ? Container(
                          color: Color(0xffF5F5F5),
                          child: Padding(
                            padding:
                                const EdgeInsets.only(left: 22.0, right: 22),
                            child: Table(
                              border: TableBorder(
                                horizontalInside: BorderSide(
                                  strokeAlign: 10,
                                  color: Color(0xff34495E).withOpacity(0.1),
                                ),
                              ),
                              defaultColumnWidth: const IntrinsicColumnWidth(),
                              children: [
                                TableRow(
                                  children: [
                                    Padding(
                                      padding: EdgeInsets.all(8.0),
                                      child: Text(
                                        'Title',
                                        style: GoogleFonts.poppins(
                                            fontSize: 10,
                                            fontWeight: FontWeight.w400,
                                            fontStyle: FontStyle.italic,
                                            color: Color(0xff34495E)
                                                .withOpacity(0.8)),
                                      ),
                                    ),
                                    Padding(
                                      padding: EdgeInsets.all(8.0),
                                      child: Text(
                                        'Asoebi Gown',
                                        style: GoogleFonts.poppins(
                                            fontSize: 12,
                                            fontWeight: FontWeight.w400,
                                            color: Color(0xff34495E)
                                                .withOpacity(0.8)),
                                      ),
                                    ),
                                  ],
                                ),
                                TableRow(
                                  children: [
                                    Padding(
                                      padding: EdgeInsets.all(8.0),
                                      child: Text(
                                        'Quantity',
                                        style: GoogleFonts.poppins(
                                            fontSize: 10,
                                            fontWeight: FontWeight.w400,
                                            fontStyle: FontStyle.italic,
                                            color: Color(0xff34495E)
                                                .withOpacity(0.8)),
                                      ),
                                    ),
                                    Padding(
                                      padding: EdgeInsets.all(8.0),
                                      child: Text(
                                        '12',
                                        style: GoogleFonts.poppins(
                                            fontSize: 12,
                                            fontWeight: FontWeight.w400,
                                            color: Color(0xff34495E)
                                                .withOpacity(0.8)),
                                      ),
                                    ),
                                  ],
                                ),
                                TableRow(
                                  children: [
                                    Padding(
                                      padding: EdgeInsets.all(8.0),
                                      child: Text(
                                        'Description',
                                        style: GoogleFonts.poppins(
                                            fontSize: 10,
                                            fontWeight: FontWeight.w400,
                                            fontStyle: FontStyle.italic,
                                            color: Color(0xff34495E)
                                                .withOpacity(0.8)),
                                      ),
                                    ),
                                    Padding(
                                      padding: EdgeInsets.all(8.0),
                                      child: Text(
                                        'Praesent vitae neque porta, hendrerit enim sed, temps ante. Suspendisse vitae massa neque. Praesent vitae neque porta, hendrerit enim sed, tempus ante.',
                                        style: GoogleFonts.poppins(
                                            fontSize: 12,
                                            fontWeight: FontWeight.w400,
                                            color: Color(0xff34495E)
                                                .withOpacity(0.8)),
                                      ),
                                    ),
                                  ],
                                ),
                                TableRow(
                                  children: [
                                    Padding(
                                      padding: EdgeInsets.all(8.0),
                                      child: Text(
                                        'Phone',
                                        style: GoogleFonts.poppins(
                                            fontSize: 10,
                                            fontWeight: FontWeight.w400,
                                            fontStyle: FontStyle.italic,
                                            color: Color(0xff34495E)
                                                .withOpacity(0.8)),
                                      ),
                                    ),
                                    Padding(
                                      padding: EdgeInsets.all(8.0),
                                      child: Text(
                                        '09077338833',
                                        style: GoogleFonts.poppins(
                                            fontSize: 12,
                                            fontWeight: FontWeight.w400,
                                            color: Color(0xff34495E)
                                                .withOpacity(0.8)),
                                      ),
                                    ),
                                  ],
                                ),
                                TableRow(
                                  children: [
                                    Padding(
                                      padding: EdgeInsets.all(8.0),
                                      child: Text(
                                        'Date to complete',
                                        style: GoogleFonts.poppins(
                                            fontSize: 10,
                                            fontWeight: FontWeight.w400,
                                            fontStyle: FontStyle.italic,
                                            color: Color(0xff34495E)
                                                .withOpacity(0.8)),
                                      ),
                                    ),
                                    TableCell(
                                        verticalAlignment:
                                            TableCellVerticalAlignment.fill,
                                        child: Row(
                                          crossAxisAlignment:
                                              CrossAxisAlignment.center,
                                          mainAxisAlignment:
                                              MainAxisAlignment.spaceBetween,
                                          children: [
                                            Padding(
                                              padding: EdgeInsets.all(8.0),
                                              child: Text(
                                                '05-03-22',
                                                style: GoogleFonts.poppins(
                                                    fontSize: 12,
                                                    fontWeight: FontWeight.w400,
                                                    color: Color(0xff34495E)
                                                        .withOpacity(0.8)),
                                              ),
                                            ),
                                            Container(
                                              decoration: BoxDecoration(
                                                color: Color.fromRGBO(
                                                    50, 151, 219, 0.09),
                                                borderRadius:
                                                    BorderRadius.circular(20),
                                              ),
                                              child: Padding(
                                                padding:
                                                    const EdgeInsets.all(8.0),
                                                child: Text(
                                                  '15 days',
                                                  style: GoogleFonts.poppins(
                                                      fontSize: 10,
                                                      fontWeight:
                                                          FontWeight.w400,
                                                      fontStyle:
                                                          FontStyle.italic,
                                                      color: Color(0xff34495E)),
                                                ),
                                              ),
                                            ),
                                          ],
                                        )),
                                  ],
                                ),
                              ],
                            ),
                          ),
                        )
                      : SizedBox(),

This is my controller :
  final isDropDownVisible = false.obs;

oid toggleDropDownVisibility() {
    isDropDownVisible.value = !isDropDownVisible.value;
  }

I know nothing about flutter animations apart from AnimatedContainer but in this logic, i don't think i have to use AnimatedContainer and even if i do, i don't know how to implement it.
Lastly I would also need help removing the extra padding as seen in the image below after my divider when the visible container is shown.

A: What you want is the ExpansionPanel Widget. It will require you to completely rework your code though. It also needs the ExpansionPanelList.
To be clear the ExpansionPanelList is a list of ExpansionPanels.


text:
Q: How to handle HtmlDocument null exception I am checking a HtmlDocument() by html id called shippingMessage_ftinfo_olp_1 but problem is that i am unable to check if this is a null exception. Because when i set if !=null still it throws exception. Anyone can tell me how can i check it if its null without this exception?

System.NullReferenceException: 'Object reference not set to an
  instance of an object.'

HtmlDocument htmlDoc = new HtmlDocument();
htmlDoc.LoadHtml(response);
string gerLang = "";
if (htmlDoc.GetElementbyId("shippingMessage_ftinfo_olp_1").InnerText != null)
{
    gerLang = htmlDoc.GetElementbyId("shippingMessage_ftinfo_olp_1").InnerText;
    if(gerLang.Contains("AmazonGlobal Express-Zustellung"))
    {
        _outOfStock = false;
    }
}

A: Use a null conditional operator:
if (htmlDoc.GetElementbyId("shippingMessage_ftinfo_olp_1")?.InnerText != null)

If htmlDoc can be null, also change that to htmlDoc?.GetEle....
Reasoning: A null conditional operator short-circuits the evaluation if the object being evaluated is null, preventing you from getting an exception, in favour of evaluating to null.


text:
Q: Complex bool queries in Elasticsearch How to build a query for this kind of match ?
(name="Adam" OR name="Bob) OR (age=21 && email="email@gmail.com")

How should I "merge" the expressions in parenthesis with and OR operation
BoolQueryBuilder queryBuilder1 = QueryBuilders.boolQuery()
.should(QueryBuilders.matchQuery("name","Adam"))
.should(QueryBuilders.matchQuery("name","Bob"));

BoolQueryBuilder queryBuilder2 = QueryBuilders.boolQuery()
.must(QueryBuilders.matchQuery("age","21"))
.must(QueryBuilders.matchQuery("email","email@gmail.com"));

A: You can use
BoolQueryBuilder queryBuilder = QueryBuilders.boolQuery().should(queryBuilder1).should(queryBuilder2)

This will act as or between two QueryBuilders


text:
Q: Isolating the loading of files I have written the below code to Upload the files and do some calculation after I click on the Go Button. However following code executes loading of files every time even I do not upload the file again. I do not want to load the file again.
**Server.R**

options(shiny.maxRequestSize = 400*1024^2)

shinyServer(function(input, output,session) {

      datasetInput <- reactive({

      progress <- shiny::Progress$new()
      # Make sure it closes when we exit this reactive, even if there's an error
      on.exit(progress$close())

      progress$set(message = "Processing is going on..Kindly wait")

     isolate({
       S <- input$file1
      T <- input$file2

      if (is.null(S))
        return(NULL)

      Startrpt<-read.csv(S$datapath, header=TRUE)

      if (is.null(T))
        return(NULL)

      Takeoffrpt<-read.csv(T$datapath, header=TRUE)

      Takeoffrpt$TkDates = as.POSIXct(Takeoffrpt$Date,format='%m/%d/%Y %H:%M')
      Startrpt$StDates = as.POSIXct(Startrpt$Date,format='%m/%d/%Y %H:%M')

      # Getting only Dates
      Takeoffrpt$TkDate1 = as.Date(Takeoffrpt$TkDates)
    Startrpt$StDate1=as.Date(Startrpt$StDates)

    # Getting only Time
    Takeoffrpt$TkTime = format(Takeoffrpt$TkDates,'%H:%M')
    Startrpt$StTime=format(Startrpt$StDates,'%H:%M')

    Takeoffrpt$TkMins<-as.numeric(substring(Takeoffrpt$TkTime,1,2))*60+as.numeric(substring(Takeoffrpt$TkTime,4,5))
    Startrpt$StMins<-as.numeric(substring(Startrpt$StTime,1,2))*60+as.numeric(substring(Startrpt$StTime,4,5))

     })
    query<-paste("select tk.*,st.*,tk.Date as Tkdate, st.Date as Stdate, (tk.TkMins-st.StMins) as difference from Takeoffrpt as tk inner join Startrpt as st on tk.ESN=st.ESN and tk.TkDate1=st.StDate1 AND (tk.TkMins-st.StMins) <= ", input$Range," and (tk.TkMins-st.StMins) >= 0",sep="")
    P<-sqldf(query,drv="SQLite")
    P<-subset(P, select=-c(Date,TkDates,TkDate1,TkTime,TkMins,StDates,StDate1,StTime,StMins,difference))
    write.csv(file="output.csv",P)

    #data1<-sqldf("select * from Startrpt",drv="SQLite")
    })

    output$view <- renderDataTable({
      if (input$goButton == 0)
        return()
      isolate(datasetInput())
    }, options = list(lengthMenu = c(5, 10, 15), pageLength = 5))

 })

**ui.R**

    rm(list=ls())

    packages <- c("sqldf", "shiny")
    if (length(setdiff(packages, rownames(installed.packages()))) > 0) {
      install.packages(setdiff(packages, rownames(installed.packages())))
    }

    library(shiny)
    library(sqldf)

    shinyUI(fluidPage(
      titlePanel("Uploading Files"),
      sidebarLayout(
        sidebarPanel(
          fileInput('file1', 'Choose your Start Report CSV File',
                    accept=c('text/csv',
                                     'text/comma-separated-values,text/plain',
                                     '.csv')),

          fileInput('file2', 'Choose your take off Report CSV File',
                    accept=c('text/csv',
                             'text/comma-separated-values,text/plain',
                             '.csv')),

      # Sidebar with a slider input for number of observations

      sliderInput("Range",
                    "Accepted Minutes difference",
                    min = 1,
                    max = 60,
                    value = 1),
      actionButton("goButton", "Go!")
      #submitButton("Apply")

  ),
    mainPanel(
        dataTableOutput("view")
    )
  )
))

A: Surya,

*

*first an aside take a look at point 2 in my answer around Importing and accessing large data files in Shiny.
We found it helpful to load data in a global.R file that sits in same directory as your ui.R and server.R files.
This may not work well as your app is needing the user to select a file, but it may help thin out some of your code. See this scoping explanation for R Shiny on how global works.

*In your specific case, is the isolate inside your reactive a problem?
I am still getting to grips with Shiny but take a look at this answer which makes use of a conditional panel and setupComplete condition. And @daattali answer below that with shinyjs may give you ideas on how to better place your reactives/observe, or provide a workaround.
All the best.


text:
Q: How to create .drawing file for PencilKit?
If you look at Apple's PencilKit Sample, you'll noticed apple used a dataset file called Notes.dataset to save Pencilkit draws. Inside the Notes.dataset, it contains a general json file for Asset Catalogue.
But more interesting, there is a file called color.drawing, which saves the actual data produced by Pencilkit. My question is, how do you create this file as a developer? For example, I want to create a tutorial using Pencilkit and save it as a ".drawing" file, to load up on first launch.

A: PKDrawing is a model layer of PencilKey (and it is opaque), and here is API to store/restore that model:
   func dataRepresentation() -> Data // << to store data in file
   init(data: Data) throws // << to restore from data read from file