text:
Q: Protractor/Js - Unable to get accurate table row and column count I am trying to verify the number of rows and columns in a table using Protractor/Js.
I have tried the following four functions but I am returned in-accurate results. I believe my locator might be wrong - '.tsc_table_s13'
Rows:
 $(locator).all(by.xpath('.//tbody/tr')).count().then(function (data) {
            expect(data).to.equal(parseInt(myCount));
        });

Or...
var table = element.all(by.css(locator));
        table.all(by.tagName("tr")).count().then(function (data) {
            expect(data).to.equal(parseInt(mycount));
        });

Columns:
$(locator).all(by.xpath('.//tbody/tr/td')).count().then(function (data) {
            expect(data).to.equal(parseInt(myCount));
        });

Or...
var table = element.all(by.css(locator));
        table.all(by.tagName("td")).count().then(function (data) {
            expect(data).to.equal(parseInt(myCount));
        });

When I test the column count, 25 (or 26) is returned and I expect only 6.
When I test row count, 0 is returned when I expect 4.
The table can be found here - http://toolsqa.com/automation-practice-table/

A: count that is return is correct because if you manually test the locator inside chrome you will see the same result.
first you get the result from locator .tsc_table_s13 and ontop of it concatenate new locator.
attaching results

A: Here is simple solution
     //test.spec.js
 describe('all rows and columns', function() {
   var rows;
   var cols;
beforeEach(function() {
  browser.waitForAngularEnabled(false);
  browser.get('http://www.toolsqa.com/automation-practice-table/');

  rows = element.all(by.xpath('.//tbody/tr'));
  cols=element.all(by.xpath('.//tbody/tr[1]/td'));
});

it('should list row and column counts', function() {
  //expect(rows.count()).toEqual(4);
  //expect(cols.count()).toEqual(6);
  rows.count().then(function(cnt) {
  console.log(cnt);
  })
  cols.count().then(function(cnt) {
  console.log(cnt);
   })
  });
 });


text:
Q: Excel sumif or sumifs with concatenated values I have problem in collating the results from table. Following is the data i have . Here i need to combine the count for test names and test names(failed). i.e., I need to take and collate Blue and Blue(Failed). However this shouldn't include "Blue ocean" entities.

Here is what is expect :

I tried using sumif, sumifs and vlookup. However i couldn't achieve what i wanted . Is there a ways to have concatenation in the criteria value of this function like "cell value containing blue" & "(failed)"
Sumif
=SUMIF(A:A,E3&"*",B:B)

Sumifs
=SUMIFS(B:B,A:A,E3,A:A,E3 & "*")

when i tried to use the concatenation in sumifs it returns 0
=SUMIFS(B:B,A:A,C60,A:A,TRIM(C60)&"(failed)")

Your inputs much appreciate.
Thank you!

A: Try SUMPRODUCT:
=SUMPRODUCT(((E2=$A$2:$A$10)+(E2&"(failed)"=$A$2:$A$10))*$B$2:$B$10)

Edit:
Formula can be a little shortened:
=SUMPRODUCT(((E2&{"";"(failed)"}=$A$2:$A$10))*$B$2:$B$10)

redpajama_set_name: RedPajamaStackExchange


text:
Q: Docker-compose with urwid (ncurses) Python app I am creating an algorithm that needs to run on a server, along with a small database.
docker-compose.yml:
version: '3'
services:
  app:
    command: python -u app.py
    build: .
    stdin_open: true
  db:
    image: mongo:latest

Dockerfile:
FROM python:3.6.1

COPY . /usr/src/app

WORKDIR /usr/src/app

RUN pip install -r requirements.txt

The app is an ncurses (urwid) app which transforms the terminal into a TUI to monitor the algorithm. When I run the app separately on my laptop, it works as expected with the terminal turning into the TUI. When ran with the command "docker-compose up", the terminal first shows stdout from docker and mongo, after which certain (clipped) parts of the TUI start to show. The TUI components are malformed and unresponsive. Killing the docker process keeps the clipped parts in the terminal.
Possible hint:
The TUI contains a running clock with hrs:min:sec. When the clipped parts appear the clock is correct but it freezes immediately. The clock is updated by an underlying asyncio event loop.

A: This works for me:
docker-compose.yml
version: '3'
services:
  app_db:
    container_name: appDB
    image: mongo:latest

  app:
    command: python -u /usr/src/app/app.py
    container_name: app
    build: .
    links:
    - app_db
    stdin_open: true
    tty: true

When running docker-compose run app, both the app and the mongo container are running and I get a terminal interface into the app container.


text:
Q: Decreasing mouse sensitivity at kernel level I have developed a custom-GUI Server, which runs on virtual console of Linux.For mouse-handling purpose, it reads the mouse device file
/dev/input/mice

and retrieves the event data and updates the pointer position.How can I add the facility of the feature of changing mouse-sensitivity to this software?
One solution may be is to change the mouse driver config file.

But i dont know where it is located or is there any such options, that fulfills my need.Thank you


text:
Q: Symbol stripping of Objective-C code still leaves method names, etc. in binary I am trying to strip our iOS application binary of debug symbols to make it more difficult for hackers to modify the binary. I have tried both xcode's symbol stripping (enabling strip linked product and deployment postprocessing) and using "strip -S -x". Both do reduce the number of symbols, but running the binary through "strings" still returns loads of hits.
How do I remove them?

A: Objective-C is a dynamic language.  Method calls are resolved at runtime based on selectors (effectively the method name as a string).  This is different from a language like C++ that binds method calls at compilation/link time.
Removing the method names (selectors) from the binary would make the application unusable.
Applications written in Objective-C are pretty much open books when it comes to their internals. Just look at tools like otool, class-dump, F-Script or DTrace to see how much is accessible and modifiable in a running Objective-C application.
However, there are linker flags (P_LNOATTACH) which stop DTrace connecting to the running application.  You can also call ptrace with the PT_DENY_ATTACH flag. iTunes is an example of an app that does this as Apple doesn't want you poking around inside their DRM.
There appears to be a previous post on Objective-C code obfuscation.  See iPhone/iPad App Code Obfuscation - Is it Possible? Worth it? for more details

A: The objective-c runtime relies on those, it won't be possible to remove them. (The type 'SEL' is a uniqued char *)


text:
Q: Including a Microsoft Form inside a responsive page Our marketing department built the following page and included an Microsoft Office 365 Forms (Kinda like Google Sheets) on the page:
https://www.supertext.de/de/unternehmung/freelancerconvention
This works fine on desktop browsers, and on mobile Safari, but Android we get an "Open Forms".

        Lade...

Any idea how to make this work on Android too?
Below how it looks on the iPhone and on Android.


text:
Q: How can I pre-install self-signed USB drivers on Windows XP? I'm trying to get some USB drivers for medical devices pre-installed on our corporate workstations. Unfortunately, these drivers are not signed. Based on some research done here and elsewhere, I self-signed these drivers using a certificate that I created:
makecert -r -pe -n "CN=Self Root CA" -b 01/01/2006 -e 01/01/2099 -eku 1.3.6.1.5.5.7.3.3,1.3.6.1.4.1.311.10.3.6 -sv selfcert.pvk selfcert.cer

I added the certificate to the "Trusted Root CA" and "Trusted Publishers CA" and and signed the drivers:
signtool sign /f selfcert.pfx /p password /uw /t http://timestamp.verisign.com/scripts/timstamp.dll /v C:\gendex\fusiondexis.cat

I added the '/uw' parameter because the "Windows System Component Verification" (1.3.6.1.4.1.311.10.3.6) and "Code Signing" (1.3.6.1.5.5.7.3.3) are present in the certificate, thus it seemed appropriate.
I then verified the signatures with signtool:
signtool.exe verify /pa /v /c C:\gendex\fusiondexis.cat C:\gendex\fusiondexis.inf

The driver files were copied to 'C:\gendex' and I updated the registry key 'DevicePath' to include this path when searching for driver files. However, when I plug-in the device, Windows displays the Add New Hardware Wizard which requires an admin to enter their credentials. If I don't do that, the device remains in an unrecognized state, and if I do--it works fine.
I've been banging my head trying to figure this out all day. Any help would be appreciated! Thanks.

A: Be sure that you added selfcert.cer (Self Root CA) to local machine store and not to the user specific store. You can use
CertMgr.exe -add -c selfcert.cer -s -r localMachine AuthRoot

I deviloped the solution for one my customer about 8 years ago and it still work. I used at the time old version of SignTool which doesn't had /uw switch. I used just
SignTool.exe signwizard /v LXT52Xxp.cat

For the troubleshooting I would recommend you to set detailed SetupAPI log (see here and here). It will shows whether which drives from which directory will be get and whether the ranking of the driver will be interpreted the same as "Microsoft signed".


text:
Q: Unable to play Youtube videos using YouTube Android Player API I am getting this error "Cannot load modern controls UI. Upgrade to the latest version of the Android YouTube API." I used youtubePlayer.addFullscreenControlFlag(YouTubePlayer.FULLSCREEN_FLAG_CONTROL_SYSTEM_UI);
but still getting same error also i go through Unable to play some Youtube videos using YouTube Android Player API
But still getting error.

A: I faced this bug because i am using Fragment inside Youtube Fragment. i removed the inner fragment my problem is solved and now Youtube Videos are working properly.


text:
Q: Using .css("background-color") for comparison jQuery/Js I am working on a project to make angled divs where the break between each basic panel on a page is an angle if the div has a background-image on the previous div, and a background-color of green on the next div.
I know I can't select pseudo classes directly so I decided to use the .addClass() to show and hide the angle.
The problem is my comparisons either turn all divs green, or adds angles to all the divs. I think most of my problem is in my approach, but I'm not sure where I am going wrong.
Here is the JS and the jQuery so far, I'm just trying to make the comparison work so it is still rough:
$(function() {
     green = $('div').css("background-color", "rgb(0,255,0)");
          if ($('.box').prev() === green)
        {
          $(this).addClass('withTop withoutTop');
          //if ($(this).css("background-color") == green)
        }
    });

I have used regex to strip all but digits from the rgb but it seems to have the same effect. Thanks in advance and here is the link to the codepen.
http://codepen.io/AnomalousDevs/pen/GJmrrw
CSS and markup

$(function() {
  green = $('div').css("background-color", "rgb(0,255,0)");
  if ($('.box').prev() === green) {
    $(this).addClass('withTop withoutTop');
    //if ($(this).css("background-color") == green)
  }
});
.box {

  height: 100px;

  width: 100%;

  /*background-color: rgb(0,255,0);*/

  position: relative;

}

.box:nth-of-type(5) {

  background-color: green;

  /* background-image:url("http://www.google.com/imgres?imgurl=http://dreamatico.com/data_images/guitar/guitar-6.jpg&imgrefurl=http://dreamatico.com/guitar.html&h=851&w=1280&tbnid=DVUGPDoyiOu4sM:&zoom=1&docid=OlLKDKDUUigDoM&hl=en&ei=iqJzVcaEOcvAtQXW-oO4Cw&tbm=isch&ved=0CDwQMygKMAo");*/

}

.box:nth-of-type(4) {

  background: red;

  position: relative;

}

.box:nth-of-type(3) {

  background: blue;

}

.box:nth-of-type(2) {

  background: rgb(0, 255, 0);

}

.box:nth-of-type(1) {

  background: lightblue;

}

.withTop::before {

  content: '';

  position: absolute;

  background: black;

  width: 100%;

  /*top:-16px;*/

  height: 30px;

  left: 0;

  transform: skewY(-1.3Deg);

  z-index: 1;

}

.withoutTop::after {

  content: '';

  position: absolute;

  background: black;

  width: 100%;

  height: 30px;

  left: 0;

  transform: skewY(2Deg);

}

A: Your question is not clear but I think that what you are trying to achieve is adding a class to the .box after the green one.
Suggestion of base logic you should do:

$(function() {
  var boxes = $('.box'),
    greenBox = '';
  //for each box
  boxes.each(function(index) {
    //if this box is the green one
    if ($(this).css("background-color") === "rgb(0, 255, 0)") {
      greenBox = $(this);
      //addClass to the next one
      $(this).next().addClass('withTop');
    }
  });
});
.box {
  height: 100px;
  width: 100%;
  /*background-color: rgb(0,255,0);*/
  position: relative;
}
.box:nth-of-type(5) {
  background-color: green;
  /* background-image:url("http://www.google.com/imgres?imgurl=http://dreamatico.com/data_images/guitar/guitar-6.jpg&imgrefurl=http://dreamatico.com/guitar.html&h=851&w=1280&tbnid=DVUGPDoyiOu4sM:&zoom=1&docid=OlLKDKDUUigDoM&hl=en&ei=iqJzVcaEOcvAtQXW-oO4Cw&tbm=isch&ved=0CDwQMygKMAo");*/
}
.box:nth-of-type(4) {
  background: red;
  position: relative;
}
.box:nth-of-type(3) {
  background: blue;
}
.box:nth-of-type(2) {
  background: rgb(0, 255, 0);
}
.box:nth-of-type(1) {
  background: lightblue;
}
.withTop::before {
  content: '';
  position: absolute;
  background: black;
  width: 100%;
  /*top:-16px;*/
  height: 30px;
  left: 0;
  transform: skewY(-1.3Deg);
  z-index: 1;
}
.withoutTop::after {
  content: '';
  position: absolute;
  background: black;
  width: 100%;
  height: 30px;
  left: 0;
  transform: skewY(2Deg);
}


text:
Q: Complex power series centered at w For any $w \in \mathbb{C} \setminus \{1\}$, find a power series for
                $$f(z)=\frac{1}{1-z}$$
centred at $w$ and give the radius of convergence. Further, find a power series for $f$ which converges in a neighbourhood of infinity.
I have a few questions. I can rewrite my series
$$f(z)=\frac{-1}{z}\frac{1}{1-\frac{1}{z}}=\frac{-1}{z}\sum\frac{1}{z^n}$$
Is this series still centered about 0? As regards the question above my thought is to try something of the form
$$\frac{1}{1-z}=\frac{1}{1-w-(z-w)}=\frac{1}{1-w}\frac{1}{1-\frac{z-w}{1-w}}=\sum\frac{(z-w)^n}{(1-w)^{n+1}}$$
Which is now centered about $w$?

A: HINT:Your method is correct for  $\dfrac{|z-w|}{|1-w|}<1$ .
For the series
$f(z)=\frac{-1}{z}\frac{1}{1-\frac{1}{z}}=\frac{-1}{z}\sum\frac{1}{z^n}$
note that it is valid in the anulus $|z|>1$.


text:
Q: Twitter API: How to get user's tweets from a timeframe? I can't quite believe this, but seems there's no way to get tweets from a particular user from a particular timeframe. Is this true? is there a way around this?
Thanks in advance.
Johnny

A: Check out this listing of Twitter resources for retrieving historical data. It looks like Tweetbird is the top with Searchastic getting good reviews, but it's shutdown now.
http://blog.tweetsmarter.com/twitter-search/10-ways-and-20-features-for-searching-old-tweets/
There is also a site called Snapbird that queries old tweets. They also have an API on Github that circumvents the 10 day search limit. You can of course use any API method to get user tweets.
https://github.com/remy/snapbird
You can also use Twitter's own since and until operator for timeframes but the capacity of historical data is limited, so it is recommended to use the resources listed instead.
example:
https://api.twitter.com/1/statuses/user_timeline.json?include_entities=true&include_rts=true&screen_name={screen_name}&since:2011-11-01&until:2011-11-06


text:
Q: Google Geocoding API error: You are over your quota I´m working with google maps, and i have problems with my quota. How can i fix this?
the message i got from my hompage is:

Google Geocoding API error: You are over your quota

I read thats something with the daily limit of 2500 pr. IP. on the page where the message comes up there is about 40 firms that are getting shown, so i dont now if it is something with the number of firms on the page, so that there are to many request for the page and some of it gets blocked.
Link to the page: My page
What can i do. Any help will be appreciated.
Regards
Ivan.

A: There's a limit of 2,500 geolocation requests per day. AFter this limit, you'll get such error .
Usage Limits
Use of the Google Geocoding API is subject to a query limit of 2,500 geolocation requests per day. (User of Google Maps API for Business may perform up to 100,000 requests per day.) This limit is enforced to prevent abuse and/or repurposing of the Geocoding API, and this limit may be changed in the future without notice. Additionally, we enforce a request rate limit to prevent abuse of the service. If you exceed the 24-hour limit or otherwise abuse the service, the Geocoding API may stop working for you temporarily. If you continue to exceed this limit, your access to the Geocoding API may be blocked.
Status code: "OVER_QUERY_LIMIT" indicates that you are over your quota.

A:
"OVER_QUERY_LIMIT" indicates that you are over your quota.

for more information please visit this URL "https://developers.google.com/maps/documentation/geocoding/intro#StatusCodes"


text:
Q: EF Core 3.1 code-first with Oracle - A string is set to NVARCHAR2(2000) instead of NCLOB I am having an application which must support both a SQL Server DB and an Oracle DB.
I have configured a basic property:
public string MyProperty{ get; set; }

When my database is generated in SQL Server, the type of the column is nvarchar(MAX) (great!), but in Oracle 11g it is a NVARCHAR2(2000) which is limiting the size of my string if stored in Oracle.
The weird thing is that this Oracle article mentions that NCLOB should be the default type for strings...
Does that means that it depends of the version of Oracle used? Or the version of EF Core? Or am I missing something?
How can I achieve a full compatibility for this string between SQL Server (nvarchar(max)) and Oracle (NCLOB)?
Thanks for your help!


text:
Q: Motivations to study the cohomology of the moduli space of curves Could anyone give some interesting motivations to understand the cohomology of $\mathcal{M}_g$?
What I know: I have read the various approaches to construct $\mathcal{M}_g$ via orbit spaces for group actions, period maps, and Teichmüller theory. I learned from literature that the cohomology of $\mathcal{M}_g$ is an important object to study, though I have not started reading some classical papers on the topic, such as Mumford's Towards an enumerative geometry of the moduli space of curves, Miller's The homology of the mapping class group, or Morita's Characteristic classes of surface bundles.
What aspects am I interested in: Some notes mentioned that the cohomology of moduli space is an important source of motives. Although I do not really understand what is a motive, any elaboration in this direction would be appreciated. Besides that, I am more interested in any concrete applications in algebraic geometry, differential geometry, or topology to motivate the study of cohomology of $\mathcal{M}_g$.

A: As the title to Mumford's famous paper "Toward an enumerative geometry..." suggests, knowing the cohomology / cycle theory of the moduli space of curves allows one to answer enumerative geometry questions for curves.
Here is an (very concrete) example that came up in real life for a student of mine. He had a family of genus 2 curves over $\mathbb{P}^2$ constructed by taking the family of lines in $\mathbb{P}^2$ and for each line taking the double cover of the line branched at the six points given by the intersection of the line with a fixed (generic) sextic curve (equivalently, this is the defining linear system on a generic genus 2 $K3$ surface). He needed to know how many of those genus two curves admit a degree $d$ map to a fixed elliptic curve $E$. This is a calculation in the cohomology ring of $\overline{M}_2$: we are looking for the number of points in the intersection of the two cycles in $\overline{M}_2$ given by the two families of curves: the 2-cycle given by the family over $\mathbb{P}^2$ and the 1-cycle given by the locus of genus 2 curves admitting a degree $d$ map to $E$ (since the dimension of $\overline{M}_2$ is 3, we expect these cycles to intersect in points). This intersection problem is dual to a cup product computation in the cohomology ring of $\overline{M}_2$. Using Mumford's complete description of this cohomology ring, one can determine how to express each of our cycles in terms of Mumford's generators and then compute the cup product. There are some minor issues to fuss with involving the orbifold structure and some general position issues, but the problem is essentially solved with the cohomology of the moduli space.
This was a rather specific example, but maybe you get the general idea: if we want to count the "number of curves satisfying this that and the other", we try to formulate the question as a problem in the cohomology ring of the moduli space.


text:
Q: Is there any point in using an 'enum' type instead of a string in Javascript? Coming from a background in statically typed languages, the main benefit I get from enums is compile time error catching.
I'm writing a little program in Javascript, and I find myself wanting something like an enum, perhaps like this:
var Fruit = {
   BANANA: "BANANA",
   APPLE: "APPLE",
   PEAR: "PEAR";
};

But I see no advantage to this.  I might as well just use strings everywhere this 'enum' is required.
Should I just be using strings in javascript in place of enum types in other languages?

A: It is good way to extract common things like magic numbers/strings or similar. Imagine that you have BANANA all over the place then for some reason you need to change BANANA to SOMETHING_ELSE, without approach you are using in question you need to make a change in every single place.
var foo = {
  bar: "baz"
}

So using foo.bar instead of hardcoded string "baz" all over the place, can save your time and possible bugs when it comes to changing "baz" to something else.


text:
Q: For continuous $f$ and $g$, $\{x \in X: f(x)=g(x)\}$ is closed $\mathbf{Question}:$Let $(X,d_1)$ and $(Y,d_2)$ be two metric spaces and $f,g: X \mapsto Y$ be two continuous functions. Then prove that $\{x \in X: f(x) =g(x)\}$ is closed in $X$.
Approach: We consider the function $h: X \mapsto \mathbb{R^+}\cup \{0\}$ defined by $h(x)=d_2(f(x),g(x))$
Lemma 1: $h(x)$ is continuous on $X$.
Proof: We have $d_2(f(x),g(x))+d_2(g(x),g(c))+d_2(f(x),f(c))\geq d_2(f(c),g(c))\implies d_2(g(x),g(c))+d_2(f(x),f(c))\geq d_2(f(c),g(c))-d_2(f(x),g(x))$.
Symmetry gives us $d_2(g(x),g(c))+d_2(f(x),f(c))\geq d_2(f(x),g(x))-d_2(f(c),g(c))$
Now, for any $\epsilon>0$, $\exists$ $\delta>0$ such that $d_2(g(x),g(c))< \epsilon/2$ and $d_2(f(x),f(c))<\epsilon/2$ whenever $d_1(x,c)<\delta$.
Hence, we conclude $\forall \epsilon>0, \ \exists \delta>0$ such that $|h(x)-h(c)|<\epsilon$ whenever $d_1(x,c)<\delta$, which establishes the lemma.
Now, $h(x)=0$, iff $f(x)=g(x)$.
We know that $\{0\}$ is a closed set in $\mathbb{R^+}\cup \{0\}$ and that the inverse image set of a closed set under a continuous mapping is a closed set.
Hence $\{x \in X: h(x)=0\} \equiv \{x \in X: f(x)=g(x)\}$ is a closed set in $X$.
$\mathbf{Follow-up \ question}:$ If $A \subseteq X$ is dense in $X$ and $f(x)=g(x), \forall x \in A$, then $f=g$ on $X$.
Attempt: By the previous theorem, $D=\{x \in X: f(x)=g(x)\}$ is closed in $X$. Now, suppose, for some $k \in X \setminus A$, $f(k) \neq g(k)$. But, $A\subset D \implies A' \subset D'$ (derived set) $\implies k \in D'$ but $k \notin D$ which contradicts the fact that $D$ is closed.
Is this correct? Please verify.

A: More generally, the function $h:X\to Y\times Y$ defined by $$h(x)= (f(x),g(x))$$ is continuous, since $f$ and $g$ are continuous, and the set $$\Delta = \{(y,y): y\in Y\}$$ is closed if $Y$ is Hausdorff.
Therefore the inverse image of a closed set
$$ h^{-1} [\Delta] = \{x \in X: f(x) =g(x)\}$$ is closed.

For a real valued function $f:X\to R$ note that
$$\{x \in X: f(x) =g(x)\}=\{x \in X: f(x) -g(x)=0\}=$$
$$ (f-g)^{-1} (\{0\})$$
Since $f-g$ is continuous and $\{0\}$ is closed,  the inverse image of a closed set is closed, therefore $$\{x \in X: f(x) =g(x)\}$$ is closed.

A: Note : $\to$ means "converges to" in whatever metric space the elements to the right and left of $\to$ belong to.
Your proof is correct.
However, you may also observe that since we are in the metric space setting, all proofs involving continuity/density may be extended to the sequential definitions.
For example, to show that $D$ is closed, it is enough to show that if $x_n \in D$ and $x_n \to x$, then $x \in D$. However, if $x_n \to x$, then by continuity, $f(x_n) \to f(x)$ and $g(x_n) \to g(x)$. Since $f(x_n) = g(x_n)$ for all $n$ it follows that $f(x) = g(x)$ by uniqueness of limits, giving $x \in D$ and hence closure of $D$.
The second proof is also right, a better way of saying things : If $f = g$ on $A$ , whose closure is $X$, then $A$ is contained in $D$ which is closed, so $D$ must contain $X$ by definition of closure being the smallest closed set containing a given set. Now, $f=g$ on $D$ so $f = g$ on $X$. You may also go sequentially : if $x \in X$, then by density there is $x_n\in A$ so that $x_n \to x$, ... (do it yourself and get $f(x) = g(x)$, which implies frmo arbitrariness of $x$ that $f=g$ on $X$).

A: Both proofs look fine.
That said, the proof to the follow up question is perhaps awkward in its use of contradiction.  A direct proof with the same flavor is given by
$$A \subseteq D \implies X = \bar{A} \subseteq \bar{D} = D \subseteq X \implies D=X$$

A: Your proof is correct. However to avoid using $\epsilon$ - $\delta$ I would say
$$A = \{x \in X: f(x) =g(x)\} = \bigcap_{n \in \mathbb N} A_n$$ where $A_n = \{x \in X: d_2(f(x) ,g(x)) \le 1/n\}$. $A_n$ is closed as the inverse image of the closed subset $[0, 1/n]$ under the continuous map $\varphi : x \mapsto d_2(f(x),g(x))$. $\varphi$ being continuous as a composition of continuous maps.
$A$ is closed being an intersection of closed subsets.
And I agree with your second proof two.


text:
Q: Using Large Font and Buttons for WPF calendar I need to provide large fonts for date numbers, month, Day-of-week headers and prev/next buttons for a WPF calendar. This is a touch-screen application with no mouse.
What is the ABSOLUTE SIMPLEST MINIMAL xaml code to do JUST this? I don't want pretty or clever. I just want BIG FONTS. Big enough for mechanics to locate and press on a grubby, dusty, grease-coated screen.
One thing I've tried is below. That didn't work. I don't understand it and don't want to. I don't have time to go chasing down all this template styling mishmash. Honestly what I'm after is for someone to just cook something up and give it to me. I'm running out of time, and I just want this thing in my rearview.
Style  TargetType="{x:Type Calendar}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Calendar}">
                    <CalendarItem x:Name="PART_CalendarItem"
                              Background="{TemplateBinding Background}"
                              BorderBrush="{TemplateBinding BorderBrush}"
                              BorderThickness="{TemplateBinding BorderThickness}"/>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsFocused" Value="true">
                            <Setter TargetName="PART_CalendarItem" Property="Padding"  Value="0,0,0,0" />
                            <Setter TargetName="PART_CalendarItem"  Property="Background"   Value="Yellow" />
                        </Trigger>

                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

A: I don't see you changing the FontSize in the XAML you provided but no matter. I just tried it and it looks like the default template ignores it anyway. Probably the best approach then would be to redefine the Template but I agree, that could be a lot of initial work. I sympathize too... I have been where you are too and been just as frustrated (i.e. try making the scrollbar wider/taller than the default size, ugh!)
So, if all you need is to just make the control larger then a simple approach would be to add a Scale to the LayoutTransform. For example, to double the size try:
<Style TargetType="{x:Type Calendar}">
    <Setter Property="LayoutTransform">
        <Setter.Value>
            <TransformGroup>
                <ScaleTransform ScaleX="2" ScaleY="2"/>
                <SkewTransform/>
                <RotateTransform/>
                <TranslateTransform/>
            </TransformGroup>
        </Setter.Value>
    </Setter>
</Style>


text:
Q: Connecting to sql database with powershell gives an error: Exception calling "Open" with "0" argument(s): "Login failed for user I am able to connect using SSMS.
However, when I try to connect via PowerShell it give me an error:
$connString = "Data Source=server;Database=mydb;User ID=myusern;Password=mypass"

#Create a SQL connection object
    $conn = New-Object System.Data.SqlClient.SqlConnection $connString

    #Attempt to open the connection
    $conn.Open()
    if($conn.State -eq "Open")
    {
        # We have a successful connection here
        # Notify of successful connection
        Write-Host "Test connection successful"
        $conn.Close()
    }

Error:
Exception calling "Open" with "0" argument(s): "Login failed for user
'username'."
At line:7 char:5
+     $conn.Open()
+     ~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : SqlException

What am I doing wrong here?
Thank you


text:
Q: What is the Target Build Os in FFmpeg 3.1.3? In configure help info,there are two type of compiler related options:

*

*target-os*

*host-os*

Do they have the same meaning as GNU Build System? such build ,host ,target.


text:
Q: The dual to the space of continuous functions is not isomorphic to $\ell^\infty$ This is a follow-up to this answer, which in turn arose in a follow-up to this question.
Let $M([0, 1])$ denote the Banach space of signed Borel measures on $[0,1]$ equipped with the total variation norm. This space is the dual of $C([0, 1])$, via the obvious identification.

Question. Is $M([0, 1])$ isomorphic to $\ell^\infty$?

I expect the answer to be negative.

A: There are several ways to proceed depending on how much machinery you are willing to use.
$\ell_\infty$ is a von Neumann algebra and thus, by Sakai theorem, it has a unique predual. Nevertheless $M([0,1])$ has plenty of nonisomorphic preduals, for instance $M([0,1])$ and $M([0,1]^2)$ are isomorphic while $C([0,1]^2)$ and $C([0,1])$ are not.
In the particular case of $\ell_\infty$ you can see that it has a unique predual directly. Use that $E^\ast = X_1 \oplus_\infty X_2$ implies that $E = E_1 \oplus_1 E_2$ with $E_1$ and $E_2$ the preduals of $X_1$ and $X_2$ respectively. Iterating will give you that $E$ satisfying that $E^\ast = \ell_\infty$ has a nested family $\ell^1(1) \subset \ell_1(2) \subset ... \ell_1(N)$ dense in $E$. Therefore $E \cong \ell_1$.
There other strategies, what I sugested in the comments was using injectivity.
A Banach space $E$ is called injective iff it satisfies a Hanh-Banach theorem if you use as an endpoint space. I.e.: for every $Y \subset X$ and bounded map $\phi: Y \to E$ there is a bounded extension $\tilde{\phi}: X \to E$ with the same norm.
Observation $\ell_\infty$ is trivially injective because we can apply Hanh-Banach in each of the coordinates.
I think, although I do not have a reference at hand, that all injective Banach spaces are $1$-complemented subsets of spaces of the form $C(K)$, where $K$ is totally disconnected.
It is easy to check that a Banach space is injective iff whenever it sits inside a larger space, it is complemented. Therefore it is enough to see that $M([0,1])$ sits as a subset of a larger space in a way that is not complemented. Probably there are examples of this in the literature, but I cannnot came up with one. The closest thing I can think of is:

*

*Use that $M([0,1]) \cong \mathbb{C} \oplus_1 \mathbb{C} \oplus_1 M(0,1)$, to reduce the problem to the open interval.

*Since $(0,1)$ is homeomorphic to $\mathbb{R}$, $M(0,1)$ is isomorphic to $M(\mathbb{R})$.

*Take $M(\mathbb{R}) \subset L^1(\mathbb{R})^{\ast \ast}$, the double dual of $L^1$. Assume that there is a projection $P: L^1(\mathbb{R})^{\ast \ast} \to M(\mathbb{R})$ to reach contradiction.

*The unit ball $B$ of $B(L^1(\mathbb{R})^{\ast \ast}, M(\mathbb{R}))$ is comapct in the point weak-$\ast$ topology given by the predual $M(\mathbb{R}) = C_b(\mathbb{R})/n$, where $n$ is the preannihilator of $M(\mathbb{R})$. The projections are a closed convex subset $B_0 \subset B$. There is an action of $\mathbb{R}$ over $B_0$ given by $t \mapsto \tau_t \circ P \circ \tau_{-t}$ where $\tau_t$ is the translation. By amenability, we have a fixed point $P_0 \in B_0$ which would be an equivariant projection (a projection commuting with the translation action). If the original $P$ would preserve $1_{\mathbb{R}}$, i.e.
$$\langle P(\psi),1_{\mathbb{R}} \rangle = \langle \psi, 1_{\mathbb{R}} \rangle$$ we would get a contradiction right away since an invariant mean $m \in L^1(\mathbb{R})^{\ast \ast}$ would give a $\mathbb{R}$-invariant and nonzero finite measure $P(m)$. I do not know whether you can take $P$ preserving $1$ without loss of generality.


text:
Q: Json to C# object. Changing key:value pair I would like to know which object would correspond to this Json string. Generally I have no trouble, but here the numbers of the key:value pairs are always changing. So for example for the first one "22548421" next time it could be any number so I do not now how to handle that in C#. Thank you for you time.
{
"22548421": [
    {
        "name": "Jayce's Mercenaries",
        "tier": "SILVER",
        "queue": "RANKED_SOLO_5x5",
        "entries": [
            {
                "playerOrTeamId": "22548421",
                "playerOrTeamName": "sifs",
                "division": "III",
                "leaguePoints": 63,
                "wins": 54,
                "losses": 49,
                "isHotStreak": true,
                "isVeteran": false,
                "isFreshBlood": false,
                "isInactive": false
            }
        ]
    }
],
"23380184": [
    {
        "name": "Darius's Blackguards",
        "tier": "GOLD",
        "queue": "RANKED_SOLO_5x5",
        "entries": [
            {
                "playerOrTeamId": "23380184",
                "playerOrTeamName": "pantoflaman13",
                "division": "V",
                "leaguePoints": 19,
                "wins": 135,
                "losses": 130,
                "isHotStreak": false,
                "isVeteran": true,
                "isFreshBlood": false,
                "isInactive": false
            }
        ]
    },
    {
        "name": "Zyra's Giants",
        "tier": "BRONZE",
        "queue": "RANKED_TEAM_3x3",
        "entries": [
            {
                "playerOrTeamId": "TEAM-3e523c50-f197-11e4-8964-782bcb48f791",
                "playerOrTeamName": "C4crew",
                "division": "I",
                "leaguePoints": 0,
                "wins": 4,
                "losses": 1,
                "isHotStreak": false,
                "isVeteran": false,
                "isFreshBlood": false,
                "isInactive": false
            }
        ]
    }
],
"31526913": [
    {
        "name": "Annie's Executioners",
        "tier": "GOLD",
        "queue": "RANKED_SOLO_5x5",
        "entries": [
            {
                "playerOrTeamId": "31526913",
                "playerOrTeamName": "GDK Beshtiwan",
                "division": "V",
                "leaguePoints": 0,
                "wins": 192,
                "losses": 217,
                "isHotStreak": false,
                "isVeteran": true,
                "isFreshBlood": false,
                "isInactive": false
            }
        ]
    },
    {
        "name": "Twitch's Mercenaries",
        "tier": "BRONZE",
        "queue": "RANKED_TEAM_5x5",
        "entries": [
            {
                "playerOrTeamId": "TEAM-50807400-bab5-11e4-b49d-782bcb4d190f",
                "playerOrTeamName": "Get Dunkid",
                "division": "I",
                "leaguePoints": 38,
                "wins": 6,
                "losses": 3,
                "isHotStreak": false,
                "isVeteran": false,
                "isFreshBlood": false,
                "isInactive": false
            }
        ]
    }
],
"33726623": [
    {
        "name": "Akali's Assassins",
        "tier": "SILVER",
        "queue": "RANKED_SOLO_5x5",
        "entries": [
            {
                "playerOrTeamId": "33726623",
                "playerOrTeamName": "MPAMPHS GR 007",
                "division": "III",
                "leaguePoints": 0,
                "wins": 310,
                "losses": 306,
                "isHotStreak": false,
                "isVeteran": true,
                "isFreshBlood": false,
                "isInactive": false
            }
        ]
    }
],
"34887523": [
    {
        "name": "Akali's Gladiators",
        "tier": "SILVER",
        "queue": "RANKED_SOLO_5x5",
        "entries": [
            {
                "playerOrTeamId": "34887523",
                "playerOrTeamName": "karpuzaotselo",
                "division": "III",
                "leaguePoints": 87,
                "wins": 121,
                "losses": 129,
                "isHotStreak": false,
                "isVeteran": true,
                "isFreshBlood": false,
                "isInactive": false
            }
        ]
    }
],
"36432092": [
    {
        "name": "Karthus's Army",
        "tier": "SILVER",
        "queue": "RANKED_SOLO_5x5",
        "entries": [
            {
                "playerOrTeamId": "36432092",
                "playerOrTeamName": "Vol4mens",
                "division": "IV",
                "leaguePoints": 100,
                "wins": 115,
                "losses": 111,
                "isHotStreak": true,
                "isVeteran": false,
                "isFreshBlood": false,
                "isInactive": false,
                "miniSeries": {
                    "target": 2,
                    "wins": 0,
                    "losses": 0,
                    "progress": "NNN"
                }
            }
        ]
    },
    {
        "name": "Nasus's Swarm",
        "tier": "BRONZE",
        "queue": "RANKED_TEAM_3x3",
        "entries": [
            {
                "playerOrTeamId": "TEAM-02ac4070-d166-11e4-aad1-782bcb48f791",
                "playerOrTeamName": "League of Fitness",
                "division": "I",
                "leaguePoints": 12,
                "wins": 5,
                "losses": 4,
                "isHotStreak": false,
                "isVeteran": false,
                "isFreshBlood": false,
                "isInactive": false
            }
        ]
    },
    {
        "name": "Annie's Cutthroats",
        "tier": "BRONZE",
        "queue": "RANKED_TEAM_5x5",
        "entries": [
            {
                "playerOrTeamId": "TEAM-02ac4070-d166-11e4-aad1-782bcb48f791",
                "playerOrTeamName": "League of Fitness",
                "division": "III",
                "leaguePoints": 9,
                "wins": 10,
                "losses": 11,
                "isHotStreak": false,
                "isVeteran": false,
                "isFreshBlood": false,
                "isInactive": false
            }
        ]
    }
],
"41537855": [
    {
        "name": "Sivir's Alliance",
        "tier": "SILVER",
        "queue": "RANKED_SOLO_5x5",
        "entries": [
            {
                "playerOrTeamId": "41537855",
                "playerOrTeamName": "My name is daka",
                "division": "II",
                "leaguePoints": 57,
                "wins": 159,
                "losses": 169,
                "isHotStreak": false,
                "isVeteran": true,
                "isFreshBlood": false,
                "isInactive": false
            }
        ]
    }
],
"42498193": [
    {
        "name": "Viktor's Marauders",
        "tier": "SILVER",
        "queue": "RANKED_SOLO_5x5",
        "entries": [
            {
                "playerOrTeamId": "42498193",
                "playerOrTeamName": "Exspy",
                "division": "II",
                "leaguePoints": 100,
                "wins": 288,
                "losses": 296,
                "isHotStreak": true,
                "isVeteran": true,
                "isFreshBlood": false,
                "isInactive": false,
                "miniSeries": {
                    "target": 2,
                    "wins": 1,
                    "losses": 0,
                    "progress": "WNN"
                }
            }
        ]
    },
    {
        "name": "Nasus's Swarm",
        "tier": "BRONZE",
        "queue": "RANKED_TEAM_3x3",
        "entries": [
            {
                "playerOrTeamId": "TEAM-02ac4070-d166-11e4-aad1-782bcb48f791",
                "playerOrTeamName": "League of Fitness",
                "division": "I",
                "leaguePoints": 12,
                "wins": 5,
                "losses": 4,
                "isHotStreak": false,
                "isVeteran": false,
                "isFreshBlood": false,
                "isInactive": false
            }
        ]
    },
    {
        "name": "Annie's Cutthroats",
        "tier": "BRONZE",
        "queue": "RANKED_TEAM_5x5",
        "entries": [
            {
                "playerOrTeamId": "TEAM-02ac4070-d166-11e4-aad1-782bcb48f791",
                "playerOrTeamName": "League of Fitness",
                "division": "III",
                "leaguePoints": 9,
                "wins": 10,
                "losses": 11,
                "isHotStreak": false,
                "isVeteran": false,
                "isFreshBlood": false,
                "isInactive": false
            }
        ]
    },
    {
        "name": "Dr. Mundo's Tyrants",
        "tier": "BRONZE",
        "queue": "RANKED_TEAM_3x3",
        "entries": [
            {
                "playerOrTeamId": "TEAM-155bf680-0798-11e5-8e2b-782bcb46f3e4",
                "playerOrTeamName": "KokaKlucisKonstantins",
                "division": "II",
                "leaguePoints": 33,
                "wins": 5,
                "losses": 5,
                "isHotStreak": false,
                "isVeteran": false,
                "isFreshBlood": false,
                "isInactive": false
            }
        ]
    },
    {
        "name": "Rengar's Warlords",
        "tier": "BRONZE",
        "queue": "RANKED_TEAM_5x5",
        "entries": [
            {
                "playerOrTeamId": "TEAM-155bf680-0798-11e5-8e2b-782bcb46f3e4",
                "playerOrTeamName": "KokaKlucisKonstantins",
                "division": "II",
                "leaguePoints": 21,
                "wins": 8,
                "losses": 5,
                "isHotStreak": false,
                "isVeteran": false,
                "isFreshBlood": false,
                "isInactive": false
            }
        ]
    }
],
"43463467": [
    {
        "name": "Janna's Runemasters",
        "tier": "SILVER",
        "queue": "RANKED_SOLO_5x5",
        "entries": [
            {
                "playerOrTeamId": "43463467",
                "playerOrTeamName": "I luv Expoil",
                "division": "III",
                "leaguePoints": 100,
                "wins": 213,
                "losses": 237,
                "isHotStreak": false,
                "isVeteran": true,
                "isFreshBlood": false,
                "isInactive": false,
                "miniSeries": {
                    "target": 2,
                    "wins": 1,
                    "losses": 0,
                    "progress": "WNN"
                }
            }
        ]
    }
],
"52665047": [
    {
        "name": "LeBlanc's Duelists",
        "tier": "SILVER",
        "queue": "RANKED_SOLO_5x5",
        "entries": [
            {
                "playerOrTeamId": "52665047",
                "playerOrTeamName": "Megoldom",
                "division": "II",
                "leaguePoints": 65,
                "wins": 204,
                "losses": 213,
                "isHotStreak": false,
                "isVeteran": true,
                "isFreshBlood": false,
                "isInactive": false
            }
        ]
    },
    {
        "name": "Nami's Weaponmasters",
        "tier": "BRONZE",
        "queue": "RANKED_TEAM_5x5",
        "entries": [
            {
                "playerOrTeamId": "TEAM-c0b583f0-2f18-11e5-91f0-782bcb4d190f",
                "playerOrTeamName": "TeamThugLifes",
                "division": "IV",
                "leaguePoints": 0,
                "wins": 3,
                "losses": 2,
                "isHotStreak": false,
                "isVeteran": false,
                "isFreshBlood": false,
                "isInactive": false
            }
        ]
    }
]

}

A: Newtonsoft.Json does the job wonderfully. The only thing is that this scenario is not common :)
Below is the code of the Json Structure
 [JsonDictionary]
public class JsonClass : Dictionary<string, List<PlayerClass>>
{
}

public class PlayerClass
{
    public string name { get; set; }
    public string tier { get; set; }
    public string queue { get; set; }
    public List<PlayerDetails> entries { get; set; }
}

public class PlayerDetails
{
    public string playerOrTeamId { get; set; }
    public string playerOrTeamName { get; set; }
    public string division { get; set; }
    public long leaguePoints { get; set; }
    public long wins { get; set; }
    public long losses { get; set; }
    public bool isHotStreak { get; set; }
    public bool isVeteran { get; set; }
    public bool isFreshBlood { get; set; }
    public bool isInactive { get; set; }
}

You can just use two lines of code to deserialize it
string jsonString = new StreamReader(File.Open("TextFile1.json", FileMode.Open)).ReadToEnd();
var deserializedOutput = JsonConvert.DeserializeObject<JsonClass>(jsonString);

where TextFile1.json is a file which contains your json
Below is the deserialized output

PS: I Used version 7.0.1 of Newtonsoft.Json nuget package


text:
Q: WCF Sharing an object between Client and Host Hey, I can't seem to access the returned value from a method I called on my Host.
    //Service---------------------------------------------------------
    [DataMember]
    private List<CalculationRecord> History = new List<CalculationRecord>();

    public IEnumerable<CalculationRecord> CalculationHistory()
    {
        return (IEnumerable<CalculationRecord>)History;
    }

    public CalculationResult Calculate(CalculationNode problem)
    {
        CalculationResult calcResult = new CalculationResult();

        //Calculates results of expression
        CalculationEvaluation Evaluator = new CalculationEvaluation();
        Evaluator.Calculate(problem, calcResult);

        return calcResult;
    }
    //interface---------------------------------------------------------
    [ServiceContract]
    public interface ICalculate
    {
        [OperationContract]
        CalculationResult Calculate(CalculationNode problem);

        [OperationContract]
        IEnumerable<CalculationRecord> CalculationHistory();
    }

    //Client------------------------------------------------------------
    CalculatorClient client = new CalculatorClient();
    ICalculate calcProxy = client.ChannelFactory.CreateChannel();

    CalculationNode calcRootNode = parser.Parse(expression);
    CalculationResult result = calcProxy.Calculate(calcRootNode);//result is null

A: You're under a wrong impression - the DataContract that the server exposes can (and should) only contain data - never any behavior. As such, you can never share an object between client and host - all you can share are service methods to call, and concrete types to use on those methods. That's it.
The process is this: when the client connects up to the server, it will download the metadata for the service - it can find out what service methods are available, what data those take - but it cannot infer any additional methods on the data contract. It just can't. The client then builds up an exact copy of the data contract type - but it's a totally separate class, and it only matches the server-side data contract class as far as its serialized representation in XML is concerned. It is not the same class - it just look the same.
Because in the end, all that happens between the server and the client is an exchange of a serialized message - basically a XML text document. You are not sending across a .NET object! All you're exchanging is a data representation of your data contract, nothing more.
So in your case, the client side proxy will have a new class that looks like the one the server uses - at least on the serialized level on the wire - but it will not contain the Calculate method. The Calculate method you're calling is on the service contract - it's not the one on the data member you have.
In your concrete example, too - you seem to be intermixing [DataMember] and service interface definition. Avoid this at all costs. Also, all the types involved in the calculation - most definitely CalculationNode and CalculationResult - must be exposed as [DataContract] elements containing a number of [DataMember] fields or properties. This is not clear from the snippet of code you posted.


text:
Q: XSL-FO setting default minimum width for inline text i am writing the XSL-FO document and i want to set min-width values for some inline elements. For example, in the following structure
|    FirstName:         string1         LastName:         string2         |

where "string1" and "string2" are data from my XML and "|"'s denotes left and right borders, i want the following results
|    FirstName:    John     LastName:   Smith                             |
|    FirstName:             LastName:   Smith                             |
|    FirstName: SomeVeryVeryLongFirstNameOfSomePerson  LastName:  Smith   |

when respective peoples ("John" "Smith", "" "Smith", "SomeVery..." "Smith") are loaded from XML.
Basicaly i need something like this
<fo:block>
FirstName: <fo:inline min-width="50mm"> <xsl:value-of ...> </fo:inline> LastName: <fo:inline min-width="50mm"> <xsl:value-of ...> </fo:inline>
</fo:block>

but this isn't working (min-width is ignored). I tried min-width on fo:block, tried inline-progression-dimension, block-progression-dimension, some workaround with fo:table but nothing works or i'm doing it wrong. I'm using Apache FOP 1.0.
Can anyone help?
Thanks in advance

A: I had this problem as well, and after some search on the web, I discovered a solution: use a fo:inline-container with the desired width and a fo:block inside where you put your text:
<fo:inline-container text-align="center" width="1cm">
  <fo:block border-bottom="0.5pt solid #000">
    <xsl:value-of select="your/xpath/selector"/>
  </fo:block>
</fo:inline-container>

Just replace the width and selector to match your needs. This example also includes a bottom line, which I needed, but it is not mandatory: just remove the border-bottom from fo:block if you don't need it. See How get fixed width for inline FO? for the original solution and details.


text:
Q: How do i split a single row of columns into multiple rows and columns? I've looked all over and either I am not sure how to word this for searching, or there just isn't anything out there. Originally, the information in my excel sheet was pulled from a text file. I had to go through a lot of work (delimiting and a lot of find/replace) just to get it to even transfer properly into excel, and it still isn't right, but I guess it will do. Unfortunately, it placed everything into one single row (i.e. A1, B1, C1, etc). I need the information to be split into multiple rows;
     A | B
1 | id | 219832
2 | id | 2398
3 | id | 0382
etc

Either that, or every other cell being considered part of the header and the cell following to be placed in the proper column;
     A  |  B   |   C   |   D
1 | id  | type | label | date
2 | 232 |  A   |  Here | 12/12/12
3 | 643 |  B   | There | 10/14/11
4 | 832 |  A   | None  | 09/29/13
etc

This is how this appears as data, currently
    id | TTXW5IAXBSWDETCQZKGUNKK2RYKOVVFQ4S3VGCV | type | A | Label | Here | date | 12/12/12 | id
etc

If someone can help me do this, I would appreciate it very much. While the second option would be much more helpful to me, as that is what I really need to transfer all of this information into, the first option would be acceptable as I can just work by hand from there. Also, just so you know how huge this is, my row extends out to JON1.
Edit:
Also, without all of the find/replace (some but not nearly as much), the data gets pasted into each cell as;
"id":"TTXW5IAXBSWDETCQZKGUNKK2RYKOVVFQ4S3VGCV"

And this is how this way looks
    "id":"TTXW5IAXBSWDETCQZKGUNKK2RYKOVVFQ4S3VGCV" | "type":"A" | "label":"Here" | "date":"12/12/12" | {"id":
etc

or something similar. If that would be easier to work with, then that would be fine as well. I am also noticing, from browsing the data, that not every line of data will begin with "id" though, without using find/replace to get rid of it, the beginning of new lines of data do have a { in front of it;
{"type":"A" |
{"id":"3242134" |
like that

A: You can use Excel inbuilt feature.
Follow below steps:

*

*Go to Data tab.

*In the Data Tools group you will see "Text to Columns" Click on that.

Now follow the instruction in the Convert Text to Column Wizard as per your need.
If that not help you, provide one Input Row and Desired Output.

A: The easy way is through VBA. I suppose that there is a "field" on each cell on row 1, like this
{"id" : "TTXW5IAXBSWDETCQZKGUNKK2RYKOVVFQ4S3VGCV" | "type" : "A" | "label": "Here"

You have to go to macro, and create a new one, insert the following code:
 Sub test()
        Dim wks As Worksheet
        Set wks = ActiveSheet
        Final = False
        i = 1
        InitialRow = 2
        Dim labels(0 To 4) As String
        labels(0) = "id"
        labels(1) = "type"
        labels(2) = "label"
        labels(3) = "grouping"
        labels(4) = "created"
        While Final = False
            ThisCell = Trim(wks.Cells(1, i))
            iniChar = Left(ThisCell, 1)
            If iniChar = "{" Then
                lengthCell = Len(ThisCell)
                ThisCell = Trim(Right(ThisCell, lengthCell - 1))
                InitialRow = InitialRow + 1
            End If
            PosLabelinCell = InStr(ThisCell, ":")
            LabelinCell = Trim(Left(ThisCell, PosLabelinCell - 1))
            lLabelinCell = Len(LabelinCell)
            DatainCell = Trim(Mid(ThisCell, PosLabelinCell + 1))
            lDatainCell = Len(DatainCell)
            LabelinCell = Mid(LabelinCell, 2, lLabelinCell - 2)
            DatainCell = Mid(DatainCell, 2, lDatainCell - 2)
            Select Case LabelinCell
                Case labels(0)
                    wks.Cells(InitialRow, 1) = DatainCell
                Case labels(1)
                    wks.Cells(InitialRow, 2) = DatainCell
                Case labels(2)
                    wks.Cells(InitialRow, 3) = DatainCell
                Case labels(3)
                    wks.Cells(InitialRow, 4) = DatainCell
                Case labels(4)
                    wks.Cells(InitialRow, 5) = DatainCell
            End Select
            i = i + 1
            If wks.Cells(1, i) = "" Then
                Final = True
            End If
        Wend
End Sub

It will go through all the cells in the first row and check if a cell starts with the symbol {, assuming this as a newline character. If a label is missing from the 4 you provide me (id, type, label, grouping,created) it wil leave a blank cell.
Now, run the macro with F5 or with the  green "play" button; from row 3 there will be all the data organized by columns.


text:
Q: Problem in my API REST with CRUD (delete and update), i use nodejs, express, javascript I want to create an api with a json database (with several tables so several json) and make my controllers link with my different routes.
In my POSTMAN tests, get and put work, but update and delete do not work.
Can you help me please?
my files :
enter image description here
my controllers :

function updatePost(filename, filepath, id, newPost) {
    return new Promise((resolve, reject) => {
        helper.mustBeInArray(filename, id)
        .then(post => {
            const index = filename.findIndex(p => p.id == post.id)
            id = { id: post.id }
            filename[index] = { ...id, ...newPost }
            helper.writeJSONFile(filepath, filename)
            resolve(filename[index])
        })
        .catch(err => reject(err))
    })
}

function deletePost(filename, filepath, id) {
    return new Promise((resolve, reject) => {
        helper.mustBeInArray(filename, id)
        .then(() => {
            posts = filename.filter(p => p.id !== id)
            helper.writeJSONFile(filepath, filename)
            resolve()
        })
        .catch(err => reject(err))
    })
}

And here my example for one route for one table :

/* Update a postPerson */
router.put('/:id', m.mustBeInteger, m.checkFieldsPostPerson, async (req, res) => {
    const id = req.params.id

    await postModel.updatePost(postsPerson, pathPerson, id, req.body)
    .then(postModel => res.json({
        message: `The postPerson #${id} has been updated`,
        content: postModel
    }))
    .catch(err => {
        if (err.status) {
            res.status(err.status).json({ message: err.message })
        }
        res.status(500).json({ message: err.message })
    })
})

/* Delete a postPerson */
router.delete('/:id', m.mustBeInteger, async (req, res) => {
    const id = req.params.id

    await postModel.deletePost(postsPerson, pathPerson, id)
    .then(postModel => res.json({
        message: `The postPerson #${id} has been deleted`
    }))
    .catch(err => {
        if (err.status) {
            res.status(err.status).json({ message: err.message })
        }
        res.status(500).json({ message: err.message })
    })
})

And that , this is my code for route GET and POST , that work for them :

router.get('/', async (req, res) => {
    await postModel.getPosts(postsPerson)
    .then(postsPerson => res.json(postsPerson))
    .catch(err => {
        if (err.status) {
            res.status(err.status).json({ message: err.message })
        } else {
            res.status(500).json({ message: err.message })
        }
    })
})

router.get('/:id', m.mustBeInteger, async (req, res) => {
    const id = req.params.id

    await postModel.getPost(postsPerson, id)
    .then(postModel => res.json(postModel))
    .catch(err => {
        if (err.status) {
            res.status(err.status).json({ message: err.message })
        } else {
            res.status(500).json({ message: err.message })
        }
    })
})

/* Insert a new postPerson */
router.post('/', m.checkFieldsPostPerson, async (req, res) => {
    await postModel.insertPost(postsPerson, pathPerson, req.body)
    .then(postModel => res.status(201).json({
        message: `The postPerson #${postModel.id} has been created`,
        content: postModel
    }))
    .catch(err => res.status(500).json({ message: err.message }))
})

And POSTMAN say that for delete and put:

<!DOCTYPE html>

    <meta charset="utf-8">
    <title>Error</title>

Cannot DELETE /portfolio/person

<!DOCTYPE html>

    <meta charset="utf-8">
    <title>Error</title>

Cannot PUT /portfolio/person

Thank you for your help !!!


text:
Q: Docker swarm - How to ensure service is linked correctly on update I'm using a compose file to deploy a stack on a swarm.
The stack contains (among others) nginx and php-fpm.
When updating the stack to newer image tags, using docker stack deploy, I get HTTP 502 errors while the php-fpm service is updating (it take a while as it builds some cache on startup).
What I experience today (or the way I suspect it works)

I would like a cleaner rolling update. What i expect is described here :

How to achieve this ?
Thanks for your appreciated help.

Error in nginx log when getting 502 :
[error] 37#37: *104 connect() failed (113: No route to host) while connecting to upstream, client: 10.0.0.2, server: viageo.ch, request: "GET / HTTP/1.0", upstream: "fastcgi://10.0.2.78:9000", host: "myservice.tld"

v1 services docker-compose file (redacted) :
version: '3.9'

x-deploy-base: &deployBase
    update_config:
        order: start-first
        failure_action: rollback
    rollback_config:
        parallelism: 0
        order: stop-first
    restart_policy:
        condition: any
        delay: 5s
        max_attempts: 5
        window: 120s

services:
    nginx:
        image: myregistry.local/myproject/nginx-deploy:v1
        healthcheck:
            test: [ "CMD", "service", "nginx", "status" ]
        deploy:
            <<: *deployBase

    php-fpm:
        image: myregistry.local/myproject/php-fpm-deploy:v1
        working_dir: /var/www/html
        stop_grace_period: 10s
        healthcheck:
            test: [ "CMD", "php-fpm-healthcheck" ]
        deploy:
            <<: *deployBase

    [other services...]

v2 services docker-compose file (redacted) :
version: '3.9'

x-deploy-base: &deployBase
    update_config:
        order: start-first
        failure_action: rollback
    rollback_config:
        parallelism: 0
        order: stop-first
    restart_policy:
        condition: any
        delay: 5s
        max_attempts: 5
        window: 120s

services:
    nginx:
        image: myregistry.local/myproject/nginx-deploy:v2
        healthcheck:
            test: [ "CMD", "service", "nginx", "status" ]
        deploy:
            <<: *deployBase

    php-fpm:
        image: myregistry.local/myproject/php-fpm-deploy:v2
        working_dir: /var/www/html
        stop_grace_period: 10s
        healthcheck:
            test: [ "CMD", "php-fpm-healthcheck" ]
        deploy:
            <<: *deployBase

    [other services...]


text:
Q: .Net framework JIT and Bulldozer special instructions AMD Bulldozer has been successful in the server space but has performed poorly on the desktop. As I understand it, a major cause of this is that server applications have been rewritten to use Bulldozer's special instructions, which are still not being used in desktop applications. Will or do we expect the Just in time Compiler (JIT) to use these in 4.5, can/ will they be back ported to 4.0?
Clarification: My understanding was that the JIT compiles for the machine it is running on, not the machine on which it was compiled to IL instructions. It has been claimed that because of this JIT applications can actually have higher performance than normal code which is compiled and linked straight down to binary.

A: Unfortunately, the .NET JIT is not particularly sophisticated when it comes to performance:

*

*Even on servers it does not do heavy optimizations like a C++ compiler does, although it has the same information as a C++ compiler has. It just does not do certain things

*It uses special instructions only for some operations with floats

*The x64 even has quality problems with invalid optimizations being done

*Some obvious optimizations like escape analysis are missing

It seems like the JIT is not being developed with a particularly high budget. So I doubt we will see such specialized instructions being used.


text:
Q: Inheritance of Overloaded assignment Operator C++ Complete Reference says ,"Except for the = operator,operator functions are inherited by a derive class."
But i cannt understand the behaviour of the following code:
#include<iostream>
using namespace std;
int main(){

    class b{
        int i;
        public:
            int operator=(b parm){
                cout<<"base overload";
            };
    };
    class d: public b{
        int j;
        public:
    };

    b inst1,inst11;
    d inst2,inst22;
    int a;

   inst1=inst11;    //works because assignment operator  is overloaded for b

   inst2=inst22;  //If =operator function is not inherited then why does it output "base oberload"

   inst1=inst2;    //works because assignment overloaded for b

 // inst2=inst11;      //But if b was inherited then this should also work but it doesnt

}

I am expecting two output statements "base overload" but it is outputting three  Why?? this is driving me nuts

A: operator= is not inherited. But the compiler will generate implicitly an operator= for class d, which invokes b::operator= for the assignment of the base subobject.

the operator performs member-wise copy assignment of the object's bases and non-static members, in their initialization order, using built-in assignment for the scalars and copy assignment operator for class types.

then

inst2=inst22;  //If =operator function is not inherited then why does it output "base oberload"

The generated d::operator= is called here; inside which b::operator= is invoked.

inst1=inst2;    //works because assignment overloaded for b

b::operator= is called here, it expects b as the argument and inst2 could be implicitly converted to the base class b.

// inst2=inst11;      //But if b was inherited then this should also work but it doesnt

d::operator= is tried to be called here, it expects d as the argument but inst11 can't be implicitly converted to the derived class d.


text:
Q: Win32_PnPEntity returning same ClassGuid for different hardware I have some C# code scanning for plug and play devices and then filtering out 2 USB devices (call them dev1 and dev2) by matching VID and PID.
Now, dev1 is directly connected to a USB port of my laptop, while dev2 is connected to a USB Hub, that is connected to my docking station, that is connected to a different laptop USB port than dev1.
Dev1 and Dev2 are different hardware and VID+PID are therefore different for both. My script does detect the 2 different hardware with the correct (and different) VID+PID.
However, the GUID is the same for both Hardware. How can this be possible? Should they not be always different?
For info, here is how I am extracting the GUID and the VID+PID:
 ManagementObjectCollection collection;
 using (var searcher = new ManagementObjectSearcher(@"Select * From Win32_PnPEntity"))
      collection = searcher.Get();

  foreach (var device in collection)
  {
    string deviceIdValue = (string)device.GetPropertyValue("DeviceID");  // Provides VID and PID
    string guidValue = (string)device.GetPropertyValue("ClassGuid");     // Provide the GUID
    ...
   }

A: That's because ClassGuid is not an object identifier but a class identifier.
If you check out the PnPClass property you'll notice that it is the same when the ClassGuid is the same.

A: Check this link. It lists all the ClassGuid types.
The ClassGuid is not tigh to one piece of hardware, but rather to the type of class your hardware refers to.
For instance, two difference hardware of type USB, will both have the same ClassGuid {36FC9E60-C465-11CF-8056-444553540000} as per reference.


text:
Q: jQuery drag and drop with placeholders in fixed grid I searched through a lot of scripts but I didn't find what I'm looking for.
I need a drag'n'drop script with a fixed of drop zones, e.g. 5x5 fields.
In this grid the draggables (e.g. 10 item) should be moveable but without sorting and floating. So that a placeholder stays where I took the draggable item from.
Is there a way to realise this?


text:
Q: Configuring a UITableViewCell object with unique image and text Given a .plist similar to :
<plist version="1.0">
<array>
    <dict>
        <key>name</key>
        <string>Afghanistan</string>
        <key>government</key>
        <string>Islamic Republic</string>
        <key>population</key>
        <integer>0</integer>
        <key>image</key>
        <string>/Flags/afghanistan.png</string>
    </dict>
    <dict>
        <key>name</key>
        <string>Albania</string>
        <key>government</key>
        <string>Emerging Democracy</string>
        <key>population</key>
        <integer>0</integer>
        <key>image</key>
        <string>/Flags/albania.png</string>
    </dict>
.... etc.

And ViewController.m :
#import "FirstViewController.h"
@implementation FirstViewController
@synthesize sortedCountries;

-(void)viewDidLoad  {

    NSString *path = [[NSBundle mainBundle] pathForResource:@"countries" ofType:@"plist"];

    NSArray *countries = [NSArray arrayWithContentsOfFile:path];
    NSSortDescriptor *descriptor = [[[NSSortDescriptor alloc] initWithKey:@"name" ascending:YES] autorelease];
    self.sortedCountries = [countries sortedArrayUsingDescriptors:[NSArray arrayWithObject:descriptor]];

}

-(UITableViewCell *)tableView:(UITableView *)tableView
        cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    NSDictionary *country = [sortedCountries objectAtIndex:indexPath.row];
        NSString *countryName = [country objectForKey:@"name"];

    static NSString *CellIdentifier = @"Cell";

    UITableViewCell *cell =
    [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

    if (cell == nil) {

        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
                                   reuseIdentifier:CellIdentifier] autorelease];
    }

    NSDictionary *item = (NSDictionary *)[sortedCountries objectAtIndex:indexPath.row];
    NSString *path = [[NSBundle mainBundle] pathForResource:[item objectForKey:@"image"] ofType:@"png"];
    UIImage *theImage = [UIImage imageWithContentsOfFile:path];

    cell.imageView.image = theImage;
    cell.textLabel.text = countryName;
    return cell;

    }

This puts countryName in ascending alphabetical order as expeted in the UITableView Cells. What is not working is cell.imageView.image.
It puts afghanistan.png in the first UITableViewCell as expected. The Cells that follow also receive afghanistan.png as well however. ( The second cell should receive 'albania.png', etc ). How can I fix this UIImageView problem?

A: Use imageNamed instead.
cell.imageView.image = [UIImage imageNamed:[item objectForKey:@"image"]];

A: You should use
[item objectForKey:@"image"] in stead of
[item objectForKey:@"imageKey"]
(as the .plist uses <key>image</key>).


text:
Q: AngularJS POST request not returning a response when sessions are used I am making a POST request in angular to an API that returns a JSON object. Everything was working perfectly until I added express.sessions to the mix. Now, the POST request still gives a 200 status, but doesn't return anything for 2 minutes (when it times out). The API gets called successfully and the behavior on the backend is all normal, but I can't retrieve the response from the server. In fact, it doesn't even call the .error() function. It just times out without doing anything.
The strangest part: when I click the link that makes the POST request a second time (immediately following the first), the request and response execute exactly as expected and nothing is wrong. The first request always times out.
When I remove express.sessions, everything works as expected as well.
I am using Express on Node, AngularJS on the frontend.
Here's the code for the POST request:
Request being made. This is within an Angular controller. (Behavior: Nothing gets logged. It doesn't reach success() or error() but times out after 2min):
  $http.post('/api/add_highlight', newHighlight).
    success(function(id){
      console.log('response from server: ' + id)
    }).
    error(function(id){
      console.log('server response failed')
    })

API (Behavior: Successfully saves entry into database. Console logs all show success and behavior is normal on the backend.):
exports.add_highlight = function(req, res) {
  console.log('API has received request to add highlight')
      var hl = new models.highlights ({
        start: req.body.start
        , end: req.body.end
        , contents: req.body.contents
      })
      console.log(hl._id)
      hl.save(function(err){
        if (!err) {
          console.log('successfully saved highlight to mongo.')
          res.json(hl._id)
        }
        res.send('failed')
      })
};

app.js (When the second line is commented out, everything behaves as expected):
  app.use(express.cookieParser());
  app.use(express.session({store: new RedisStore(), secret: '[...]'}));

Please let me know if you have encountered something similar before or have any ideas.
I highly suspect it's an issue with my usage of Angular, because another POST request from an example works perfectly fine. But I do suspect it also has something to do with how I'm supposed to work with sessions in Angular, because when I comment out the session line in app.js, everything works fine too.
Thanks!

A: Got it- it was very silly. I didn't return my res.json and res.send


text:
Q: Order WP_Query by meta_key priority when 'OR' relation used for multiple meta values I have a WP_Query that queries posts by an ACF date field AND an ACF true/false field.  I am requesting all posts that have a date field value past the current date OR have the true/false field checked true be returned.  It appears like such:
$args = array(
    'post_type' => 'post',
    'posts_per_page' => 6,
    'meta_key' => 'event_date',
    'orderby' => 'meta_value_num',
    'order' => 'ASC',
    'cat' => 3,
    'meta_query' => array(
        'relation' => 'OR',
        array(
            'key'     => 'event_date',
            'value'   => date('Ymd'),
            'compare' => '>='
        ),
        array(
            'key'     => 'recurring_event',
            'value'   => 1,
            'compare' => '=='
        )
    )
);

This works great except for the order.  It lists the True/False "true" posts first, most likely because the event_date field value is blank.  I would like it to still order the posts by event_date and then place all the posts with the recurring_event value to true afterwards.
I am getting this as the results:

*

*Post 1 - Recurring Event Selected True

*Post 2 - Recurring Event Selected True

*Post 3 - June 1st, 2022

*Post 4 - July 1st, 2022

*Post 5 - August 1st, 2022

But I would prefer it like this:

*

*Post 1 - June 1st, 2022

*Post 2 - July 1st, 2022

*Post 3 - August 1st, 2022

*Post 4 - Recurring Event Selected True

*Post 5 - Recurring Event Selected True

Do I need to sort the array independently after queried or is there a way to accomplish this through the orderby field?


text:
Q: Tapestry: Ways to do page refresh What are the ways to do a page refresh in Tapestry? I know how to refresh a zone using AjaxResponseRenderer but not quite sure about a page refresh.
Any help would be much appreciated. Thanks.

A: There's nothing in Tapestry to refresh a page as it's just Javascript:
window.location.reload(true);

The 'true' forces the browser to reload content from the server (and not use it's cache).

A: Usually your page has an onActivate() method. To refresh a page you need to have injected with @Inject the PageRenderLinkSource and then use it like in the example
@Inject
private PageRenderLinkSource pageRenderer;

Object onActivate(){}

@OnEvent(*any event*)
Object onRefresh()
{
return pageRenderer.createPageRenderLink(YourClass.class);
}

A: Not sure what you are asking, but, for example, when I use the form in Tapestry and want to add "Reset" button to form, I mark the input button as:
<input t:type="submit" t:id="reset" value="${message:reset}" />
and in class, I add:
 public Object onSelectedFromReset() {

       return this;

    }

This means that I am handling the event from reset button and I am returning this (the same would be if you return the page name return "page-name"). When you return the page, it has the same effect if you would refreshed it.


text:
Q: What symbology to use to show population development? In ArcMap I have made a layer containing two cities and the number of population from 1968-2014. I need help with what symbology to use to show the population development for each city. I have tried various quantities and charts but none shows the development i.e. a graph or something.
Any tips in how to show the development trend clearly?

A: Perhaps something like percent population change between those two years, categorized by symbol size and color for growth/decline.

A: You could try using a bar chart to symbolize your population growth but it might get a bit messy since you are dealing with a large time series. Maybe aggregate population by decade and use the bar chart.
Chart symbolizer manual:
http://resources.arcgis.com/EN/HELP/MAIN/10.1/index.html#/Using_bar_and_column_charts/00s500000003000000/


text:
Q: Prevent automounting of a Linux drive I have a USB stick which is used for backup in a Linux VM (via parallels).  Everything works fine there, except that every time the VM is powered off, the USB stick is handed back to macOS, which promptly shows me a happy little dialog to offer initializing the stick.  It's even kept on top for extra happiness.
More than the mere annoyance of clicking "Ignore" each time, or just leave the damn thing on, I worry that the chances of me clicking that "Initialize" button, small as they may be, become significant when repeated infinitely often.  So I went on the trail of yet another one of these little macos things that should be a few seconds but then you find yourself stuck in a two-day black hole of time and soul sucking.
Everywhere I look, there's the usual vifs dance of finding the UUID and blacklisting it for no automounting.  But my stick is a mostly a mystery to macOS -- it doesn't see any UUID, and FS type, no nothing.  (The complete diskutil info and system report are below.)  This is the closest question I could find, but that discussion reached no definitive conclusion.
I tried using the UUIDs that Linux gave me for the disk and for the partition.  Also, macOS does show something when I try to extract information about the partition (disk2s1) only that's a different UUID.  I tried adding the magic lines for all three UUIDs, but nothing helps.  Not surprising given that one component of that magic is hfs which this is not.
So, how do I prevent macOS from trying to mount this stick?
(Things that I want to avoid: reformatting it in the mac for using some other mac FS, installing some ext4 driver (since the idea of a driver that would be used just to not mount a drive is offensive), or sacrificing a goat.
One thing that I would consider a half-assed solution is to just disable all automounting.)

$ diskutil info disk2
   Device Identifier:         disk2
   Device Node:               /dev/disk2
   Whole:                     Yes
   Part of Whole:             disk2
   Device / Media Name:       SanDisk 3.2Gen1

   Volume Name:               Not applicable (no file system)
   Mounted:                   Not applicable (no file system)
   File System:               None

   Content (IOContent):       GUID_partition_scheme
   OS Can Be Installed:       No
   Media Type:                Generic
   Protocol:                  USB
   SMART Status:              Not Supported

   Disk Size:                 494.2 GB (494206451712 Bytes) (exactly 965246976 512-Byte-Units)
   Device Block Size:         512 Bytes

   Media OS Use Only:         No
   Media Read-Only:           No
   Volume Read-Only:          Not applicable (no file system)

   Device Location:           External
   Removable Media:           Removable
   Media Removal:             Software-Activated

   Solid State:               Info not available
   Virtual:                   No

$ diskutil info disk2s1
   Device Identifier:         disk2s1
   Device Node:               /dev/disk2s1
   Whole:                     No
   Part of Whole:             disk2

   Volume Name:               Not applicable (no file system)
   Mounted:                   Not applicable (no file system)
   File System:               None

   Partition Type:            Linux Filesystem
   OS Can Be Installed:       No
   Media Type:                Generic
   Protocol:                  USB
   SMART Status:              Not Supported
   Disk / Partition UUID:     697A2A16-285F-418D-9CB0-3AE349F50F38
   Partition Offset:          1048576 Bytes (2048 512-Byte-Device-Blocks)

   Disk Size:                 494.2 GB (494204354560 Bytes) (exactly 965242880 512-Byte-Units)
   Device Block Size:         512 Bytes

   Media OS Use Only:         No
   Media Read-Only:           No
   Volume Read-Only:          Not applicable (no file system)

   Device Location:           External
   Removable Media:           Removable
   Media Removal:             Software-Activated

   Solid State:               Info not available

System report info:
 SanDisk 3.2Gen1:

  Product ID:   0x5591
  Vendor ID:    0x0781  (SanDisk Corporation)
  Version:  1.00
  Serial Number:    04013dd539bdbc9ee86ce8fe9b85d90ca5e7c05737f84b114db8c67b79112931829e00000000000000000000c34487e8ff0cc718915581071eac8ae1
  Speed:    Up to 5 Gb/s
  Manufacturer:  USB
  Location ID:  0x01240000 / 4
  Current Available (mA):   900
  Current Required (mA):    896
  Extra Operating Current (mA): 0
  Media:
SanDisk 3.2Gen1:
  Capacity: 494.21 GB (494,206,451,712 bytes)
  Removable Media:  Yes
  BSD Name: disk2
  Logical Unit: 0
  Partition Map Type:   GPT (GUID Partition Table)
  S.M.A.R.T. status:    Verified
  USB Interface:    0
  Volumes:
disk2s1:
  Capacity: 494.2 GB (494,204,354,560 bytes)
  BSD Name: disk2s1
  Content:  Linux Filesystem


text:
Q: as ... as - "African-American culture as embodied in music, art, and literature flourished as never before." (a)

African-American culture as embodied in music, art, and literature flourished as never before.

Is this sentence above an example of "as ... as"?
Or is it an example of ellipsis? What words are left out to avoid repetition?
Such as
(a*)

African-American culture as (which was) embodied in music, art, and literature flourished as (this culture) never (flourished) before.

A: It is not a comparison between two things, if I understand what you mean by "as ... as".
(c) is the closest in meaning to the original sentence.
(b) has a slightly different meaning. It seems to note, incidentally, that African-American culture happens to be embodied in those things, without specifically qualifying the exact sort of culture we are discussing.
(a) does not really make much sense.
To break down this complex sentence:

*

*African-American culture

*

*as embodied in

*

*music, art, and literature

*flourished

*

*as never before

It would be more clear, I think, if we re-allocated some optional commas:

African-American culture, as embodied in music, art and literature, flourished as never before.

Or instead, with parentheses:

African-American culture (as embodied in music, art, and literature) flourished as never before.

By the way, the punctuation ... is called an ellipsis, not to be confused with the concept you asked about :)

A: This is not an example of "as ... as".
It's simply a sentence that happens to use the word "as" twice.
It means roughly:

African-American culture, which was embodied in music, art, and literature, flourished as it had never flourished before.


text:
Q: How to use interlocked variable for WaitOnAddress / WakeByAddressSingle? Recently I've got to know WaitOnAddress, WakeByAddressSingle, and Interlocked* family of functions.
While making test code as a part of understanding process, I've faced C28112 warning.
Following code is the test code that generates C28112 warning.
#include <iostream>
#include <Windows.h>
#pragma comment(lib, "Synchronization.lib")

using namespace std;

void* g_pThread0 = nullptr;
unsigned long g_ulThread0ID = 0UL;

void* g_pThread1 = nullptr;
unsigned long g_ulThread1ID = 0UL;

short g_sShared = 0i16;
short g_sCompare = 0i16;

unsigned long __stdcall Thread0(void* const _pParameter)
{
    int nWaitResult = -1;
    short sExchangeResult = -1i16;

    while (true)
    {
        nWaitResult = WaitOnAddress(&g_sShared, &g_sCompare, sizeof(short), INFINITE);  // C28112
        if (InterlockedOr16(&g_sShared, 0i16) == 1i16)   // Check
        {
            // Do Something

            sExchangeResult = InterlockedExchange16(&g_sShared, 0i16);
        }
    }

    return 0UL;
}

unsigned long __stdcall Thread1(void* const _pParameter)
{
    short sExchangeResult = -1i16;

    while (true)
    {
        sExchangeResult = InterlockedExchange16(&g_sShared, 1i16);
        WakeByAddressSingle(&g_sShared);    // C28112
    }

    return 0UL;
}

int main()
{
    g_pThread0 = CreateThread(nullptr, 0UL, Thread0, nullptr, 0UL, &g_ulThread0ID);
    g_pThread1 = CreateThread(nullptr, 0UL, Thread1, nullptr, 0UL, &g_ulThread1ID);

    while (true)
    {
    }

    return 0;
}

The following two lines are "accessing interlocked variable", I understand that.
nWaitResult = WaitOnAddress(&g_sShared, &g_sCompare, sizeof(short), INFINITE);  // C28112
...
WakeByAddressSingle(&g_sShared);    // C28112

The question is, how can I remove this warning while using interlocked variable for WaitOnAddress / WakeByAddressSingle?
Currently, I've come up with an answer by declaring g_sShared as pointer.
#include <iostream>
#include <Windows.h>
#pragma comment(lib, "Synchronization.lib")

using namespace std;

void* g_pThread0 = nullptr;
unsigned long g_ulThread0ID = 0UL;

void* g_pThread1 = nullptr;
unsigned long g_ulThread1ID = 0UL;

short* const g_pShared = new short(0i16);
short g_sCompare = 0i16;

unsigned long __stdcall Thread0(void* const _pParameter)
{
    int nWaitResult = -1;
    short sExchangeResult = -1i16;

    while (true)
    {
        nWaitResult = WaitOnAddress(g_pShared, &g_sCompare, sizeof(short), INFINITE);
        if (InterlockedOr16(g_pShared, 0i16) == 1i16)   // Check
        {
            // Do Something

            sExchangeResult = InterlockedExchange16(g_pShared, 0i16);
        }
    }

    return 0UL;
}

unsigned long __stdcall Thread1(void* const _pParameter)
{
    short sExchangeResult = -1i16;

    while (true)
    {
        sExchangeResult = InterlockedExchange16(g_pShared, 1i16);
        WakeByAddressSingle(g_pShared);
    }

    return 0UL;
}

int main()
{
    g_pThread0 = CreateThread(nullptr, 0UL, Thread0, nullptr, 0UL, &g_ulThread0ID);
    g_pThread1 = CreateThread(nullptr, 0UL, Thread1, nullptr, 0UL, &g_ulThread1ID);

    while (true)
    {
    }

    return 0;
}

This successfully removes warning.
However, I feel this approach is a kind of warning removing trick.
[EDIT]
Thanks to the comments by Richard Critten, WBuck, Simon Mourier,
It seems there are 4 options to solve C28112 warning.

*

*Disable warning.

*Use InterlockedOr.

*Use InterlockedCompareExchange.

*Use struct wrapper for the interlocked variable.

1 and 4 seem to be the measures that solve the problem by bypassing warning.
2 and 3 seem to be the measures that solve the problem by satisfying warning .
Even though the warning is "overly cautious", 2 and 3 seem to be essentially problem solving way.
Following is the test code after using InterlockedOr.
#include <iostream>
#include <Windows.h>
#pragma comment(lib, "Synchronization.lib")

using namespace std;

void* g_pThread0 = nullptr;
unsigned long g_ulThread0ID = 0UL;

void* g_pThread1 = nullptr;
unsigned long g_ulThread1ID = 0UL;

short* g_pShared = new short(0i16);
short g_sCompare = 0i16;

unsigned long __stdcall Thread0(void* const _pParameter)
{
    int nWaitResult = -1;
    short sExchangeResult = -1i16;

    while (true)
    {
        nWaitResult = WaitOnAddress(reinterpret_cast<void*>(InterlockedOr64(reinterpret_cast<long long*>(&g_pShared), 0LL)), &g_sCompare, sizeof(short), INFINITE);
        if (InterlockedOr16(g_pShared, 0i16) == 1i16)   // Check
        {
            // Do Something

            sExchangeResult = InterlockedExchange16(g_pShared, 0i16);
        }
    }

    return 0UL;
}

unsigned long __stdcall Thread1(void* const _pParameter)
{
    short sExchangeResult = -1i16;

    while (true)
    {
        sExchangeResult = InterlockedExchange16(g_pShared, 1i16);
        WakeByAddressSingle(reinterpret_cast<void*>(InterlockedOr64(reinterpret_cast<long long*>(&g_pShared), 0LL)));
    }

    return 0UL;
}

int main()
{
    g_pThread0 = CreateThread(nullptr, 0UL, Thread0, nullptr, 0UL, &g_ulThread0ID);
    g_pThread1 = CreateThread(nullptr, 0UL, Thread1, nullptr, 0UL, &g_ulThread1ID);

    while (true)
    {
    }

    return 0;
}

Code seem surprisingly ugly. Any gentle person help me out please.

A: I think the warning here is false positive. It should make sure the variable is always accessed atomically, but WaitOnAddress and WakeByAddress* access the variable atomically internally.
You can suppress it using #pragma warning(supress:28112) above the line, or disable temporarily and then restore:
#pragma warning(push)
#pragma warning(disable:28112)
WakeByAddressSingle(...)
#pragma warning(pop)

You can report this false positive to Microsoft if you care (to https://developercommunity.visualstudio.com I guess)

Also if you are using Visual Studio 2019, more convenient way to have atomic wait is to use C++20 std::atomic<T>::wait / std::atomic<T>::notify_*. std::atomic should not produce this warning, and doesn't allow easy access to the underlying variable to access to it in non-atomic way.


text:
Q: Delete selected tables from Postgres sql I need to remove selected tables from the Postgres SQL. It would better to use like or where clause.
Like I have
TABLE_A
TABLE_B
TABLE_C
-
-
-
TABLE_N

I need to delete
TABLE_A to TABLE_X

A: Can be done with a single command, which is faster - in case this is a recurring task.
Add IF EXISTS if the existence of any tables is uncertain. This way we save an extra trip to the system catalogs (information_schema.tables or pg_catalog.pg_tables).
And you may want to add CASCADE:
DO
$do$
BEGIN
  -- child safety device: quote RAISE instead of EXECUTE to prime the bomb
  -- EXECUTE (
  RAISE NOTICE '%', (
     SELECT 'DROP TABLE IF EXISTS'
         || string_agg('table_' || chr(ascii('a') + g) , ', ')
         || ' CASCADE;'
     FROM   generate_series(0,13) g
     );
END
$do$;

Generates a command of the form:
DROP TABLE IF EXISTS table_a, table_b, ... , table_n CASCADE;

Using generate_series() to generate requested table names. More here:

*

*How to drop many (but not all) tables in one fell swoop?

*How to check if a table exists in a given schema

A: DO
$$
DECLARE
   r RECORD;
BEGIN
    FOR r IN SELECT oid::REGCLASS table_name
             FROM pg_class
             WHERE relname <= 'table_x'
             AND relkind = 'r'
    LOOP
          EXECUTE 'DROP TABLE' || r.table_name;
    END LOOP;
END;
$$ LANGUAGE plpgsql;


text:
Q: Why's my Eloquent where() clause breaking my query when removed? I have an Eloquent query where it allows the user to search for items using keywords successfully when the ->where('item.isAvailable', $boxChecked) clause isn't present.
However, whenever I add the ->where('item.isAvailable', $boxChecked) clause - it breaks my query in terms of no items showing up upon searching.  I believe the issue's because of the way that where()'s written but I'm not too sure.
Note:  $boxChecked's just a boolean value. this where() clause's supposed to hide items that are unavailable.  The frontend has a checkbox.
How'd I correct this so that the user can search using keywords to find the item they need and be able to hide unavailable items if they want to without breaking the query?
Edit: I've tried using a closure but it still produced the same result :(.
Here's my Eloquent query:
$inventories = $this->model
                ->join('awards', 'item.ItemID', '=', 'awards.AwardLinkID')
                ->join('opps', 'awards.AwardID', '=', 'opps.AwardID')
                ->whereIn('item.ItemID', explode(',', $searchKeyword))
                ->orWhere('item.Description','like', "%{$searchKeyword}%")
                ->where('item.isAvailable', $boxChecked)
                ->groupBy('item.ItemID')
                ->select("item.ItemID", "item.Description", "opps.OppID")
                ->get();


text:
Q: Creating dataframe rows with timestamp increments I have a dataframe with a structure similar to this:

name
time_from
time_to
value

a
2020-01-01 00:00:00
2020-01-01 01:30:00
value1

a
2020-01-01 02:00:00
2020-01-01 02:30:00
value2

b
2020-01-01 00:00:00
2020-01-01 01:00:00
value3

I want to convert the dataframe to the following structure by increasing the time_from timestamp by 30 minutes up to the time_to timestamp value while the name and value remain the same over the timestamp increments.

name
time
value

a
2020-01-01 00:00:00
value1

a
2020-01-01 00:30:00
value1

a
2020-01-01 01:00:00
value1

a
2020-01-01 01:30:00
value1

a
2020-01-01 02:00:00
value2

a
2020-01-01 02:30:00
value2

b
2020-01-01 00:00:00
value3

b
2020-01-01 00:30:00
value3

b
2020-01-01 01:00:00
value3

Help and guidance would be greatly appreciated. Thank you.

A: Using seqPOSIXt in a by approach.
dat <- do.call(rbind, by(dat, dat[c('name', 'value')], function(x) {
  setNames(
    data.frame(x[1, 1], seq.POSIXt(x[1, 2], x[nrow(x), 3], by='30 min'), x[1, 4]),
    c('name', 'time', 'value'))}))
dat
#   name                time  value
# 1    a 2020-01-01 00:00:00 value1
# 2    a 2020-01-01 00:30:00 value1
# 3    a 2020-01-01 01:00:00 value1
# 4    a 2020-01-01 01:30:00 value1
# 5    a 2020-01-01 02:00:00 value2
# 6    a 2020-01-01 02:30:00 value2
# 7    b 2020-01-01 00:00:00 value3
# 8    b 2020-01-01 00:30:00 value3
# 9    b 2020-01-01 01:00:00 value3

Of course, the solution assumes correctly formated 'POSIXct' format as input. Convert beforehand if you don't have it:
tcols <- c('time_from', 'time_to')
dat[tcols] <- lapply(dat[tcols], as.POSIXct)

Data:
dat <- structure(list(name = c("a", "a", "b"), time_from = structure(c(1577833200,
1577840400, 1577833200), class = c("POSIXct", "POSIXt"), tzone = ""),
    time_to = structure(c(1577838600, 1577842200, 1577836800), class = c("POSIXct",
    "POSIXt"), tzone = ""), value = c("value1", "value2", "value3"
    )), row.names = c(NA, -3L), class = "data.frame")


text: Q: Android Webview flask website hosted on heroku I have used Website 2 Apk builder pro for conversion of my flask app hosted on heroku. It uses auth0 of google. It is working like a charm in web but when I am using app with webview the auth0 google page is opening without retrieving all the saved google user. It is again asking me to sign in. So is there any way to use in the same way like other app uses it. Like native app uses it. Please tell me how to do that.


text:
Q: How can I make files show thumbnails? Ubuntu 20.04.1
Files shows file names for .png files and possibly others, e.g. .jpg
I want it to show thumbnails.
I've looked at files > preferences which is set to All Files less than 10Mb, but I'm still seeing file names and sizes, considerably less than 10Mb.
How can I make Files show thumbnails?

A: Use the view switch as shown in the image:

The keyboard shortcuts are Ctrl+1 and Ctrl+2.


text:
Q: Pure css tabs transitions How can I make this tabs script: FIDDLE
work like this: DEMO
Where did I made a mistake?
a[name="tab1"] + .facebook_box {
    display: block
}
:target + .twitter_box {
    display: block
}
:target ~ a[name="tab1"] + .facebook_box {
    display: none
}

A: I've updated your Fiddle which is a working example now.
There are various issues in your Fiddle but the biggest issue is that the technique you are trying to use depends on a set HTML structure.
You tried to add an extra
 which wasn't taken care of in your CSS.
Also the links in the labels were empty and didn't have a width/height so you can't click on them.
The HTML I've used:

            <input checked type="radio" name="tab" id="fbtab" />
            <input type="radio" name="tab" id="twtab" />

                     Facebook

                     Twitter

The most important changes to the CSS was the removal of the .tab-content and updating the .twitter_box with the position: absolute; and the top/left/right/bottom:
.social_slider .twitter_box {
    border-radius: 8px;
    background-color: #19bfe5;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99998;
    display:none;
    height:300px;
    border: 10px solid #68c2ff;
}

Making the anchors clickable:
.social_slider .tab-links label a {
    display: block;
    height: 100%;
}


text:
Q: Union of 2d array in Python by row according to first column I'm trying to find a union of two 2d arrays based on the first column:
>>> x1
array([[1, 2, 3],
       [4, 5, 6],
       [7, 8, 9]])
>>> x2
array([[ 7, -1, -1],
       [10, 11, 12]])

If two rows have a matching first value, I want the one from x2. I.e. the union of the first column of x1[:, 0] and x2[:, 0] is [1, 4, 7, 10] and I want the row [7, -1, -1] from x2, not [7, 8, 9] from x1. The expected result in this case is:
>>> res
array([[ 1,  2,  3],
       [ 4,  5,  6],
       [ 7, -1, -1],
       [10, 11, 12]])

I see there is a possible solution for union of a 2D array here, where I get the result:
>>> res
array([[ 1,  2,  3],
       [ 4,  5,  6],
       [ 7, -1, -1],
       [ 7,  8,  9],
       [10, 11, 12]])

In this result, I wanted the row [7, 8, 9] from x1 to be excluded. How could I do that?

A: You can use np.unique and np.concatenate, placing x2 first. Unique can compute the index of your values, based on the first occurrence:
values = np.concatenate((x2[:, 0], x1[:, 0]))
_, index = np.unique(values, return_index=True)
mask = index >= x2.shape[0]
result = np.concatenate((x1[index[mask] - x2.shape[0], :], x2[index[~mask], :]), axis=0)

The result is exactly the array you would expect:
array([[ 1,  2,  3],
       [ 4,  5,  6],
       [ 7, -1, -1],
       [10, 11, 12]])

Keep in mind that the result of unique is sorted, which coincidentally happens to correspond to your original order. You can get the original order with a clever application of return_inverse=True, which will be left as an exercise for the reader.


text:
Q: Group by pick row with lowest value (price)
I have all the hotel and room price, in these data, I need to fetch the lowest price room among the hotels data, below is my query it is not picking the least price example hotelname3, room2, 5.
SELECT *
FROM (hoteldata)
GROUP BY hotelname
ORDER BY price ASC

A: Try this:
SELECT * FROM hoteldata where price = (SELECT min(price) FROM hoteldata)

A: SELECT hd.*
FROM (
    SELECT hotelname , MIN(price) as minprice
    FROM hoteldata
    GROUP BY hotelname
) minprices
JOIN hoteldata hd
    ON  hd.hotelname = minprices.hotelname
    AND hd.price = minprices.minprice

Note: If two rooms in one hotel have the lowest price, they will be listet both.
For performance you should define an index on (hotelname, price)
http://sqlfiddle.com/#!9/10f00/1

A: SELECT *
FROM (hoteldata) order by price asc limit 1;

This will work for getting minimum price room from different hotel.