Q: Inspect variable outside of anonymous class in Eclipse is it possible to get the value of a final variable declared outside an anonymous class (where the debugger currently is) in Eclipse?  For example:
    final int x = 5;
    new Object() {
        {
            System.out.println(x);
        }
    };

This will compile and print "5", but if I try to inspect x on the println line I get the error "x cannot be resolved to a variable".

A: Expand the "this" item on Variables view; it contains variable val$x where you can see the x and it's value.


Q: How to obtain the returned cookie after a POST in PHP? Let's say I have a website called (example.com) which will have a php file (example.com/call.php).
call.php will have a post method that will post to the website exampleOne.com/login.php with the right parameters. exampleOne.com will return a header with a cookie that will confirm the authentication of the user, how do I obtain the cookie or at least check if the header includes Set-Cookie in  order to be informed that the user is authenticated?
If this is not clear enough please let me know in the comments and I will try my best to clear everything up.
(UPDATE 1: so the idea is that, how do I know that the other domain I am posting to has set up the cookie because the fact that the cookie has been set up (Set-cookie != null or "") means that the username and password are in fact correct)
(Update 2 so my issue is that I want to make sure that user is a member of some forum which does not have an API and I cannot authenticate to that forum because i don't have access to their records, however, that forum authenticate the user and sets a cookie if the information is right and I want to be able to see that cookie to make sure I understand that the user is authenticated - hope this helps)

A: You can use this code to do what you want.  Pretty much you're just simulating a client when you do this by writing a HTTP request to a page and then processing the response headers that it sends back.  This is also how you would build a proxy server, but that is sort of what you're doing.
Let me know if you need any help.
//
// OPEN SOCKET TO SERVER
//

$_socket = @fsockopen($host, $port, $err_no, $err_str, 30);

//
// SET REQUEST HEADERS
//

$_request_headers  = '... CONSTRUCT FULL HEADERS HERE ...';

fwrite($_socket, $_request_headers);

//
// PROCESS RESPONSE HEADERS
//

$_response_headers = $_response_keys = array();
$line = fgets($_socket, 8192);

while (strspn($line, "\r\n") !== strlen($line))
{
    @list($name, $value) = explode(':', $line, 2);
    $name = trim($name);
    $_response_headers[strtolower($name)][] = trim($value);
    $_response_keys[strtolower($name)] = $name;
    $line = fgets($_socket, 8192);
}

sscanf(current($_response_keys), '%s %s', $_http_version, $_response_code);

if (isset($_response_headers['set-cookie']))
{
    // DO WHAT YOU WANT HERE
}

For reference, you can find similar code in PHProxy that goes into much more detail.  It will create headers for you, process response headers, and more.  If you find that this example doesn't do everything you need, you should reference that software.


Q: FIELDDATA Data is too large I open kibana and do a search and i get the error where shards failed. I looked in the elasticsearch.log file and I saw this error:
org.elasticsearch.common.breaker.CircuitBreakingException: [FIELDDATA] Data too large, data for [@timestamp] would be larger than limit of [622775500/593.9mb]

Is there any way to increase that limit of 593.9mb?

A: You can try to increase the fielddata circuit breaker limit to 75% (default is 60%) in your elasticsearch.yml config file and restart your cluster:
indices.breaker.fielddata.limit: 75%

Or if you prefer to not restart your cluster you can change the setting dynamically using:
curl -XPUT localhost:9200/_cluster/settings -d '{
  "persistent" : {
    "indices.breaker.fielddata.limit" : "40%"
  }
}'

Give it a try.

A: I meet this problem,too.
Then i check the fielddata memory.
use below request:
GET /_stats/fielddata?fields=*

the output display:
"logstash-2016.04.02": {
  "primaries": {
    "fielddata": {
      "memory_size_in_bytes": 53009116,
      "evictions": 0,
      "fields": {

      }
    }
  },
  "total": {
    "fielddata": {
      "memory_size_in_bytes": 53009116,
      "evictions": 0,
      "fields": {

      }
    }
  }
},
"logstash-2016.04.29": {
  "primaries": {
    "fielddata": {
      "memory_size_in_bytes":0,
      "evictions": 0,
      "fields": {

      }
    }
  },
  "total": {
    "fielddata": {
      "memory_size_in_bytes":0,
      "evictions": 0,
      "fields": {

      }
    }
  }
},

you can see my indexes name base datetime, and evictions is all 0. Addition, 2016.04.02 memory is 53009116, but 2016.04.29 is 0, too.
so i can make conclusion, the old data have occupy all memory, so new data cant use it, and then when i make agg query new data , it raise the CircuitBreakingException
you can set config/elasticsearch.yml
indices.fielddata.cache.size:  20%

it make es can evict data when reach the memory limit.
but may be the real solution you should add you memory in furture.and monitor the fielddata memory use is good habits.
more detail: https://www.elastic.co/guide/en/elasticsearch/guide/current/_limiting_memory_usage.html

A: Alternative solution for CircuitBreakingException: [FIELDDATA] Data too large error is cleanup the old/unused FIELDDATA cache.
I found out that fielddata.limit been shared across indices, so deleting a cache of an unused indice/field can solve the problem.
curl -X POST "localhost:9200/MY_INDICE/_cache/clear?fields=foo,bar"

For more info https://www.elastic.co/guide/en/elasticsearch/reference/7.x/indices-clearcache.html

A: I think it is important to understand why this is happening in the first place.
In my case, I had this error because I was running aggregations on "analyzed" fields. In case you really need your string field to be analyzed, you should consider using multifields and make it analyzed for searches and not_analyzed for aggregations.

A: I ran into this issue the other day. In addition to checking the fielddata memory, I'd also consider checking the JVM and OS memory as well. In my case, the admin forgot to modify the ES_HEAP_SIZE and left it at 1gig.

A: just use:
ES_JAVA_OPTS="-Xms10g -Xmx10g" ./bin/elasticsearch

since the default heap is 1G, if your data is big ,you should set it bigger


Q: UITableView - how to recognize a cancel deletion? After the classic swipe to delete, there are two possibilities,

*

*The user has pressed the "Delete" Button, so this function is fired:

*(void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath

*The user has pressed outside the button, so the edit state is cancelled.

Does anyone knows which function (if it exists) is fired when the editing is cancelled, or how can I catch this event? so I can do some stuff right after the deletion is cancelled.
Thanks.

A: When the edit state is finished, you'll know via the UITableViewDelegate method - (void)tableView:(UITableView *)tableView didEndEditingRowAtIndexPath:(NSIndexPath *)indexPath
You just need to figure out how to differentiate between a delete and a cancel. You'll know it's a delete if the data source "tableView:commitEditingStyle:forRowAtIndexPath:" method is called.  If it isn't, then the user cancelled.


Q: Black Matlab image after saving using saveas function I am using Matlab2007b and I would like to plot and save a 3d surface.
I manage to display the figure using meshz(X,Y,Z), but when calling:
saveas(gca, fullfile(path,name), 'png')

or
saveas(gcf, fullfile(path,name), 'png')
or even using

File --> Save As...

in the Figure window, the resulting figure appears black when I open it.
Also, I get the following warning in the console:
Warning: Problems in UIW_SetUpGLPrinting
In graphics\private\render at 142
In print at 267
In saveas at 159

Has anyone already experienced this issue?
Thanks


Q: SSL connection issue when calling GRPC service from Alpine Linux Image using Zulu jdk 11 I have a spring boot application which calls a GRPC service using Netty. When I run my code in my local machine (MacOS and zulu jdk without JCE) I am able to connect to the GRPC service.
Note: We are using Oracle JDK 1.8 compiled GRPC client jar
When I build a docker image (Alpine Linux with zulu jdk without JCE) I get below error
    javax.net.ssl|ERROR|37|C7-services-1|2019-09-26 21:18:10.622 GMT|TransportContext.java:312|Fatal (HANDSHAKE_FAILURE): Couldn't kickstart handshaking (
"throwable" : {
  javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate)
    at java.base/sun.security.ssl.HandshakeContext.<init>(HandshakeContext.java:169)
    at java.base/sun.security.ssl.ClientHandshakeContext.<init>(ClientHandshakeContext.java:98)
    at java.base/sun.security.ssl.TransportContext.kickstart(TransportContext.java:216)
    at java.base/sun.security.ssl.SSLEngineImpl.beginHandshake(SSLEngineImpl.java:103)
    at io.netty.handler.ssl.JdkSslEngine.beginHandshake(JdkSslEngine.java:155)
    at io.netty.handler.ssl.SslHandler.handshake(SslHandler.java:1967)
    at io.netty.handler.ssl.SslHandler.startHandshakeProcessing(SslHandler.java:1886)
    at io.netty.handler.ssl.SslHandler.channelActive(SslHandler.java:2021)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelActive(AbstractChannelHandlerContext.java:225)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelActive(AbstractChannelHandlerContext.java:211)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelActive(AbstractChannelHandlerContext.java:204)
    at io.netty.channel.DefaultChannelPipeline$HeadContext.channelActive(DefaultChannelPipeline.java:1396)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelActive(AbstractChannelHandlerContext.java:225)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelActive(AbstractChannelHandlerContext.java:211)
    at io.netty.channel.DefaultChannelPipeline.fireChannelActive(DefaultChannelPipeline.java:906)
    at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.fulfillConnectPromise(AbstractNioChannel.java:311)
    at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:341)
    at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:670)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:617)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:534)
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:496)
    at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:906)
    at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
    at java.base/java.lang.Thread.run(Thread.java:834)}

)

I see that on my local below cipher suites are present
*   TLS_AES_128_GCM_SHA256
*   TLS_AES_256_GCM_SHA384
*   TLS_DHE_DSS_WITH_AES_128_CBC_SHA
*   TLS_DHE_DSS_WITH_AES_128_CBC_SHA256
*   TLS_DHE_DSS_WITH_AES_128_GCM_SHA256
*   TLS_DHE_DSS_WITH_AES_256_CBC_SHA
*   TLS_DHE_DSS_WITH_AES_256_CBC_SHA256
*   TLS_DHE_DSS_WITH_AES_256_GCM_SHA384
*   TLS_DHE_RSA_WITH_AES_128_CBC_SHA
*   TLS_DHE_RSA_WITH_AES_128_CBC_SHA256
*   TLS_DHE_RSA_WITH_AES_128_GCM_SHA256
*   TLS_DHE_RSA_WITH_AES_256_CBC_SHA
*   TLS_DHE_RSA_WITH_AES_256_CBC_SHA256
*   TLS_DHE_RSA_WITH_AES_256_GCM_SHA384
*   TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA
*   TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256
*   TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
*   TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA
*   TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384
*   TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
*   TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA
*   TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256
*   TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
*   TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA
*   TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384
*   TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
*   TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA
*   TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256
*   TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256
*   TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA
*   TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384
*   TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384
*   TLS_ECDH_RSA_WITH_AES_128_CBC_SHA
*   TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256
*   TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256
*   TLS_ECDH_RSA_WITH_AES_256_CBC_SHA
*   TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384
*   TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384
*   TLS_EMPTY_RENEGOTIATION_INFO_SCSV
*   TLS_RSA_WITH_AES_128_CBC_SHA
*   TLS_RSA_WITH_AES_128_CBC_SHA256
*   TLS_RSA_WITH_AES_128_GCM_SHA256
*   TLS_RSA_WITH_AES_256_CBC_SHA
*   TLS_RSA_WITH_AES_256_CBC_SHA256
*   TLS_RSA_WITH_AES_256_GCM_SHA384

and in the image i see very few
*   TLS_AES_128_GCM_SHA256
*   TLS_AES_256_GCM_SHA384
*   TLS_DHE_DSS_WITH_AES_128_CBC_SHA
*   TLS_DHE_DSS_WITH_AES_128_CBC_SHA256
*   TLS_DHE_DSS_WITH_AES_128_GCM_SHA256
*   TLS_DHE_DSS_WITH_AES_256_CBC_SHA
*   TLS_DHE_DSS_WITH_AES_256_CBC_SHA256
*   TLS_DHE_DSS_WITH_AES_256_GCM_SHA384
*   TLS_DHE_RSA_WITH_AES_128_CBC_SHA
*   TLS_DHE_RSA_WITH_AES_128_CBC_SHA256
*   TLS_DHE_RSA_WITH_AES_128_GCM_SHA256
*   TLS_DHE_RSA_WITH_AES_256_CBC_SHA
*   TLS_DHE_RSA_WITH_AES_256_CBC_SHA256
*   TLS_DHE_RSA_WITH_AES_256_GCM_SHA384
*   TLS_EMPTY_RENEGOTIATION_INFO_SCSV
*   TLS_RSA_WITH_AES_128_CBC_SHA
*   TLS_RSA_WITH_AES_128_CBC_SHA256
*   TLS_RSA_WITH_AES_128_GCM_SHA256
*   TLS_RSA_WITH_AES_256_CBC_SHA
*   TLS_RSA_WITH_AES_256_CBC_SHA256
*   TLS_RSA_WITH_AES_256_GCM_SHA384

Note: BTW on my local it is choosing TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256
I downgraded my java version to Oracle JDK 1.8 and built the image also with JDK 1.8. Now i was able to resolve the issue with SSL handshake as I can see all the ciphers now available within the image. However I ended up with an issue which is very Alpine Linux.
Caused by: java.lang.IllegalStateException: Could not find TLS ALPN provider; no working netty-tcnative, Conscrypt, or Jetty NPN/ALPN available
    at io.grpc.netty.GrpcSslContexts.defaultSslProvider(GrpcSslContexts.java:258) ~[grpc-netty-1.16.1.jar:1.16.1]
    at io.grpc.netty.GrpcSslContexts.configure(GrpcSslContexts.java:171) ~[grpc-netty-1.16.1.jar:1.16.1]
    at io.grpc.netty.GrpcSslContexts.forClient(GrpcSslContexts.java:120) ~[grpc-netty-1.16.1.jar:1.16.1]
    at com.samsclub.list.core.client.C7ProductCatalogProvider.createChannel(C7ProductCatalogProvider.java:104) ~[sams-list-core-0.0.10-SNAPSHOT.jar:0.0.10-SNAPSHOT]
    at com.samsclub.list.core.client.C7ProductCatalogProvider.init(C7ProductCatalogProvider.java:59) ~[sams-list-core-0.0.10-SNAPSHOT.jar:0.0.10-SNAPSHOT]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_212]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_212]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_212]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_212]
    at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:363) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]
    at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMet

see this https://github.com/grpc/grpc-java/issues/3336
I really want to be on zulu 11 and wants to call this GRPC service. Should we just get the GRPC client jar compiled with JDK 11.?
My Docker Alpine image config
/app # cat /etc/os-release
NAME="Alpine Linux"
ID=alpine
VERSION_ID=3.10.0
PRETTY_NAME="Alpine Linux v3.10"
HOME_URL="https://alpinelinux.org/"
BUG_REPORT_URL="https://bugs.alpinelinux.org/"
/app # java -version
openjdk version "11.0.4" 2019-07-16 LTS
OpenJDK Runtime Environment Zulu11.33+15-CA (build 11.0.4+11-LTS)
OpenJDK 64-Bit Server VM Zulu11.33+15-CA (build 11.0.4+11-LTS, mixed mode)

A: What do you mean by saying zulu jdk without JCE?
Official zulu jdk is provided with all required crypto libraries and providers. In case of you manually exclude some of the providers or libraries you'll miss corresponding functionality.
For example SunEC crypto provider is responsible for ECDSA and ECDH algorithms implementation. Excluding SunEC from the list of providers or disabling/removing jdk.crypto.ec module, you'll miss all TLS_ECDH_ECDSA_* TLS_ECDHE_ECDSA_* cipher suites. It could be a reason of your TLS handshake failure.

A: Clean alpine docker image with Zulu 11 jdk shows the following:
$ docker run alpn_zulu more /etc/os-release
NAME="Alpine Linux"
ID=alpine
VERSION_ID=3.10.2
PRETTY_NAME="Alpine Linux v3.10"
HOME_URL="https://alpinelinux.org/"
BUG_REPORT_URL="https://bugs.alpinelinux.org/"
$ docker run alpn_zulu java -version
openjdk version "11.0.4" 2019-07-16 LTS
OpenJDK Runtime Environment Zulu11.33+15-CA (build 11.0.4+11-LTS)
OpenJDK 64-Bit Server VM Zulu11.33+15-CA (build 11.0.4+11-LTS, mixed mode)
$ docker run alpn_zulu jrunscript -e "java.util.Arrays.asList(javax.net.ssl.SSLServerSocketFactory.getDefault().getSupportedCipherSuites()).stream().forEach(println)"
Warning: Nashorn engine is planned to be removed from a future JDK release
TLS_AES_128_GCM_SHA256
TLS_AES_256_GCM_SHA384
TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
TLS_RSA_WITH_AES_256_GCM_SHA384
TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384
TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384
TLS_DHE_RSA_WITH_AES_256_GCM_SHA384
TLS_DHE_DSS_WITH_AES_256_GCM_SHA384
TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
TLS_RSA_WITH_AES_128_GCM_SHA256
TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256
TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256
TLS_DHE_RSA_WITH_AES_128_GCM_SHA256
TLS_DHE_DSS_WITH_AES_128_GCM_SHA256
TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384
TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384
TLS_RSA_WITH_AES_256_CBC_SHA256
TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384
TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384
TLS_DHE_RSA_WITH_AES_256_CBC_SHA256
TLS_DHE_DSS_WITH_AES_256_CBC_SHA256
TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA
TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA
TLS_RSA_WITH_AES_256_CBC_SHA
TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA
TLS_ECDH_RSA_WITH_AES_256_CBC_SHA
TLS_DHE_RSA_WITH_AES_256_CBC_SHA
TLS_DHE_DSS_WITH_AES_256_CBC_SHA
TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256
TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256
TLS_RSA_WITH_AES_128_CBC_SHA256
TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256
TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256
TLS_DHE_RSA_WITH_AES_128_CBC_SHA256
TLS_DHE_DSS_WITH_AES_128_CBC_SHA256
TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA
TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA
TLS_RSA_WITH_AES_128_CBC_SHA
TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA
TLS_ECDH_RSA_WITH_AES_128_CBC_SHA
TLS_DHE_RSA_WITH_AES_128_CBC_SHA
TLS_DHE_DSS_WITH_AES_128_CBC_SHA
TLS_EMPTY_RENEGOTIATION_INFO_SCSV


Q: Adding tabs on clicking button How can I add a new tab in TabBar by clicking on a button?
I tried to call 'setState' in order to add a new tab.
class _MyHomeState extends State<MyHome> {
  final List<Tab> _tabs = [
    Tab(
      child: Text("tab 1"),
    ),
    Tab(
      child: Text("tab 2"),
    )
  ];
  int _length = 2;
  final List<Widget> _tabBarView = [
    Icon(Icons.ac_unit),
    Icon(Icons.access_alarm)
  ];
  @override
  Widget build(BuildContext context) {
    return DefaultTabController(
      length: _length,
      child: Scaffold(
        appBar: AppBar(
          title: Text("New"),
          actions: <Widget>[
            IconButton(
              icon: Icon(Icons.add),
              onPressed: () {
                setState(() {
                  _tabs.add(
                    Tab(
                      child: Text("another"),
                    ),
                  );
                  _tabBarView.add(
                    Icon(Icons.access_alarms),
                  );
                  _length = _tabs.length;
                });
              },
            ),
          ],
          bottom: TabBar(
            tabs: _tabs,
          ),
        ),
        body: TabBarView(
          children: _tabBarView,
        ),
      ),
    );
  }
}

By doing so, got an error message,

RangeError (index): Invalid value: Not in range 0..1, inclusive: 2

A: You need minor tweaking in your code:
change:
 bottom: TabBar(
            tabs: _tabs,
          ),
        ),
        body: TabBarView(
          children: _tabBarView,
        ),

to
  bottom: TabBar(
            tabs: _tabs.toList(),  // Creates a [List] containing the elements of this [Iterable].
          ),
        ),
        body: TabBarView(
          children: _tabBarView.toList(),  // Creates a [List] containing the elements of this [Iterable].
        ),


Q: Premature end of POST data - Ajax with FormData is Broken on IE10 / IE11 in Some Conditions I have a JSP application.
Wherein a set of data will be sent to an JSP using AJAX request.
The issue is, I am getting an error when a data is sent to the JSP in Internet Explorer 11. Whereas it properly works in IE9.
IllegalStateException - IOException: Premature end of POST data

I couldn't find answers in google, as well as i couldn't reveal the code as its proprietary.
    Request Class:
request     EvermindHttpServletRequest

response        EvermindHttpServletResponse

pageContext     EvermindPageContext

session     EvermindHttpSession


Q: How to create components (labels) on the fly? (or how to create facebook/hotmail-style to add contacts to message) What I want to do is to create something like that hotmail/facebook-style list of selected contacts.. with 1 little block and a "X" for removing each item.
How could I achieve that in .NET?
I thought of creating new labels "on the fly" and use .NET's Ajax UpdatePanel..
But, can I do it? if yes, how can i create a label on the fly, and put it just where I want?
I want the items to be created in a list. (<ul>)

A: Assuming you have a Panel somewhere on your site:
Label myLabel = new Label();
myLabel.Text = "My Name";
myLabel.CssClass = "labelClass";
pnlItems.Controls.Add(myLabel);

To have ul / li items (or something completely customisable):
HtmlGenericControl ulControl = new HtmlGenericControl("ul");
pnlItems.Controls.Add(ulControl);
foreach (object myThing in myItems)
{
    HtmlGenericControl itemControl = new HtmlGenericControl("li");
    itemControl.InnerHtml = myThing.GetMarkup();
    ulControl.Controls.Add(itemControl);
}

Note this is untested - I'm fairly sure you can add controls to an Html Generic Control.


Q: draw a chart with pointer in android how I can draw a chart with a pointer that specify a point of chart and return information of that point. pointer is movable.
I want to show the information of Specified point below the chart.

A: Check the following libraries:
https://github.com/PhilJay/MPAndroidChart
https://github.com/diogobernardino/WilliamChart
https://github.com/lecho/hellocharts-android
They are beautiful and maybe they have what you need.


Q: Cannot list changed files using github actions I am trying to list all the changed files on file push. However my List all changed files command does not return anything even though I change the file and commit

name: test on:   push:
    branches: [ main ]

jobs:   build:
    runs-on: ubuntu-latest
steps:
  - uses: actions/checkout@v2
    with:
      fetch-depth: 0  # OR "2" -> To retrieve the preceding commit.

  - name: Get changed files using defaults
    id: changed-files
    uses: actions/checkout@v2

  - name: List all added files
    run: |
      for file in ${{ steps.changed-files.outputs.added_files }}; do
        echo "$file was added"
      done

  - name: List all changed files
    run: |
      for file in ${{ steps.changed-files.outputs.modified_files }}; do
        echo "$file was modified"
      done

A: Try using the one available in marketplace https://github.com/jitterbit/get-changed-files#get-all-changed-files


Q: AngularJs - Dynamic Form - single selection or checkbox list I wonder how I can make a dynamic way to bring a combobox (single selection) or a checkbox list depending on what is defined in the database.
[{
  id:10
  question: "Gender?",
  type: 1, //singleSelect
  options: [{id:1, name:"Male"}, {id:2, name:"Female"}]
},
{
  id:11
  question: "Witch videogames do you have?",
  type: 2, //multiSelect
  options: [{id:1,name:"PS4"}, {id:2, name:"XBox One"}, {id:3, name:"Wii"}, {id:4, name:"Super Nintendo"}]
}]

And I want to receive in controller a list of selected itens like that:
[10:[1],11:[2,3]] // male and with XBox One and Wii

Is is possible?

A: Well, the [10:[1],11:[2,3]] is invalid JavaScript, but if you need something approximately, you can use [{"10":1,"11":[2,3]}].
You don't need AngularJS or any third party library like jQuery to build a dynamic form. You can implement by using pure JavaScript through by DOM manipulation.
This is a simple demo where you can see how it works.

(function() {
  var data = [{
    "id": 10,
    "question": "Gender?",
    "type": 1,
    "options": [{
      "id": 1,
      "name": "Male"
    }, {
      "id": 2,
      "name": "Female"
    }]
  }, {
    "id": 11,
    "question": "Witchvideogamesdoyouhave?",
    "type": 2,
    "options": [{
      "id": 1,
      "name": "PS4"
    }, {
      "id": 2,
      "name": "XBoxOne"
    }, {
      "id": 3,
      "name": "Wii"
    }, {
      "id": 4,
      "name": "SuperNintendo"
    }]
  }];

  function buildFields(data) {
    var form, count, i, j, div, label, labelOpt, field, option, content, button;
    form = document.getElementById("form");
    count = data.length;
    for (i = 0; i < count; i++) {
      div = document.createElement("div"); // Creates a DIV.
      div.classList.add("question"); // Adds a css class to your new DIV.
      div.setAttribute("data-id", data[i].id); // Adds data-id attribute with question id in the new DIV.
      div.setAttribute("data-type", data[i].type); // Adds data-type attribute with question type in the new DIV.
      label = document.createElement("label"); // Adds a label to wrap the question content.
      label.innerText = data[i].id + "." + data[i].question; // Adds the question id in the label with the current question.
      if (data[i].type === 1) { // Check for the question type. In this case 1 is for the select tag.
        field = document.createElement("select"); // Creates a select tag.
        field.id = "field_" + data[i].id; // Adds an identifier to your select tag.
        field.name = "field_" + data[i].id; // Adds a name to the current select tag.
        if (data[i].options.length > 0) { // Checks for the options to create an option tag for every option with the current options values.
          option = document.createElement("option");
          option.value = "";
          option.text = ".:: Please select an option ::.";
          field.appendChild(option);
          for (j = 0; j < data[i].options.length; j++) {
            option = document.createElement("option");
            option.value = data[i].options[j].id;
            option.text = data[i].options[j].name;
            field.appendChild(option);
          }
        }
        div.appendChild(field);
      } else {
        if (data[i].options.length > 0) {
          content = document.createElement("span");
          for (var k = 0; k < data[i].options.length; k++) {
            labelOpt = document.createElement("label");
            labelOpt.innerText = data[i].options[k].name;

            field = document.createElement("input");
            field.type = "checkbox";
            field.value = data[i].options[k].id;

            labelOpt.insertBefore(field, labelOpt.firstChild); // Inserts a field before the label.
            content.appendChild(labelOpt);
          }
          div.appendChild(content);
        }
      }
      div.insertBefore(label, div.firstChild);
      form.appendChild(div);
    }
    button = document.createElement("button");
    button.type = "button";
    button.innerText = "Send";
    button.addEventListener("click", function() {
      var form, dataId, dataType, values, array, obj, i, result,
        form = document.getElementById("form");
      values = [];
      array = [];
      obj = {};
      for (i = 0; i < form.children.length; i++) { // Iterates for every node.
        if (form.children[i].tagName === "DIV") {
          dataId = parseInt(form.children[i].getAttribute("data-id"), 10);
          dataType = parseInt(form.children[i].getAttribute("data-type"), 10);
          if (dataType === 1) {
            obj[dataId] = parseInt(form.children[i].children[1].value, 10);
          } else {
            for (var j = 0; j < form.children[i].children[1].children.length; j++) {
              if (form.children[i].children[1].children[j].children[0].checked) {
                array.push(parseInt(form.children[i].children[1].children[j].children[0].value, 10));
              }
            }
            obj[dataId] = array;
          }
        }
      }
      values.push(obj);
      result = document.getElementById("result");
      result.innerText = JSON.stringify(values) + "\nTotal answers from question 11: " + values[0]["11"].length + ((values[0]["11"].length === 1) ? " answer." : " answers.");
    });
    form.appendChild(button);
  }
  buildFields(data);
})()
.question {
  border: solid 1px #000;
  border-radius: 5px;
  padding: 5px;
  margin: 10px;
}
.question label {
  display: block;
}
#result {
  background-image: linear-gradient(#0CC, #fff);
  border-radius: 10px;
  padding: 10px;
}
<form id="form" name="form">
</form>
<div id="result">
</div>


Q: Send data to a webform using MS Access VBA I am trying to send data from an Access DB to a website http://www.lee.vote/voters/check-your-registration-status/.  I'm able to use similar code (below) to send data to a different website, but I can't figure out why it doesn't work for this website.
The HTML from what I'm trying to fill in:

Voter Information in Lee County

Sample Ballots and Voting Locations

    Complete the form to see:

Where to vote on election day

Sample ballots

Upcoming elections

        You'll also be able to:

Request a mail ballot

Review/update your voter registration information

Check the status of your mail ballot

Review your voting activity for the past 12 months

If you are not registered to vote please fill out our voter registration form

    All items are required.

1.

Voter's Last Name

<input title="Please enter your last name." id="NameID" type="text" size="10" maxlength="35" value="">

2.

Voter's Birth Date

<input title="Please enter your birth date (MM/DD/YYYY)." id="BirthDate" type="text" size="10" maxlength="10" value="">

MM/DD/YYYY

3.

House Number of Voter's Residence Address

<input title="Please enter your house street number." id="StNumber" type="text" size="10" maxlength="10" value="">

    <button id="ButtonForm" onclick="ButtonForm_onclick()" type="button" value="Submit">Submit</button>

The VBA code:
'creates a new internet explorer window
Dim IE As Object
Set IE = CreateObject("InternetExplorer.Application")

'opens Lee County registration check
With IE
    .Visible = True
    .navigate "http://www.lee.vote/voters/check-your-registration-status/"
End With

'waits until IE is loaded
Do Until IE.ReadyState = 4 And Not IE.busy
    DoEvents
Loop

'sends data to the webpage
Call IE.Document.getelementbyid("NameID").setattribute("value", Last_Name)
Call IE.Document.getelementbyid("BirthDate").setattribute("value", Date_of_Birth.Value)
Call IE.Document.getelementbyid("StNumber").setattribute("value", Street_Number.Value)

'"clicks" the button to display the results
IE.Document.getelementbyid("ButtonForm").Click

Any help?

A: The HTML snippet you provided belongs to iframe , so you should navigate to URL https://www.electionsfl.org/VoterInfo/vflookup.html?county=lee instead of http://www.lee.vote/voters/check-your-registration-status/.
I navigated https://www.electionsfl.org/VoterInfo/vflookup.html?county=lee in Chrome and checked XHR logged after I submit the data via Developer Tools (F12), Network tab:

Seems that is simple POST XML HTTP request with payload in JSON format, like:
{'LastName':'Doe', 'BirthDate':'01/01/1980', 'StNumber':'10025', 'County':'lee', 'FirstName':'', 'challengeValue':'', 'responseValue':''}

That XHR uses no cookies or any other authorization data neither in headers nor payload, so I tried to reproduce the same request using the following code:
Option Explicit

Sub Test_Submit_VoterInfo()

    Dim sLastName As String
    Dim sBirthDate As String
    Dim sStNumber As String
    Dim sFormData As String
    Dim bytFormData
    Dim sContent As String

    ' Put the necessary data here
    sLastName = "Doe"
    sBirthDate = "01/01/1980"
    sStNumber = "10025"
    ' Combine form payload
    sFormData = "{" & _
    "'LastName':'" & sLastName & "', " & _
    "'BirthDate':'" & sBirthDate & "', " & _
    "'StNumber':'" & sStNumber & "', " & _
    "'County':'lee', " & _
    "'FirstName':'', " & _
    "'challengeValue':'', " & _
    "'responseValue':''" & _
    "}"
    ' Convert string to UTF-8 binary
    With CreateObject("ADODB.Stream")
        .Open
        .Type = 2 ' adTypeText
        .Charset = "UTF-8"
        .WriteText sFormData
        .Position = 0
        .Type = 1 ' adTypeBinary
        .Position = 3 ' skip BOM
        bytFormData = .Read
        .Close
    End With
    ' Make POST XHR
    With CreateObject("MSXML2.XMLHTTP")
        .Open "POST", "https://www.electionsfl.org/VoterInfo/asmx/service1.asmx/FindVoter", False, "u051772", "mar4fy16"
        .SetRequestHeader "Content-Length", LenB(bytFormData)
        .SetRequestHeader "Content-Type", "application/json; charset=UTF-8"
        .Send bytFormData
        sContent = .ResponseText
    End With
    ' Show response
    Debug.Print sContent

End Sub

The response for me is {"d":"[]"}, the same as in browser, but unfortunately I can't check if it processed on the server correctly, since I have no valid voter record data.

A: This is the answer that I came up with after the (much needed) help determining that I was not really navigating to the right webpage for the form:
'creates a new internet explorer window
Dim IE As Object
Set IE = CreateObject("InternetExplorer.Application")

'opens Lee County registration check
With IE
    .Visible = True
    .navigate "https://www.electionsfl.org/VoterInfo/vflookup.html?county=lee"
End With

'waits until IE is loaded
Do Until IE.ReadyState = 4 And Not IE.busy
    DoEvents
Loop
x = Timer + 2
Do While Timer < x
    DoEvents
Loop

'sends data to the webpage
Call IE.Document.getelementbyid("NameID").setattribute("value", Last_Name.Value)
    'formats DOB to correct output
    Dim DOBMonth As Integer
    Dim DOBDay As Integer
    Dim DOBYear As Integer
    DOBMonth = Month(Date_of_Birth.Value)
    DOBDay = Day(Date_of_Birth.Value)
    DOBYear = Year(Date_of_Birth.Value)

    If DOBMonth < 10 Then
        Call IE.Document.getelementbyid("BirthDate").setattribute("value", "0" & DOBMonth & "/" & DOBDay & "/" & DOBYear)
    Else
        Call IE.Document.getelementbyid("BirthDate").setattribute("value", DOBMonth & "/" & DOBDay & "/" & DOBYear)
    End If
Call IE.Document.getelementbyid("StNumber").setattribute("value", Street_Number.Value)

'"clicks" the button to display the results
IE.Document.getelementbyid("ButtonForm").Click


Q: SAPUI5 and Logon Tokens/SSO? I'm getting started with SAP's SAPUI5 framework, and I am trying to get single sign on to work with logon tokens (MYSAPSSO2), but I don't see anywhere that I can fetch a token or attach a token to an OData HTTP request. The example in the blog post I linked to above employs username/password but doesn't use a token:
// Specify the SAP Gateway SalesOrder service as an OData model
var salesOrderService =
    "https://gw.esworkplace.sap.com/sap/opu/sdata/IWFND/SALESORDER",

// The SalesOrder service requires authentication
// get the username/password from the SDN page.
username = "[username]",
password = "[password]",

// SAP Gateway only supports XML, so don't use JSON
asJson = false,
salesOrderModel = new ODataModel(salesOrderService, asJson, username, password)

Even when I look at the ODataModel.js file provided in the SDK, the constructor does not take logon tokens:
/**
 * Constructor for a new ODataModel.
 *
 * @param {string} sServiceUrl required - base uri of the service to request data from
 * @param {string} [bJSON] (optional) true to request data as JSON
 * @param {string} [sUser] (optional) user
 * @param {string} [sPassword] (optional) password
 *
 * @class
 * Model implementation for oData format
 *
 * @extends sap.ui.model.Model
 *
 * @author SAP AG
 * @version 1.2.0
 *
 * @constructor
 * @public
 */

I'm curious (though since it's new, I wouldn't be surprised if nobody had even heard of this yet) if anyone has any experience with SSO/MYSAPSSO2 logon tokens with SAPUI5.

A: I am the author of the blog you refer to. Let me try and answer your question.
Your comment from Mar 15 describes a proxy approach. What you should try to do is, once your proxy has received an SSO token you should pass that on to the client, using a SET-COOKIE header.
So when you successfully authenticate to SAP you get an SSO token an HTTP header of the response.
E.g.
set-cookie: MYSAPSSO2=AjQxMDM.....BABhHAFcA%3d%3d; path=/; domain=esworkplace.sap.com
Your proxy should simply pass that on to the client's browser and change the domain name to that of the proxy, otherwise the client will not use it.
set-cookie: MYSAPSSO2=AjQxMDM.....BABhHAFcA%3d%3d; path=/; domain=yourproxydomain.com
Next time the browser makes a request to your proxy it will automatically include this session cookie in the request header, like this:
Cookie: MYSAPSSO2=AjQxMDMBABhH......%2fjmaRu5sSb28M6rEg%3d%3d
Your proxy can read that cookie from the HTTP request headers and use it to make a call.
I hope this helps.

A: I'm responsible for SAPUI5 - although I'm not 100% sure whether I completely understand the issue, I'll try to answer. The SAPUI5 calls to read data use XMLHttpRequests and thus all certificates or cookies are sent along with the requests automatically. Futhermore, Gateway is expected to accept these (valid) certificates.
So following the answer from Istak and using cookies with a proper domain, it should just work without the need of an API in UI5.
Anyhow, if I missed something, please explain more in detail.
Best regards
Stefan

A: Not Sure about SAPUI5 and oData, I have used MYSAPSSO2 token with Java EE web applications / sencha touch based apps which connect sto SAP backend systems with SSO. You simply pass the token as a cookie in the http request.
There are many ways of doing this, the one I used was SimpleClientHttpRequestFactory or you could do that in UrlConnection itself.


Q: Android scene transition issue I am trying to change one scene to another scene using transition framework.
MainActivity.java
mSceneRoot = (ViewGroup) findViewById(R.id.root_scene);
        calendarScene = Scene.getSceneForLayout(mSceneRoot, R.layout.content_main_scene1,this);
        searchScene = Scene.getSceneForLayout(mSceneRoot, R.layout.content_main_scene2,this);

searchTextView = (TextView) findViewById(R.id.searchTextEdit);
        searchTextView.setOnFocusChangeListener(new View.OnFocusChangeListener() {
            @Override
            public void onFocusChange(View v, boolean hasFocus) {
                if (hasFocus) {
                    TransitionManager.go(searchScene);
                } else
                {
                    TransitionManager.go(calendarScene);
                }
            }
        });

content_root.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent"
    android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:paddingBottom="@dimen/activity_vertical_margin"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    tools:showIn="@layout/activity_main" tools:context=".MainActivity">

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/root_scene">
        <include layout="@layout/content_main_scene1"/>
    </FrameLayout>
</RelativeLayout>

content_main_scene2 has additional listView.
Finally I got the exception:
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/InputEventReceiver: Exception dispatching input event.
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI: Exception in MessageQueue callback: handleReceiveCallback
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI: java.lang.NullPointerException
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.ViewGroup.onRequestFocusInDescendants(ViewGroup.java:2413)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.ViewGroup.requestFocus(ViewGroup.java:2370)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.ViewGroup.onRequestFocusInDescendants(ViewGroup.java:2414)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.ViewGroup.requestFocus(ViewGroup.java:2370)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.ViewGroup.onRequestFocusInDescendants(ViewGroup.java:2414)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.ViewGroup.requestFocus(ViewGroup.java:2370)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.ViewGroup.onRequestFocusInDescendants(ViewGroup.java:2414)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.ViewGroup.requestFocus(ViewGroup.java:2370)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.ViewGroup.onRequestFocusInDescendants(ViewGroup.java:2414)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.ViewGroup.requestFocus(ViewGroup.java:2370)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.ViewGroup.onRequestFocusInDescendants(ViewGroup.java:2414)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.ViewGroup.requestFocus(ViewGroup.java:2370)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.ViewGroup.onRequestFocusInDescendants(ViewGroup.java:2414)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.ViewGroup.requestFocus(ViewGroup.java:2370)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.ViewGroup.onRequestFocusInDescendants(ViewGroup.java:2414)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.ViewGroup.requestFocus(ViewGroup.java:2373)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.View.requestFocus(View.java:6945)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.View.requestFocus(View.java:6924)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.View.rootViewRequestFocus(View.java:4746)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.ViewGroup.removeAllViewsInLayout(ViewGroup.java:4042)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.ViewGroup.removeAllViews(ViewGroup.java:3971)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.transition.Scene.enter(Scene.java:163)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.transition.TransitionManager.changeScene(TransitionManager.java:193)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.transition.TransitionManager.go(TransitionManager.java:342)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at com.freelance.wwtlf.info.MainActivity$2.onFocusChange(MainActivity.java:71)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.View.onFocusChanged(View.java:4836)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.widget.TextView.onFocusChanged(TextView.java:7641)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.View.handleFocusGainInternal(View.java:4617)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.View.requestFocusNoSearch(View.java:6999)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.View.requestFocus(View.java:6978)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.View.requestFocus(View.java:6945)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.View.requestFocus(View.java:6924)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.View.onTouchEvent(View.java:8653)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.widget.TextView.onTouchEvent(TextView.java:7693)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.View.dispatchTouchEvent(View.java:7706)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2068)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1515)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.app.Activity.dispatchTouchEvent(Activity.java:2458)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.support.v7.internal.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:60)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.support.v7.internal.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:60)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:   at
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info D/AndroidRuntime: Shutting down VM
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info W/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0xa4d17b20)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/AndroidRuntime: FATAL EXCEPTION: main
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/AndroidRuntime: Process: com.freelance.wwtlf.info, PID: 5937
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/AndroidRuntime: java.lang.NullPointerException
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/AndroidRuntime:     at android.view.ViewGroup.onRequestFocusInDescendants(ViewGroup.java:2413)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/AndroidRuntime:     at android.view.ViewGroup.requestFocus(ViewGroup.java:2370)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/AndroidRuntime:     at android.view.ViewGroup.onRequestFocusInDescendants(ViewGroup.java:2414)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/AndroidRuntime:     at android.view.ViewGroup.requestFocus(ViewGroup.java:2370)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/AndroidRuntime:     at android.view.ViewGroup.onRequestFocusInDescendants(ViewGroup.java:2414)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/AndroidRuntime:     at android.view.ViewGroup.requestFocus(ViewGroup.java:2370)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/AndroidRuntime:     at android.view.ViewGroup.onRequestFocusInDescendants(ViewGroup.java:2414)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/AndroidRuntime:     at android.view.ViewGroup.requestFocus(ViewGroup.java:2370)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/AndroidRuntime:     at android.view.ViewGroup.onRequestFocusInDescendants(ViewGroup.java:2414)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/AndroidRuntime:     at android.view.ViewGroup.requestFocus(ViewGroup.java:2370)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/AndroidRuntime:     at android.view.ViewGroup.onRequestFocusInDescendants(ViewGroup.java:2414)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/AndroidRuntime:     at android.view.ViewGroup.requestFocus(ViewGroup.java:2370)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/AndroidRuntime:     at android.view.ViewGroup.onRequestFocusInDescendants(ViewGroup.java:2414)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/AndroidRuntime:     at android.view.ViewGroup.requestFocus(ViewGroup.java:2370)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/AndroidRuntime:     at android.view.ViewGroup.onRequestFocusInDescendants(ViewGroup.java:2414)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/AndroidRuntime:     at android.view.ViewGroup.requestFocus(ViewGroup.java:2373)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/AndroidRuntime:     at android.view.View.requestFocus(View.java:6945)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/AndroidRuntime:     at android.view.View.requestFocus(View.java:6924)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/AndroidRuntime:     at android.view.View.rootViewRequestFocus(View.java:4746)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/AndroidRuntime:     at android.view.ViewGroup.removeAllViewsInLayout(ViewGroup.java:4042)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/AndroidRuntime:     at android.view.ViewGroup.removeAllViews(ViewGroup.java:3971)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/AndroidRuntime:     at android.transition.Scene.enter(Scene.java:163)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/AndroidRuntime:     at android.transition.TransitionManager.changeScene(TransitionManager.java:193)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/AndroidRuntime:     at android.transition.TransitionManager.go(TransitionManager.java:342)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/AndroidRuntime:     at com.freelance.wwtlf.info.MainActivity$2.onFocusChange(MainActivity.java:71)

...
What object is pointing to null?
Update:
When I have changed OnFocusChangeListener to onClickListener everything worked fine. But I still don't understand why...


Q: Can I transmit a func from parent to child in reactnavigation 6? Have a nice day.
Can I transmit a func from parent to child in reactnavigation 6?
Maybe somethings like this:
onPress={function =>
 navigation.navigate({
  name: LANGUAGES.label_people_component,
  params: function,
  merge: true,
 })
}

Tks all.

A: As mentioned here,

We recommend that the params you pass are JSON-serializable. That way,
you'll be able to use state persistence and your screen components
will have the right contract for implementing deep linking.

React Navigation parameters work like query parameters in websites in 6.x I believe, the ideal way to do this now is to use Context API where you have a single source of information.
You can also use a state management library such as redux or mobx in cases where you have a large number of stores and actions to manipulate them.


Q: Error after restoring TFS database to new hardware I am using TFS 2012. I wanted to test how i can recover from server failure or any hardware failure, So i wanted to shift TFS to new PC.
I followed some articles to restore it. what i did is
1)I had full backup of TFS_configuration and all other collection database.(backup taken using TFSbackup.exe)
2)In new PC i installed all the softwares(such as TFS 2012, sql server etc).
3)created all the windows user account as in old server.
4)When I checked the New PC it had default collection created which was mapped to sql server which i installed.
5)Now i deleted that default collection and restored all databases of my old TFS server(TFS_configuration and all other collection database.)(backup restored using TFSrestore.exe)
6)Now when i checked TFS administrative console it had all the collections as my old server.
7) But when i click on Administrative security, group membership etc  I get error like
TF30046: The instance information does not match. Team Foundation expected 368f7830-1c67-4c4c-8bc4-ba3d5b5a5543 which was not found. Please contact your Team Foundation Server administrator.
In this link it was mentioned to change service host id in table. But it didn't work for me.
So please help

A: You mistakenly configured TFS (in fact it created a default collection). If read carefully Move Team Foundation Server from one hardware configuration to another, you have to run the AT-only Configuration Wizard after restoring the databases.


Q: Routing audio output between multiple bluetooth devices with iOS using AVAudioSession Got a video conference app, implementing device selection feature of switching between Earpiece, Speaker, and connected Bluetooth devices. All seems to function appropriately apart from switching between bluetooth devices themselves.
For some reason, only the last connected device gets the audio routed to it, and you can't switch back to the other ones even if they're available in availableInputs of AVAudioSession SharedInstance, using setPreferredInput with OverridePortNone
I tried searching for resolutions but found the same unanswered issue from 5 years ago, I tried doing the same as changing setActive calls but was also unsuccessful.
Following is the test code, which is taken from here:

    AVAudioSession *_audioSession = [AVAudioSession sharedInstance];

    AVAudioSessionCategoryOptions _incallAudioCategoryOptionsAll = AVAudioSessionCategoryOptionMixWithOthers|AVAudioSessionCategoryOptionAllowBluetooth|AVAudioSessionCategoryOptionAllowAirPlay;

    [_audioSession setCategory:AVAudioSessionCategoryPlayAndRecord
                   withOptions:_incallAudioCategoryOptionsAll
                   error:nil];

    [_audioSession setMode:AVAudioSessionModeVoiceChat error: nil];

    RCT_EXPORT_METHOD(setAudioDevice:(NSString *)device
                  resolve:(RCTPromiseResolveBlock)resolve
                  reject:(RCTPromiseRejectBlock)reject) {

    BOOL success;
    NSError *error = nil;

    NSLog(@"[setAudioDevice] - Attempting to set audiodevice as: %@", device);

    if ([device isEqualToString:kDeviceTypeSpeaker]) {
        success = [_audioSession overrideOutputAudioPort:AVAudioSessionPortOverrideSpeaker error:&error];
    } else {
        AVAudioSessionPortDescription *port = nil;

        for (AVAudioSessionPortDescription *portDesc in _audioSession.availableInputs) {
            if ([portDesc.UID isEqualToString:device]) {
                port = portDesc;
                break;
            }
        }

        if (port != nil) {
            [_audioSession overrideOutputAudioPort:AVAudioSessionPortOverrideNone error:nil];
            success = [_audioSession setPreferredInput:port error:&error];

            if(error != nil)
            {
                NSLog(@"setAudioDevice %@ %@", error.localizedDescription, error);
            }
        } else {
            success = NO;
            error = RCTErrorWithMessage(@"Could not find audio device");
        }
    }
    if (success) {
        resolve(@"setAudioDevice success!");
        NSLog(@"resolved success");
    } else {
        reject(@"setAudioDevice", error != nil ? error.localizedDescription : @"", error);
        NSLog(@"sent reject");
    }
 }

So how can I make it that we're able to successfully change from one bluetooth device to other?


Q: Capturing a Session variable in Session_OnStart - Global.asa I'm trying to use the users session to process the code in my global.asa:
Sub Session_OnStart
  sAdmin = Session("Admin")
  Application("Admin") = sAdmin

The Session("Admin") is not empty, but the Application("Admin") always comes up empty when I check it.  Is there a reason I'm not able to capture the users session variable in the Session_OnStart section of the global.asa?
When I do this Application("Admin") doesn't come up empty, it comes up as hi
Sub Session_OnStart
  Application("Admin") = "hi"

What do I have to do to capture the users session value in the global.asa?

A: It appears that you try to set "by reference" assignment so that Application("Admin") will change when Session("Admin") changes. I fear such thing is not possible in classic ASP.
The only elegant way I can think of is adding helper method that will be included in all pages:
Sub AssignAdminSession(value)
    Session("Admin") = value
    Application("Admin") = value
End Sub

Then instead of just Session("Admin") = "something" have everywhere:
Call AssignAdminSession("value here")


Q: How to build a "defaulting map" data structure I have some configuration data that I'd like to model in code as so:
Key1,  Key2,  Key3,  Value
null,  null,  null,  1
1,     null,  null,  2
9,     null,  null,  21
1,     null,  3,     3
null,  2,     3,     4
1,     2,     3,     5

With this configuration set, I then need to do lookups on bazillion (give or take) {Key1, Key2, Key3} tuples to get the "effective" value.  The effective value to use is based on a  Key/Priority sum whereby in this example:
Key1 - Priority 10
Key2 - Priority 7
Key3 - Priority 5

So a specifc query which has a config entry on Key1=null, Key2=match, and Key3=match beats out one that has Key1=match, Key2=null, and Key3=null since Key2+Key3 priority > Key1 priority...  That make sense?!
given a key of {1, 2, 3} the value should be 5.
given a key of {3, 2, 3} the value should be 4.
given a key of {8, 10, 11} the value should be 1.
given a key of {1, 10, 11} the value should be 2.
given a key of {9, 2, 3} the value should be 4.
given a key of {8, 2, 3} the value should be 4.
given a key of {9, 3, 3} the value should be 21.

Is there an easy way to model this data structure and lookup algorithm that is generic in that the # and types of keys is variable, and the "truth table" (the ordering of the lookups) can be defined dynamically?  The types being generics instead of ints would be perfect (floats, doubles, ushorts, etc), and making it easy to expand to n number of keys is important too!
Estimated "config" table size: 1,000 rows, Estimated "data" being looked up: 1e14
That gives an idea about the type of performance that would be expected.
I'm looking for ideas in C# or something that can translate to C# easily.

A: EDIT: This code is apparently not what's required, but I'm leaving it as it's interesting anyway. It basically treats Key1 as taking priority, then Key2, then Key3 etc. I don't really understand the intended priority system yes, but when I do I'll add an answer for that.
I would suggest a triple layer of Dictionaries - each layer has:
Dictionary<int, NextLevel> matches;
NextLevel nonMatch;

So at the first level you'd look up Key1 - if that matches, that gives you the next level of lookup. Otherwise, use the next level which corresponds with "non-match".
Does that make any sense? Here's some sample code (including the example you gave). I'm not entirely happy with the actual implementation, but the idea behind the data structure is sound, I think:
using System;
using System.Collections;
using System.Collections.Generic;

public class Test
{
    static void Main()
    {
        Config config = new Config
        {
            { null,  null,  null,  1 },
            { 1,     null,  null,  2 },
            { 1,     null,  3,     3 },
            { null,  2,     3,     4 },
            { 1,     2,     3,     5 }
        };

        Console.WriteLine(config[1, 2, 3]);
        Console.WriteLine(config[3, 2, 3]);
        Console.WriteLine(config[9, 10, 11]);
        Console.WriteLine(config[1, 10, 11]);
    }
}

// Only implement IEnumerable to allow the collection initializer
// Not really implemented yet - consider how you might want to implement :)
public class Config : IEnumerable
{
    // Aargh - death by generics :)
    private readonly DefaultingMap<int,
                         DefaultingMap<int, DefaultingMap<int, int>>> map
        = new DefaultingMap<int, DefaultingMap<int, DefaultingMap<int, int>>>();

    public int this[int key1, int key2, int key3]
    {
        get
        {
            return map[key1][key2][key3];
        }
    }

    public void Add(int? key1, int? key2, int? key3, int value)
    {
        map.GetOrAddNew(key1).GetOrAddNew(key2)[key3] = value;
    }

    public IEnumerator GetEnumerator()
    {
        throw new NotSupportedException();
    }
}

internal class DefaultingMap<TKey, TValue>
    where TKey : struct
    where TValue : new()
{
    private readonly Dictionary<TKey, TValue> mapped = new Dictionary<TKey, TValue>();
    private TValue unmapped = new TValue();

    public TValue GetOrAddNew(TKey? key)
    {
        if (key == null)
        {
            return unmapped;
        }
        TValue ret;
        if (mapped.TryGetValue(key.Value, out ret))
        {
            return ret;
        }
        ret = new TValue();
        mapped[key.Value] = ret;
        return ret;
    }

    public TValue this[TKey key]
    {
        get
        {
            TValue ret;
            if (mapped.TryGetValue(key, out ret))
            {
                return ret;
            }
            return unmapped;
        }
    }

    public TValue this[TKey? key]
    {
        set
        {
            if (key != null)
            {
                mapped[key.Value] = value;
            }
            else
            {
                unmapped = value;
            }
        }
    }
}

A: To answer your question about something which is generic in the number and type of keys - you can't make the number and type of keys dynamic and use generics - generics are all about providing compile-time information. Of course, you could use ignore static typing and make it dynamic - let me know if you want me to implement that instead.
How many entries will there be, and how often do you need to look them up? You may well be best just keeping all the entries as a list and iterating through them giving a certain "score" to each match (and keeping the best match and its score as you go). Here's an implementation, including your test data - but this uses the keys having priorities (and then summing the matches), as per a previous comment...
using System;
using System.Collections;
using System.Collections.Generic;

public class Test
{
    static void Main()
    {
        Config config = new Config(10, 7, 5)
        {
            { new int?[]{null,  null,  null},  1},
            { new int?[]{1,     null,  null},  2},
            { new int?[]{9,     null,  null},  21},
            { new int?[]{1,     null,  3},     3 },
            { new int?[]{null,  2,     3},     4 },
            { new int?[]{1,     2,     3},     5 }
        };

        Console.WriteLine(config[1, 2, 3]);
        Console.WriteLine(config[3, 2, 3]);
        Console.WriteLine(config[8, 10, 11]);
        Console.WriteLine(config[1, 10, 11]);
        Console.WriteLine(config[9, 2, 3]);
        Console.WriteLine(config[9, 3, 3]);
    }
}

public class Config : IEnumerable
{
    private readonly int[] priorities;
    private readonly List<KeyValuePair<int?[],int>> entries =
        new List<KeyValuePair<int?[], int>>();

    public Config(params int[] priorities)
    {
        // In production code, copy the array to prevent tampering
        this.priorities = priorities;
    }

    public int this[params int[] keys]
    {
        get
        {
            if (keys.Length != priorities.Length)
            {
                throw new ArgumentException("Invalid entry - wrong number of keys");
            }
            int bestValue = 0;
            int bestScore = -1;
            foreach (KeyValuePair<int?[], int> pair in entries)
            {
                int?[] key = pair.Key;
                int score = 0;
                for (int i=0; i < priorities.Length; i++)
                {
                    if (key[i]==null)
                    {
                        continue;
                    }
                    if (key[i].Value == keys[i])
                    {
                        score += priorities[i];
                    }
                    else
                    {
                        score = -1;
                        break;
                    }
                }
                if (score > bestScore)
                {
                    bestScore = score;
                    bestValue = pair.Value;
                }
            }
            return bestValue;
        }
    }

    public void Add(int?[] keys, int value)
    {
        if (keys.Length != priorities.Length)
        {
            throw new ArgumentException("Invalid entry - wrong number of keys");
        }
        // Again, copy the array in production code
        entries.Add(new KeyValuePair<int?[],int>(keys, value));
    }

    public IEnumerator GetEnumerator()
    {
        throw new NotSupportedException();
    }
}

The above allows a variable number of keys, but only ints (or null). To be honest the API is easier to use if you fix the number of keys...

A: Yet another solution - imagine that the entries are a bit pattern of null/non-null. You have one dictionary per bit pattern (i.e. { 1, null, null } and { 9, null, null } go in the same dictionary, but { 1, 2, 3 } goes in a different one. Each dictionary effectively has a score as well - the sum of the priorities for the non-null parts of the key. You wil end up with 2^n dictionaries, where n is the number of elements in the key.
You order the dictionaries in reverse score order, and then just look up the given key in each of them. Each dictionary needs to ignore the values in the key which aren't in its bit pattern, which is done easily enough with a custom IComparer<int[]>.
Okay, here's the implementation:
------------ Test.cs -----------------
using System;

sealed class Test
{
    static void Main()
    {
        Config config = new Config(10, 7, 5)
        {
            { null, null, null, 1 },
            {null,  null,  null,  1},
            {1,     null,  null,  2},
            {9,     null,  null,  21},
            {1,     null,  3,     3 },
            {null,  2,     3,     4 },
            {1,     2,     3,     5 }
        };

        Console.WriteLine(config[1, 2, 3]);
        Console.WriteLine(config[3, 2, 3]);
        Console.WriteLine(config[8, 10, 11]);
        Console.WriteLine(config[1, 10, 11]);
        Console.WriteLine(config[9, 2, 3]);
        Console.WriteLine(config[9, 3, 3]);
    }
}

--------------- Config.cs -------------------
using System;
using System.Collections;

sealed class Config : IEnumerable
{
    private readonly PartialMatchDictionary<int, int> dictionary;

    public Config(int priority1, int priority2, int priority3)
    {
        dictionary = new PartialMatchDictionary<int, int>(priority1, priority2, priority3);
    }

    public void Add(int? key1, int? key2, int? key3, int value)
    {
        dictionary[new[] { key1, key2, key3 }] = value;
    }

    public int this[int key1, int key2, int key3]
    {
        get
        {
            return dictionary[new[] { key1, key2, key3 }];
        }
    }

    // Just a fake implementation to allow the collection initializer
    public IEnumerator GetEnumerator()
    {
        throw new NotSupportedException();
    }
}

-------------- PartialMatchDictionary.cs -------------------
using System;
using System.Collections.Generic;
using System.Linq;

public sealed class PartialMatchDictionary<TKey, TValue> where TKey : struct
{
    private readonly List<Dictionary<TKey[], TValue>> dictionaries;
    private readonly int keyComponentCount;

    public PartialMatchDictionary(params int[] priorities)
    {
        keyComponentCount = priorities.Length;
        dictionaries = new List<Dictionary<TKey[], TValue>>(1 << keyComponentCount);
        for (int i = 0; i < 1 << keyComponentCount; i++)
        {
            PartialComparer comparer = new PartialComparer(keyComponentCount, i);
            dictionaries.Add(new Dictionary<TKey[], TValue>(comparer));
        }
        dictionaries = dictionaries.OrderByDescending(dict => ((PartialComparer)dict.Comparer).Score(priorities))
                                   .ToList();
    }

    public TValue this[TKey[] key]
    {
        get
        {
            if (key.Length != keyComponentCount)
            {
                throw new ArgumentException("Invalid key component count");
            }
            foreach (Dictionary<TKey[], TValue> dictionary in dictionaries)
            {
                TValue value;
                if (dictionary.TryGetValue(key, out value))
                {
                    return value;
                }
            }
            throw new KeyNotFoundException("No match for this key");
        }
    }

    public TValue this[TKey?[] key]
    {
        set
        {
            if (key.Length != keyComponentCount)
            {
                throw new ArgumentException("Invalid key component count");
            }
            // This could be optimised (a dictionary of dictionaries), but there
            // won't be many additions to the dictionary compared with accesses
            foreach (Dictionary<TKey[], TValue> dictionary in dictionaries)
            {
                PartialComparer comparer = (PartialComparer)dictionary.Comparer;
                if (comparer.IsValidForPartialKey(key))
                {
                    TKey[] maskedKey = key.Select(x => x ?? default(TKey)).ToArray();
                    dictionary[maskedKey] = value;
                    return;
                }
            }
            throw new InvalidOperationException("We should never get here");
        }
    }

    private sealed class PartialComparer : IEqualityComparer<TKey[]>
    {
        private readonly int keyComponentCount;
        private readonly bool[] usedKeyComponents;
        private static readonly EqualityComparer<TKey> Comparer = EqualityComparer<TKey>.Default;

        internal PartialComparer(int keyComponentCount, int usedComponentBits)
        {
            this.keyComponentCount = keyComponentCount;
            usedKeyComponents = new bool[keyComponentCount];
            for (int i = 0; i < keyComponentCount; i++)
            {
                usedKeyComponents[i] = ((usedComponentBits & (1 << i)) != 0);
            }
        }

        internal int Score(int[] priorities)
        {
            return priorities.Where((value, index) => usedKeyComponents[index]).Sum();
        }

        internal bool IsValidForPartialKey(TKey?[] key)
        {
            for (int i = 0; i < keyComponentCount; i++)
            {
                if ((key[i] != null) != usedKeyComponents[i])
                {
                    return false;
                }
            }
            return true;
        }

        public bool Equals(TKey[] x, TKey[] y)
        {
            for (int i = 0; i < keyComponentCount; i++)
            {
                if (!usedKeyComponents[i])
                {
                    continue;
                }
                if (!Comparer.Equals(x[i], y[i]))
                {
                    return false;
                }
            }
            return true;
        }

        public int GetHashCode(TKey[] obj)
        {
            int hash = 23;
            for (int i = 0; i < keyComponentCount; i++)
            {
                if (!usedKeyComponents[i])
                {
                    continue;
                }
                hash = hash * 37 + Comparer.GetHashCode(obj[i]);
            }
            return hash;
        }
    }
}

It gives the right results for the samples that you gave. I don't know what the performance is like - it should be O(1), but it could probably be optimised a bit further.

A: I'm assuming that there are few rules, and a large number of items that you're going to check against the rules. In this case, it might be worth the expense of memory and up-front time to pre-compute a structure that would help you find the object faster.
The basic idea for this structure would be a tree such that at depth i, you would follow the ith element of the rule, or the null branch if it's not found in the dictionary.
To build the tree, I would build it recursively. Start with the root node containing all possible rules in its pool. The process:

*

*Define the current value of each rule in the pool as the score of the current rule given the path taken to get to the node, or -infinity if it is impossible to take the path. For example, if the current node is at the '1' branch of the root, then the rule {null,  null,  null,  1} would have a score of 0, and the rule {1, null, null, 2} would have a score 10

*Define the maximal value of each rule in the pool as its current score, plus the remaining keys' score. For example, if the current node is at the '1' branch of the root, then the rule {null,  1,  2,  1} would have a score of 12 (0 + 7 + 5), and the rule {1, null, null, 2} would have a score 10 (10 + 0 + 0).

*Remove the elements from the pool that have a maximal value lower than the highest current value in the pool

*If there is only one rule, then make a leaf with the rule.

*If there are multiple rules left in the pool, and there are no more keys then ??? (this isn't clear from the problem description. I'm assuming taking the highest one)

*For each unique value of the (i+1)th key in the current pool, and null, construct a new tree from the current node using the current pool.

As a final optimization check, I would check if all children of a node are leaves, and if they all contain the same rule, then make the node a leaf with that value.
given the following rules:
null,  null,  null = 1
1,     null,  null = 2
9,     null,  null = 21
1,     null,  3    = 3
null,  2,     3    = 4
1,     2,     3    = 5

an example tree:
       key1   key2   key3
root:
 |----- 1
 |      |----- 2          = 5
 |      |-----null
 |             |----- 3   = 3
 |             |-----null = 2
 |----- 9
 |      |----- 2
 |      |      |----- 3   = 4
 |      |      |-----null = 21
 |      |-----null        = 21
 |-----null
        |----- 2          = 4
        |-----null        = 1

If you build the tree up in this fashion, starting from the highest value key first, then you can possibly prune out a lot of checks against later keys.
Edit to add code:
class Program
{
    static void Main(string[] args)
    {
        Config config = new Config(10, 7, 5)
        {
            { new int?[]{null,  null,  null},  1},
            { new int?[]{1,     null,  null},  2},
            { new int?[]{9,     null,  null},  21},
            { new int?[]{1,     null,  3},     3 },
            { new int?[]{null,  2,     3},     4 },
            { new int?[]{1,     2,     3},     5 }
        };

        Console.WriteLine("5 == {0}", config[1, 2, 3]);
        Console.WriteLine("4 == {0}", config[3, 2, 3]);
        Console.WriteLine("1 == {0}", config[8, 10, 11]);
        Console.WriteLine("2 == {0}", config[1, 10, 11]);
        Console.WriteLine("4 == {0}", config[9, 2, 3]);
        Console.WriteLine("21 == {0}", config[9, 3, 3]);
        Console.ReadKey();
    }
}

public class Config : IEnumerable
{
    private readonly int[] priorities;
    private readonly List<KeyValuePair<int?[], int>> rules =
        new List<KeyValuePair<int?[], int>>();
    private DefaultMapNode rootNode = null;

    public Config(params int[] priorities)
    {
        // In production code, copy the array to prevent tampering
        this.priorities = priorities;
    }

    public int this[params int[] keys]
    {
        get
        {
            if (keys.Length != priorities.Length)
            {
                throw new ArgumentException("Invalid entry - wrong number of keys");
            }

            if (rootNode == null)
            {
                rootNode = BuildTree();
                //rootNode.PrintTree(0);
            }

            DefaultMapNode curNode = rootNode;
            for (int i = 0; i < keys.Length; i++)
            {
                // if we're at a leaf, then we're done
                if (curNode.value != null)
                    return (int)curNode.value;

                if (curNode.children.ContainsKey(keys[i]))
                    curNode = curNode.children[keys[i]];
                else
                    curNode = curNode.defaultChild;
            }

            return (int)curNode.value;
        }
    }

    private DefaultMapNode BuildTree()
    {
        return new DefaultMapNode(new int?[]{}, rules, priorities);
    }

    public void Add(int?[] keys, int value)
    {
        if (keys.Length != priorities.Length)
        {
            throw new ArgumentException("Invalid entry - wrong number of keys");
        }
        // Again, copy the array in production code
        rules.Add(new KeyValuePair<int?[], int>(keys, value));

        // reset the tree to know to regenerate it.
        rootNode = null;
    }

    public IEnumerator GetEnumerator()
    {
        throw new NotSupportedException();
    }

}

public class DefaultMapNode
{
    public Dictionary<int, DefaultMapNode> children = new Dictionary<int,DefaultMapNode>();
    public DefaultMapNode defaultChild = null; // done this way to workaround dict not handling null
    public int? value = null;

    public DefaultMapNode(IList<int?> usedValues, IEnumerable<KeyValuePair<int?[], int>> pool, int[] priorities)
    {
        int bestScore = Int32.MinValue;

        // get best current score
        foreach (KeyValuePair<int?[], int> rule in pool)
        {
            int currentScore = GetCurrentScore(usedValues, priorities, rule);
            bestScore = Math.Max(bestScore, currentScore);
        }

        // get pruned pool
        List<KeyValuePair<int?[], int>> prunedPool = new List<KeyValuePair<int?[], int>>();
        foreach (KeyValuePair<int?[], int> rule in pool)
        {
            int maxScore = GetCurrentScore(usedValues, priorities, rule);
            if (maxScore == Int32.MinValue)
                continue;

            for (int i = usedValues.Count; i < rule.Key.Length; i++)
                if (rule.Key[i] != null)
                    maxScore += priorities[i];

            if (maxScore >= bestScore)
                prunedPool.Add(rule);
        }

        // base optimization case, return leaf node
        // base case, always return same answer
        if ((prunedPool.Count == 1) || (usedValues.Count == prunedPool[0].Key.Length))
        {
            value = prunedPool[0].Value;
            return;
        }

        // add null base case
        AddChild(usedValues, priorities, prunedPool, null);
        foreach (KeyValuePair<int?[], int> rule in pool)
        {
            int? branch = rule.Key[usedValues.Count];
            if (branch != null && !children.ContainsKey((int)branch))
            {
                AddChild(usedValues, priorities, prunedPool, branch);
            }
        }

        // if all children are the same, then make a leaf
        int? maybeOnlyValue = null;
        foreach (int v in GetAllValues())
        {
            if (maybeOnlyValue != null && v != maybeOnlyValue)
                return;
            maybeOnlyValue = v;
        }
        if (maybeOnlyValue != null)
            value = maybeOnlyValue;

    }

    private static int GetCurrentScore(IList<int?> usedValues, int[] priorities, KeyValuePair<int?[], int> rule)
    {
        int currentScore = 0;
        for (int i = 0; i < usedValues.Count; i++)
        {
            if (rule.Key[i] != null)
            {
                if (rule.Key[i] == usedValues[i])
                    currentScore += priorities[i];
                else
                    return Int32.MinValue;
            }
        }
        return currentScore;
    }

    private void AddChild(IList<int?> usedValues, int[] priorities, List<KeyValuePair<int?[], int>> prunedPool, Nullable<int> nextValue)
    {
        List<int?> chainedValues = new List<int?>();
        chainedValues.AddRange(usedValues);
        chainedValues.Add(nextValue);
        DefaultMapNode node = new DefaultMapNode(chainedValues, prunedPool, priorities);
        if (nextValue == null)
            defaultChild = node;
        else
            children[(int)nextValue] = node;
    }

    public IEnumerable<int> GetAllValues()
    {
        foreach (DefaultMapNode child in children.Values)
            foreach (int v in child.GetAllValues())
                yield return v;
        if (defaultChild != null)
            foreach (int v in defaultChild.GetAllValues())
                yield return v;
        if (value != null)
            yield return (int)value;
    }

    public void PrintTree(int depth)
    {
        if (value == null)
            Console.WriteLine();
        else
        {
            Console.WriteLine(" = {0}", (int)value);
            return;
        }

        foreach (KeyValuePair<int, DefaultMapNode> child in children)
        {
            for (int i=0; i<depth; i++)
                Console.Write("    ");
            Console.Write(" {0}  ", child.Key);
            child.Value.PrintTree(depth + 1);
        }
        for (int i = 0; i < depth; i++)
            Console.Write("    ");
        Console.Write("null");
        defaultChild.PrintTree(depth + 1);
    }
}


Q: Android Picasso store files or use cache I'm using Picasso to initially download images of products to my app from a server. Since the images aren't changing nearly at all for a certain product, I save the images to the disk from the ImageView. In the app I have to display these images all over again in different sizes. To do so I'm using Picasso again, loading the saved file into an ImageView and do fit().centercrop() so I don't get any OutofMemory issues.
Since Picasso is also capable of using OkHttp's cache and doing the caching by its own, I want to know:

*

*Are there any advantages about letting Picasso do the caching, over saving it to storage manually and handing it over again to Picasso later?

*And would it be a good way to store the shrinked image (after using .fit()) as a new file so the calculation hasn't to be done all the time.


Q: matplotlib ticklabels disabling co-ordinates from displaying, twinx/twiny functions any useful? I went through tcaswell's answer on stackoverflow for the question on looking at co-ordinate information after using xticklabels/yticklabels function: http://goo.gl/0Y5VpF that "there is no easy way to do this." I am curious if the job becomes any easier if I had twin axes. (PS: I am newbie to python :) )
e.g. I have a figure in which I have used twinx() + set_yticklabels() functions like this:
bx2=bx.twinx()
bx2.set_ylim(bx.get_ylim())
bx2.set_yticks(new_tick_locations)
bx2.set_yticklabels(mylabellist)

I no longer able to see y-position of the cursor in the interactive plot window. Kindly let me know if I could make figure window to look at co-ordinates corresponding to bx axis, so that one can readily look at y co-ordinate upon mouse over.
Thanks,
sahdeV


Q: Any faces this kind of error in 32-bit machine? I have been using Mongo-db from one month ago i am getting the error as follows "MapViewOfFile failed /data/db/sgserver.4 errno:0 The operation completed successfully. 0".
If i check in the DB path c:/data/db the size not exceeded 2GB.I am using windows2003serverR2...Anyone faced same Issue share your experience.......
Advance Thanks,

A: Default file sizes for MongoDB
.ns =>  16MB
.0 =>   64 MB
.1 =>  128 MB
.2 =>  256 MB
.3 =>  512 MB
.4 => 1024 MB

Add that up and you're just under 2GB. So if you've filled the .4 file, then you won't be able to allocate any more space. (the .5 file will be 2GB)
If you log into Mongo and do a db.stats(), how much space are you using? That should tell you how close you are to the limit.

A: What size is the /data/db? This error is most likely from Mongo trying to allocate a new database file and that new file would push the size of the db past 2GB. MongoDB allocates database files in fairly large chunks so if you are anywhere near 2GB this could be the problem.


Q: How to secure Web API without individual logins? I have an api that calculates some math based on inputs and returns the result.
I have multiple asp.net mvc sites that have a javascript graph which updates the graph according to user input / ajax calls from api
I want the sites and graph pages to be open access. People should be able to view/update the graphs without having to login.
However, I don't want people to be able to directly plug-in to my api and use it for themselves. The only time someone sees the output of the api should be through my own sites.
Is this possible?
I've been reading through https://identityserver4.readthedocs.io and perhaps I'm misunderstanding, but there's no way to do it without exposing the access token to javascript?
I can use C#/MVC to get the access token which keeps username/password from being exposed:
var tokenClient = new TokenClient(disco.TokenEndpoint, "client", "secret");
var tokenResponse = await tokenClient.RequestClientCredentialsAsync("api1");

But then for the javascript graph to make api calls, it needs to know that token.
Once I've exposed the token to javascript, what's to stop someone getting that token and using it to call the api? And even if the token expires, can't they just automate grabbing a new token from my sites to use in their api calls again?
If there's any benefit, I could move all the sites/api to the same server. Perhaps IP restriction could be used, but then again, couldn't someone send requests with a spoofed IP address to get around that?

A: Did you checked with the [AllowAnonymous] attribute. If you put this attribute on your "Action" that you want to be open access, then anyone can access the method without login.
If you want to allow access to a specific site/source, then please add this in your web.config file inside
<system.webServer></system.webServer>.
<httpProtocol>
  <customHeaders>
    <remove name="Access-Control-Allow-Origin" />
    <add name="Access-Control-Allow-Origin" value="*" />
  </customHeaders>

See here * means you are allowing everyone. You can place your site address instead of * that only you want to access your api.
Let me know is that what you want or anything else.

A: When your site renders your page, include an encrypted json token in the page. The token will include a timestamp. When your page calls your api, include the token. Your service decrypts the token, validates the timestamp is less that NN minutes. If either of these fail, no business.
This way only your site will know how to create the correct token required to call your api. Tokens can not be replayed if the timestamp age is short enough.
You can get creative as to the structure/content of the token and how you encrypt, AES is a good choice.


Q: Spinner won't highlight when item is selected By default, when you select an item in spinner, it highlights briefly before disappearing.
I changed the color of my spinner rows to alternate color with the following code, and the highlight disappears. R.layout.textviewinside and R.layout.textview don't cause this, just the @Override for getDropDownView, because everything works if I comment out that block.
How can I restore that functionality but keep the row colors?
products = new ArrayAdapter<String>(this,   R.layout.textview, thedata){
                @Override
                public View getDropDownView(int position, View convertView, ViewGroup parent) {
                    View v = super.getDropDownView(position, convertView, parent);
                    if (position % 2 == 0) { // we're on an even row
                        v.setBackgroundColor(0xffEBF4FA);//Color.BLUE)
                    } else {
                        v.setBackgroundColor(Color.WHITE);
                    }
                    ((TextView) v).setGravity(Gravity.CENTER);

                    return v;
                }
            };
            products.setDropDownViewResource(R.layout.textviewinside);

            spitem.setAdapter(products);

A: Instead of using setBackgroundColor, you'll need to use setBackgroundDrawable, and use an xml state list drawable file with pressed/default states.
http://developer.android.com/guide/topics/resources/drawable-resource.html#StateList


Q: Inno Setup Compiler: add page option selected according I want to display a custom page only if the option of an earlier page is activated, for example, i have this code:
[Code]
var page_option : TInputOptionWizardPage;
    page_dir_se : TInputDirWizardPage;

procedure InitializeWizard();
begin
    page_option := CreateInputOptionPage(1,'Select','','',False,True);
    page_option.Add('Option 1');
    page_option.Add('Option 2');

    page_dir_se :=CreateInputDirPage(page_option.ID,'Select', '','',False, '');
    page_dir_se.Add('Select A');
    page_dir_se.Add('Select B');
    page_dir_se.Add('Select C');

end;

In the example only if page_option.Values[0] is TRUE page_dir_se should show me, and if page_option.Values[1] is TRUE then should show me another page.
I use Inno Setup Compiler
Thankz for help.
Regards xD

A: You can skip any page in the ShouldSkipPage event:
[Setup]
AppName=My Program
AppVersion=1.5
DefaultDirName={pf}\My Program

[Code]
var
  DirPage: TInputDirWizardPage;
  OptionPage: TInputOptionWizardPage;

procedure InitializeWizard;
begin
  OptionPage := CreateInputOptionPage(wpWelcome, 'Caption', 'Description',
    'SubCaption', False, True);
  OptionPage.Add('Option 1');
  OptionPage.Add('Option 2');

  DirPage := CreateInputDirPage(OptionPage.ID, 'Caption', 'Description',
    'SubCaption', False, '');
  DirPage.Add('Select A');
  DirPage.Add('Select B');
  DirPage.Add('Select C');
end;

function ShouldSkipPage(PageID: Integer): Boolean;
begin
  // skip the page if your custom dir page is about to show and
  // the option is not checked
  Result := (PageID = DirPage.ID) and not OptionPage.Values[0];
end;


Q: Flyway changes performed in previous migration script are not visible to next migrations scripts In a spring-based project, I'm using flyway as a database migration tool.
I encounter very strange behavior. Suppose that I have 1 to n migration scripts to execute (mix between JDBC and SQL-based scripts). Flyway performs successfully a sequence of scripts but it stuck suddenly on script n-3 because it is not able to see changes performed in previous scripts. Strangely when I restarted my JAR and continue the migration process, the previous changes become visible to the stuck script and the error disappear.
Noting that I use Spring Data to implement my java based migration scripts.


Q: open two new windows/tabs (different external sites) from a single button press in c# Is there a way I can open two pages, both in external websites, from a single button press in c# (or jquery/javascript, having set the parameters via c#)?
The context is I am trying to allow users to share content to both twitter and facebook with a single click.
When my user performs an action on my site, they generate (in the c# code-behind) a custom url. this needs to be passed to twitter and the fb share dialog via c#.
I'm able to build the 2 urls I need using String.Format to pass my custom url and other information, but at the moment the user needs to press one button for FB, and one for Twitter - I'd love to get that down to a single button press.

A: On the button press event can you just load both?
 ScriptManager.RegisterStartupScript(Page, Page.GetType(), "popup", "window.open('" + url1+ "','_blank')", true);

 ScriptManager.RegisterStartupScript(Page, Page.GetType(), "popup", "window.open('" + url2+ "','_blank')", true);


Q: Drag and Drop Javascript - better way I have created a little application where there is a dragzone and within it two  elements. I should have possibility to drag and drop these two paragraphs within this area. Code below works pretty well, but when i drop one element at the other element or at the edge of the dropzone or sometimes randomly this element move to the top left corner instead of right place. This is really annoying! Is there a way to go around this issue? Or is there a better way to write this app?

var section = document.querySelector("#dragzone");
  var currentLabel

  function moveStart(e) {
   e.dataTransfer.setData('text/plain', null);
   myX = e.offsetX === undefined ? e.layerX : e.offsetX;
   myY = e.offsetY === undefined ? e.layerY : e.offsetY;
   currentLabel = e.target;
  }

  function moveDragOver(e) {
   e.preventDefault();
   e.dataTransfer.dropEffect = "move";
  }

  function moveDrop(e) {
   e.preventDefault();
   currentLabel.style.left = e.offsetX - myX + 'px';
   currentLabel.style.top = e.offsetY - myY - 10 + 'px';
  }

  section.addEventListener('dragstart', moveStart, false);
  section.addEventListener('dragover', moveDragOver, false);
  section.addEventListener('drop', moveDrop, false);
#dragzone {
   position: relative;
   width: 300px;
   height: 300px;
   border: 2px solid black;
  }
  p {
   position: absolute;
   top: 20px;
   left: 20px;
  }
<!DOCTYPE html>

  <meta charset="UTF-8">
  <title>My site</title>

DraggableElement1

DraggableElement2


Q: dojo: Show or hide divs based on selection in a list Is there a simple way to accomplish this using dojo (jQuery would be easier for me but I have to use dojo): I have a simple unordered list. I don't want dojo to style the list (as it might if I used some widget). When I click a link on the list I want to show a div associated with the link. Then if I click another link in the list the first div hides and that one shows.

Header

Link 1

Link 2

Link 3

Sub Content Header 1

Lorem ipsum veritas britas conflictum civa

Sub Content Header 2

Lorem ipsum mobius ceti

Sub Content Header 3

Lorem ipsum citrus pecto

Lemons

Limes

A: So in fact you're creating your own tabcontainer? If you really want to do it yourself you should probably need something like this:
require(["dojo/ready", "dojo/on", "dojo/dom-attr", "dojo/dom-style", "dojo/query", "dojo/NodeList-dom"], function(ready, on, domAttr, domStyle, query) {
    ready(function() {
        query("ul li a").forEach(function(node) {
            query(domAttr.get(node, "href")).forEach(function(node) {
                domStyle.set(node, "display", "none");
            });

            on(node, "click", function(e) {
                query("ul li a").forEach(function(node) {
                    if (node == e.target) {
                        query(domAttr.get(node, "href")).forEach(function(node) {
                            domStyle.set(node, "display", "block");
                        });
                    } else {
                        query(domAttr.get(node, "href")).forEach(function(node) {
                            domStyle.set(node, "display", "none");
                        });
                    }
                });
            });
        });
    });
});

I'm not sure how familiar you are with Dojo, but it uses a query that will loop all links in lists (with the dojo/query and dojo/NodeList-dom modules) (you should provide a classname or something like that to make it easier). Then it will, for each link, retrieve the div corresponding to it and hide it, it will also connect a click event handler to it (with the dojo/on module).
When someone clicks the link, it will (again) loop all the links, but this time it's doing that to determine which node is the target one and which isn't (so it can hide/show the corresponding div).
I made a JSFiddle to show you this. If something is still not clear you should first try to look at the reference guide of Dojo since it really demonstrates the most common uses of most modules.
But since this behavior is quite similar to a TabContainer, I would recommend you to look at the TabContainer reference guide.