text:
Q: Apply css to just one grid I'm using jqgrid 4.5.4.
I'm trying to apply some css using this selectors
.ui-jqgrid tr.jqgrow td {
    word-wrap: break-word; /* IE 5.5+ and CSS3 */
    white-space: pre-wrap; /* CSS3 */
    white-space: -moz-pre-wrap; /* Mozilla, since 1999 */
    white-space: -pre-wrap; /* Opera 4-6 */
    white-space: -o-pre-wrap; /* Opera 7 */
    overflow: hidden;
    height: auto;
    vertical-align: middle;
}

but since i have multiple grids and i just want to apply this css to a grid, i tried this way:
#grid .ui-jqgrid tr.jqgrow td {
    word-wrap: break-word; /* IE 5.5+ and CSS3 */
    white-space: pre-wrap; /* CSS3 */
    white-space: -moz-pre-wrap; /* Mozilla, since 1999 */
    white-space: -pre-wrap; /* Opera 4-6 */
    white-space: -o-pre-wrap; /* Opera 7 */
    overflow: hidden;
    height: auto;
    vertical-align: middle;
}

but with no success.
Is there a way to apply this css to just one or two grids instead of all grids?

A: Educated guess: You're targeting grid with id="grid" and class="ui-jqgrid". Then, your CSS should target #grid.ui-jqgrid tr.jqgrow td (no space between #grid and .ui-jqgrid).
As currently it targets .ui-jqgrid which would be child of #grid instead of the element.
So your code would be:
#grid.ui-jqgrid tr.jqgrow td {
    word-wrap: break-word; /* IE 5.5+ and CSS3 */
    white-space: pre-wrap; /* CSS3 */
    white-space: -moz-pre-wrap; /* Mozilla, since 1999 */
    white-space: -pre-wrap; /* Opera 4-6 */
    white-space: -o-pre-wrap; /* Opera 7 */
    overflow: hidden;
    height: auto;
    vertical-align: middle;
}

A: The selector
#grid .ui-jqgrid tr.jqgrow td {...}

is wrong because .ui-jqgrid is outer div relative to the grid. Correct would be at least the following:
.ui-jqgrid #grid tr.jqgrow td {...}

see the structure of jqGrid divs and tables here.


text:
Q: Deploying reactJS application - routing issues in production mode I've got some routing issues after deploying in production mode.
(My app runs on an aws S3 Bucket) everything works fine only routing has some issues.
Matching not known Routes are the Problem. I have the following routing:
import {BrowserRouter as Router, hashHistory, Switch, NavLink, Route} from "react-router-dom";

<Provider store={store}>
    <AppContainer>
        <Router history={createHistory}>

                <ThemeProvider theme={theme}>

                        {/*Switch is for Error Routing*/}
                        <Switch>
                            <Route exact path="/" component={() => (<Logins foo={"test"} loginHandler={this.props.loginHandler}/>)}/>
                            <Route path="/logout" component={() => (<Logins foo={"test"} loginHandler={this.loginHandler}/>)}/>
                            <Route path="/signup" component={() => (<SignUp loginHandler={this.loginHandler}/>)}/>
                            <Route path="/imprint" component={() => (<Impressum/>)}/>
                            <Route path="/verification/:verificationToken/:verificationEmail" component={() => (<Verification/>)}/>
                            <Route component={() => (<Error/>)}/>
                        </Switch>

                            {t('application:made')}
                             | <NavLink to="/imprint">{t('application:imprint')}</NavLink> | <LanguageChooserSmall/>

                </ThemeProvider>

        </Router>
    </AppContainer>
</Provider>

Known Routes working fine. But in error case the Switch should affect all not known routes should be redirected to <Route component={() => (<Error/>)} /> but that's not working ...
what could be the problem?

A: Try setting the response page path to index.html in the custom error response setting in cloudfront.

redpajama_set_name: RedPajamaStackExchange


text:
Q: My temp conversion program I'm not sure why my program will not work. I was told that I should not put the getCelcius inside the constructor but now I'm stuck. Any help? I may also have some un wanted braces that are useless to the program.
import java.io.*;
class Temperature {
    //Assign varriables to int
    int factorC, factorF;
    int celcius, ferenheit;

    {
        int getFactorC() { // Celsius
            return factorC;
        }
    }

    // declaring variables
    Temperature(int factorC, int factorF, int celcius, int ferenheit) {
        setFactorC() {
            factorC = (9 / 5) * celcius + 32; //Calculate Celcius
        }
        {
            int getFactorF() { // Fahrenheit
                return factorF;
        }
    }

    {
        setFactorF() {
            factorF= (5 / 9) * ferenheit - 32; //Calculate Ferenheit
        }
    }
}
} //???

class TempConversion
{

A: There are numerous problems with your code, but the first thing I'm going to do it format it:
class Temperature {

    //Assign varriables to int
    int factorC, factorF;
    int celcius, ferenheit;

    int getFactorC() { // Celsius
        return factorC;
    }

    Temperature(int factorC, int factorF, int celcius, int ferenheit) {
        this.factorC = factorC;
        this.factorF = factorF;
        this.celcius = celcius;
        this.ferenheit = ferenheit;
    }

    void setFactorC() {
        factorC = (9 / 5) * celcius + 32; //Calculate Celcius
    }

    int getFactorF() { // Fahrenheit
        return factorF;
    }

    void setFactorF() {
        factorF = (5 / 9) * ferenheit - 32; //Calculate Ferenheit
    }
}

Quick tip:

*

*9/5 is 1 and 5/9 is 0. In Java, when you divide integers, you get an integer. You can replace that with 9.0/5.0 and 5.0/9.0.


text:
Q: Explained examples of program time complexity I'm trying to learn time complexity of various programms/algorithms. Does anybody know, where I could get a set of explained examples like the ones found on this site (heading Exercises).
Thank you in advance.

A: Google "Time Complexity Exercises"
see First Result


text:
Q: How might one optimise geospatial operations on complex polygons, especially plots in R? Question:
I'm attempting to run some simple plots on some shapefiles with a high number of complex polygons. These aren't massive files - for the example below, the shapefile is 70mb (15872 obs), but plots, buffers, etc. are running extremely slowly, e.g. over an hour in some cases for a single relatively simple plot. Can anyone recommend some ways to optimise these operations? I cannot simplify the geometry of the polygons, as I need to ensure accuracy, but this seems to render R unworkable as a platform for reproducible geospatial research.
Sample data:
Download data as ESRI Shapefile from page at: https://gateway.snh.gov.uk/natural-spaces/dataset.jsp?dsid=SSSI
Reproducible example:
(install libraries and data ahead of execution)
require(RCurl) # used for fetching reproducible datasets
require(sf) # new simplefeature data class, supercedes sp in many ways
# using GEOS 3.6.1, GDAL 2.1.3, PROJ 4.9.3
require(sp) # needed for proj4string, deprecated by sf()
require(rgdal) # version version: 1.3-6
require(rgeos) # used for buffering below
require(devtools)
require(ggplot)

# Download data as ESRI Shapefile from page at: https://gateway.snh.gov.uk/natural-spaces/dataset.jsp?dsid=SSSI

unzip("SSSI_SCOTLAND_ESRI.zip")
sssi_sf <- st_read("SSSI_SCOTLAND.shp")
sssi_sp <- readOGR("./", "SSSI_SCOTLAND")

# First test out plots using spatialfeatures and spdf with core R

system.time(
plot(sssi_sf)
  )

system.time(
plot(sssi_sp)
  )

# Then test out plots using spatialfeatures and spdf with ggplot2

system.time(
  ggplot() +
    geom_sf(data = sssi_sf)
)

system.time(
  ggplot() +
    geom_polygon(data = sssi_sp)
)

A few notes:
I've updated R and packages as of this morning, so am working with the latest versions (of pre-compiled binaries) of relevant libraries.
Also worth noting is that I've seen indications elsewhere that slow plots might be related to XQuartz limitations, but I've tested and confirmed that plots are terribly slow (> 1hr for plot(sssi_sf) below for example) on both MacOS and Windows (running in virtualbox).

A: Well, On my laptop with an i7-4core and 24GB RAM, I was able to use a primitive plot on the sp class in 7 seconds and all 7 columns in a panel plot with an sf class in 62 seconds.
However, ggplot2 seems to be having some speed issues with the data regardless of what I do. As to buffering, you do have 15,872 features but, additionally it is taking longer than expected (ran for 15 mins before I killed it).
You may want to try simplifying your geometry using: rgeos::gSimplify or sf::st_simplify. Some think that this reduces precision but, often what it accomplishes is reducing the number of unnecessary nodes in a feature geometry. This is dictated by the tolerance factor used in the generalization algorythm. Also, keep in mind that if the end result is the product of a buffering operation there is quite a bit of introduced uncertainty in the precision of the resulting buffers. Besides, maintaining high precision while plotting 15,872 features seems a bit unnecessary.
Here is a worked example on your data. It speeded up buffering operations to a reasonable expectation and rendered a ggplot2 plot in ~1 min.
library(sf)
library(sp)
library(rgeos)
library(ggplot2)
library(rgdal)

sssi_sf <- st_read("SSSI_SCOTLAND.shp")
sssi_sp <- readOGR(getwd(), "SSSI_SCOTLAND")

Check validity of feature(s) geometry
rgeos::gIsValid(sssi_sp)
valid <- st_is_valid(sssi_sf)
  valid[valid == FALSE]

Here we apply the Douglas-Peuker simplify algorithm to sp and sf objects, then buffer the results to 20 meters with a quadseg of 30 (checking for run times). For the sp object we plot a single polygon to check if the shape has changed. After applying a simplify operation, the buffer operation took ~62 seconds on the sf class object and ~30 seconds on the sp.
sssi_sp2 <- rgeos::gSimplify(sssi_sp, tol=3)
  par(mfrow=c(1,2))
    plot(sssi_sp[1,])
    plot(sssi_sp2[1,])

  system.time(
    sssi_b1000 <- rgeos::gBuffer(sssi_sp2, width = 20, quadsegs = 30)
  )

sssi_sf2 <- sf::st_simplify(sssi_sf)
  system.time(
    sssi_b1000 <- sf::st_buffer(sssi_sf2, dist = 20)
  )

Render ggplot2 plot on simplified geomerty
ggplot(sssi_sf2) + geom_sf(aes(fill = PA_CODE))

Just to illustrate the uncertainty that is introduce to the precision in buffering operations (across 4 scales), here is a quick example. Note that I am using an unnecessarily high number of line segments (quadsegs) to use to approximate the buffer.
par(mfrow=c(2,2))
  plot(gBuffer(sssi_sp[1,], width = 10,
       quadsegs = 30), main="Buffer = 10")
    plot(sssi_sp[1,], add=TRUE)
  plot(gBuffer(sssi_sp[1,], width = 20,
       quadsegs = 30), main="Buffer = 20")
    plot(sssi_sp[1,], add=TRUE)
  plot(gBuffer(sssi_sp[1,], width = 40,
       quadsegs = 30), main="Buffer = 40")
    plot(sssi_sp[1,], add=TRUE)
  plot(gBuffer(sssi_sp[1,], width = 80,
       quadsegs = 30), main="Buffer = 80")
    plot(sssi_sp[1,], add=TRUE)


text:
Q: Alternate Form of Estimation Lemma for Product of Two Functions I am curious if this is a valid inequality:
$|\int_Xfg dx| \leq M|\int_Xgdx|$
Where $f,g$ are integrable functions and $M=\sup_X|f|$. Here was my (quick) proof:
$|\int_X fg dx| \leq \int_X |fg| dx \leq \int_X|f||g|dx \leq M\int_X|g|dx$
Is this valid? And if it is, would it hold if $X=\mathbb{R}$?

A: Hint: Consider $f(x) = g(x) = x$ on $[-1, 1]$.


text:
Q: Яндекс.Карты - убрать границы между регионами Использую Яндекс.Карты для отображения нескольких регионов сразу как одно целое. Можно как-нибудь убрать внутренние границы между ними и оставить лишь общую внешнюю? Код с примером прилагаю.
Заранее спасибо!

YMaps.jQuery(function() {
  var map = new YMaps.Map(YMaps.jQuery("#YMapsID")[0]);
  map.setCenter(new YMaps.GeoPoint(55.617671, 53.552283), 5);
  var zoom = new YMaps.Zoom();
  map.addControl(zoom);
  map.enableScrollZoom(true);
  YMaps.Regions.load("ru", function(state, response) {
    if (state == YMaps.State.SUCCESS) {
      var shapes, polygon;
      var regionVba = response.filter(function(obj) {
        var names = [
          "Республика Башкортостан",
          "Оренбургская область",
          "Пермская область",
          "Республика Татарстан",
          "Удмуртская Республика"
        ];
        return (names.indexOf(obj.name) > -1);
      });
      for (var i = 0; i < regionVba.length; i++) {
        shapes = regionVba[i].metaDataProperty.encodedShapes;
        for (var ix = shapes.length; ix--;) {
          polygon = YMaps.Polygon.fromEncodedPoints(
            shapes[ix].coords,
            shapes[ix].levels
          );
          polygon.setStyle({
            polygonStyle: {
              fillColor: "b00c0c50",
              strokeColor: "b00c0c"
            }
          });
          polygon.setOptions({ hasHint : true });
          polygon.name = "Как убрать внутренние границы?";
          map.addOverlay(polygon);
        }
      }
    } else {
      alert("Error: " + response.error.message)
    }
  });
})

  <title>Несколько регионов.</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

A: Можно попробовать склеить границы регионов в один контур через http://turfjs.org/docs#union
и потом показать финальный полигон на карте

A: Реализовать задачу на самом деле можно, и достаточно просто. К сожалению модуль регионов Яндекс.Карт для этого немного не подойдет, но у него есть почти что drop-in замена - https://github.com/esosedi/regions
Данные по регионам доступны "как сервис", или как отедельный пакет, который можно себе скачать через npm или unpkg - https://github.com/esosedi/osme-geometry
В твоем случае можно или просто федеральный округ попросить (см http://data.esosedi.org), или именно что "склеить" несколько регионово по некому признаку (общий родитель/общая граница) - смотри пример с барселоной в readme регионов.


text:
Q: Invalid read of size 8 I have written a class for a sequence of doubles in c++ using a dynamically allocated array..  When running the program, it completes successfully, but valgrind is finding an error. I receive Invalid read of size 8 when my resize function is called.
  void sequence::resize(size_type new_capacity){
    if (new_capacity == capacity){
      return;
    }else {
      if (new_capacity < used)
          used = new_capacity;
      capacity = new_capacity;
      value_type* new_vals;
      new_vals = new value_type[capacity];
      for (int i=0;i<used;i++){
          new_vals[i] = data[i];
      }
      cout<<endl;
      delete [] data;
      data = new_vals;
    }
  }

Resize is being called by attach:
  void sequence::attach(const value_type& entry){
    //Behaivoir for empty sequence
    if(used == 0){
      current_index = 0;
      used++;
      if (used > capacity)
        resize(capacity*2);
      data[current_index] = entry;
    }
    //Behaivoir for no current_index
    else if (!is_item()){
      current_index = used;
      used++;
      if (used > capacity)
        resize(capacity*2);
      data[current_index] = entry;
    }
    //Default behaivoir
    else {
      used++;
      if (used > capacity)
        resize(capacity*2);
      for(int i = used-1; i>current_index+1;i--)
        data[i] = data[i-1];
      advance();
      data[current_index] = entry;
    }
  }

Here is the error I am receiving in my test program:
==1919== Invalid read of size 8
==1919==    at 0x400DB3: main_savitch_4::sequence::resize(unsigned long) (sequence2.cxx:44)
==1919==    by 0x401091: main_savitch_4::sequence::attach(double const&) (sequence2.cxx:95)
==1919==    by 0x403232: test5() (sequence_exam2.cxx:538)
==1919==    by 0x40414E: run_a_test(int, char const*, int (*)(), int) (sequence_exam2.cxx:744)
==1919==    by 0x404321: main (sequence_exam2.cxx:775)
==1919==  Address 0x5a1ae50 is 0 bytes after a block of size 240 alloc'd
==1919==    at 0x4C2C037: operator new[](unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==1919==    by 0x400C33: main_savitch_4::sequence::sequence(unsigned long) (sequence2.cxx:17)
==1919==    by 0x4030AC: test5() (sequence_exam2.cxx:520)
==1919==    by 0x40414E: run_a_test(int, char const*, int (*)(), int) (sequence_exam2.cxx:744)
==1919==    by 0x404321: main (sequence_exam2.cxx:775)
==1919==

I have tried running valgrind with --leak-check=full and --read-var-info=yes and cannot determine why I am getting this error. Line 45 of resize is the one that reads: new_vals[i] = data[i];
Thanks!!!

A: The issue is that you are setting used to new_capacity without checking it so if it is less than new_capacity it causes a problem.

A: if (used > capacity)
 resize(capacity*2);     //here current index=capacity i.e maxm size allocated to new_vals
  data[current_index] = entry; //current_index > capacity, this is out of reach memory for new vals and data(since data=new_vals), so you are getting invalid read.


text:
Q: load all views at once in an activity
I show an array of image views using a list adapter. I set their IDs in program dynamically. The problem is when I scroll the adapter to right, the images get their IDs only when they come on the screen. When I scroll to left again, the IDs of previous images are reset to  new value. How could I stop such a behavior and set the ID of all images at the start of activity launch?
The working is as shown in the diagram. The old image gets a new id, everytime it is brought into activity screen, which creates problems accessing it via old ID.
My image adapter code:
public View getView(final int position, View convertView,ViewGroup parent)
    {
        final ImageView i = new ImageView(thView.getView().getContext());
        Bitmap bm;
        try {
            bm = thView.getBitmapFromAsset(lis.get(position));
            bm = Bitmap.createScaledBitmap(bm, 100, 100, false);
        } catch (IOException e) {
            e.printStackTrace();
            bm=null;
        }
        i.setImageBitmap(bm);
        final RelativeLayout borderImg = new RelativeLayout(thView.getView().getContext());

        i.setId(x);
        Log.w("ID set as",""+x);
        i.setTag(IMAGEVIEW_TAG);
        x++;
        borderImg.addView(i);
         i.setOnLongClickListener(new OnLongClickListener() {
            public boolean onLongClick(View v) {
                fname = lis.get(position);
                ClipData.Item item = new ClipData.Item((CharSequence) v
                        .getTag());
                dragData = new ClipData(
                        (CharSequence) v.getTag(),
                        new String[] { ClipDescription.MIMETYPE_TEXT_PLAIN },
                        item);

                View.DragShadowBuilder myShadow = new MyDragShadowBuilder(i);
                v.startDrag(dragData, myShadow, null, 0);
                return false;
            }
         });
         myDragEventListener mDragListen = new myDragEventListener();
         i.setOnDragListener(mDragListen);
        return borderImg;
    }
}

A: What is x? If x depends on the position, then why don't you use that instead, since you always have it?
You can't do what you want without really going around what an AdapterView means. Also, if you render all of your image views at the beginning, you might run into out of memory issues.
I guess the real question is what are you trying to accomplish with the ID?


text:
Q: Lat, Long to Point geometry in cartoDB Could any one give me some good flow in diagram of how lat, long information from a csv file is changed into a point in cartoDB. I am assuming it is being done with the help of SQL queries, but still is there any architectural diagram of the data flow in cartoDB?

A: If you have LAT and LON as decimal degrees (WGS84 / EPSG:4326) in your CSV, CartoDB should automatically recognize those values when you upload your table.
If your data is another coordinate system, you might have to project your data to WGS84 first, then export to CSV, THEN upload to CartoDB.

A: As mapBaker says, CartoDB will recognize your coordinates directly only if your columns are named "latitude", "longitude", "lat", "long", "lon"...
Remember that latitude and longitude needs to be included into different columns. If in your information both are together, perhaps this FAQ is useful for you: http://docs.cartodb.com/faqs.html#why-isnt-my-single-latlong-column-appearing-as-georeferenced-data


text:
Q: MacLaurin powerseries and interval of convergence Given the function $f(x) = 5/(6*x^2-x-1)$,
(a) Expand into MacLaurin powerseries the function $f$ up to order $3$.
(b) Find the interval of convergence of it.
(a) I will use the type of $$\frac{1}{0!}f(0) + \frac{1}{1!}f^{(1)}(0)x + \frac{1}{2!}f^{(2)}(0)x^2 + \frac{1}{3!}f^{(3)}(0)x^3 = -5+5x-35x^2+65x^3$$
(b) I will test the $\lim_{n\to \infty} |a_{(n+1)}/a_{n}| = 1$. Now, given the number "1", I don't know how to continue. Can someone give me some tips?
Thank you

A: Hint: Use partial fractions to put $5/(6x^2-x-1)$ in nice form. Note that the denominator factors as $(3x+1)(2x-1)$. So you will be looking for an expression of shape $\frac{A}{2x-1}+\frac{B}{3x+1}$.
Note that for example the expansion of $\frac{1}{1+2x}$ is easy, since $\frac{1}{1-t}=1+t+t^2+\cdots$.
You can then combine the two expansions to get an explicit formula for the coefficient of $x^n$ in the power series expansion of your original function.
You can do a ratio test on these, not too messy.
But there is an easier way. One of the two component series has radius of convergence $1/2$, the other $1/3$. The radius of convergence of the combination is th radius of convergence of the bad one, which is $1/3$,
Remark: Partial fractions are good for other things than integration!


text:
Q: Istio upgrade from HELM to istioctl I'm little confused with the istioctl manifest migrate command for upgrading from 1.4.3 > 1.4.10.
The installation is done with HELM with version 1.4.3 and following method.
helm template --name istio-init install/kubernetes/helm/istio-init --namespace istio-system | kubectl apply -f -
helm template --name istio-init \
    --set kiali.enabled=true \
    ## all specs defined#
    ./install/kubernetes/helm/istio --namespace istio-system \
    --values ./install/kubernetes/helm/istio/values-istio-sds-auth.yaml | kubectl apply -f -

Now, before upgrade to 1.4.10, I have to create the istioctl manifest migrate with following command from 1.4.3 installation directory, right?
./bin/istioctl manifest migrate ./install/kubernetes/helm/istio/values.yaml > istio-migrate.yaml
./bin/istioctl manifest migrate ./install/kubernetes/helm/istio/values-istio-sds-auth.yaml > istio-migrate.yaml

But, this command just returns:
proto: tag has too few fields: "-"

Does this command complete successfully?
if yes, which file should I pass as -f while I'll be in 1.4.10 directory and use the istioctl upgrade command?
if no, how can I correctly generate the manifest file?


text:
Q: How to rank values inside of a function? I have two columns of values and I want to find the correlation of their ranks. Is there a way to do this without first explicitly calculating the ranks in new columns? Something like =CORREL(RANK.AVG(column A), RANK.AVG(column B))? Basically something like the example below, without having to first create the Rank A and Rank B columns.
-------------------------------
|  A  |  B  | Rank A | Rank B |
-------------------------------
| 3.3 | 2.1 |    2   |    2   |
| 1.7 | 1.4 |    1   |    1   |
| 4.1 | 7.2 |    4   |    4   |
| 3.7 | 9.0 |    3   |    5   |
| 5.6 | 4.1 |    5   |    3   |
-------------------------------
=CORREL(Rank A, Rank B) = 0.6

A: Yes, it is possible.

In the screenshot is non-english delimeter (;) used.
=CORREL(RANK.AVG(Table1[Rank A],Table1[Rank A],1),RANK.AVG(Table1[Rank B],Table1[Rank B],1))

In older Excel versions the formula must be confirmed as an array formula (confirmed by CTRL+SHIFT+ENTER).
See Example in Excel Online.


text:
Q: More questions about Verdier duality (and related math) The first set of questions can be found here: Understanding (the wiki page on) Verdier duality
I'm fairly confident that I understand something wrong, so I'll write down here clearly what my set of beliefs is about what is right, and you feel free to shoot down any falsehood:
Let $X$ be our geometric object, be it a topological space, variety, scheme, or what have you. I will do two cases, one Poincare duality, and the other Serre duality.
Serre duality
I will assume $X$ is nice (a variety, projective, smooth,... of dimension $n$). Here I will look at the (abelian) category of coherent $O_X$-modules. In this case the "dualizing module" is $\omega_X[n]$. I take that to mean that $[\mathcal{E},\mathcal{F}]$ is dual to $[\mathcal{F},\mathcal{E}\otimes \omega_X[n]]$.
I also believe $H^k(X,\mathcal{F})\cong [O_X,\mathcal{F}[k]]$. Going from there, the rest is easy: $H^k(X,\mathcal{F})\cong [O_X,\mathcal{F}[k]]\cong [$dual of $\mathcal{F},O_X[k]]$, which is dual to $[O_X[k],\omega_X[n]\otimes$ dual of $\mathcal{F}]\cong [O_X, \omega_X \otimes$ dual of $\mathcal{F}[n-k]] \cong H^{n-k}(X,\omega_X \otimes $ dual of $\mathcal{F})$.
Great! However...
Poincare duality
Again assume $X$ is nice (orientable compact smooth manifold of dimension $n$). Let $K$ be field. Here I will look at the (abelian) category of $K$-vector spaces. Here the "dualizing sheaf" is $K[-n]$. I will continue somewhat similarly to the Serre duality case. I interpret the dualizing sheaf as meaning that $[\mathcal{E},\mathcal{F}]$ is dual to $[\mathcal{F},\mathcal{E}\otimes K[-n]]$ (here $\mathcal{E}$ and $\mathcal{F}$ are $K$-vector spaces).
For whatever reason, I believe that $H_k(X,\mathcal{E})\cong[\mathcal{E}[-k],D_X]$ ($D_X$ is the dualizing sheaf in general. But what does this even mean in general? For example in the Serre duality case, what would $H_k(X,\mathcal{F})$ even mean?). So:
$H_k(X,K) \cong [K[-k],K[-n]] \cong [K,K[k-n]] \cong H^{k-n}(X,K)$. Wait. What? Makes no sense!
If we use the "duality" it still makes no sense:
$[K,K[k-n]] \cong [K[k-n],K[-n]] \cong [K,K[-k]]\cong H^{-k}(X,K)$. What? Huh?
So in conclusion, I desperately want to have a handle on this, but I clearly don't. Hopefully just a nudge in the right direction would lead me to a better understanding of this yoga.

A: I'm not sure if this will answer your question or not, but let $\mathbb{D}$ be the Verdier dualizing sheaf on the locally compact space $X$. If $M$ is a manifold, then $\mathbb{D}[-n]$, where $n$ is the dimension of $M$, is isomorphic in the derived category to the orientation sheaf $\omega$ on $M$ (see, for example, Borel's book on interesection cohomology, I think around section V.7). The Borel-Moore homology of $X$, which is equivalent to the ordinary homology of $X$ if $X$ is compact (otherwise it's the homology theory built from locally-finite chains) is defined to be $H^{BM}_{k}(X)=H^{-k}(X; \mathbb{D})$. If you unwind all that indexing business, it says that, for a compact manifold, $H_k(M)=H^{n-k}(M; \omega)$, which is probably the duality statement you're looking for.
Of course showing that this has anything to do with classical Poincare duality (say via the cap product) is pretty far from obvious. This is part of the content of a paper I currently have in preparation with Jim McClure.


text:
Q: How can a point be deformed to a loop? I understand how we can shrink a circle to a point. Just lower the radius, and the limit to radius $0$ I suppose.
However, how can we deform a point into a loop? The deformation theorem says that two loop contours can be deformed between another if each intermediate contour is a loop. How is a point a loop? And how can I map a singular point to a whole circle? Isn't that not a function?
What I (maybe?) realize is that let's say we have a point $z=0$, which we'd like to deform to $r=1$.
We can write this $z=0$ as the loop given by $\displaystyle z(t)=0e^{2\pi it}$ for $0<t<1$. Then, the deformation function could be $z(s,t)=se^{2\pi it}$. While it makes more sense using this notion, a point doesn't look like a loop because it is a point. Would it be better to think of a point as the limit of a shrinking loop?

A: A point $p$ determines the constant loop, namely which maps every $t\in [0,1]$ to $p$.
Note that this coincides with the formula of circles when we take the limit $r\to 0$, as you wrote, the corresponding loop for $p=0\in\Bbb C$ is given by
$$f(t) =0\cdot e^{2\pi ti}=0$$


text:
Q: Review apps in Bitbucket pipelines? I am researching into a DevOps workflow that we can use to replace our current DevOps implementation. We are using Bitbucket cloud to host our repositories.
While researching I stumbled upon "Review Apps" feature of GitLab CI/CD.
Is it possible to achieve something similar using Bitbucket pipelines?


text:
Q: Is actually sound being played? There are a lot of reasons for sound not work (no speakers, speakers turned off, volume set to zero, software configuration problems, etc)
How can I discover from within my program if sound is working and being heard?

A: The only way to reliably do that is pretty much to ask the user:
play sound;
if (user_hears_sound_dialog)
  sound works;

Edit: Please don't do an unannounced sound test by killing the users ears, potentially blowing his speakers and forcing him to kill the application. It's just not nice, see!

A: Of course only the user can decide if sound is working.
Programmatically, I believe that only with a micro you could trace sounds.

A: On the screen display two buttons.
Put a note below the buttons: "Please click the right button".
At the same time play this sound message: "Please disregard the note text on the screen and click the left button."
Wait for a button to be clicked.


text:
Q: value of content type of drupal visible in sugarcrm what I want : value of content type of drupal visible in sugarcrm.
What I have Done:- I have created a content type and mange their field, for that I use module webform2sugar.
getting problem :- with the help of above module  when I create a field in webform  then data is visible in lead of sugarcrm  and the field of content type is not visible in sugarcrm
also I need the value in account of sugarcrm not in lead.
I have wasted lots of time but not getting any result.

A: webform2sugar is use to capture a lead in sugarcrm. its only capture data only not the field, means if you create a field movie_name in drupal webform, which is not visible in sugarcrm lead edit or detail view.
webform2sugar module is use to capture only lead not for account. for account you use sugar soap and call set_entry function.


text:
Q: python - convert multiple string datetimes format into a specific date format I have this column date with 6 different date strings sizes:
df = pd.DataFrame({'date': {0: '2020-03-21T10:13:08',  1: '2020-03-21T17:43:03',  2: '2020-03-21T13:13:30',  3: '2020-03-21T20:43:02',  4: '3/8/20 5:31',  5: '3/8/20 5:19',  6: '3/22/20 23:45',  7: '3/22/20 23:45',  8: '2/1/2020 11:53',  9: '2/1/2020 10:53',  10: '1/31/2020 15:20',  11: '1/31/2020 10:37',  12: '2020-04-04 23:34:21',  13: '2020-04-04 23:34:21'}},
             index=range(0,14))

I need to convert all those different datetimes strings to date format. The approach I'm using is:

*

*Find the first white space and extract the date

*Change its format given a certain string length (each string length has its specific date format as you can see below in the format argument)

*Do (2) in the respective rows in the dataframe df.
You can see this approach here:
df.loc[df["date"].str.find(" ") == 10, "date"] = pd.to_datetime(df.loc[df["date"].str.find(" ") == 10, "date"].str[0:10])
df.loc[df["date"].str.find(" ") == -1, "date"] = pd.to_datetime(df.loc[df["date"].str.find(" ") == 10, "date"].str[0:10])
df.loc[df["date"].str.find(" ") == 6, "date"] = pd.to_datetime(df.loc[df["date"].str.find(" ") == 6, "date"].str[0:6], format="%m/%d/%y")
df.loc[df["date"].str.find(" ") == 7, "date"] = pd.to_datetime(df.loc[df["date"].str.find(" ") == 7, "date"].str[0:7], format="%m/%d/%y")
df.loc[df["date"].str.find(" ") == 8, "date"] = pd.to_datetime(df.loc[df["date"].str.find(" ") == 8, "date"].str[0:8], format="%m/%d/%Y")
df.loc[df["date"].str.find(" ") == 9, "date"] = pd.to_datetime(df.loc[df["date"].str.find(" ") == 9, "date"].str[0:9], format="%m/%d/%Y")

I'm going perfect until step 3) where I'm trying to find a workaround to make all the format changes in the dataframe, but I can't understand why it doesn't give what it should give. Any suggestions?
By the way, it has to be scalable (I have a lot of rows per format string)

A: For me working converting all values to datetimes and then remove times with Series.dt.floor if output is datetimes or with Series.dt.date if output are python dates:
df['date'] = pd.to_datetime(df['date']).dt.floor('d')
#dates
#df['date'] = pd.to_datetime(df['date']).dt.date
print (df)
         date
0  2020-03-21
1  2020-03-21
2  2020-03-21
3  2020-03-21
4  2020-03-08
5  2020-03-08
6  2020-03-22
7  2020-03-22
8  2020-02-01
9  2020-02-01
10 2020-01-31
11 2020-01-31
12 2020-04-04
13 2020-04-04

Your solution should be simplify - get first 10 letters, then split by possible space and get first values:
df['date'] = pd.to_datetime(df['date'].str[:10].str.split().str[0])

A: import pandas as pd

df = pd.DataFrame({'date': {0: '2020-03-21T10:13:08',  1: '2020-03-21T17:43:03',  2: '2020-03-21T13:13:30',  3: '2020-03-21T20:43:02',  4: '3/8/20 5:31',  5: '3/8/20 5:19',  6: '3/22/20 23:45',  7: '3/22/20 23:45',  8: '2/1/2020 11:53',  9: '2/1/2020 10:53',  10: '1/31/2020 15:20',  11: '1/31/2020 10:37',  12: '2020-04-04 23:34:21',  13: '2020-04-04 23:34:21'}},
             index=range(0,14))
df
    date
0   2020-03-21T10:13:08
1   2020-03-21T17:43:03
2   2020-03-21T13:13:30
3   2020-03-21T20:43:02
4   3/8/20 5:31
5   3/8/20 5:19
6   3/22/20 23:45
7   3/22/20 23:45
8   2/1/2020 11:53
9   2/1/2020 10:53
10  1/31/2020 15:20
11  1/31/2020 10:37
12  2020-04-04 23:34:21
13  2020-04-04 23:34:21

df['date'] = pd.to_datetime(df['date'])
df
    date
0   2020-03-21 10:13:08
1   2020-03-21 17:43:03
2   2020-03-21 13:13:30
3   2020-03-21 20:43:02
4   2020-03-08 05:31:00
5   2020-03-08 05:19:00
6   2020-03-22 23:45:00
7   2020-03-22 23:45:00
8   2020-02-01 11:53:00
9   2020-02-01 10:53:00
10  2020-01-31 15:20:00
11  2020-01-31 10:37:00
12  2020-04-04 23:34:21
13  2020-04-04 23:34:21


text:
Q: nginx uWSGI connection to unix socket failed I'm trying to connect uWSGI Flask application on CentOS 7 with nginx, nginx error log at /var/log/nginx/error.log gives:
2017/10/04 22:35:29 [crit] 24381#0: *54 connect() to unix:/var/www/html/CON29Application1/socket.sock failed
(13: Permission denied) while connecting to upstream, client: 80.44.138.51,
server: 188.226.174.121, request: "GET /favicon.ico HTTP/1.1", upstream: "uwsgi://unix:/var/www/html/CON29Application1/socket.sock:",
host: "188.226.174.121", referrer: "http://188.226.174.121/"

uWSGI error log shows I think that uWSGI running correctly:
WSGI app 0 (mountpoint='') ready in 1 seconds on interpreter 0x1a1ebd0 pid: 26364 (default app)

This is my first deployment on Linux, but read another SO answer here: Nginx can't access a uWSGI unix socket on CentOS 7
This guy answered his own question, and referred to blog post on SE Linux http://axilleas.me/en/blog/2013/selinux-policy-for-nginx-and-gitlab-unix-socket-in-fedora-19/, saying SE Linux was the problem. I don't really understand what is running where on SE Linux, and solution seems to involve altering "AVC" messages in nginx audit.log, I'm getting in over my head!
As the blog post referred, I do get AVC messages mentioning denied write and nginx at /var/log/audit/audit.log:
 type=AVC msg=audit(1507153878.777:559609): avc:  denied  { write } for  pid=24381
comm="nginx" name="socket.sock" dev="vda1" ino=715975
scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:var_t:s0 tclass=sock_file

But being a newbie, is there perhaps something simpler perhaps I did wrong and can fix with chmod permissions or chown? Thanks any ideas.
Socket permissions:
ls -l socket.sock
srwxrwxrwx. 1 will nginx 0 Oct  4 17:02 socket.sock

A: Well, my SELinux settings did make a difference in the end, and changing this has got my web application actually working! I looked at another tutorial: https://www.digitalocean.com/community/tutorials/an-introduction-to-selinux-on-centos-7-part-1-basic-concepts
I must say from a Linux newbie's point of view, I have seen a few other posts mentioning how good Digital Ocean's tutorials are (I certainly don't have any affiliation with them whatsoever..).
For other newbies reading this, SELinux stands for Security Enhanced Linux, and is something included with many distributions of Linux now apparently, including CentOS 7. It's there for added security of some kind. I ran the simplest command they list on this page: getenforce
which output
enforcing
As the Digital Ocean tutorial states, "SELinux should currently be disabled", mine wasn't - no idea why, I hadn't touched anything on SELinux as had no idea what it was until 2 days ago.
Anyway, trying for simplest fix, as their advice did:
vi /etc/sysconfig/selinux

Or actually I think I didnt have permission to do this as my user, had to do it as root:
sudo vi /etc/sysconfig/selinux

There's only actually 2 settings in this file. So reset:
SELINUX=permissive

Then tried reboot as their advice to restart server, so apparently then SE Linux will start logging some security mumbo jumbo stuff, ie I think this means it records security booboos and people hacking into the system rather than stopping them. Reboot then asked me for Cloud something password, which I thought must be my sudo password, it wasn't, then crashed after trying this couple times anyway, so restarted it I think this is reboot yes? And my website now works.
As the other post I mentioned here, I think this means SELinux doing something to stop nginx running when it is set to enforcing. But the other post here seemed bit more complex for a newbie than to just change one setting as I have done here, more potential to create further problems. If I can ever develop this or another app further, i think need to find someone with more Linux experience.


text:
Q: Error: com.microsoft.sqlserver.jdbc.SQLServerException: The index 2 is out of range I have a function to update the user's information as follows:

public void updateAccount(String username, String name, String address, String aboutMe, String
id) {
    String sql = "update Account set username = '?', \n"
            + "                [Full_Name] = '?',\n"
            + "                [Address] = '?',\n"
            + "                [about_me] = '?'\n"
            + "                where id = ?";
    try {
        PreparedStatement ps = connection.prepareStatement(sql);
        ps.setString(1, username);
        ps.setString(2, name);
        ps.setString(3, address);
        ps.setString(4, aboutMe);
        ps.setString(5, id);
        ps.executeUpdate();

    } catch (Exception ex) {
        Logger.getLogger(AccountDao.class.getName()).log(Level.SEVERE, null, ex);
    }
}

and this code is giving me an error like this:

Severe: com.microsoft.sqlserver.jdbc.SQLServerException: The index 2 is out of range.

at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:191)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.setterGetParam(SQLServerPreparedStatement.java:933)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.setValue(SQLServerPreparedStatement.java:948)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.setString(SQLServerPreparedStatement.java:1578)
at dao.AccountDao.updateAccount(AccountDao.java:117)
at controller.UserProfileController.doPost(UserProfileController.java:91)
I don't understand why it gives me the error "The index 2 is out of range" and is there any
way to fix it?

A: Don't enclose ? parameter markers in quotes. These are typed by the appropriate setter:
String sql = "update Account set username = ?, \n"
        + "                [Full_Name] = ?,\n"
        + "                [Address] = ?,\n"
        + "                [about_me] = ?\n"
        + "                where id = ?";


text:
Q: WPF's CollectionView Filter calls constructor of elements in list I have a CollectionView created from an ObservableCollection.  I attached a Filter to the CollectionView, and after the filter fires for each element, my Item's constructor is called once for every element in the ObservableCollection.  Why does filtering re-instantiate my entire collection of items?  Is this a feature that can be turned off?

A: Whenever the CollectionView is re-created (such as by calling the filter function implicitly or explicitly), the datatemplates for the items are re-drawn (re-instantiated).  The CollectionView thus does not create once all gui items and then hide the ones not to be shown, but rather re-draws everything each time the filter is activated...


text:
Q: What does "On-link" mean on the result of "route print" command? I'm using Windows 7. When I type "route print" under command prompt, I get a IPv4 Route Table with several "On-link" values under the Gateway column. For example, like this one:
IPv4 Route Table
===========================================================================
Active Routes:
Network Destination        Netmask          Gateway       Interface  Metric
          0.0.0.0          0.0.0.0      192.168.1.1      192.168.1.5     25
        127.0.0.0        255.0.0.0         On-link         127.0.0.1    306
        127.0.0.1  255.255.255.255         On-link         127.0.0.1    306
  127.255.255.255  255.255.255.255         On-link         127.0.0.1    306
      137.132.0.0      255.255.0.0     172.18.180.1    172.18.180.10     31
    137.132.80.16  255.255.255.255      192.168.1.1      192.168.1.5     26
      169.254.0.0      255.255.0.0         On-link     172.18.180.10    306
  169.254.255.255  255.255.255.255         On-link     172.18.180.10    286
       172.18.0.0      255.254.0.0     172.18.180.1    172.18.180.10     31
     172.18.180.0    255.255.255.0         On-link     172.18.180.10    286
    172.18.180.10  255.255.255.255         On-link     172.18.180.10    286
   172.18.180.255  255.255.255.255         On-link     172.18.180.10    286
      172.25.64.0    255.255.240.0     172.18.180.1    172.18.180.10     31
      192.168.1.0    255.255.255.0         On-link       192.168.1.5    281
      192.168.1.5  255.255.255.255         On-link       192.168.1.5    281
    192.168.1.255  255.255.255.255         On-link       192.168.1.5    281
        224.0.0.0        240.0.0.0         On-link         127.0.0.1    306
        224.0.0.0        240.0.0.0         On-link     172.18.180.10    286
        224.0.0.0        240.0.0.0         On-link       192.168.1.5    281
      255.254.0.0      255.254.0.0     172.18.180.1    172.18.180.10     31
      255.255.0.0      255.255.0.0     172.18.180.1    172.18.180.10     31
    255.255.240.0    255.255.240.0     172.18.180.1    172.18.180.10     31
    255.255.254.0    255.255.254.0     172.18.180.1    172.18.180.10     31
  255.255.255.255  255.255.255.255         On-link         127.0.0.1    306
  255.255.255.255  255.255.255.255         On-link     172.18.180.10    286
  255.255.255.255  255.255.255.255         On-link       192.168.1.5    281
  255.255.255.255  255.255.255.255      192.168.1.1      192.168.1.5     26
===========================================================================

So what does "On-link" mean?

A: They are addresses that can be resolved locally. They don't need a gateway because they don't need to be routed.

A: on-link is a vista thing and it means there is a direct connection meaning "directly reachable". In general, such record will be generated after establishing a dial-up connection.

A: Yep, the other three answers are correct: it's just a route that's directly reachable (the NIC is in direct contact with it; on the same subnet).  To explain a little further though: by contrast, the routes that have a gateway IP listed must be contacted through that gateway.
So, in the table you gave above, 192.168.1.255 is contacted by simply putting a packet on the network from 192.168.1.5, marked as going to 192.168.1.255.  The destination machine would see the packet, and take it off the network directly.
But to reach 137.132.0.0, the packet would be sent out from 172.18.180.10, to the gateway 172.18.180.1, where the gateway would see that it's to be forwarded on to where it's going.
Note that I haven't bothered looking at the whole routing table to make sure there are no more specific routes overriding these, as it's a little beside the point for this issue.

A: Wild guess: Unrouted subnets that are handled locally.


text:
Q: Screen resolution keeps on getting reset back to default I'm trying to learn Monogame right now by making some clones of some simple older games.  I tried to set the screen resolution via the method described here:
How do I set the window / screen size in xna?
At first, a call to Console.WriteLine() reports that the resolution was changed successfully, but when I then run the program, I get the default 800x480.  I added another call to Console.WriteLine() in the update() method to see what the resolution was, and it was reporting the 800x480.
What can I do to fix this?  Do I need to set the resolution everytime in the update() method?

A: Put initial resolution in your game constructor. Becuase if you put in Initalize, system first change resolution to default and then to your. With this code below system will change resolution only once. Don't have code now, but it should go like this:
public Game1()
{
     graphics = new GraphicsDeviceManager(this);
     graphics.PreferredBackBufferHeight = 600;
     graphics.PreferredBackBufferWidth = 800;
     // graphics.ApplyChanges(); <-- not needed
}

and then if you wish to change later, put in update funciton.
protected override void Update(GameTime gameTime)
{
    if(changeresolution){
         graphics.PreferredBackBufferHeight = 1600;
         graphics.PreferredBackBufferWidth = 1800;
         graphics.ApplyChanges();
         changeresolution = false;
    }
}


text:
Q: How Uvicorn workers works, and how many do I need for a slim machine? The application I deploy is FastAPI with Uvicorn under K8s.
While trying to understand how I want to Dockerize the application I understood I want to implement Uvicorn without Gunicorn and to add a system of scale up/down by the load of the requests the application is getting.
I did a lot of load testing and discovered that with the default of 1 Uvicorn worker I'm getting 3.5 RPS, while changing the workers to 8 I can get easly 22 RPS (didn't check for more since its great results for me).
Now what I was expecting regarding the resources is that the CPU that I will have to provide will be with a limit of 8 (I assume every worker works on one process and thread), but I saw only increase in the memory usage, but barley in the CPU. maybe its because the app don't use that much CPU but indeed its possible for it to use more than 1 CPU? so far it didn't used more than one CPU.
How are the Uvicorn workers works? how should I calculate the workers number I need for the app? I didn't find useful information.
Again, my goal is to keep a slim machine of 1 cpu, with Autoscaling system.


text:
Q: Best way to design for localization of strings This is kinda a general question, open for opinions. I've been trying to come up with a good way to design for localization of string resources for a Windows MFC application and related utilities. My wishlist is:

*

*Must preserve string literals in code (as opposed to replacing with macro #define resource ID's), so that the messages are still readable inline

*Must allow localized string resources (duh)

*Must not impose additional run-time environment restrictions (eg: dependency on .NET, etc.)

*Should have minimal obtrusion into existing code (the less modification the better)

*Should be debuggable

*Should generate resource files which are editable by common tools (ie: common format)

*Should not use copy/paste comment blocks to preserve literal strings in code, or anything else which creates the potential for de-synchronization

*Would be nice to allow static (compile-time) checking that every "notated" string is in the resource file(s)

*Would be nice to allow cross-language resource string pooling (for components in various languages, eg: native C++ and .NET)

I have a way which fulfills all my wishlist to some extent except for static checking, but I have had to develop a bit of custom code to achieve it (and it has limitations). I'm wondering if anyone has solved this problem in a particularly good way.
Edit:
The solution I currently have looks like this:
ShowMessage( RESTRING( _T("Some string") ) );
ShowMessage( RESTRING( _T("Some string with variable %1"), sNonTranslatedStringVariable ) );

I then have a custom utility to parse out the strings from within the 'RESTRING' blocks and put them into a .resx file for localization, and a separate C# COM object to load them from localized resource files with fallback. If the C# object is not available (or cannot load), I fallback to the string in the code. The macro expands to a template class which calls the COM object and does the formatting, etc.
Anyway, I thought it would be useful to add what I have now for reference.

A: We use the English string as the ID.
If it fails the look up from the international resource object (loaded from the I18N dll installed) then we default to the ID string.
Code looks like:
doAction(I18N.get("Press OK to continue"));

As part of the build processes we have a perl script that parses all source for string constants. It builds a temp file of all strings in the application and then compares these against the resource strings in each local to see if they exists. Any missing strings generates an e-mail to the appropriate translation team.
We can have multiple dll for each local. The name of the dll is based on RFC 3066
language[_territory][.codeset][@modifier]
We try and extract the locale from the machine and be as specific as possible when loading the I18N dll but fallback to less specific local variations if the more specific version is not present.
Example:
In the UK: If the local was en_GB.UTF-8
(I use the term dll loosely not in the specific windows sense).
First look for the I18N.en_GB.UTF-8 dll. If this dll does not exist fall back to I18N.en_GB. If this dll does not exist fall back to I18N.en If this dll does not exist fall beck to I18N.default
The only exception to this rule is:
Simplified Chinese (zh_CN) where the fallback is US English (en_US). If the machine does not support simplified Chinese then it is unlikely to support full Chinese.

A: The simple way is to only use string IDs in your code - no literal strings.
You can then produce different versions of the.rc file for each language and either create resource only DLLs or simply different language builds.
There are a couple of shareware utilstohelp localising the rc file which handle resizing dialog elements for languages with longer words and warnign about missing translations.
A more complicated problem is word order, if you have several numbers in a printf which must be in a different order for different language's grammar.
There are some extended printf classes on codeproject that let you specify things like printf("word %1s and %2s",var1,var2) so you can switch %1s and %2s if necessary.

A: I don't know much about how this is normally done on Windows, but the way localized strings are handled in Apple's Cocoa framework works pretty well. They have a very basic text-format file that you can send to a translator, and some preprocessor macros to retrieve the values from the files.
In your code, you'll see the strings in your native language, rather than as opaque IDs.

A: Since it is open for opinions, here is how I do it.
My localized text file is a simple tab delimited text file that can be loaded in Excel and edited.
The first column is for the define and each column to the right is a subsequent language, for example:
ID              ENGLISH      FRENCH    GERMAN
STRING_YES      YES          OUI       YA
STRING_NO       NO           NON       NEIN

Then in my makefile is a cusom build step that generates a strings.h file and a strings.dat. In my case it builds an enum list for the string ids and then a binary file with offsets for the text. Since in my app the user can change the language at any time i have them all in memory but you could easily have your pre-processer generate a different output file for each language if necessary.
The thing that I like about this design is that if any strings are missing then I would get a compile error whereas if strings were looked up at runtime then you might not know about a missing string in a seldom used part of the code until later.

A: Your solution is quite similar to the Unix/Linux "gettext" solution. In fact, you would not need to write the extraction routines.
I'm not sure why you want the _RESTRING macro to handle multiple arguments. My code (using wxWidgets' support for gettext) looks like this: MyString.Format(_("Some string with variable %ls"), _("variable"));. That is to say, String::Format(...) gets two individually translated arguments. In hindsight, Boost::Format would have been better, but it too would allow boost::format(_("Some string with variable %1")) % _("variable");
(We use the _() macro for brevity)

A: On one project I had localized into 10+ languages, I put everything that was to be localized into a single resource-only dll.  At install time, the user selected which dll got installed with their application.
I only had to deliver the English dll to the localization team.  They returned a localized dll to me for each language which I included in the build.
I know it's not perfect, but it worked.

A: You want an advanced utility that I've always wanted to write but never had the time to.
If you don't find such a tool, you may want to fallback on my CMsg() and CFMsg() wrapper classes that allow to very easily pull strings from the resource table. (CFMsg even provide a FormatMessage one-liner wrapper.
And yes, in the absence of that tool you're looking for, keeping a copy of the string in comment is a good solution. Regarding desynchronisation of the comment, remember that string literals are very rarely changed.
http://www.codeproject.com/KB/string/stringtable.aspx
BTW, native Win32 programs and .NET programs have a totally different resource storage management. You'll have a hard time finding a common solution for both.


text:
Q: R mediation package output: independent variable effect on mediators I'm a phd student struggling with mediation package.
Is there anyway I can get direct effect of independent variable on all mediators and that of mediators on dependent variable with this package?
ACME and ADE are awesome but I need those direct effects as well.
Thank you!!


text:
Q: Get custom attribute in CatalogInventory module So far I have created custom attribute my_custom_attribute and I want to pass this attribute inside Magento/CatalogInventory/Model/StockStateProvider.php and call it like $stockItem->getIsInStock() but I want to get it like $stockItem-getMyAttribute(). Can someone explain me how to do it? Can't really understand how to set this data to get my attribute there
Thank you a lot!

A: To get your custom attribute value in Magento/CatalogInventory/Model/StockStateProvider.php model file you just need to do following steps.

*

*Override Model file in custom module Mee/CustomModule/Model/StockStateProvider.php as mentioned in below link https://magenticians.com/override-model-magento-2/

*Include your function in the above overdid model file as
protected function getMyAttribute()
{
    $product = $this->productFactory->create();
    return $product->getMyAttribute();
}

*Run magento upgrade and deployment commands from your root directory.
now you can call $stockItem-getMyAttribute() in your file


text:
Q: Cardinality of the set of $C^1$ functions with these properties
Let $\mathcal{C}^1(\mathbb{R})$ denote the set of all continuously differentiable real valued functions defined on the real line. Define
  $$A=\{f\in\mathcal{C}^1(\mathbb{R})\mid f(0)=0,\,f(1)=1,\,|f'(x)|\leq 1/2\,\text{ for all }\,x\in\mathbb{R}\}$$
  where $f'$ denotes the derivative of the function $f$. Pick out the true statement:
(a) $A$ is an empty set.
  (b) $A$ is a finite and non-empty set.
  (c) $A$ is an infinite set.

(original image)
I don't know which result from analysis I should apply here, please give me some hints or remark

A: By the mean value theorem, if $f(0)=0$ and $f(1)=1$, then there exists $c\in(0,1)$ such that
$$
f'(c)=\frac{f(1)-f(0)}{1-0}=1,
$$
which is impossible if $|f'(x)|\leq \frac{1}{2}$ for all $x\in\mathbb{R}$.  So the set is empty.


text:
Q: Delphi: how to automatically create property from private field? I already know how to use inline templates (prop/propf + CTRL-J) to declare properties that automatically create their private field and their getters/setters, but how do I do the opposite?
I have 166 private fields already declared. Is there a way to have the Delphi IDE automatically create properties for each one of them?
This is what I have:
TMyObject = class(TPersistent)
private
  FFirstProp: boolean;
  FSecondProp: boolean;
  // 164 more of them...

This is what I would like to (ideally) have the IDE create for me:
published
  property FirstProp: boolean read FFirstProp write FFirstProp;
  property SecondProp: boolean read FSecondProp write FSecondProp;
  // and the other 164...


text:
Q: How do you get possible candidates for primitive roots of 12?
Candidates for primitive roots are 1, 5, 7 and 11. $\phi(12)=\phi(2^2)\phi(3)=4$.
  $ord_{12}1 =1, ord_{12}5 =2, ord_{12}7 =2, ord_{12}11 =2$. None of these has  $\phi(12)=4$, thus number 12 has not primitive root.

My question still remains: How do you get possible candidates for primitive roots? What about when trying to find primitive roots of some prime, how you get then possible candidates for primitive roots?

A: There are primitive roots modulo $m$ iff $m$ is $1, 2, 4$, a power of an odd prime or twice a power of an odd prime. Once you find a primitive root modulo a prime $p$, it is easy to find a primitive root modulo all powers of $p$. So the real problem is the case $m$ prime.
There is no general method for finding a primitive root. See
http://en.wikipedia.org/wiki/Primitive_root_modulo_n#Finding_primitive_roots. However, once you find one, call it $g$, then all other ones are $g^k$ with $k$ coprime with $p-1$.
The least primitive root is generally small. See http://en.wikipedia.org/wiki/Primitive_root_modulo_n#Order_of_magnitude_of_primitive_roots

A: A primitive root exists, i.e. $\rm\:(\mathbb Z/n\mathbb Z)^*\:$ is cyclic, iff $\rm\:n = 2, 4, p^k, 2\:p^k\:$ for an odd prime $\rm\:p\:.\:$ Generally there is no better way to find a primitive root other than brute force: e.g. sequentially test small candidates, verifying that they have the desired order. This usually succeeds quite quickly since e.g. by GRH the least primitive root mod $\rm\:p\:$ is $\rm\:O(\log^6\:p)\:.\:$ See the Wikipedia page for more. It's always a good idea to check there first before posing questions.
There are also very interesting conjectures about primitive roots such as Artin's conjecture. To learn about this and related topics I highly recommend reading Daniel Shanks: Solved and Unsolved Problems in Number Theory, 4ed, 1993, where you will find many expositions on how to make conjectures in number theory. It is essential reading for a budding experimental number theorist. Be sure to get the final $4$th edition (1993), which has much added content, esp. on making and judging conjectures.
More generally you may find of interest Andrew Sutherland's 2007 MIT Thesis Order Computations in Generic Groups.


text:
Q: How to pause JavaScript execution in Internet Explorer? I have the following scenario:

*

*Main page

*Nested page

*Common JS file (which is included in both pages)

The nested page is subsequently loaded into an iframe of the main page. Both pages invoke a function from the common JS file on page load.
Live demo:
http://www.ecmazing.com/misc/pause-execution/mainpage.html
http://www.ecmazing.com/misc/pause-execution/nestedpage.html
http://www.ecmazing.com/misc/pause-execution/common.js
The common JS file contains one global function which paints the H1 element red. I would like to pause execution at the beginning of that function, so that the execution is paused while the H1 element is still black.
How to do it on the main page:
This is trivial. Simply load the page, open the dev tools of the browser, select the common.js file, and set a break-point at the first line of the function. Now, reload the page. The break-point will persist the reload, and execution will be paused.
How to do it on the nested page:
Now, in Chrome and Firefox (Firebug), the break-point that was set above (for the main page), will also work for the nested page. Both pages use the same JS file, and setting a break point in that file will apply for both pages automatically. Unfortunately, this rule does not apply to IE.
And even worse, even if I set the break point subsequently, and then reload the iframe only, the break-point will not persist.
So, I don't know how to pause execution for the nested page in IE. Can it be done? (I'm dealing with this by manually setting a debugger; at the beginning of the function, but I would love to be able to set the break-point via the dev tools in IE, if that's possible.)

A: The closest I can come to a solution is to set a breakpoint within the loadIFrame() function on the main page and then 'step in' until the nested page's Common.js file is loaded.  In a more complicated example you would then be able to set your breakpoints within the new Common.js file and they would work correctly until the next time the iframe is loaded, when they would all be lost again.

A: I don't have IE9 to test, but perhaps you can treat common.js file as a separate asset for the iframe page? I believe that's why it works in other browsers since those files must be tagged or labeled by the browser some how.
An example is to append ?iframePage to the end of common.js on the iframe page. At least in Firefox is shows an asset loaded as common.js?iframePage. Everything past the query string is ignored by the browser but otherwise the JavaScript is loaded with that exact name.
Another example is to make a copy of common.js and renamed it to commonClone.js which is then used for the iframe page.
Either example might allow you to set the break-point twice in IE9, one for each asset.
That said, there's nothing stopping you from creating iframe only breakpoints that are independent of common.js file that the parent page is using.. This method, let's call it parallel break-point, allows for asynchronous debugging of JavaScript since the iframe page and the parent page are processing JavaScript independently yet may be working in tandem.
Reference for this method is from official source MSDN Library: Using the F12 Developer Tools to Debug JavaScript Errors section Managing Breakpoints that shows how to perform breakpoints on multiple JavaScript files.
According to a recent forum post at the IE9 Developers Forum, the solution to prevent reloading of JavaScript files when used for debugging is to use the inline event handler instead of attachEvent as shown in this example:
replace (or comment it out)

$(document).onload(function(){ mycustomonload functions});

with

<body onload="mycustomonload functions">

A: If you are doing this solely for compatibility testing then have you tried using IETab plugin for Chrome?
This emulates IE's rendering engine while allowing you to use the Chrome debugger.
If this isn't good enough then I think you've hit an impasse, IE dev tools just aren't sophisticated enough.

A: Perhaps, if you could restructure your Html and JavaScript code, you could only reference common.js from the parent page and make both the main and the nested page use the same JavaScript function.
That way one break point would satisfy both scenarios.

A: To debug iframes in IE, and be able to set and retain breakpoints, you could open the iframe address in its own ie tab/window. This is not possible/straightforward however if the iframe communicates with its parent.

A: I hope you at least are using IE Debuggy Bar. Update your common.js file with this code
function func () {
    if(typeof window.parent.debug !== "undefined"){
        window.parent.debug();
    }
    document.getElementsByTagName( 'h1')[0].style.color = 'red';
}

function debug(){
    var a = "break here";
}

set break point to var a = "break here"; after your main page loads. When you hit Load Iframe button js will stop on that line. Use call stack to navigate to previous javascript instruction (line) which should be in common.js file in nestedpage.html. Now set another break point where ever you'd like and hit continue in debugger, or use STEP feature
== UPDATE ===
BTW, to answer your question, why break point cannot be persisted in iframe, think this way. Each time you click on "Load IFrame" button, old instance of window object is disposed in memory and with it all break points and new is created with new common.js instance. Same would happen if you would call windows.open("http://......");
Also keep in mind even you have same file loaded in both window(s), it is loaded in two different execution frames in browser. you can run two browser instances of same browser but they are not showing same page in window. Tho, there are things which are shared, like cookies but that is out of scope of this topic.

A: you can use setTimeout() for pause javascript for perticular time...


text:
Q: Converting a date 'year - month - date' to only 'year and month' in r with SQL data I'm working on a problem where I need to merge two datasets. The first dataset is from SQL and imported using the RODBC library, while the second dataset is imported from Excel. I want to merge the two dataframes by month and year, however in order to do that, I need to convert the first DF's date column into year-month, from year-month-date.
I have tried to use as.Date(df$postingdate, format = '%Y %M' or strftime(df$postingdate,"%Y %m")  as I normally would do, however the first doesn't work and the second changes the column to character. It has been a problem for days, and I have tried a number of things, mainly suggestions from the following link: [https://stackoverflow.com/questions/6242955/converting-year-and-month-yyyy-mm-format-to-a-date][1]
In the bottom I have created a df from output I get when using `dput()´ (df2) and I noticed that under posting date, the data is converted to a number, rather than the actual date ("2020-05-28", "2020-10-09", "2021-10-19"). Therefor I'm also unsure whatever I have problem because I use the wrong functions, or because the data is of a "unknown" data type.
A sample of the first dataset where I want to transform date into year – month:
df <- data.frame(
  Posting_Date = c("2020-05-28", "2020-10-09", "2021-10-19"), Sales = c(2702.5, 369, 4134),
  Sales_person_code = c(6L, 10L, 10L), EDI = c(1L, 1L, 1L),
  City = c(141L, 4L, 6L), Kæde = c(12L, 12L, 12L),
  Vinter = c(0, 0, 0), Forår = c(1, 0, 0), Sommer = c(0, 0, 0),
  Efterår = c(0, 1, 1), Fredag = c(0, 1, 0), Lørdag = c(0, 0, 0),
  Mandag = c(0, 0, 0), Onsdag = c(0, 0, 0), Søndag = c(0, 0, 0),
  Tirsdag = c(0, 0, 1), Torsdag = c(1, 0, 0),
  year_month = c("2020-05-28", "2020-10-09", "2021-10-19"))

df2 <- data.frame(
  Posting_Date = c(18410, 18544, 18919), Sales = c(2702.5, 369, 4134),
  Sales_person_code = c(6L, 10L, 10L),EDI = c(1L, 1L, 1L),
  City = c(141L, 4L, 6L), Kæde = c(12L, 12L, 12L),
  Vinter = c(0, 0, 0), Forår = c(1, 0, 0), Sommer = c(0, 0, 0),
  Efterår = c(0, 1, 1), Fredag = c(0, 1, 0), Lørdag = c(0, 0, 0),
  Mandag = c(0, 0, 0), Onsdag = c(0, 0, 0), Søndag = c(0, 0, 0),
  Tirsdag = c(0, 0, 1), Torsdag = c(1, 0, 0),
  year_month = c(18410, 18544, 18919))

Thanks in advance for any help. Plz let me know if i can do anything to help you guys, helping me

A: Up front, your attempt of as.Date(df$Posting_Date, format="%Y %m") seems backwards: the function as.Date is for converting from a string to a Date-class, and its format= argument is to identify how to find the year/month/day components of the string, not how you want to convert it later. (Note that in R, a Date is shown as YYYY-MM-DD. Always. Telling R you want a date to be just year/month is saying that you want to convert it to a string, no longer date-like or number-like. lubridate and perhaps other packages allow you to have similar-to-Date like objects.)
For df, one can just subset the strings without parsing to Date-class:
substring(df$Posting_Date, 1, 7)
# [1] "2020-05" "2020-10" "2021-10"

If you want to do anything number-like to them, you can convert to Date-class first, and then use format(.) to convert to a string with a specific format.
as.Date(df$Posting_Date)
# [1] "2020-05-28" "2020-10-09" "2021-10-19"
format(as.Date(df$Posting_Date), format = "%Y-%m")
# [1] "2020-05" "2020-10" "2021-10"

For df2, though, since it is numeric you need to specify an origin= instead of a format=. I'm inferring that these are based off of epoch, so
as.Date(df2$Posting_Date, origin = "1970-01-01")
# [1] "2020-05-28" "2020-10-09" "2021-10-19"
format(as.Date(df2$Posting_Date, origin = "1970-01-01"), format = "%Y-%m")
# [1] "2020-05" "2020-10" "2021-10"

Note that R stores Date (and POSIXct, incidentally) as numbers internally:
dput(as.Date(df2$Posting_Date, origin = "1970-01-01"))
# structure(c(18410, 18544, 18919), class = "Date")


text:
Q: How to EMBED external jar and FOLDERS into one executable jar file using NetBeans IDE I have a netbean project with standard folder structure. Project Dependencies are guava.jar, a folder with plain text file, and a folder with nested folders, each having images, totaling to over 20K images and a size of 500MB. Standard build process yields myjar.jar which works perfectly outside the ide if it is run in the same folders as my dependencies. Folder tree is something like
root/
  image/
     folder1/
             image1.png
             image2.png
       folder2/
      ...
      ...
   txtfolder/
      file.txt
   lib/
      guava.jar
   myJar.jar

Deploying above file structure works perfectly, but the requirement is to deploy the above file structure as ONE executable jar file, say myJarAll.jar (naturally, with a size of nearly 600MB).
I have already tried adding jar files and folders to netbean project as dependencies and then doing a clean build but it doesn't generate a myJarAll.jar. Ideal situation would be to have zero changes to the source code and heck up the ant file to make it generate a combined jar.
One solution that I have experimented with is to create external jar files from images and text folders and add them up as dependencies to a project. Problem with this approach is that it expects considerable changes to the original source code.
Any help, suggestion or tools that can solve this problem.
Thanks

A: Easiest would be to have a myJar.jar with a META-INF/MANIFEST.MF listing the library jars in lib. In the lib folder besides guava.jar you can create a myResources.jar stemming from a second project. Or add those files to myJar.jar. (The NetBeans IDE already maintains the manifest.)
Unavoidable is loading the files as read-only java resources on the class path, under the src directory (see the Files tab in NetBeans). So the question is whether you are already using getClass().getResourceAsStream("/txtfolder/file.txt").


text:
Q: What are the main tables that updated when we creating new product in magento? I need to know SQL Table Structure for adding new product.I don't want to any sql queries only want to know effecting tables names.

A: *

*catalog_product_entity - this one is the main product table. It contains the id, sku, attribute set and a few other details

*catalog_product_entity_int|varchar|text|datetime|decimal - these tables contain attribute values. Each attribute has a type and based on that type the value is inserted in the right table.

*catalog_product_website - this table contains the association of products on websites (product id, website id). If you don't add the products to at least a website nothing will be inserted here.

*catalog_category_product - this table contains the association between products and categories (product id, category id). if you don't assign products to categories nothing will be inserted here

*catalog_category_product_index - this tables also holds the association between products and categories but it is populated after reindexing.

*catalog_product_entity_gallery, catalog_product_entity_media_gallery, catalog_product_entity_media_gallery_value - these hold references to images assigned to products

*catalog_product_link this holds the links between products: cross-sells, up-sells, related products, child products of configurable & grouped products

*catalog_product_link_attribute, catalog_product_link_attribute_decimal|int|varchar, hold the positions and other attribute values that might be related to the links above for the related products up-sells and cross-sells

*catalog_product_entity_tier_price contains the tier prices for the products

*catalog_product_option holds the product custom options

*catalog_product_option_price holds the custom options prices

*catalog_product_option_title holds the custom options titles

*catalog_product_option_type_value holds the custom options type values

*catalog_product_option_type_price holds the custom options price types

*catalog_product_relation holds a kind of redundant parent-child relation for configurable products

*catalog_product_index_* hold values for product attributes after reindexing

*catalog_product_bundle_* hold relations and options for bundle products

*donwloadable_* - hold data related to downloadable products

That's all I got. I hope I didn't miss anything.


text:
Q: MapView V2 in a ScrollView draws itself over the ActionBar So, all bad things in the title aside, I've got a MapView (and a few other Views) inside of a ScrollView (I know, and I've advised a thousand times against putting a MapView in a scrolling container but this is what the client wants) and when I scroll the ScrollView up the MapView ends up drawing over the ActionBar. I set the zOrderOnTop to true on the GoogleMapOptions that I pass to the constructor of MapView which prevents this from happening when I first add the MapView to the view hierarchy, but when I navigate away and come back to the app the map is drawn over the ActionBar again.
I have to artificially call the MapView lifecycle events when the MapView is created and placed into the ScrollView because I make a network call, and depending on the data I may or may not need to add a map.
I've been searching on Google and SO for ways to mitigate this and I've come up with nothing. The phones I'm testing on are Android 4.1+ so it should be using the TextureView implementation and not the SurfaceView implementation of MapView.


text:
Q: Missing function value after call I am working on a project for a class. The code calculates shipping charges based on data read in from a file. The issue I am having is in the calculation. The value passed from the volume function remains zero. I don't think I am passing it correctly. Also, need to not use globals - especially with the calculate function - use parameters was the last feedback I got from my prof.
Here is the code:
#include <iostream>
#include <iomanip>
#include <cmath>
#include <fstream>

using namespace std;

void header(int lab_number, char lab_part)
{
    cout << "Kevin Schultz\n";
    cout << "Lab" << lab_number << lab_part << endl << endl;
}

double length, width, height, x, weight, total = 0, shipping_cost, volume;

int main ()
{
    double calculate(double length, double width, double height);
    double volume;
    double chargeAmount;
    double charge(ifstream & inFile, ofstream & prt);

    ifstream inFile;
    ofstream prt("lab7new_out.txt");

    header(7, 'A');
    prt << "        S & S Global Services\n";
    prt << "    Shipping Cost Analysis Report\n\n";
    prt << "Length Width Height Weight Shipping\n";
    prt << "                             Cost\n\n";

    inFile.open("c:\\lab7\\pkg.txt");
        if (!inFile)
        cout << "Error opening the file\n";

    inFile >> length;
    inFile >> width;
    inFile >> height;
    inFile >> weight;

    volume = calculate(length, width, height);
    chargeAmount = charge(inFile, prt);

    prt << "------------------------------------" << endl;
    prt << "\nTotal cost: $" << total;

    system("pause");
    return 0;

}

double calculate(double length, double width, double height)
        {
            double volume;
            volume = length * width * height;
            return volume;
        }

double charge(ifstream & inFile, ofstream & prt)
        {
            const double basic_charge = 12;
            const double Vsurcharge = 5;
            const double Dsurcharge = 4;
            const double Wsurcharge = 2;
            double netWeight = 0;

            while (!inFile.eof())
            {
                shipping_cost = basic_charge;

                if (volume > 7)
                    shipping_cost += Vsurcharge;
                if (length > 3 || width > 3 || height > 3)
                    shipping_cost += Dsurcharge;
                if (weight > 50)
                {
                    netWeight = weight - 50;
                    shipping_cost += netWeight * Wsurcharge;
                }
                total += shipping_cost;
                prt << setw(4) << right << setprecision(1) << length << setw(6) << right << setprecision(1) << width << setw(6) << right << setprecision(1) << height << setw(8) << right;
                prt << weight << setw(5) << right << setprecision(2) << fixed << "$" << shipping_cost << endl;

                inFile >> length;
                inFile >> width;
                inFile >> height;
                inFile >> weight;
            }
             return total;
        }

Any assistance would be great!

A: As your professor said, please don't use global variables. In your code you have different variables volume and I doubt that you know when you are accessing which of the variables. Let's do a walk through your code:
 double volume;    // global variable, never written, read in function charge

 int main() {
    ...
    double volume; // local variable, only visible in function main, but never used
    ...
 }

 double calculate(double length, double width, double height) {
    double volume; // local variable, only visible in calculate
    volume = ...;
    return volume;
 }

 double charge(ifstream & inFile, ofstream & prt) {
    ...
    if(volume > 7) // no local variable volume defined, so using global variable volume
    ...
 }

Also, you declare a function calculate, but you never call it.
Please consider enabling as much compiler warnings as possible. It will help you find the bugs.

A: try something like this. The problemn is that you need to declare your function prototype before calling it, but if you put your main function to the bottom of your .c file you don't need to decalre the prototype function, hope it's clear
#include <iostream>
#include <iomanip>
#include <cmath>
#include <fstream>

using namespace std;

void header(int lab_number, char lab_part)
{
    cout << "Kevin Schultz\n";
    cout << "Lab" << lab_number << lab_part << endl << endl;
}

double length, width, height, x, weight, total = 0, shipping_cost, volume;

double calculate(double length, double width, double height)
{
    double volume;
    volume = length * width * height;
    return volume;
}

double charge(ifstream & inFile, ofstream & prt)
{
            const double basic_charge = 12;
            const double Vsurcharge = 5;
            const double Dsurcharge = 4;
            const double Wsurcharge = 2;
            double netWeight = 0;

            while (!inFile.eof())
            {
                shipping_cost = basic_charge;

                if (volume > 7)
                    shipping_cost += Vsurcharge;
                if (length > 3 || width > 3 || height > 3)
                    shipping_cost += Dsurcharge;
                if (weight > 50)
                {
                    netWeight = weight - 50;
                    shipping_cost += netWeight * Wsurcharge;
                }
                total += shipping_cost;
                prt << setw(4) << right << setprecision(1) << length << setw(6) << right << setprecision(1) << width << setw(6) << right << setprecision(1) << height << setw(8) << right;
                prt << weight << setw(5) << right << setprecision(2) << fixed << "$" << shipping_cost << endl;

                inFile >> length;
                inFile >> width;
                inFile >> height;
                inFile >> weight;
            }
     return total;
}

int main ()
{

    double volume = calculate(length, width, height);
    double chargeAmount;

    ifstream inFile;
    ofstream prt("lab7new_out.txt");

    header(7, 'A');
    prt << "        S & S Global Services\n";
    prt << "    Shipping Cost Analysis Report\n\n";
    prt << "Length Width Height Weight Shipping\n";
    prt << "                             Cost\n\n";

    inFile.open("c:\\lab7\\pkg.txt");
        if (!inFile)
        cout << "Error opening the file\n";

    inFile >> length;
    inFile >> width;
    inFile >> height;
    inFile >> weight;

    chargeAmount = charge(inFile, prt);

    prt << "------------------------------------" << endl;
    prt << "\nTotal cost: $" << total;

    system("pause");
    return 0;

}


text:
Q: useForm hidden nested file input not working I have a form with a custom file input.  I am using react-hook-form.  In the past I have been able to hide the default <input type="file"/> and add my own custom button, targeting the input with ref.current.click and triggering the onChange event from there.
However, while experimenting with react-hook-form it does not seem as straight forward.  I am under the impression that I have to use Controller component from useForm but I can't seem to get it to work.
Currently, when I click my Add Image button, it does not prompt me to choose a file.
const ImageInput = () => {
  const [selectedImage, setSelectedImage] = useState();

  const pickImageHandler = async () => {
    //I dont know what to ref here??
    ref.current.click();
  };

  const imageChange = (e) => {
    console.log("imageChange onChange triggered");
    if (e.target.files && e.target.files.length > 0) {
      setSelectedImage(e.target.files[0]);
    }
  };

  <>
    <Controller
      control={control}
      render={({ field }) => (
        <input
          control={control}
          type="file"
          accept=".jpg,.png,.jpeg"
          style={{ display: "none" }}
          onChange={imageChange}
          {...field}
        />
      )}
    />
    <Button
      type="button"
      variant="contained"
      className={classes.pickImageButton}
      onClick={pickImageHandler}
    >
      Add Image
    </Button>
  </>;
};

 const PostForm = (props) => {
    const submitFunction= async (data) => {
      //handle submitForm with formData
    }
    <form onSubmit={submitFunction}>
      <FormProvider {...methods}>
        <ImageInput {...register("cardImage")} name="cardImage" />
      </FormProvider>
      <Button type="submit" className={classes.postButton}>
        Post
      </Button>
    <form/>;
 };

A: You're having multiple errors in your code, I've fixed it all and the code below. Because register() returns a set a props including the input ref callback, you need to create a wrapper ref callback to initialize both RHF ref and your own ref too:
const { ref, ...fields } = register('cardImage');
const inputRef = React.useRef(); // your ref to call click() imperatively

const ImageInput = () => {
  const { register } = useFormContext();
  const { ref, ...fields } = register('cardImage');
  const inputRef = React.useRef();
  const pickImageHandler = () => {
    inputRef.current?.click();
  };

  return (
    <>
      <input
        type="file"
        accept=".jpg,.png,.jpeg"
        style={{ display: 'none' }}
        {...fields}
        ref={(instance) => {
          ref(instance); // RHF wants a reference to this input
          inputRef.current = instance; // We also need it to manipulate the elemnent
        }}
      />
      <Button type="button" variant="contained" onClick={pickImageHandler}>
        Add Image
      </Button>
    </>
  );
};

If you want to submit only one image you can process after the user submitted:
const onSubmit = (data) => {
  if (data.cardImage && data.cardImage.length > 0) {
    data.cardImage = data.cardImage[0];
  }

  console.log(data);
  // submit the data
};

A: I have found this issue myself. I found a good solution was to just set the height property of the image input to zero:
<input id='image' type='file' accept='image/*' style={{height: 0}}></input>


text:
Q: Superposition principle and op-amp I was trying to answer these questions (picture below) but I am not sure if I did a good job.

The way that I solved it is shown on this picture below:

At the inverting part of the op-amp where the two resistors are connected, I supposed it is a virtual ground so the voltage is equal to zero.
Can someone please see if I solved it correctly?

A: I am rewriting the answer following a point correctly raised by user287001 (merci !). If you want to apply superposition to this circuit, the only sources you can short are the 10-V on the left-side of the potentiometer and the 5-V one. Shorting the \$V_{ref}\$ node actually implies that the equivalent voltage of 6 V is generated with an extremely low resistance, negligible versus the value of \$R_i\$. Practically speaking, in this particular case, the error is small but this is not a rigorous approach hence the needed correction.
The easiest and fastest way is truly to observe that the non-inverting input is biased at 5 V (considering equal inverting and non-inverting pins biases), then the voltage across resistor \$R_i\$ is 6 V-5 V, a 1-V drop which divided by the resistance gives a 100-µA current. The same current circulates in \$R_f\$ considering the zero current going in the (-) pin. Therefore, knowing the bias at the (-) pin and the current in \$R_f\$ leads us to the output voltage:

If we now want to apply superposition to this circuit, there is no other option than determining the wiper position to know the Thévenin resistance at the \$V_{ref}\$ node. How to do this? You consider the potentiometer as two series resistance affected by a coefficient \$k\$ as shown below:

If \$k=1\$, the wiper is 100% in the low-side position and imposes 0 V on the wiper (considering the low-side terminal grounded). If \$k=0\$, the wiper is in the upper position and you read 10 V if the upper terminal is biased to 10 V. With \$k\$ varying between 0 and 1, you adjust the division ratio. By applying superposition around the equivalent circuit shown below, then you can determine where the wiper is positioned:

The, you transform the 6-V \$V_{ref}\$ node by a Thévenin equivalent circuit affected by an output resistance:

We can now alternatively short the 10-V and the 5-V sources to find the exact output voltage which is exactly 300 mV:

And finally, a quick dc-point calculation with SPICE confirms the approach is correct:

SPICE finds \$V_{out}\$ to 300 mV on the output node while the reconstructed version gives 299.999 mV.

A: There's many hints already given, but you nor others at least haven't published one fact. Here it is:
When +5V is taken into the account with superposition it must be considered to be amplified by a non-inverting amplifier. It's a fatal theory error to consider the feedback voltage divider in that amp to contain only Rf and Ri. There's also the potentiometer.
You must calculate where its slider actually sits when it outputs 6V (=a loaded voltage divider).
Let the resistance parts around the slider of pot R1 be X and 1kOhm-X. You must add to Ri resistance X in parallel with 1kOhm-X and use it in the feedback circuit with Rf. You have skipped this.
There's no voltage source which is in the left end of Ri and ouputs 6V. Placing GND to the left end of Ri when calculating how much the +5V input causes to Vout just assumes that nonexistent voltage source to exist.
The halves of the pot when Vref is 6V are 398 Ohm (upper) and 602 Ohm (lower). One must add 239.6 Ohm to Ri when he calculates how much +5V is amplified. The usual (=wrong) method which simply zeroes Vref gives gain=5.76 for +5V input, the exact method which takes also the pot into the account gives only gain=5.60 for the +5V input.


text:
Q: Multirow not working for subplots I tried to add a colorbar to a figure consisting of six subplots. In my MWE, I have replaces them with letters to spare you the extra hassle:
% Einstellung der Dokumentklasse für A4 und weitere Optionen
\documentclass[12pt, a4paper, bibliography=totoc, listof=totoc, parskip=half, numbers=noenddot]{scrreprt}

\usepackage[utf8]{inputenc}
\usepackage{textcomp}
\usepackage[english, ngerman]{babel}
\usepackage[babel,german=quotes]{csquotes}
\usepackage{siunitx}
\usepackage{ziffer}
\usepackage{float}
\usepackage{subcaption}
\usepackage{multirow}
\usepackage{lmodern}
\renewcommand{\familydefault}{\sfdefault}
\usepackage{tikz, tikz-3dplot, pgfplots}
% Zahlen mit Einheiten setzen
\usepackage{siunitx}
\usepackage{tikz, tikz-3dplot, pgfplots}
\pgfplotsset{compat=1.9}

\begin{document}

\begin{figure}[p]
    \centering
    \begin{tabular}{cccc}
    \begin{subfigure}[b]{0.25\textwidth}
        \centering
        \resizebox{3.5cm}{!}{A}
        \caption{Zeitschritt 31}
        \label{fig:develops031}
    \end{subfigure}~
    &
    \begin{subfigure}[b]{0.25\textwidth}
        \centering
        \resizebox{3.5cm}{!}{B}
        \caption{Zeitschritt 51}
        \label{fig:develops051}
    \end{subfigure}~
    &
    \begin{subfigure}[b]{0.25\textwidth}
        \centering
        \resizebox{3.5cm}{!}{C}
        \caption{Zeitschritt 71}
        \label{fig:develops071}
    \end{subfigure}
    &
    \multirow{2}{*}{
        \begin{subfigure}[b]{0.25\textwidth}
            \centering
            \begin{tikzpicture}
                \begin{axis}[
                    hide axis,
                    scale only axis,
                    height=0pt,
                    width=0pt,
                    colormap/hot2,
                    colorbar right,
                    point meta min=300,
                    point meta max=3133,
                    colorbar style={height=8cm}]
                    \addplot [draw=none] coordinates {(0,0)};
                \end{axis}
            \end{tikzpicture}
        \end{subfigure}
    }\\
    \begin{subfigure}[b]{0.25\textwidth}
        \centering
        \resizebox{3.5cm}{!}{D}
        \caption{Zeitschritt 91}
        \label{fig:develops091}
    \end{subfigure}
    &
    \begin{subfigure}[b]{0.25\textwidth}
        \centering
        \resizebox{3.5cm}{!}{E}
        \caption{Zeitschritt 111}
        \label{fig:develops111}
    \end{subfigure}
    &
    \begin{subfigure}[b]{0.25\textwidth}
        \centering
        \resizebox{3.5cm}{!}{F}
        \caption{Zeitschritt 131}
        \label{fig:develops131}
    \end{subfigure}
    &\\
    \end{tabular}
    \caption{Entwicklung der Temperaturen im Längsschnitt}
    \label{fig:referenz_development_section}
\end{figure}
\end{document}

And I get this result:

The problem is the colorbar, it is not in the place it should be. It should span both rows but it looks like it is only in the lower row.
I have also tried moving the colorbar to the last place and calling
\multirow{-2}{*}{...

But that yields the same result.
How can I archive the desired result, with the colorbar being on the right side of "both rows" ?

A: Instead of \multirow I used a box of zero height and depth (through \raisebox) and added the baseline=(current bounding box.center) option to tikzpicture:
\documentclass[12pt, a4paper, bibliography=totoc, listof=totoc, parskip=half, numbers=noenddot]{scrreprt}

\usepackage[utf8]{inputenc}
\usepackage{textcomp}
\usepackage[english, ngerman]{babel}
\usepackage[babel,german=quotes]{csquotes}
\usepackage{siunitx}
\usepackage{ziffer}
\usepackage{float}
\usepackage{subcaption}
\usepackage{multirow}
\usepackage{lmodern}
\renewcommand{\familydefault}{\sfdefault}
\usepackage{tikz, tikz-3dplot, pgfplots}
% Zahlen mit Einheiten setzen
\usepackage{siunitx}
\usepackage{tikz, tikz-3dplot, pgfplots}
\pgfplotsset{compat=1.9}

\begin{document}

\begin{figure}[p]
    \centering
    \begin{tabular}{cccc}
    \begin{subfigure}[b]{0.25\textwidth}
        \centering
        \resizebox{3.5cm}{!}{A}
        \caption{Zeitschritt 31}
        \label{fig:develops031}
    \end{subfigure}~
    &
    \begin{subfigure}[b]{0.25\textwidth}
        \centering
        \resizebox{3.5cm}{!}{B}
        \caption{Zeitschritt 51}
        \label{fig:develops051}
    \end{subfigure}~
    &
    \begin{subfigure}[b]{0.25\textwidth}
        \centering
        \resizebox{3.5cm}{!}{C}
        \caption{Zeitschritt 71}
        \label{fig:develops071}
    \end{subfigure}
    &
        \raisebox{0pt}[0pt][0pt]{\begin{subfigure}[b]{0.25\textwidth}
            \centering
            \begin{tikzpicture}[baseline=(current bounding box.center)]
                \begin{axis}[
                    hide axis,
                    scale only axis,
                    height=0pt,
                    width=0pt,
                    colormap/hot2,
                    colorbar right,
                    point meta min=300,
                    point meta max=3133,
                    colorbar style={height=8cm}]
                    \addplot [draw=none] coordinates {(0,0)};
                \end{axis}
            \end{tikzpicture}
        \end{subfigure}
    }\\
    \begin{subfigure}[b]{0.25\textwidth}
        \centering
        \resizebox{3.5cm}{!}{D}
        \caption{Zeitschritt 91}
        \label{fig:develops091}
    \end{subfigure}
    &
    \begin{subfigure}[b]{0.25\textwidth}
        \centering
        \resizebox{3.5cm}{!}{E}
        \caption{Zeitschritt 111}
        \label{fig:develops111}
    \end{subfigure}
    &
    \begin{subfigure}[b]{0.25\textwidth}
        \centering
        \resizebox{3.5cm}{!}{F}
        \caption{Zeitschritt 131}
        \label{fig:develops131}
    \end{subfigure}
    &\\
    \end{tabular}
    \caption{Entwicklung der Temperaturen im Längsschnitt}
    \label{fig:referenz_development_section}
\end{figure}
\end{document}


text:
Q: Extract lists based on one property value in JS I have this kind of object:
input = [  {value: 1,
    week: 1,
    year: 2017
   },
   {value: 10,
    week: 30;
    year: 2018
   },
   {value: 2,
    week: 2,
    year: 2018
   },
   {value:3,
    week: 3,
    year: 2017
   }
]

And I want to obtain this object:
{ 2017: {value : [1, 3],
         week: [1, 3]
        },
  2018: {value : [10, 2],
         week: [30, 2]
        }
}

I started with _.groupBy(input, function(elem) {return elem.year}) but then I'm stucked.

A: You can use .reduce

let input = [{
    value: 1,
    week: 1,
    year: 2017
  },
  {
    value: 10,
    week: 30,
    year: 2018
  },
  {
    value: 2,
    week: 2,
    year: 2018
  },
  {
    value: 3,
    week: 3,
    year: 2017
  }
];

let result = input.reduce((c, v) => {
  c[v.year] = c[v.year] || {value: [], week: []};
  c[v.year].value.push(v.value);
  c[v.year].week.push(v.value);
  return c;
}, {});

console.log(result);

Doc: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce

A: Use lodash lib
var result = _(input)
                .mapKeys('year')
                .mapValues(({ value, week }) => ({ value, week }))
                .value();

        console.log(result);

    /*

    {
     2017: {
             value : [1, 3],
             week: [1, 3]
     },
      2018: {
             value : [10, 2],
             week: [30, 2]
     }
    }

    */


text:
Q: Chart JS - single lines (points) tooltips How do I get to ChartJS returns only the value of a point on the graph (on mouse over), instead of the whole dataset?

            <canvas id="canvas" height="600" width="1000"></canvas>

Like this
now - than

A: You can do this by overriding the showTooltip of the chart and inRange methods of the points.
Preview

Script
...
var myChart = new Chart(ctx).Line(data);

// Chart.js replaces the base inRange function for Line points with a function that checks only the x coordinate
// we replace it with the original inRange fucntion (one that checks both x and y coordinates)
myChart.datasets.forEach(function(dataset){
  dataset.points.forEach(function(point){
    point.inRange = Chart.Point.prototype.inRange;
  });
});

// Chart.js shows a multiTooltip based on the index if it detects that there are more than one datasets
// we override it to show a single tooltip for the inRange element
myChart.showTooltip = function(ChartElements, forceRedraw) {
  // this clears out the existing canvas - the actual Chart.js library code is a bit more optimized with checks for whether active points have changed, etc.
  this.draw();
  // draw tooltip for active elements (if there is one)
  Chart.helpers.each(ChartElements, function(Element){
      var tooltipPosition = Element.tooltipPosition();
      new Chart.Tooltip({
        x: Math.round(tooltipPosition.x),
        y: Math.round(tooltipPosition.y),
        xPadding: this.options.tooltipXPadding,
        yPadding: this.options.tooltipYPadding,
        fillColor: this.options.tooltipFillColor,
        textColor: this.options.tooltipFontColor,
        fontFamily: this.options.tooltipFontFamily,
        fontStyle: this.options.tooltipFontStyle,
        fontSize: this.options.tooltipFontSize,
        caretHeight: this.options.tooltipCaretSize,
        cornerRadius: this.options.tooltipCornerRadius,
        text: Chart.helpers.template(this.options.tooltipTemplate, Element),
        chart: this.chart,
        custom: this.options.customTooltips
      }).draw();
    }, this);
}

The obvious downside is that if there are 2 (or more) points close together, you'll see multiple tooltips that might possible overlap.

Fiddle - http://jsfiddle.net/v7mtz64o/