text:
Q: NoClassDefFoundError when running spray-can I have a multi-module sbt project which uses spray-can as one of its dependencies. Here is what I have in my sbt:
"com.typesafe" % "config" % "1.2.0",
"io.spray" % "spray-routing" % 1.2.0,
"io.spray" % "spray-can" % 1.2.0,
"com.typesafe.akka" %% "akka-actor" % "2.3.11",

I use scala version 2.11.6 and Java 8. When I run my project, I get the following error:
Uncaught error from thread [my-actor-system-akka.actor.default-dispatcher-5] shutting down JVM since 'akka.jvm-exit-on-fatal-error' is enabled for ActorSystem[my-actor-system]
java.lang.NoClassDefFoundError: spray/can/HttpManager$$anonfun$receive$1
    at spray.can.HttpManager.receive(HttpManager.scala:42)
    at akka.actor.ActorCell.newActor(ActorCell.scala:558)
    at akka.actor.ActorCell.create(ActorCell.scala:578)
    at akka.actor.dungeon.FaultHandling$class.finishCreate(FaultHandling.scala:136)
    at akka.actor.dungeon.FaultHandling$class.faultCreate(FaultHandling.scala:130)
    at akka.actor.ActorCell.faultCreate(ActorCell.scala:369)
    at akka.actor.dungeon.FaultHandling$class.faultRecreate(FaultHandling.scala:59)
    at akka.actor.ActorCell.faultRecreate(ActorCell.scala:369)
    at akka.actor.ActorCell.invokeAll$1(ActorCell.scala:459)
    at akka.actor.ActorCell.systemInvoke(ActorCell.scala:478)
    at akka.dispatch.Mailbox.processAllSystemMessages(Mailbox.scala:263)
    at akka.dispatch.Mailbox.run(Mailbox.scala:219)
    at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:397)
    at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
    at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
    at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
    at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
16:04:22.382 [my-actor-system-akka.actor.default-dispatcher-3] ERROR akka.actor.ActorSystemImpl - Uncaught error from thread [my-actor-system-akka.actor.default-dispatcher-5] shutting down JVM since 'akka.jvm-exit-on-fatal-error' is enabled
java.lang.NoClassDefFoundError: spray/can/HttpManager$$anonfun$receive$1
    at spray.can.HttpManager.receive(HttpManager.scala:42) ~[spray-can-1.2.0.jar:na]
    at akka.actor.ActorCell.newActor(ActorCell.scala:558) ~[akka-actor_2.11-2.3.11.jar:na]
    at akka.actor.ActorCell.create(ActorCell.scala:578) ~[akka-actor_2.11-2.3.11.jar:na]
    at akka.actor.dungeon.FaultHandling$class.finishCreate(FaultHandling.scala:136) ~[akka-actor_2.11-2.3.11.jar:na]
    at akka.actor.dungeon.FaultHandling$class.faultCreate(FaultHandling.scala:130) ~[akka-actor_2.11-2.3.11.jar:na]
    at akka.actor.ActorCell.faultCreate(ActorCell.scala:369) ~[akka-actor_2.11-2.3.11.jar:na]
    at akka.actor.dungeon.FaultHandling$class.faultRecreate(FaultHandling.scala:59) ~[akka-actor_2.11-2.3.11.jar:na]
    at akka.actor.ActorCell.faultRecreate(ActorCell.scala:369) ~[akka-actor_2.11-2.3.11.jar:na]
    at akka.actor.ActorCell.invokeAll$1(ActorCell.scala:459) ~[akka-actor_2.11-2.3.11.jar:na]
    at akka.actor.ActorCell.systemInvoke(ActorCell.scala:478) ~[akka-actor_2.11-2.3.11.jar:na]
    at akka.dispatch.Mailbox.processAllSystemMessages(Mailbox.scala:263) ~[akka-actor_2.11-2.3.11.jar:na]
    at akka.dispatch.Mailbox.run(Mailbox.scala:219) ~[akka-actor_2.11-2.3.11.jar:na]
    at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:397) [akka-actor_2.11-2.3.11.jar:na]
    at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260) [scala-library-2.11.6.jar:na]
    at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339) [scala-library-2.11.6.jar:na]
    at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979) [scala-library-2.11.6.jar:na]
    at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107) [scala-library-2.11.6.jar:na]
Uncaught error from thread [inland24-actor-system-akka.actor.default-dispatcher-2] shutting down JVM since 'akka.jvm-exit-on-fatal-error' is enabled for

A: This helped to solve my issue:
"io.spray" %% "spray-routing" % sprayVersion,
"io.spray" %% "spray-can" % sprayVersion,
"com.typesafe.akka" %% "akka-actor" % akkaVersion,
"com.typesafe.akka" %% "akka-slf4j" % akkaVersion,

scalaVersion := "2.11.6"

val sprayVersion = "1.3.3"
val akkaVersion = "2.3.9"


text:
Q: Erro Internal Error Server UID of script is smaller than min_uid Quando eu entro na página que estou desenvolvendo aparece o seguinte erro:

Internal Server Error
UID of script "/home/httpd/html/index.php" is smaller than min_uid
suPHP 0.7.2

Alguém sabe o que pode ser e como resolver?

A: Conforme esta resposta no SOen
Isto parece um problema com o suPHP.

Change the user and group of your script to the user running your
  webserver process. So if you're running an Apache with user www-data
  for example, change to:

Altere o usuário e o grupo do seu script para o usuário que esta rodando o seu processo de servidor web. Por exemplo, se você estiver executando um Apache com o usuário www-data por exemplo, mude para:
chown www-data:www-data /home/.../public_html/index.php

Ou altere todos arquivos de uma vez:
chown -R www-data:www-data /home/.../public_html/

Se você ainda estiver com este problema após mudar o usuário e grupo então provavelmente suPHP esta usando o valor padrão de min_uid = 100, o UID de www-data deve ser menor que 100.
Pra corrigir isto você pode trocar o min_uid nas configurações do suPHP pro correspondente do UID do www-data:
Pra editar:
vi /etc/suphp/suphp.conf

min_uid = <UID of www-data>

Se você não tem acesso SSH e isto for uma hospedagem ou outro tipo de servidor online, talvez você tenha que entrar em contato com o suporte ou com o administrador do servidor.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Looping over yearly named This feels like a very stupid question but is there a simple way to loop over multiple years in names of a dataframe?
My procedure is very simple, I just need to add 3 columns together on a yearly basis:
df$ges_2005 <- df$bKU3_2005 + df$bKUe3_2005 + df$bKSch_2005
df$ges_2006 <- df$bKU3_2006 + df$bKUe3_2006 + df$bKSch_2006
df$ges_2007 <- df$bKU3_2007 + df$bKUe3_2007 + df$bKSch_2007
df$ges_2008 <- df$bKU3_2008 + df$bKUe3_2008 + df$bKSch_2008
df$ges_2009 <- df$bKU3_2009 + df$bKUe3_2009 + df$bKSch_2009
df$ges_2010 <- df$bKU3_2010 + df$bKUe3_2010 + df$bKSch_2010

The latter variables all exist from years 2000-2018 in my dataframe and I was wondering wether I could somehow get way from copy&pasting this code 20 times?

A: One possible solution would look like this:
my_function <- function(df, start = 2000, end = 2018) {
  for(i in start:end) {
    df[[paste0("ges_", i)]] <- df[[paste0("gesbKU3_", i)]] + df[[paste0("bKUe3_", i)]] + df[[paste0("bKSch_", i)]]
  }
  return(df)
}

# my_function(df) -> supply your data frame


text:
Q: How do I specify a hash algorithm in Xamarin? Programmed in Visual Studio 2019 on Windows 10.
RFC 2898 encoding process from a .NET Framowork 4.7.2 project. to Xamarin.Form (.NET Standard 2.0) .
The original processing is as follows
var salt = "abcdefg";
var passWord = "password";
var iterations = 5;
var saltbyte = System.Text.Encoding.UTF8. GetBytes(salt);
var Rfc2898 = new System.Security.Cryptography. Rfc2898DeriveBytes(passWord, saltbyte, iterations, System.Security.Cryptography. HashAlgorithmName.SHA256);

Porting it will result in an error in Xamarin, because you can't specify a hash algorithm. You can't specify a hash algorithm.
var Rfc2898 = new System.Security.Cryptography. Rfc2898DeriveBytes(passWord, saltbyte, iterations);

How do I specify a hash algorithm in Xamarin?
Translated with www.DeepL.com/Translator (free version)

A: It seems like .NET Standard 2.0 doesn't provide the constructor with the HashAlgorithmName argument. It is however present in .NET Standard 2.1. You can easily change your library to use .NET Standard 2.1.
Otherwise, you will have to do that platform specifically instead. Xamarin.iOS and Xamarin.Android do have the constructor available.
So I would create a service to hash your passwords:
public interface IPasswordHasher
{
    byte[] GetHashedPassword(string password, string salt, int keySize);
}

Then implement this on both Android and iOS and register it as a Xamarin.Forms DependencyService instance:
using System.Security.Cryptography;
using System.Text.Encoding;
using Xamarin.Forms;

[assembly: Dependency(typeof(MyAwesomeProject.iOS.Services.PasswordHasher))]

namespace MyAwesomeProject.iOS.Services
{
    public class PasswordHasher : IPasswordHasher
    {
        public byte[] GetHashedPassword(string password, string salt, int keySize)
        {
            var saltbyte = UTF8.GetBytes(salt);
            var rfc2898 = new Rfc2898DeriveBytes(password, saltbyte, 1000, HashAlgorithmName.SHA256);
            return rfc2898.GetBytes(keySize);
        }
    }
}

Then when you need to use it as:
var bytes = DependencyService.Get<IDeviceOrientationService>().GetHashedPassword("password", "abcdefg", 20);

I highly recommend that you use more than 5 iterations for your PBKDF2 key derivation. The default is 1000, the higher the better. Of course on mobile, you may hit a performance limitation, but 5 is way too low.


text:
Q: How to add bold text with CSS? Answers to this question show how to prepend/append text to a HTML element contents using CSS. Is there a way to make the CSS-added text bold without making the original HTML element contents bold as well?

A: Sure:
.OwnerJoe:before {
  content: "Joe's Task:";
  font-weight: bold;
}

A: Try:
#foo:after
{
    content: 'hello!';
    font-weight: bold;
}

Fiddle

A: Try this:

stuff

.test{
border:1px solid #000;
}

CSS:
.test:before {
content: "more stuff";
background:red;
font-weight:bold;
}

Fiddle
All the information was in the link you posted, by the way. You just needed to add the font-weight to the right area.

A: That is of course possible
Just set appropriate styles to your pseudo element.
World

And the CSS:
span:before {
    content: "Hello";
    font-weight: bold;
}

Here's a working JSFiddle.


text:
Q: My observable value is not displayed despite the ngOnInit I apologize first of all for my English which is not good at all. I am asking for your help today, because I am having an incomprehensible problem!
I'm currently on Angular and using .subscribe to track my obsersables.
Here is my component:
export class SiteDetailComponent implements OnInit {

public test1 : ISite = <ISite>{};
public test2: ISite[] = [];

public errMsg : string = "";
constructor(...)

ngOnInit() {
const id : number = Number(this.route.snapshot.paramMap.get('id'));

this.SiteListeService.getSiteById(id).subscribe({
  next: site => {
    this.test1 = site;
  },
  error: err => this.errMsg = err
});

this.SiteListeService.getSites().subscribe({
  next: sites => {
    this.test2 = sites;

  },
  error: err => this.errMsg = err
});

As you can see I made a .subscribe on 2 Observable: this;SiteListeService.getSites() and this.SiteListeService.getSiteById(id), here is the service concerned (which I have imported the constructor).
public getSites(): Observable<ISite[]> {
return this.http.get<ISite[]>(this.HOTEL_API_URL + "test/").pipe(
  tap(test2 => console.log('test2 : ', test2)),
  catchError(this.handleError)
);
}

public getSiteById(id : number): Observable<ISite> {
  return this.http.get<ISite>(this.HOTEL_API_URL + "test/" + id).pipe(
    tap(test1 => console.log('test1 : ', test1)),
    catchError(this.handleError)
  );
}

The problem being that the test1 variable that I use in my .html does not want to be displayed, here is the example:

{{ test1.nom }}

On the other hand my test2 variable that I use in the same .html works, example:

{{ t2.nom }}

What I don't understand is why one displays and the other does not! I however put both in the ngOnInit() so that it is treated in priority!
in my service I made a console.log of what my https requests return to me, and everything is working correctly...
This is what the google chrome console shows me :

I hope I have provided you with all the necessary information, sorry if my words are not correct I am not a professional. Thank you in advance for reading!

A: Assuming that the service method getSiteById was on line 30 when you got the log entries from your message, the http request is returning an array:

Your functions are expecting an object instead. So when you assign your variable test1 here:
   this.test1 = site;

it becomes an array with a single element.
There are a few option to resolve this:

*

*change it to get the first element

   this.test1 = site[0];

*this could also be done at the service function

public getSiteById(id : number): Observable<ISite> {
  return this.http.get<ISite[]>(this.HOTEL_API_URL + "test/" + id).pipe(
    map(data => data[0]),
    catchError(this.handleError)
  );
}

*change your BackEnd for this request so it return the element and not an array.


text:
Q: Como modelar de uma forma correta problema de RH? Tenho a seguinte estrutura de tabelas:

Primeiro: está certo está modelagem?
Segundo: há como melhorar? Reduzir o número de tabelas?
O sistema funcionará da seguinte maneira:
Cada Candidato tem um Objetivo Profissional. E cada Objetivo Profissional pode ser composto por Turno (Manha / Tarde / Integral), Dias(Segunda a Sexta), Profissoes (Analista... etc...), e Pretensao Salararial. Porém ao preencher o Objetivo profissional o Candidato pode selecionar mais de um turno / dia / profissão.

A: Até onde dá para entender da descrição, está correto.
Sempre é possível reduzir o número de tabelas. Há poucos dias vi um caso de um sistema inteiro que cabia em uma tabela :D Dá até para ser com uma única coluna e na maioria dos casos em uma linha :) Isto é um antipattern chamado god table, muito usado em sistemas NoSQL orientados a documento.
É possível reduzir, mas não necessariamente aconselhável.
Se as tabelas de amarras sempre serão acessadas através da ObjetivoProfissional, é possível eliminá-las e criar 3 colunas de tamanho variável com a lista de códigos de de cada item. Isso pode ser com um VARCHAR, por exemplo, mas isto é detalhe de implementação. Ao contrário do que muita gente imagina, isso pode ser bem vantajoso trazendo pouca ou nenhuma desvantagem, dependendo do que se pretende.
Embora totalmente correta, ela é fora do que as pessoas estão acostumadas e pode dificultar um pouco a aplicação (também pode facilitar, depende). Certamente será mais rápido.
Reforço que não estou dizendo que deve fazer isto, mas é uma opção que eu nunca descarto.
Se precisa do acesso independente aos itens amarrados sem passar pelo ObjetivoProfissional, por exemplo, ver todos os profissionais que tem um determinado objetivo, aí é melhor ter as tabelas extras. Mesmo que dê para resolver com a tabela única, será mais complicado. Parece ser o caso, então deixa assim como modelou.


text:
Q: Ethereum Go-ethereum pending transactions GETH VERSION
Geth
Version: 1.8.10-stable
Git Commit: eae63c511ceafab14b92e274c1b18bf1700e2d3d
Architecture: amd64
Protocol Versions: [63 62]
Network Id: 1
Go Version: go1.10.1
Operating System: linux
GOPATH=/home/myuser/go
GOROOT=/usr/lib/go-1.10
Node running under:
geth --testnet --rpc --rpcapi "eth,net,web3,personal,parity" --syncmode="light"
Problem 1:
When I tried to run out Node with --syncmode="full" or --syncmode="fast", CurrentBlock is always behind then HighestBlock, Approximately 64 blocks. So Node is running under --syncmode="light".
My Goal is to find all pending transactions on my accounts.
Steps to reproduce

*

*eth.getBlock('pending').transactions
["0x2e6d5273fa29e892313166b8de458793fb0728f13a9077ab2295c1dc2371529c", "0xcc2e659ea3f8b6f6c1b812d559198427b0b2adf0316213c903e08c277384a1c6", "0x6a194f095f3b9ee65fa2eb9765617edda8ea99c2f8ad3e09d03d61735acd3a34", "0x604f53727f6ad056d82f57ce07b4e28cfae16c098dca909bffeaa51fb3584843"]

*Curl eth_getTransactionByBlockHashAndIndex
    curl -X POST -H "Content-Type: application/json" --data'{"id":8,"jsonrpc":"2.0","method":"eth_getTransactionByBlockHashAndIndex","params":["0xc0a9a6075081add64ac2f69b52f40de7b3d726281fc00a9ab23f90c892ae3346", "0x0"]}' http://localhost:8545

It returns:
{ "jsonrpc":"2.0",
 "id":8,
 "result":
     {"blockHash":"0xc0a9a6075081add64ac2f69b52f40de7b3d726281fc00a9ab23f90c892ae3346",

    "blockNumber":"0x344c3b",
    "from":"0x40e0b46c7a461c02ab6e70d5536e23a9d727f9f8",
    "gas":"0x927c0",

    "gasPrice":"0x218711a00",
    "hash":"0x2e6d5273fa29e892313166b8de458793fb0728f13a9077ab2295c1dc2371529c",

    "input":"0xfe6362ae000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000000c3332353136303935323130370000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c3037363832333538353537300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002e516d54755334664370664531563444784c547079507074596874664845446f5734774c745159675837375a376378000000000000000000000000000000000000",

    "nonce":"0x161",
    "to":"0xabe486e0ad5319d8047d5ef83e8c1cb1dce0d8c5",
    "transactionIndex":"0x0","value":"0x0","v":"0x2a",
    "r":"0xd1c106a22480e173784267c4da3db1707e2efd7598d9c55c6e060842d8e42390",
    "s":"0x15786e1f7f4bd53e402d4911b0334b38973609415868687f171501b64770331e"}}

it works perfect, Now lets ask for this transaction using getTransactionByHash

*

*Now lets check eth_getTransactionByHash:
   curl -X POST -H "Content-Type: application/json" --data '{"id":8,"jsonrpc":"2.0","method":"eth_getTransactionByHash","params":["0x2e6d5273fa29e892313166b8de458793fb0728f13a9077ab2295c1dc2371529c"]}' http://localhost:8545

It returns
{"jsonrpc":"2.0","id":8,"result":null}

I have to get the same result, But i got null!
Any idea? Or any suggestion of another way how to get incoming pending transactions?

A: You can always check for transaction details using getTransactionReceipt.
Could you please try this and get back if you do get null sometimes?
Also regarding your question on getting pending transactions, mind you these pending transactions are not for your account or you node (if you haven't posted any). Since you are connected to the public version of Ethereum, you are getting these transactions which are some later point in time picked up by some miner and getting added to the ledger. For the answer, you might write a backend which saves the pending transaction data by polling it continuously and hence serve your purpose. I hope I have answered your question.


text:
Q: Django + jQuery - Create Placeholders from database field value I have this form:

  <form method="POST" id="my_form" autocomplete="off"> {% csrf_token %}
    {% for field in form.visible_fields %}

        {{ field.label_tag }}
        {{ field }}

    {% endfor %}
     <button type="submit" class="btn btn-primary">Submit</button>
  </form>

{{ field.label_tag }} renders this label:
    Name:

{{ field }} renders this inputfield:
    <input type="text" name="name" maxlength="20" required="" id="id_name">

Unfortunately, there are no placeholders, so I created them by myself:

$(".form-group").each(function(){
$('input[type="text"]').attr("placeholder", "placeholder");
});

The placeholders show up, now I want to populate them with the corresponding values from the database.

Example:
class ModelA(models.Model):
    name = models.CharField(max_length=50,null=True,blank=True)

placeholder = Julia
What would be the best approach to do this?
Thank you

A: If you want to added placeholder only then try adding this code in
form
This is example add your key as example like as password.
password = forms.CharField(label='password',widget=forms.PasswordInput((attrs={'placeholder': 'Password'})))

or
Try this.
class Meta:
        model = MyModel
widgets = {
            'name': forms.TextInput(attrs={'placeholder': 'Name'}),
            'description': forms.Textarea(
                attrs={'placeholder': 'Enter description here'}),
        }

A: If you want a default value instead of a placeholder now, you could use the default argument in the model field.
class ModelA(models.Model):
    name = models.CharField(max_length=50, null=True, blank=True, default='some_default')

Then I believe the model form will pull this through as the initial form value for the corresponding field automatically.


text:
Q: "this computer has been scheduled to go to sleep" when none is set Simple question- My mac regularly & seemingly randomly tells me it has been scheduled to go to sleep automatically- usually (I think) right after I wake it up. I have no schedule for automatic sleep set up in preferences.
When this happens I just shrug and cancel the countdown box but it is annoying. Is there any way to see what is triggering this message and fix it?

A: If you are using iDrive that might be the culprit.

A: I had this issue as well. I found two potential answers:
This one suggests resetting PRAM and the SMC:
https://discussions.apple.com/thread/7702633
However, the second one mentions iDrive (as did a previous answer here). I did, in fact, switch to iDrive about a month ago, and believe the dialog box began appearing after installing it:
https://discussions.apple.com/thread/8304128?page=2
The above thread refers to a response from iDrive support which suggests un-checking the "wake from sleep" setting (it is apparently checked by default; mine was). For me, the issue was completely resolved by making this change; it has been 4 months since I changed the setting with zero recurrence. Make sure you don't miss the "do you want to save changes" dialog after changing it; iDrive has a way of making macOS feel like Windows.

A: I have a Mac Mini running High Sierra and have it scheduled to wake up at 2am every day to do backups.  The problem was that it didn't seem to be sleeping again afterward (as it should after 10 minutes of inactivity according to my Energy Saver preferences).  I could tell this because the light on the front of the Mini was on, not pulsating.  It seems as if only the display was sleeping even though I unchecked "Prevent computer from sleeping automatically when the display is off".
I tried also setting a scheduled sleep time of 2:15am in the Energy Saver preferences, but that didn't help, plus I got a dialog when I turned on the computer at 7am saying that it was about to sleep in 9 minutes.
I solved the problem by disabling the scheduled sleep time, extending the sleep timeout to 20 minutes, and adding the following line to my crontab (edit the crontab with "crontab -e"):
15 2 * * * pmset sleepnow
The command makes the computer sleep, and the cron job is set to run at 2:15am.  I don't know if it was necessary to extend the Energy Saver sleep period, but I did this to make sure the cron job would execute before the Energy Saver preferences kicked in, and so far it is working for me.
Edit:
I found that my Late 2014 Mac Mini would then go into "safe sleep" after some time, and it wouldn't wake up according to the schedule.  Entering the following two commands at the Terminal fixes this by extending the safe-sleep delay to 1 day:
1) "sudo pmset -a standbydelay 86400"
2) "sudo pmset -a autopoweroffdelay 86400"
(see here: https://discussions.apple.com/thread/6625408)

A: I have had this problem since moving to High Sierra. The dialog box appears after I supposedly wake up the computer in the morning. I say supposedly, because the power light on the macmini is usually steady, indicating only the display, not the computer, is asleep. THe dialog always gives the same interval before sleep, something like 9 minutes and 28 seconds, which bears no meaningful relationship to the scheduled times in Energy Saver. It does not appear every day. I sleep the computer every night before I sleep. I have Schedule in Energy Saver set to wake the computer at 2:59 AM daily and put the computer to sleep again at 3:30 AM so it should definitely be asleep later in the morning when I get up. This Schedule is so a Launch Agent can run and download a TV schedule into EyeTV and there should be plenty of time for this to happen and the computer to go back to sleep, but it is clearly remaining awake. I have tried resetting PRAM and trashing Finder .plist with no result.


text:
Q: mysql database SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax im getting error from this code
i don't how to figure it out
<?php
    include "db.php";
    include "auth.php";
    if(isset($_GET["getlist"]))
    {
        $uid=$_GET["getlist"];

        $sql="SELECT * FROM devices WHERE brand_id=:uid ORDER BY id ASC";
        $query=$db->query($sql);
        $devices=$query->fetchAll(PDO::FETCH_OBJ);

    }
?>

A: done it by @lawrence-cherone helping
here is the answer
<?php
    include "db.php";
    include "auth.php";
    if(isset($_GET["getlist"]))
    {

        try {
            $uid=(int)$_GET["getlist"];
            $sql=$db->prepare("SELECT * FROM devices WHERE brand_id = :uid ORDER BY id ASC");
            $sql->execute([':uid' => $uid]);
            $devices = $sql->fetchAll(PDO::FETCH_OBJ);
            } catch (Exception $e) {
            echo 'Caught exception: ',  $e->getMessage(), "\n";
        }
    }
?>


text:
Q: Create Table from a specific column that contains XML data I am in a situation where a specific set of data that is critical to a project is stored in a SQL Server table, but the column contents are in XML.
The table is in the below format

ID
DS_RowGuid
PCScreenStructureVariantID
Xml
ToScreen
FromScreen
LRScreen
_FlgTCF
DS_RowVersion

2058
8771805B-42FC-4D43-8F37-949AFB89F372
185
XML STUFF
0
0
0
0
0x000000003F27E191

The XML column when queried returns this XML:
<IGPosEvtHallStruct Ver="1">
  <Rows>
    <Row Coord="0" Id="2768c6d4-fe88-441e-ae8a-4af0060af1bc" Legend="J" />
    <Row Coord="1" Id="96b8b07e-43cb-4812-9b3f-ce1b95e38cb2" Legend="I" />
    ---
  </Rows>
  <Columns>
    <Column Coord="0" Id="96af2fb1-3816-410c-b99d-5d9270c13b58" />
    <Column Coord="1" Id="a518716a-fabc-433c-9945-21056b7d1b96" />
    <Column Coord="2" Id="bc7fc15e-0c15-4aa1-b323-a3c6d236c904" />
    ---
  </Columns>
  <Places>
    <Place Id="296178b2-707e-4f4a-b82f-57863d23d984" RowId="2768c6d4-fe88-441e-ae8a-4af0060af1bc" ColId="96af2fb1-3816-410c-b99d-5d9270c13b58" Symbol="" Kind="Excluded" />
    <Place Id="f79f5249-711b-4d85-a1ad-f5308d431801" RowId="2768c6d4-fe88-441e-ae8a-4af0060af1bc" ColId="a518716a-fabc-433c-9945-21056b7d1b96" Symbol="" Kind="Excluded" />
    <Place Id="7b116ee5-8f1f-42b8-9eaa-2be6b29ce8d6" RowId="2768c6d4-fe88-441e-ae8a-4af0060af1bc" ColId="bc7fc15e-0c15-4aa1-b323-a3c6d236c904" Symbol="15" Kind="Included" />
    <Place Id="c90c7156-9b5f-44eb-8e59-672b4f47c248" RowId="2768c6d4-fe88-441e-ae8a-4af0060af1bc" ColId="faa1bb37-22bc-4b35-8d83-34bef01ce04a" Symbol="14" Kind="Included" />
    <Place Id="0f5995ce-47ac-453d-b37c-a04d1dcbd211" RowId="2768c6d4-fe88-441e-ae8a-4af0060af1bc" ColId="918c650b-9402-4aff-a03b-3770c60e626e" Symbol="13" Kind="Excluded" />
    <Place Id="ac1200b6-ee15-4c16-9c33-4413c9577b6c" RowId="2768c6d4-fe88-441e-ae8a-4af0060af1bc" ColId="a2d816dc-d777-4a30-8b47-e80d89ee2b7f" Symbol="12" Kind="Included" />
    <Place Id="56905ff8-369d-4f6e-8e77-0f5e2f780796" RowId="2768c6d4-fe88-441e-ae8a-4af0060af1bc" ColId="199da003-1cc5-4e6f-9c37-cbae76f6f48a" Symbol="11" Kind="Included" />
    <Place Id="e6fb8ad4-b1be-4017-a753-4cac31adf423" RowId="2768c6d4-fe88-441e-ae8a-4af0060af1bc" ColId="3f74a90e-b2bb-48a6-9a68-5e9b65a8a1c3" Symbol="10" Kind="Excluded" />
    <Place Id="fb03dc89-12a0-49cd-b978-a7e4bc355bdb" RowId="2768c6d4-fe88-441e-ae8a-4af0060af1bc" ColId="234c9999-788c-415f-88fc-b77f79e493a8" Symbol="9" Kind="Included" />
    <Place Id="35700ff7-6405-4ca8-9e74-a44da2e0d1c0" RowId="2768c6d4-fe88-441e-ae8a-4af0060af1bc" ColId="91b2e41d-9de7-49a8-b37e-5036a2c64d39" Symbol="8" Kind="Included" />
    <Place Id="f3be70c9-93a7-4824-b4b0-3d8d6bc317a5" RowId="2768c6d4-fe88-441e-ae8a-4af0060af1bc" ColId="2bb7dc3b-1355-4343-9e20-dced0778db3a" Symbol="7" Kind="Excluded" />
    <Place Id="be980a4e-49ac-4b29-8e25-92937545e088" RowId="2768c6d4-fe88-441e-ae8a-4af0060af1bc" ColId="027b3efa-81f9-456b-b13a-742bbbfed357" Symbol="6" Kind="Included" />
    <Place Id="612734a4-ead9-4fd2-9d14-d0a557464bec" RowId="2768c6d4-fe88-441e-ae8a-4af0060af1bc" ColId="c37c3c6e-ca2d-4b8a-9b67-53d8605b9ad0" Symbol="5" Kind="Included" />
    <Place Id="f753c89a-6e9a-4dbb-bf37-2110ab941293" RowId="2768c6d4-fe88-441e-ae8a-4af0060af1bc" ColId="28e1b0b4-7e92-4814-b972-42cb5e04f39e" Symbol="4" Kind="Excluded" />
    <Place Id="5d318aab-2775-4dd3-81b4-2f78f5d3bcbd" RowId="2768c6d4-fe88-441e-ae8a-4af0060af1bc" ColId="5eb3a4dc-3a1a-4f5f-8991-997533ff9912" Symbol="3" Kind="Included" />
    <Place Id="2b6c033d-9be7-41c3-ad14-60a59ef490b0" RowId="2768c6d4-fe88-441e-ae8a-4af0060af1bc" ColId="65a88ecf-6e0e-4a7c-b81e-6d2e15498011" Symbol="2" Kind="Included" />
    <Place Id="3aea20d0-ec44-48b4-8456-0d923499c299" RowId="2768c6d4-fe88-441e-ae8a-4af0060af1bc" ColId="3ddc9559-faa6-45da-97f0-c43db4e3c827" Symbol="1" Kind="Excluded" />
    <Place Id="b6ab027f-5e85-479e-86b7-17e2abfee59a" RowId="2768c6d4-fe88-441e-ae8a-4af0060af1bc" ColId="6734cca8-5391-4255-a45a-8713be965c4f" Symbol="" Kind="Excluded" />
    <Place Id="cd61be80-4c41-4f90-998c-42b68587fce5" RowId="2768c6d4-fe88-441e-ae8a-4af0060af1bc" ColId="79e43ba6-5488-471e-b46d-ba59c97b4f8c" Symbol="" Kind="Excluded" />
    <Place Id="57b924dc-4c2e-4f16-bab5-9b47f9434d28" RowId="96b8b07e-43cb-4812-9b3f-ce1b95e38cb2" ColId="96af2fb1-3816-410c-b99d-5d9270c13b58" Symbol="" Kind="Excluded" />
    <Place Id="537ed01e-2743-4183-aa60-0d722d42edfe" RowId="96b8b07e-43cb-4812-9b3f-ce1b95e38cb2" ColId="a518716a-fabc-433c-9945-21056b7d1b96" Symbol="" Kind="Excluded" />
    <Place Id="a57db94e-8bb7-4818-af19-9a7acbcf5e37" RowId="96b8b07e-43cb-4812-9b3f-ce1b95e38cb2" ColId="bc7fc15e-0c15-4aa1-b323-a3c6d236c904" Symbol="15" Kind="Excluded" />
    <Place Id="85b49eb4-2674-4b39-98c3-fc99c74293a0" RowId="96b8b07e-43cb-4812-9b3f-ce1b95e38cb2" ColId="faa1bb37-22bc-4b35-8d83-34bef01ce04a" Symbol="14" Kind="Included" />
    <Place Id="1fbb02b0-3cc9-48ea-8f29-63c558424bb9" RowId="96b8b07e-43cb-4812-9b3f-ce1b95e38cb2" ColId="918c650b-9402-4aff-a03b-3770c60e626e" Symbol="13" Kind="Included" />
   ---
  </Places>
  <CoachGroups />

  <CustomGroups>
    <Group Id="4819c2e6-c8fc-455a-98a1-b9d0021703e2" GroupSeatsId="55feabb6-bd57-436c-b4f9-5f5f7ef9b485">
      <Places>
        <Place Id="01c930c9-0d5a-48f4-b5d0-1416c8a8c99f" />
        <Place Id="3609a78d-2d8c-4c96-8b06-2648226cbcab" />
        <Place Id="a10ec0ec-9b5a-4279-a40f-2103104ff979" />
        <Place Id="e7580756-cc38-41a4-b4d1-d356136fe9d5" />
        <Place Id="c189a0db-f53e-4a99-a5cd-7318c4506f2d" />
        <Place Id="67717bd9-e9d2-414f-ae6d-de4c2bd7b53a" />
        <Place Id="39fbca3d-acd6-4248-99d4-d5503151affb" />
        <Place Id="795f2264-5564-4cb4-8c78-c7382b7a2789" />
        <Place Id="c8a8bf32-0626-4a02-ab93-34fd17739787" />
        <Place Id="20e06b4d-333a-42cc-ba16-72eaa92e0eff" />
        <Place Id="9a1d1746-acd1-4cd5-ab86-d24ba1483d8c" />
        <Place Id="b840f33c-2b21-4c89-9eb1-a0bb637e0ab8" />
        <Place Id="66ea913c-1f8f-45d3-b1bb-f6936df9f9db" />
        <Place Id="77540b03-8284-4a2a-ab79-33526ab928fc" />
        <Place Id="a4047c47-59da-43ba-adc3-c0d0a8b0bb14" />
        <Place Id="b9094a20-ce0a-46e6-9db4-f2e9294034cb" />
        <Place Id="c8e6f136-ef51-4853-97e9-ea27458af4cd" />
        <Place Id="6bc7b667-b3a6-4cbb-952f-8cc452476416" />
        <Place Id="ef6edd3f-9da6-4c97-bf17-ea22f6d6f9f6" />
        <Place Id="58b683e4-cacc-4ae8-bff6-bd3816bdc507" />
        <Place Id="0ff27d45-4f6d-47a4-94f7-f7e45ded5d34" />
        <Place Id="9cf8df8e-f79e-4090-b2d6-dc937a474adf" />
        <Place Id="3e5d92f4-db67-4ff3-9d6b-9b8a44fb94c4" />
        <Place Id="9a7659b4-2137-4797-badf-2a40ba09dd3a" />
        <Place Id="e9c7e3fb-67f3-404a-a54f-ebf2d16d8b84" />
        <Place Id="7baca53e-f48b-485f-9d53-ad1a93199194" />
        <Place Id="23c72a9f-e4f9-42bb-a64f-c11af162a8e8" />
      </Places>
    </Group>
    <Group Id="b49c7f1a-1fc2-455e-8d00-41cea3dac82d" GroupSeatsId="55feabb6-bd57-436c-b4f9-5f5f7ef9b485">
      <Places>
        <Place Id="7b116ee5-8f1f-42b8-9eaa-2be6b29ce8d6" />
        <Place Id="c90c7156-9b5f-44eb-8e59-672b4f47c248" />
        <Place Id="ac1200b6-ee15-4c16-9c33-4413c9577b6c" />
        <Place Id="56905ff8-369d-4f6e-8e77-0f5e2f780796" />
        <Place Id="fb03dc89-12a0-49cd-b978-a7e4bc355bdb" />
        <Place Id="35700ff7-6405-4ca8-9e74-a44da2e0d1c0" />
        <Place Id="be980a4e-49ac-4b29-8e25-92937545e088" />
        <Place Id="612734a4-ead9-4fd2-9d14-d0a557464bec" />
        <Place Id="5d318aab-2775-4dd3-81b4-2f78f5d3bcbd" />
        <Place Id="2b6c033d-9be7-41c3-ad14-60a59ef490b0" />
        <Place Id="85b49eb4-2674-4b39-98c3-fc99c74293a0" />
        <Place Id="1fbb02b0-3cc9-48ea-8f29-63c558424bb9" />
        <Place Id="fc41d588-e495-4c4d-91cd-88949f367264" />
        <Place Id="4d401101-207b-4a37-a9fe-957d147712b4" />
        <Place Id="f06b4ceb-7872-4f1c-87f9-5a1bfb428958" />
        <Place Id="a71189db-2198-4c34-b57f-8de5a5938cbf" />
        <Place Id="d675a530-5e9e-4cf4-990a-566386e5fb8a" />
        <Place Id="496b00bf-2e21-4f34-a11a-06235769e84c" />
        <Place Id="15dafb9c-f90a-476f-a6ad-cde5db74407c" />
        <Place Id="a21c3a36-5c6d-42e6-99e6-b1992ec7a37e" />
        <Place Id="5bb4e85f-99f8-4ab2-82e8-d6ae10a316bd" />
        <Place Id="24dc5ffa-c785-4b73-8bc0-1bd43ae591d0" />
        <Place Id="4c323c73-7e2f-401b-a3da-3451a92487fc" />
        <Place Id="8cc1370e-6824-4a34-9d3a-040a155ae229" />
        <Place Id="b2c088c1-e132-432d-b920-907c6c813bc4" />
        <Place Id="93e046f3-03de-4d7a-9654-9ea2d3ba19d5" />
        <Place Id="01ce83f1-3380-42df-9ee0-c300ab432b2b" />
        <Place Id="ca8e2273-8c07-4b99-8c9b-2ccbb709e839" />
        <Place Id="372c67b7-59aa-42a4-9638-ff4e5282d0eb" />
        <Place Id="27f9e128-86df-4280-87e8-9355c1061ce4" />
        <Place Id="27e4b385-965d-4c17-8e38-8cbbdd136a3f" />
        <Place Id="b2610871-3fb1-48e5-917e-d7148358861f" />
        <Place Id="b6a61399-2fca-4a36-95ce-04faaf1de30c" />
        <Place Id="e1f7d937-65dd-4e63-9cfa-a032d8c0e19f" />
        <Place Id="8e5cc633-f5c5-4067-9f8d-76bd0cd28385" />
        <Place Id="ce74b491-f868-403b-b5e5-4366426e8a8c" />
        <Place Id="6d9c175d-97f9-4132-9209-c55f2152aeb0" />
        <Place Id="b5c7b2fc-c4ad-4e9d-bc6e-8cb07afe9273" />
        <Place Id="c20cd9ca-70bd-4851-8675-f02a48ea1271" />
        <Place Id="df9f060e-fc32-4bd7-b3f7-52898779008c" />
        <Place Id="655bb2b5-a7a0-4794-bfca-9feb355ba97b" />
        <Place Id="ef8eb9b0-9129-41a8-adb2-a28208a729ee" />
        <Place Id="4faa4dbb-5066-42a7-a5fa-ea2295d12ca4" />
        <Place Id="36adea82-928a-4c0d-9fb0-d147e09ca181" />
        <Place Id="8ddc5442-16fe-4af5-9548-efdc4f6d7dd8" />
        <Place Id="cd7db0bf-cc5a-498f-bdf1-75adcaa0e0ce" />
        <Place Id="465e5048-e063-43ab-8375-dc0a2a930054" />
        <Place Id="97905665-0f1a-42c2-bf0a-76c4156ea678" />
        <Place Id="4364e8b7-1113-4ba8-b103-91ce542c03e2" />
        <Place Id="545f2336-dad9-4378-9948-d138394a657c" />
        <Place Id="4307cc49-4cea-4089-8f5f-7992eb9d10f7" />
        <Place Id="29dc4b9a-3239-451e-baf8-7ded37fe0e03" />
        <Place Id="accf0603-0070-4f4e-8e16-31029ba270ff" />
        <Place Id="d3526c22-0816-457b-bd0a-a830850f3b99" />
        <Place Id="b3540ee8-8b16-42f9-bf99-8a5c1c549cfd" />
        <Place Id="b3fc6e24-ac14-4687-a298-83de9cb3752d" />
        <Place Id="cf27f59c-e85f-44ae-83c6-91b189b94446" />
        <Place Id="fb917c61-4659-47ae-89e6-e40f270f7ddc" />
        <Place Id="f4646afa-b941-4971-a4c3-39538b5fe53a" />
        <Place Id="0331765a-05aa-435e-ae57-46a7d910c79f" />
        <Place Id="a9f3957e-c9e3-4a9e-9c96-64255d449c4a" />
        <Place Id="ce19ce74-e5a2-4a91-96aa-eb1ab37d094b" />
        <Place Id="d1c31454-291a-418e-8d9b-f95b1e60658b" />
        <Place Id="3f3f222e-2488-46d8-95fe-2b735303a6dc" />
        <Place Id="38e9dc06-52cc-415b-b00f-de344ab28f3d" />
        <Place Id="157e49e4-c2e5-4dcb-bc97-5b311481007e" />
        <Place Id="8979cc1d-93bc-4529-a1d5-41709b54fc89" />
        <Place Id="c7fad1db-261b-46e0-99b3-bcd95b9e7860" />
        <Place Id="95eadfb4-2738-4ce1-b0c7-df76a9dfbf34" />
        <Place Id="426e875c-68fe-41a2-975b-5792ca8b59b6" />
      </Places>
    </Group>
  </CustomGroups>
  <Wheelchairs>
    <Wheelchair Id="03df3286-5ffb-4239-b4af-3ec2ff643df8" PlaceId="a10ec0ec-9b5a-4279-a40f-2103104ff979" />
  </Wheelchairs>
  <LoungeGroups />
  <SalesChannelGroups>
    <Group Id="e00d7780-285b-46d1-ba82-bd1393077b66" BlockedSalesChannelID="0b884544-5660-4c31-9c59-d57e41733b8e">
      <Places>
        <Place Id="e7580756-cc38-41a4-b4d1-d356136fe9d5" />
        <Place Id="c189a0db-f53e-4a99-a5cd-7318c4506f2d" />
        <Place Id="c6828de4-1696-44ac-b2e4-bdce7cb25fd7" />
      </Places>
    </Group>
    <Group Id="78c91c03-b754-403c-8f43-b78deb92afd4" BlockedSalesChannelID="5cb99449-ca4d-4a83-b3bb-2e57c8c2f98d">
      <Places>
        <Place Id="e7580756-cc38-41a4-b4d1-d356136fe9d5" />
        <Place Id="c189a0db-f53e-4a99-a5cd-7318c4506f2d" />
        <Place Id="c6828de4-1696-44ac-b2e4-bdce7cb25fd7" />
      </Places>
    </Group>
    <Group Id="702b51c3-50c0-4077-9a29-da8091ea0c67" BlockedSalesChannelID="1a1fe703-587a-4885-8fd3-496b7321d4b9">
      <Places>
        <Place Id="e7580756-cc38-41a4-b4d1-d356136fe9d5" />
        <Place Id="c189a0db-f53e-4a99-a5cd-7318c4506f2d" />
        <Place Id="c6828de4-1696-44ac-b2e4-bdce7cb25fd7" />
      </Places>
    </Group>
    <Group Id="6275ae54-e3c7-412d-801d-c60a948fb2a0" BlockedSalesChannelID="fc483f27-ba50-4441-a609-65cadb6d6564">
      <Places>
        <Place Id="e7580756-cc38-41a4-b4d1-d356136fe9d5" />
        <Place Id="c189a0db-f53e-4a99-a5cd-7318c4506f2d" />
        <Place Id="c6828de4-1696-44ac-b2e4-bdce7cb25fd7" />
      </Places>
    </Group>
    <Group Id="31ad6d3b-a84e-49f9-af10-3c45d0f7a7b8" BlockedSalesChannelID="0b884544-5660-4c31-9c59-d57e41733b8e">
      <Places>
        <Place Id="2b6c033d-9be7-41c3-ad14-60a59ef490b0" />
        <Place Id="5d318aab-2775-4dd3-81b4-2f78f5d3bcbd" />
        <Place Id="612734a4-ead9-4fd2-9d14-d0a557464bec" />
        <Place Id="be980a4e-49ac-4b29-8e25-92937545e088" />
        <Place Id="35700ff7-6405-4ca8-9e74-a44da2e0d1c0" />
        <Place Id="fb03dc89-12a0-49cd-b978-a7e4bc355bdb" />
        <Place Id="56905ff8-369d-4f6e-8e77-0f5e2f780796" />
        <Place Id="ac1200b6-ee15-4c16-9c33-4413c9577b6c" />
        <Place Id="c90c7156-9b5f-44eb-8e59-672b4f47c248" />
        <Place Id="7b116ee5-8f1f-42b8-9eaa-2be6b29ce8d6" />
        <Place Id="a21c3a36-5c6d-42e6-99e6-b1992ec7a37e" />
        <Place Id="15dafb9c-f90a-476f-a6ad-cde5db74407c" />
        <Place Id="496b00bf-2e21-4f34-a11a-06235769e84c" />
        <Place Id="d675a530-5e9e-4cf4-990a-566386e5fb8a" />
        <Place Id="a71189db-2198-4c34-b57f-8de5a5938cbf" />
        <Place Id="f06b4ceb-7872-4f1c-87f9-5a1bfb428958" />
        <Place Id="4d401101-207b-4a37-a9fe-957d147712b4" />
        <Place Id="fc41d588-e495-4c4d-91cd-88949f367264" />
        <Place Id="1fbb02b0-3cc9-48ea-8f29-63c558424bb9" />
        <Place Id="85b49eb4-2674-4b39-98c3-fc99c74293a0" />
        <Place Id="5bb4e85f-99f8-4ab2-82e8-d6ae10a316bd" />
        <Place Id="24dc5ffa-c785-4b73-8bc0-1bd43ae591d0" />
        <Place Id="27f9e128-86df-4280-87e8-9355c1061ce4" />
        <Place Id="372c67b7-59aa-42a4-9638-ff4e5282d0eb" />
        <Place Id="ca8e2273-8c07-4b99-8c9b-2ccbb709e839" />
        <Place Id="01ce83f1-3380-42df-9ee0-c300ab432b2b" />
      </Places>
    </Group>
    <Group Id="7f420e48-32e2-43ec-9ff1-879fc8142665" BlockedSalesChannelID="5cb99449-ca4d-4a83-b3bb-2e57c8c2f98d">
      <Places>
        <Place Id="7b116ee5-8f1f-42b8-9eaa-2be6b29ce8d6" />
        <Place Id="c90c7156-9b5f-44eb-8e59-672b4f47c248" />
        <Place Id="0f5995ce-47ac-453d-b37c-a04d1dcbd211" />
        <Place Id="ac1200b6-ee15-4c16-9c33-4413c9577b6c" />
        <Place Id="56905ff8-369d-4f6e-8e77-0f5e2f780796" />
        <Place Id="e6fb8ad4-b1be-4017-a753-4cac31adf423" />
        <Place Id="fb03dc89-12a0-49cd-b978-a7e4bc355bdb" />
        <Place Id="35700ff7-6405-4ca8-9e74-a44da2e0d1c0" />
        <Place Id="f3be70c9-93a7-4824-b4b0-3d8d6bc317a5" />
        <Place Id="be980a4e-49ac-4b29-8e25-92937545e088" />
        <Place Id="612734a4-ead9-4fd2-9d14-d0a557464bec" />
        <Place Id="f753c89a-6e9a-4dbb-bf37-2110ab941293" />
        <Place Id="5d318aab-2775-4dd3-81b4-2f78f5d3bcbd" />
        <Place Id="2b6c033d-9be7-41c3-ad14-60a59ef490b0" />
        <Place Id="3aea20d0-ec44-48b4-8456-0d923499c299" />
        <Place Id="a57db94e-8bb7-4818-af19-9a7acbcf5e37" />
        <Place Id="85b49eb4-2674-4b39-98c3-fc99c74293a0" />
        <Place Id="1fbb02b0-3cc9-48ea-8f29-63c558424bb9" />
        <Place Id="9ed0fd93-9482-40a1-840a-9f3f880bbb0b" />
        <Place Id="fc41d588-e495-4c4d-91cd-88949f367264" />
        <Place Id="4d401101-207b-4a37-a9fe-957d147712b4" />
        <Place Id="fd961ab9-886e-47d6-9be6-8acb47a2765b" />
        <Place Id="f06b4ceb-7872-4f1c-87f9-5a1bfb428958" />
        <Place Id="a71189db-2198-4c34-b57f-8de5a5938cbf" />
        <Place Id="12d9bfe8-6929-49bf-a78d-d17cf7685c9b" />
        <Place Id="d675a530-5e9e-4cf4-990a-566386e5fb8a" />
        <Place Id="496b00bf-2e21-4f34-a11a-06235769e84c" />
        <Place Id="0bf88c52-6c56-481c-943e-1c174de79d25" />
        <Place Id="15dafb9c-f90a-476f-a6ad-cde5db74407c" />
        <Place Id="a21c3a36-5c6d-42e6-99e6-b1992ec7a37e" />
        <Place Id="5bb4e85f-99f8-4ab2-82e8-d6ae10a316bd" />
        <Place Id="24dc5ffa-c785-4b73-8bc0-1bd43ae591d0" />
        <Place Id="372c67b7-59aa-42a4-9638-ff4e5282d0eb" />
        <Place Id="27f9e128-86df-4280-87e8-9355c1061ce4" />
        <Place Id="3f409342-70a1-4d2d-b933-bf8726c9be21" />
      </Places>
    </Group>
    <Group Id="cec9e7d5-24af-40dc-89e4-2a3d220499f6" BlockedSalesChannelID="1a1fe703-587a-4885-8fd3-496b7321d4b9">
      <Places>
        <Place Id="7b116ee5-8f1f-42b8-9eaa-2be6b29ce8d6" />
        <Place Id="c90c7156-9b5f-44eb-8e59-672b4f47c248" />
        <Place Id="0f5995ce-47ac-453d-b37c-a04d1dcbd211" />
        <Place Id="ac1200b6-ee15-4c16-9c33-4413c9577b6c" />
        <Place Id="56905ff8-369d-4f6e-8e77-0f5e2f780796" />
        <Place Id="e6fb8ad4-b1be-4017-a753-4cac31adf423" />
        <Place Id="fb03dc89-12a0-49cd-b978-a7e4bc355bdb" />
        <Place Id="35700ff7-6405-4ca8-9e74-a44da2e0d1c0" />
        <Place Id="f3be70c9-93a7-4824-b4b0-3d8d6bc317a5" />
        <Place Id="be980a4e-49ac-4b29-8e25-92937545e088" />
        <Place Id="612734a4-ead9-4fd2-9d14-d0a557464bec" />
        <Place Id="f753c89a-6e9a-4dbb-bf37-2110ab941293" />
        <Place Id="5d318aab-2775-4dd3-81b4-2f78f5d3bcbd" />
        <Place Id="2b6c033d-9be7-41c3-ad14-60a59ef490b0" />
        <Place Id="3aea20d0-ec44-48b4-8456-0d923499c299" />
        <Place Id="a57db94e-8bb7-4818-af19-9a7acbcf5e37" />
        <Place Id="85b49eb4-2674-4b39-98c3-fc99c74293a0" />
        <Place Id="1fbb02b0-3cc9-48ea-8f29-63c558424bb9" />
        <Place Id="9ed0fd93-9482-40a1-840a-9f3f880bbb0b" />
        <Place Id="fc41d588-e495-4c4d-91cd-88949f367264" />
        <Place Id="4d401101-207b-4a37-a9fe-957d147712b4" />
        <Place Id="fd961ab9-886e-47d6-9be6-8acb47a2765b" />
        <Place Id="f06b4ceb-7872-4f1c-87f9-5a1bfb428958" />
        <Place Id="a71189db-2198-4c34-b57f-8de5a5938cbf" />
        <Place Id="12d9bfe8-6929-49bf-a78d-d17cf7685c9b" />
        <Place Id="d675a530-5e9e-4cf4-990a-566386e5fb8a" />
        <Place Id="496b00bf-2e21-4f34-a11a-06235769e84c" />
        <Place Id="0bf88c52-6c56-481c-943e-1c174de79d25" />
        <Place Id="15dafb9c-f90a-476f-a6ad-cde5db74407c" />
        <Place Id="a21c3a36-5c6d-42e6-99e6-b1992ec7a37e" />
        <Place Id="5bb4e85f-99f8-4ab2-82e8-d6ae10a316bd" />
        <Place Id="24dc5ffa-c785-4b73-8bc0-1bd43ae591d0" />
        <Place Id="372c67b7-59aa-42a4-9638-ff4e5282d0eb" />
        <Place Id="27f9e128-86df-4280-87e8-9355c1061ce4" />
        <Place Id="3f409342-70a1-4d2d-b933-bf8726c9be21" />
      </Places>
    </Group>
    <Group Id="f3329004-7163-46e8-9888-3ecd1551e4c6" BlockedSalesChannelID="fc483f27-ba50-4441-a609-65cadb6d6564">
      <Places>
        <Place Id="7b116ee5-8f1f-42b8-9eaa-2be6b29ce8d6" />
        <Place Id="c90c7156-9b5f-44eb-8e59-672b4f47c248" />
        <Place Id="0f5995ce-47ac-453d-b37c-a04d1dcbd211" />
        <Place Id="ac1200b6-ee15-4c16-9c33-4413c9577b6c" />
        <Place Id="56905ff8-369d-4f6e-8e77-0f5e2f780796" />
        <Place Id="e6fb8ad4-b1be-4017-a753-4cac31adf423" />
        <Place Id="fb03dc89-12a0-49cd-b978-a7e4bc355bdb" />
        <Place Id="35700ff7-6405-4ca8-9e74-a44da2e0d1c0" />
        <Place Id="f3be70c9-93a7-4824-b4b0-3d8d6bc317a5" />
        <Place Id="be980a4e-49ac-4b29-8e25-92937545e088" />
        <Place Id="612734a4-ead9-4fd2-9d14-d0a557464bec" />
        <Place Id="f753c89a-6e9a-4dbb-bf37-2110ab941293" />
        <Place Id="5d318aab-2775-4dd3-81b4-2f78f5d3bcbd" />
        <Place Id="2b6c033d-9be7-41c3-ad14-60a59ef490b0" />
        <Place Id="3aea20d0-ec44-48b4-8456-0d923499c299" />
        <Place Id="a57db94e-8bb7-4818-af19-9a7acbcf5e37" />
        <Place Id="85b49eb4-2674-4b39-98c3-fc99c74293a0" />
        <Place Id="1fbb02b0-3cc9-48ea-8f29-63c558424bb9" />
        <Place Id="9ed0fd93-9482-40a1-840a-9f3f880bbb0b" />
        <Place Id="fc41d588-e495-4c4d-91cd-88949f367264" />
        <Place Id="4d401101-207b-4a37-a9fe-957d147712b4" />
        <Place Id="fd961ab9-886e-47d6-9be6-8acb47a2765b" />
        <Place Id="f06b4ceb-7872-4f1c-87f9-5a1bfb428958" />
        <Place Id="a71189db-2198-4c34-b57f-8de5a5938cbf" />
        <Place Id="12d9bfe8-6929-49bf-a78d-d17cf7685c9b" />
        <Place Id="d675a530-5e9e-4cf4-990a-566386e5fb8a" />
        <Place Id="496b00bf-2e21-4f34-a11a-06235769e84c" />
        <Place Id="0bf88c52-6c56-481c-943e-1c174de79d25" />
        <Place Id="15dafb9c-f90a-476f-a6ad-cde5db74407c" />
        <Place Id="a21c3a36-5c6d-42e6-99e6-b1992ec7a37e" />
        <Place Id="5bb4e85f-99f8-4ab2-82e8-d6ae10a316bd" />
        <Place Id="24dc5ffa-c785-4b73-8bc0-1bd43ae591d0" />
        <Place Id="372c67b7-59aa-42a4-9638-ff4e5282d0eb" />
        <Place Id="27f9e128-86df-4280-87e8-9355c1061ce4" />
        <Place Id="3f409342-70a1-4d2d-b933-bf8726c9be21" />
      </Places>
    </Group>
  </SalesChannelGroups>
</IGPosEvtHallStruct>

There are approximately 500 rows in the table. The XML column data is of similar format. The only valuable data exists are in the CustomGroup Section (it can be 1 or 2 sections. Nevertheless all of those are needed). Can someone help me to convert the output of this table and XML into a new table with the below columns:
ID (from above table)
DS_RowGuid
PCScreenStructureVariantID
GroupID
GroupSeatsID
PlaceId

Much appreciated.

A: You can use the following code:
SELECT
  t.ID,
  t.DS_RowGuid,
  t.PCScreenStructureVariantID,
  GroupID      = x1.Groups.value('@Id'          ,'uniqueidentifier'),
  GroupSeatsID = x1.Groups.value('@GroupSeatsId','uniqueidentifier'),
  PlaceId      = x2.Places.value('@Id'          ,'uniqueidentifier')
FROM YourTable t
CROSS APPLY t.XML.nodes('IGPosEvtHallStruct/CustomGroups/Group') x1(Groups)
CROSS APPLY x1.Groups.nodes('Places/Place') x2(Places);

db<>fiddle

*

*Note how the first .nodes breaks out the Group nodes, and is then fed into the second one to break out the Place nodes. This is only necessary because we are selecting from two different levels of the XML

*When using .value the XQuery must be known to be exactly one node. This is only true with attributes (referred by @), but if you wanted a node's inner text value, you would need '.value('(someNode/text())[1]', etc


text:
Q: How to replace the first three character on a string How to replace the first three special character in my string.?
This is the sample.
$string = "~~MASTER FOR OILCHEM; ETD - MID OF JUNE~~";
 echo preg_replace("/[^a-zA-Z0-9]/", "", $string);

The outout will be :
MASTERFOROILCHEMETDMIDOFJUNE

But I want the fist three special character to be replace. So the output will be :
MASTER FOR OILCHEM; ETD - MID OF JUNE~~

A: Instead of regex you can simply use substr like as
$string = "~~MASTER FOR OILCHEM; ETD - MID OF JUNE~~";
echo substr($string,2);

A: The following code searches for 0 up to 3 non word characters and replaces them with an empty string:
$string = "~~MASTER FOR OILCHEM; ETD - MID OF JUNE~~";
echo preg_replace("/^\W{0,3}/", "", $string);

The above PHP outputs the following:
MASTER FOR OILCHEM; ETD - MID OF JUNE~~

See https://3v4l.org/lFKXV for a live example.
And regarding Regular Expressions, you should try this great tool.
https://regex101.com/r/pD7vR7/1


text:
Q: Slick.js not working with Polymer 2.0 I try to make my own component with Slick.js library but it seems not working with Polymer 2.0
I have no error in the debug console and nothing appear on the browser
Here's the code :

<template>

    <link rel="stylesheet" href="../vendors/slick-1.6.0/slick/slick.css">
    <link rel="stylesheet" href="../vendors/slick-1.6.0/slick/slick-theme.css">

</template>

I've tried to move .js files imported to the index.html but nothing more.
Same for .css files.

A: Using external stylesheets has been deprecated in Polymer 2. The alternative and preferred way to share styles is with style modules.If you want to learn more about style modules click here.
Basically, to create a style module, you need to wrap your style block in <dom-module> and <template> elements, like this:
<dom-module id="my-style">
  <template>

  </template>
</dom-module>

When you create the element that will use the styles, import the style module and include in the opening tag of the style block:
<link rel="import" href="my-style.html">
<dom-module id="my-element">
  <template>

  </template>
</dom-module>

Demo using slick.js library: http://plnkr.co/edit/PP1uIUICNP4uFZAjZfZb?p=preview


text:
Q: Constructing higher order transition probability matrix Recently I asked a question here about how to construct a transition probability matrix given the following list:
x = {"A", "A", "A", "E", "D", "D", "D", "C", "B", "E", "E", "E", "D",
  "B", "A", "D", "B", "E", "C", "A", "D", "A", "A", "A", "A", "C",
  "C", "C", "D", "D", "E"}

For which one can get the following matrix: (see the detail from the previous question)
$$\begin{array}{cccccc}
& \text{A} & \text{B} & \text{C} & \text{D} & \text{E} \\
\text{A} & \frac{5}{9} & 0 & \frac{1}{9} & \frac{2}{9} & \frac{1}{9} \\
\text{B} & \frac{1}{3} & 0 & 0 & 0 & \frac{2}{3} \\
\text{C} & \frac{1}{5} & \frac{1}{5} & \frac{2}{5} & \frac{1}{5} & 0 \\
\text{D} & \frac{1}{8} & \frac{1}{4} & \frac{1}{8} & \frac{3}{8} & \frac{1}{8} \\
\text{E} & 0 & 0 & \frac{1}{5} & \frac{2}{5} & \frac{2}{5} \\
\end{array}$$
above is equivalent of partitioning list $x$ into sublists with size 2 and offset of 1, then counting each element and divide it by the sum of the row. The command to find the right partition is Partition[x, 2, 1] (again I refer you to the previous question). Now what if we want to find the higher order transition matrix? For example the second order would be Partition[x, 3, 1] and the expected matrix shall look like:
$$\begin{array}{cccccc}
   & A & B & C & D &E \\
AA & P_{AA,A} & P_{AA,B} & P_{AA,C} & P_{AA,D} &P_{AA,E}\\
AB & P_{AB,A} & P_{AB,B} & P_{AB,C} & P_{AB,D} &P_{AB,E}\\
AC & P_{AC,A} & P_{AC,B} & P_{AC,C} & P_{AC,D} &P_{AC,E}\\
AD & P_{AD,A} & P_{AD,B} & P_{AD,C} & P_{AD,D} &P_{AD,E}\\
AE & P_{AE,A} & P_{AE,B} & P_{AE,C} & P_{AE,D} &P_{AE,E}\\
\vdots & \vdots & \vdots &  \vdots  &\vdots & \vdots\\
EC & P_{EC,A} & P_{EC,B} & P_{EC,C} & P_{EC,D} &P_{EC,E}\\
ED &P_{ED,A} & P_{ED,B} & P_{ED,C} & P_{ED,D} &P_{ED,E}\\
EE & P_{EE,A} & P_{EE,B} & P_{EE,C} & P_{EE,D} &P_{EE,E}\\
\end{array}$$
In general the dimension of the matrix follows $\{|S|^n,|S|\}$, where n is the order of the Markov chain.

A: Update: Using EmpiricalDistribution and MarginalDistribution to compute the conditional probabilities:
ClearAll[transitionProb]
transitionProb[step_: 1][x_] := Module[{states = DeleteDuplicates@x,
   ed = EmpiricalDistribution[Partition[ArrayComponents @ x, step + 1, 1]],
   ordering, tuples, md, condpdF},
  ordering = Ordering[states]; tuples = Tuples[ordering, step];
  md = MarginalDistribution[ed, Range[step]];
  condpdF[u__, w_] := If[PDF[md, {u}] === 0, 0, PDF[ed, {u, w}]/PDF[md, {u}]];
  Prepend[{Row @ states[[{##}]],
      ## & @@ Table[## & @@ condpdF[##, i], {i, ordering}]} & @@@ tuples,
   Prepend[states[[ordering]], ""]]]

Examples:
transitionProb[2][x] // Grid[#, Dividers -> All] & // TeXForm

$\begin{array}{|c|c|c|c|c|c|}
\hline
 \text{} & \text{A} & \text{B} & \text{C} & \text{D} & \text{E} \\
\hline
 \text{A}\text{A} & \frac{3}{5} & 0 & \frac{1}{5} & 0 & \frac{1}{5} \\
\hline
 \text{A}\text{B} & 0 & 0 & 0 & 0 & 0 \\
\hline
 \text{A}\text{C} & 0 & 0 & 1 & 0 & 0 \\
\hline
 \text{A}\text{D} & \frac{1}{2} & \frac{1}{2} & 0 & 0 & 0 \\
\hline
 \text{A}\text{E} & 0 & 0 & 0 & 1 & 0 \\
\hline
 \text{B}\text{A} & 0 & 0 & 0 & 1 & 0 \\
\hline
 \text{B}\text{B} & 0 & 0 & 0 & 0 & 0 \\
\hline
 \text{B}\text{C} & 0 & 0 & 0 & 0 & 0 \\
\hline
 \text{B}\text{D} & 0 & 0 & 0 & 0 & 0 \\
\hline
 \text{B}\text{E} & 0 & 0 & \frac{1}{2} & 0 & \frac{1}{2} \\
\hline
 \text{C}\text{A} & 0 & 0 & 0 & 1 & 0 \\
\hline
 \text{C}\text{B} & 0 & 0 & 0 & 0 & 1 \\
\hline
 \text{C}\text{C} & 0 & 0 & \frac{1}{2} & \frac{1}{2} & 0 \\
\hline
 \text{C}\text{D} & 0 & 0 & 0 & 1 & 0 \\
\hline
 \text{C}\text{E} & 0 & 0 & 0 & 0 & 0 \\
\hline
 \text{D}\text{A} & 1 & 0 & 0 & 0 & 0 \\
\hline
 \text{D}\text{B} & \frac{1}{2} & 0 & 0 & 0 & \frac{1}{2} \\
\hline
 \text{D}\text{C} & 0 & 1 & 0 & 0 & 0 \\
\hline
 \text{D}\text{D} & 0 & 0 & \frac{1}{3} & \frac{1}{3} & \frac{1}{3} \\
\hline
 \text{D}\text{E} & 0 & 0 & 0 & 0 & 0 \\
\hline
 \text{E}\text{A} & 0 & 0 & 0 & 0 & 0 \\
\hline
 \text{E}\text{B} & 0 & 0 & 0 & 0 & 0 \\
\hline
 \text{E}\text{C} & 1 & 0 & 0 & 0 & 0 \\
\hline
 \text{E}\text{D} & 0 & \frac{1}{2} & 0 & \frac{1}{2} & 0 \\
\hline
 \text{E}\text{E} & 0 & 0 & 0 & \frac{1}{2} & \frac{1}{2} \\
\hline
\end{array}$

transitionProb[1][x] // Grid[#, Dividers -> All] & // TeXForm

$\begin{array}{|c|c|c|c|c|c|}
\hline
 \text{} & \text{A} & \text{B} & \text{C} & \text{D} & \text{E} \\
\hline
 \text{A} & \frac{5}{9} & 0 & \frac{1}{9} & \frac{2}{9} & \frac{1}{9} \\
\hline
 \text{B} & \frac{1}{3} & 0 & 0 & 0 & \frac{2}{3} \\
\hline
 \text{C} & \frac{1}{5} & \frac{1}{5} & \frac{2}{5} & \frac{1}{5} & 0 \\
\hline
 \text{D} & \frac{1}{8} & \frac{1}{4} & \frac{1}{8} & \frac{3}{8} & \frac{1}{8} \\
\hline
 \text{E} & 0 & 0 & \frac{1}{5} & \frac{2}{5} & \frac{2}{5} \\
\hline
\end{array}$

Original answer:
states = DeleteDuplicates[x];
ordering = Ordering[states];
data = ArrayComponents@x ;
estproc = EstimatedProcess[data, DiscreteMarkovProcess[Length@states]];
tuples = Tuples[Range[5][[ordering]], {2}];
table = {Row@states[[{##}]], ## & @@
      Table[Probability[p[3] == s \[Conditioned] p[1] == # && p[2] == #2,
        p \[Distributed] estproc], {s, Range[Length @ states]}]} & @@@ tuples ;

TeXForm @ Grid[Prepend[table, Prepend[states[[ordering]], ""]], Dividers -> All]

$\begin{array}{|c|c|c|c|c|c|}
\hline
 \text{} & \text{A} & \text{B} & \text{C} & \text{D} & \text{E} \\
\hline
 \text{AA} & \frac{5}{9} & \frac{1}{9} & \frac{2}{9} & \frac{1}{9} & 0 \\
\hline
 \text{AB} & 0 & 0 & 0 & 0 & 0 \\
\hline
 \text{AC} & \frac{1}{5} & 0 & \frac{1}{5} & \frac{2}{5} & \frac{1}{5} \\
\hline
 \text{AD} & \frac{1}{8} & \frac{1}{8} & \frac{3}{8} & \frac{1}{8} & \frac{1}{4} \\
\hline
 \text{AE} & 0 & \frac{2}{5} & \frac{2}{5} & \frac{1}{5} & 0 \\
\hline
 \text{BA} & 0 & 0 & 0 & 0 & 0 \\
\hline
 \text{BB} & 0 & 0 & 0 & 0 & 0 \\
\hline
 \text{BC} & 0 & 0 & 0 & 0 & 0 \\
\hline
 \text{BD} & 0 & 0 & 0 & 0 & 0 \\
\hline
 \text{BE} & 0 & 0 & 0 & 0 & 0 \\
\hline
 \text{CA} & \frac{5}{9} & \frac{1}{9} & \frac{2}{9} & \frac{1}{9} & 0 \\
\hline
 \text{CB} & \frac{1}{3} & \frac{2}{3} & 0 & 0 & 0 \\
\hline
 \text{CC} & \frac{1}{5} & 0 & \frac{1}{5} & \frac{2}{5} & \frac{1}{5} \\
\hline
 \text{CD} & \frac{1}{8} & \frac{1}{8} & \frac{3}{8} & \frac{1}{8} & \frac{1}{4} \\
\hline
 \text{CE} & 0 & 0 & 0 & 0 & 0 \\
\hline
 \text{DA} & \frac{5}{9} & \frac{1}{9} & \frac{2}{9} & \frac{1}{9} & 0 \\
\hline
 \text{DB} & \frac{1}{3} & \frac{2}{3} & 0 & 0 & 0 \\
\hline
 \text{DC} & \frac{1}{5} & 0 & \frac{1}{5} & \frac{2}{5} & \frac{1}{5} \\
\hline
 \text{DD} & \frac{1}{8} & \frac{1}{8} & \frac{3}{8} & \frac{1}{8} & \frac{1}{4} \\
\hline
 \text{DE} & 0 & \frac{2}{5} & \frac{2}{5} & \frac{1}{5} & 0 \\
\hline
 \text{EA} & 0 & 0 & 0 & 0 & 0 \\
\hline
 \text{EB} & 0 & 0 & 0 & 0 & 0 \\
\hline
 \text{EC} & \frac{1}{5} & 0 & \frac{1}{5} & \frac{2}{5} & \frac{1}{5} \\
\hline
 \text{ED} & \frac{1}{8} & \frac{1}{8} & \frac{3}{8} & \frac{1}{8} & \frac{1}{4} \\
\hline
 \text{EE} & 0 & \frac{2}{5} & \frac{2}{5} & \frac{1}{5} & 0 \\
\hline
\end{array}$

A: The following code is just brute-force. But at least yields the expected results. Also, it can be used for any order.
The first parameter is the data. The second parameter is the order.
probM[data_, ord_] :=
 Module[{uniques = Union[data], acc = 0, len, trans, trPre, tData,
   toCount, toGather, toNormalize},
  trans = Dispatch@Thread[uniques -> Range[len = Length[uniques]]];
  trPre = Dispatch@Flatten[Array[{##} -> ++acc &, ConstantArray[len, ord]]];
  tData = Replace[data, trans, {1}];
  toCount = Partition[tData, ord + 1, 1];
  toGather = Map[{Replace[#[[1, ;; -2]], trPre], #[[1, -1]]} -> #[[2]] &,
    Tally[toCount]];
  toNormalize = GatherBy[toGather, #[[1, 1]] &];
  SparseArray[
   Flatten@Map[
     With[{tot = 1/Plus @@ #[[All, 2]]},
       Map[#[[1]] -> #[[2]] tot &, #]] &, toNormalize]]];

Let us check the dimensions of the first three orders.
Table[probM[x, i] // Dimensions, {i, 3}]
(*{{5, 5}, {25, 5}, {125, 5}}*)

As for the efficiency of probM, I tried replacing some of the Map with ParallelMap but it did not yield any improvement. You might want to combine with niceties from the other answer. For example, use ArrayComponents instead of dispatch tables.
In any case, check the second order table:
$$
\begin{array}{cccccc}
 \text{} & \text{A} & \text{B} & \text{C} & \text{D} & \text{E} \\
 \text{AA} & \frac{3}{5} & 0 & \frac{1}{5} & 0 & \frac{1}{5} \\
 \text{AB} & 0 & 0 & 0 & 0 & 0 \\
 \text{AC} & 0 & 0 & 1 & 0 & 0 \\
 \text{AD} & \frac{1}{2} & \frac{1}{2} & 0 & 0 & 0 \\
 \text{AE} & 0 & 0 & 0 & 1 & 0 \\
 \text{BA} & 0 & 0 & 0 & 1 & 0 \\
 \text{BB} & 0 & 0 & 0 & 0 & 0 \\
 \text{BC} & 0 & 0 & 0 & 0 & 0 \\
 \text{BD} & 0 & 0 & 0 & 0 & 0 \\
 \text{BE} & 0 & 0 & \frac{1}{2} & 0 & \frac{1}{2} \\
 \text{CA} & 0 & 0 & 0 & 1 & 0 \\
 \text{CB} & 0 & 0 & 0 & 0 & 1 \\
 \text{CC} & 0 & 0 & \frac{1}{2} & \frac{1}{2} & 0 \\
 \text{CD} & 0 & 0 & 0 & 1 & 0 \\
 \text{CE} & 0 & 0 & 0 & 0 & 0 \\
 \text{DA} & 1 & 0 & 0 & 0 & 0 \\
 \text{DB} & \frac{1}{2} & 0 & 0 & 0 & \frac{1}{2} \\
 \text{DC} & 0 & 1 & 0 & 0 & 0 \\
 \text{DD} & 0 & 0 & \frac{1}{3} & \frac{1}{3} & \frac{1}{3} \\
 \text{DE} & 0 & 0 & 0 & 0 & 0 \\
 \text{EA} & 0 & 0 & 0 & 0 & 0 \\
 \text{EB} & 0 & 0 & 0 & 0 & 0 \\
 \text{EC} & 1 & 0 & 0 & 0 & 0 \\
 \text{ED} & 0 & \frac{1}{2} & 0 & \frac{1}{2} & 0 \\
 \text{EE} & 0 & 0 & 0 & \frac{1}{2} & \frac{1}{2} \\
\end{array}
$$

A: As a variant of my answer to the linked question, the following should work correctly and efficiently.
Some random data to work with:
x = RandomChoice[Alphabet["English", "IndexCharacters"], 1000000];

Creating the probability tensor P:
n = 2;
data = Flatten[ToCharacterCode[x]] - (ToCharacterCode["A"][[1]] - 1); // AbsoluteTiming // First
A = With[{spopt = SystemOptions["SparseArrayOptions"]},
     Internal`WithLocalSettings[
      (*switch to additive assembly*)
      SetSystemOptions["SparseArrayOptions" -> {"TreatRepeatedEntries" -> Total}],

      (*assemble matrix*)
      SparseArray[Partition[data, n + 1, 1] -> 1, ConstantArray[Max[data], n + 1] ],

      (*reset "SparseArrayOptions" to previous value*)
      SetSystemOptions[spopt]]]; // AbsoluteTiming // First
P = #/N[Total[Abs[#], {n + 1}] /. 0 -> 1] &@Flatten[A, n - 1];

0.717521
0.184357

The row labels of P should be
Tuples[Sort[DeleteDuplicates[x]], n]

A: You can use CrossTensorate from the package CrossTabulate.m, which I used and referenced in my answer of the previous question.
The making of contingency tensors with that function is discussed in this blog post: "Contingency tables creation examples".
In general, though, I would say it is better to use Tries with Frequencies or nested associations.
tmat3 = CrossTensorate[Count == 1 + 2 + 3, Partition[x, 3, 1]];

tmat4 = CrossTensorate[Count == 1 + 2 + 3 + 4, Partition[x, 4, 1]];

tmat3["XTABTensor"] = #/(Total[#, {Length[Dimensions[#]]}] /. {0 -> 1}) &@tmat3["XTABTensor"];
tmat4["XTABTensor"] = #/(Total[#, {Length[Dimensions[#]]}] /. {0 -> 1}) &@tmat4["XTABTensor"];

Grid[{{"tmat3", "tmat4"}, {MatrixForm[tmat3], MatrixForm[tmat4]}}]

ArrayRules[tmat3["XTABTensor"]]

(* {{1, 1, 1} -> 3/5, {1, 1, 5} -> 1/5, {1, 5, 4} ->
  1, {1, 4, 2} -> 1/2, {1, 4, 1} -> 1/2, {1, 1, 3} -> 1/
  5, {1, 3, 3} -> 1, {2, 5, 5} -> 1/2, {2, 1, 4} -> 1, {2, 5, 3} -> 1/
  2, {3, 2, 5} -> 1, {3, 1, 4} -> 1, {3, 3, 3} -> 1/2, {3, 3, 4} -> 1/
  2, {3, 4, 4} -> 1, {4, 4, 4} -> 1/3, {4, 4, 3} -> 1/3, {4, 3, 2} ->
  1, {4, 2, 1} -> 1/2, {4, 2, 5} -> 1/2, {4, 1, 1} -> 1, {4, 4, 5} ->
  1/3, {5, 4, 4} -> 1/2, {5, 5, 5} -> 1/2, {5, 5, 4} -> 1/
  2, {5, 4, 2} -> 1/2, {5, 3, 1} -> 1, {_, _, _} -> 0} *)


text:
Q: mathimatic induction with SUM
I want to do this with mathimatical induction,for every n>=1.
What I did : I know that basic step is  for n=1 so
 ( 1+2    )and I have   (  3 )
 (    3   )             (  3 )

step 2 : let assume  n=k is true
( n+2   )  it becomes        (  k + 2 )
(    3   )                   (     3  )

step 3: we have to prove that
( k+1   )   =      (  k + 2 )
(  2    )          (    3   )

we know that n=k+1 so
( k+1   )   =      (  k +1 + 2 )
 (  2    )          (    3   )

it gives us
( k+1   )   =      (  k + 3 )
 (  2    )          (    3   )

not sure if I go right or wrong.

A: The induction is straightforward and follows from Pascal's rule
Base case
The case $n=1$ is trivial (you made the calculation in you question).
Inductive hypothesis
Suppose that  the proposition is true for $n$. This means that we assume that the following is true:
$$\sum_{k=1}^{n} {k+1\choose 2 }={n+2 \choose 3}$$
Inductive step (Prove that the proposition is true for n+1)
Consider the sum $$\sum_{k=1}^{n+1} {k+1\choose 2 }=\sum_{k=1}^{n} {k+1\choose 2 }+ {n+2 \choose 2}$$
Since by inductive hypothesis the assertion is true for $n$ we apply the hypothesis for calculate the sum.
Hence
$$\sum_{k=1}^{n+1} {k+1\choose 2 }= {n+2\choose 3 }+ {n+2 \choose 2}={n+3 \choose 3}$$
And this complete the induction. Therefore the assertion is true for all $n\geq 1$.
Remark
Notice that the least step is possibly since we apply  the pascal`s rule to the sum of the two binomial coefficients.


text:
Q: WPF Textbox - How to save text without the wrapping-paragraph I load some texts from a database with different lengths into a textbox. (From 1 character to 1000 words...)
I use TextWrapping="Wrap", so if the text is to big for the width of the textbox, it will create a new line....
By saving the text, the added paragraph from TextWrapping="Wrap" will also be saved. But I don't want this. The original text shouldn't be changed in any way...
How can I display the text on a new line in the textbox without adding a "real" paragraph?
Is there a way I can determine if the paragraph was added from TextWrapping="Wrap" or if it belong to the original text?
Thanks

A: As @StevenRands mentioned, the source text won't be changed in any way by using TextWrapping.
It only affects the display of the text inside the TextBox.

A: Normally if you used text Wrapping,it wont affect the original source text.But anyways Before saving back to database you can remove the new line constants from your text box text which will give you the original text loaded from db.


text:
Q: How to customize success screen after google marketplace app installation? Is there a way to specify what kind of success screen Google marketplace is showing after an App has been successfully added by a user?
The current success screen is misleading users, as it is pointing to opening an existing document that users do not have at this point. A screen showing how to create a new document would be much more helpful. Is there a way to specify this in the google developer console?
Misleading success screen

A: Unfortunately it's impossible to change the message that will be shown when an AddOn is installed. It's automatic and it depends on the platform the AddOn is designed for.
Workaround
You can provide additional information using the Setup URL field in the Store Listing from G Suite Marketplace API management menu.
In your Google Cloud Console select the project and then APIs & Services > Library > G Suite Marketplace SDK > Manage.
Providing this URL will activate second page in the post installation pop up. At this URL you can have a webpage with an AddOn walk-through for your users.
Reference
G Suite Marketplace SDK


text:
Q: Запустить и остановить bat файл по кругу помогите с скриптом который запускает .bat файл, через 30 минут закрывает этот файл, проверяет закрылась ли бат файл и если закрылся тогда сразу запускает опять bat файл. итак по кругу.
Спасибо.

A: :A

"Сюда твой код"

timeout /t 1800

goto A

Время в секундах.


text:
Q: AWS S3 with Java - Reactive: S3 upload doesn't work I have a Spring Batch that should get a gzipped file from a rest service and then save it in a S3 bucket in the first step. In the second step it should retrieve this file from S3 and elaborate it. I have tried to follow this guide ("Single File Upload" case).
I'm able to save the file in S3, but I get "NoSuchKeyException: The specified key does not exist." at the beginning of the second step.
Looking at S3 bucket, the file has been written just 2 seconds after the second step started. It seems that the first step said "file created" even if its process was not completed. Infact this log:
log.info("S3 saving response: {}", response.sdkHttpResponse().isSuccessful());

is not present at all in the logs.
Thanks in advance!
The tasklet of the first step (simplified):
    @Override
    public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception {

        ...

        Mono<ResponseEntity<Flux<DataBuffer>>> response = myService.getAnalyticsDataBuffer2(authToken);
        response.log().map(e -> {
            DataBufferMapper dataBufferMapper = new DataBufferMapper(myFileManager, analyticTripFilename);
            return dataBufferMapper.apply(e);
        }).log().block();
        return RepeatStatus.FINISHED;
    }

The method to retrieve the gzipped file:
    public Mono<ResponseEntity<Flux<DataBuffer>>> getAnalyticsDataBuffer2(String correlationId, String token) {
        return webClient
            .get()
            .uri(
                uriBuilder ->
                    uriBuilder.path(ANALITYCS)
                        .build()
            )
            .headers(h -> h.setBearerAuth(token))
            .header("Business-User-Id", clientId)
            .header("Connection", "close")
            .accept(MediaType.APPLICATION_OCTET_STREAM)
            .retrieve()
            .toEntityFlux(DataBuffer.class)

            .name(METRICS_NAME)
            .tag(TAG_API_NAME, API_NAME)
            .metrics();
    }

The mapper Functional interface:
public class DataBufferMapper implements Function<ResponseEntity<Flux<DataBuffer>>, Mono> {

    private final MyFileManager myFileManager;
    private final String analyticTripFilename;

    public DataBufferMapper(MyFileManager myFileManager, String analyticTripFilename) {
        this.myFileManager = myFileManager;
        this.analyticTripFilename = analyticTripFilename;
    }

    @Override
    public Mono apply(ResponseEntity<Flux<DataBuffer>> response) {
        return myFileManager.saveFile(analyticTripFilename, response.getBody(), response.getHeaders().getContentLength());
    }
}

The implementation of the S3 upload.
public class S3FileManager implements MyFileManager {

    @Autowired
    private S3AsyncClient s3AsyncClient;

    @Autowired
    private S3ClientConfig s3ClientConfig;

    @Override
    public Mono saveFile(String fileName, Flux<DataBuffer> body, long contentLength) {
        log.info("S3FileManager saving file/content length{}/{}", fileName, contentLength);
        Flux<java.nio.ByteBuffer> buffers = body.map(DataBuffer::asByteBuffer);
        CompletableFuture<PutObjectResponse> future = s3AsyncClient. putObject(PutObjectRequest.builder()
            .bucket(s3ClientConfig.getBucket())
            .contentLength(contentLength)
            .key(fileName)
            .contentType(MediaType.APPLICATION_OCTET_STREAM.toString())
            .build(), AsyncRequestBody.fromPublisher(buffers));

        return Mono.fromFuture(future)
            .map(response -> {
                checkResult(response);
                log.info("S3 saving response: {}", response.sdkHttpResponse().isSuccessful());
                return response;
            });
    }

Update
To isolate the problem, I have added reactor logs and added a 'local' implementation for MyFileManager like this:
    @Override
    public Mono saveFile(String fileName, Flux<DataBuffer> dataBuffer, long contentLength) {
        String filePath = localFileManagerPath + fileName;
        final Path path = FileSystems.getDefault().getPath(filePath);
        log.info("LocalFileManager saving {}", filePath);
        return DataBufferUtils.write(dataBuffer, path, CREATE_NEW).log();
    }

Now the error is clearly  turned into 'Input resource must exist' and the log says:
[ INFO]  demo.service.batchservice.BatchService: Starting the runAnalyticTripsJob job
[ INFO]  org.springframework.batch.core.launch.support.SimpleJobLauncher: Job: [SimpleJob: [name=analyticTripsLoaderJob]] launched with the following parameters: [{analyticTripFilename=ANALYTIC_TRIPS-30052022-175840.858.csv, time=T15:58:40.858902Z, isNewAnalyticTripNeeded=true}]
[ INFO]  org.springframework.batch.core.job.SimpleStepHandler: Executing step: [retrievingDataStep]
[ INFO]  demo.service.demo.DemoDataRetriever: analyticTripFilename = ANALYTIC_TRIPS-30052022-175840.858.csv, isNewAnalyticTripNeeded = true
[ INFO]  demo.client.DemoAuthClient: Successfully accrued demo token
[ INFO]  reactor.Mono.OnAssembly.1: | onSubscribe([Fuseable] FluxOnAssembly.OnAssemblySubscriber)
[ INFO]  reactor.Mono.OnAssembly.2: | onSubscribe([Fuseable] FluxOnAssembly.OnAssemblySubscriber)
[ INFO]  reactor.Mono.OnAssembly.3: | onSubscribe([Fuseable] FluxOnAssembly.OnAssemblySubscriber)
[ INFO]  reactor.Mono.OnAssembly.3: | request(unbounded)
[ INFO]  reactor.Mono.OnAssembly.2: | request(unbounded)
[ INFO]  reactor.Mono.OnAssembly.1: | request(unbounded)
[ INFO]  reactor.Mono.OnAssembly.1: | onNext(<200,Flux.onErrorResume ⇢ at org.springframework.web.reactive.function.client.DefaultWebClient$DefaultResponseSpec.handlerEntityFlux(DefaultWebClient.java:635),[access-control-allow-origin:"*", x-request-id:"xyz", content-disposition:"attachment; filename="data.csv.gz"", ... function-execution-id:"j", x-cloud-trace-context:"xxx;o=1", Connection:"close", Content-Length:"68", Content-Type:"application/octet-stream", Via:"1.1 google"]>)
[ INFO]  reactor.Mono.OnAssembly.2: | onNext(<200,Flux.onErrorResume ⇢ at org.springframework.web.reactive.function.client.DefaultWebClient$DefaultResponseSpec.handlerEntityFlux(DefaultWebClient.java:635),[access-control-allow-origin:"*", x-request-id:"xyz", content-disposition:"attachment; filename="data.csv.gz"", ... function-execution-id:"j", x-cloud-trace-context:"xxx;o=1", Connection:"close", Content-Length:"68", Content-Type:"application/octet-stream", Via:"1.1 google"]>)
[ INFO]  demo.service.demo.LocalFileManager: LocalFileManager saving ./tmp/ANALYTIC_TRIPS-30052022-175840.858.csv
[ INFO]  reactor.Mono.OnAssembly.3: | onNext(Mono.log ⇢ at demo.service.demo.DemoDataRetriever.lambda$execute$0(DemoDataRetriever.java:45))
[ INFO]  demo.service.demo.DemoDataRetriever: LocalFileManager saved ANALYTIC_TRIPS-30052022-175840.858.csv
[ INFO]  reactor.Mono.OnAssembly.2: | onComplete()
[ INFO]  reactor.Mono.OnAssembly.3: | onComplete()
[ INFO]  reactor.Mono.OnAssembly.1: | onComplete()
[ INFO]  org.springframework.batch.core.step.AbstractStep: Step: [retrievingDataStep] executed in 2s257ms
[ INFO]  org.springframework.batch.core.job.SimpleStepHandler: Executing step: [processingDataStep]
[ INFO]  demo.config.BatchConfiguration: analyticTripFilename = ANALYTIC_TRIPS-30052022-175840.858.csv
[ INFO]  demo.service.demo.LocalFileManager: LocalFileManager getFileResource ./tmp/ANALYTIC_TRIPS-30052022-175840.858.csv
[ERROR]  org.springframework.batch.core.step.AbstractStep: Encountered an error executing step processingDataStep in job analyticTripsLoaderJob
org.springframework.batch.item.ItemStreamException: Failed to initialize the reader

Thanks in advance!

A: Finally solved...it was just a matter of turning map into flatMap in the tasklet:

Mono<ResponseEntity<Flux<DataBuffer>>> response = myService.getAnalyticsDataBuffer2(authToken);
response.flatMap(e -> {
    DataBufferMapper dataBufferMapper = new DataBufferMapper(myFileManager, analyticTripFilename);
    return dataBufferMapper.apply(e);
}).block();

Now it works both locally and on S3.


text:
Q: Scroll Position Update on Mobile I am using the following code below, which is working just fine. However when I view it on my mobile phone the triggers aren't run until scrolling stops, not when it reaches that point. Is there a way to report the scroll position while you scroll for mobile devices? instead of when it stops.
var waypoint = new Waypoint({
 element: document.getElementById('trigger-1'),
  handler: function(direction) {
   console.log(direction);
   if(direction == "down"){
    $(".sign-up-absolute").css("position","fixed");
    $(".sign-up-absolute").css("top","25%");
   }
    else{
    $(".sign-up-absolute").css("position","absolute");
    $(".sign-up-absolute").css("top","150px");
   }
  }
 });

 var waypoint = new Waypoint({
  element: document.getElementById('trigger-2'),
    handler: function(direction) {
      if(direction == "up"){
        $(".sign-up-absolute").css("position","fixed");
        $(".sign-up-absolute").css("top","25%");
       }
       else{
        $(".sign-up-absolute").css("position","absolute");
        $(".sign-up-absolute").css("top","150px");
        }
      }
  });


text:
Q: How to convert a vector of arrays into 4D array? I'm trying to play a little bit with Knet.jl and CNNs. Every example I found requires the input for CNN to be in the form of [dim1, dim2, n_of_channels, N] where N is a number of the actual images.
I'm a bit new to Julia and I don't know how to accomplish this.
I loaded images from some private directory and pushed them to a vector, so that their length is N.
images = Vector()
for img_file in readdir(dir)
    img = load("$dir/$img_file")
    images = vcat(images, [img])
end

typeof(image)
"320-element Array{Any,1}"

However in the following example xtrn is stored as 28x28x1x60000 Array and that is what I would like to accomplish with the private dataset.
using Knet; include(Knet.dir("data","mnist.jl"))
xtrn,ytrn,_,_= mnist()

typeof(xtrn)
Array{Float32,4}

I'm aware of functions as channelview, reshape and it's seems they should provide solution but I played with them a bit and got DimensionMismatch error all the time. I guess there's something I miss.

A: I don't have the files you are using in your example. But I would use cat in conjunction with a generator. Here's an example of something you can do:
julia> reduce((x,y)->cat(x, y, dims=4), rand(3,3) for _ in 1:3)
3×3×1×3 Array{Float64,4}:
[:, :, 1, 1] =
 0.366818  0.847529  0.209042
 0.281807  0.467918  0.68881
 0.179162  0.222919  0.348935

[:, :, 1, 2] =
 0.0418451  0.256611  0.609398
 0.65166    0.281397  0.340405
 0.11109    0.387638  0.974488

[:, :, 1, 3] =
 0.454959  0.37831   0.554323
 0.213613  0.980773  0.743419
 0.133154  0.782516  0.669733

In order to do this with your files, this might work (untested):
images = reduce((x,y)->cat(x, y, dims=4), load(joinpath(dir, img_file)) for img_file in readdir(dir))

BTW. You should not initialize vectors like this:
images = Vector()

This makes an untyped container, which will have very bad performance. Write e.g.
images = Matrix{Float32}[]

This initializes an empty vector of Matrix{Float32}s.

A: Just to fill in the answer of DNF, this code results in Array in the form of [dim1, dim2, 1, N]:
images = reduce((x,y)->cat(x, y, dims=4), load(joinpath(dir, img_file)) for img_file in readdir(dir))

I wanted the 3rd dimension to be the channel and hence, the expected output is produced by:
images = reduce((x, y) -> cat(x, y, dims=4), permutedims(channelview(load(joinpath(dir, img_file))), (2, 3, 1)) for img in readdir(dir))


text:
Q: PHPUnit test doesn't seem to work with Alice Bundle I'm trying to add some phpunit tests for my Symfony project (that also implements the Api Platform). I've installed the Alice Bundle and I've created some fixtures but for some reason when I try to run the command:
php bin/phpunit

It says:
PDOException: SQLSTATE[HY000] [1044] Access denied for user 'user'@'%' to database 'product-db-api_test'

The fixtures were loaded in the database (product-db-api) and I even tried to create a database test but it says there's an error in my query so I guess I cannot add it with that name.
Has anyone encountered this issue?
And my test class is like this:
class ProductTest extends ApiTestCase
{
   use RefreshDatabaseTrait;

   public function testGetAllProducts()
   { // code}
}

And I also tried to add a .env.testing with the same values as in .env but without luck.


text:
Q: Dual monitors issue I have two monitors. One on the left is a 2600 x 1440, and the one on the right 1920 x 1080. The left monitor is connected via the Displayport, which is monitor 1. The right monitor is connected via HDMI, and is monitor 2. The problem is that can't drag any application from left (monitor 1) to the right (monitor 2).
When I drag an application it stops when the cursor is at the boundary of monitor 1. Then I have to move the cursor to the other monitor and continue from there.
Need help in resolving the issue.
Thanks.

A: Most likely, your monitors are simply reversed.
Assuming you're working on Windows (please EDIT your question to add this rather necessary information), right-click on your Desktop and select Display Properties.
In the dialog that opens, click the Identify button and observe the numbers projected on your displays.
Now, click and drag the monitor icons in the dialog so their numbers correspond to the actual layout of the monitors in reality.
Click OK/Apply.

A: Go here:
Control Panel\Appearance and Personalization\Display\Screen Resolution
Flip the monitors over with a click and drag and then tick the box 'Make this my primary display' to the monitor on the left (assuming thats where you want your desktop to be).

A: It sounds like your monitor arrangement is flipped or just not set up properly.  In Windows 10, this is in Display Settings when you right click anywhere on the desktop.  The displays involved should appear on the field in the menu that it shows.  You can drag and drop these to set their arrangement, including slight adjustments to ensure the cursor is at an elevation which makes sense.
For example, my two 1680x1050 monitors at work are not on the same level.  One is portrait and stands next to a riser which has the other monitor set as landscape.  You can fine-tune the adjustments so that the cursor crosses over in a way that makes sense, which I have done by making cursor motions from halfway down my landscape monitor and below cross over to the top third of the portrait monitor.


text:
Q: How to get XML out of HTTP Request in ASP I'm trying to post an XML page in Android with HTTP POST to an ASP-page. My problem now is that I'm not really a ASP-programmer, but I need this page in ASP. Can someone help me on track to get the XML out of the HTTP Post and into my ASP, so I can save the XML-file on my server? Thank you very much.
In Android, I'm going to put my XML in a StringBuilder, following this example.
StringBuilder sb = new StringBuilder();

sb.append("<ArrayOfString>");
sb.append("<string>").sb.append("the_command").sb.append("</string>");
sb.append("</ArrayOfString>");

StringEntity entity = new StringEntity(sb.toString(), "UTF-8");
httppost.setEntity(entity);
httppost.addHeader("Accept", "application/xml");
httppost.addHeader("Content-Type", "application/xml");

HttpResponse response = httpclient.execute(httppost);

In my ASP-page looks like this for the moment
<%
strFilenaam = "d:\myhrm\android\xml\" & day(now) & month(now) & year(now) & hour(now) & minute(now) & second(now)
set oFs = server.createobject("Scripting.FileSystemObject")

blnOk = oFs.fileExists(strFilenaam & intTeller & "httppost.xml")
Do While blnOk = True
intTeller = intTeller + 1
blnOk = oFs.fileExists(strFilenaam & intTeller & "httppost.xml")
Loop
set oTextFile = oFs.OpenTextFile(strFilenaam & intTeller & "httppost.xml", 2, True)

oTextFile.Write "Test"
oTextFile.Close
set oTextFile = nothing
set oFS = nothing

Response.Write("OK")
%>

A: setEntity sets your request body in plain text (in this case the XML data). Usually you need key-value pairs that you can read via the Request.Form collection. You might want to try the Request.BinaryRead method in this case.


text:
Q: dbup does not create schemaversions table automatically I installed the latest DbUp version 4.4.0 from nuget and followed the steps described in the docs
https://dbup.readthedocs.io/en/latest/
I'm using a MySQL database and created a new .NET Core console project.

*

*There is no database present yet. I deleted it

*I installed the dbup and dbup-mysql package

*I copied the sample code from the docs and modified it a little bit
  static void Main(string[] args)
  {
      var connectionString = "Server=localhost;Port=3306;Database=my_database;Uid=root;Pwd=admin;";

      EnsureDatabase.For.MySqlDatabase(connectionString);

      var upgrader = DeployChanges.To
              .MySqlDatabase(connectionString)
              .WithScriptsEmbeddedInAssembly(Assembly.GetExecutingAssembly())
              .Build();

      var result = upgrader.PerformUpgrade();

      if (!result.Successful)
      {
          throw result.Error;
      }
  }

*I created a new .sql file within that project and called it 1595961596-initial_script.sql and defined it as an embedded resource
.
DROP DATABASE IF EXISTS `my_database`;
CREATE DATABASE `my_database`;

*

*When running the project result.Successful returns false and throws this error

Table 'my_database.schemaversions' doesn't exist

I thought that it would generate the schemaversions table automatically? Does someone know how to fix it?

If it helps:
I'm using Linux with MariaDb. I also tried to create that table on my own with
https://dbup.readthedocs.io/en/latest/more-info/journaling/
.JournalToSqlTable("my_database", "schemaversions")

but then I get this error

MySql.Data.MySqlClient.MySqlException: You have an error in your SQL
syntax; check the manual that corresponds to your MariaDB server
version for the right syntax to use near
'[my_database].[schemaversions] (
[Id] int identity(1,1) not null constraint' at line 1

A: FWIW, I came here because I saw this error... except in my case, it appears to be related to this old bug somehow: https://github.com/DbUp/DbUp/issues/188 . Another schema already had a schemaversions table.


text:
Q: building two android applications with ionic So I currently have two applications. I have built both with Ionic Cordova Build Android then copied and installed app1 through copying the apk to my phone but then when i install app2 it would just replace app1. What should I do so that both apps would be accessible?

A: I think you are facing the same issue. By default, it will overwrite the previous version. You need to give two different id while building the two app. You can achieve this using below way:
Check the config.xml file, and change the id of the app.
<widget id="new.app.id" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">

Now, it will be considered as a different app and will not replace the previous one.


text:
Q: Why do $f$ and $f'$ generate all of $K[X]$? I have been studying Marcus' Number Fields. I am stuck on a remark in Appendix 2, page 258.
He says: A monic irreducible polynomial $f$ of degree n over $K$ (a subfield of $\mathbb{C}$) splits into n monic linear factors over $\mathbb{C}$. We claim these factors are distinct; any repeated factor would be a factor of the derivative $f'$. [This is clear to me.]
This is my question:
He says: But this is impossible since $f$ and $f'$ generate all of $K[X]$ as an ideal.
How would I know this $a$ $priori$?
He finishes using this saying $1$ is a linear combination of $f$ and $f'$ with coefficients in $K[X]$ to show $f$ and $f'$ have no common factors, etc., and thus $f$ has distinct roots in $\mathbb{C}$
I have no problem with the conclusion either. My only question is how to know $f$ and $f'$ generate all of $K[X]$ as an ideal.
Thanks as always for you help.

A: Marcus says that $f$ is irreducible, so $(f,f')=1$. If not, then $f\mid f'$ (since the only non-constant divisor of $f$ is itself) and since $\deg f'<\deg f$ we have a contradiction.

A: Consider $I = \langle f, f' \rangle = \langle g \rangle$ for some $g$, since $K[x]$ is a PID.  Since $g \mid f$ and $f$ is irreducible, $g$ is associate to (i.e., equal to up to multiplication by a unit) either $1$ or $f$.
Since $g \mid f'$ and (because the characteristic is zero!) $0 \leq \operatorname{deg} f' < \operatorname{deg} f$, we have $\operatorname{deg} g \leq \operatorname{deg} f' < \operatorname{deg} f$, so $g$ cannot be associate to $f$. Thus $g$ must be associate to $1$.

A: Consider $I = (f ,f')$ the ideal generated by $f$ and $f'$. It can be written $I = (P)$ with $P \in K[X]$ monic (since $K[X]$ is principal). Clearly, $(f) \subset I$ so $P | f$. And because $f$ is irreducible, we get either $P = 1$ of $P = f$. But clearly $f' \notin (f)$, so $P = 1$.

A: Hint: the gcd of $f$and  $f'$ is $1$ hence by Bezout, there exist $u,v\in K[X]$ such that
$$
uf+vf'=1.
$$
Note: if you know that the gcd remains the same in every extension (by Bezout and its converse, for instance), then you see directly that $gcd(f,f')=1$ in $\mathbb{C}[X]$. So $f$ can't have a repeated root. And you get a little shortcut.


text:
Q: How is generating PWM related to GPIO speed? During GPIO configuration and initialization we, for example, may set the pin speed to 50MHz, 100 MHz, but we also may set it to 2MHz. As far as I know less speed = less power consumption. How is generating PWM related to pin speed? When I want to generate 300Hz or 1kHz PWMs, can I set pin speed to 2MHz?
Thanks in advance for answers.

A: The speed ratings you are talking about - 50 MHz, 100 MHz, 2 MHz - are basically slew rates controlling how fast the I/O pin changes state.
This has essentially nothing to do with the programming of the counters/timers used to actually generate the signal - it should not be confused with a clock prescaler which reduces the clock rate going into the timer, potentially drastically reducing the power consumption (most power in CMOS circuits is used charging and discharging implicit capacitance when changing state) but also the timing resolution.
In contrast, the slew rate reduction is something like a crude low-pass filter on the output.  It does potentially mean less power consumed driving the output (or at least the power spread over a greater amount of time), but most of the power consumed by a counter/timer will be in clocking the counter itself.
If your output frequency is well below the slew rate limit, and your external circuit can tolerate slow transitions you could try setting this.
Of course if your output frequency approaches the slew rate limit, you may find that your signal fails to drive all the way to valid logic levels.


text:
Q: What is wrong in Mysql select query with mysql variable concatenated with string? I have bellow query but has problem
set @lang = "en";
SELECT
 COUNT(*) AS total_of_user,
 COUNT(*) AS "total_of_user_@lang",
 src.district AS district_name,
 src.district AS "district_name_@lang"
FROM users LEFT JOIN (
  SELECT
    d.district_code,
    d.name_en AS district,
    p.name_en AS province_name,
    p.`province_code`
  FROM
    provinces AS p LEFT JOIN districts AS d ON p.province_code =    d.province_code
  WHERE
    p.province_code = '01'
) AS src ON src.district_code = users.district_code
WHERE
   users.district_code IS NOT NULL AND
   users.district_code <> '' AND
   users.province_code = '01'
GROUP BY users.district_code

If I remove " from query the never run, but above query run and result came as district_name_@lang but I need the column name to be as district_name_en.
For any help thanks.

A: You would need to use dynamic SQL for this:
set @lang = 'en';
set @sql = '
SELECT COUNT(*) AS total_of_user,
       COUNT(*) AS total_of_user_@lang,
       src.district AS district_name,
       src.district AS district_name_@lang
FROM users LEFT JOIN
     (SELECT d.district_code, d.name_en AS district, p.name_en AS province_name, p.`province_code`
      FROM provinces p LEFT JOIN
           districts d
           ON p.province_code = d.province_code
      WHERE p.province_code = ''01''
     ) src
     ON src.district_code = users.district_code
WHERE users.district_code IS NOT NULL AND
      users.district_code <> '''' AND
      users.province_code = ''01''
GROUP BY users.district_code';

set @sql = replace(@sql, '@en', @en);

prepare stmt from @sql;
execute stmt;
deallocate prepare stmt;

Note:  you cannot use parameters for column names or table names in a dynamic query.


text:
Q: Mail() only sending first word from subject When i send some email, it only sends the first word from the subject:
Example: I send an email with the name of "Send email", it only sends the word "Send", how can i prevent that?
Code:
The subject is selected in a select box

<?=  ' '.$val['email'].'  '; ?>
<input type="text" value="<?=  $val['email']; ?>" name="to"/>

<select name="subject">
<?php
  foreach($templatesarr as $val){
   echo '<option value='.$val['name'].'>'.$val['name'].'</option>';
  }
  echo '</select>
  <input type="submit" name="send" value="Send e-mail" />

  ';
  ?>
  </form>

Check if the button was clicked
if(isset($_POST['send'])){
$sendername = 'Company';
$from = 'noreplay@compaty.com';
$to      = safe($_POST['to']);

$subject =  safe($_POST['subject']);
$message = 'teste';

$headers  = 'MIME-Version: 1.0' . PHP_EOL;
$headers .= 'Content-type: text/html; charset=iso-8859-1' . PHP_EOL;
$headers .= "From: $sendername <$from>".PHP_EOL;

mail($to, $subject, $message, $headers);

}else{
$to = NULL;

}

Safe function
function safe($value) {
    return mysql_real_escape_string($value);
}

A: The main problem is caused by not escaping variables and not properly encapsulating your attribute values; use this instead:
foreach($templatesarr as $val){
   printf('<option value="%1$s">%1$s</option>',
       htmlspecialchars($val['name'], ENT_QUOTES, 'UTF-8')
   );
}

It now uses "" to delimit the value attribute of the option element.


text:
Q: Best and most convenient way of handling multiple sites for different clients? A very broad question, but how would you handle multiple domain names for different clients? Do you setup a "Web Hosting"-like server where you install Cpanel?
What are other cheaper alternatives to Cpanel?

A: You can choose to buy a "reseller" account from web hosting companies. This allows you to host multiple domains, each under different hosting account. Server management and technical support is done by the web hosting company without you having to worry about it. Each client has its own control panel.

I know Arvixe offers this by example. They provide cPanel for Linux hosting, and WebsitePanel for Windows hosting.

A: http://lordmatt.co.uk/item/966/


text:
Q: Display Issue Runas /user:administrator I have a strange issue with a software that I'm having to run as local administrator.
When I launch the application normally it is fine. When I launch the application using runas /user:administrator it ends up with these black lines across the application.
This causes the user to be unable to see half the content in the application.
I've tried all the compatibility settings in the .exe properties to no joy.
The program is 32 bit running in Windows 7 32 bit.
Any thoughts on where to begin to troubleshoot.


text:
Q: cross compatibility of python 2.x and python 3.x for networking I've been thinking of developing a robot using the Raspberry pi using an old RC tank I have. I know the raspberry Pi come with Python 2 but I'm using Python 3 on my PC.
The end goal for the robot is to be able to pass it coordinate through python to the pi but I'm not sure if the 2 version of python have compatible networking scripts.
I want to connect Python 2 and 3 using their networking but I'm not sure if they are compatible or if I'll have to download python 2 on my PC as well?
Here is the code I'll more than likely end up using with some changes, would it I be able to send information from this python 3 script the a python 2 script:
import socket, Encryption, threading
class Networking():
    StrName = ""
    BlnCon = False
    StrMsgs = []
    Server = socket.socket()
    StrMsgR = ""
    C = Encryption.Cryption()

    def ConnectTrd(self,E):
        TrdNetworking = threading.Thread(target = self.Connect, args = (E.TextBoxs.TxtboxSet[2].StrMessage,int(E.TextBoxs.TxtboxSet[3].StrMessage),E.TextBoxs.TxtboxSet[4].StrMessage,E))
        TrdNetworking.start()

    def Connect(self, StrHost, IntPort, StrName,E):
        self.StrName = StrName
        self.Server.connect((StrHost, IntPort))
        self.BlnCon = True
        while self.BlnCon:
            try:
                self.RecvMsg(E)
            except Exception as Error:
                print(Error)
        self.Server.close()

    def SendMsg(self,Message,E):
        if self.BlnCon:
            StrMsg = Message

            if StrMsg == "EXIT":
                self.BlnCon = False
                StrMsg = self.StrName + ": " + "EXIT"
            else:
                StrMsg = self.StrName + ": " + Message
            try:
                self.StrMsgs.append(str(self.StrName + ": " + Message))
                self.Server.send(self.C.EncryptMsg(StrMsg).encode())
            except Exception as Error:
                print(Error)
        else:
            print("can't send message.")
        self.WriteToTxBx(E)

    def RecvMsg(self,E):
        if self.BlnCon:
            try:
                self.StrMsgR = self.C.DecryptMsg(self.Server.recv(10240).decode())
            except Exception as Error:
                print(Error)
                self.BlnCon = False

            StrConCh = self.StrMsgR.split(":")
            if  StrConCh[1] == " EXIT":
                StrMsg = self.StrName + ": " + "EXIT"
                self.Server.send(self.C.EncryptMsg(StrMsg).encode())
                self.BlnCon = False
                self.StrMsgs.append(str(StrConCh[0]) + " has disconnected.")
            else:
                self.StrMsgs.append(self.StrMsgR)
            self.WriteToTxBx(E)

    def WriteToTxBx(self,E):
        E.TextBoxs.TxtboxSet[0].StrMessage = ""
        for IntZ in range(0,len(self.StrMsgs)):
            while len(self.StrMsgs[IntZ])%55 != 0:
                self.StrMsgs[IntZ] += " "
            E.TextBoxs.TxtboxSet[0].StrMessage += self.StrMsgs[IntZ]

the code is from a P2P client I made a while back that also uses a base GUI engine I made with Pygame.

A: For network communication it won't matter what language either side is written in.
All your code does is send bytes over the network. As long as the other side can process bytes and send back other bytes, you are fine. Python 2 is perfectly capable of doing that.


text:
Q: Is more clock speed means higher risk to circuit can have race condition It is a very simple question but it made me think. I have been working on finite state machines. I came to topic of finite state machines from combination circuits. In the book it says that sequential circuits which uses register with same clock input prevent race condition since it is synchronous design.
My question, is there a possibility that the clock cycle is so fast, delay on the circuit causes race condition?

A: A race condition is a situation where a signal is divided into two or more paths, and depending upon whether it traverses one path faster or slower than another path, the results could be different.
Given this definition, if a race condition exists, then it does not matter how fast or slowly signals change in the circuit, the race condition will still exist.
There are circuits that technically have race conditions in their logic that are, nevertheless, extremely reliable. This reliability is achieved by strict control over the timing delays in the circuit. If the manufacturing process is such that one path is guaranteed to "win", the race condition will not have adverse effects.
There are other circuits that technically have race conditions in their logic that are reliable if the signals supplied to these circuits obey given timing restraints, for example set-up and hold-times for data inputs for registers.
Excessive clock speeds will almost certainly make those circuits unreliable. However, technically, it is not that the excessive clock speeds "create a higher risk of a race condition", but that they create a higher risk that an existing race condition (i.e. a situation where different propagation speeds along different paths will result in in different outcomes) will have unwanted outcomes.