text:
Q: How to interact a front-end input via a webservice? I have a page with an account number and a button to block the user's account. The webService interacts perfectly. When I click on the blocking button, the account is blocked!
Here is a small picture illustration.
I click on the button

The card displays that the account is blocked

Now, I want to add an input. The user can block the account only if he enters the password.
I added the input in HTML...

To test, the webService with the password, I run the cURL and it works.
{
    "HEADER":{
        "USER":"TOTO",
        "CHANNEL":"B",
        "LANGUAGE":"FR",
        "SESSION":"",
        "PASSWORD":"TOTO",
        "NUMTRX":0,
        "VERSION":"",
        "LADACO": 0,
        "LAHECO": 0,
        "LADAPWD": 0,
        "LAHEPWD": 0,
        "IDENTIF": 0,
        "AGDE": 0,
        "TIERS": 0,
        "EXPIRED": 0,
        "EXPDATE": "0001-01-01",
        "EXPDAYS": 0,
        "CDEACC": ""
    },
    "CUSTOMER":{
            "REFERENCE":"NA0052",
            "ID":"",
            "INTITULE1":"",
            "INTITULE2":"",
            "ACCESS":0,
            "SERVICE":0,
            "DEFAULTPTF":0
    },

    "MODE": "ETAT",

    "PTF_IN": {
        "ETAT": 4,
        "MONTANT": 0
    }

}

The return works
{"RETURNCODE":"OKK00","RETURNLIST":[]}

Thus, the webService works with the password. Now I need to integrate this into the front-end. But I don't understand how I have to integrate the password input?!
The page HTML is like this:
<form #formulaire="ngForm" (ngSubmit)="formulaire.form.valid && locking()">

Account number

      {{ ((currentPortfolio$ | async)?.DEPO | accountDash) }} ({{
      ((currentPortfolio$ | async)?.NO_PTF) }})

      Password

      <input id="passwordCurrent" name="passwordCurrent" type="password" class="form-control" maxlength="30">

      <button type="submit" class="btn-green" [disabled]="formulaire.form.invalid">Blocking</button>

</form>

Service.ts
@Injectable()
export class LockingService {
  private readonly api: string = environment.api;
  constructor(
    private http: HttpClient,
    private router: Router,
    private store: Store
  ) {}

  getLocking(): Observable<ApiResponse> {
    return this.http.post<ApiResponse>(
      this.api + `/WBBLOCKING`,
      {
        PTF_IN: {
          ETAT: 4, // blocking
          MONTANT: 0,
        },
        MODE: "ETAT",
      },
      { headers: { AddCustomer: "" } }
    );
  }

  getPortfolios(): Observable<SelectPortfolioResponse> {
    return this.http.post<SelectPortfolioResponse>(
      this.api + `/WBPORTFOLIO`,
      {},
      { headers: { AddCustomer: "" } }
    );
  }

  selectPortfolio(selectPortfolio: SelectPortfolio): Observable<void> {
    return this.store.dispatch(
      new SetCurrentPortfolioAction(
        SelectPortfolio_To_Portfolio(selectPortfolio)
      )
    );
  }
}

In the locking.component.ts I have this:
How do I interact the html input password in typescript?
Thank you very much for your help and explanation.
export class LockingComponent implements OnInit {
  private unsubscribe$ = new Subject<void>();

  show = false;
  buttonName = "Show";
  hide: any;

  @Select(ProfileState.currentPortfolio)
  currentPortfolio$!: Observable<Portfolio>;
  @Select(AuthState.user) user$!: Observable<string>;

  constructor(
    private service: LockingService,
    private store: Store,
    private router: Router
  ) {}

  ngOnInit(): void {}

  locking(): void {
    this.service
      .getLocking()
      .pipe(
        takeUntil(this.unsubscribe$),
        takeWhile((res) => res.RETURNCODE === ApiResponseCodeEnum.Ok),
        tap(() => {
          this.show = !this.show;
          if (this.show) {
            this.buttonName = "Hide";
            console.log(this.show);
          } else {
            this.buttonName = "Show";
          }
        }),
        concatMap(() => this.service.getPortfolios()),
        takeWhile(
          (res) =>
            res.RETURNCODE === ApiResponseCodeEnum.Ok && res.PTF.length > 0
        ),
        concatMap((res) => this.service.selectPortfolio(res.PTF[0]))
      )
      .subscribe();
  }
}


text:
Q: css+html5 The best way to lay out this info I want to lay out the following info horizontally in a container 460px wide:
32 Likes (Restricted to 50px wide)    (whitespace)      From Great Britain        (whitespace)                           Featured (Floated to the right)
What would you recommend being the best tags to use to lay these out?
You can see an image of what I mean here http://www.flickr.com/photos/62570778@N04/5693086371/in/dateposted/

A: I don't believe that there are any new tags in HTML5 that would give semantic value to the data you're laying out.
A div would probably be the best element to use, along with a usual hX for the title and strong (or the like) for the Featured text.
Actually, if this is a list of link items, you could always use a menu/li layout? If you're also showing content from these posts(?), how about a section or article tag?

A: I think a picture would better describe what you mean.
I'm confused if the entire button is 50px wide in an arbitrary 460px wide block or if the content is in a 460px wide block, and the 32 Likes itself is 50px wide and From Great Britain Featured is to the right and are separate elements?

redpajama_set_name: RedPajamaStackExchange


text:
Q: Latest amd HD audio device driver doesn't work in windows 7 64bit I have amd radeon HD 6900 graphics card. I updated the drivers via catalyst setup and then I had no sound. My pc is connected to my tv/monitor via hdmi cable. I have tried restarting, sleeping, re-jacking in hdmi cable, reeinstalling driver and nothing works.
In playback devices, when sound comes through the default device you can see little green bars illustrating the sound level(how on earth are they called?). Whatever sound I play, media files or system sounds, I see no such bars in my hd device. I do see them though in my realtek digital output if I set them to default. With this I tested and sound comes through headphones(if I check disable front panel detection in realtek manager, as needed). I would imagine sound would come through speakers as well. In the same menu of playback devices, whn I try to click test on my hd device an error pops up stating it is of use by another device.
Everything works fine when in device manager I roll back to version 7.12.0.7721 from the non working 7.12.0.7722. I imagine amd screwed this one up and its drivers don't work properly. Or am I missing something?

A: vengse on https://community.amd.com/thread/184657 found a solution
" Right click on the AMD HDMI audio out. Click on preferences and then in Generel "information about controller" you click on preferences aswell (my version is on Danish, so I'm not sure this is exactly what they are called in the English version). Then "Preferences for AMD High Definition Audio Device" opens. Here you click on the "Change settings" button, then the same window opens, but in administrator mode. Then you click on the fan "Driver" and then click on "Cancel opdate". This will go back to the previous sound driver that worked. "
But I got the gist.
Right Click on AMD HDMI Output,
Playback devices,
Properties on AMD HDMI Output,
properties on AMD H D Audio Device,
Drivers,
Rollback


text:
Q: Will the Ubuntu Edge work in countries without LTE? I live in a country with no LTE, we use 3G. Will the Edge still work here?
Thanks

A: Yes.
From the Ubuntu Edge project page...

The Ubuntu Edge is an open device, not locked to any particular network. It works in all countries that provide GSM/3G/LTE-based network services. It will also support the two LTE standards to provide 4G mobile broadband connectivity around the world


text:
Q: Replace NULL Value with 0 when crossing measures in Browser SSAS MDX I want to replace Null values when browsing in the cube, when i do IIF or coalesce I get null values for years that doesn't have Data (all dimension rows), I just want to replace null for current data crossed. Here is an exemple to explain more :
Year   Measure 1     Measure 2
2015     55            60
2016     44            70
2017      30           (null)

Problem behaviour when I use ISEMPTY OR COALESCE
Year         Measure 1      Measure 2
(All TimeDim years) 0               0
    2012            0               0
    2013            0               0
    2014             0              0
    2015            55              60
    2016            44              70
    2017            30              0
The dataset is bigger now with useless values.
What I want :
Year   Measure 1     Measure 2
    2015     55            60
    2016     44            70
    2017      30           0
How to solve this ? thank you.

A: You could use the IS operator with the NULL reference. See here
Another option would be to wrap it in an IIF statement. See here

A: This is an emxample people can play with:
SELECT
  {
    [Measures].[Internet Sales Amount]
   ,[Measures].[Reseller Sales Amount]
  } ON COLUMNS
 ,NON EMPTY
    [Date].[Calendar Year].[Calendar Year].MEMBERS ON ROWS
FROM [Adventure Works]
WHERE
  [Geography].[Geography].[Country].&[Australia];

Results in:

This is the simple amendment that causes the expansion of the rows:
WITH
  MEMBER [Measures].[Reseller Sales Amount NEW] AS
    IIF
    (
      [Measures].[Reseller Sales Amount] = 0
     ,0
     ,[Measures].[Reseller Sales Amount]
    )
SELECT
  {
    [Measures].[Internet Sales Amount]
   ,[Measures].[Reseller Sales Amount NEW]
  } ON COLUMNS
 ,NON EMPTY
    [Date].[Calendar Year].[Calendar Year].MEMBERS ON ROWS
FROM [Adventure Works]
WHERE
  [Geography].[Geography].[Country].&[Australia];

Results in

So we could just amend the NEW measure a bit more to this:
WITH
  MEMBER [Measures].[Reseller Sales Amount NEW] AS
    IIF
    (
        [Measures].[Reseller Sales Amount] = 0
      AND
        [Measures].[Internet Sales Amount] <> 0
     ,0
     ,[Measures].[Reseller Sales Amount]
    )
SELECT
  {
    [Measures].[Internet Sales Amount]
   ,[Measures].[Reseller Sales Amount NEW]
  } ON COLUMNS
 ,NON EMPTY
    [Date].[Calendar Year].[Calendar Year].MEMBERS ON ROWS
FROM [Adventure Works]
WHERE
  [Geography].[Geography].[Country].&[Australia];

Then we have:

BE AWARE ... getting rid of nulls within the cube space can seriously degrade the performance of your mdx scripts so use the above with care - better still don't bother with the above and in your client to the mdx do the transformation of (null) => 0


text:
Q: SSLHandshakeException: PKIX path building failed I've been trying to debug this error with no luck.
Essentially I'm contacting an external app throught my app. The connection is established fine, the app contacts back my app through a callback URL, then I need to send a final validation to the external app.
This last step is failing because of an SSLHandShajeException.

javax.net.ssl.SSLHandshakeException:
  sun.security.validator.ValidatorException: PKIX path building failed:
  sun.security.provider.certpath.SunCertPathBuilderException: unable to
  find valid certification path to requested target

I've had a look at the possible causes, and created a truststore with the external app cert in it following these steps:

*

*download the cert chain from the browser

*creating the truststore with

keytool -import -v -trustcacerts -alias mycert -file
  x_my_cert_location_x -keystore truststore

*

*adding the above trustore in my setenv file

*restart my tomcat instance.

This has not resolved the problem.
I also added to cert to the cacert file, and the same to the connector in the server.xml file as follows:

<Connector port="${catalina.port.https}" server="Apache" protocol="HTTP/1.1"
           SSLEnabled="true" scheme="https" secure="true" sslProtocol="TLS"
           clientAuth="false"
           connectionTimeout="20000"
           compression="on"
           compressionMinSize="200"
           compressableMimeType="text/html,text/xml,text/plain,text/css,text/javascript,application/javascript,application/json,application/xml"
           enableLookups="false"
           URIEncoding="UTF-8"
           keystoreFile="my_store_location" keystorePass="myPwd"/>

Debugging in the SSL, I can see:
> %% Invalidated: [Session-15, TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256]
> http-nio-8080-exec-9, SEND TLSv1.2 ALERT: fatal, description =
> certificate_unknown http-nio-8080-exec-9, WRITE: TLSv1.2 Alert, length
> = 2 [Raw write]: length = 7 0000: 15 03 03 00 02 02 2E ....... http-nio-8080-exec-9, called closeSocket() http-nio-8080-exec-9,
> handling exception: javax.net.ssl.SSLHandshakeException:
> sun.security.validator.ValidatorException: PKIX path building failed:
> sun.security.provider.certpath.SunCertPathBuilderException: unable to
> find valid certification path to requested target

Which makes no real sense to me. My app is on java 1.8.242. Any advice on this please?

A: The error suggests that you are missing the certificate of the site you are trying to reach. So..

*

*Start your java/tomcat with -Djavax.net.debug=ALL.  In the logs you should see lines like these (I stripped out the timestamp etc.):
 trustStore is: {your-cacerts-file} trustStore
 type is: pkcs12
 trustStore provider is: the last modified time is: Tue Feb 02 18:29:33 GMT 2021
 Reload the trust store
 Reload trust
 Reloaded {x} trust certs adding as trusted certificates
 ( {then you get a big dump of all {x} certs.}

That way you know for sure if your cacerts is really being read or not.

*If your file is really being read by Tomcat then write your own small Java program that uses your cacerts file (use -Djavax.net.ssl.trustStore={path-to-my-file}) and the same debug parameter used above.  You should see it read in the certificate you added.  Then debug from there and maybe repost this smaller case.  That isn't the total answer but at least you will have isolated the problem to some degree.


text:
Q: Aggregate results of batch consumer in Camel (for example from SQS) I'm consuming messages from SQS FIFO queue with maxMessagesPerPoll=5 set.
Currently I'm processing each message individually which is a total waste of resources.
In my case, as we are using FIFO queue and all of those 5 messages are related to the same object, I could process them all toghether.
I though this might be done by using aggregate pattern but I wasn't able to get any results.
My consumer route looks like this:
from("aws-sqs://my-queue?maxMessagesPerPoll=5&messageGroupIdStrategy=usePropertyValue")
    .process(exchange -> {
        // process the message
    })

I believe it should be possible to do something like this
from("aws-sqs://my-queue?maxMessagesPerPoll=5&messageGroupIdStrategy=usePropertyValue")
    .aggregate(const(true), new GroupedExchangeAggregationStrategy())
    .completionFromBatchConsumer()
    .process(exchange -> {
        // process ALL messages together as I now have a list of all exchanges
    })

but the processor is never invoked.
Second thing:
If I'm able to make this work, when does ACK is sent to SQS? When each individual message is processed or when the aggregate process finishes? I hope the latter

A: When the processor is not called, the aggregator probably still waits for new messages to aggregate.
You could try to use completionSize(5) instead of completionFromBatchConsumer() for a test. If this works, the batch completion definition is the problem.
For the ACK against the broker: unfortunately no. I think the message is commited when it arrives at the aggregator.
The Camel aggregator component is a "stateful" component and therefore it must end the current transaction.
For this reason you can equip such components with persistent repositories to avoid data loss when the process is killed. In such a scenario the already aggregated messages would obviously be lost if you don't have a persistent repository attached.

A: The problem lies in GroupedExchangeAggregationStrategy
When I use this strategy, the output is an "array" of all exchanges. This means that the exchange that comes to the completion predicate no longer has the initial properties. Instead it has CamelGroupedExchange and CamelAggregatedSize which makes no use for the completionFromBatchConsumer()
As I don't actually need all exchanges being aggregated, it's enough to use GroupedBodyAggregationStrategy. Then exchange properties will remain as in the original exchange and just the body will contain an "array"
Another solution would be to use completionSize(Predicate predicate) and use a custom predicate that extracts necessary value from groupped exchanges.


text:
Q: Make recursive function in javascript I would like to get an object as such:
let params_ = {
  filters: {
    orderId: null,
    status: ['rejected', 'accepted'],
    orderStatus: 'A',
    a: {
      c: 'deepFilter'
    }
  },
  page: {
    limit: 15,
    offset: 0
  }
}

and transform it into:
{
  filters[orderId]: null,
  filters[status]: ['rejected', 'acepted'],
  filters[orderStatus]: 'A',
  filters[a.c]: 'deepFilter',
  page[limit]: 15,
  page[offset]: 0,
}

I was able to go into a two level and getting the result as desired but Im having a problem knowing where I should make the recursive call to be able to call deep nested levels.
So far I have tried the following:

let params_ = {
  filters: {
    orderId: null,
    status: ['rejected', 'accepted'],
    orderStatus: 'A',
    a: {
      c: 'a'
    }
  },
  page: {
    limit: 15,
    offset: 0
  }
}

function paramsSerializer(parameters) {
  let finalParameters = {};

  for (let key in parameters) {
    if (parameters.hasOwnProperty(key)) {
      if (typeof parameters[key] === 'object' && parameters[key] !== null) {
        finalParameters = {
          ...finalParameters,
          ...constructParameterFromObject(parameters[key], key)
        }
      }
    }
  }

  console.log(finalParameters);
}

function constructParameterFromObject(object, prepend = null) {
  let finalParameters = {};

  for (let key in object) {
    if (object.hasOwnProperty(key)) {
      finalParameters = {
        ...finalParameters,
        ...{
          [`${prepend}[${key}]`]: object[key]
        }
      }
    }
  }

  return finalParameters;
}

paramsSerializer(params_);

You can have a live example over here: https://codesandbox.io/s/angry-dream-sl0gr
Any light would be highly appreciated. Thank you very much for the help in advance

A: You can do something like this:

let params_ = {
  filters: {
    orderId: null,
    status: ['rejected', 'accepted'],
    orderStatus: 'A',
    a: {
      c: 'deepFilter'
    }
  },
  page: {
    limit: 15,
    offset: 0
  }
}

function paramsSerializer(params, prefix) {
 return Object.entries(params).reduce((a, [key, value]) => {
   let fullKey = key;
   if (prefix) {
     if (prefix.includes('[')) {
       fullKey = prefix.replace(']', `.${key}]`);
     } else {
       fullKey = `${prefix}[${key}]`;
     }
   }

   if (typeof value === 'object' && value !== null && !Array.isArray(value)) {
     a = {...a, ...paramsSerializer(value, fullKey)};
   } else {
     a = {...a, [fullKey]: value};
   }
   return a;
 }, {});
}

const ret = paramsSerializer(params_);
console.log(ret);

This will only work if the original object's keys don't contain the [ and ] characters. There is probably another way of constructing the new keys without using String.replace(..).

A: let params = {
    filters: {
        orderId: null,
        status: ['rejected', 'accepted'],
        orderStatus: 'A',
        a: {
            c: 'deepFilter',
            d: 'lightFilters',
            e: {
                f: ['Hi', 'There'],
                g: 100
            }
        }
    },
    page: {
        limit: 15,
        offset: 0
    }
}
function paramsSerializerRecursive(originalParameters, parentName){
    // Store (key,value) pairs
    let key_value_pairs = []
    parentName !== ''?parentName=parentName+'.':null;
    for (let key in originalParameters) {
        // If value is null
        if(originalParameters[key] === null)
            key_value_pairs.push([parentName+key, null])
        // Object but not array
        else if(typeof(originalParameters[key]) === 'object' && !Array.isArray(originalParameters[key])) {
            // Recursively get all (key,value) pairs for child object
            let child_pairs = paramsSerializerRecursive(originalParameters[key], parentName+key)
            // Add them to current (key,value) pairs list
            for(let pair of child_pairs)
                key_value_pairs.push(pair)
        }
        // Anything else
        else
            key_value_pairs.push([parentName+key, originalParameters[key]])
    }
    return key_value_pairs
}

function paramsSerializer(params){
    let serializedParams = {}
    for(let key in params){
        let key_value_pairs = paramsSerializerRecursive(params[key],'')
        for(let pair of key_value_pairs)
            serializedParams[String(key)+'['+pair[0]+']'] = pair[1]
    }
    console.log(serializedParams);
}

paramsSerializer(params);

Output
{
  'filters[orderId]': null,
  'filters[status]': [ 'rejected', 'accepted' ],
  'filters[orderStatus]': 'A',
  'filters[a.c]': 'deepFilter',
  'filters[a.d]': 'lightFilters',
  'filters[a.e.f]': [ 'Hi', 'There' ],
  'filters[a.e.g]': 100,
  'page[limit]': 15,
  'page[offset]': 0
}


text:
Q: Ensure my servlet filter runs before other dynamically added filters I am trying to customize a third-party web application by adding servlet filters to web.xml.
It looks like my filters are not the first in the chain, even though I put their filter-mapping declarations at the very top of web.xml.
It seems like there are Spring Boot filters being inserted into the filter chain dynamically, via ServletContext.addFilter and FilterRegistration.addMappingForUrlPatterns with isMatchAfter set to false.  This means the dynamically-added filter mappings will be matched before any filter mappings declared in web.xml
I could do the same for my own filters as well, but how could I ensure that my filters will be run before the other filters that were added dynamically?  Is there any way to control the order explicitly with dynamically-added filters?


text:
Q: Traffic does not go through the Egress if loadBalancing.simple: PASSTHROUGH I have Kafka cluster with two nodes. node1 with ip 1.1.1.1, and node2 with ip 2.2.2.2
All traffic must go through Egres Controller.
If a client from the application addresses a node with ip 1.1.1.1, then he should contact it without any balancing from Istio
Configuration:
apiVersion: networking.istio.io/v1alpha3
kind: ServiceEntry
metadata:
  name: kafka
spec:
  hosts:
    - kafka.host
  addresses:
    - 1.1.1.1/32
    - 2.2.2.2/32
  ports:
    - number: 9092
      name: tcp-kafka
      protocol: TCP
  location: MESH_EXTERNAL
  resolution: STATIC
  endpoints:
    - address: 1.1.1.1
    - address: 2.2.2.2
---
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
  name: kafka
spec:
  host: kafka.host
  trafficPolicy:
    loadBalancer:
      simple: PASSTHROUGH    # disabled loadBalancer
---
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: kafka
spec:
  selector:
    istio: istio-egressgateway
  servers:
    - port:
        number: 9092
        name: tcp-kafka
        protocol: TCP
      hosts:
        - kafka.host
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: kafka
spec:
  hosts:
    - kafka.host
  gateways:
    - mesh
    - kafka
  tcp:
    - match:
        - gateways:
            - mesh
          destinationSubnets:
            - 1.1.1.1/32
            - 2.2.2.2/32
          port: 9092
      route:
        - destination:
            host: istio-egressgateway
            port:
              number: 9092
    - match:
        - gateways:
            - kafka
          port: 9092
      route:
        - destination:
            host: kafka.host
            port:
              number: 9092
          weight: 100

Traffic reaches to Egress Controller and does not go outside, while in the egress controller logs:
[Envoy (Epoch 0)] [2020-07-31 13:52:21.351][58][warning][upstream] [external/envoy/source/common/upstream/original_dst_cluster.cc:76] original_dst_load_balancer: No downstream connection or no original_dst.
[2020-07-31T13:52:11.385Z] "- - -" 0 UH "-" "-" 0 0 0 - "-" "-" "-" "-" "-" - - 10.128.19.132:9092 10.128.13.52:47984 - -

P.S.
If you set loadBalancer: ROUND_ROBIN or another in the DestinationRule, then everything works and traffic goes to external nodes.
But there is no guarantee that when accessing ip 1.1.1.1 from the application, the traffic will go to the external server with ip 1.1.1.1
Istio v1.1

A: I think you could try set up sticky sessions in DestinationRule for that.
Example from istio documentation:

LoadBalancerSettings
Load balancing policies to apply for a specific destination. See Envoy's load balancing  documentation  for more details.
For example, the following rule uses a round robin load balancing policy for all traffic going to the ratings service.

apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
  name: bookinfo-ratings
spec:
  host: ratings.prod.svc.cluster.local
  trafficPolicy:
    loadBalancer:
      simple: ROUND_ROBIN

The following example sets up sticky sessions for the ratings service hashing-based load balancer for the same ratings service using the the User cookie as the hash key.

 apiVersion: networking.istio.io/v1alpha3
 kind: DestinationRule
 metadata:
   name: bookinfo-ratings
 spec:
   host: ratings.prod.svc.cluster.local
   trafficPolicy:
     loadBalancer:
       consistentHash:
         httpCookie:
           name: user
           ttl: 0s

There is link for v1.1 documentation.

There is an example with sticky sessions.

Hope you find this useful.


text:
Q: Equivalence of Euclidean norm used in Ostrowski's Theorem In a proof of Ostrowski's theorem (The only nontrivial norms on $\mathbb{Q}$ are $\|\cdot\|_{p}$ and $\|\cdot\|_{\infty}$), we come to the point where we have shown a certain norm, $\|\cdot\|$, has $\|n\|=n^{\alpha}$ for all natural numbers $n$ and a posititve constant $\alpha$. How is it that we can immediately conclude that $\|\cdot\|$ is equivalent to $\|\cdot\|_{\infty}$?  (Two norms are equivalent if they induce equivalent metrics. Two metrics are equivalent if they have the same Cauchy sequences.)  Thank you for any help or insight you can give.

A: Given $\| n \| = n^{\alpha}$ and the property $\| x y \| = \| x \| \cdot \|y \|$, we can derive $\| x \| = \| x \|_{\infty}^{\alpha}$ for all $x \in \mathbb Q$. To prove this, take $x = \frac{m}{n}$, or $m = x \cdot n$; then $\| m \| = \| x \| \cdot \| n \|$.
It remains to show that if two norms $\| \cdot \|$ and $\| \cdot \|_{\infty}$ on a field are (positive) powers of each other, then they are topologically equivalent.
Suppose the sequence $(x_n)$ is Cauchy w.r.t. $\| \cdot \|$. Therefore, given $\varepsilon > 0$, there exists $N$ such that for all $n, m \geqslant N$, we have $\| x_n - x_m \| \leqslant \varepsilon$. Therefore, $\| x_n - x_m \|_{\infty}^{\alpha} \leqslant \varepsilon$, or $\| x_n - x_m \|_{\infty} \leqslant \varepsilon^{1/\alpha}$ for all $n, m \geqslant N$. Since the final statement is true for all $\varepsilon > 0$, it follows that $(x_n)$ is Cauchy w.r.t. $\| \cdot \|_{\infty}$.
Reversing the above argument, we conclude that if $(x_n)$ is Cauchy w.r.t. $\| \cdot \|_{\infty}$, then it is Cauchy w.r.t. $\| \cdot \|$ as well. Thus the norms $\| \cdot \|$ and $\| \cdot \|_{\infty}$ have the same set of Cauchy sequences; i.e., they are topologically equivalent.


text:
Q: How to convert the format of the media source for exoplayer? Is it possible to convert the format of the media source when playing a video with exoplayer? I thought that I could use FFMPEG to convert the format, but I do not really know how exoplayer works and the problem is that the media source is not a file, but a stream. It is avi format, which unfortunately is not supported by exoplayer, and I could not find any working player for android that has avi support.
I see there is a ffmpeg extension for exoplayer, but I do not know if that will solve my problem and I have no idea about NDK and compiling c++ for android and the instructions are very unclear. If someone could explain how to do it or give me a guide that would be nice. This is the link to the exoplayer extension:
ffmpeg extension


text:
Q: Xcode 6 Beta - Apple Mach-O Linker error After updating to the recently released beta 6 of Xcode 6, my swift project fails to build due to the following errors.

Looking at previous questions on this issue, propose checking the build architecture is set to support arm which mine project includes already (arm64, armv7s, armv7).

A: First, make sure you have the most recent beta installed. Afterwards delete your DerivedData folder ( ~/Library/Developer/Xcode/DerivedData ). This should allow you to compile again in the latest beta.
Edit: This appears to hold  true for the newest beta version of the Xcode as well

A: From what I hear, so far Xcode 6 Beta 6 is broken. You should uninstall and rollback to Beta 5.
Edit:
Apparently, a new version is already out, just reinstall beta 6
http://9to5mac.com/2014/08/18/apple-re-releases-xcode-6-beta-6-solves-issues-discovered-by-developers-in-new-build/

A: Make sure you install the latest Xcode Beta 6 version. If you check Xcode->About Xcode, you should see: Version 6.0 (6A280e)

A: I had the same problem. I reinstalled Xcode. then it fixed the problem.
In my case it happened because of deleting a imported framework(move to trash) which is inside my project navigator. I think Xcode delete the whole framework when we delete(move to trash) imported framework from our project navigator.

A: Make sure you haven't done any unnecessary imports example importing an .h file when you needed .m


text:
Q: laravel Only one usage of each socket address i am getting this error a lot lately idk why and i searched but couldnt finda  solution
Illuminate \ Database \ QueryException (2002)
SQLSTATE[HY000] [2002] Only one usage of each socket address (protocol/network address/port) is normally permitted. (SQL: select * from users where id = 1 limit 1)


text:
Q: Highcharts-react not rendering on initial page load I have a simple React component which is supposed to render two Highcharts using the highcharts-react library. The data for the charts comes from a parent component's state and is passed to this component as a prop. When the page loads, the pie chart is empty (eg there's just an empty circle with no series). If I inspect the HighchartsReact element using the React element inspector, I can see that the correct data is in the options prop. Also, if I manually alter any of the data in the inspector, the chart suddenly shows up. My guess is that it has something to do with the chart not updating properly but I can't exactly pin down what I am doing wrong.
const sharedPlotOptions = {
    chart: {
        plotBackgroundColor: null,
        plotBorderWidth: null,
        plotShadow: false,
        type: 'pie'
    },
    title: null,
    tooltip: {
        pointFormat: '{series.name}: {point.percentage:.1f}%'
    },
    plotOptions: {
        pie: {
            allowPointSelect: true,
            cursor: 'pointer',
            dataLabels: {
                enabled: true,
                format: '{point.name}: {point.percentage:.1f} %'
            }
        }
    },
    series: [{
        name: 'Countries',
        colorByPoint: true,
        data: []
    }]
}

export function CountryPopulationPlot(props) {
  let adultData = props.countries.map(country => ({
    name: country.name,
    y: country.population //TODO: use adult only data
  }))

  let allData = props.countries.map(country => ({
    name: country.name,
    y: country.population
  }))

  let adultPlotOptions = sharedPlotOptions
  adultPlotOptions.series[0].data = adultData

  let allPlotOptions = sharedPlotOptions
  allPlotOptions.series[0].data = allData

  return(

      <HighchartsReact
        highcharts={Highcharts}
        options={adultPlotOptions}
        oneToOne={true}
      />
      <HighchartsReact
        highcharts={Highcharts}
        options={allPlotOptions}
      />

  );
}

EDIT: oneToOne prop was an attempt at fixing the bug, it doesn't seem to have any effect.

A: In Highcharts for Pie charts to render, the adultData and allData should be in the format as below:
[
  {
    name: "USA",
    y: 1000
  },
  {
    name: "Italy",
    y: 500
  }
]

(or)
 [
  {
    "name": "USA",
    "y": 1000
  },
  {
    "name": "Italy",
    "y": 500
  }
]

Please double check this in your input data. I have written a blog post and a working application on GitHub with a simple Highcharts Pie chart example. Please check: http://softwaredevelopercentral.blogspot.com/2020/03/react-highcharts-and-spring-boot.html

A: I'm having the same issue and found a rough workaround. Like you said this happens on the initial component render. Therefore triggering a re-render by updating a state solves the problem.
const [shouldRender, doRender] = useState(true)
useEffect(() => {
   if (shouldRender) {  // this stops the cycle after the first re-render
      doRender(!shouldRender)
}

Would like to add in case someone has a better solution, I'm rendering multiple graphs with the same props and only pie charts are an issue.


text:
Q: If the radiation emitted by an accelerated electron was sent back to the electron, would the electron decelerate? Basically I am asking if photons can be used to change the speed of an electron. Electrons emits electromagnetic radiation when they are accelerated (cyclotron radiation, etc). Can this be reversed? I suspect I might be merely asking if a receiving antenna exists -- which obviously does -- but I am not sure this is the same.

A: Electrons and photons are elementary particles  and their interaction is described  as electron photon scattering by quantum electrodynamis (QED) . As with all interactions input energy-momentum has to be conserved, and there is a probability both for a higher momentum for the electron (acceleration) or higher energy/momentum of the photon. ( quantum mechanical calculations lead to probability distributions)

Electrons emits electromagnetic radiation when they are accelerated (cyclotron radiation, etc).

This is the classical , i.e using Maxwell's equations  framework for accelerated charged particles.  Classically it is not photons that come out, but electromagnetic radiation. The classical calculation  is also correct for an accelerated electron because the classical and QED calculations are consistent with each other. But when one is at the particle frame one uses the energy-momentum four vectors of the particles.
At the QED calculation level   it is a part of the electron photon interaction ( virtual photons given by  the accelerating electric field) that gives the probability for real photon emission.

Can this be reversed

At the QED level it is reversed, when electrons are accelerated with an electric field, except the photon is a virtual photon provided by the field.

If the radiation emitted by an accelerated electron was sent back to the electron, would the electron decelerate?

So , because the electron emits single photons it is not radiation that can be sent back but a photon that will interact and give a probability for deceleration.
Now in a collective electron beam radiating classical electromagnetic waves, an experiment of sending back that radiation to the beam one would have to calculate the disruption to the beam energy by the individual electron photon scatterings.


text:
Q: HTTP Status 500 - The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed I'm trying to run a web application in myEclipse(latest version) using Tomcat 7. As such, I've included JSTL 1.2 jar files as shown here
But when I run the application and try to log in(through the log-in form), I get this error.
Here's the full log of the error on the console:
Jun 20, 2021 4:51:11 PM org.apache.catalina.core.ApplicationDispatcher invoke
SEVERE: Servlet.service() for servlet jsp threw exception
org.apache.jasper.JasperException: The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application
    at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:56)
    at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:445)
    at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:117)
    at org.apache.jasper.compiler.TagLibraryInfoImpl.generateTLDLocation(TagLibraryInfoImpl.java:311)
    at org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:152)
    at org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:410)
    at org.apache.jasper.compiler.Parser.parseDirective(Parser.java:475)
    at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1427)
    at org.apache.jasper.compiler.Parser.parse(Parser.java:138)
    at org.apache.jasper.compiler.ParserController.doParse(ParserController.java:242)
    at org.apache.jasper.compiler.ParserController.parse(ParserController.java:102)
    at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:198)
    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:373)
    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:353)
    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:340)
    at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:646)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:749)
    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:487)
    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:412)
    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:339)
    at edu.securemail.controller.Controller.doPost(Controller.java:177)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
    at java.base/java.lang.Thread.run(Thread.java:832)
Jun 20, 2021 4:51:11 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [edu.securemail.controller.Controller] in context with path [/SecureMail] threw exception [The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application] with root cause
org.apache.jasper.JasperException: The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application
    at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:56)
    at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:445)
    at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:117)
    at org.apache.jasper.compiler.TagLibraryInfoImpl.generateTLDLocation(TagLibraryInfoImpl.java:311)
    at org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:152)
    at org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:410)
    at org.apache.jasper.compiler.Parser.parseDirective(Parser.java:475)
    at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1427)
    at org.apache.jasper.compiler.Parser.parse(Parser.java:138)
    at org.apache.jasper.compiler.ParserController.doParse(ParserController.java:242)
    at org.apache.jasper.compiler.ParserController.parse(ParserController.java:102)
    at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:198)
    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:373)
    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:353)
    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:340)
    at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:646)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:749)
    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:487)
    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:412)
    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:339)
    at edu.securemail.controller.Controller.doPost(Controller.java:177)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
    at java.base/java.lang.Thread.run(Thread.java:832)

I've also copied the jstl files directly to my WEB-INF folder of the project as I saw in some of the forums. But the error still doesn't go away.
And also, my web.xml file looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
  <display-name>SecureMail</display-name>
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
  </welcome-file-list>

  <servlet>
    <description></description>
    <display-name>Controller</display-name>
    <servlet-name>Controller</servlet-name>
    <servlet-class>edu.securemail.controller.Controller</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>Controller</servlet-name>
    <url-pattern>*.html</url-pattern>
  </servlet-mapping>

  <resource-ref>
    <description>DB Connection</description>
    <res-ref-name>jdbc/secure_mail</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
  </resource-ref>
</web-app>

And it's showing the following error.
I don't know if it has anything to do with the error or not. I'm totally confused and I don't even know where to start. The odd thing is that my database is updating the tables as I enter the data in the form, even though the web application keeps throwing this error my way.

A: I got it! All I had to do was to copy the jstl files into the WEB-INF->lib folder. Problem was, there was no lib folder inside the WEB-INF folder of my project, so I created one. After that, I copied those three jstl files into the WEB-INF->lib folder and viola! My project is working.


text:
Q: error while running sc create command through java I want to register the service in windows and after register wants to start also.
using following command in the code::
cmd.exe /C sc create "<service name>" binpath="D:\\abc\\xyz.exe -zglaxservice xyz"

I execute above command through runtime.exec().
upon running the code it gives the help of sc command.
Code ::
Process proc = null;
String[] cmdStr = new String[] { "cmd.exe","/C","sc", "create", "\""+servicename+"\"", "binpath= \"D:\\SCCode\\"+exeName+".exe -zglaxservice "+laxName+"\"" };
proc = Runtime.getRuntime().exec(cmdArr);

Please help...

A: Two issues with the command
cmd.exe /C sc create "" binpath="D:\abc\xyz.exe -zglaxservice xyz"

*

*Service name is missing

*After = (equals symbol) you need to put a space.

So the correct command would be as follows:
cmd.exe /C sc create "ServiceName" binpath= "D:\abc\xyz.exe -zglaxservice xyz"
I observed you did some modification, although still you command line string is not correct (couple of space is missing). The correct one would be as follows:
String[] cmdStr = new String[] { "cmd.exe ","/C ","sc ", "create ", "\""+servicename+"\"", " binpath= \"D:\\SCCode\\"+exeName+".exe -zglaxservice "+laxName+"\"" };

I tried above and I was getting issue as
'"sc "' is not recognized as an internal or external command

which comes if your java is not running in admin mode, since sc command requires your cmd command to run in admin mode.
If you are facing the same issue, please check below link:
Run command prompt as Administrator

A: This solution works for me:
cmd.exe /C sc create "cdfa$" binpath= "F:\Connect_Direct\Sterling Commerce\FileAgent\cdfa$.exe -zglaxservice cdfa$"


text:
Q: Convert Latitude/Longitude to decimal degrees i need to convert a large txt file with latitudes, and a large txt file with longitudes into decimal degrees.
The data i have is in the current format:
7d44'31.495"W for longitude

and
41d3'40.313"N for latitude

i need to convert both of this files to decimal degrees (using a script preferably). How can i do this?

A: Knowing nothing about *itudes, I can only give you a general idea about how
to solve your problem:
Use a RegExp to cut the numbers from your data and feed them in a trusted formula
To give you some confidence in my proposal, I show you, how I would tackle
the two sub-problems of your task.
(1) Apply a RegExp on an input string and calculate.
Based on this section

Conversion from DMS to Decimal Degree
Given a DMS (Degrees, Minutes, Seconds) coordinate such as W87°43'41",
  convert it to a number of decimal degrees using the following method:
Calculate the total number of seconds:
43'41" = (43*60 + 41) = 2621 seconds.
The fractional part is total number of seconds divided by 3600:
2621 / 3600 = ~0.728056
Add fractional degrees to whole degrees to produce the final result:
87 + 0.728056 = 87.728056
Since it is a West longitude coordinate, negate the result.
The final result is -87.728056.

found here
Code:
  Dim oFmt   : Set oFmt = New cFormat
  Dim oRE    : Set oRE  = New RegExp
  '                 0    1     2     3
  oRE.Pattern = "^([W])(\d+)°(\d+)'(\d+)""$"
  Dim aTests : aTests   = Array( _
      Array("W87°43'41""", -87.728056) _
  )
  Dim aTest
  For Each aTest In aTests
      Dim sInp : sInp     = aTest(0)
      Dim nExp : nExp     = aTest(1)
      Dim oMTS : Set oMTS = oRE.Execute(sInp)
      Dim sMsg
      If 1 <> oMTS.Count Then
         sMsg = oFmt.formatTwo("|{0}| didn't match /{1}/", sInp, oRE.Pattern)
      Else
         Dim sLoLa    : sLoLa    =      oMTS(0).SubMatches(0)
         Dim nDegrees : nDegrees = CDbl(oMTS(0).SubMatches(1))
         Dim nMinutes : nMinutes = CDbl(oMTS(0).SubMatches(2))
         Dim nSeconds : nSeconds = CDbl(oMTS(0).SubMatches(3))
         Dim nRes

'        Calculate the total number of seconds:
'        43'41" = (43*60 + 41) = 2621 seconds.
         nRes = nMinutes * 60 + nSeconds
'        WScript.Echo "***", nRes

'        The fractional part is total number of seconds divided by 3600:
'        2621 / 3600 = ~0.728056
         nRes = nRes / 3600
'        WScript.Echo "***", nRes

'        Add fractional degrees to whole degrees to produce the final result:
'        87 + 0.728056 = 87.728056
         nRes = nDegrees + nRes
'        WScript.Echo "***", nRes

'        Since it is a West longitude coordinate, negate the result.
'        The final result is -87.728056.
         Select Case sLoLa
           Case "W"
             nRes = -nRes
         End Select

         sMsg = oFmt.formatArray(_
              "{0,-12}: R: {1,12:N6} E: {2,12:N6} D: {3,12:N6}" _
            , Array(sInp, nRes, nExp, nRes - nExp) _
         )
      End If
      WScript.Echo sMsg
  Next

Output:
Step00 - conversion a la wikipedia
================================================================
W87°43'41"  : R:   -87,728056 E:   -87,728056 D:     0,000000
================================================================
xpl.vbs: Erfolgreich beendet. (0) [0.08594 secs]

Starting from an input sample, I derive (a first attempt at) the Regexp
pattern
                "   W   87  ° 43  ' 41  "" "
  '                 0    1     2     3
  oRE.Pattern = "^([W])(\d+)°(\d+)'(\d+)""$"

For your data, something like this
                "   7  d 44  ' 31.495   ""  W    "
                "  41  d  3  ' 40.313   ""  N    "
  '                 0     1        2        3
  oRE.Pattern = "^(\d+)d(\d+)'(\d+\.\d+)""([WN])$"

may be appropriate.
To get the parts captured by the RegExps group ()s, I access and convert
the match's submatches
 Dim sLoLa    : sLoLa    =      oMTS(0).SubMatches(0)
 Dim nDegrees : nDegrees = CDbl(oMTS(0).SubMatches(1))
 Dim nMinutes : nMinutes = CDbl(oMTS(0).SubMatches(2))
 Dim nSeconds : nSeconds = CDbl(oMTS(0).SubMatches(3))

Then it's just computing according to the algorithm/formulas stolen
from Wikipedia (see the code/comments).
(2) Get the data from your files
If the files are not to big, you can .ReadAll() them into memory and
apply the RegExp in multiline mode:
  Dim oFmt : Set oFmt = New cFormat

  Dim oRE  : Set oRE  = New RegExp
  oRE.Global    = True
  oRE.Multiline = True
  '                 0     1        2        3
  oRE.Pattern = "^(\d+)d(\d+)'(\d+\.\d+)""([WN])$"

  Dim sAll : sAll = goFS.OpenTextFile("..\data\f00.txt").ReadAll()
  WScript.Echo sAll

  WScript.Echo oFmt.formatArray( _
      "|{0,-5}|{1,-11}|{2,-11}|{3,-15}|" _
    , Array("LoLa", "Degrees", "Minutes", "Seconds") _
  )

  Dim oMTS : Set oMTS = oRE.Execute(sAll)
  Dim oMT
  For Each oMT In oMTS
      Dim sLoLa    : sLoLa    =      oMT.SubMatches(3)
      Dim nDegrees : nDegrees = CDbl(oMT.SubMatches(0))
      Dim nMinutes : nMinutes = CDbl(oMT.SubMatches(1))
      Dim nSeconds : nSeconds = CDbl(oMT.SubMatches(2))

      WScript.Echo oFmt.formatArray( _
          "|{0,-5}|{1,11:N2}|{2,11:N2}|{3,15:N6}|" _
        , Array(sLoLa, nDegrees, nMinutes, nSeconds) _
      )
  Next

output:
======================================================
7d44'31.495"W
41d3'40.313"N

|LoLa |Degrees    |Minutes    |Seconds        |
|W    |       7,00|      44,00|      31,495000|
|N    |      41,00|       3,00|      40,313000|
======================================================

Get the cFormat class from here


text:
Q: Stream of items, each producing n{ http request } > merge{response} > wrapInHeaderAndFooter{data} > http-request I am trying to solve a classic ETL problem using streaming. I have a batch of segments, Each segment holds information about the records associated for that segment like number of records, url to retrieve etc, to issue a http request to collect data. I need to extract the records from a source with paging size of 100 records, merge the pages of records for each segment, wrap in a xml header and footer. Now send each xml payload per segment to a target.

                 {http}
                 page 1
                 /      \
       seg 1 >  page 2  -> merge -> wrapHeaderAndFooter -> http target
          /      \      /
         /       page n
        /
       /
batch -  seg 2                    "                     -> http target
       \ seg n                    "                     -> http target

val loadSegment: Flow[Segment, Response, NotUsed] = {
    Flow[Segment].mapAsync(parallelism = 5) { segment =>
      val pages: Source[ByteString, NotUsed] = pagedPayload(segment).map(page => page.payload)
//Using source concatenation to prepend and append
      val wrappedInXML: Source[ByteString, NotUsed] = xmlRootStartTag ++ pages ++ xmlRootEndTag
      val httpEntity: HttpEntity = HttpEntity(MediaTypes.`application/octet-stream`, pages)
        invokeTargetLoad(httpEntity, request, segment)
    }
  }
def pagedPayload(segment: Segment): Source[Payload, NotUsed] = {
    val totalPages: Int =   calculateTotalPages(segment.instanceCount)
      Source(0 until totalPages).mapAsyncUnordered(parallelism = 5)(i => {
        sendPayloadRequest(request, segment, i).mapTo[Try[Payload]].map(_.get)
      })
  }

val batch: Batch = someBatch
  Source(batch.segments)
    .via(loadSegment)
    .runWith(Sink.ignore)
    .andThen {
      case Success(value) => log("success")
      case Failure(error) => report(error)
    }

Is there a better approach? I am trying to use the HttpEntity.Chunked encoding to stream the pages. Sometimes the first request from the source can take longer time due to warm up and the target truncates the stream with no data. Is there a way to delay the actual connection to target until we have the first page in stream?
I would have more liked to do something like below. if it's possible how to implement methods wrapXMLHeader & toHttpEntity
val splitPages: Flow[BuildSequenceSegment, Seq[PageRequest], NotUsed] = ???
  val requestPayload: Flow[Seq[PageRequest], Seq[PageResponse], NotUsed] = ???
  val wrapXMLHeader: Flow[Seq[PageResponse], Seq[PageResponse], NotUsed] = ???
  val toHttpEntity: Flow[Seq[PageResponse], HttpEntity.Chunked, NotUsed] = ???
  val invokeTargetLoad: Flow[HttpEntity.Chunked, RestResponse, NotUsed] = ???

  Source(batch.segments)
    .via(splitPages)
    .via(requestPayload)
    .via(wrapXMLHeader)
    .via(toHttpEntity)
    .via(invokeTargetLoad)
    .runWith(Sink.ignore)


text:
Q: Select group that every member of that team dont have specific value in column CREATE TABLE Dzialania
(id_harcerza int NOT NULL PRIMARY KEY,
id_sprawnosci text NOT NULL);

id_harcerza | id_sprawnosci
-----------------------------
1           | S1
1           | S2
2           | S6
2           | S4
3           | S6
4           | S3

CREATE TABLE Harcerze
(id_harcerza int NOT NULL,
Druzyna text NOT NULL);

id_harcerza | druzyna
-----------------------------
1           | Team1
2           | Team2
3           | Team2
4           | Team1
5           | Team3

Hi guys, im so tired so i need your help with some SQL.
So i have two tables, "Harcerze" and "Dzialania".
I need to select only one "Druzyna" that every member of that group dont have S6 value in "Id_sprawnosci" column in "Dzialania" table
On that example data i used above. It should return Team1 because its the only group that dont have any member with S6 value.

A: One method uses left join and group by with a having clause:
select d.druzyna
from Dzialania d left join
     Harcerze h
     on h.id_harcerza = d.id_harcerza and
        h.id_sprawnosci = 6
group by d.druzyna
having count(h.id_harcerza) = 0;

A: SELECT
  h.druzyna
FROM
  Harcerze    AS h
INNER JOIN
  Dzialania   AS d
    ON d.id_harcerza = h.id_harcerza
GROUP BY
  h.druzyna
HAVING
  COUNT(CASE WHEN d.id_sprawnosci = 'S6' THEN 1 END) = 0


text:
Q: What is the difference between metric spaces and vector spaces? Does a metric space have an origin? That is, does it have $(0,0)$.
Does a vector space have an origin?
It seems whatever you can do in a metric space can also be done in a vector space. Is this true?

A: A metric space is a set with a notion of distance defined between points of that set. This notion of distance is a function known as the metric (which must satisfy a set of axioms pertaining to distance). This metric takes in any two points and maps them onto a real number which characterises the distance between those two points.
A vector space is a set containing objects called vectors which interact in some pre-defined way determined by the axioms. Vectors are measured relative to some reference frame and thus have a notion of magnitude and direction from some origin.

A: This is an ancient question; it also has been correctly answered. But maybe I can provide a perspective from Applied Mathematics.
A vector space with a finite number of dimensions $n$ must have a global coordinate structure (actually, many such structures) specified by $n$ vectors. For example, $\mathbb R^3$ has a global coordinate structure whose basis vectors are
$$ X = (1, 0, 0) $$
$$ Y = (0, 1, 0) $$
$$ Z = (0, 0, 1) $$
What I mean by "coordinate structure" is that points of $\mathbb R^3$ can be specified as a linear combination of these three vectors:
$$ v = (a X + b Y + c Z, d X + e Y + f Z, g X + h Y + i Z) $$
For the canonical basis above this is easy to see; there are more complicated choices of basis, but at any rate, this works for every element of $\mathbb R^3$.
Now take something as planet Earth. Obviously Earth isn't a mathematical object, and admits multiple mathematical models -- cosmologists see it as three-dimensional and who knows what contemporary physicists are up to. But we don't see Earth in three dimensions -- it's the literal 2D ground on which we walk. Still, it's notorious that a proper two-dimensional coordinate system for the Earth cannot be found.
One way to put this is that this model of the Earth is a two-dimensional manifold embedded in $\mathbb R^3$. But technically manifolds don't need to be embedded in anything; they just need to have some local structure that's out of scope for us. But the point is that we can easily define distances on Earth: two possible choices are geodesic (shortest flyover) and shortest-possible walking distance. We don't care how high the Everest is in a putative third dimension, we care how far it is on foot.
So that's a metric space (please check the axioms to convince yourself this is true); but not a vector space.
My current research has to do with Nearest Neighbors methods for data science. A conceptual point that I stress is that NN methods are useful when the data can be given a distance structure, but not a (credible) vector space structure. Take something like underwear: we can clearly say that U1 is closer to U2 than to U3, but it's much harder to imagine that there are basis vectors such that all underwear is just combinations of it. I.e. often the domain problems that arrive at the data scientist's desk have definite similarity structure but not a clear global coordinate structure.
(Of course, the Nearest Neighbor algorithm ultimately does calculations with computer arrays representing vectors; the entire challenge is to find "metric learning" algorithms that figure out the appropriate distance function near each point and map the data onto something on which the standard vector distances represent the abstract, ground-truth distances between objects. But this too is besides the point.)

A: No, a metric space does not have any particular distinguished point called "the origin".  A vector space does: it is defined by the property $0 + x = x$ for every $x$.
In general, in a metric space you don't have the operations of addition and scalar multiplication that you have in a vector space.  On the other hand, in general a vector space does not have a notion of "distance".

A: Vector spaces necessarily have a vector called the "zero vector"; in the special case of the vector space $k^n$ (where $k$ is a field), this vector is often called "the origin", since $k^n$ also can be seen as a geometric object (the $n$-dimensional affine space). But vector spaces don't necessarily have something we call "the origin": the collection of all polynomials with real coefficients is a real vector space, but we don't normally refer to the zero polynomial as "the origin", even though it is the zero vector of this vector space.
Metric spaces are sets with a metric defined on them. For example, the collection of all complex numbers with complex norm $1$, and with metric given by the usual distance between them as complex numbers, is a metric space. Any nonempty subset of the real numbers, with the usual distance function, is a metric space; and any nonempty set $X$, with distance defined by $d(x,y) = 0$ if $x=y$ and $d(x,y)=1$ if $x\neq y$, is a metric space. There need not be anything that we can reasonably call "the origin."

A: A metric space is a set with a distance. That's all you know. That means the set may not have an algebraic structure. for example, {chair, apple} is a set. define d(apple, apple) = d(chair, chair) = 0 and d(chair, apple) = d(apple, chair) = 1. That's a metric space, and it doesnt look like a vectorial space at all.

A: I think the OP is confusing a vector space with a normed vector space,which indeed shares many properties of general metric spaces.And for a very simple reason: A norm induces a metric on the underlying set on which the map is defined.This is fairly simple to prove from the definitions and the questioner should try and do it. A general vector space does NOT necessarily have these properties,of course.It is not even necessary that a general vector space admits any notion of distance whatsoever.


text:
Q: Jquery on(), reference dynamically generated element $('body').on('input', $('#images_finder').find('input[type=search]'), function (event) {
});

Consider the code above, I was (wrongly?) expecting $(this) within this block to point to the element matching the selector I'm passing, but it points to body instead.
If I try to find the element again it doesn't work
$('body').on('input', $('#images_finder').find('input[type=search]'), function (event) {
    console.log($('#images_finder').find('input[type=search]').prop('tagName'));
    // returns undefined

});

What's the correct way to reference it?


text:
Q: Scroll to specific div/height after loading page if certain condition matches I want to scroll to a div after loading page means my starting point is that specific div  and curser should point to that div.i tried several things ,
if ($stateParams.year) {
    console.log("hiop");
    //window.scrollTo(0, 800);
    $(document).scrollTop( $("#scrollToChart").offset().top );
    // $(window).scroll(function(){
    //  $("#scrollToChart").css("margin-top", Math.max(-250, 0 - $(this).scrollTop()));
    // });
    //$('html, body').animate({ scrollTop: $('#scrollToChart').offset().top}, 800);
    //$(window).scrollTop($("#scrollToChart").offset().top).scrollLeft($("#scrollToChart").offset().left);
    //  // $('html,body').animate({scrollTop: 0}, -1000);
    //
    //  //window.scrollTo(0, 800);
    //  //window.onload = scrollToChart();
    //  $(document).ready(function() {
    //      $('html,body').animate({
    //              scrollTop: $(".scrollToChart").offset().top
    //          },
    //          'slow');
    //  });
    //  //$(".scrollToChart").bind('mouseenter', 'scrollTo',);
    // //   $(window).scrollTop($('.scrollToChart').offset().top);
    //
    //  // $(".scrollToChart").ready(function(){
    //  //  $("html, body").delay(2000).animate({
    //  //      scrollTo: $('.scrollToChart').offset().top
    //  //  }, 2000);
    //  // });
}

             //content

But issue is when page is loading curser is pointing to  the location where i want to but after complete load page scrolls up. Any solution ?

A: Give this a whirl:
$(document).ready(function() {
    $('html,body').animate({
        scrollTop: $("#scrollToChart").offset().top
    }, 1000);
});

A: If you wanna do it your way, your commented out code would work if you used the id, since the div you're targeting doesn't have a class..
$('#scrollToChart') instead of $('.scrollToChart')

If you don't need the actual animated scrolling just use this one-liner...
window.location.href='#scrollToChart'

window.location.href='#scrollToChart'

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

scroll to here

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

stuff

A: I got the problem , the problem was not logic. I was calling scrollTop on every state change on loading . And 'scroll to specific div' logic was executing before  $rootScope.$on('$stateChangeSuccess') .So i set the timeout for that logic and it worked !!!
setTimeout(function () {
                scrollToChart();
            },1300);

    var scrollToChart = function () {
        if ($stateParams.year) {

            $(document).ready(function () {
                $('html,body').animate({
                    scrollTop: $("#scrollToChart").offset().top
                }, 1000);
            });

        }
    };


text:
Q: How to save the response of a Tavern test in a JSON file? I am using Tavern tool for API testing and I want to save the returned response in a JSON file while the test is being executed so I am using the following code in response of the yaml test file:
 response:
    status_code: 200
    save:
      $ext:
        function: tavern_utils:save_response

The tavern_utils:save_response() function:
def save_response(response):
    with open('saved.json','w') as file:
       json.dump(file,response.json())

So while executing the test with pytest, I get the following error:
TypeError: The Object of type 'TextIOWrapper' is not JSON serializable

How to solve this error or save the response by any other method?

A: Got the solution:
Just replace the save_response function with this:
def save_response(response):
    filename='file4.json'
    with open(filename, 'w') as f:
        json.dump(response.json(), f)

And the Yaml test file as:
  response:
    status_code: 200
    body:
      $ext:
        function: tavern_utils:save_response

A: A TextIOWrapper is an open text file, or something that acts like one (in your case some kind of net response object). You obviously can't serialize that (it would have to store the entire state of the server and the network connection between you and the server to restore the same object).
If you're looking to serialize the lines in the file, as a list of strings, that's easy. A file object is an iterator over its lines, so:
list(f)

… gives you a list of those lines.
If you want to serialize it as one giant string, you can do that too:
f.read()

Or, if the file's contents are already a JSON-encoded string, and you want to decode that to a value that you can serialize, you could json.load it. But, unless you're doing this to validate that it really is valid JSON, this is kind of silly; you could just read the JSON string as a string and write it back out as a string without doing any JSON stuff anywhere.
If you want something different than any of these, you'll need to explain what you're trying to do, but it's probably doable.
If you want something different


text:
Q: Moving a specific column of a dataframe to first column I have a dataframe as follows:
s = df.head().to_dict()
print(s)

{'BoP transfers': {1998: 12.346282212735618,
  1999: 19.06438060024298,
  2000: 18.24888031473687,
  2001: 24.860019912667006,
  2002: 32.38242225822908},
 'Current balance': {1998: -6.7953,
  1999: -2.9895,
  2000: -3.9694,
  2001: 1.1716,
  2002: 5.7433},
 'Domestic demand': {1998: 106.8610389799729,
  1999: 104.70302507466538,
  2000: 104.59254229534136,
  2001: 103.83532232336977,
  2002: 102.81709401489702},
 'Effective exchange rate': {1998: 88.134,
  1999: 95.6425,
  2000: 99.927725,
  2001: 101.92745,
  2002: 107.85565},
 'RoR (foreign liabilities)': {1998: 0.0433,
  1999: 0.0437,
  2000: 0.0542,
  2001: 0.0539,
  2002: 0.0474},
 'Gross foreign assets': {1998: 19.720897432405103,
  1999: 22.66200738564236,
  2000: 25.18270679890144,
  2001: 30.394226651732836,
  2002: 37.26477320359688},
 'Gross domestic income': {1998: 104.9037939043707,
  1999: 103.15361867816479,
  2000: 103.06777792080423,
  2001: 102.85886528974339,
  2002: 102.28518242008846},
 'Gross foreign liabilities': {1998: 60.59784839338306,
  1999: 61.03308220978983,
  2000: 64.01438055825233,
  2001: 67.07798172469921,
  2002: 70.16108592109364},
 'Inflation rate': {1998: 52.6613,
  1999: 19.3349,
  2000: 16.0798,
  2001: 15.076,
  2002: 17.236},
 'Credit': {1998: 0.20269913592846378,
  1999: 0.2154280880177353,
  2000: 0.282948948505006,
  2001: 0.3954812893893278,
  2002: 0.3578263032373988}}

which can be converted back to its original form using:
df = pd.DataFrame.from_dict(s)

Suppose, I want to move the column named "Gross foreign liabilities" to the first column. I know this can be done by reindexing. However, in my case the dataframe has 100 columns. How can I move say a specific column the very beginning? I read about pandas pop() method, but in my framework I get an error.

A: Here are a few ways I do it:
columns = df.columns.tolist()
columns.insert(0, columns.pop(columns.index("Gross foreign liabilities")))
df = df.reindex(columns=columns)

OR
col = ["Gross foreign liabilities"]
df = df[col + [x for x in df.columns if x not in col]]

A: You can use pop and insert:
name = 'Gross foreign liabilities'
df.insert(0, name, df.pop(name))

as a function:
def move_first(df, name):
    df.insert(0, name, df.pop(name))

move_first(df, 'Gross foreign liabilities')

Output:
      Gross foreign liabilities  BoP transfers  Current balance  \
1998                  60.597848      12.346282          -6.7953
1999                  61.033082      19.064381          -2.9895
2000                  64.014381      18.248880          -3.9694
2001                  67.077982      24.860020           1.1716
2002                  70.161086      32.382422           5.7433

      Domestic demand  Effective exchange rate  RoR (foreign liabilities)  \
1998       106.861039                88.134000                     0.0433
1999       104.703025                95.642500                     0.0437
2000       104.592542                99.927725                     0.0542
2001       103.835322               101.927450                     0.0539
2002       102.817094               107.855650                     0.0474

      Gross foreign assets  Gross domestic income  Inflation rate    Credit
1998             19.720897             104.903794         52.6613  0.202699
1999             22.662007             103.153619         19.3349  0.215428
2000             25.182707             103.067778         16.0798  0.282949
2001             30.394227             102.858865         15.0760  0.395481
2002             37.264773             102.285182         17.2360  0.357826

A: Example
data = {'col1': {0: 0, 1: 2}, 'col2': {0: 1, 1: 3}, 'col3': {0: 2, 1: 4}}
df = pd.DataFrame(data)

df
    col1    col2    col3
0   0       1       2
1   2       3       4

Code
df.insert(0, 'col3', df.pop('col3'))

output(df):
    col3    col1    col2
0   2       0       1
1   4       2       3

make example more simple plz


text:
Q: Выдаёт ошибку при попытке создать png файл import pyqrcode

qr = pyqrcode.create('https://www.instagram.com/armanchev/')
qr.png('d:\\Download\\qr3.png', scale=60, background='green')

Ошибка:
Traceback (most recent call last):
File "D:\Docs\pycharm\autopress\main.py", line 5, in <module>
qr.png('d:\\Download\\qr3.png', scale=60, background='green')
File "D:\Docs\pycharm\autopress\venv\lib\site-packages\pyqrcode\__init__.py", line 462, in png builder._png(self.code, self.version, file, scale,
File "D:\Docs\pycharm\autopress\venv\lib\site-packages\pyqrcode\builder.py", line 1266, in _png import png
ModuleNotFoundError: No module named 'png'

A: Ошибка означает, что у вас не установлен указанный модуль:
ModuleNotFoundError: No module named 'png'

В документации к модулю pyqrcode есть об этом указание:

If you install the optional pypng library, you can also render the
code as a PNG image

Похоже, имеется ввиду эта библиотека: https://pypi.org/project/pypng/
Нужно установить её:
pip install pypng


text:
Q: Do not allow passwords to be saved in Remote desktop connection Greeting,
I have a PC with Windows 7 home edition. As known, Windows 7 home edition has no Group Policy setting option. I want to disable saving password and user name option in  Remote desktop connection and I know how to do it with gpedit.msc but now without having this option how can I  disable saving password and user name option in  Remote desktop connection?
by the way, I'm using rdp file to connect.
Please advice.
Regards,

A: Not sure if this works on the home edition, but this is what the policy effectively does:

*

*Open regedit

*Navigate to HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows
NT\Terminal Services

*Create or edit a DWORD named DisablePasswordSaving and set the value
to 1 (any non-zero value should do)
If you just want to apply this to a single user and not for all users, make this change to the same key in the HKEY_CURRENT_USER hive instead of HKEY_LOCAL_MACHINE


text:
Q: Overlay behavior when zooming I am having trouble with overlays. I have drawn a polygon overlay on the map, however, when I zoom in or out, the edges no longer align with where I want them to. How can I fix this?
Here is what it looks like when I start the app (it covers the whole parking lot perfectly):
Correct
Here is what it looks like when I zoom out (edges no longer line up with parking lot. The overlay looks a bit bigger than the parking lot):
Zoomed out
Also, it doesn't align well when I zoom in. In this case the overlay is a bit smaller that the parking lot. (Sorry, stackoverflow won't let me post more that 2 links)
Any suggestions on how to fix this?
Here is the code:
private Projection projection;
private List<Overlay> mapOverlays;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    MapView mapView = (MapView) findViewById(R.id.mapView);
    mapView.setBuiltInZoomControls(true);

    MapController mc = mapView.getController();
    mc.setZoom(17);
    mc.animateTo(new GeoPoint((int)(32.734248*1E6), (int)(-97.113448*1E6)));

    mapOverlays = mapView.getOverlays();
    projection = mapView.getProjection();
    mapOverlays.add(new MyOverlay());

    mapView.postInvalidate();
}

@Override
protected boolean isRouteDisplayed() {
    return false;
}

class MyOverlay extends Overlay{

    public MyOverlay(){

    }

    public void draw(Canvas canvas, MapView mapv, boolean shadow){
        super.draw(canvas, mapv, shadow);

        Paint   mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
        mPaint.setColor(Color.RED);
        mPaint.setStyle(Paint.Style.FILL);
        mPaint.setAlpha(100);

        GeoPoint gP1 = new GeoPoint(32733839,-97112976);
        GeoPoint gP2 = new GeoPoint(32733875, -97113448);
        GeoPoint gP3 = new GeoPoint(32734961,-97113455);
        GeoPoint gP4 = new GeoPoint(32734953, -97112962);

        Point p1 = new Point();
        Point p2 = new Point();
        Point p3 = new Point();
        Point p4 = new Point();
        Path path = new Path();

        projection.toPixels(gP1, p1);
        projection.toPixels(gP2, p2);
        projection.toPixels(gP3, p3);
        projection.toPixels(gP4, p4);

        path.moveTo(p1.x, p1.y);
        path.lineTo(p2.x,p2.y);
        path.lineTo(p3.x,p3.y);
        path.lineTo(p4.x,p4.y);

        canvas.drawPath(path, mPaint);
    }
}

}

A: Everytime the zoom changes, Projection also changes. Even when you make a large move in the map without changing zoom, projection may change.
To correct your code you need to add the line as bellow:
public void draw(Canvas canvas, MapView mapv, boolean shadow){
    super.draw(canvas, mapv, shadow);

    Projection projection = mapv.getProjection();  //Add this line

    Paint   mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mPaint.setColor(Color.RED);
    mPaint.setStyle(Paint.Style.FILL);
    mPaint.setAlpha(100);

    GeoPoint gP1 = new GeoPoint(32733839,-97112976);
    GeoPoint gP2 = new GeoPoint(32733875, -97113448);
    GeoPoint gP3 = new GeoPoint(32734961,-97113455);
    GeoPoint gP4 = new GeoPoint(32734953, -97112962);

    Point p1 = new Point();
    Point p2 = new Point();
    Point p3 = new Point();
    Point p4 = new Point();
    Path path = new Path();

    projection.toPixels(gP1, p1);
    projection.toPixels(gP2, p2);
    projection.toPixels(gP3, p3);
    projection.toPixels(gP4, p4);

    path.moveTo(p1.x, p1.y);
    path.lineTo(p2.x,p2.y);
    path.lineTo(p3.x,p3.y);
    path.lineTo(p4.x,p4.y);

    canvas.drawPath(path, mPaint);
}

And you can remove the projection created in onCreate().
--EDITED--
Improvements - Quick wins
onDraw() is called twice eveytime you move the map or change zoom level, so it's important to make it as possible. Bellow you can find some suggestions:
private List<Overlay> mapOverlays;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    MapView mapView = (MapView) findViewById(R.id.mapView);
    mapView.setBuiltInZoomControls(true);

    MapController mc = mapView.getController();
    mc.setZoom(17);
    mc.animateTo(new GeoPoint((int)(32.734248*1E6), (int)(-97.113448*1E6)));

    mapOverlays = mapView.getOverlays();
    mapOverlays.add(new MyOverlay());

    mapView.postInvalidate();
}

@Override
protected boolean isRouteDisplayed() {
    return false;
}

class MyOverlay extends Overlay{

    //Moved objects that need only one instance to the initialization, to avoid creating a new copy of each every time draw() runs
    private Paint   mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);

    private GeoPoint gP1 = new GeoPoint(32733839,-97112976);
    private GeoPoint gP2 = new GeoPoint(32733875, -97113448);
    private GeoPoint gP3 = new GeoPoint(32734961,-97113455);
    private GeoPoint gP4 = new GeoPoint(32734953, -97112962);

    private Point p1 = new Point();
    private Point p2 = new Point();
    private Point p3 = new Point();
    private Point p4 = new Point();
    private Path path = new Path();

    public MyOverlay(){
        //mPaint settings done on class creation, to avoid repeating them on draw() call
        mPaint.setColor(Color.RED);
        mPaint.setStyle(Paint.Style.FILL);
        mPaint.setAlpha(100);
    }

    public void draw(Canvas canvas, MapView mapv, boolean shadow){
        super.draw(canvas, mapv, shadow);

        //draw is always called twice, one with shadow equal to true and one to false.
        //This can be used to draw the same image with shadow
        //But you are not using shadows, so you can immediately return half of the calls, and reduce the draw() effort by half
        if(shadow) return;

        Projection projection = mapv.getProjection();

        projection.toPixels(gP1, p1);
        projection.toPixels(gP2, p2);
        projection.toPixels(gP3, p3);
        projection.toPixels(gP4, p4);

        path.rewind();
        path.moveTo(p1.x,p1.y);
        path.lineTo(p2.x,p2.y);
        path.lineTo(p3.x,p3.y);
        path.lineTo(p4.x,p4.y);

        canvas.drawPath(path, mPaint);
    }
}

Improvements - a more complex one
The improvement I'm describing bellow is a overkill for you current overlay. It only makes sense when you have realy huge paths to draw.
When you move the map, without zomming it, with the code above the path will be recreated and redrawn in a different place to be aligned with the map. But the path you are creating is the same size, same shape as the previous one, just in a different position.
You can achive the same result using:
path.offset(dx, dy);

where dx, dy is the number of pixels you need to move the path to keep it aligned with the map. Of course, you need to keep track where was the map last time you offset the path, so you can offset the path to the new map position.
If you have a path with several thousands of points, offseting the path will be about 100 times faster then redrawing it.
You also need to keep track on zoom level, as you still need to recreate the path when zoom changes. You can't use getCurrentZoomLevel() to do it, as it´s not synchronized with zoom animation. You need to test longitudeSpan() value changes, to be able to have a synchronized path creation with zoom change animation.
I hope this will help.
Regards.


text:
Q: How can (GNU/BSD) libc macros be safe? Upon reimplementing some libc functions (in my school's "personal" library project called libft), I got the idea of implementing some as macros, like so:
#define ft_isalnum(c)  (ft_isalpha(c) || ft_isdigit(c))
#define ft_isalpha(c)  (ft_isupper(c) || ft_islower(c))
#define ft_isascii(c)  (((c) >= 0) && ((c) <= 0177))
#define ft_isdigit(c)  (((c) >= '0') && ((c) <= '9'))
#define ft_islower(c)  (((c) >= 'a') && ((c) <= 'z'))
#define ft_isprint(c)  (((c) >= 0040) && ((c) <= 0176))
#define ft_isspace(c)  ((((c) >= 0x09) && ((c) <= 0x0d)) || ((c) == 0x20))
#define ft_isupper(c)  (((c) >= 'A') && ((c) <= 'Z'))

However, I soon found out that instructions like ft_isspace(s[--len]) become broken, because the len variable gets decremented three times. So I had to make actual functions instead of macros.
I know that macros are unsafe. But I see that GNU/BSD libc implementations of the is*(3) character tests are macros. How do they make their macros safe?
I am not allowed (at school) to use functions I have not implemented myself (except malloc(3), free(3), and a few system calls such as write(2). And I presume that calling a function just to test an ASCII character is rather inefficient.
Thanks.

A: In this particular case for the functions in ctype.h both linux and BSDs look up the value in an array that contains a bitmask for all the valid values the functions can be called with - [0,255]. Each of the functions simply index the array with their argument and check if the particular bit you're testing for is set. That's how they only evaluate the argument once.
It might look something like this:
#define C_ALPHA 0x01
#define C_NUM 0x02
...
int ctype_array[256] = { ..., /* offset for 'A' */C_ALPHA|C_PRINT|C_UPPER, ...};
#define isalnum(c) (ctype_array[(c)] & (C_ALPHA|C_NUM))

In a more general case for all macros a trick is to do:
#define foo(x) do { int _x = (x); do_something_with(_x, twice(_x)); } while (0)

Of course this construct can't return anything (the do-while construct is so that this is a single statement that doesn't break when put as a single statement in an if/for/while statement without brackets). There are compiler extensions that allow macros like this to be implemented safely and returning a value.
In general, I would recommend going for inline functions or just use normal functions. Function call overhead isn't that high on modern CPUs and in large programs you might even get substantial speedups on a macro level by wasting less cache for code. Get your code correct first, then think about speeding it up while measuring if your inlines are actually doing anything at all.


text:
Q: EasySlider and Lightbox Conflicting? On my site: http://windowsphonedaily.blogspot.com/
I first noticed there was a problem when EasySlider 1.7 whenever I tried to add any javascript functions like "continuous: true". The two navigation buttons (prevBtn and nextBtn) would disappear whenever that was done, so I had to undo any changes I made. Then I realized that the simple lightbox that I use for my articles' images was not working and would just act as a normal direct link to the picture.
So I figure the problem is most likely within my site's Javascript. I usually follow examples on tutorials and guides, so I really don't know anything about how to implement more than one script without them conflicting.
I don't know much about Javascript in general, so I'm giving you a heads up that I'm a noob!
Here's what my current setup is with the Lightbox and EasySlider. I'm sure it's probably some dumb mistake I made, but any help would be appreaciated! Thank you!
  <!--Light Box Code Starts  Bloggerplugins.ORG-->
  <style>
    #lightbox{    position: absolute;    left: 0; width: 100%; z-index: 100; text-align: center; line-height: 0;}
    #lightbox img{ width: auto; height: auto;}
    #lightbox a img{ border: none; }

    #outerImageContainer{ position: relative; background-color: #fff; width: 250px; height: 250px; margin: 0 auto; }
    #imageContainer{ padding: 10px; }

    #loading{ position: absolute; top: 40%; left: 0%; height: 25%; width: 100%; text-align: center; line-height: 0; }
    #hoverNav{ position: absolute; top: 0; left: 0; height: 100%; width: 100%; z-index: 10; }
    #imageContainer>#hoverNav{ left: 0;}
    #hoverNav a{ outline: none;}

    #prevLink, #nextLink{ width: 49%; height: 100%; background-image: url(data:image/gif;base64,AAAA); /* Trick IE into showing hover */ display: block; }
    #prevLink { left: 0; float: left;}
    #nextLink { right: 0; float: right;}
    #prevLink:hover, #prevLink:visited:hover { background: url(http://lh5.ggpht.com/_u4gySN2ZgqE/SnWk89-4azI/AAAAAAAAAj8/hM0MqnVouCQ/prevlabel%5B3%5D.gif) left 15% no-repeat; }
    #nextLink:hover, #nextLink:visited:hover { background: url(http://lh6.ggpht.com/_u4gySN2ZgqE/SnWk9-mNiQI/AAAAAAAAAkA/Zg1jXV9xnQM/nextlabel%5B6%5D.gif) right 15% no-repeat; }

    #imageDataContainer{ font: 10px Verdana, Helvetica, sans-serif; background-color: #fff; margin: 0 auto; line-height: 1.4em; overflow: auto; width: 100%    ; }

    #imageData{    padding:0 10px; color: #666; }
    #imageData #imageDetails{ width: 70%; float: left; text-align: left; }
    #imageData #caption{ font-weight: bold;    }
    #imageData #numberDisplay{ display: block; clear: left; padding-bottom: 1.0em;    }
    #imageData #bottomNavClose{ width: 66px; float: right;  padding-bottom: 0.7em; outline: none;}

    #overlay{ position: absolute; top: 0; left: 0; z-index: 90; width: 100%; height: 500px; background-color: #000; }
round-color: #000; }
lute; top: 0; left: 0; z-index: 90; width: 100%; height: 500px; background-color: #000; }
round-color: #000; }
  </style>
  <script src='http://ajax.googleapis.com/ajax/libs/prototype/1.7.0.0/prototype.js' type='text/javascript'/>
  <script src='http://ajax.googleapis.com/ajax/libs/scriptaculous/1.8.3/scriptaculous.js' type='text/javascript'/>
  <script src='http://blogergadgets.googlecode.com/files/lightbox.js' type='text/javascript'/>
<!--Light Box Code Ends Bloggerplugins.ORG-->

<script src='https://sites.google.com/site/shawnhasinger/home/files/jquery.js' type='text/javascript'/>

<script src='https://sites.google.com/site/shawnhasinger/home/files/easySlider1.7.js' type='text/javascript'/>

<script type='text/javascript'>
$(document).ready(function(){
    $("#slider").easySlider();
});
</script>

Update: I tried the fix detailed at this website and it fixed the Lightbox but it broke the EasySlider.

A: I'm no expert in Javascript, but I finally got it to work after much trial and error. First, for lightbox I used Slimbox2. Then I made sure that the jquery script came before the Slimbox2 script. I put the EasySlider script last.


text:
Q: Toolbox theme using printif statement - help needed understanding code block I want to make edits to the following so that I can display the author and date but without those being links to searches 'by date' and 'by author'. The site I'm building will only have one author and I want to lock down the searches users can do.
Code as follows:
        <?php
            printf( __( 'Posted on <time class="entry-date" datetime="%2$s" pubdate>%3$s</time>  by  %6$s', 'toolbox' ),
                get_permalink(),
                get_the_date( 'c' ),
                get_the_date(),
                get_author_posts_url( get_the_author_meta( 'ID' ) ),
                sprintf( esc_attr__( 'View all posts by %s', 'toolbox' ), get_the_author() ),
                get_the_author()
            );
        ?>

Any help understanding what how this code block is working would be great. Thanks all.

A: The % signs are arguments in the string to be formatted. The s represents a string type argument must be passed. I've notated which arguments are connected to which strings being passed in.
get_permalink() - %1 string type
get_the_date( 'c' ) - %2 string type
get_the_date() - %3 string type
get_author_posts_url( get_the_author_meta( 'ID' ) ) %4 string type
sprintf( esc_attr(__( 'View all posts by %s', 'toolbox' ), get_the_author() ) %5 string type (Also %s refers to get_the_author())
get_the_author() - %6 string type

For more information see: http://php.net/manual/en/function.printf.php


text:
Q: Angular js select specific data from json using date or filter it by date I am new to angular js , how to select specific or certain data from json array.Return data from an array which date is equal to today , and also get data from json of this current week(all data of the current week), and also of the data of this current month. Thanks
$scope.Combination = [
          {
          "Name" : "HelloWorld",
          "Type" : "Phyton",
              "Date": "01/11/2018"
          },
          {
              "Name" : "HelloWorld",
          "Type" : "C#",
              "Date": "01/08/2018"
          },
          {
              "Name" : "HelloWorld",
          "Type" : "JS",
              "Date": "01/04/2018"
          },
          {
              "Name" : "HelloWorld",
          "Type" : "Ruby",
              "Date": "01/07/2018"
          },
          {
              "Name" : "HelloWorld",
          "Type" : "C",
              "Date": "01/010/2018"
          }
      ];

A:

<!DOCTYPE html>

<title>Create Angularjs To Do Application with demo</title>

        {{todo.Date}}

{{name}}

Here you can use filter to show combination:
For monthly combination:
  angular.module('ToDo').filter('getCombinations', function($filter) {
    return function (combinations) {

      var month_filtered_list = [];

      for (var i = 0; i < combinations.length; i++) {

        var thirty_days_ago = new Date().getTime() - 30*24*60*60*1000;
        var com_date = new Date(combinations[i]["Date"]).getTime();
        if (com_date >= thirty_days_ago) {
    month_filtered_list.push(combinations[i]);

        }
      }
      return month_filtered_list;
    }
  });

DOM looks like this

Similarly you can do for the weak also by just changing the
var thirty_days_ago = new Date().getTime() - 30*24*60*60*1000;
to
var seven_days_ago = new Date().getTime() - 7*24*60*60*1000;
for present day:
    .filter('getTodayCombinations', function() {
      return function (combinations) {

        var today_filtered_list = [];

        for (var i = 0; i < combinations.length; i++) {

          var com_date = new Date(combinations[i].Date).getTime();

          if (com_date == new Date().getTime()) {
            today_filtered_list.push(combinations[i]);
          }
        }
        return month_filtered_list;
      }

  });


text:
Q: RegisterType with an interface in UnityContainer I'm using UnityContainer, and I want to register an interface not with a type, but with another interface.
Unfortunately, I'm unable to do it cleanly..
I have several common interfaces, which are united in one interface, and I need to register them in the container. The code is like the following:
interface IDeviceImporter {
    void ImportFromDevice();
}

interface IFileImporter {
    void ImportFromFile();
}

interface IImporter : IDeviceImporter, IFileImporter {
}

class Importer1: IImporter {
}
class Importer2: IImporter {
}

When entering the library, I know which importer to use, so the code is like:
var container = new UnityContainer();
if (useFirstImport) {
    container.RegisterType<IImporter, Importer1>();
} else {
    container.RegisterType<IImporter, Importer2>();
}

and then I want to register this specific class with IDeviceImporter and IFileImporter also. I need something like:
container.RegisterType<IDeviceImporter, IImporter>();

But with that code I'm getting an error:  IImporter is an interface and cannot be constructed.
I can do it inside the condition, but then it'll be copy-paste. I can do
container.RegisterInstance<IDeviceImporter>(container.Resolve<IImporter>());

but it's really dirty.
Anyone please, advice me something :)

A: Well this depends on the type of lifetime management you are using. Here:
  container.RegisterType<IImporter, Importer1>();

you use transient one, so you can do the following:
var container = new UnityContainer();

if (useFirstImport) {
    container.RegisterType<IImporter, Importer1>();
    container.RegisterType<IDeviceImporter, Importer1>();

} else {
    container.RegisterType<IImporter, Importer2>();
    container.RegisterType<IDeviceImporter, Importer2>();
}

without fear of bugs. container.Resolve<IImporter>() will create new instance on every call, just like container.Resolve<IDeviceImporter>() will.
But if you are using ContainerControlledLifetimeManager then anyway you'll have to use container.RegisterInstance<IDeviceImporter>(container.Resolve<IImporter>()) because Unity offers no other way to do this.
This feature is really interesting, it would be very nice to have something like container.CreateSymLink<IDeviceImporter, IImporter>() but there is no such a thing.

A: I'm using ContainerControlledLifetimeManager, and end up with a code like:
var container = new UnityContainer();
System.Type importerType
if (useFirstImport) {
    importerType = GetType(Importer1);
} else {
    importerType = GetType(Importer2);
}

container.RegisterType(GetType(IImporter), importerType);
container.RegisterType(GetType(IDeviceImporter), importerType);
container.RegisterType(GetType(IFileImporter), importerType);

But yes, the best thing would be to have something like:
container.CreateSymLink<IDeviceImporter, IImporter>()