text:
Q: What is regularInterceptedExpression in angular? During debugging of my ng-app I've find out that most time of $digest takes regularInterceptedExpression. The question is, what is causes of triggering it?

A: Found this on AngularJs Docs, hope this can help.
https://docs.angularjs.org/error/$rootScope/infdig?p0=10&p1=%5B%5B%7B%22msg%22:%22fn:%20regularInterceptedExpression%22
Following scenarios could cause this error.

*

*When you declare a local scope property using = in a directive. This will create a interceptedExpression.

*method calls in the view
Angular Tip:  We should avoid method calls in the view whenever possible, since they run on every $digest loop.
Thanks,


text:
Q: Logic and urn with balls of different colors. I'm sorry if the community to place such a question is chosen incorrectly, but I think math is quite suitable for this case. So there are two reasoning/logic questions.
[temporary deleted]

redpajama_set_name: RedPajamaStackExchange


text:
Q: Angular5, setting active class for RouterLink I am trying to distinguish currently selected routerLink from others by giving it class which will change some styles.
So in html i added some properties and event to links.
app.component.html:

     Dashboard

  Products List

and in typescript I have implemented variable and method.
app.component.ts:
import { Component } from '@angular/core';

@Component({   selector: 'app-root',   templateUrl: './app.component.html',   styleUrls: ['./app.component.css'] })
  export class AppComponent {

  pageSelected:string;

  setActivepage(page){
    this.pageSelected = page;   }

}

but there is nothing happening after link click although activePage class is already set in styles.
Somebody got an idea how to make it work ?

A: https://angular.io/api/router/RouterLinkActive
You just need to use routerLinkActive prop for that on your routerLink's.

A: @vikas and @Mertcan Diken already showed you the solution! I show you how you should use it.
The 'angular' router knows which route is active and will set a class on the active a tag for you. You only have to define which class should be set.
.css
.active-route {
    background: black;
    border-bottom: 2px solid red;
}

.html

    Dashboard
    Products List

A:

     Dashboard

  Products List
</nav


text:
Q: Como colocar gráficos diferentes do ggplot2, separados, mas na mesma tela? Suponha que eu tenha estes 4 gráficos:
p1 <- ggplot(mtcars, aes(mpg, cyl)) + geom_point()
p2 <- ggplot(mtcars, aes(mpg, cyl)) + geom_line()
p3 <- ggplot(mtcars, aes(mpg, cyl)) + geom_line(color="blue")
p4 <- ggplot(mtcars, aes(mpg, cyl)) + geom_line(color="red")

Como plotar cada um destes gráficos separados, mas todos juntos na mesma tela?

A: Você também pode usar as funções grid.arrange do pacote gridExtra.
    library(ggplot2)
    library(gridExtra)

    # Crio 4 gráficos
    grafico_1 <- qplot(1:5,1:5)
    grafico_2 <- qplot(10:1,1:10)
    grafico_3 <- qplot(1)
    grafico_4 <- qplot(12)

    # Plotando dois deles (em colunas)
    grid.arrange(grafico_1 , grafico_2 , ncol=2)

    # Plotando outros dois (em linhas)
    grid.arrange(grafico_3 , grafico_4 , nrow=2)

    # Plotando todos
    grid.arrange(grafico_1 , grafico_2 ,
                 grafico_3 , grafico_4 ,
                 ncol=2, nrow=2)

Ajuda?

A: Para isso, eu já usei a função multiplot disponibilizada nesse site.
Pode calhar de a função não ser exatamente o que precisa, mas já fica mais fácil alterá-la do que começar do zero.
Copiando a função do site aqui abaixo para eternizar:
# Multiple plot function
#
# ggplot objects can be passed in ..., or to plotlist (as a list of ggplot objects)
# - cols:   Number of columns in layout
# - layout: A matrix specifying the layout. If present, 'cols' is ignored.
#
# If the layout is something like matrix(c(1,2,3,3), nrow=2, byrow=TRUE),
# then plot 1 will go in the upper left, 2 will go in the upper right, and
# 3 will go all the way across the bottom.
#
multiplot <- function(..., plotlist=NULL, file, cols=1, layout=NULL) {
  require(grid)

  # Make a list from the ... arguments and plotlist
  plots <- c(list(...), plotlist)

  numPlots = length(plots)

  # If layout is NULL, then use 'cols' to determine layout
  if (is.null(layout)) {
    # Make the panel
    # ncol: Number of columns of plots
    # nrow: Number of rows needed, calculated from # of cols
    layout <- matrix(seq(1, cols * ceiling(numPlots/cols)),
                    ncol = cols, nrow = ceiling(numPlots/cols))
  }

 if (numPlots==1) {
    print(plots[[1]])

  } else {
    # Set up the page
    grid.newpage()
    pushViewport(viewport(layout = grid.layout(nrow(layout), ncol(layout))))

    # Make each plot, in the correct location
    for (i in 1:numPlots) {
      # Get the i,j matrix positions of the regions that contain this subplot
      matchidx <- as.data.frame(which(layout == i, arr.ind = TRUE))

      print(plots[[i]], vp = viewport(layout.pos.row = matchidx$row,
                                      layout.pos.col = matchidx$col))
    }
  }
}

A: Bom, se for para colocar todos os gráficos SEPARADOS em uma mesma tela, isso é possível com o pacote gridExtra. No entanto, dependendo da situação, existe o recurso do facets ou também colocar todas as curvas no mesmo gráfico. Vamos a cada caso:
1) Gráficos separados na mesma tela
library(gridExtra)

p1 <- ggplot(mtcars, aes(mpg, cyl)) + geom_point()
p2 <- ggplot(mtcars, aes(mpg, cyl)) + geom_line()
p3 <- ggplot(mtcars, aes(mpg, cyl)) + geom_line(color="blue")
p4 <- ggplot(mtcars, aes(mpg, cyl)) + geom_line(color="red")

grid.arrange(p1,p2, p3, p4)

2) Para mostrar o caso usando facets, vou utilizar o conjunto de dados tips, do pacote reshape2
library(tips)
library(ggplot2)

data(tips)
head(tips)

total_bill  tip    sex smoker day   time size
1      16.99 1.01 Female     No Sun Dinner    2
2      10.34 1.66   Male     No Sun Dinner    3
3      21.01 3.50   Male     No Sun Dinner    3
4      23.68 3.31   Male     No Sun Dinner    2
5      24.59 3.61 Female     No Sun Dinner    4
6      25.29 4.71   Male     No Sun Dinner    4

Veja que temos o valor da conta, da gorjeta, do sexo, como estava o dia e etc. Suponha que eu queira ver a relação entre a conta e fração da gorjeta em relação à conta:
g1 <- ggplot(tips, aes(x=total_bill, y=tip/total_bill)) + geom_point(shape=1)

Vamos usar o facets e apresentar o mesmo gráfico, só que separando por sexo, isto é, vamos ver quem dá mais gorjeta em relação ao valor da conta, os homens ou as mulheres.
g1 + facet_grid(. ~ sex)

3) Por fim, vamos colocar todas as curvas no mesmo gráfico. Ainda usando o mesmo conjunto de dados tips e utilizando uma função de suavização.
ggplot(tips, aes(x=total_bill, y=tip/total_bill, fill=sex, col=sex)) + geom_point(shape=1) + geom_smooth()

A estratégia a ser utilizada, a 1), a 2) ou a 3) depende de cada caso particular.

A: Além dos pacotes citados, existem também os pacotes cowplot, ggpubr, patchwork e egg. No caso aqui apresentado, todos retornam o mesmo plot.
library(ggplot2)

p1 <- ggplot(mtcars, aes(mpg, cyl)) + geom_point()
p2 <- ggplot(mtcars, aes(mpg, cyl)) + geom_line()
p3 <- ggplot(mtcars, aes(mpg, cyl)) + geom_line(color="blue")
p4 <- ggplot(mtcars, aes(mpg, cyl)) + geom_line(color="red")

library(cowplot)
cowplot::plot_grid(p1, p2, p3, p4,
                   nrow = 2, align = "hv")

library(ggpubr)
ggpubr::ggarrange(p1, p2, p3, p4,
                  nrow = 2, ncol = 2)

library(patchwork)
p1 + p2 + p3 + p4

library(egg)
egg::ggarrange(p1, p2, p3, p4, ncol = 2)

Em casos complexos, prefiro utilizar o pacote cowplot, pois o alinhamento dos plots é realizado facilmente através do argumento align = "hv", bem como também a capacidade de extrair legendas, com a função get_legend.
O pacote gridExtra também tem a opção de uso do argumento layout_matrix, que facilita em algumas situações a escolha da sequência de plots, e ajuste de largura e altura.
library(gridExtra)
# Matriz para divisao do plot
lay <- rbind(c(1,2),
             c(3,4))

gridExtra::grid.arrange(p1, p2, p3, p4, layout_matrix = lay)


text:
Q: How can an app find out if the user has updated the OS in their device I am trying to build an application in which I need to find out whether the user has updated their Android phone's OS or not.
For example if user's phone has android version 9 and his phone supports android version 11 but he has not updated it then I have to send a notification on his phone that please update your device.
But if his phone doesn't support android version 11 or other new versions then we have to check that till which version his device can support.
Please advise me on how I can do that.

A: TL;DR - It will be a lot of work.  This is not something that the standard Android APIs support.

Here are a couple of approaches that may work
Approach #1
You will need to do is build and maintain a central database of all makes and models of Android phones and the latest available OS version for each one.
When your app needs to check if the OS is up to date it does the following:

*

*Lookup the device's make and model, and its OS version.  This Q&A explains how to get the current OS version:

*

*How can I check the system version of Android?

*Query the central database (running on your infrastructure) to find out what the latest OS version for the device is.

*If the user's device is out of date, send the user the notification.
Downside: you will have to assemble the database of devices and OS versions, and keep it up to date.  And you will need to pay for the infrastructure that hosts the database and responds to queries.
Approach #2
For each Android device manufacturer, research how their device firmware works out if there is an update available.  Apparently, this functionality is not standardized.  There are no standard Android APIs that will tell you if the user's device has an OS update available.
Downside: you have a lot of research and (possibly) implementation work to do to support a range of devices.  It will quite possibly entail getting hold of a lot of different types of devices for testing.  (You are unlikely to be able to develop and test on an emulator.


text:
Q: Network not working after network-manager disabled I'm using the Wok web interface to manage a kvm virtual machine. Wok would not allow a bridged vm interface with network-manager enabled, so I disabled it. Since then networking does not work on the host (everything was working before). IP address is configured properly and routing table shows correct routes. The host can ping itself, but no other hosts on the LAN. I tried
sudo service networking restart

and
sudo /etc/init.d/network restart

and
ifdown eno1

ifup eno1

and multiple reboots, no success.
Here is the network setup:
me@host:~$ ip address show eno1 | grep 192

    inet 192.168.1.201/24 brd 192.168.1.255 scope global dynamic eno1

me@host:~$ route -n

Kernel IP routing table

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

0.0.0.0         192.168.1.1     0.0.0.0         UG    100    0        0 eno1

169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 eno1

192.168.1.0     0.0.0.0         255.255.255.0   U     100    0        0 eno1

192.168.122.0      0.0.0.0         255.255.0.0     U     0      0        0 virbr0

Any ideas how to fix this? Thanks.

A: NetworkManager was not the problem. I had configured KVM to use a bridge network, which took control of eno1 and prevented it from communicating on the LAN. Here's /etc/network/interfaces after enabling the bridge network. I commented out the lines 'auto kbeno1','iface kbeno1 inet manual', and 'bridge-ports eno1'. Now the host can talk on the LAN again.
///interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
auto kbeno1
iface kbeno1 inet manual
  bridge_ports eno1

auto eno1
iface eno1 inet static
  address 192.168.1.201

  netmask 255.255.255.0

  gateway 192.168.1.1

  dns-nameservers 8.8.8.8


text:
Q: php /Drupal7 Curl Error - SSL read: error $ch = curl_init();
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // Return data inplace of echoing on screen
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); // Skip SSL Verification
    $rsData = curl_exec($ch);

I am trying to get data from other(site2) site. Both the website are hosted in same server but different domain.
I have verified the OPenssl is turned on.

Error Message:SSL read: error:00000000:lib(0):func(0):reason(0), errno
  104

A: My Firewall has blocked the conection between the hosts in same server, After updating NAT rule it works fine


text:
Q: Why doesn't the singular verb "pass" take an "-es" suffix in this sentence? As I was studying Peterson's Master TOEFL Writing Skill, I saw the sentence:

Teamwork requires that a player pass the ball whoever is in the best position to make the goal.

I wonder why pass does not take an -es suffix in the sentence cited above. Is it a mistake? If not, could you please explain under which particular circumstances we don't add -es suffix to a present tense verb that's in the third-person singular?


text:
Q: How to use chrome.identity.getProfileUserInfo in chrome.webRequest.onBeforeRequest? How can I use a Chrome extensions API that can be used with a callback function, such as chrome.identity.getProfileUserInfo, in chrome.webRequest.onBeforeRequest?
For example, I have a part of script similar to:
chrome.webRequest.onBeforeRequest.addListener(
  function (request) {
    return { redirectUrl: `https://example.com` };
  },
  // filters here.
  // permissions here.
)

The above works, it redirects request attempts to the https://example.com.
But the following, with wrapping the code in a callback function, the return/redirectUrl part is ignored and it doesn't work; it doesn't redirect.
chrome.webRequest.onBeforeRequest.addListener(
  function (request) {

    chrome.identity.getProfileUserInfo(function (profileUserInfo) {
      console.log(profileUserInfo.email);

      return { redirectUrl: `https://example.com` };
    });
  },
  // filters here.
  // permissions here.
)

This is a synchronous way that webRequest.onBeforeRequest is only capable of, correct? I use these callbacks, synchronous way because I learnt the chrome extensions API doesn't support an asynchronous way (e.g. async/await, Promise) as I asked on SO other day: javascript - async in chrome.webRequest.onBeforeRequest? - Stack Overflow
So, is it possible, to use chrome.identity.getProfileUserInfo in chrome.webRequest.onBeforeRequest? Thanks.

A: No, you can't. "chrome.identity.getProfileUserInfo" like most "chrome." methods take time to do, therefore the callback function. "chrome.webRequest.onBeforeRequest" only supports the "blocking" option but not "asyncBlocking". But in your case, you could easily assign the ProfileUserInfo to a variable beforehand somewhere in your background script and use it like that.


text:
Q: Collision between Box Collider 2D and Polygon Collider 2D not working Currently I am working on a networked 2d platform game.
My player is an empty object which serves as a parent to my actual graphics etc. The empty object has a rigidbody (3d) attached to it as it needs to have one in order to use the configurable joint component ( note: I move my player around using this 3d rigid body).The player body however, a child to the graphics, has a box collider 2d attached to it as it after all it is a 2d game and has to collide with other 2d objects.
My platforms have polygon collider 2ds attached to them (which is connected to a platform effector if that is worth mentioning).
Now, even though both my player body (which is a child to graphics which is a child to my player object) and my platforms have 2d colliders on them they do not collide and can simply go inside each other (neither of them is marked as isTrigger).
In order to solve this I thought I would add a  rigidbody 2D to the player body and see if that would do anything. Now upon adding the rigidbody 2D collisions did work but as soon as I made the rigidbody 2D have all position and rotation constraints ticked or as soon as I made it kinematic or static it would cease to collide with my platforms. The problem is I need to have the rigidbody 2D be static or not be able to move as I am currently moving my player object using the rigidbody (3d) attached to it and do not want any additional movement of the player body upon colliding with objects.
I know this is quite a lot of information, so if you have any questions or would like further information just comment and I will be quick to respond. Thank you :-)!
Edit:
2d ray casts are also unable to hit the player body box collider 2D
Edit 2:
So to recap:
If either the player body or the platform has a rigidbody 2d that is not static (dynamic) and can move collisions work. However currently I only have a rigidbody 2D on my player body which has to be static though (as explained earlier) as well as a box collider 2d. My platform(s) on the other hand currently only has a polygon collider 2d as I do not see why it would need a rigidbody 2D.

A: A static collider won't detect the collision with another collider if it doesn't have a rigidbody, if it is static or if it has a kinematic rigidbody. At least one of your two objects needs to not be static and to have a rigidbody which is not kinematic to be correctly detected. So you do need to add a Rigidbody2D to your platform.
When you have a doubt about why a collider wouldn't collide with another one, always refer to this page of Unity's documentation which sums up which kind of collider will collide with another one.

A: Rigidbody2D can't collide with Rigidbody3D, here's a workaround though
http://answers.unity3d.com/questions/580769/can-rigidbody-2d-collide-with-3d-colliders.html


text:
Q: cocos2d-x V3.1 save screenshot to album for android I'm new for cocos2d-x and I'm using v3.1.
I wrote an app using cocos2d before and now I want to add an android version by cocos2d-x.
After checking online, I use this code for saving my screen image:
void Game1::takePhoto(Ref *pSender){

Size size = Director::getInstance()->getWinSize();
RenderTexture* texture = RenderTexture::create((int)size.width, (int)size.height);
texture->setPosition(Point(size.width, size.height));
texture->begin();
Director::getInstance()->getRunningScene()->visit();
texture->end();
if (texture->saveToFile("screenshot.png", kCCImageFormatPNG)){
    CCLOG("screen captured");
}

}
Where did the file be saved? I can't find it on my album, how can I save it to album for android device?

A: it saved to where getWriteablePath() returns.


text:
Q: JSON.net null property I recently solved this error:
Type is an interface or abstract class and cannot be instantiated,
by using the solution suggested here:
Using Json.NET converters to deserialize properties.
Unfortunately I am getting new issues with this. In the code below, Depth gets called as part of the deserialisation, which in turn calls the Prof property which fails because 'this.Profile' is null. ('this.Profile' is a property inherited from the Section class.)
public class TimberSection : Section, IPurlinShape, IEavesBeamShape
    {
        private Profiles.Flat Prof
        {
            get
            {
                var prof = this.Profile as Profiles.Flat;
                if (prof != null)
                    return prof;
                else
                    throw new DataMissingException("Expected Rectangle profile");
            }
        }

        public override double Depth { get { return Prof.Depth; } }
}

I used http://www.jsoneditoronline.org/ to view my object and it seems everything is correct. The profile object that is coming up null when i deserialise, has a value the same as the object prior to serialization.
Below is my method for serialising it, then deserialising it immediately after.
        string serialisedEnquiry = JsonConvert.SerializeObject(enquiry, Formatting.Indented, new JsonSerializerSettings
         {
             TypeNameHandling = TypeNameHandling.Objects,
             TypeNameAssemblyFormat = System.Runtime.Serialization.Formatters.FormatterAssemblyStyle.Simple
         });

        Enquiry enq = JsonConvert.DeserializeObject<Enquiry>(serialisedEnquiry, new JsonSerializerSettings
        {
            TypeNameHandling = TypeNameHandling.Objects
        });

What am i doing wrong here?

A: The two things that pop in my mind are

*

*Change Depth from a property to a method

or

*

*Make the entire class opt-in and specify which properties should be serialized

You can read more about that here

A: ObjectCreationHandling = ObjectCreationHandling.Replace solves this.


text:
Q: Adding items into ObservableCollection is changing a backing field on the same ViewModel I have been experimenting with Winui 3 and I have noticed an issue which I am not sure if it is of my own doing or if it some sort bug. I have a ViewModel which when navigated too, passes a Model object to the ViewModel which then pushes the Model data to the backing fields.
At the same time the ViewModel queries the database and runs it through a foreach and adds it to a ObservableCollection. What I have found, on the first foreach loop it is replacing the UsersID backing field value with the ID of the first item through the foreach loop.
public async void Initialize(object queryObject)
{
    Model = (InspectionModel)queryObject;
    var users = await Task.Run(App.Repository.Users.GetCertifiersAsync);

    foreach (var item in users)
    {
        Certifiers.Add(item);
    }
}

public ObservableCollection<UsersModel> Certifiers = new ObservableCollection<UsersModel>();

public int UsersID
{
    get { return Model.UsersID; }
    set
    {
        Model.UsersID = value;
        OnPropertyChanged(nameof(UsersID));
        IsModified = true;
    }
}

Certifiers is the ItemsSource for a combobox and UsersID is the SelectedIndex.


text:
Q: my springboot application embered tomcat started is very slowly this is the startup log in this picture
21:20:45,691 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@28c97a5 - Registering current configuration as safe fallback point

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::       (v2.1.12.RELEASE)

2021-01-06 21:20:46,346 [main] INFO  com.pingan.smartcity.scw.whapply.WhApplyApplication - Starting WhApplyApplication v1.0-SNAPSHOT on izxs801ql7o8q7dbxyv64jz with PID 11576 (/opt/data/app/h5/whapply-xm-1.0-SNAPSHOT.jar started by root in /opt/data/app/h5)
2021-01-06 21:20:46,349 [main] DEBUG com.pingan.smartcity.scw.whapply.WhApplyApplication - Running with Spring Boot v2.1.12.RELEASE, Spring v5.1.13.RELEASE
2021-01-06 21:20:46,349 [main] INFO  com.pingan.smartcity.scw.whapply.WhApplyApplication - The following profiles are active: prod
2021-01-06 21:20:47,511 [main] WARN  org.mybatis.spring.mapper.ClassPathMapperScanner - No MyBatis mapper was found in '[com.pingan.smartcity.scw.whapply]' package. Please check your configuration.
2021-01-06 21:20:47,550 [main] INFO  org.springframework.data.repository.config.RepositoryConfigurationDelegate - Multiple Spring Data modules found, entering strict repository configuration mode!
2021-01-06 21:20:47,552 [main] INFO  org.springframework.data.repository.config.RepositoryConfigurationDelegate - Bootstrapping Spring Data Redis repositories in DEFAULT mode.
2021-01-06 21:20:47,596 [main] INFO  org.springframework.data.repository.config.RepositoryConfigurationDelegate - Finished Spring Data repository scanning in 30ms. Found 0 Redis repository interfaces.
2021-01-06 21:20:48,110 [main] INFO  o.s.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker - Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$f5a22d6c] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-01-06 21:36:15,587 [main] INFO  org.springframework.boot.web.embedded.tomcat.TomcatWebServer - Tomcat initialized with port(s): 8899 (http)
2021-01-06 21:36:15,608 [main] INFO  org.apache.coyote.http11.Http11NioProtocol - Initializing ProtocolHandler ["http-nio-8899"]
2021-01-06 21:36:15,622 [main] INFO  org.apache.catalina.core.StandardService - Starting service [Tomcat]
2021-01-06 21:36:15,622 [main] INFO  org.apache.catalina.core.StandardEngine - Starting Servlet engine: [Apache Tomcat/9.0.30]
2021-01-06 21:36:15,710 [main] INFO  org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/] - Initializing Spring embedded WebApplicationContext
2021-01-06 21:36:15,710 [main] INFO  org.springframework.web.context.ContextLoader - Root WebApplicationContext: initialization completed in 929305 ms

As shown in the picture above, It takes 10 minutes to start my springboot application, This is very abnormal, what's the problem '


text:
Q: Output of command as variable I'm writing a PBS script to process many files at once and perform multiple actions.
I would like to start by unzipping .gz files (which I later zip) and then process the unzipped file.
The following will unzip the file in $file, but I once I have unzipped the file, I would like the variable $file to refer to the unzipped version:
for file in $READS/*2.fq.gz;
do
    gunzip $file
    # continue script with the gunzipped file
done

Something like:
for file in $READS/*2.fq.gz;
do
    file=gunzip $file
    # continue script with the gunzipped file
done

A: You want to remove the .gz suffix on $file:
file=${file%.gz}

Note that you probably also want to check the result of the gunzip command to see if it failed:
for file in $READS/*2.fq.gz;
do
    if gunzip $file; then
        file=${file%.gz}
        # continue script with the gunzipped file
    else
        # gunzip failed (corrupt file?) and already output an error message
        # try to recover?
    fi
done


text:
Q: "the girls' nose" or "the girls' noses": which means the nose of many girls? "the girls' nose" or "the girls' noses"?
We are talking about the nose of many girls.

A: Girls' noses. "Girls' nose" would only occur if many girls were sharing the same nose, which is uncommon to say the least.


text:
Q: No response from Ubuntu One Oauth request According to the documentation at https://one.ubuntu.com/developer/files/store_files/cloud, I should be able to get files with 'https://one.ubuntu.com/api/file_storage/v1/~/Ubuntu One', but temporarily renamed to 'https://files.one.ubuntu.com/~/Ubuntu One'. I'm getting no response from either, though my access token is successful and I'm able to get:
object(stdClass)[230]
  public 'visible_name' => string 'Username'
  public 'root_node_path' => string '/~/Ubuntu One' (length=13)
  public 'user_node_paths' =>
    array (size=0)
      empty
  public 'resource_path' => string '' (length=0)
  public 'user_id' => int number
  public 'max_bytes' => int number
  public 'used_bytes' => int number

Is there something wrong with the server or my account?

A: You'll want to look at passing a querystring of include_children=true to see the contents of the Ubuntu One folder.
For reference, when I make a request to https://one.ubuntu.com/api/file_storage/v1/~/Ubuntu%20One this is the JSON I get back:
 {
    "kind": "directory",
    "when_created": "2009-02-11T15:33:10Z",
    "generation": 12592,
    "has_children": true,
    "content_path": "/content/~/Ubuntu One",
    "generation_created": 0,
    "parent_path": null,
    "is_live": true,
    "resource_path": "/~/Ubuntu One",
    "when_changed": "2013-01-23T15:56:45Z",
    "key": "(removed)",
    "path": "/",
    "volume_path": "/volumes/~/Ubuntu One"
  }


text:
Q: "$http" does not exist - TypeScript compiler error with Vuejs2 and vue-resource I am writing a Vue app using typescript using vue-property-decorator (an extension of vue-class-component). I am using vue-resource but get a compiler error when using this.$http:

"Property '$http' does not exist on type ...."

I saw a very similar issue posted at How to use plugins like vue-resource when using Vue.js with Typescript?
I have already been importing vue-resource using import VueResource from 'vue-resource' syntax - so this solution is not working for me.
Here is my main.ts
import Vue from 'vue'
import VueResource from 'vue-resource'
import VueRouter from 'vue-router'
import App from './App.vue'
import store from './store/store'
import routes from './routes'

import moment from 'moment'

Vue.use(VueResource)
Vue.use(VueRouter)

Vue.filter('formatTime', function(ms) {
  const zeroTime = moment('2016-06-12 00:00:00')

  if (ms > 3600000) {
    return zeroTime.add(ms, 'milliseconds').format('HH:mm:ss:SSS')
  } else if (ms > 60000) {
    return zeroTime.add(ms, 'milliseconds').format('mm:ss:SSS')
  } else if (ms > 1000) {
    return zeroTime.add(ms, 'milliseconds').format('ss:SSS')
  } else {
    return zeroTime.add(ms, 'milliseconds').format('SSS')
  }
})

Vue.filter('dateFormat', (date, format) => {
  return moment(date).format(format || 'MMMM Do, YYYY - HH:mm:ss')
})

const router = new VueRouter({ routes })

new Vue({
  el: '#app',
  store,
  router,
  render: h => h(App)
})

And I get the error in this file (in the created() method):
import { Vue, Component } from 'vue-property-decorator'

import WordTyper from 'components/wordTyper'
import Race from 'components/Race.vue'
import Stats from 'components/stats'
import SpeedGraph from 'components/speedGraph'
import SaveScore from 'components/saveScoreModal'

@Component({
  name: 'SinglePlayer',
  components: {
    WordTyper,
    Race,
    Stats,
    SpeedGraph,
    SaveScore
  }
})
export default class SinglePlayer extends Vue {
  loading: boolean = false
  saveScore: boolean = false

  get playing() {
      return this.$store.getters.timeElapsed
    }

  get finished() {
      return this.$store.getters.finished
    }

  created() {
    this.$store.dispatch('reset')

    const url = 'https://cors-anywhere.herokuapp.com/https://api.forismatic.com/api/1.0/?method=getQuote&format=json&lang=en'

    this.loading = true

    this.$http.get(url).then((res) => {
      if (!res.body) {
        this.loading = false
        return
      } else {
        const text = res.body.quoteText.trim()
        const source = res.body.quoteAuthor

        this.$store.dispatch('reset', { text, source })
        this.loading = false
      }
    }, (err) => {
      this.loading = false
    })
  }

  save() {
    this.$router.push('scores')
  }
}

Of course, the app is working fine as intended but this compiler error still persists.
Any insight would be very appreciated, thanks!


text:
Q: Why did my title and other text boxes disappear when I resized the layout in ArcMap? I had finished building a nice layout with my maps, inserts, scale bar, and text boxes. However, when I changed the layout from landscape to portrait all of the map elements such as the text boxes and title vanished.  It is as though they were deleted or are simply floating somewhere off of the view.
Is there any way to recover them?


text:
Q: Prevent mouse pointer from going between monitors when in a corner of a monitor This is a feature that i found on windows but i can't find anything like this on Linux.
I have multiple monitors and each of them had its own taskbar. Each of them has an applications menu button on the bottom left corner.
When I have only one monitor i can quickly hit it by moving the mouse cursor as far down and left as it will go.
But on multiple monitors it will instead go to a different monitor. On windows it stops at the bottom left corner and if i want to move it to another monitor i have to move it at least a pixel up and then to the other monitor.
Is there any way to get that effect on Linux? For some time my workaround was to make the bottom of the monitor on the right be set a few pixels below the one on the left but that's not very convenient when it doesn't align with the physical layout of my monitors.


text:
Q: How to decode MappedByteBuffer without copying in Java How can I decode the UTF-8 codepoints of a MappedByteBuffer in Java without copying the buffer? Copying the buffer into memory would defeat the point of mapping the memory, and since CharsetDecoder would require me to copy the buffer with the toCharArray method, it would defeat the purpose of mapping the memory. Is there any way to efficiently decode it without copying the buffer?

A: Not really: essentially a char[] needs to be built from the byte[] (either direct or indirect) which is backing the MappedByteBuffer.
So something like the following is necessary:
private static CharBuffer readUTF8(final Path path) throws IOException {

    final long             byteCount  = path.toFile().length();

    final FileChannel      channel    = FileChannel.open(PATH);
    final MappedByteBuffer byteBuffer = channel.map(MapMode.READ_ONLY, 0, byteCount);

    return StandardCharsets.UTF_8.decode(byteBuffer);
}

The following snippet demonstrates the possibility to reuse various components used in the above example.
As stated in the Javadoc, this is a complex matter.
So it should only be considered as a collection of ideas & invocations of various JDK methods, which may or may not be of use, depending on your concrete requirements.
You really need an in-depth understanding of Charsets etc. before using the following...
/**
 * It is possible to pre-allocate a CharsetDecoder & CharBuffer & use those multiple times.
 * Be aware that this would make your logic MUCH more complicated.
 * a) you'll have to control use/reuse & initialisation of the CharsetDecoder
 * b) you'll need to ensure the CharBuffer has sufficient capacity
 *
 * The following is just snippets which may be of use.
 */
public static void main(final String[] args) throws Exception {

    final CharsetDecoder   utf8Decoder = StandardCharsets.UTF_8.newDecoder();
    ;                      utf8Decoder.onMalformedInput     (CodingErrorAction.REPLACE);
    ;                      utf8Decoder.onUnmappableCharacter(CodingErrorAction.REPLACE);

    final int              charBufLength    = 0; // TODO how long?
    final CharBuffer       charBuf          = CharBuffer.allocate(charBufLength);

    final int              byteBufferLength = 0; // TODO how long?
    final MappedByteBuffer byteBuffer       = FileChannel.open(Path.of("my File")).map(MapMode.READ_ONLY, 0, byteBufferLength);

    readUTF8(utf8Decoder, byteBuffer, charBuf);
}
private static void readUTF8(final CharsetDecoder utf8Decoder, final MappedByteBuffer byteBuffer, final CharBuffer charBuffer) throws IOException {

    /* Maybe */ utf8Decoder.reset();            // TODO check out the source of the following decode(byteBuffer) method
    /* Maybe */ utf8Decoder.decode(byteBuffer); // TODO check out the source of this method

    utf8Decoder.decode(byteBuffer, charBuffer, true); // reuses utf8Decoder & charBuffer
    charBuffer.flip();
}

A: Here is a somewhat more complete answer.
It reads the Input-File in Chunks & stores the result in a CharBuffer.
import static java.nio.charset.StandardCharsets.UTF_8;

import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.channels.FileChannel;
import java.nio.charset.CharacterCodingException;
import java.nio.charset.CharsetDecoder;
import java.nio.charset.CoderResult;
import java.nio.charset.MalformedInputException;
import java.nio.charset.UnmappableCharacterException;
import java.nio.file.Files;
import java.nio.file.Path;

public class ChunkedUtf8Decoder {
    /*
     * Valid UTF-8 Multi-Bytes
     * -----------------------
     * 1-Byte : 0xxxxxxx
     * 2-Byte : 110xxxxx + 10xxxxxx
     * 3-Byte : 1110xxxx + 10xxxxxx + 10xxxxxx
     * 4-Byte : 11110xxx + 10xxxxxx + 10xxxxxx + 10xxxxxx
     */
    private static final int            UTF8_CONTINUE_MASK   = 0b11_000000;
    private static final int            UTF8_INVALID_MASK    = 0b11111_000;

    private static final int            UTF8_CONTINUE_PREFIX = 0b10_000000;
    private static final int            UTF8_INVALID_PREFIX  = UTF8_INVALID_MASK;

    private static final int            CHUNK_SIZE           = 24; // TODO Test value! Try something larger, e.g. 64_000

    private        final CharsetDecoder utf8Decoder          = UTF_8.newDecoder();
    private        final ByteBuffer     bb                   = ByteBuffer.allocate(CHUNK_SIZE); // TODO maybe allocateDirect?
    private        final CharBuffer     cb;
    private        final Path           inputPath;

    private              byte[]         remainder            = {};
    private              int            bytesChunked         = 0;

    public ChunkedUtf8Decoder(final Path inputPath) throws IOException {

        this.inputPath = inputPath;
        this.cb        = CharBuffer.allocate(Math.toIntExact(Files.size(inputPath)));

//      this.utf8Decoder.onMalformedInput     (CodingErrorAction.REPLACE); // (TODO Default is REPORT)
//      this.utf8Decoder.onUnmappableCharacter(CodingErrorAction.REPLACE); // (TODO Default is REPORT)
    }

    /**
     * Split the Input-File into Chunks & Decode them, appending the result to our CharBuffer.
     *
     * @throws IOException
     */
    public void decode() throws IOException {

        try(final FileChannel  channel = FileChannel.open(inputPath))
        {
            while (channel.read(bb) != -1) {

                debugBytesIn("Read......:", false);

                this.remainder    =  backupToCharBoundary();

                debugBytesIn("Backed up.:", true);

                this.bytesChunked += decodeChunk();

                bb.clear();             // (position=0, limit=capacity, mark=-1)
                bb.put(this.remainder); // (Final Remainder is dealt with below)
            }
            debugBytesIn("EOF.......:", false);
            /*
             * Lastly, deal with Final Remainder (0 to 4 Bytes) @ start of Buffer...
             */
            decodeChunk();
        }
    }

    /**
     * We try to back up the BB to a Character boundary.
     * If the file is correctly encoded, the shorter BB will then decode OK.
     * The Remainder will be processed after the NEXT Read operation.
     *
     * @return
     * @throws MalformedInputException
     */
    private byte[] backupToCharBoundary() throws MalformedInputException {

        for (int i = 1; i <= 4; i++) {

            final int trailingBytePos = bb.position() - i;

            if (trailingBytePos < 0) {
                /*
                 *  If there were too few Bytes available, carry them over until either
                 *  a) more Bytes become available, or
                 *  b) EOF is reached
                 */
                final byte[] remainder = new byte[bb.position()];

                bb.get  (0,  remainder);
                bb.clear();       // (position=0, limit=capacity, mark=-1)

                return remainder; // (Entire contents of BB in Remainder, BB Empty)
            }

            final int trailingByte = 0xFF & bb.get(trailingBytePos);

            /*
             * We stop as soon as we encounter a Character-Selector...
             * (The following 2 intervals are either invalid or a continuation-character)
             */
            if ((trailingByte  &  UTF8_INVALID_MASK )  !=  UTF8_INVALID_PREFIX     // 11111xxx
            &&  (trailingByte  &  UTF8_CONTINUE_MASK)  !=  UTF8_CONTINUE_PREFIX) { // 10xxxxxx
                /*
                 *  OK, we have found a (1-, 2-, 3- or 4-Byte) Character-Selector...
                 */
                final byte[] remainder = new byte[i];

                bb.get     (trailingBytePos, remainder);
                bb.position(trailingBytePos);

                return remainder; // (Trailing 1-4 Bytes of BB in Remainder)
            }
        }
        /*
         * Although at least 4 Bytes are available, We couldn't find a Character-Selector!
         * This is an error.
         * We leave the ByteBuffer unchanged & return an empty Remainder.
         * The CharsetDecoder will produce a MalformedInputException in due course...
         */
        return new byte[0];
    }

    /**
     * Decode the current Chunk of Bytes & append the result to our CB.
     *
     * @return
     * @throws CharacterCodingException
     */
    private int decodeChunk() throws CharacterCodingException {
        try {
            this.bb.flip(); // (limit=position, position=0, mark=-1)

            ;                       this.utf8Decoder.reset();
            final CoderResult res = this.utf8Decoder.decode(this.bb, this.cb, true);

            System.out.println("CB Chars..: " + this.cb.position());
            /*
             * Why on earth is UNDERFLOW the correct result of an error-free Decode?!
             */
            if (res.isUnderflow() == false) {
                res.throwException();
            }
            return this.bb.position();
        }
        catch (final  MalformedInputException e) {
            throw new MalformedInputException     (this.bytesChunked + e.getInputLength());
        }
        catch (final  UnmappableCharacterException e) {
            throw new UnmappableCharacterException(this.bytesChunked + e.getInputLength());
            /*
             * (Famous Last Words "UnmappableCharacterException never occurs with UTF-8 Decoder")
             */
        }
        catch (final CharacterCodingException inputUnderflowOrOutputOverflow) {
            throw                             inputUnderflowOrOutputOverflow;
            /*
             * (Underflow if the final Character of the final Chunk was incomplete)
             * (Overflow  if the Output Buffer is too small, which SHOULD NOT HAPPEN with our big CB)
             */
        }
    }

    /**
     * Some Debug Writes.
     *
     * @param debugText
     * @param includeRemainder
     */
    private void debugBytesIn(final String debugText, final boolean includeRemainder) {

        System        .out.print(debugText + " previous=" + this.bytesChunked + " bbPos=" + bb.position() + " Bytes.:");

        for (    int p = 0; p < bb.position();         p++) {
            System    .out.print(" " + Integer.toHexString(0xFF & bb.get(p)));
        }
        if (includeRemainder) {
            System    .out.print(" Remainder.:");

            for (int r = 0; r < this.remainder.length; r++) {
                System.out.print(" " + Integer.toHexString(0xFF & this.remainder[r]));
            }
        }
        System        .out.println();
    }

    public static void main(final String[] args) throws IOException {

        final ChunkedUtf8Decoder utf8Decoder = new ChunkedUtf8Decoder(Path.of("Utf8-Chars_nn.txt"));
        ;                        utf8Decoder.decode();

        System.out.println      (utf8Decoder.cb.flip()); // TODO Note.: flip()
    }
}


text:
Q: How to enable or disable a field on value change of another field? <xhtml:html xmlns:xhtml="http://www.w3.org/1999/xhtml"
xmlns:xxforms="http://orbeon.org/oxf/xml/xforms"
xmlns:xforms="http://www.w3.org/2002/xforms">

<xhtml:head>
  <xhtml:title>Orbeon XForms Sample Form</xhtml:title>

  <xforms:model>
     <xforms:instance id="myModel" xmlns="">
    <form>
            <type>

                <radio></radio>
            </type>
            <type>

                <radio></radio>
            </type>
            <type>

                <radio></radio>
            </type>
    </form>
     </xforms:instance>

     <xforms:bind id="radio" nodeset="instance('myModel')/type/radio"/>

  </xforms:model>
</xhtml:head>

<xhtml:body>

            <xforms:repeat nodeset="instance('myModel')/type">

                        <xforms:output ref="position()"/>

                        <xforms:select1 ref="radio" incremental="true" appearance="minimal">
                            <xforms:item>
                                <xforms:label>Please Select</xforms:label>
                                <xforms:value></xforms:value>
                            </xforms:item><xforms:item>
                                <xforms:label>Yes</xforms:label>
                                <xforms:value>Yes</xforms:value>
                            </xforms:item>
                            <xforms:item>
                                <xforms:label>No</xforms:label>
                                <xforms:value>No</xforms:value>
                            </xforms:item>
                            <xforms:alert>Required</xforms:alert>
                        </xforms:select1>

            </xforms:repeat>

</xhtml:body>

</xhtml:html>

In the above form, I want to enable the field based on the value selected on the previous field. For example, if I select Yes in the first dropdown, only then the second dropdown should be enabled. If I select Yes in the second dropdown, only then the third dropdown should be enabled and so on. How can I implement this ? Can I do something in the xforms-value-changed event ? Or can I implement this in xforms:bind ?

A: As you suspected, you can do this with an xforms:bind. The following will do the job in your example:
<xforms:bind id="radio" nodeset="instance('myModel')/type/radio"
    relevant="empty(../preceding-sibling::type)
              or ../preceding-sibling::type[1]/radio = 'Yes'"/>

The most subtle part here is the use of the preceding axis to get the type element that comes just before the current one.


text:
Q: How to get byte[] from SOAPEnvelope response I am  trying to use SOAP service to download a pdf file. There is some issue with the wsdl import, thus the stubs does not have proper method and I am trying to download the file using Apache Axis service invocation method.

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
    <SOAP-ENV:Header/>
    <SOAP-ENV:Body>
        <ns2:getFileStreamResponse xmlns:ns2="http://spring.io/guides/gs-producing-web-service">
            <ns2:FileByteStream>L1VzZXJzL3BrdW1hci9Eb2N1bWVudHMvTmFyZW5kcmFTaW5naC5wZGY=</ns2:FileByteStream>
        </ns2:getFileStreamResponse>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

This is the java code I am trying to use.

  String SOAP_REQUEST = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"\n" +
          "\t\t\t\t  xmlns:gs=\"http://spring.io/guides/gs-producing-web-service\">\n" +
          "   <soapenv:Header/>\n" +
          "   <soapenv:Body>\n" +
          "      <gs:getFileStreamRequest>\n" +
          "         <gs:id>12313</gs:id>\n" +
          "         <gs:token>Ratakkdajd</gs:token>\n" +
          "         <gs:path>/Users/pkumar/Documents/NarendraSingh.pdf</gs:path>\n" +
          "      </gs:getFileStreamRequest>\n" +
          "   </soapenv:Body>\n" +
          "</soapenv:Envelope>";

    String HOST_ADDRESS = "http://localhost:8080/ws";

    SOAPEnvelope resp = null;
    try {
        byte[] reqBytes = SOAP_REQUEST.getBytes();
        ByteArrayInputStream bis = new ByteArrayInputStream(reqBytes);
        StreamSource ss = new StreamSource(bis);
        MessageFactoryImpl messageFactory = new MessageFactoryImpl();
        SOAPMessage msg = messageFactory.createMessage();
        SOAPPart soapPart = msg.getSOAPPart();
        soapPart.setContent(ss);
        Service service = new Service();
        org.apache.axis.client.Call call = (org.apache.axis.client.Call)service.createCall();
        call.setTargetEndpointAddress(HOST_ADDRESS);
        call.setProperty(call.CHECK_MUST_UNDERSTAND, false);
        resp = call.invoke(((org.apache.axis.SOAPPart)soapPart).getAsSOAPEnvelope());
        byte[] output = resp.getBodyElements().get(0).toString().getBytes();
        return output;

    } catch (Exception ex) {
        throw new Exception(ex.getMessage());
    }

I can not find a way to get byte[] FileByteStream from the SOAPEnvelope resp. Does any one experience with using SOAP api like this and created file.
If the wsdl import worked correctly I could have easily downloaded the file using this code
CountriesPortServiceLocator locator = new CountriesPortServiceLocator();
CountriesPort service = locator.getCountriesPortSoap11(new URL("http://localhost:8080/ws"));
GetFileStreamRequest request = new GetFileStreamRequest(123,
        "321323",
        "remote_file_path.pdf");
GetFileStreamResponse response = service.getFileStream(request);

byte[] fileStream = response.getFileByteStream();
new FileOutputStream("output.pdf").write(fileStream);

A: After going about it for days, A nice guy from the client helped me out with the solution.
the SOAPEnvelope class supports DOM like methods using which we can navigate to the result tag (fileByteStream) and the string representation in the text node is actually encoded Byte64, thus we need to decode it back to get the original byte[].

//Invoke the WebService.
SOAPEnvelope resp = call.invoke(((org.apache.axis.SOAPPart) soapPart).getAsSOAPEnvelope());
//Extract and decode the fileStream from the response
byte[] output = Base64.decode(resp.getBody().getElementsByTagName("FileByteStream").item(0).getLastChild().getNodeValue());


text:
Q: Database sync solutions for Delphi I am looking for some starting points integrating a Win32 Delphi application's data with a remote database for a web application.
Problem(s) this project intends to solve:
1) The desktop does not perform well over vpns.  Users in remote office could use the web app instead.
2) Some companies prefer a web app to the desktop app
3) Mobile devices could hit the web app as a front end.
Issues I've identified:
Web application will run on a Unix based system, probably Linux while the desktop application uses NexusDB while the web application will likely be Postgres.  Dissimilar platforms and databases.
Using Delphi it appears the Microsoft Sync Framework is not available for this project.
My first thought was to give the web app your standard REST API and have the desktop app hit the API as though it's a client every n-minutes from the local database server.  Tons of issues I see with this already!

A: Richard, I have been down this path before and all I can say is DON'T DO IT!  I use to work for a company that had a large Delphi Desktop Application (over 250 forms) running on DBISAM (very similar to what you have).  Clients wanted a "Web" interface so people could remotely work and then have the web app and desktop app synch changes.  Well, a few years later and the application was horrible - data issues and user workflow was terrible because managing the same data in two different places is a nightmare.
I would recommend moving your database to something like MySQL (Delphi and Web Client both hit) and use one database between the two interfaces.  The reason the Delphi client is not working well over the VPN is because desktop databases like NexusDB and DBISAM copy way to much data over the pipe when it runs queries  (pulls back all the data and then filters/orders, etc)- it not truly client / server like SQL Server or MySQL where all the heavy lifting is being done on the server and only the results come back.  Of course, moving the Delphi app to DB like MySQL could eleviate speed issues all together - but you don't solve #2 and #3 with that.
Another option is to move the entire application to the web and only have 1 application to support.  Of course, a good UI developer in a tool like Delphi can always make a superior user interface to a web app - especially in data-entry heavy applications  - so that may not be an option for you.
I would be very weary of "synching data".
My 2 cents worth.
Mike

A: If you use a RESTful based ORM, you could have both for instance AJAX and Client Delphi applications calling the same Delphi server, using JSON as transmission format, HTTP/1.1 as remote connection layer, Delphi and Javascript objects to access the data.
For instance, if you type http://localhost:8080/root/SampleRecord in your browser, you'll receive something like:
[{"ID":1},{"ID":2},{"ID":3},{"ID":4}]

And if you ask for http://localhost:8080/root/SampleRecord/1 you'll get:
{"ID":1,"Time":"2010-02-08T11:07:09","Name":"AB","Question":"To be or not to be"}

This can be consumed by any AJAX application, if you know a bit about JavaScript.
And the same HTTP/1.1 RESTful requests (GET/POST/PUT/DELETE/LOCK/UNLOCK...) are already available in any Client HTTP/1.1 application. The framework implements the server using the very fast kernel-mode http.sys (faster than any other HTTP server on Windows), and fast HTTP API for the client. You can even use HTTPS to handle a secure connection.
IMHO, using such an ORM is better than using only a database connection, because:

*

*It will follow more strictly the n-Tier principle: the business rules are written ONCE in the Delphi server, and you consume only services and RESTful operations with business objects;

*It will use HTTP/1.1 for connection which is faster, more standard across the Internet than any direct database connection, and can be strongly secured via HTTPS;

*JSON and RESTful over HTTP are de-facto standard for AJAX applications (even Microsoft uses it for WCF);

*The data will be transmitted using JSON, which is a very nice format for multiple front-end;

*The Stateless approach makes it very strong, even in unconnected mode;

*Using a local small replication of the database (we encourage SQLite for this) allow you to have client access in unconnected mode (for Delphi client, or for HTML 5 clients).

A: I recommend you have one database, and two front ends (web UI that calls SOAP methods for its back end work, and a SOAP method call based rich client in Delphi, and a SOAP server tier that implements SOAP accessible methods which contains your business logic).
From what you're describing, you think replication will merely speed you up, but what it will do instead, is slow you down and cause you to have replication, coherence, and relational integrity problems that must be sorted out by hand (by you).

A: Take a look at this

CopyCat is a database replication
  engine, written as a component set for
  Embarcadero Delphi. CopyCat has been
  in production use since 2004, and is
  very stable. It is relied upon daily
  by a number of small to large
  businesses for applications ranging
  from inter-site synchronization,
  itinerant work, database backup and
  more. We are confident that it can
  fulfill your needs as well. Read on...


text:
Q: Query Regarding Roots of Discriminant Suppose I have an equation $x^2+kx+k$ and the required condition for its roots is $D=0$. After splitting the middle term we obtain $k(k-4)=0$. By the rules, the factors are $k=0,4$ but what if I transposed the '$k$' towards $0$ making the equation $k-4= \left(\frac{0}{k}\right) \implies k-4=0$, thus $k=0$.
Why can't this be the correct answer as $4$ will be the two equal roots.

A:
But what if I transposed the '$k$' towards $0$ making the equation $k-4= \left(\frac{0}{k}\right) \implies k-4=0$

With "transposing the $k$" I assume you're trying to solve this equation by dividing both sides by $k$. But remember that you cannot divide by $0$, so this step is only valid if $k \ne 0$. You can check this case separately and notice that $k=0$ indeed satisfies the original equation so it is a solution too.

$k-4= \left(\frac{0}{k}\right) \implies k-4=0$, thus $k=\color{red}{0}$.

Here I think you mean "thus $k=\color{blue}{4}$"? You "lost" the solution $k=0$ but you still get $k=4$.


text:
Q: Extract XML tag data based on attributes of a different tag I'm working with xml.etree to parse a few enormous XML files that I need to import into a database with Python, but for some reason I can't figure out how I can extract a specific tag based on an attribute of a different tag
For example, in this piece of XML included below, I need to extract the text of the  tags that are under the NicamWarningCS  tags, and put both of them in a single list. Any suggestions on how to achieve this?
<Main xmlns:mpeg7="urn:mpeg:mpeg7:schema:2001" xmlns="urn:tva:metadata:2004">
  <ProgramDescription>
    <ProgramInformationTable>
      <ProgramInformation programId="123456">
        <BasicDescription>
           <Genre href="urn:tva:metadata:cs:2004:2.4">
             <Name xml:lang="NL"><![CDATA[Film]]></Name>
           </Genre>
           <Genre href="urn:po:metadata:cs:GenreCS:2009:4" type="other">
             <Name xml:lang="NL"><![CDATA[Film]]></Name>
           </Genre>
           <Genre href="urn:po:metadata:cs:NicamWarningCS:2007:t">
             <Name xml:lang="NL"><![CDATA[Grof taalgebruik]]></Name>
           </Genre>
           <Genre href="urn:po:metadata:cs:NicamWarningCS:2007:g">
             <Name xml:lang="NL"><![CDATA[Geweld]]></Name>
           </Genre>
           <Genre href="urn:po:metadata:cs:GenreCS:2009:23" type="other">
             <Name xml:lang="NL"><![CDATA[Biography/Drama/History]]></Name>
           </Genre>
         </BasicDescription>
       </ProgramInformation>
     </ProgramInformationTable>
   </ProgramDescription>
 </Main>

A: Here is a detailed procedure of what I'd do :
import xml.etree.ElementTree as ET

# 1. Parse your xml file
tree = ET.parse('your.xml')

# 2. Get the root
root = tree.getroot()

# 3. Set the tag and attribute you are looking for
ns = 'urn:tva:metadata:2004'
matchTag = 'NicamWarningCS'

# 4. retrieve all Genres
genres = root.find('{%s}ProgramDescription' % ns) \
    .find('{%s}ProgramInformationTable' % ns) \
    .find('{%s}ProgramInformation' % ns) \
    .find('{%s}BasicDescription' % ns) \
    .findall('{%s}Genre' % ns)

# 5. filter them in order to get just the Names of the ones that match your matchTag : 'NicamWarningCS'
filteredGenreNames = [genre.find('{%s}Name' % ns) for genre in genres if matchTag in genre.get('href')]

# 6. extract the text of the tags
data = [t.text for t in filteredGenreNames]

print(data)
# ['Grof taalgebruik', 'Geweld']

A: Just get all Genre elements and filter the ones that have an href attribute you're interested in:
ns = 'urn:tva:metadata:2004'
all_genres = fromstring(xml) \
    .find('{%s}ProgramDescription' % ns) \
    .find('{%s}ProgramInformationTable' % ns) \
    .find('{%s}ProgramInformation' % ns) \
    .find('{%s}BasicDescription' % ns) \
    .findall('{%s}Genre' % ns)
some_genres = [g for g in all_genres if 'NicamWarningCS' in g.get('href')]

A: I wasn't able to get Erik's answer quickly up and running, but it hinted me in the direction of a different solution that managed to solve my problem.
By creating a dict with all genres in it, I was able to filter out all the Nicam warnings and add them to a list which I could then use to populate my SQL statements:
genreitemdict = dict()
for genreitem in program.iter("{urn:tva:metadata:2004}Genre"):
    for child in genreitem:
        genreitemdict[genreitem.attrib['href']] = child.text
        NicamWarningCS = [v for k, v in genreitemdict.items() if 'NicamWarningCS' in k]
print NicamWarningCS

It might not be the nicest solution, but for now this will do.


text:
Q: Removing google translate icon on .chm pages I have a large number of (300+) help pages.  The web version should display the Google Translate dropdown menu, but when these same files are used offline (in Windows help .chm files) the dropdown should be hidden.  Obviously I would not want to maintain two separate help files.
So I have my Google Translate code inside a  called  and created a style sheet that tells the page whether or not to show the translate dropdown (web) or hide it (local file).  This works pretty well, except that I get the Google Translate icon on my local .chm files.
Like I said, the dropdown is not displaying on these local pages, just as expected, but how can I get rid of the icon?  Interesting, too, that this image (untitled.png) shows up with or without the style sheet enabled.
BTW, I am talking about the bigger, blue image, not the Google"G" right in front of the dropdown.
without dropdown
with dropdown
Thanks for your time!

A: You can ensure that the CSS files are compiled into the help file by adding their names to the [FILES] list in the project (.hhp) file in two ways.
You may add the *.css filename(s) by editing the *.hhp file with a plain text editor or to do this with HH Workshop:

*

*Open the .hhp file in HTML Help Workshop.

*Click the Add/Remove Topic Files button on the Project tab.

*In the Topic Files dialog box, click Add.

*In the File Name field at the bottom of the Open dialog box, type *.css (or e.g. *.jpg)

*Browse to the directory that contains the files (or e.g css), and then select them.

*Click Open, and then click OK to close the Topic Files dialog box.

Additional information:
The help compiler automatically pulls into the help file all graphics that are referenced in  elements via the "src=" attribute. For graphics that are referenced by other means, such as in a script or style sheet, you must use the above workaround to ensure that they are compiled into the .chm file


text:
Q: Speed up pandas iteration with multiple excel sheets I have an excel file with 1000 sheets and each sheet contain a dataframe. In order to feed my model with these data, I try to convert it to 1000 batches of tensors and here's my code:
df = pd.read_excel('file.xlsx', sheet_name=None)
file_names = list(df.keys())

columns = ['A','B','C']
features = []
labels = []
for n in file_names:
  df = pd.read_excel('file.xlsx', sheet_name=n)
  features.append(df[columns].to_numpy())
  labels.append(df['D'].to_numpy())

Y = tf.convert_to_tensor(np.stack(labels), dtype=tf.float32)
X = tf.convert_to_tensor(np.stack(features), dtype=tf.float32)
dataset = tf.data.Dataset.from_tensor_slices((X, Y))

My code works fine, but it takes over an hour to iterate it.
I will have more than 1000 batches of data in the future so it seems not a good idea to have several thousand of csv files.
How can I speed up the process?

A: You could retrieve your file.xlsx once, which will read all worksheets into a dictionary of dataframes and then you can get the sheets from that dictionary:
import tensorflow as tf
import pandas as pd
import numpy as np
from random import sample

### Create data
writer = pd.ExcelWriter('file.xlsx', engine='xlsxwriter')
for i in range(1000):
  df = pd.DataFrame({'A': [1, i, 1, 2, 9], 'B': [3, 4, i, 1, 4], 'C': [3, 4, 3, i, 4], 'D': [1, 2, 6, 1, 4], 'E': [0, 1, 1, 0, 1]})
  df.to_excel(writer, sheet_name='Sheet'+ str(i))

writer.save()

df = pd.read_excel('file.xlsx', sheet_name=None)
file_names = list(df.keys())

columns = ['A','B','C']
features = []
labels = []
for n in file_names:
  temp_df = df[n]
  features.append(temp_df[columns].to_numpy())
  labels.append(temp_df['D'].to_numpy())

Y = tf.convert_to_tensor(np.stack(labels), dtype=tf.float32)
X = tf.convert_to_tensor(np.stack(features), dtype=tf.float32)
dataset = tf.data.Dataset.from_tensor_slices((X, Y))

Furthermore, you could try creating your own custom data generator and retrieve random samples from your Excel file, which should also speed things up:
df = pd.read_excel('file.xlsx', sheet_name=None)
file_names = list(df.keys())
columns = ['A','B','C']

def generator_function(samples = 64):
    def generator():
        for n in sample(file_names, samples):
            temp_df = df[n]
            x = temp_df[columns].to_numpy()
            y = temp_df['D'].to_numpy()
            yield x, y
    return generator

gen = generator_function()
dataset = tf.data.Dataset.from_generator(
    generator=gen,
    output_types=(np.float32, np.int32),
    output_shapes=((5, 3), (5))
)
batch_size = 16
dataset = dataset.batch(batch_size, drop_remainder=True)
dataset = dataset.prefetch(tf.data.AUTOTUNE)


text:
Q: WPF: Get DataTemplate element from data context object I have a fairly complex tree of data which I'm displaying in a WPF UserControl and the control is using DataTemplates to create and link various UI elements up to the various data inside the tree. Here's a (very) simplistic example which involves a list of items being display in an ItemsControl sitting on a canvas, and each element is represented with a TextBox:
<ItemsControl.ItemTemplate>
    <DataTemplate>
        <TextBox
            Text="{Binding ...}"
            Canvas.Left="{Binding ...}"
            Canvas.Top="{Binding ...}"
        />
    </DataTemplate>
</ItemsControl.ItemTemplate>

Now an event has occurred inside my UserControl whereby I have a reference to one of the list items and I want to set the focus to the TextBox item behind it. Is there an easy way to get the TextBox element from the data object that its Data Context is bound to? Or do I have to manually walk the entire visual tree myself?
I realize I could put a member inside the data element itself and use triggers to do whatever it is I'm trying to do but in my case it would require an extra layer of abstraction that I'd really like to avoid if at all possible.

A: As you say, if you cannot directly add a member to the item class that you are using, I assume its a built-in type you don't have access to, you must create a proper View Model to access a trigger like
<Trigger Property="IsFocused" Value="True">
    <Setter TargetName="myTextBox" Property="FocusManager.FocusedElement" Value="{Binding IsTextBoxFocused}" />
</Trigger>

It's another layer of abstraction but you will always find it important to use a View Model that you have access to.


text:
Q: launchin programs on windows 10 on different virtual desktops, position them on startup, automatically. How? When Windows starts I want programs A,B,C running on Desktop 1 and they should be positioned in a apecific way like A in Fullscreen on Monitor 1, B and C on Monitor 2 splitted.
On Desktop 2 there should also be running programs with predefined window settings.
This hould happen automatically so that i don't have to reconfigure it by myself after every computer restart.
How can i achieve that?
Are there good 3rd party programs?

A: Virtual Desktops are just a means to organize your daily tasks. Set them up at the beginning of the day and use them as needed.
https://community.windows.com/en-us/stories/virtual-desktop-windows-10

We all get sidetracked from time to time. Either through the power of
eye-catching advertising or a promo email from your favorite retailer.
Using virtual desktop in Windows 10 allows you to expand your desktop
beyond the physical limitations of the space, organize groups of
related tasks, and easily switch between  them. Tackling what you want
to—when you want to—just got a whole lot easier.

However virtual desktops do not survive restart:
https://answers.microsoft.com/en-us/insider/forum/insider_wintp-insider_desktop-insiderplat_pc/virtual-desktops-vanish-on-reboot-windows-10/90e49fc8-aae0-4436-ae62-cc41edc1d149

It is expected that any running apps will close at Shutdown. If you
were to use Hibernate instead, they might still be running on each
desktop after powering up again.

Virtual Desktop do not have anything to do with what apps start. All apps started are available in all desktops.  (Just try all your desktops and you will see)

A: A search for "virtual desktop monitors" turned up several discussions.  At first glance I didn't see anything about preconfigured layouts, but I didn't look very far.
Here is an idea you could try.  It uses:

*

*UltraMon,
"a utility for multi-monitor systems, designed to increase productivity and unlock the full potential of multiple monitors."
It is GUI based, but has a shortcut feature which I think may help do what you want
(I don't use UltraMon, so no guarantees).
A saved shortcut specifies an application's full multi-monitor startup configuration,
and can be invoked from a command line.
I have not researched whether there is any other multi-monitor utility with a similar feature.

*VDesk,
a utility for switching to a specified virtual desktop and executing a command there.
For each application:

*

*Create an UltraMon shortcut which starts the application on the desired monitor with desired window size, position, etc.

*Save the UltraMon shortcut as a Windows shortcut (.lnk file).

*Use VDesk to run the Windows shortcut on the desired virtual desktop.

Collect the VDesk commands into a script, such as:
vdesk on:2 run:"Notepad on monitor 3.lnk"
timeout /t 5
vdesk on:3 run:"Firefox on monitor 1.lnk"
timeout /t 45
...

The timeout commands give each application time to open its window(s) before the next VDesk command switches desktops again.  You will have to find the right duration by experiment.  For example, my Firefox startup can take some 40 seconds if it decides to auto-update, but usually its windows open sooner and I can tap a key to move on.
I prefer to run my startup script manually, after dealing with the aftermath of any Windows updates during restart.  However, you could invoke it from Task Scheduler or your Windows Startup folder if desired.
You can search SuperUser.com for more discussions of VDesk and UltraMon.


text:
Q: Does the 'unibody' design of the MB/MBP actually help increase the strength of the MBP/MB? I've seen and used many laptops, and one of my favorites is the MacBook Pro. It has a nice, clean design - but most of all, it seems quite sturdy.
Allegedly, this is due to the "unibody" design. However, I own a Dell Inspiron 1545 which is even stronger - I dropped it several times in multiple ways, see comment on accepted answer - and it is most definitely not unibody - in fact, it is the polar opposite. Almost every part of it can come apart.
Does the unibody design of the MacBook Pro and MacBook contribute at all to this strength, or is this strength from other factors, like the aluminum?
Please note: This is different from How tough is the aluminum body of a MacBook?. That question asks how strong the aluminum body is; I'm asking if the unibody design has anything to do with that strength or if 'unibody' is just a marketing term.

A: There are some basic approaches to making a laptop as strong as it needs to be. One is the internal chassis, IBM Thinkpads (pre-Lenovo) were famous for having a cast magnesium chassis along with a metal skin - they defined "business class" and were much imitated. Another is the Toughbook approach. Another is unibody. If size and weight did not matter we'd probably all carry Toughbook-style machines because they're, ah, tough. Big rubber bumpers everywhere are pretty good protection, but unibody is the nicest compromise between toughness and size/weight. You get more toughness for a given size and weight by combining the skin with the chassis.
Before its introduction in laptops the idea of a monocoque design was well known in aircraft, automobiles, even armoured vehicles and rockets. Ignoring the structural strength of the skin material and relying on the strength of an internal chassis wastes weight. By using the skin for structure as well, there is no wasted space or weight. By making the skin a single rigid piece, structural integrity (not to mention appearance) is not harmed by joins or fasteners. By machining out what is unnecessary only, the case can be left stronger (thicker) where it matters, at the stress points. Cheaper laptops of a few years ago would flex and creak if not picked up with two hands, just the weight of the parts inside would cause the skin to deform. I can't flex my MBP 15" at all, not even if I grab the sides and try to twist.
All materials being equal this design is responsible for the strength of the machine. As a material, aluminium (you may know it as aluminum) is desirable because:

*

*it is easy to source and relatively cheap

*it is easy to treat for surface toughness (anodizing)

*it is relatively light and strong

*it is easy to machine

*what is machined away is easy to recycle simply by sweeping the floor and re-casting

Additionally, unibody design can actually reduce cost by reducing the amount of parts in the laptop, by reducing the number of assembly steps and opportunities for failure during and after the manufacturing process.
The video here, at Apple's MacBook Pro page is the usual stuff with a lot of sexy shots of perfectly arranged MacBook Pros, you've seen it before. But the segments with huge billets of aluminium being extruded and then machined into unibody components are just incredible so watch it all!
"In many ways I think it's more beautiful internally than externally" - Sir Jony Ive.

(How do you know the Dell is even stronger? Destructive test results with photos, please :-)

A: Yes - unibody design offers more strength at the same weight.
The idea of unibody design is not very new and not limited to manufacturing processes of the modern industry.
E.g. you can find unibody-like designs in furniture quite often. An example is crafting a chair out of once piece of wood - or at least the same tree. This has several advantages:

*

*all parts of the cover have the same thermal coefficient of expansion

*all parts of the cover have the same heat conducting coefficient

Those two points especially matter in the design of the portable Macs. They 'suffer' from extreme variations in temperatures which stresses the material. Unibody design causes the whole cover to expand at the same rate and thus avoids unpleasant side effects:

*

*Just little divergences can cause a bottom piece to not exactly fit a connected side piece. This creates tensions to the construction's edges and may result in unpleasant squeaking noises when you touch the device as attacking forces does not get distributed evenly over the whole construction.

In the unibody design, pieces are connected at the lowest level possible, making them...

*

*torsion-resistant

*stiff

*more stable at the same weight than a modular design for the body frame

*higher customizable design (no limitations for connecting elements)

A: Look at nature.  A lobster has an exoskeletal structure (shell is both skin and structure) while a mouse has an internal structure, where the skin has little structural value.
The lobster will not survive a long fall onto a hard surface without cracking its skin, but the mouse might survive from that same distance.
The mouse will not survive a certain steady weight placed on top of it, but the lobster might.
Each structure has its own benefits, and you can't strictly say that one is stronger than another.
If your environment involves a lot of falls and dropping, it's possible for one style of laptop architecture to survive better than another.  If it involves being placed in a bookbag with 40 pounds of books on top, it might survive better with one architecture than another.
Neither base structure is better, stronger, or worse in every environment.  The designers can, of course, take a little from both (and other) structure basics, and attempt to find a moderate solution that provides enough strength for all scenarios they believe their products will be subject to, but they all involve tradeoffs.
The unibody design is the strength of the macbook line.  Being machined from a solid billet of aluminum means you get better flexibility than cast aluminum (ie, less brittle), and the fact that the skin is thicker than the skin on most laptops lends additional strength.
However, Apple does this primarily for looks, and they have made many tradeoffs to increase the laptop's appeal.  For instance, the screen has very little protection, and the aluminum flexes enough that the screen may break under the wrong impact.  Laptops with a different structure can protect the screen better.  Not because the unibody design is inherently weaker, but the way Apple implemented that design to increase appeal at the cost of robustness means that Apple's overall design is weaker for that particular use case or environment.


text:
Q: distributed lock with zookeeper. how to avoid repeatly check the min node As we know that when implementing a distributed lock with Zookeeper and to avoid "herd effect", we will set watcher on the next lowest sequence number node. So, once the node is deleted , we can be notified immediately.
If the connection to lowest sequence number node is broken unexpectedly, we will check the nodes for a new "next lowest sequence number node" and set watcher on it.
But if the connection to this new founded node is broken now, we have to checkout the nodes for node we set watcher, again and again.
So, is there any solution to avoid this situation?


text:
Q: Weird Pandas dataframe and seaborn boxplot bugs Here's the dataset :
1.1;1.2;1.3;2.1;2.2;2.3;2.4;3.1;3.2;3.3;3.4;4.1;4.2;4.3;5.1;5.2
1;1;-;1;1;1;-;1;1;2;-;-;1;-;-;-
6;6;5;6;6;6;6;4;3;2;3;6;0;5;5;2
2;1;1;1;1;2;1;1;1;1;1;1;1;1;1;1
4;1;2;4;1;2;-;2;1;-;1;-;-;1;-;-
1;1;-;1;-;1;-;-;1;-;-;-;-;-;-;-
0;0;0;1;2;0;0;0;0;1;1;0;0;0;0;0
1;1;1;1;0;1;1;1;1;2;1;1;-;-;-;-
0;1;1;1;-;0;-;-;0;-;-;-;-;-;-;-
2;0;-;0;1;-;-;0;1;-;1;-;-;-;-;-
-;1;1;1;-;1;-;-;1;-;-;-;-;1;-;-
2;1;1;1;1;1;1;1;1;-;1;1;-;1;-;-
0;2;-;4;1;1;-;1;0;-;0;-;-;0;-;-
0;-;-;1;1;2;1;-;-;-;-;-;-;-;1;-
1;1;2;1;1;1;1;1;1;2;1;1;1;1;1;1
1;1;1;1;1;1;-;1;1;1;1;1;0;1;-;-
2;1;1;1;1;1;-;1;1;-;1;1;-;-;-;-
3;3;1;0;2;1;0;1;1;0;0;1;0;1;1;0
3;4;-;2;1;-;-;1;1;-;1;1;-;-;-;-
4;1;1;1;3;2;3;1;1;2;1;1;2;0;4;4

Here's the code:
import csv
import glob
import re
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns

files = glob.glob(f"session*C.csv")

# load dataset with pandas
df = pd.read_csv(files[0], sep = ';')

# replace "-" data with 0
dfs = df.replace(r'^-$', 0, regex=True)

print(dfs)

# Seaborn boxplot
sns.set_style('darkgrid')
fig, ax = plt.subplots(figsize=(9, 10))

sns.boxplot(data=dfs, orient="h", ax=ax)

plt.show()

Two weird bugs here:

*

*Boxplot only outputs column 2.1.

*Dataframes df and dfs exhibit a weird one-space column before column 2.1, the one that gets plotted!

The code works perfectly fine with other datasets. I searched and tested things for hours.


text:
Q: Can this system of linear equations have infinite solutions? $ax_1 + bx_2 + 2x_3 = 1$
$x_1 + x_2 + x_3 = 1$
I'm fairly sure that I cannot, however my exam prep question seems to suggest that it might (perhaps it's poorly worded).

A: It can have infinitely many solutions (e.g. When $a=1, b=1$) and it can also have NO solution e.g. When $a=2, b=2$.
For the case $a=1, b=1$, the solution set is given by $(t,1-t,0)$, where $t$ is any real number.


text:
Q: How to transfer menu between pages in Visual Studio C# project I'm new to C#, and am trying to make a multi-page program with a GUI in Visual Studio. Ideally, I'd like to create some kind of nav-bar with menu options like "Home", "FAQ", "Register", etc. Is it necessary for me to re-create this structure for each distinct page? Is there a way to transfer some kind of menu between pages - so for example, the "Home" and "FAQ" pages both display the navigational menu?
Any help/info would be appreciated, cheers!


text:
Q: Is there a word describing the activity of killing somebody with a knife? I am looking especially for a verb.

A: stabbing
or fatal stabbing
From oxford

An act or instance of wounding or killing someone with a knife:

A: Gore:

transitive verb   :
  to pierce or wound with something pointed (as a horn or knife)

Origin of GORE
Middle English, probably from gore spear, sword, from Old English gār
  spear First Known Use: 15th century
merriam-webster.com

A: knifing him to death/demise
perhaps ... ?

Yvonne Strahovski 65 Success Facts - Everything you need ... Christine
  Gallegos - 2014
However, Logan comes foremost and challenges the Sheikh, disclosing
  him that the images are bogus and then knifing him to demise.


text:
Q: how to get 50 largest files in directory CMD If I run in CMD
dir /od
I get sorted files by length. But now, do anyone know what is a command to get the 50 largest file?
Thank you so much for help.
Branka

A: This combined command could satisfy you.
du -a /od | sort -n -r | head -n 50

du
--all  -a                 (Write size for all files)

sort
--numeric-sort  -n  (Compare string numerical value)
--reverse  -r                      (Reverse results)


text:
Q: How do I solve this code signing error when building iOS app?
CopySwiftLibs /Users/admin/Library/Developer/Xcode/DerivedData/testtt-crjmujkhpfhokjabtvhimrwqyhod/Build/Products/Debug-iphoneos/testtt.app (in target: testtt)
    cd /Users/admin/Desktop/desktop/projects/testtt
    export CODESIGN_ALLOCATE=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate
    export DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer
    export SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk
    builtin-swiftStdLibTool --copy --verbose --sign 24177DC0179155D95B9619ABA2C4EEE5017D157F --scan-executable /Users/admin/Library/Developer/Xcode/DerivedData/testtt-crjmujkhpfhokjabtvhimrwqyhod/Build/Products/Debug-iphoneos/testtt.app/testtt --scan-folder /Users/admin/Library/Developer/Xcode/DerivedData/testtt-crjmujkhpfhokjabtvhimrwqyhod/Build/Products/Debug-iphoneos/testtt.app/Frameworks --scan-folder /Users/admin/Library/Developer/Xcode/DerivedData/testtt-crjmujkhpfhokjabtvhimrwqyhod/Build/Products/Debug-iphoneos/testtt.app/PlugIns --platform iphoneos --toolchain /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain --destination /Users/admin/Library/Developer/Xcode/DerivedData/testtt-crjmujkhpfhokjabtvhimrwqyhod/Build/Products/Debug-iphoneos/testtt.app/Frameworks --strip-bitcode --resource-destination /Users/admin/Library/Developer/Xcode/DerivedData/testtt-crjmujkhpfhokjabtvhimrwqyhod/Build/Products/Debug-iphoneos/testtt.app --resource-library libswiftRemoteMirror.dylib --strip-bitcode-tool /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/bitcode_strip --emit-dependency-info /Users/admin/Library/Developer/Xcode/DerivedData/testtt-crjmujkhpfhokjabtvhimrwqyhod/Build/Intermediates.noindex/testtt.build/Debug-iphoneos/testtt.build/SwiftStdLibToolInputDependencies.dep

Requested Swift ABI version based on scanned binaries: 6
libswiftCoreGraphics.dylib is up to date at /Users/admin/Library/Developer/Xcode/DerivedData/testtt-crjmujkhpfhokjabtvhimrwqyhod/Build/Products/Debug-iphoneos/testtt.app/Frameworks/libswiftCoreGraphics.dylib
libswiftCoreImage.dylib is up to date at /Users/admin/Library/Developer/Xcode/DerivedData/testtt-crjmujkhpfhokjabtvhimrwqyhod/Build/Products/Debug-iphoneos/testtt.app/Frameworks/libswiftCoreImage.dylib
libswiftFoundation.dylib is up to date at /Users/admin/Library/Developer/Xcode/DerivedData/testtt-crjmujkhpfhokjabtvhimrwqyhod/Build/Products/Debug-iphoneos/testtt.app/Frameworks/libswiftFoundation.dylib
libswiftDarwin.dylib is up to date at /Users/admin/Library/Developer/Xcode/DerivedData/testtt-crjmujkhpfhokjabtvhimrwqyhod/Build/Products/Debug-iphoneos/testtt.app/Frameworks/libswiftDarwin.dylib
libswiftUIKit.dylib is up to date at /Users/admin/Library/Developer/Xcode/DerivedData/testtt-crjmujkhpfhokjabtvhimrwqyhod/Build/Products/Debug-iphoneos/testtt.app/Frameworks/libswiftUIKit.dylib
libswiftos.dylib is up to date at /Users/admin/Library/Developer/Xcode/DerivedData/testtt-crjmujkhpfhokjabtvhimrwqyhod/Build/Products/Debug-iphoneos/testtt.app/Frameworks/libswiftos.dylib
libswiftObjectiveC.dylib is up to date at /Users/admin/Library/Developer/Xcode/DerivedData/testtt-crjmujkhpfhokjabtvhimrwqyhod/Build/Products/Debug-iphoneos/testtt.app/Frameworks/libswiftObjectiveC.dylib
libswiftQuartzCore.dylib is up to date at /Users/admin/Library/Developer/Xcode/DerivedData/testtt-crjmujkhpfhokjabtvhimrwqyhod/Build/Products/Debug-iphoneos/testtt.app/Frameworks/libswiftQuartzCore.dylib
libswiftCoreFoundation.dylib is up to date at /Users/admin/Library/Developer/Xcode/DerivedData/testtt-crjmujkhpfhokjabtvhimrwqyhod/Build/Products/Debug-iphoneos/testtt.app/Frameworks/libswiftCoreFoundation.dylib
libswiftDispatch.dylib is up to date at /Users/admin/Library/Developer/Xcode/DerivedData/testtt-crjmujkhpfhokjabtvhimrwqyhod/Build/Products/Debug-iphoneos/testtt.app/Frameworks/libswiftDispatch.dylib
libswiftCore.dylib is up to date at /Users/admin/Library/Developer/Xcode/DerivedData/testtt-crjmujkhpfhokjabtvhimrwqyhod/Build/Products/Debug-iphoneos/testtt.app/Frameworks/libswiftCore.dylib
libswiftMetal.dylib is up to date at /Users/admin/Library/Developer/Xcode/DerivedData/testtt-crjmujkhpfhokjabtvhimrwqyhod/Build/Products/Debug-iphoneos/testtt.app/Frameworks/libswiftMetal.dylib
libswiftRemoteMirror.dylib is up to date at /Users/admin/Library/Developer/Xcode/DerivedData/testtt-crjmujkhpfhokjabtvhimrwqyhod/Build/Products/Debug-iphoneos/testtt.app/libswiftRemoteMirror.dylib
Probing signature of /Users/admin/Library/Developer/Xcode/DerivedData/testtt-crjmujkhpfhokjabtvhimrwqyhod/Build/Products/Debug-iphoneos/testtt.app/Frameworks/libswiftCoreGraphics.dylib
/usr/bin/codesign -r- --display /Users/admin/Library/Developer/Xcode/DerivedData/testtt-crjmujkhpfhokjabtvhimrwqyhod/Build/Products/Debug-iphoneos/testtt.app/Frameworks/libswiftCoreGraphics.dylib
/Users/admin/Library/Developer/Xcode/DerivedData/testtt-crjmujkhpfhokjabtvhimrwqyhod/Build/Products/Debug-iphoneos/testtt.app/Frameworks/libswiftCoreGraphics.dylib: code object is not signed at all

Codesigning /Users/admin/Library/Developer/Xcode/DerivedData/testtt-crjmujkhpfhokjabtvhimrwqyhod/Build/Products/Debug-iphoneos/testtt.app/Frameworks/libswiftCoreGraphics.dylib
/usr/bin/codesign --force --sign 24177DC0179155D95B9619ABA2C4EEE5017D157F --verbose /Users/admin/Library/Developer/Xcode/DerivedData/testtt-crjmujkhpfhokjabtvhimrwqyhod/Build/Products/Debug-iphoneos/testtt.app/Frameworks/libswiftCoreGraphics.dylib
/Users/admin/Library/Developer/Xcode/DerivedData/testtt-crjmujkhpfhokjabtvhimrwqyhod/Build/Products/Debug-iphoneos/testtt.app/Frameworks/libswiftCoreGraphics.dylib: errSecInternalComponent

error: Failed with exit code 1

A: You must be in Apple's paid developer program to run apps on a physical device. Upgrade to the developer license and re-load your certificate.


text:
Q: How can get last value of form charge in jQuery I am trying to make a form where a customer can choose parson and automatically show the cost depend on parson number. So for that, I used jQuery form change function and calculate the cost inside of the function. My all logic is working ok but the issue is when increasing number then showing multiple costs.
Visual look:

Always I want to show the last one/ updated one
Blow my code:
var adultsSingleChage = 200;
var childrenSingleCharge = 100;
var infantsSingleCharge = 50;

$('#absbt_form input').change(function(){
    var adults = $("#absbt_adults").val();
    var adultsCharge = adults * adultsSingleChage;

    var children = $("#absbt_children").val();
    var childrenCharge = children * childrenSingleCharge;

    var infants = $("#absbt_infants").val();
    var infantsCharge = infants * infantsSingleCharge;

    var totalCharge = adultsCharge + childrenCharge + infantsCharge;

    console.log(totalCharge);

    $('.total_cost').append(totalCharge);

});

I know I did the maximum of logic but for last logic, I'm confused.
How can I just show the last one?

A: append adds new content to existing one - that's the reason of having previous values.
Instead of using append use text:
$('.total_cost').text(totalCharge);

A: The problem is with the code you are appending which means you are adding the text into the element instead of replacing it. You can use the following two methods:

*

*text(): $('.total_cost').text("iota")

*html(): $('.total_cost').html("iota")
Note: Use id selector or with class use $($('.total_cost')[0])

A: Use html(totalCharge) instead of append(totalCharge)


text:
Q: Send complex JavaScript object to ASP.Net MVC Action This seems to be quite a common theme and a few people have given some very constructive answers, but I'm still struggling to get my attempt to work.
The problem is much the same as this one for example, except that I'm only trying to send a single complex object instead of an array.
My controller looks like this:
[AcceptVerbs (HttpVerbs.Put)]
[Authorize]
[JsonFilter(Param="Designer", JsonDataType=typeof(Designer))]
public JsonResult SaveProfile(Designer Profile)
{
    ProfileRepository Repo = new ProfileRepository();

    Designer d = Repo.GetById(Profile.ID);
    d.Comments = Profile.Comments;
    d.DisplayName = Profile.DisplayName;
    d.Email = Profile.Email;
    d.FirstName = Profile.FirstName;
    d.LastName = Profile.LastName;

    Repo.Update(d);

    return Json(Profile);
}

The code for retrieving the page data and posting it looks like this:
    $('#save-profile').click(function () {

        var Profile = {};
        var context = $('#profile-data')[0];

        $('span', context).each(function () {
            Profile[this.id] = $(this).text();
        });

        Profile.ID = $('h3', context).attr('id');
        console.log(Profile);

        //var DTO = { 'Profile': Profile };

        $.ajax({
            type: "PUT",
            url: "/Home/SaveProfile",
            data: { 'Profile': Profile },
            success: function (data) {
                console.log(data);
            }
        });
    });

The object is being correctly created and posted to the server (I've tried using POST and PUT, by the way), the server appears to be receiving an object instance, but the properties are - as usual - all null.
What am I missing?  I've tried using the approach (adapted) from the example question linked above, but still don't seem to be getting any closer to the solution.  Any help appreciated.

A: As it turns out, there's nothing wrong with the ActionResult method itself and neither is there any issue with the JavaScript object or Ajax post.  The problem actually lies in the custom filter that decorates the ActionResult and the parameter being set for its param value.
The following attribute has a parameter of "Designer" set for the name of the parameter I'm trying to pass in.  I've supplied this as both the parameter name and the type.
[JsonFilter(Param="Designer", JsonDataType=typeof(Designer))]

The correct version should be:
[JsonFilter(Param="Profile", JsonDataType=typeof(Designer))]


text:
Q: Will Winter Bash page stick around? Now hats are gone for the year, I was wondering if the winter bash page will stick around?
http://winterbash2013.stackexchange.com/
The reason I ask is, I found a critical bug in Firefox nightly, that shows up on that page:
https://bugzilla.mozilla.org/show_bug.cgi?id=953074
It won't be useful for debugging if it goes 404 pretty soon.

A: The mini-site for Winter Bash will stick around for a short period of time (days, not weeks), then we'll archive it and redirect that site to our Community Promotions Archive, which will contain only screenshots and brief descriptions.


text:
Q: How to hide theme and template details? I am a new one to Magento, How to hide theme details like WordPress in Magento?
Actually, I usually use to hide WordPress with some plugins in the same case is there any plugin for Magento?

A: Although there is no specific plugin or module or service to do so in Magento, but you can rename theme folder name to whatever you want. It will hide actual theme name from front-end users.
Apart from that, when you merge CSS and JS from System > Configuration > Advanced (Developer) > CSS Settings, Magento hides skin paths for JS and CSS files and combines these files into 1 file which is located into media folder.
In this way, you can hide path for CSS and JS files of theme, but still path for theme images can not be made hidden.
If you want to hide those also, you need to use CDN service to host images for theme.
I hope I was clear enough to explain what you asked.


text:
Q: I can't connect to mysqlfabric I can't connect to mysqlfabric on port 32275.
I am connecting on port 3306 to database so all the grants are in place . On port 32275 I get a message

ERROR 1044 (42000): [Fabric] Access denied

for user and in log I can see

[INFO] 1441810699.948011 - MySQL-RPC-Session-4 - User 'john'
  denied access which suggests permissions issue.

I can log in to database if I use
mysql -u fabric -p -h localhost -P 32275

but if I use
mysql -u fabric -p -h host-ip-address -P 32275

I get above error. I can see in netstat that server is listening on that port.
What am I doing wrong ?

A: There are a couple of things to check in the fabric config.
Firstly try disabling RPC authenication until you have it up and running.
[protocol.xmlrpc]
disable_authentication = no

Also check your storage section and test you can connect using these settings.
[storage]
address = 192.168.0.1:3306
user = fabric_store
password = secret
database = mysql_fabric
auth_plugin = mysql_native_password

mysql -u fabric -psecret -h 192.168.0.1 -P 3306 fabric_store


text:
Q: How to build a logit classification table in R when values are deleted...? I'm a french stud and i'm trying to make a classification table on a Logit model.
Problem, R returns me an error when i'm trying to build it, because the lenght of the glm don't match with the lenght of my dependent variable.
What i tried to do... :
1.
>reg4=glm(buyEV3~lvlEtu+typecar1+typecar2+typecar3+bonus+goodForEnv+cheaper+knowEV,data=bdd,family=binomial(link="logit"))
> reg4
[...]
Degrees of Freedom: 230 Total (i.e. Null);  222 Residual
  (85 observations deleted due to missingness)
[...]
>mysteps=step(reg4,buyEV3~lvlEtu+typecar1+typecar2+typecar3+bonus+goodForEnv+cheaper+knowEV,data=bdd,family=binomial(link="logit"))
[...]
> classDF=data.frame(response=bdd$buyEV,predicted=round(fitted(mysteps),0))
    Error in data.frame(response = bdd$buyEV, predicted = round(fitted(mysteps),  :
  arguments imply differing number of rows: 316, 231

2.
> library(QuantPsyc)
> ClassLog(reg4,bdd$buyEV,cut=.5)
Error in table(predict(MOD, type = "response") > cut, resp) :
  all arguments must have the same length

How to fix this problem ?
Thanks a lot :)

A: Refering to attempt 1. Since only complete observations are included in your logistic model "(85 observations deleted due to missingness)" the length of your dependent varable in the original dataset and the number of values supplied by running fitted()will differ by the same amount.
Extracting the dependent variable from observations actually included in the model will do the trick
classDF=data.frame(response=reg4$model$buyEV,predicted=round(fitted(mysteps),0))

Where glmobject$model$variable is what's important in similar situations.


text:
Q: How do I find all the PersonOrGroup fields I can request in my REST API call? I have a list in SharePoint 2013 Online. This list has a column that is a PersonOrGroup type. I'm using REST APIs to retrieve the items of this list, and I want to retrieve all the data for the PersonOrGroup column. I just learned how to expand the PersonOrGroup data to return its fields. How do I find out all the available fields in the PersonOrGroup type? Any links to documentation would be great.
REST call:
<base url>/_api/web/lists/my_list/items?$select=my_col/Name&$expand=my_col

I know a 'Name' field exists, because it is returning the name of the person/group. But I don't know what other fields I can retrieve. Looking at the PersonOrGroup settings through Internet Explorer, I see the following fields in the "Show field" dropdown:

*

*Title

*First name

*Last name

*Organization

*List item

*List item

*ID

*Name (with presence)

*etc.

I imagine these correspond to the fields of the PersonOrGroup type, but how do I reference them in the REST API call? For example, how do I know what to pass in for the 'First name' field? It could be many things like "first_name", "first-name", "firstname", "first%20name", etc.

A: Here is a technique that will work for any lookup type because it goes to the lookup list for the field you're interested in:
You can make a REST request to the /fields endpoint on your list to retrieve some more information about the fields that exist within the list.
For your case, you're interested in fields of the person or group type so you could do something like this (assuming you're in a browser window on your SP site using JavaScript with a reference to jQuery -- but you can satisfy these criterea artificially to check the results yourself if in a different environment):
$.getJSON("/_api/web/lists/getByTitle('yourList')/fields?$filter=TypeDisplayName eq 'Person or Group'")
    .then(function(data) { console.log(data) })
    .fail(function(jqXHR) { console.log(jqXHR.responseText) })

I'm using the browser dev tool consoles so I can see the response objects.
Now inside the data returned from this will have an array containing all of the fields that are of the Person or Group type.
You can use this information to go back to the lists where they lookup data from by finding the LookupList property for that field. Then finally you can go get a request for some items in that list to see the available property names:
$.getJSON("/scratch/_api/web/lists('{guidYouLookedUpFromYourField}')/items")
    .then(function(data) { console.log(data) })
    .fail(function(jqXHR) { console.log(jqXHR.responseText) })

Here are the fields available in my SiteUserInfoList which applies directly to your question:
{
  "odata.type": "SP.Data.UserInfoItem",
  "odata.id": "b09721bb-1505-4f93-ad24-e718fce66c31",
  "odata.etag": "\"1\"",
  "odata.editLink": "Web/SiteUserInfoList/Items(14)",
  "FileSystemObjectType": 0,
  "Id": 14,
  "ContentTypeId": "0x010A0076E50CD586E0514794008EF63DFE0307",
  "Title": "Test User",
  "Name": "i:0#.f|membership|testuser@someone.onmicrosoft.com",
  "EMail": null,
  "MobilePhone": null,
  "Notes": null,
  "SipAddress": null,
  "IsSiteAdmin": false,
  "Deleted": false,
  "UserInfoHidden": false,
  "Picture": null,
  "Department": null,
  "JobTitle": null,
  "FirstName": null,
  "LastName": null,
  "WorkPhone": null,
  "UserName": null,
  "WebSite": null,
  "SPSResponsibility": null,
  "Office": null,
  "SPSPictureTimestamp": null,
  "SPSPicturePlaceholderState": null,
  "SPSPictureExchangeSyncState": null,
  "ID": 14,
  "Modified": "2014-12-09T14:36:37Z",
  "Created": "2014-12-09T14:36:37Z",
  "AuthorId": 9,
  "EditorId": 9,
  "OData__UIVersionString": "1.0",
  "Attachments": false,
  "GUID": "b344f215-0dbe-4732-b5d1-4c29c3b444ab"
}