text:
Q: parsing yaml without creating variables for each parameter I am still quite new to programming and I really hope anyone can help me.
I would like to create a Map from a Yaml file. The problem is, I would like to make it optional which parameters are configured, so I do not want to create a class, in which all possible parameters are created as variables. I have used snakeyaml before, however as far as I know this is not an option in snakeyaml.
An example for my yaml file would look like this:
description: linter for microservices
meta:
  pciScope: false
image:
  name: helmcube
  tag: 2.5.4
service:
  type: 45
deployment:
  replicaCount: 2

Do any of you have an idea how this could be realised? I have already searched for hours and could not find anything concerning that issue.
I hope anyone can help
Regards
Marie

A: Would getting a Properties instance be sufficient for you? Instead of creating your own Class with defined variables.
If you use Spring,
public class YamlPropertySourceFactory implements PropertySourceFactory {

    @Override
    public PropertySource<?> createPropertySource(String name, EncodedResource encodedResource)
      throws IOException {
        YamlPropertiesFactoryBean factory = new YamlPropertiesFactoryBean();
        factory.setResources(encodedResource.getResource());

        Properties properties = factory.getObject();

        return new PropertiesPropertySource(encodedResource.getResource().getFilename(), properties);
    }
}

https://www.baeldung.com/spring-yaml-propertysource
What's the best way to load a yaml file to Map(not an environment configuration file) in spring boot web project?
--- Edited ---
You now have a Properties, which you can in turn get a Hashmap out of:
Using external Lib Guava,
com.google.common.collect.Maps.fromProperties(Properties)

Or the Java Way:
    Map properties = new Properties();
    HashMap<String, String> map = new HashMap<String, String>(properties);

This stackoverflow shows you how to convert Properties into HashMap:
Converting java.util.Properties to HashMap<String,String>
Once you have a hasmap of configurations(Strings), you could compare against another hashamap of configurations (Strings)
If this does not help you, kindly update your question with clear incentives/example of what you are trying to achieve.


text:
Q: How to check if values in an array of objects have a date format and how to reorder array by date if so? I have an array of data like so:
let arrayData =[
    {
        "category": "2019-07-24",
        "total": 1,
        "Col 1": 100
    },
    {
        "category": "2018-11-12",
        "total": 3,
        "Col 1": 101
    },
    {
        "category": "2019-07-11",
        "total": 1,
        "Col 1": 200
    },
    {
        "category": "2019-08-11",
        "total": 1,
        "Col 1": 153
    },
    {
        "category": "2019-09-25",
        "total": 1,
        "Col 1": 198
    }
]

How can I check if every 'category' value inside the array is in the format YYYY-MM-DD? And if so, re-order the objects inside the array by earliest date?
I know that I can use regex like so to check for individual dates:
checkIfDateIsInRightFormat() {
  // Is this the best way?
  const regex = /^\d{4}-\d{2}-\d{2}$/;

  if (dateStr.match(regex) === null) {
    return false;
  }

  const date = new Date(dateStr);

  const timestamp = date.getTime();

  if (typeof timestamp !== 'number' || Number.isNaN(timestamp)) {
    return false;
  }

  return date.toISOString().startsWith(dateStr);
}

and then I can do this:
let arrayOfItems = []

this.arrayData.foreach(item => {
     arrayOfItems.push(this.checkIfDateIsInRightFormat(item))
})

let result = arrayOfItems.every(element => {
    if (element === array[0] && element === true) {
      return true;
    }
});

if(result  === true) {
    // Here I'll order the objects in arrayData by earliest date in 'category'
    arrayData.sort(
      (objA, objB) => Number(objB.category) - Number(objA.category),
    );
}

However, it doesn't work as intended. How would I be able to achieve the right result?
Based on the arrayData above, the result should be:
let newArrayData =[
    {
        "category": "2018-11-12",
        "total": 3,
        "Col 1": 101
    },
    {
        "category": "2019-07-11",
        "total": 1,
        "Col 1": 200
    },
    {
        "category": "2019-07-24",
        "total": 1,
        "Col 1": 100
    },
    {
        "category": "2019-08-11",
        "total": 1,
        "Col 1": 153
    },
    {
        "category": "2019-09-25",
        "total": 1,
        "Col 1": 198
    }
]

Otherwise if I have something like this:
let exampleArrayData =[
    {
        "category": "2018-11-12",
        "total": 3,
        "Col 1": 101
    },
    {
        "category": "ABC",
        "total": 1,
        "Col 1": 200
    },
]

It would stop at finding out that they are not all dates. result = false.

A: Simplest way I think:

let newArrayData = false;
let arrayData =[
    {
        "category": "2019-07-24",
        "total": 1,
        "Col 1": 100
    },
    {
        "category": "2018-11-12",
        "total": 3,
        "Col 1": 101
    },
    {
        "category": "2019-07-24",
        "total": 1,
        "Col 1": 200
    },
    {
        "category": "2019-08-11",
        "total": 1,
        "Col 1": 153
    },
    {
        "category": "2019-09-25",
        "total": 1,
        "Col 1": 198
    }
];

if (arrayData.every(x => new Date(x.category) !== "Invalid Date"  && !isNaN(new Date(x.category)))){
    newArrayData = arrayData.slice().sort((a, b) => new Date(a.category) - new Date(b.category));
}

console.log(newArrayData);

.every() checks whether all items fulfill a condition.
By trying to convert the strings into a date, we can check whether they result in "Invalid Date" (which is returned by the new Date object in case of an invalid date) and if it is a number (ms since January 1, 1970).
Now if you really want to make sure, that the strings are EXACTLY in YYYY-MM-DD format, then yes, you need regex, see: Regex date validation for yyyy-mm-dd
.slice() is only there to first make a copy of the array and can be omitted if you don't care about manipulating the original array, which .sort() otherwise does by default.

redpajama_set_name: RedPajamaStackExchange


text:
Q: In what way is the execution order of reactiva-banana's execute not guaranteed? The documentation for the execute function in Reactive.Banana.Frameworks says that "there is no guarantee about the order in which the actions are executed."
I'm not sure which ordering is meant here. As the event only fires one action at once, there isn't much of an order to guarantee here, so the most likely scenario I can imagine is this:
a :: MomentIO (Event t)
a = ...

b :: MomentIO (Event t)
b = ...

makeEvent :: MomentIO (Event (MomentIO (Event t))
makeEvent = fromAddHandler $ ... -- Some AddHandler that first fires a
                                 -- and later fires b

network :: MomentIO ()
network = do
  ...
  newEvents <- makeEvent
  ts <- execute newEvents >>= switchE
  ...

The non-guarantee I can imagine here is that the execution order of a and b is switched, thus b gets executed first. If we assume that a and b both modify the behavior of some widget (using liftIO) and then register their corresponding event handler (unregistering the previously registered one), switching the execution order of a and b would be fatal as it would leave the widget in a state where it doesn't fire the handlers it supposed to fire. As I don't see for which use cases execute is still useful if my scenario is correct, I suppose the documentation actually means something else.
Can someone please clarify what the documentation is trying to say here?


text:
Q: How to detect system halt and recover last status in C#? I making a editor like program in Windows with C#.
I wonder that how the programs restore their working status or last working file that wasn't saved by user. The Photoshop and the 3Ds Max show a dialog to restore user's last working after system halt such as plugged out or bluescreen.
How do they do it? Do they just save their status every seconds? That's so simple and reasonable but not fancy. Is this only the way?

A: Use an unhandled exception handler and inside it save the current data to a special file.
Check AppDomain Unhandled Exception and Application DispatcherUnhandledException
If you want to protect yourself from other kind of issues like system errors then you need to save periodically the information


text:
Q: (python) quicksort working for ordered data, but not for unordered data I am working on an implementation of recursive quicksort in python. I am working with very large data sets (10,000 - 1,000,000 elements). When feeding it ordered data (i.e. changing an array sorted from largest -> smallest to smallest -> largest) it works fine. But when giving it unordered data, it doesn't seem to work at all.
I'm using a 3-way pivot that counts elements that are equal to the pivot (dutch national flag problem) and, if the data is larger than 101 (remember it's recursive), it uses a median of first, middle, and last elements in the array partition when selecting the pivot.
Slice of output from a random set of 10,000 elements:
129
1
16
7
21
4
16
19
4
15
22
23
1
20
25
27
1
4
15
31
31
37
41
32
42
46
46
44

As you can see, it seems to have a certain pattern to it. I've increased the recursion limit so I know that's not the problem, but it almost seems like it's only partially sorting the input. Like I mentioned, it works fine for an array that's already sorted in reverse order, which is what mystifies me.
My code:
def array_swap(A, i, j):
    temp = A[i]
    A[i] = A[j]
    A[j] = temp

# take median of three elements
def median_three(a, b, c):
    return sorted([a, b, c])[1]

def qs_part(A, lo, hi):
    mid = lo
    p = median_three(A[lo], A[(lo + hi) // 2], A[hi]) # pivot set to median of 3, as described in handout
    # ('//' must be used for floor division in Python 3 -- it took me longer than I'm willing to admit to figure that out.)

    while mid <= lo:
        if A[mid] < p:
            array_swap(A, mid, lo)
            mid += 1
            lo  += 1
        elif A[mid] > p:
            array_swap(A, mid, hi)
            hi  -= 1
        else:
            mid += 1
    return (lo - 1), mid

# Quicksort implementation as described in handout.
# A: Array to sort
# write:    name of file to write sorted results to
# out:      name of file to write runtime to
# lo:       start index (1 after pivot in first case)
# hi:       end index
def quick_sort(A,lo, hi):
    if lo >= hi:
        return # if there are 0 or 1 elements in A

    if lo - hi == 1:
        if A[lo] < A[hi]: # if 2 elements, sort them
            array_swap(A, lo, hi)
        return

    i, j = qs_part(A, lo, hi)
    quick_sort(A, lo, i) # recursively sort partition 1 (elements < pivot)
    quick_sort(A, j, hi) # recursively sort partition 2 (elements > pivot)
    # no need to sort between 'i' and 'j' because those items == pivot

A: I figured it out. It was just a small typo in qs_part(). while mid <= lo should have been while mid <=  hi


text:
Q: Output comes in stderr when calling java in python I am launching a MapReduce job with python using the code[1]. The problem is that I am getting correct output data in the stderr field [3], instead of coming in the stdout field [2]. Why am I getting correct data in the stderr field? Am I using the Popen.communicate correctly? Is there a better way to launch a java execution using python (not jython)?
[1] snippet that I use to launch a job in Hadoop
command=/home/xubuntu/Programs/hadoop/bin/hadoop jar /home/xubuntu/Programs/hadoop/medusa-java.jar mywordcount -Dfile.path=/home/xubuntu/Programs/medusa-2.0/temp/1443004585/job.attributes /input1 /output1

try:
    process = subprocess.Popen(shlex.split(command), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    out,err = process.communicate()
    print ("Out %s" % out)
    print ("Error %s" % err)

    if len(err) > 0:  # there is an exception
        # print("Going to launch exception")
        raise ValueError("Exception:\n" + err)
except ValueError as e:
    return e.message

return out

[2] Output that is in stdoutdata:
[2015-09-23 07:16:13,220: WARNING/Worker-17] Out My Setup
My get job name
My get job name
My get job name
org.apache.hadoop.mapreduce.lib.partition.HashPartitioner
---> Job 0: /input1, : /output1-1443006949
10.10.5.192
10.10.5.192:8032

[3] Output that is in stderrdata field:
[2015-09-23 07:16:13,221: WARNING/Worker-17] Error 15/09/23 07:15:52 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
15/09/23 07:15:53 INFO client.RMProxy: Connecting to ResourceManager at  /10.10.5.192:8032
15/09/23 07:15:54 WARN mapreduce.JobSubmitter: Hadoop command-line option parsing not performed. Implement the Tool interface and execute your application with ToolRunner to remedy this.
15/09/23 07:15:54 INFO input.FileInputFormat: Total input paths to process : 4
15/09/23 07:15:54 INFO mapreduce.JobSubmitter: number of splits:4
15/09/23 07:15:54 INFO mapreduce.JobSubmitter: Submitting tokens for job: job_1442999930174_0009
15/09/23 07:15:54 INFO impl.YarnClientImpl: Submitted application application_1442999930174_0009
15/09/23 07:15:54 INFO mapreduce.Job: The url to track the job: http://hadoop-coc-1:9046/proxy/application_1442999930174_0009/
15/09/23 07:15:54 INFO mapreduce.Job: Running job: job_1442999930174_0009
15/09/23 07:16:00 INFO mapreduce.Job: Job job_1442999930174_0009 running in uber mode : false
15/09/23 07:16:00 INFO mapreduce.Job:  map 0% reduce 0%
15/09/23 07:16:13 INFO mapreduce.Job:  map 100% reduce 0%
15/09/23 07:16:13 INFO mapreduce.Job: Job job_1442999930174_0009 completed successfully
15/09/23 07:16:13 INFO mapreduce.Job: Counters: 30
    File System Counters
            FILE: Number of bytes read=0
            FILE: Number of bytes written=423900
            FILE: Number of read operations=0
            FILE: Number of large read operations=0
            FILE: Number of write operations=0
            HDFS: Number of bytes read=472
            HDFS: Number of bytes written=148
            HDFS: Number of read operations=20
            HDFS: Number of large read operations=0
            HDFS: Number of write operations=8
    Job Counters
            Launched map tasks=4
            Data-local map tasks=4
            Total time spent by all maps in occupied slots (ms)=41232
            Total time spent by all reduces in occupied slots (ms)=0
            Total time spent by all map tasks (ms)=41232
            Total vcore-seconds taken by all map tasks=41232
            Total megabyte-seconds taken by all map tasks=42221568
    Map-Reduce Framework
            Map input records=34
            Map output records=34
            Input split bytes=406
            Spilled Records=0
            Failed Shuffles=0
            Merged Map outputs=0
            GC time elapsed (ms)=532
            CPU time spent (ms)=1320
            Physical memory (bytes) snapshot=245039104
            Virtual memory (bytes) snapshot=1272741888
            Total committed heap usage (bytes)=65273856
    File Input Format Counters

A: Hadoop (specifically Log4j) just logs all of the [INFO] messages to stderr. From their entry on Configuration:

Hadoop logs messages to Log4j by default. Log4j is configured via log4j.properties on the classpath. This file defines both what is logged and where. For applications, the default root logger is "INFO,console", which logs all message at level INFO and above to the console's stderr. Servers log to the "INFO,DRFA", which logs to a file that is rolled daily. Log files are named $HADOOP_LOG_DIR/hadoop-$HADOOP_IDENT_STRING-.log

I have never actually tried redirecting the logs to stdout so I can't really help with that, but a promising answer from another user suggests:
// Answer by Rajkumar Singh
// to get your stdout and log message on the console you can use apache
// commons logging framework in to your mapper and reducer.

public class MyMapper extends Mapper<..,...,..,...>{
public static final Log log = LogFactory.getLog(MyMapper.class)
public void map() throws Exception{
// Log to stdout file
System.out.println("Map key "+ key);

//log to the syslog file
log.info("Map key "+ key);

if(log.isDebugEanbled()){
log.debug("Map key "+ key);
}
context.write(key,value);
}

I suggest giving it a try.


text:
Q: Cannot read property 'main' of undefined in MUI v5 I was following the tutorial to add page pagination for my Table and now I have this error in my browser :
   Uncaught TypeError: Cannot read property 'main' of undefined
    at ButtonRoot.ownerState.ownerState (Button.js:80)
    at transformedStyleArg (createStyled.js:189)
    at handleInterpolation (emotion-serialize.browser.esm.js:137)
    at serializeStyles (emotion-serialize.browser.esm.js:262)
    at emotion-styled-base.browser.esm.js:131
    at emotion-element-cbed451f.browser.esm.js:36
    at renderWithHooks (react-dom.development.js:14985)
    at updateForwardRef (react-dom.development.js:17044)
    at beginWork (react-dom.development.js:19098)
    at HTMLUnknownElement.callCallback (react-dom.development.js:3945)

Which completely prevents me from displaying my page.
I know there are big style changes from mui v4 to mui v5, I managed to "dodge" them by using simple CSS. So I don't understand my mistake at all. Especially since the error seems to be located in a "ButtonRoot" ? :
backgroundColor: alpha(theme.palette[ownerState.color].main, theme.palette.action.hoverOpacity),

So here is my code where I use a "theme" (I normally have the same code as the tutorial) :

import { useTheme } from '@mui/material';

import LastPageOutlinedIcon from "@mui/icons-material/LastPageOutlined";
import FirstPageIcon from "@mui/icons-material/FirstPage";
import KeyboardArrowLeftIcon from "@mui/icons-material/KeyboardArrowLeft";
import KeyboardArrowRightIcon from "@mui/icons-material/KeyboardArrowRight";

function TablePaginationActions(props) {
  const theme = useTheme();
  const { count, page, rowsPerPage, onPageChange } = props;

  const handleFirstPageButtonClick = (event) => {
    onPageChange(event, 0);
  };

  const handleBackButtonClick = (event) => {
    onPageChange(event, page - 1);
  };

  const handleNextButtonClick = (event) => {
    onPageChange(event, page + 1);
  };

  const handleLastPageButtonClick = (event) => {
    onPageChange(event, Math.max(0, Math.ceil(count / rowsPerPage) - 1));
  };

  return (
    <div style={{ flexShrink: 0, marginLeft: 2.5 }}>
      <IconButton
        onClick={handleFirstPageButtonClick}
        disabled={page === 0}
        aria-label="Première page"
      >
        {theme.direction === "rtl" ? (
          <LastPageOutlinedIcon />
        ) : (
          <FirstPageIcon />
        )}
      </IconButton>

      <IconButton
        onClick={handleBackButtonClick}
        disabled={page === 0}
        aria-label="Page précédente"
      >
        {theme.direction === "rtl" ? (
          <KeyboardArrowRightIcon />
        ) : (
          <KeyboardArrowLeftIcon />
        )}
      </IconButton>

      <IconButton
        onClick={handleNextButtonClick}
        disabled={page >= Math.ceil(count / rowsPerPage) - 1}
        aria-label="Page suivante"
      >
        {theme.direction === "rtl" ? (
          <KeyboardArrowLeftIcon />
        ) : (
          <KeyboardArrowRightIcon />
        )}
      </IconButton>

      <IconButton
        onClick={handleLastPageButtonClick}
        disabled={page >= Math.ceil(count / rowsPerPage) - 1}
        aria-label="Dernière page"
      >
        {theme.direction === "rtl" ? (
          <FirstPageIcon />
        ) : (
          <LastPageOutlinedIcon />
        )}
      </IconButton>
    </div>
  );
}

export default function Importation() {

  // Pagination
  const [page, setPage] = useState(0);
  const [rowsPerPage, setRowsPerPage] = useState(10);

  TablePaginationActions.propTypes = {
    count: PropTypes.number.isRequired,
    onPageChange: PropTypes.func.isRequired,
    page: PropTypes.number.isRequired,
    rowsPerPage: PropTypes.number.isRequired,
  };

  // Permet de changer de page
  const handleChangePage = (event, newPage) => {
    setPage(newPage);
  };

  return (
    <Grid
      container
      style={{ width: "100%", minHeight: "90vh" }}
      {...getRootProps()}
    >

      <TablePagination
        component="div"
        rowsPerPageOptions={[]}
        count={fichiers.length}
        rowsPerPage={rowsPerPage}
        page={page}
        onPageChange={handleChangePage}
        ActionsComponent={TablePaginationActions}
      />
    </Grid>
  );
}

Note : It's note the full page (+1000 lines) but I think my problem comes from this "theme" style.
Finally, the code of the tutorial, on which I base myself :
https://codesandbox.io/s/ccw8hm?file=/demo.js

A: Hopefully this solves your issue as it did mine, but I believe it has to do with passing custom colors to the Button or IconButton component as described here. The error returned is the same that you are describing.
https://github.com/mui/material-ui/issues/33054
Essentially the problem is that some components dropped support for the 'default' color that was available in v4. In v5 they state they want to align with the material spec and no longer include the 'default' grey color because it isn't part of the material design guidelines. This has caused a major headache for me, since I used these default/grey buttons and other components extensively when making proper dark/light themes.
You would need to go through your code and ensure that there are no <Button color="default"/> instances and if there is, change the color to something thats supported per the docs, like primary or secondary for example. There are some components that still support 'default' like AppBar, Fab and IconButton, but not Button.
As a quick fix, you can update/create your custom MUI theme and add a default color, but it may end up looking weird, because it doesn't cover all the variants that v4 had (Here's a thread about replicating the color fully).
import { createTheme } from '@mui/material/styles';
import { grey } from "@mui/material/colors";

export const lightTheme = createTheme({
  palette: {
    mode: 'light',
    default: {
      main: grey[300],
      dark: grey[400]
    },
  }
});

A: check this link You cannot customize themes in Material UI by just declaring them in your code, you have to make the style components for the every component you used by importing styled  from MUI, in your code use sx={{}} instead of style={{}} for better reliability.


text:
Q: vue-cli-service build --target lib loses images path when imported as lib I followed this guide to create my npm module. My repo contains in the src/assets folder an svg image (hue-cirle.svg).
When building with vue-cli-service build --target lib --name <lib-name> the svg image is bundled under dist/img/hue-circle123456.svg.
Now when installing the module with npm install --save <module> the path remains src/img/hue-circle123456.svg, while it should refer to the svg image from the node_modules dist folder and not to a non-existing hue-circle123456.svg image from the main Vue App src folder.
Basically what happens is that the svg image path is wrong in the Vue project that uses my module. I tried to add the ~ to force webpack to interpret it as a module dependency as suggested here but it did not work.
In the end I gave up and embedded the svg in the html template as you can see in the repo. Nonetheless, I ask this question since I could not find any solution and I, as well as others, may need to solve this in order to use image resources in custom modules built with vue-cli-service build --target lib --name <lib-name> command.
Thanks for the help!

A: I have a similar problem, my fix for the time being is to add the following to vue.config.js:
module.exports = {
  css: {
    extract: false
  },
  chainWebpack: config => {
    config.module
      .rule("images")
      .use("url-loader")
      .loader("url-loader")
      .tap(options => Object.assign(options, { limit: Infinity }));
  }
};

This inlines all assets as base64 Data URLs.
Taken from: https://cli.vuejs.org/guide/html-and-static-assets.html#relative-path-imports
Edit:
For SVG try this:
module.exports = {
  css: {
    extract: false
  },
  chainWebpack: config => {
    const svgRule = config.module.rule('svg')
    svgRule.uses.clear()

    svgRule
      .test(/\.svg$/)
      .use('svg-url-loader') // npm install --save-dev svg-url-loader
      .loader('svg-url-loader')
  }
};

Remember this is far from optimal and a workaround!

A: Here is the documentation for resolve path with WebPack :
https://webpack.js.org/configuration/resolve/
The path for assets can be resolve like this for example :
process.env.NODE_ENV == "production ? path.resolve(process.cwd(), "dist/assets") : path.resolve(__dirname, "src/assets");

Production :
process.cwd() // Where the application is running. You can pack it for example.


text:
Q: Printing list with current view without webpage headers sharepoint 2013 online I've been using Sharepoint lists as a reporting method, recently I was requested to print out my lists just the way they looked, with sorting and grouping and filters applied.  I've also enabled the 'Sum' feature on some of my lists to sum up grouped items in certain columns.
I've looked at several tutorials but they were all made for Sharepoint 2010, while Sharepoint 2013 does not allow its contents to be opened in a popup window...
Has anyone else had similar problems or a work around?
Thanks,
Fan

A: it is possible to print a section of the page with the help of some javascript
Below code sample may be helpful for you to get started:

    <title>Untitled Page</title>

    <form id="form1" runat="server">

        Print me I am in 1st Div

        I am not going to print

    <input type="button" value="Print 1st Div" onclick="javascript:printDiv('printablediv')" />
    </form>

Code Project Reference
SharePoint 2013 allows list forms to be opened in a dialog box by changing this setting:
List Settings>Advanced settings> Launch forms in a dialog?  Yes/No.


text:
Q: StackLayout on pressed event In my Xamarin.Forms app, I have a view in my StackLayout. I want to make an effect so that when the user presses on the StackLayout the background changes color, and then reverts the color back when the user releases his/her finger, for a "flash" effect.
I was advised that since views don't have an "on pressed" event, I would have to use a custom renderer. But I don't know how to make a custom renderer for a StackLayout?

A: You don't really need a CustomRenderer to have a "on pressed" event on your StackLayout, you can use TapGestureRecognizer instead.
<StackLayout>
...
    <StackLayout.GestureRecognizers>
        <TapGestureRecognizer
                Tapped="OnTapGestureRecognizerTapped" />
  </StackLayout.GestureRecognizers>
</StackLayout>

You can read more about GestureRecognizers in the official documentation.
P.S.: If you really need to react to "finger release" than you might need an Effect or a CustomRenderer.


text:
Q: Kubernetes Go API I have some questions about the golang API for kubernetes.

*

*which one should I use? k8s.io/client-go or k8s.io/kubernetes/pkg/client? What's the difference?

*I want to get list of all pods and then listen to add/update/delete events, what's the difference between using the api.Pods("").Watch method and using an informer?

*I'm using the API from inside the cluster, how can I fetch the name of the node I'm currently in? is it just the hostname of the machine?

A:
which one should I use? k8s.io/client-go or k8s.io/kubernetes/pkg/client?

Use k8s.io/client-go.

what's the difference between using the api.Pods("").Watch method and using an informer?

The informer is essentially a shared cache, reducing the load on the API server. Unless you're doing something trivial, this is the preferred way.

how can I fetch the name of the node I'm currently in?

Use k8s.io/api/core/v1.Node, see for example this code.
BTW, a colleague of mine and myself gave a workshop on this topic (using the Kube API with Go) last week at GopherCon UK—maybe the slide deck and the repo are useful for you; also, there is an accompanying online Katacoda scenario you can use to play around.


text:
Q: java.io.IOException: Cannot run program "curl" CreateProcess error=2, Impossibile trovare il file specificato I have error in the title, my code is:
import java.io.File;
import java.io.IOException;
import java.lang.ProcessBuilder;

public class Pro {
    public static void main (String arg[]){
        ProcessBuilder pb = new ProcessBuilder();
        try {
            ProcessBuilder pb2=pb.directory(new File("C:\\Users\\Utente\\Downloads\\src"));
            System.out.println(pb2.directory());
            pb2.command("curl", "-X", "POST", "http://10.0.6.96:7877/connect/Nuke");
            pb2.start();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

The curl.exe is in the correct folder, but the java code don't work correctly. Please help me, Thanks you.


text:
Q: How to correctly read JSON data from a file? In my simple Web API, I'm working on a controller which reads a JSON file and then has to return the content as a pure JSON string. However, once read, the latter is stained by many \r, \" and \n which, AFAIK, render its direct parsing impossible. I don't really know how to solve this, I tried with some quite dumb .Replace("\r", ""), to no avail, as I don't know how to work around "\"". I'm stuck and I have no idea what to do.
Can someone please help me? I'm sorry if this has been asked and solved somewhere else, but I could not find an already answered question to solve my issue.
[Produces("application/json")]
public async Task<string> JsonData()
{
    using var reader = new StreamReader("Mocks\\data.json");
    string fileContent = await reader.ReadToEndAsync();
    fileContent = fileContent.Replace("\r", "").Replace("\n", "").Replace("\"", "\""); // Doesn't do the job

    return fileContent;
}

Here's how it's given out:
{\n\r\"name\":\"lloyd\",\n\r\"mydata\":\"somedata\",\n\r\"moredata\"...}

I'd like all the formatting stuff to disappear:
{
    "name":"lloyd",
    "mydata":"somedata",
    "moredata": ...
}

A: Just convert to object and return it:
[Produces("application/json")]
[HttpGet]
public async Task<Object> JsonData()
{
    var reader = new StreamReader("data.json");
    string fileContent = await reader.ReadToEndAsync();
    var data = JsonConvert.DeserializeObject(fileContent);
    return data;
}


text:
Q: Bean that uses ehcache cannot be injected I use Spring 3.0 and ehcache. I have added @Cacheable annotations to some methods of a bean. I am injecting that bean into other beans and it is registered in my application context xml file. The application was working before adding ehcache annotations (I use com.googlecode.ehcache-spring-annotations v 1.2.0), but after adding the annotations, Spring is unable to properly inject the beans that contain the annotations. The error I see in my log file is:
org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type '$Proxy67 implementing java.io.Serializable,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised' to required type '{my bean type}' for property '{property}'.
Here is what I have added to my application context for ehcache to work:
<context:annotation-config />
<context:component-scan base-package="{my root package}" />

<ehcache:annotation-driven cache-manager="cacheManager" />
<bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
    <property name="configLocation" value="classpath:ehcache.xml" />
</bean>

I think the configuration is OK, because at first I had some issues loading the ehcache.xml file and there was a corresponding error in the logs for that. After I fixed the problem, I got the error above. It seems that spring creates a proxy for my bean that internally calls the caching logic for ehcache, but fails to make that proxy convertible to the bean type.

A: See Spring (3.1) Reference: Chapter 27. Cache Abstraction
In your configuration, you are using, Interface Base Proxies.
So the Bean that uses the Bean with the cached Method must refer to its interface, not to its concrete class.
Or you can change the configuration proxy-target-class="true" to use class based proxies.


text:
Q: Codeigniter Paginition does not show result on 2 page I am using Codeigniter pagination class for the first.
Controller :-
public function index($issue_id = 0)
    {
        if(empty($issue_id))
        {
            $config = array(
               array(
                     'field'   => 'seltype',
                     'label'   => 'Type of issue',
                     'rules'   => 'trim'
                  ),
               array(
                     'field'   => 'txttitle',
                     'label'   => 'Title',
                     'rules'   => 'trim|required'
                  ),
            );
            $this->form_validation->set_rules($config);

            $this->load->library('pagination');

            $config['base_url'] = site_url()."/new_issues";
            $config['total_rows'] = $this->all_model->total_new_level_records(1);

            $offset = $this->uri->segment(3);
            $config['per_page'] = 9;

            $config['uri_segment'] = 3;
            $config['use_page_numbers'] = TRUE;

            $this->pagination->initialize($config);

            $data['level_one'] = $this->all_model->new_level_issues(1,$config["per_page"], $config['uri_segment']);

            $data["links"] = $this->pagination->create_links();

            $this->load->view("new_issues_page", $data);
        }
}

I am getting total 33 rows from db and also I can see pagination in my view page which shows 1,2,3 Last. but when I click on 2 link it display no result.
EDIT :- The URL which I got when I click on 2 page is :- http://www.example.com/new_issues/2
Also I tries to print :- $offset = $this->uri->segment(3); but it does not show anything.

A: Try to replace like,it should be third segment of url
$config['uri_segment'] = 3;

and your base_url should be like
$config['base_url'] = site_url()."/new_issues/index";

not other new functions

A: Just load model $this->load->model('all_model') before calling model function.
try
$this->load->model('all_model');

        $config = array();
        $config['base_url'] = site_url("controller/method");
        $config['total_rows'] = $this->db->get_where('table name',array('where condition'))-> num_rows();
        $config['per_page'] = 9;
        $config['uri_segment'] = 5;
        $this->pagination->initialize($config);
        $data['pagination'] = $this->pagination->create_links();


text:
Q: A generic term for a piece of writing Is there a generic term which encompasses all types of work that a writer might do? Something that for example covers 'stories' and 'poems', but also 'articles' or 'journals'?
I thought possibly 'script', but I feel that as a script itself is a piece of written stageplay, in this context it doesn't feel generic enough.

A: Writings:

the written works of a person:

*

*the writings of Abraham Lincoln
(Cambridge)

It is used in the plural to include any written work:

writings PLURAL
all the books etc that someone has written

*

*Wordsworth's writings
(Macmillan)

A: You may use oeuvre if you refer to most or all of a writer's output. It has overtones of authority that perhaps derive from its French origin or from its more general application to significant and substantial bodies of creative work such as musical composition, painting or sculpture, as well as to writing.

Merriam Webster
oeuvre, noun:
a substantial body of work constituting the lifework of a writer, an artist, or a composer
"a catalogue of Rembrandt's oeuvre"
"scrupulously examines Dickens' oeuvre in order to demonstrate how his convictions helped to determine the shape of his novels"


text:
Q: Sitecore 7.2 Upgrade Media Library issue I upgraded Sitecore 7.1 to 7.2 and images with a space in the path are not working eg /images/path 1/image1 not working but /images/path1/image1 is working. I'm using
 <encodeNameReplacements>
      <replace mode="on" find=" " replaceWith="-" />
 </encodeNameReplacements>

Any help will be really appreciated. I tried a solution explained here
but didn't help

A: I have written a blog post here which I think covers this situation. The problem as you know is related to the encodeNameReplacements. When I had this issue, I just renamed the items to not have spaces, but you can also follow this Sitecore KB article.

A: I fixed the issue by renaming all the " " with "-" using Sitecore POwershell.


text:
Q: Windows Service doesn't start - exception logged I've seen a few variants of this issue, but none are quite the same as my issue.
I'm building a Windows Service, using .NET 6.0.  This service hosts ASP.NET Core in addition to other background functionality.  When run as an ordinary application, everything is fine, but when registered as a service, on startup it fails with:
Application: MyService.exe
CoreCLR Version: 6.0.222.6406
.NET Version: 6.0.2
Description: The process was terminated due to an unhandled exception.
Exception Info: System.NotSupportedException: The content root changed from "C:\WINDOWS\system32\" to "c:\long-path-executable\". Changing the host configuration using WebApplicationBuilder.Host is not supported. Use WebApplication.CreateBuilder(WebApplicationOptions) instead.
   at Microsoft.AspNetCore.Builder.ConfigureHostBuilder.ConfigureHostConfiguration(Action`1 configureDelegate)
   at Microsoft.Extensions.Hosting.HostingHostBuilderExtensions.UseContentRoot(IHostBuilder hostBuilder, String contentRoot)
   at Microsoft.Extensions.Hosting.WindowsServiceLifetimeHostBuilderExtensions.UseWindowsService(IHostBuilder hostBuilder, Action`1 configure)
   at Program.Main(String[] args) in C:\...\Program.cs:line 41

The error message is quite specific - use WebApplication.Createbuilder.  Problem is, that's exactly what I am already doing.  Here's my program startup code:
      var builder = WebApplication.CreateBuilder(args);

      builder.Host.UseWindowsService(options =>
      {
        options.ServiceName = "FileFlow";
      });

      builder.Services.AddControllers();
      builder.Services.AddEndpointsApiExplorer();
      builder.Services.AddSwaggerGen();
      builder.Services.AddHostedService<WindowsService>();

      var app = builder.Build();

      if (app.Environment.IsDevelopment())
      {
        app.UseSwagger();
        app.UseSwaggerUI();
      }

      app.UseAuthorization();
      app.MapControllers();
      app.Run();

As you can see from the stack trace, it's failing very early in the build process.
Suggestions appreciated.  Meanwhile, I'll keep digging.

A: This other post https://stackoverflow.com/a/70036550/4139809 has the answer:
      var builder = WebApplication.CreateBuilder(new WebApplicationOptions
      {
        Args = args,
        ContentRootPath = WindowsServiceHelpers.IsWindowsService() ? AppContext.BaseDirectory : default
      });

Thanks to Jeremy Lakeman for the pointer to that post in the comments.


text:
Q: Getting a HeadlessException: No X11 DISPLAY variable was set Exception in thread "main" java.awt.HeadlessException:
    No X11 DISPLAY variable was set, but this program performed an operation which requires it.
        at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:159)
        at java.awt.Window.<init>(Window.java:432)
        at java.awt.Frame.<init>(Frame.java:403)
        at javax.swing.JFrame.<init>(JFrame.java:202)
        at DrawGUI.<init>(DrawGUI.java:15)
        at ShapeCreator.<init>(ShapeCreator.java:31)
        at ShapeCreator.main(ShapeCreator.java:138)

What does this error message mean? And how can I solve it?

A: This appears to be a more general SWING/AWT/JDK problem that just the JBOSS installer:
The accepted answer below solved the issue for me :
Unable to run java gui programs with ubuntu
("sudo apt-get install openjdk-6-jdk")

A: I assume you're trying to tunnel into some unix box.
Make sure X11 forwarding is enabled in your PuTTY settings.

A: Your system does not have a GUI manager. Happens mostly in Solaris/Linux boxes. If you are using GUI in them make sure that you have a GUI manager installed and you may also want to google through the DISPLAY variable.

A: I think you are trying to run some utility or shell script from UNIX\LINUX which has some GUI. Anyways
SOLUTION: dude all you need is an XServer & X11 forwarding enabled. I use XMing (XServer). You are already enabling X11 forwarding. Just Install it(XMing) and keep it running when you create the session with PuTTY.

A: Problem statement – Getting  java.awt.HeadlessException while trying to initialize java.awt.Component from the application as the tomcat environment does not have any head(terminal).
Issue – The linux virtual environment was setup without a virtual display terminal. Tried to install virtual display – Xvfb, but Xvfb has been taken off by the redhat community.
Solution – Installed 'xorg-x11-drv-vmware.x86_64' using yum install xorg-x11-drv-vmware.x86_64 and executed startx. Finally set the display to :0.0 using export DISPLAY=:0.0 and then executed xhost +


text:
Q: What's meant by, "TODO Auto-generated method stub"? I am using eclipse for android programming, and every here and there i see the statement, "TODO Auto-generated method stub."
I understand that these methods were generated automatically by eclipse upon creation of classes and other trigger activities but I do not understand the need to have it mentioned everywhere.
What's the need to have it mentioned everywhere repeatedly?

A: TODO is one of several default keywords which indicate tasks to perform in Eclipse.  Under windows->Preferences->Java->Compiler->Task Tags, you should see these keywords.  It is thought  to add a comment with this keyword to automatically indicate the things that are still to complete, which is convenient if you make use of these task tags.
However, if you don't use them, you should modify the code templates (Preferences->Java->Code Style->Code Templates) to eliminate these comments.
In particular:

*

*Code->Method body

*Code->Constructor body

*Code->Catch block body

A: Many IDEs, including Eclipse, use "TODO" in a comment to generate task lists. These task lists include the text of the comment and the file and method that the comment is in. This lets everyone using a tool with this functionality generate lists of things that are still open. There are also some other common identifiers, like FIXME or XXX that have similar functionality in some IDEs. This question on Stack Overflow asks about the comment keywords in Eclipse, and provide some additional information.
When you autogenerate some functions, it's expected that you'll be inserting your own implementation. It adds the appropriate stub so that your code will compile, but adds the comments so that you can quickly find methods that need to be implemented. Note that some autogenerated functions, like autogenerated toString and hashcode functions do not contain these comments because it's not expected that you'll modify them.
There are ways to disable the insertion of these by editing the templates used to create autogenerated code, if it bothers you that much. However, they are useful. Simply searching your codebase for things like TODO and FIXME can be the basis of a task list if they are coupled with a decent comment about what needs to be done, especially on smaller projects.

A: TODO simply mean "TO DO", stub is generated but developer or programmer need to add code as required.

A: Eclipse creates just empty methods that return null (hence "stub"). The comments are inserted to remind the developer that he'll probably want to do something in those methods, otherwise why should they exist? You're supposed to delete the comments when you've done that.
If you see those comments all over the place, then either (if the actually contain implementations) the developers are lazy or believe the comments have some other purpose and therefore don't delete them, or it's an indication of weak design, usually interfaces that are too big and have implementations (and users) that don't actually use all the methods in the interface.


text:
Q: Getting random value from table variable in SQL returns no data I'm using the following SQL to return a single colour from the table variable. I have to do this way and not with order by newid() as this query will be in another query as a column value, and I want a different value for each row.
Apologies for the abnormally long table variable, it's got 746 colours in it!
declare @socks table
    (
        RowID int identity(1,1),
        Colour nvarchar(70)
    );

insert into @socks(Colour)
values('Air Force blue'), ('Alice blue'), ('Alizarin crimson'), ('Almond'), ('Amaranth'), ('Amber'), ('American rose'), ('Amethyst'), ('Android Green'), ('Anti-flash white'), ('Antique brass'), ('Antique fuchsia'), ('Antique white'), ('Ao'), ('Apple green'), ('Apricot'), ('Aqua'), ('Aquamarine'), ('Army green'), ('Arylide yellow'), ('Ash grey'), ('Asparagus'), ('Atomic tangerine'), ('Auburn'), ('Aureolin'), ('AuroMetalSaurus'), ('Awesome'), ('Azure'), ('Azure mist/web'), ('Baby blue'), ('Baby blue eyes'), ('Baby pink'), ('Ball Blue'), ('Banana Mania'), ('Banana yellow'), ('Battleship grey'), ('Bazaar'), ('Beau blue'), ('Beaver'), ('Beige'), ('Bisque'), ('Bistre'), ('Bittersweet'), ('Black'), ('Blanched Almond'), ('Bleu de France'), ('Blizzard Blue'), ('Blond'), ('Blue'), ('Blue Bell'), ('Blue Gray'), ('Blue green'), ('Blue purple'), ('Blue violet'), ('Blush'), ('Bole'), ('Bondi blue'), ('Bone'), ('Boston University Red'), ('Bottle green'), ('Boysenberry'), ('Brandeis blue'), ('Brass'), ('Brick red'), ('Bright cerulean'), ('Bright green'), ('Bright lavender'), ('Bright maroon'), ('Bright pink'), ('Bright turquoise'), ('Bright ube'), ('Brilliant lavender'), ('Brilliant rose'), ('Brink pink'), ('British racing green'), ('Bronze'), ('Brown'), ('Bubble gum'), ('Bubbles'), ('Buff'), ('Bulgarian rose'), ('Burgundy'), ('Burlywood'), ('Burnt orange'), ('Burnt sienna'), ('Burnt umber'), ('Byzantine'), ('Byzantium'), ('CG Blue'), ('CG Red'), ('Cadet'), ('Cadet blue'), ('Cadet grey'), ('Cadmium green'), ('Cadmium orange'), ('Cadmium red'), ('Cadmium yellow'), ('Café au lait'), ('Café noir'), ('Cal Poly Pomona green'), ('Cambridge Blue'), ('Camel'), ('Camouflage green'), ('Canary'), ('Canary yellow'), ('Candy apple red'), ('Candy pink'), ('Capri'), ('Caput mortuum'), ('Cardinal'), ('Caribbean green'), ('Carmine'), ('Carmine pink'), ('Carmine red'), ('Carnation pink'), ('Carnelian'), ('Carolina blue'), ('Carrot orange'), ('Celadon'), ('Celeste'), ('Celestial blue'), ('Cerise'), ('Cerise pink'), ('Cerulean'), ('Cerulean blue'), ('Chamoisee'), ('Champagne'), ('Charcoal'), ('Chartreuse'), ('Cherry'), ('Cherry blossom pink'), ('Chestnut'), ('Chocolate'), ('Chrome yellow'), ('Cinereous'), ('Cinnabar'), ('Cinnamon'), ('Citrine'), ('Classic rose'), ('Cobalt'), ('Cocoa brown'), ('Coffee'), ('Columbia blue'), ('Cool black'), ('Cool grey'), ('Copper'), ('Copper rose'), ('Coquelicot'), ('Coral'), ('Coral pink'), ('Coral red'), ('Cordovan'), ('Corn'), ('Cornell Red'), ('Cornflower'), ('Cornflower blue'), ('Cornsilk'), ('Cosmic latte'), ('Cotton candy'), ('Cream'), ('Crimson'), ('Crimson Red'), ('Crimson glory'), ('Cyan'), ('Daffodil'), ('Dandelion'), ('Dark blue'), ('Dark brown'), ('Dark byzantium'), ('Dark candy apple red'), ('Dark cerulean'), ('Dark chestnut'), ('Dark coral'), ('Dark cyan'), ('Dark electric blue'), ('Dark goldenrod'), ('Dark gray'), ('Dark green'), ('Dark jungle green'), ('Dark khaki'), ('Dark lava'), ('Dark lavender'), ('Dark magenta'), ('Dark midnight blue'), ('Dark olive green'), ('Dark orange'), ('Dark orchid'), ('Dark pastel blue'), ('Dark pastel green'), ('Dark pastel purple'), ('Dark pastel red'), ('Dark pink'), ('Dark powder blue'), ('Dark raspberry'), ('Dark red'), ('Dark salmon'), ('Dark scarlet'), ('Dark sea green'), ('Dark sienna'), ('Dark slate blue'), ('Dark slate gray'), ('Dark spring green'), ('Dark tan'), ('Dark tangerine'), ('Dark taupe'), ('Dark terra cotta'), ('Dark turquoise'), ('Dark violet'), ('Dartmouth green'), ('Davy grey'), ('Debian red'), ('Deep carmine'), ('Deep carmine pink'), ('Deep carrot orange'), ('Deep cerise'), ('Deep champagne'), ('Deep chestnut'), ('Deep coffee'), ('Deep fuchsia'), ('Deep jungle green'), ('Deep lilac'), ('Deep magenta'), ('Deep peach'), ('Deep pink'), ('Deep saffron'), ('Deep sky blue'), ('Denim'), ('Desert'), ('Desert sand'), ('Dim gray'), ('Dodger blue'), ('Dogwood rose'), ('Dollar bill'), ('Drab'), ('Duke blue'), ('Earth yellow'), ('Ecru'), ('Eggplant'), ('Eggshell'), ('Egyptian blue'), ('Electric blue'), ('Electric crimson'), ('Electric cyan'), ('Electric green'), ('Electric indigo'), ('Electric lavender'), ('Electric lime'), ('Electric purple'), ('Electric ultramarine'), ('Electric violet'), ('Electric yellow'), ('Emerald'), ('Eton blue'), ('Fallow'), ('Falu red'), ('Famous'), ('Fandango'), ('Fashion fuchsia'), ('Fawn'), ('Feldgrau'), ('Fern'), ('Fern green'), ('Ferrari Red'), ('Field drab'), ('Fire engine red'), ('Firebrick'), ('Flame'), ('Flamingo pink'), ('Flavescent'), ('Flax'), ('Floral white'), ('Fluorescent orange'), ('Fluorescent pink'), ('Fluorescent yellow'), ('Folly'), ('Forest green'), ('French beige'), ('French blue'), ('French lilac'), ('French rose'), ('Fuchsia'), ('Fuchsia pink'), ('Fulvous'), ('Fuzzy Wuzzy'), ('Gainsboro'), ('Gamboge'), ('Ghost white'), ('Ginger'), ('Glaucous'), ('Glitter'), ('Gold'), ('Golden brown'), ('Golden poppy'), ('Golden yellow'), ('Goldenrod'), ('Granny Smith Apple'), ('Gray'), ('Gray asparagus'), ('Green'), ('Green Blue'), ('Green yellow'), ('Grullo'), ('Guppie green'), ('Halayà úbe'), ('Han blue'), ('Han purple'), ('Hansa yellow'), ('Harlequin'), ('Harvard crimson'), ('Harvest Gold'), ('Heart Gold'), ('Heliotrope'), ('Hollywood cerise'), ('Honeydew'), ('Hooker green'), ('Hot magenta'), ('Hot pink'), ('Hunter green'), ('Icterine'), ('Inchworm'), ('India green'), ('Indian red'), ('Indian yellow'), ('Indigo'), ('International Klein Blue'), ('International orange'), ('Iris'), ('Isabelline'), ('Islamic green'), ('Ivory'), ('Jade'), ('Jasmine'), ('Jasper'), ('Jazzberry jam'), ('Jonquil'), ('June bud'), ('Jungle green'), ('KU Crimson'), ('Kelly green'), ('Khaki'), ('La Salle Green'), ('Languid lavender'), ('Lapis lazuli'), ('Laser Lemon'), ('Laurel green'), ('Lava'), ('Lavender'), ('Lavender blue'), ('Lavender blush'), ('Lavender gray'), ('Lavender indigo'), ('Lavender magenta'), ('Lavender mist'), ('Lavender pink'), ('Lavender purple'), ('Lavender rose'), ('Lawn green'), ('Lemon'), ('Lemon Yellow'), ('Lemon chiffon'), ('Lemon lime'), ('Light Crimson'), ('Light Thulian pink'), ('Light apricot'), ('Light blue'), ('Light brown'), ('Light carmine pink'), ('Light coral'), ('Light cornflower blue'), ('Light cyan'), ('Light fuchsia pink'), ('Light goldenrod yellow'), ('Light gray'), ('Light green'), ('Light khaki'), ('Light pastel purple'), ('Light pink'), ('Light salmon'), ('Light salmon pink'), ('Light sea green'), ('Light sky blue'), ('Light slate gray'), ('Light taupe'), ('Light yellow'), ('Lilac'), ('Lime'), ('Lime green'), ('Lincoln green'), ('Linen'), ('Lion'), ('Liver'), ('Lust'), ('MSU Green'), ('Macaroni and Cheese'), ('Magenta'), ('Magic mint'), ('Magnolia'), ('Mahogany'), ('Maize'), ('Majorelle Blue'), ('Malachite'), ('Manatee'), ('Mango Tango'), ('Mantis'), ('Maroon'), ('Mauve'), ('Mauve taupe'), ('Mauvelous'), ('Maya blue'), ('Meat brown'), ('Medium Persian blue'), ('Medium aquamarine'), ('Medium blue'), ('Medium candy apple red'), ('Medium carmine'), ('Medium champagne'), ('Medium electric blue'), ('Medium jungle green'), ('Medium lavender magenta'), ('Medium orchid'), ('Medium purple'), ('Medium red violet'), ('Medium sea green'), ('Medium slate blue'), ('Medium spring bud'), ('Medium spring green'), ('Medium taupe'), ('Medium teal blue'), ('Medium turquoise'), ('Medium violet red'), ('Melon'), ('Midnight blue'), ('Midnight green'), ('Mikado yellow'), ('Mint'), ('Mint cream'), ('Mint green'), ('Misty rose'), ('Moccasin'), ('Mode beige'), ('Moonstone blue'), ('Mordant red 19'), ('Moss green'), ('Mountain Meadow'), ('Mountbatten pink'), ('Mulberry'), ('Munsell'), ('Mustard'), ('Myrtle'), ('Nadeshiko pink'), ('Napier green'), ('Naples yellow'), ('Navajo white'), ('Navy blue'), ('Neon Carrot'), ('Neon fuchsia'), ('Neon green'), ('Non-photo blue'), ('North Texas Green'), ('Ocean Boat Blue'), ('Ochre'), ('Office green'), ('Old gold'), ('Old lace'), ('Old lavender'), ('Old mauve'), ('Old rose'), ('Olive'), ('Olive Drab'), ('Olive Green'), ('Olivine'), ('Onyx'), ('Opera mauve'), ('Orange'), ('Orange Yellow'), ('Orange peel'), ('Orange red'), ('Orchid'), ('Otter brown'), ('Outer Space'), ('Outrageous Orange'), ('Oxford Blue'), ('Pacific Blue'), ('Pakistan green'), ('Palatinate blue'), ('Palatinate purple'), ('Pale aqua'), ('Pale blue'), ('Pale brown'), ('Pale carmine'), ('Pale cerulean'), ('Pale chestnut'), ('Pale copper'), ('Pale cornflower blue'), ('Pale gold'), ('Pale goldenrod'), ('Pale green'), ('Pale lavender'), ('Pale magenta'), ('Pale pink'), ('Pale plum'), ('Pale red violet'), ('Pale robin egg blue'), ('Pale silver'), ('Pale spring bud'), ('Pale taupe'), ('Pale violet red'), ('Pansy purple'), ('Papaya whip'), ('Paris Green'), ('Pastel blue'), ('Pastel brown'), ('Pastel gray'), ('Pastel green'), ('Pastel magenta'), ('Pastel orange'), ('Pastel pink'), ('Pastel purple'), ('Pastel red'), ('Pastel violet'), ('Pastel yellow'), ('Patriarch'), ('Payne grey'), ('Peach'), ('Peach puff'), ('Peach yellow'), ('Pear'), ('Pearl'), ('Pearl Aqua'), ('Peridot'), ('Periwinkle'), ('Persian blue'), ('Persian indigo'), ('Persian orange'), ('Persian pink'), ('Persian plum'), ('Persian red'), ('Persian rose'), ('Phlox'), ('Phthalo blue'), ('Phthalo green'), ('Piggy pink'), ('Pine green'), ('Pink'), ('Pink Flamingo'), ('Pink Sherbet'), ('Pink pearl'), ('Pistachio'), ('Platinum'), ('Plum'), ('Portland Orange'), ('Powder blue'), ('Princeton orange'), ('Prussian blue'), ('Psychedelic purple'), ('Puce'), ('Pumpkin'), ('Purple'), ('Purple Heart'), ('Purple Mountain''s Majesty'), ('Purple mountain majesty'), ('Purple pizzazz'), ('Purple taupe'), ('Rackley'), ('Radical Red'), ('Raspberry'), ('Raspberry glace'), ('Raspberry pink'), ('Raspberry rose'), ('Raw Sienna'), ('Razzle dazzle rose'), ('Razzmatazz'), ('Red'), ('Red Orange'), ('Red brown'), ('Red violet'), ('Rich black'), ('Rich carmine'), ('Rich electric blue'), ('Rich lilac'), ('Rich maroon'), ('Rifle green'), ('Robin''s Egg Blue'), ('Rose'), ('Rose bonbon'), ('Rose ebony'), ('Rose gold'), ('Rose madder'), ('Rose pink'), ('Rose quartz'), ('Rose taupe'), ('Rose vale'), ('Rosewood'), ('Rosso corsa'), ('Rosy brown'), ('Royal azure'), ('Royal blue'), ('Royal fuchsia'), ('Royal purple'), ('Ruby'), ('Ruddy'), ('Ruddy brown'), ('Ruddy pink'), ('Rufous'), ('Russet'), ('Rust'), ('Sacramento State green'), ('Saddle brown'), ('Safety orange'), ('Saffron'), ('Saint Patrick Blue'), ('Salmon'), ('Salmon pink'), ('Sand'), ('Sand dune'), ('Sandstorm'), ('Sandy brown'), ('Sandy taupe'), ('Sap green'), ('Sapphire'), ('Satin sheen gold'), ('Scarlet'), ('School bus yellow'), ('Screamin Green'), ('Sea blue'), ('Sea green'), ('Seal brown'), ('Seashell'), ('Selective yellow'), ('Sepia'), ('Shadow'), ('Shamrock'), ('Shamrock green'), ('Shocking pink'), ('Sienna'), ('Silver'), ('Sinopia'), ('Skobeloff'), ('Sky blue'), ('Sky magenta'), ('Slate blue'), ('Slate gray'), ('Smalt'), ('Smokey topaz'), ('Smoky black'), ('Snow'), ('Spiro Disco Ball'), ('Spring bud'), ('Spring green'), ('Steel blue'), ('Stil de grain yellow'), ('Stizza'), ('Stormcloud'), ('Straw'), ('Sunglow'), ('Sunset'), ('Sunset Orange'), ('Tan'), ('Tangelo'), ('Tangerine'), ('Tangerine yellow'), ('Taupe'), ('Taupe gray'), ('Tawny'), ('Tea green'), ('Tea rose'), ('Teal'), ('Teal blue'), ('Teal green'), ('Terra cotta'), ('Thistle'), ('Thulian pink'), ('Tickle Me Pink'), ('Tiffany Blue'), ('Tiger eye'), ('Timberwolf'), ('Titanium yellow'), ('Tomato'), ('Toolbox'), ('Topaz'), ('Tractor red'), ('Trolley Grey'), ('Tropical rain forest'), ('True Blue'), ('Tufts Blue'), ('Tumbleweed'), ('Turkish rose'), ('Turquoise'), ('Turquoise blue'), ('Turquoise green'), ('Tuscan red'), ('Twilight lavender'), ('Tyrian purple'), ('UA blue'), ('UA red'), ('UCLA Blue'), ('UCLA Gold'), ('UFO Green'), ('UP Forest green'), ('UP Maroon'), ('USC Cardinal'), ('USC Gold'), ('Ube'), ('Ultra pink'), ('Ultramarine'), ('Ultramarine blue'), ('Umber'), ('United Nations blue'), ('University of California Gold'), ('Unmellow Yellow'), ('Upsdell red'), ('Urobilin'), ('Utah Crimson'), ('Vanilla'), ('Vegas gold'), ('Venetian red'), ('Verdigris'), ('Vermilion'), ('Veronica'), ('Violet'), ('Violet Blue'), ('Violet Red'), ('Viridian'), ('Vivid auburn'), ('Vivid burgundy'), ('Vivid cerise'), ('Vivid tangerine'), ('Vivid violet'), ('Warm black'), ('Waterspout'), ('Wenge'), ('Wheat'), ('White'), ('White smoke'), ('Wild Strawberry'), ('Wild Watermelon'), ('Wild blue yonder'), ('Wine'), ('Wisteria'), ('Xanadu'), ('Yale Blue'), ('Yellow'), ('Yellow Orange'), ('Yellow green'), ('Zaffre'), ('Zinnwaldite brown');

select s.Colour
from @socks s
where s.RowID = floor(cast(746 * rand(checksum(newid())) + 1 as int))

The random number element, when run separately, returns a number in the valid range of 1 - 746. But when it's used to filter a query, it will return no rows about 25% of the time - maybe more.
I've also tried..
select top 1 s.Colour
from @socks s
where s.RowID between floor(cast(746 * rand(checksum(newid())) + 1 as int))
                  and floor(cast(746 * rand(checksum(newid())) + 1 as int))

But this only ever returned values from the table variable where the RowID is between 1 and 99.
Any suggestions on where I can go next?
Edit:
Apologies for not including this part before - I wrongly assumed a solution to the above would also solve the main issue.
I need to use this in another query, not with joins but as a subquery that returns a different value for each row. For example:
Select 'Socks' as [Clothes],
(select s.Colour from @socks s where s.RowID = floor(cast(746 * rand(checksum(newid())) + 1 as int))) as [Colour],
U.Name,
From do.Users u

This is a simplified version of what I'm trying to do - like I said, I thought working out my random selection issue would resolve it in the main query. Apologies for the poor formatting, I'm on my phone!

A: The function you use to generate random id is evaluated for every row. Basically you're comparing RowId of each row with a new random number. For 746 rows and possible ids, that's (745/746)^746 = 37% chance of getting no result.
You need to generate the id once, and use the same value for all rows:
declare @randomId int = floor(cast(746 * rand(checksum(newid())) + 1 as int))
select s.Colour from @socks s where s.RowID = @randomId

Edit
According to the comments, this solution cannot be used in the context where the query is needed.
There is actually a very simple solution to the problem. The query from the question needs a table scan + filter to get results, that's why the function is evaluated for every row.
We can easily make it an index seek by making RowId a primary key. In that case the query will only perform one index seek, so the function will be evaluated only once. It will perform better too.
declare @socks table
(
    RowID int identity(1,1) primary key,
    Colour nvarchar(70)
);

select s.Colour
from @socks s
where s.RowID = floor(cast(746 * rand(checksum(newid())) + 1 as int)) -- no changes here


text:
Q: How to get the next and previous record using slug in laravel I am trying to get the previous and next record in a project (like a blog post). I have not been able to get the id related to the slug of each project.
Could I do it in the same query in my projectController?
I can assign and get the slug of each project, which is created from the title.
::ProjectController

    public function single($slug){

        $project = Project::with('tools', 'categories')->where('slug', $slug)->firstOrFail();
        $prev = Project::where('id', '<', $project->id)->orderBy('id','desc')->first();
        $next = Project::where('id', '>', $project->id)->orderBy('id')->first();
        return view('project-single',compact('project',$project))
                    ->with('prev',$prev)
                    ->with('next',$next);
    }

::SingleProject.blade.php

 @if($prev ==! null)
                 $prev]) }}" class="animate">

                  Anterior

                @endif

::Route

Route::get('/proyectos/{slug}', 'ProjectController@single')->name('project.single');

A: What about this:
$project = Project::with('tools', 'categories')->where('slug', $slug)->firstOrFail();

$more = Project::whereIn('id', [$project->id - 1, $project->id + 1])->get();
$prev = $more->where('id', '<', $project->id)->first();
$next = $more->where('id', '>', $project->id)->first();

A: I solve the problem:
::projectController

 public function single($slug){
        $project = Project::with('tools', 'categories')->where('slug', $slug)->firstOrFail();
        $next = Project::where('id', '>', $project->id)->min('id');
        $prev = Project::where('id', '<', $project->id)->max('id');

        return view('project-single',compact('project',$project))
                    ->with('prev',Project::find($prev))
                    ->with('next',Project::find($next));
    }

:::view

 @if($prev ==! null)
                 $prev->slug]) }}" class="animate">

                  Anterior

                @endif


text:
Q: How to include a local repository that contains spaces in the Remotes field of an R package DESCRIPTION? One of the dependecies for an R package I'm developing is in a local directory. Using devtools/remotes I can specify this dependency by including Remotes: local::/path/to/the_repository in the package DESCRIPTION.
However, the path I need to access contains spaces and I cannot figure out how to specify it correctly.
So far I've tried quoting (local::"~/path/to/the repository") and escaping (local::~/path/to/the\ repository) but I still get
Error: Missing commas separating Remotes

Any suggestion?

A: I am not sure how to solve this one. Perhaps backticks would work?
local::`~/path/to/the repository`

Good luck!


text:
Q: How to get File from DocumentFile in android version 29+ for File Manager App? I am developing File Manager, I have one issue in android version 30, when I get listFile() of OTG path its not return file, the only way to get all files is from DocumentFile, but now I want to get file as File from that DocumentFile how do I get, plz support me.

A: You don't.  There's no promise that there is an actual File anywhere, it could be backed by a content provider calculating it at runtime, or reading it from a db.  Since a File can only represent a file on disk, there's no way to convert from a DocumentFile to a File.

A: USB OTG drives are often not mentioned any more in getExternalFilesDirs().
So you have no path.
Only with SAF ACTION_GET_DOCUMENT_TREE you can get an uri to the drive or folders on the drive.
Now its pretty easy to convert such an uri to a flie system path.(Look at all kinds of getRealFileForUri() implementations).
But even if you manage to get a path it is not usable.


text:
Q: choosing correct handler based on CLI options I am currently building a simple command-line application in C#. To help me with parsing and other under-the-hood stuff I use .NET System.CommandLine library. The approach for implementing options and setting handlers is identical to what Microsoft uses in their docs for the library. The tool is meant to be used as follows:
program -a aArgument -b -c cArgument
program -b -c cArgument

-a, -b and -c are all CLI options. Then, I implemented a handler method, which executes the correct set of methods depending on which options are used.
internal static void HandleOptions(string aOpt, string bOpt, string cOpt){
    if (aOpt != null && bOpt != null && cOpt != null)
    {
        method1();
        method2();
    }
    else if (aOpt == null && bOpt != null && cOpt != null)
    {
        method3();
    }
    else if (aOpt != null && bOpt == null && cOpt != null)
    {
        method4();
    }
...
}

However, this approach is not extensible in the long run, since as I continue adding more options, the if-else statements get complicated. What would be a good design pattern to solve this issue?


text:
Q: Display available stack memory in Java I am trying to display the consumed stack space during a recursive program execution, like inorder traversal of a tree. Is there a way to print the available stack space in Java, I know that available heap memory could be displayed using Runtime.getRuntime().freeMemory().

A: Java doesn't give you access to this kind of information, for various reasons:

*

*keeping track of that information might actually make some kinds of optimizations impossible

*giving an exact number at a certain point might slow down the execution (due to a potentially necessary de-optimization).

*the exact amount of available space left might vary over time (for example if stack space were dynamically allocated from a shared space and not fixed).

*Any value you might get is very likely to only be of limited value (as you can't know for sure how many bytes a given method invocation needs in various scenarios).

The closest you can get is to get a current stack trace (for example using Thread.getStackTrace()) and check the returned arrays size to know how many stack frames are in use (i.e. how deep the stack already is).
But even that operation is likely to be somewhat costly.


text:
Q: Spring Boot Tomcat configuration Total time: 03:24 min
 Finished at: 2017-01-16T21:31:55-06:00
 Final Memory: 79M/508M

How can I set the maximum long running time of tomcat server in spring boot?
If its time is overdue then it throws Exception.


text:
Q: I'm Receiving Invalid Hook Call error either from inside a functional component In my project I have the index.tsx calling the App.tsx that uses a UserProvider and AuthProvider. I received an invalid call error from inside the UserProvider because I'm using the useState hook.
This problem occurs also if I create a custom hook, I can't use any hook inside the custom hook.
This is my index.tsx:
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
//import './commons/global.css';
import reportWebVitals from './reportWebVitals';

import App from './App';
import { BrowserRouter } from 'react-router-dom';

ReactDOM.render(
  <BrowserRouter>
    <App />
  </BrowserRouter>,
  document.getElementById('root'),
);

reportWebVitals();

This is my App.tsx:
import { useEffect, useState } from 'react';
import { BrowserRouter, useNavigate } from 'react-router-dom';
import {
  AuthService,
  AuthProvider,
  useAuth,
  useLogin,
  UserProvider,
} from 'reactjs-oauth2-pkce-provider';

import './index.css';
import Routes from './routes';

const authService = new AuthService({...});

const App = () => {
  const [user, setUser] = useState({});
  const [loading, setLoading] = useState(true);

  // for every refresh of the page, check if there is a user in localStorage
  useEffect(() => {
    const user = localStorage.getItem('user');

    if (user) {
      setUser(JSON.parse(user));
    }

    setLoading(false);
  }, []);

  return (
    <UserProvider>
      <AuthProvider authService={authService}>
        <Routes />
      </AuthProvider>
    </UserProvider>
  );
};

export default App;

This is my UserProvider.tsx:
import React, { ReactElement, useState } from 'react';
import { UserContext } from '@app/application/UserContext';

export const UserProvider = ({ children }: { children: ReactElement }) => {
  const [user, setUser] = useState({});

  console.log(user);
  return (
    <UserContext.Provider value={{ user, setUser }}>
      {children}
    </UserContext.Provider>
  );
};

*

*There is no function that is calling the hook outside a functional component (there is?)!

*A important thing to note is that the UserProvider.tsx is part of a separate package for authentication that I'm building and importing from it with yarn link.

*I already tested to install directly from github without success.

*I already tested declaring the function with React.FC type but the result is the same.

The understanding that I have from it until now is that the react do not know that the App() function is a functional component and the call for UserProvider is inside a functional component.
I'm expecting that I can use hooks inside the provider, to work useState, useEffect, useNavigate.

A: The error message is telling you that your error is in fact originating from your Hook call in UserProvider.tsx at line 5.
When you don't import components traditionally as react Components such as
<Component/>

and instead import them as a function such as
return component();

or as in your case, importing them as a wrapper:
<Component>Parent</Component>

Then React hooks won't work.
I would recommend using Redux for logins or the useContext Hook to manage logins if you can't figure out the Traditional React Hooks way of managing this. useContext is also a React hook which would cause the same error if implemented in a similar way, but Redux wouldn't cause you to adhere to any of these strict React rules..
There's a lot of existing Login Templates on Github, including ones with Redux. Implementing Logins is the most boring and tedious process I've dealt with, which can usually take extremely long. Traditionally I use App Skeletons with login capabilities already implemented, and then add all the fun code over, but try the suggestions I mentioned.

A: The error message that you posted contains three possible reasons for the error.  Based on the information that you've provided, reason #3 seems like the most likely culprit.

*

*You might have mismatching versions of React and React DOM.

*You might be breaking the Rules of Hooks.

*You might have more than one copy of React in the same app.

I don't see anywhere in your code, at least not in what you've posted, that you are violating the rules of hooks.
It's what you've said here that jumps out:

A important thing to note is that the UserProvider.tsx is part of a separate package for authentication that I'm building and importing from it with yarn link.

I suspect that your reactjs-oauth2-pkce-provider package is declaring react in the dependencies rather than the peerDependencies.  This would cause you to have two copies of react -- one from the package and another from your main app.  If these two versions don't match, you could be dealing with reason #1 as well.
The "Duplicate React" section of the docs contains a few checks that you can do to confirm that you do in fact have two copies of React.

If you see more than one React, you'll need to figure out why this happens and fix your dependency tree. For example, maybe a library you're using incorrectly specifies react as a dependency (rather than a peer dependency).

Since this is a package that you created and control, you can fix the problem at its root.  the solution is to remove react from the dependencies array in your package's package.json and move it to the peerDependencies array instead.  You may also need it in the devDependencies.  Here is a good example.


text:
Q: iPhone upload image speed advice I have an app that allows you to take a picture, adjust the jpeg quality size (10-100%) and then send it to a server using ASIFormDataRequest (part of the ASIHTTPRequest implementation). This works fine over a network connection, but over the celluar network it appears to sit there for 5-10 minutes attempting to transmit the image post data, before failing (even with the quality at 10%).
On comparing this to the image uploads that the Twitter and Facebook apps provide (which take ~30 seconds to a minute) this isn't exactly ideal. I wondered if anyone could give me any advice about either how to speed up my data transfer, or monitor it so I can see exactly where the problem lies.
Once I get back to my mac laptop tonight I'll post a code snippet of exactly what it is I'm doing, in case that helps.
EDIT: Heres the code snippet:
NSURL *url = [NSURL URLWithString:@"...upload.php"];
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
NSTimeInterval time = [[NSDate date] timeIntervalSince1970];
NSString *fileName = [NSString stringWithFormat:@"%d", time];
...
float compressionRate = [userAccountView getCompressionRate];
NSLog(@"Compression rate: %.1f", compressionRate);
NSData *imageData = UIImageJPEGRepresentation(imageForView, compressionRate);
[request setData:imageData withFileName:fileName andContentType:@"image/jpeg" forKey:@"userfile"];
[request setDelegate:self];
[request startAsynchronous];

The .. code comment is where I just stick an 'uploading' image over the view. I suppose I could make the call synchronous as opposed to asynchronous, do you think that may improve performance? I have left it that way in case at a later stage I wanted to allow the user to do other bits while it is uploading.
Any advice would be great :)
Thanks,
Dan
EDIT:
Jesse, thanks for the comment - I added in [request setUploadProcessDelegate:self] and put in the required method to monitor the data that was being sent, and it all seemed to be sending okay.
JosephH - I have added in "[ASIHTTPRequest setShouldThrottleBandwidthForWWAN:YES]" as suggested, and have also added "set_time_limit(0);" into the PHP upload script (in case of timeouts) and now the data does seem to be sending and being retrieved over the cellular network, so horray! Am playing around now with file compressions etc. to find the best one for the best quality. ATM it seems like 0.3 is pretty good quality, and transfers in roughly 30 seconds or so, which is what I was looking for!
I was also incorrectly setting the compression rate, as I was using 10-100 as opposed to 0.0-1.0, so I have also corrected that.
Thanks for your quick help guys in solving my issue!!

A: I think the first thing to do is to check what size the data you're sending is:
 NSLog(@"imageData size = %d", [imageData length]);

Does your NSLog correctly show the compressionRate is set to 0.1 for 10%?
ASIHTTPRequest also has a lot of debug logging you can enable - see ASIHTTPRequestConfig.h; just change everything from 0 to 1. It may not reveal anything of interest, but it is certainly worth looking at.
Are you calling [ASIHTTPRequest setShouldThrottleBandwidthForWWAN:YES] ?
When it fails, how does it fail, what is the error, what does any logging on the server show?
(If you find out anything extra, please do edit it into the question and post a comment and I'll take another look)


text:
Q: Stopping Locked On-Demand/Triggered Azure Webjob I have a "Triggered" Webjob in Azure that is stuck on "Running"
It has been in this state for two days, it is scheduled to run every 5 minutes.
This Webjob has previously worked without any problem. This problem seems to have occurred on a Saturday (my timezone), which means that no one was playing with it when it broke.
What I have tried so far:

*

*Restarting the site the Webjob is attached to.

*Running the job manually from the azure portal*

*Redeploying the site

*Setting WEBJOBS_STOPPED=1 in App Settings

*Changing the schedule time from 5 minutes to 6 minutes

*This gave me an error:
Could not run job: 'EnrolmentProcessor'.
Please try again. If the problem persists, contact support.

All of these have not affected the process and it is still stuck in a "Running" State.
I have looked at the folders from the KUDU debug console and have noticed the following:
The process where it has failed has these log lines:
[04/15/2016 22:20:02 > 1e4ce4: SYS INFO] Status changed to Initializing
[04/15/2016 22:20:02 > 1e4ce4: SYS INFO] Run script 'TERACC.WebJob.EnrolmentProcessor.exe' with script host - 'WindowsScriptHost'
[04/15/2016 22:20:02 > 1e4ce4: SYS INFO] Status changed to Running

The previous process that succeeded has these log lines:
[04/15/2016 22:15:01 > 1e4ce4: SYS INFO] Status changed to Initializing
[04/15/2016 22:15:01 > 1e4ce4: SYS INFO] Run script 'TERACC.WebJob.EnrolmentProcessor.exe' with script host - 'WindowsScriptHost'
[04/15/2016 22:15:01 > 1e4ce4: SYS INFO] Status changed to Running
[04/15/2016 22:18:51 > 1e4ce4: SYS INFO] Status changed to Success

There is a file named triggeredJob.lock which has the following StackTrace at the time of failure:
2016-04-15T22:20:02   at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)
   at System.Environment.get_StackTrace()
   at Kudu.Core.Infrastructure.LockFile.WriteLockInfo(Stream lockStream)
   at Kudu.Core.Infrastructure.LockFile.Lock()
   at Kudu.Core.Jobs.TriggeredJobRunner.StartJobRun(TriggeredJob triggeredJob, JobSettings jobSettings, String trigger, Action`2 reportAction)
   at Kudu.Core.Jobs.TriggeredJobsManager.InvokeTriggeredJob(String jobName, String arguments, String trigger)
   at Kudu.Services.Jobs.JobsController.InvokeTriggeredJob(String jobName, String arguments)
   at lambda_method(Closure , Object , Object[] )
   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.<GetExecutor>b__9(Object instance, Object[] methodParameters)
   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments)
   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)
   at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__0.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.Start[TStateMachine](TStateMachine& stateMachine)
   at System.Web.Http.Controllers.ApiControllerActionInvoker.InvokeActionAsyncCore(HttpActionContext actionContext, CancellationToken cancellationToken)
   at System.Web.Http.Controllers.ApiControllerActionInvoker.InvokeActionAsync(HttpActionContext actionContext, CancellationToken cancellationToken)
   at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>b__0(ActionInvoker innerInvoker)
   at System.Web.Http.Controllers.ActionFilterResult.<>c__DisplayClass10`1.<InvokeActionWithActionFilters>b__f()
   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.Start[TStateMachine](TStateMachine& stateMachine)
   at System.Web.Http.Filters.ActionFilterAttribute.CallOnActionExecutedAsync(HttpActionContext actionContext, CancellationToken cancellationToken, Func`1 continuation)
   at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__0.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.Start[TStateMachine](TStateMachine& stateMachine)
   at System.Web.Http.Filters.ActionFilterAttribute.ExecuteActionFilterAsyncCore(HttpActionContext actionContext, CancellationToken cancellationToken, Func`1 continuation)
   at System.Web.Http.Filters.ActionFilterAttribute.System.Web.Http.Filters.IActionFilter.ExecuteActionFilterAsync(HttpActionContext actionContext, CancellationToken cancellationToken, Func`1 continuation)
   at System.Web.Http.Controllers.ActionFilterResult.<>c__DisplayClassb.<>c__DisplayClassd.<InvokeActionWithActionFilters>b__9()
   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.Start[TStateMachine](TStateMachine& stateMachine)
   at System.Web.Http.Filters.ActionFilterAttribute.CallOnActionExecutedAsync(HttpActionContext actionContext, CancellationToken cancellationToken, Func`1 continuation)
   at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__0.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.Start[TStateMachine](TStateMachine& stateMachine)
   at System.Web.Http.Filters.ActionFilterAttribute.ExecuteActionFilterAsyncCore(HttpActionContext actionContext, CancellationToken cancellationToken, Func`1 continuation)
   at System.Web.Http.Filters.ActionFilterAttribute.System.Web.Http.Filters.IActionFilter.ExecuteActionFilterAsync(HttpActionContext actionContext, CancellationToken cancellationToken, Func`1 continuation)
   at System.Web.Http.Controllers.ActionFilterResult.<>c__DisplayClassb.<>c__DisplayClassd.<InvokeActionWithActionFilters>b__9()
   at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.Start[TStateMachine](TStateMachine& stateMachine)
   at System.Web.Http.Controllers.ActionFilterResult.ExecuteAsync(CancellationToken cancellationToken)
   at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__0.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.Start[TStateMachine](TStateMachine& stateMachine)
   at System.Web.Http.Controllers.ExceptionFilterResult.ExecuteAsync(CancellationToken cancellationToken)
   at System.Web.Http.ApiController.ExecuteAsync(HttpControllerContext controllerContext, CancellationToken cancellationToken)
   at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__1.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.Start[TStateMachine](TStateMachine& stateMachine)
   at System.Web.Http.Dispatcher.HttpControllerDispatcher.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Net.Http.HttpMessageInvoker.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Web.Http.Dispatcher.HttpRoutingDispatcher.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Net.Http.DelegatingHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Web.Http.HttpServer.<SendAsync>d__0.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.Start[TStateMachine](TStateMachine& stateMachine)
   at System.Web.Http.HttpServer.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Net.Http.HttpMessageInvoker.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Web.Http.WebHost.HttpControllerHandler.<ProcessRequestAsyncCore>d__0.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine)
   at System.Web.Http.WebHost.HttpControllerHandler.ProcessRequestAsyncCore(HttpContextBase contextBase)
   at System.Web.Http.WebHost.HttpControllerHandler.ProcessRequestAsync(HttpContext context)
   at System.Web.HttpTaskAsyncHandler.<>c__DisplayClass4_0.<System.Web.IHttpAsyncHandler.BeginProcessRequest>b__0()
   at System.Web.TaskAsyncHelper.BeginTask(Func`1 taskFunc, AsyncCallback callback, Object state)
   at System.Web.HttpTaskAsyncHandler.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData)
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
   at System.Web.HttpApplication.PipelineStepManager.ResumeSteps(Exception error)
   at System.Web.HttpApplication.BeginProcessRequestNotification(HttpContext context, AsyncCallback cb)
   at System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context)
   at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)
   at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)
   at System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr pHandler, RequestNotificationStatus& notificationStatus)
   at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)
   at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)

This indicates to me that something has gone wrong when trying to process the Webjob and left it in this corrupt state.
I am not worried about losing data in the process that is "running", I just need to get the Webjob running properly again. What can I do to abort the one it is stuck on and get it to start up again?

A: It seems that it got into a bad state. I think the key is to delete that triggeredJob.lock file. The problem is that it's locked and doesn't want to get deleted.
Please try these steps to see if that allows deletion:

*

*Stop both the site and the SCM site using these special steps

*Connect using FTP and delete the lock file

*Restart the site (e.g. from portal)

If that doesn't work, we'll try something else. I'd like to understand the root cause, but let's try to get you running first.


text:
Q: How to mock rows in a Excel VSTO plugin? I am trying to put a mocked Range (which contains cells with values) inside the rows of a new Range. But when I try to access a specific element from the Range, a exception is thrown.
I've tried everything, does anyone have a idea what I am doing wrong here?
Exception

Message: Test method xxx.MockUtilsTest.MockRowsTest threw exception:
  Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: Cannot apply
  indexing with [] to an expression of type 'Castle.Proxies.RangeProxy'

Test
[TestMethod]
public void MockRowsTest()
{
    var row1 = MockUtils.MockCells("test_row_1", "test_row_1");
    var row2 = MockUtils.MockCells("test_row_2", "test_row_2");
    var range = MockUtils.MockRows(row1, row2);

    Assert.IsNotNull(range);
    Assert.AreEqual(2, range.Count);
    Assert.IsNotNull(range.Rows);
    Assert.AreEqual(2, range.Rows.Count);
    Assert.AreSame(row1, range.Rows[1].Cells[1]); // exception is thrown here
    Assert.AreSame(row2, range.Rows[2].Cells[1]);
    Assert.AreEqual("test_row_1", range.Rows[1].Cells[1].Value2);
    Assert.AreEqual("test_row_2", range.Rows[2].Cells[1].Value2);
}

MockUtils
public static Range MockCellValue2(Object value)
{
    var cell = new Moq.Mock<Range>();
    cell.Setup(c => c.Value2).Returns(value);

    return cell.Object;
}

public static Range MockCells(params Object[] values)
{
    var cells = new Moq.Mock<Range>();
    for (int i = 0; i < values.Length; i++)
    {
        var cell = MockCellValue2(values[i]);
        cells.SetupGet(c => c[i + 1, Moq.It.IsAny<Object>()]).Returns(cell);
    }

    var row = new Moq.Mock<Range>();
    row.SetupGet(r => r.Cells).Returns(cells.Object);
    row.SetupGet(r => r.Count).Returns(values.Length);

    return row.Object;
}

public static Range MockRows(params Range[] rows)
{
    var mergedRows = MergeRanges(rows);
    var range = new Moq.Mock<Range>();
    range.SetupGet(r => r.Count).Returns(rows.Length);
    range.SetupGet(r => r.Rows).Returns(() => mergedRows);
    range.Setup(r => r.GetEnumerator()).Returns(rows.GetEnumerator());

    return range.Object;
}

public static Range MergeRanges(params Range[] ranges)
{
    var range = new Moq.Mock<Range>();
    for (int i = 0; i < ranges.Length; i++)
    {
        range.SetupGet(r => r[i + 1, Moq.It.IsAny<Object>()]).Returns(ranges[i]);
    }

    range.SetupGet(r => r.Count).Returns(ranges.Length);
    range.Setup(r => r.GetEnumerator()).Returns(ranges.GetEnumerator());

    return range.Object;
}

A: The indexer of Range returns a dynamic object, this is the source of your problem.

Moq use Castle Dynamic proxy to generate fake objects, Castle.Proxies.RangeProxy is the generated class in your case. Since this object is not a COM object the processing of those the C# Runtime binder is being called. The Runtime binder resolves the type and looking for the indexer method, but he failed to resolve it because the generated class don't have it.
The easiest way to solve your is to return the indexer result to a strict Range local variable:

Then your test will fail because range.Rows[1] is equals to row1...
So change your test code to:
[TestMethod]
public void MockRowsTest()
{
    var row1 = MockUtils.MockCells("test_row_1", "test_row_1");
    var row2 = MockUtils.MockCells("test_row_2", "test_row_2");
    var range = MockUtils.MockRows(row1, row2);

    Assert.IsNotNull(range);
    Assert.AreEqual(2, range.Count);
    Assert.IsNotNull(range.Rows);
    Assert.AreEqual(2, range.Rows.Count);
    Range x = range.Rows[1];
    Range y = range.Rows[2];
    var xCell = x.Cells[1];
    var yCell = y.Cells[1];
    Assert.AreSame(row1, x);
    Assert.AreSame(row2, y);
    Assert.AreEqual("test_row_1", xCell.Value2);
    Assert.AreEqual("test_row_2", yCell.Value2);
}

The above UT will pass the test. IMO you should to break your aggregation calls to "atomic OPS(multi line) and methods" not because it will pass the test, because it will make your code a debug friendly code.(I call that "the 11TH rule" where your code will be read a least 10 more times from the time it was written... So let the compiler to remove the transitive local variables and make your it a debug friendly code..).
Here you can read a simple and short explanation with links on how dynamic works in c#.
Here you can read more about Castle Dynamic Proxy.
BTW; you also can do:
Range x = range.Rows[1].Cells;
var str = x[1].Value2;

to receive the value


text:
Q: Rails 3 Exception Notification error I am converting a rails 2.3.5 app to rails 3 app. I am getting an error in the below code
the error
Undefined method `filter_sensitive_post_data_parameters' for #<#<Class:0x0000010726a478>:0x000001069e7080>

in app/views/exception_notifier/_request.rhtml
  <% if @request.respond_to?(:protocol) %>
        * URL       : <%= @request.protocol %><%= @host %><%= @request.request_uri %>
        * IP address: <%= @request.env["HTTP_X_FORWARDED_FOR"] || @request.env["REMOTE_ADDR"] %>
        * Parameters: <%= send(:filter_sensitive_post_data_parameters,@request.parameters).inspect %>
        * Rails root: <%= @rails_root %>
        <% else  %>
        * Exception did not occur in controller, and was recoverable.
        <% end %>

stuck for 3 hours. Please help

A: It maybe because this method doesn't exist anymore in Rails 3. Change it by request.filtered_parameters()
<% if request.respond_to?(:protocol) %>
        * URL       : <%= request.protocol %><%= @host %><%= request.request_uri %>
        * IP address: <%= request.env["HTTP_X_FORWARDED_FOR"] || request.env["REMOTE_ADDR"] %>
        * Parameters: <%= request.filtered_parameters().inspect %>
        * Rails root: <%= @rails_root %>
<% else  %>
        * Exception did not occur in controller, and was recoverable.
<% end %>


text:
Q: Retrieve Map Data in Firebase to Flutter I have this data structure
Database Structure
I need to call all the item in the FavDestination collection and here is my code in Flutter
child: StreamBuilder(
stream: Firestore.instance.collection('FavDestination').snapshots(),
builder: (context, snapshot){
if(!snapshot.hasData) return Text('Loading Data... Please Wait');
return
ListView.builder(
scrollDirection: Axis.horizontal,
itemCount: snapshot.data.documents.length, //snapshot.data.document.length,
itemBuilder: (BuildContext context, int index) {
DocumentSnapshot destination = snapshot.data.documents[index];
//DocumentSnapshot destination = snapshot.data.document[index];
return GestureDetector(
                  onTap: () => Navigator.push(
                    context,
                    MaterialPageRoute(
                      builder: (_) => DestinationScreen(
                        destination: destination,
                      ),
                    ),
                  ),

It retrieves the data successfully, and if the user taps on the document, it will go to Destination Screen and I need to retrieve all the data in activities, here is my code in the Destination Screen
Expanded(
        child: ListView.builder(
          padding: EdgeInsets.only(top: 10.0, bottom: 15.0),
          itemCount: widget.destination['activities'].length,
          itemBuilder: (BuildContext context, int index) {
            DocumentSnapshot activity = widget.destination['activities'][index];
            return Stack(
              children: <Widget>[
                  Row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: <Widget>[
                       Container(
                          width: 120.0,
                          child: Text(
                          activity['name'],
                          style: TextStyle(
                          fontSize: 18.0,
                          fontWeight: FontWeight.w600,
                          ),

and here is the Error I got
Error Message
any idea how to solve it? Thank you

A: It seems that your activities field is nested map. On first level you have field Bali1 which is map as well. And it the code activity is trying to get name on first level.
I suppose you should work more on destination object structure. You can print it out to analyze and try to map object like Map<dynamic, dynamic> and Bali1 as well.
I don't have playground to do it fast, but I found similar approach here:
How do I get specific values from a datasnapshot in flutter?
I hope it will help!


text:
Q: how to create multi company group on facebook workplace using graph api I have created an app in facebook workplace. Using app access token i want to create multi company group . As per documentaion to create group we should use
POST graph.facebook.com
  /{community-id}/groups?
    name={...}&
    description={...}&
    privacy=OPEN

So how we can create a multi company group ?

A: you can't create MCG through APIs.
The APIs are not available in the MCG, except few use cases like read the post on behalf of a member of the group.


text:
Q: Pygame Black Box Code:
import pygame
pygame.init()
screen = pygame.display.set_mode((400, 400))

What happens:
The pygame screen pulls up, but there is a black box covering the top right-hand corner of the screen. I would post a picture but stack overflow wouldn't let me.

A: Yes, so what are you trying to make happen?
pygame.display.set_mode((0, 0)) should make that box full screen. Is that your objective?


text:
Q: Why is the 'if statement' getting ignored? print("10 apples on a tree")
userChoice = input("Would you like to change the amount on apples ([Y]/[N]): ")

if userChoice == 'Y':
appleAmount = input("Please enter the amount of apples: ")

if appleAmount == 1:
    print("1 apple on a tree")
else:
    print(appleAmount, "apples on a tree")

if userChoice == 'N':
print("Okay.")

When ever I run my code, and enter '1'. It prints out "1 apples on a tree" instead of "1 apple on a tree" as I have wrote it. Struggling to pin point the problem.
My goal is, allowing the user to modify the amount of apples. If they decide to type in '1' then the word "apples" needs to change to "apple".
I have googled around and this is how everyone does the if statements but surely somethings wrong somewhere or have I missed something out.

A: because of the indentation, also the type of appleAmount should be int:
print("10 apples on a tree")
userChoice = input("Would you like to change the amount on apples ([Y]/[N]): ")

if userChoice == 'Y':
    appleAmount = int(input("Please enter the amount of apples: "))

if appleAmount == 1:
    print("1 apple on a tree")
else:
    print(appleAmount, "apples on a tree")

if userChoice == 'N':
    print("Okay.")

A: Actually, I think it's because you're checking the integer 1 and not the string "1". Returns from input() are strings, so either change them to integers to compare, or in this case just compare to the string version of 1:
print("10 apples on a tree")
userChoice = input("Would you like to change the amount on apples ([Y]/[N]): ")

if userChoice == 'Y':
    appleAmount = input("Please enter the amount of apples: ")

if appleAmount == "1":
    print("1 apple on a tree")
else:
    print(appleAmount, "apples on a tree")

if userChoice == 'N':
    print("Okay.")

A: change this:
if appleAmount == 1:
to this:
if int(appleAmount) == 1:
input() returns a string, thats why the if statement is not working.