text:
Q: Android debugging fails with error after power outage I am working on an android app that was working well and all of a sudden after a power outage, I got the error bellow in when trying to debug the app
this is the error that appears and seams to be ppointing at codes different from my app's
com.google.gson.JsonSyntaxException: java.lang.IllegalStateException:
Expected BEGIN_ARRAY but was STRING at line 1 column 1 path $
at com.google.gson.Gson.fromJson(Gson.java:899)
at com.google.gson.Gson.fromJson(Gson.java:852)
at com.android.build.gradle.internal.pipeline.SubStream.loadSubStreams(SubStream.java:129)
at com.android.build.gradle.internal.pipeline.IntermediateFolderUtils.<init>(IntermediateFolderUtils.java:66)
at com.android.build.gradle.internal.pipeline.IntermediateStream.init(IntermediateStream.java:191)
at com.android.build.gradle.internal.pipeline.IntermediateStream.asOutput(IntermediateStream.java:135)
at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:228)
at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:217)
at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:102)
at com.android.build.gradle.internal.pipeline.TransformTask.transform(TransformTask.java:212)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
at org.gradle.api.internal.project.taskfactory.IncrementalTaskAction.doExecute(IncrementalTaskAction.java:46)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:121)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:110)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:92)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70)
at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:62)
at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:60)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:97)
at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:87)
at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:248)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:241)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:230)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:123)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:79)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:104)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:98)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:626)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:581)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:98)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was
STRING at line 1 column 1 path $
at com.google.gson.stream.JsonReader.beginArray(JsonReader.java:350)
at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:80)
at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:61)
at com.google.gson.Gson.fromJson(Gson.java:887)
... 56 more

Bellow is a snapshot of what I was the eror

A: You can try Closing android studio and then opening the projects afresh


text:
Q: Error Key Vault object_id is an invalid UUID - Terraform/Azure I'm deploying an Azure Application Gateway in Terraform and I want to store my SSL private certificate for the https between Internet and my App-gtw in an Azure Key Vault.
The code, omitting useless information in the application gateway module, is:

module "agw_user_assigned_identity" {
  source = "../modules/resources-blocks/user_assigned_identity"

  user_assigned_identity_name  = "agw-user-signed-id"
  resource_group_name     = module.resource_group.name
  resource_group_location = module.resource_group.location
}

module "key_vault" {
  source = "../modules/resources/key_vault"

  key_vault_name = local.key_vault_name
  resource_group_location = module.resource_group.location
  resource_group_name     = module.resource_group.name

  tenant_id = data.azurerm_client_config.current.tenant_id
  object_id = module.agw_user_assigned_identity.id

  soft_delete_retention_days  = 90

  log_analytics_workspace_id = module.log_analytics_workspace.id
  enable_diagnostic_setting  = true
}

module "key_vault_private_certificate" {
  source = "../modules/resources-blocks/key_vault_certificate"

  key_vault_id         = module.key_vault.id
  certificate_name     = local.agw_certificate_name
  certificate_path     = "./certificates/xxxxx.pfx"
  certificate_password = var.SSL_CERTIFICATE_PASSWORD
}

resource "null_resource" "previous" {}

module "agw_time_sleep" {
  source = "../modules/resources-blocks/time_sleep"

  select_module = module.key_vault
  seconds = "200s"
}

module "application_gateway" {
  source = "../modules/resources-hub/application_gateway"

  resource_group_name        = module.resource_group.name
  resource_group_location    = module.resource_group.location
  application_gateway_name   = local.agw_name

  key_vault_private_certificate_id = module.key_vault_private_certificate.certificate_id
  key_vault_private_certificate_id = azurerm_key_vault_certificate.kv_certificate.secret_id
  ssl_certificate_name             = local.agw_certificate_name
  agw_time_sleep                   = module.agw_time_sleep.id

  frontend_ports = [
    {
      name = "myFrontendPort"
      port = 443
    }
  ]

  http_listeners = [
    {
      name                      = "devListener"
      frontend_ip_configuration = local.frontend_ip_configuration_name
      frontend_port_name        = "myFrontendPort"
      protocol                  = "Https"
      hostname                  = "xxxxxxxxxxxxx.be"
      ssl_certificate_name      = local.agw_certificate_name
    }
  ]
}

The key_vault resource is:
resource "azurerm_key_vault" "kv" {
  name                        = var.key_vault_name
  location                    = var.resource_group_location
  resource_group_name         = var.resource_group_name
  enabled_for_disk_encryption = true
  tenant_id                   = var.tenant_id
  soft_delete_retention_days  = var.soft_delete_retention_days
  purge_protection_enabled    = false

  sku_name = "standard"

  access_policy {
    tenant_id = var.tenant_id
    object_id = var.object_id

    key_permissions = ["Get", "List", "Update", "Create", "Import", "Delete", "Recover", ]

    secret_permissions = ["Get", "List", "Set", "Delete", "Recover", "Backup", "Restore", "Purge"]

    storage_permissions = ["Get", "Set", "Delete", "Recover", "Backup", "Restore"]

    certificate_permissions = ["Get", "List", "Update", "Create", "Import", "Delete", "Recover", "Backup", "Restore", "Purge"]
  }

  lifecycle {
    ignore_changes = [access_policy]
  }
}

The key_vault_certificate resource is:
resource "azurerm_key_vault_certificate" "kv_certificate" {
  name         = var.certificate_name
  key_vault_id = var.key_vault_id

  certificate {
    contents = filebase64(var.certificate_path)
    password = var.certificate_password
  }
  certificate_policy {
    issuer_parameters {
      name = "Self"
    }

    key_properties {
      exportable = true
      key_size   = 2048
      key_type   = "RSA"
      reuse_key  = false
    }

    secret_properties {
      content_type = "application/x-pkcs12"
    }
  }
}

The application gateway resource is (omitting useless information):
resource "azurerm_application_gateway" "app_gw" {
  name                = var.application_gateway_name
  resource_group_name = var.resource_group_name
  location            = var.resource_group_location

  identity {
    type = "UserAssigned"
    identity_ids = [var.user_assigned_identity_id]
  }

  ssl_certificate {
    name     = var.ssl_certificate_name
    key_vault_secret_id = var.key_vault_private_certificate_id
  }

  dynamic "http_listener" {
    for_each = var.http_listeners
    content {
      name                           = http_listener.value.name
      frontend_ip_configuration_name = http_listener.value.frontend_ip_configuration
      frontend_port_name             = http_listener.value.frontend_port_name
      protocol                       = http_listener.value.protocol
      host_name                      = http_listener.value.hostname
      firewall_policy_id             = var.firewall_policy_id
      ssl_certificate_name           = http_listener.value.ssl_certificate_name
    }
  }

  depends_on = [var.agw_time_sleep]

}

The error that I get when I use the command terraform plan -var-file="variables.tfvars" is:
Error: expected "access_policy.0.object_id" to be a valid UUID, got /subscriptions/xxxxxxxx/resourceGroups/xxxxxxxxx/providers/Microsoft.ManagedIdentity/userAssignedIdentities/agw-user-signed-id
│
│   with azurerm_key_vault.kv,
│   on main.tf line 344, in resource "azurerm_key_vault" "kv":
│  344:     object_id    = module.agw_user_assigned_identity.id

Apparently seems that the problem is related to the object_id that I specify in the key_vault, but I don't know how to solve it.

A: Error Explanation
Error: expected "access_policy.0.object_id" to be a valid UUID .......
with azurerm_key_vault.kv,
│   on main.tf line 344, in resource "azurerm_key_vault" "kv":
│  344:     object_id    = module.agw_user_assigned_identity.id

This means that in your resource azurerm_key_vault in the access_policy block the object_id attribute is getting the incorrect value more simply the incorrect value that azure API accepts for it.
It expects the principal_id output from the azurerm_user_assigned_identity resource in spite of id.
in azure id would be the URI of the resource itself in azure namespaces /subscriptions/<sub-id>/resourceGroups/<resource-group-name>/providers/Microsoft.ManagedIdentity/userAssignedIdentities/<resource-name>
So you need principal_id output in your module module.agw_user_assigned_identity and then use it in your key_vault module  as follows
Terraform code
## inside module.agw_user_assigned_identity add an output , ignore if already exists

output "principal_id" {
  value       = azurerm_user_assigned_identity.base.principal_id
  description = "Set accordingly or from terraform documentation"
}

## then use the above the output in key_vault module
module "key_vault" {
  source = "../modules/resources/key_vault"

  key_vault_name = local.key_vault_name
  resource_group_location = module.resource_group.location
  resource_group_name     = module.resource_group.name

  tenant_id = data.azurerm_client_config.current.tenant_id
  object_id = module.agw_user_assigned_identity.principal_id

  soft_delete_retention_days  = 90

  log_analytics_workspace_id = module.log_analytics_workspace.id
  enable_diagnostic_setting  = true
}

That will solve the above error message.

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to embed $(X,\mathcal T)$ in the product topology $\prod_{i\in I}(X,\mathcal T_i) $ For each $i\in I$, $\mathcal T_i$ is a topology on $X$ and $\mathcal T$ is the coarsest topology containing all $\mathcal T_i$.
Can we embed $(X,\mathcal T)$ (homeomorphically) in the product topology $\prod_{i\in I}(X,\mathcal T_i) $?
(we assume $I\ne \emptyset$)

A: You have an obvious continuous injective map $(X,\mathcal T)\to\prod_{i\in I}(X,\mathcal T_i)$, namely the diagonal map. If $X$ is compact, then this map should be a homeomorphism onto its image, but not in general.

A: The diagonal map is a homeomorphism. For each non-empty finite $F\subseteq I$ let $$\mathscr{B}_F=\left\{\bigcap_{i\in F}U_i:U_i\in\mathscr{T}_i\text{ for each }i\in F\right\}\;,$$
and let $\mathscr{B}=\bigcup\{\mathscr{B}_F:F\subseteq I\text{ is finite and non-empty}\}$; then $\mathscr{B}$ is a base for $\mathscr{T}$.
For $i\in I$ let $X_i$ denote the space $\langle X,\mathscr{T}_i\rangle$, and let $d:X\to\prod_{i\in I}X_i:x\mapsto\hat x$ be the diagonal map: $\hat x_i=x$ for each $i\in I$. Let $\Delta=d[X]$ be the diagonal in $\prod_{i\in I}X_i$. For $x\in X$ let $\hat x=d(x)$.
Suppose that $F\subseteq I$ is finite and non-empty, and $B=\bigcap_{i\in F}U_i\in\mathscr{B}_F$. Then for each $x\in X$ we have
$$\begin{align*}
d[B]&=\{\hat x\in\Delta:x\in B\}\\
&=\{\hat x\in\Delta:\forall i\in F(x\in U_i)\}\\
&=\{\hat x\in\Delta:\forall i\in F(\hat x_i\in U_i)\}\\
&=\Delta\cap\left(\prod_{i\in F}U_i\times\prod_{i\in I\setminus F}X_i\right)\;,
\end{align*}$$
an open set in the topology that $\Delta$ inherits from $\prod_{i\in I}X_i$. Thus, $d$ is an open bijection from $X$ to $\Delta$. Moreover, the sets of the form
$$\prod_{i\in F}U_i\times\prod_{i\in I\setminus F}X_i\;,$$
where $F$ ranges over finite, non-empty subsets of $I$, and $U_i\in\mathscr{T}_i$ for each $i\in F$, form a base for the product topology, so the the same calculation shows that $d$ is continuous and therefore a homeomorphism.


text:
Q: Do i need to declare none for mypy pytest functions? So i basically just read in the documentation that

If a function does not explicitly return a value, give it a return type of None. Using a None result in a statically typed context results in a type check error

Does that also include pytest functions? Do i have to annotate every pytest func with None?

A: Yes, or run mypy with --check-untyped-defs, though of course that may hide other functions you've forgotten to annotate


text:
Q: How to set the JAVA_HOME correctly? I have upgraded my Eclipse from Mars to the current version and installed Java 1.12 (previously 1.8). I'm trying to run an Ant script which calls on
<javac destdir="${build.dir}" includeantruntime="false" source="${target.version}" target="${target.version}" modulepath="${modules.dir}" encoding="UTF8">

and tells me
BUILD FAILED
C:\Users\Sebastian Koch\git\gcs\build.xml:55: Unable to find a javac compiler; com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK.
It is currently set to "C:\Program Files\Java\jre1.8.0_144"

Based on that I went to my environment variables (I use Windows 10) and, to my surprise, found out there exists no JAVA_HOME variable there, so I just created one.
C:\Users\Sebastian Koch>echo %JAVA_HOME%
C:\Program Files\Java\jdk-12.0.2

I also added the new JDK to Eclipse. After a restart, Eclipse recognizes the new Java version: Project->Properties->Java Compiler->JDK Compliance:
Use compliance from execution environment 'JavaSE-12' on the 'Java Build Path'

is checked. The error prevails. The code I'm trying to run can be found here. I'm doing a right click on the build.xml and then Run As->Ant Build to get the error. I don't know why. Feel free to ask questions for more information.


text:
Q: Dynamically add row to table in Angular I have a table and would like to dynamically add a row to that table. Below is my code!

  4

    <input type="text" name="firstName" required minlength="2">

    <input type="text" name="lastName" required minlength="2">

    <input type="text" name="countryCode" required maxlength="2">

    <input type="number" name="age" required minlength="2">

Below the table the above row should be added to.  is the selector which holds the above html(the single table row to be added). Currently, when the button is clicked, the above row appears at the very bottom of the page instead of being added to the table as intended.

            #
            First
            Last
            Country
            Gender
            Age
            Edit
            Delete

            {{i + 1}}
            {{customer.firstName}}
            {{customer.lastName}}
            {{customer.countryCode}}
            {{customer.gender}}
            {{customer.age}}

          <add-edit-customer></add-edit-customer>

A: Angular is a framework whose main purpose is to update the view when the model changes. The templates represent a simple way to "teach" Angular how the actual DOM should be updated (at runtime of the app) whenever a change in your model happens.
Your rows are rendered by reading from the customerArray.

To add another row, simply add another object to customerArray, and Angular will handle updating the view on its own.

A: from Angular2 : render a component without its wrapping tag
If you want to add a tr into the table your component can be like
@Component({
  selector: '[add-edit-customer]',  //<--see you enclosed the name by []
  template: `<input ...>	  //see you don't include tr tag
             <input ...>	`
})

And your .html

      {{i + 1}}
      ...


text:
Q: How can I expose the status of an Amazon Lambda function in my web app? I'm hoping to use Amazon Lambda to run some background tasks for my web app. These particular tasks will only need to run once for the app (not once per user), so I'd like any user to see in the UI if a task is already running, and I'd like to disable the UI that allows them to start that task again.
Does Lambda offer a way to check the status of a function to see if it is running? If not, what is the best way to persist this info to my web app? Am I taking the wrong approach here altogether?

A: Lambda functions are supposed to be stateless and keeping functions stateless enables AWS Lambda to rapidly launch as many copies of the function as needed to scale to the rate of incoming events. While AWS Lambda's programming model is stateless, your code can access stateful data by calling other web services, such as Amazon S3 or Amazon DynamoDB.


text:
Q: The theorem on ordinary differential equations stated in the appendix of Kobayashi-Nomizu The following theorem is stated in the appendix I of Foundation of differential geometry by Kobayashi-Nomizu.
They say the proof will be found in various text books on differential equations.
I checked several books, but could not find it.
Theorem
Let $E$ and $F$ be finite dimensional normed spaces over $\mathbb R$.
Let $U$ and $V$ be non-empty open subsets of $E$ and $F$ respectively.
Let $J$ be an open interval of $\mathbb R$ containing $0$.
Let $f:J×U×V → E$ be a map.
Suppose $f$ is differentiable of class $C^p, 0 ≦ p ≦ ω$ in $J$
and of class $C^q, 1 ≦ q ≦ ω$ in $U$ and $V$.
Then there exist open subinterval $J_0$ of $J$ containing $0$,
non-empty open connected subsets $U_0, V_0$ of $U, V$ respectively and a unique map $g:J_0×U_0×V_0 → U$ which satisfy the following properties.
(1) $g$ is differentiable of class $C^{p+1}$ in $J_0$ and of class $C^q$ in $U_0$ and $V_0$.
(2) $D_tg(t, x, s) = f(t, g(t, x, s)$, s) for all $(t, x, s) ∈ J_0×U_0×V_0$
(3) $g(0, x, s) = x$ for all $(x, s) ∈ U_0×V_0$

A: This is a combination of the existence and uniqueness theorem and the smooth dependence on parameters.  See e.g. Solomon Lefschetz, "Differential Equations: Geometric Theory", II.9.1.


text:
Q: How to design my database I have a table QUEST which will have  some columns like(id, difficulty, description, etc). Also there are some particular quests that will have specific columns.
In Java I will make particular quest to extend Quest.
But, how is it better to save this in the database? Given the fact that I will be using Hibernate.
My options are:

*

*Table Per Hierarchy, where I have a single table, with nullable  columns

*Table Per Subclass, where I have a table for every class.

Suggestions? Also, in my app, many CRUD operations on those quests are expected


text:
Q: How to group only words, no spaces? i want group all words without white space e.g.:
I like stackoverflow
[0]I
[1]like
[2]stackoverflow
i know its a easy regex but i forgot how i do that xP.

A: (\w+)\s+(\w+)\s+(\w+)

In Java you would use something like this
String[] splits = "I like stackoverflow".split("\\s+");
// split[0] = "I"
// split[1] = "like"
// split[2] = "stackoverflow"

A: In Perl:
my $str = "I like stackoverflow";
my @words = split '\s+', $str;

@words now contains "I", "like", and "stackoverflow".

A: What language are you using?
PHP:  $array=array_filter(array_map('trim',explode(" ",$string)));
or better yet:
or better yet.    $array=array_filter(array_map("trim",explode(" ",preg_replace("/[^a-zA-Z0-9\s]/", "", $copy))));
In action at one of my dev sites

A: Usually you can use \w for an alphanumeric character so if you don't have strange symbols you can just go with something like
(\w)+\s+(\w)+\s+.....

where \s means any whitespace character
If you have words that are made also by symbols (even if it's quite nonsense) you can use \S instead that \w to match everything except white space.. but if you have just a list of words separated by spaces you can define a set of delimiters and split the string with an API function.

A: var reg = /([\w$])+/gi; // matches only words without space and noalphabetic characters


text:
Q: Java Deck of Cards Iterator method I have a Card class and a Deck class and a method I am supposed to implement is the following:

Iterator<Card> iterator ( )
  Returns the standard Iterator<Deck> (do this by either delegating to the data-type that you used to contain Cards, or by defining an inner-class that exposes this interface—your call.

My question is: What does it mean to delegate a data type? And how do I approach that?


text:
Q: Oscillation - atoms
A homogeneous, spherical electron cloud describes an atom (radius $a_0$ and total charge $^-e$ and positive point charge $^+e$ as the nucleus. An external electric field stimulates the electron cloud to oscillate relatively to the nucleus. Let the achieved deflections be small compared ot the atom radius. Determine the resonance frequency for the case
(a) of a hydrogen atom: $a_0=0.53\cdot 10^{-10}m$.
(b) of a sodium atom: $a_0=4.53\cdot 10^{-10}m$.
(c) Show that even for electric fields of magnitude $10^8V/m$ the deflection of the electron cloud is small compared to the atom radius.

To be honest I'm not sure how to approach this. The exercises are usually based on the last lecture. And the last thing we did was talking about plasma oscillation, where the plasma frequency is $\omega_{pe}=\sqrt{\frac{n_ee^2}{m_e\epsilon_0}}$. If that's really what I have to apply here this is what I was thinking:
(a): Since $r=a_0$ then $n_e=\frac{1}{\frac{4}{3}\pi a_0^3}$, since there is only one electron in the electron cloud, right? Which then would give me a frequency of $\omega_{pe}=3786808$Hz. Is that correct?
Anyway, similarly that would give me $\omega_{pe}=1295275.407$Hz. Again, could very well be wrong for this problem since I don't know whether we are looking for the plasma frequency or not.
(c) Pretty much lost here. I don't remember an expression including the electric field in regards to the plasma frequency.
I would greatly appreciate any hints or tips.

A: The electric field of the electron cloud is zero at the center and increases linearly away from the center.  You should have that result either for a uniform charged sphere or a uniform mass for gravity.  This makes the atom a harmonic oscillator. Compute the spring constant, which is the force applied by the electric field divided by the distance the nucleus is offset from the center of the cloud.  The mass is the mass of the electron.  For the last part, find how much offset it takes to neutralize that electric field and note that it is small.


text:
Q: Problem about sum of polynomials I have this problem I don't know how to solve:
Let $f(x)$ be a polynomial of degree $n$ with real coefficients and such that $f(x) \geq 0 \forall x \in \mathbb{R}.$ How do I show that $f(x) + f'(x) + \cdots + f^{(n)}(x) \geq 0 \forall x \in \mathbb{R}?$ where $f^{(k)}(x)$ denotes the kth derivative of $f(x).$

A: For n=2, f(x) = ax$^2$ +bx +c, f(x) >=0 implies a>0, b$^2$ -4ac <=0, f(x) + f'(x) + f''(x) = ax$^2$ + (2a+b)x + ( c+ b +2a), (2a+b)$^2$ - 4a(2a+b +c) = b$^2$ -4ac -4a$^2$ <0, so f(x) + f'(x) + f''(x) > 0


text:
Q: Animated (anime?) movie with a boy who is transported to another world and meets his backpack as a living creature Animated (anime?) movie with a boy who is transported to another world by a girl, accidentally. In this world he meets his backpack who is now a cute living creature and learns that he can become anything he can imagine. I think the girl wanted to transport another boy she had an eye on to help and save her world/kingdom from a great threat, but this other boy got summoned instead. He vowed to save it nonetheless. The threat moved to the real world.

A: The Toy Warrior (2005)
The plot synopsis on IMDb matches your description quite well. It mentions saving the world, imagination and the loyal backpack.

The Land Of Toys is a world of pure imagination, ruled by the popular doll Princess Sherbet, but when the mysterious Dark One threatens Sherbet's toy kingdom, she turns to the real world in search of a heroic Warrior Prince... Unfortunately, she ends up with the imaginative trouble-maker Jinoo. When Jinoo accidentally touches Sherbet's magical Warrior Stone, the spunky sixth-grader is suddenly transported to the Land Of Toys to become the powerful Toy Warrior! Aided by the reluctant Princess Sherbet, the transforming Police-bot, R.J., and Jinoo's amazingly loyal backpack, Ping, Jinoo is ready to play Toy Warrior and chase the dark forces across the landscape of imagination. The evil is spreading and now both the real world and the very Well of Imagination itself are at stake! Our only hope is a hero with heart... the Toy Warrior Jinoo!

The Toy Warrior poster - click to enlarge.
It is available online at YouTube but in Hindi. From skimming the video the below appears to be the boy's backpack as a creature in the new land.

Click image to enlarge.

I found this by Googling the new title of the post but specifying it must include backpack: Animated (anime?) movie with a boy who is transported to another world and meets his "backpack" as a living creature. This then gave me a Movies & TV question and answer about the work back from when they accepted story identification questions.


text:
Q: Incompatibility between \usetikzlibrary{babel} and the tkz-graph \Edge macro Continuing on from my question posted yesterday, I struck a similar problem with the \Edge macro of tkz-graph when attempting to define text labels - with \usetikzlibrary{babel} loaded compile ERROR !Undefined control sequence.\cmdGR is flagged. The fix provided for the previous question, if applied here, raises !Package xkeyval Error: '/tikz/handle active characters in nodes' undefined in families 'edge'; as demonstrated for \Edge[...](C)(B)
\documentclass{article}
% RN. 21 October 2017
\usepackage[utf8]{inputenc}
\usepackage[greek,ngerman,french,english]{babel}
\usepackage{tikz}
\usepackage{tkz-euclide}
\usepackage{tkz-graph}
%\usetikzlibrary{babel}
\begin{document}
\section{Alain Matthes: tkz-graph}
\begin{tikzpicture}
\SetUpEdge[lw = 1.5pt,
color = orange,
labelcolor = gray!30,
labelstyle = {draw}]
\SetGraphUnit{3}
\GraphInit[vstyle=Normal]
\Vertex{P}
\NOEA(P){B}
\SOEA(P){M}
\SOEA(B){C}
%\Edge[/tikz/handle active characters in nodes=false,label=bc](C)(B)
\Edge[label=bp](B)(P)
\Edge[label=pm](P)(M)
\Edge[label=cm](C)(M)
\Edge[label=bm](B)(M)
\end{tikzpicture}
\end{document}

A: Rather than applying the fix of the other question (Incompatibility between `\usetikzlibrary{babel}` and `tkz` macros `\tkzRep` and `\tkzDrawLine`) to \Edge, you can put the edge commands within a scope where the fix is applied:

\documentclass{article}
% RN. 21 October 2017
\usepackage[utf8]{inputenc}
\usepackage[greek,ngerman,french,english]{babel}
\usepackage{tikz}
\usepackage{tkz-euclide}
\usepackage{tkz-graph}
\usetikzlibrary{babel}
\begin{document}
\section{Alain Matthes: tkz-graph}
\begin{tikzpicture}
\SetUpEdge[lw = 1.5pt,
color = orange,
labelcolor = gray!30,
labelstyle = {draw}]
\SetGraphUnit{3}
\GraphInit[vstyle=Normal]
\Vertex{P}
\NOEA(P){B}
\SOEA(P){M}
\SOEA(B){C}
\begin{scope}[/tikz/handle active characters in nodes=false]
\Edge[label=bc](C)(B)
\Edge[label=bp](B)(P)
\Edge[label=pm](P)(M)
\Edge[label=cm](C)(M)
\Edge[label=bm](B)(M)
\end{scope}

\end{tikzpicture}
\end{document}


text:
Q: Unable to drag and drop current map elements into custom geoprocessing tool? I have scripted an ArcPy tool and the tool works fine in ArcGIS 10.2. The only problem is when I use the tool I can't drag and drop current map elements into the parameters, I have to manually navigate to the file through explorer each time, also there isn't a drop down menu of current map items to select from either?
Is it something to do with how I have set the tool parameters or is it a scripting issue?

A: Open the Properties of the script tool, and head to the Parameter tab:

Enter the parameters on the left-hand side, and choose the parameter type on the right-hand side dropdown.
Please let me know if you're still not seeing the expected behaviour after making these changes.


text:
Q: python 3 NameError Edit: Thank you for your helpful answers! I downloaded Python 3.7.0 but you are right, my Mac is running Python 2.7.  I have homework now :) Figure out how to get it running 3.7.  I will come back if I have more questions.  Thank you!
Beginner here.  I'm getting NameError when executing in Mac with Python Launcher. When testing in Python 3.7.0 Shell it works ok.  I've read other answers to NameError questions, but do not understand what I'm doing wrong. Help is appreciated.
Code used
first_name = input ("Hi, what's your first name? ")
print ("Hi," , first_name)

Error received
Traceback (most recent call last):
  File "/Users/imperio/Documents/pythonpractice/Name.py", line 1, in <module>
   first_name = input ("Hi, what's your first name? ")
  File "<string>", line 1, in <module>
NameError: name 'Imperio' is not defined

A: This is most likely because you are not executing it using Python 3+.
Please check the output of python -V to see which version you are executing your code with.
On mac you may already have both installed, Python 3 is sometimes aliased under python3 file.py
Here's your program converted to valid Python2:
first_name = raw_input ("Hi, what's your first name? ")
print ("Hi, {}".format(first_name))

A: You're running Python 2.  In Python 2, input executes the input.  raw_input just returns the string entered.
Here's an example:
>>> x = 1
>>> y = 2
>>> z = 3
>>> print input('variable? ')
variable? x                       # Note output is the value of the variable
1
>>> print input('variable? ')
variable? w                          # Variable 'w' doesn't exist
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<string>", line 1, in <module>
NameError: name 'w' is not defined
>>> print raw_input('variable? ')       # Raw input just returns the input.
variable? x
x


text:
Q: sql self join without equal operator on column Post the problem and SQL solution which works. My confusion is, when I am doing self join in the past, there is always some equal value (equal operator) in columns to join, but in below example, it seems self join could work without using equal operator? In my below example, using minus operator and >, no equal operator to specify which columns used to join.
Wondering if no equal operator, how did underlying self join works in my example?
Problem,
Given a Weather table, write a SQL query to find all dates' Ids with higher temperature compared to its previous (yesterday's) dates.
+---------+------------+------------------+
| Id(INT) | Date(DATE) | Temperature(INT) |
+---------+------------+------------------+
|       1 | 2015-01-01 |               10 |
|       2 | 2015-01-02 |               25 |
|       3 | 2015-01-03 |               20 |
|       4 | 2015-01-04 |               30 |
+---------+------------+------------------+

For example, return the following Ids for the above Weather table:
+----+
| Id |
+----+
|  2 |
|  4 |
+----+

SQL solution,
select W1.Id
from Weather W1, Weather W2
where TO_DAYS(W1.Date)-TO_DAYS(W2.Date) = 1 and W1.Temperature > W2.Temperature

A: Writing it using an ANSI join, since they're a standard part of SQL:
select W1.Id
from Weather W1
        inner join
     Weather W2
        on TO_DAYS(W1.Date)-TO_DAYS(W2.Date) = 1 and
           W1.Temperature > W2.Temperature

(Should produce an identical result set)
A join is just the process of matching up two sets of rows - you have a row source on the "left" and a row source on the "right" of the join. In trivial cases, these row sources are tables, but a join may also join the results of any previous joins as the row sources.
In theory, in the join, the result would be a cartesian product - every row on the left would be matched with every row on the right. If this is what you want, you can indicate this with CROSS JOIN.
Usually, however, we want to restrict the result of the join to less than the cartesian product of the rows. And we express those restrictions by writing an ON clause (or in the WHERE clause in your example using the old-style comma join).
The most common type of join is an equijoin, where one or more columns on each side are compared for equality. But that is by no means required. It can be any predicates that make sense. E.g. one form of join that I employ semi-regularly I described as a "triangle join" (by no means standard terminology) where every row is matched with every row that comes later:
SELECT
    *
FROM
    Table t1
        left join
    Table t2
        on
           t1.ID < t2.ID

And that's perfectly fine. The row with the lowest ID in Table will be matched with every other row in the table. The row with the highest ID value will not be matched with any other rows.

A: That's called an "implicit join" - I suggest, you read up on SQL JOIN, for example at https://en.wikipedia.org/wiki/Join_(SQL).
In short: The database looks for fitting JOIN columns without requiring you to explicitly specify them.


text:
Q: How do i send messages from one computer to another using vb.net? Ok so i've been wanting to do this for a few years now and it amazes me that no one can come up with a solution... i want to write a program (preferably in vb.net) that can send a message to another computer (or device) that is connected to the same network as me. I want the message to appear on the other computer (or device) in a popup message box. Also, it would be ideal if this could be done through some sort of bluetooth connection, if not then local ip connection will do. I don't know how i would go about doing this but i know it's possible because i've seen some programs do it... in fact i've seen a program called blackrain that without any additional software installed, can display messages on an ipod touch screen to instruct the yser what to do, and then display the results from their input on the computer screen, almost instantly. I would like to know how that works as well if anyone has any thoughts please feel free to share them!
Additional Details:

*

*I have alot of experience with vb.net, command-line functions, and vbscript.

*I am currently running Windows 7 Professional x64

*I have an external bluetooth mini adapter.

*I would like this to be (if possible) similar to those ipod/iphone apps that let you control your laptop cursor over wifi sync; in the sense that there is no setup required, and no additional software needed. (Example: remotepad.ipa)
The code for the message box would be something like:
ObjClient = New TcpClient("127.0.0.1", 1000)
TcpClient.Start()
Messagebox.Show("Popup Message Here")
TcpClient.Close()

I know that this code will do sort of the same thing in the command prompt:
msg * /SERVER:localhost hello

or this code will do the same thing in the command prompt:
msg * hello > localhost

But i want to do this without any batch files if possible, because i don't want to have to set up anything on the other end.
Thanks!
Does it have anything to do with Sockets or Ports maybe?

A: Using TcpClient and related libraries is definitely the correct answer.
Sample code for writing data to a specific IP/port:
''' <summary>
''' Send data over TCP/IP network
''' </summary>
''' <param name="data">Data string to write</param>
''' <param name="IP">The connected destination TcpClient</param>
Public Sub WriteData(ByVal data As String, ByRef IP As String)
    Console.WriteLine("Sending message """ & data & """ to " & IP)
    Dim client As TcpClient = New TcpClient()
    client.Connect(New IPEndPoint(IPAddress.Parse(IP), My.Settings.CommPort))
    Dim stream As NetworkStream = client.GetStream()
    Dim sendBytes As Byte() = Encoding.ASCII.GetBytes(data)
    stream.Write(sendBytes, 0, sendBytes.Length)
End Sub

Use TcpListener for watching for incoming data.
http://msdn.microsoft.com/en-us/library/system.net.sockets.tcplistener.aspx
edit: For knowing what IP to send it to... You could either have a list of internal IPs to connect to, or have each networked computer 'subscribe' to your program if it's hosted statically on a box. For my purposes, when I'm using this code, the host process sits on a known server. Client processes that want to receive messages sends a quick message to the host, which will then record the IP to be able to send to later.
Obtaining the IP of a requesting client:
''Given variable m_listener is an active TcpListener...
Dim client As TcpClient = m_listener.AcceptTcpClient()
Dim requesterIP As String = client.Client.RemoteEndPoint.ToString().Split(New Char() {":"})(0)


text:
Q: Создание неизменяемых объектов и ссылки на них Есть некий код:
import copy

a = 'spamlkfna;inoianoiho'
b = copy.copy(a)

if a is b:
    print("yes")

В книге что я читаю выяснил, что тут происходит создание 2 переменных, которые будут ссылаться на разные объекты, однако строка if a is b возвращает True. Я не могу понять почему так происходит если is возвращает true только если 2 ссылки равны, то есть ссылаются на один и тот же объект. Это все проделки оптимизации? Или в версии после python 3.0 этот момент выглядит иначе? Моя версия на которой я работаю 3.7.1

A: CPython интернирует строки, поэтому вы не сможете сделать её копию. Но стоит учитывать, что это внутренняя особенность реализации и когда-нибудь это поведение может измениться.


text:
Q: Why use getters to const private members instead of making them public? Suppose I have a simple class that defines a Circle object:
class Circle {
public:
    Circle(const double x): radius(x) { ; }
    const double getRadius() const { return radius; }

private:
    const double radius;

};

This seems like a common convention and subscribes to the OO principle of data-hiding.  My question is why do this?  Would it not be simpler to make radius a public member?  For a mutable member, this would obviously be a bad idea, since anyone could modify the circle's radius, but since it's const, I see no need to make it private.  Would it be acceptable to do something like this?:
class Circle {
public:
    Circle(const double x): radius(x) { ; }
    const double radius;
};


text:
Q: Triangle optimization problem Let $a,b,c$ be the sides of a triangle , then what is the maximum and minimum values (if exist) of the following quantities
(i) $\dfrac {a^2b^2c^2}{(a+2b)(a+2c)(b+2c)(b+2a)(c+2a)(c+2b)}$
(ii) $\dfrac {abc(a+b+c)^3}{(a+2b)(a+2c)(b+2c)(b+2a)(c+2a)(c+2b)}$

A: (i)
\begin{align*}
&\dfrac {a^2b^2c^2}{(a+2b)(a+2c)(b+2c)(b+2a)(c+2a)(c+2b)}\\
=&\dfrac{1}{(1+2\frac{b}{a})(1+2\frac{a}{b})(1+2\frac{c}{a})(1+2\frac{a}{c})(1+2\frac{c}{b})(1+2\frac{b}{c})}
\end{align*}
For each two factors, for example, $(1+2\frac{b}{a})(1+2\frac{a}{b})=5+2(\frac{a}{b}+\frac{b}{a})\geqslant5+2\cdot2$
(ii)
\begin{align*}
&\dfrac {abc(a+b+c)^3}{(a+2b)(a+2c)(b+2c)(b+2a)(c+2a)(c+2b)}\\
=&\frac{(a+b+c)^3}{(1+2\frac{b}{a})(1+2\frac{c}{b})(1+2\frac{a}{c})(a+2c)(b+2a)(c+2b)}
\end{align*}
Note that $(1+2\frac{b}{a})(1+2\frac{c}{b})(1+2\frac{a}{c})=9+2(\frac{b}{a}+\frac{c}{b}+\frac{a}{c})+4(\frac{c}{a}+\frac{b}{c}+\frac{a}{b})\geqslant9+2\cdot3+4\cdot3$ and $(a+2c)(b+2a)(c+2b)$


text:
Q: How to get full setup project support in Visual Stuidio 2012? Can i use any installation software in visual studio 2012 to create setup projects?
Because many options in setup projects with install-shield limited edition is disabled. I  cannot customize those?

*

*what can i do to get full customization support in VS 2012?

*can i use any other installation software,then how can i do it?

A: It looks like the following posts do address your setup project support issues:

*

*Where is Visual studio 2012 Setup project template?

*Create MSI or setup Project with visual studio 2012
However, if you are looking for a previous "basic setup and deployment project type Visual Studio Installer" - then they are NOT supported anymore  :(.


text:
Q: Can I create a link to a specific email message in Outlook? I use Outlook as my email client at work, but I don't want to use it to manage my tasks and todos. (Instead I use plain text files and Emacs org-mode.) Since many todo items start out as mails in my inbox, I often need to reference these mails.
Is there some clever way to create a link (a URL) that opens a specific email in Outlook when clicked?

A: I solved this by writing a simple vbscript (download):
Set Outlook = CreateObject("Outlook.Application")
Set SelectedItem = Outlook.ActiveExplorer.Selection.Item(1)
Set Shell = CreateObject("Shell.Application")
Shell.ShellExecute "cmd", "/c echo Outlook:" & SelectedItem.entryID & " | clip", "", "runas", 1

It copies a link of the element (Email, Calendar entry, ...) you have currently selected in Outlook to your clipboard:
Outlook:176CZREX7A79L9TG1T0AJ6HQ8DEBLTFS60HUQYKT2IXBBZ9ZZVA73MNRYVRWRL4RY0VCPQE1IB5GAWY0D8OSMOB4IFDV5OMG9NX2BBKGFA3IWSD62UCNVK0HD9GA80BIDZSBCZL7INCT

You can even use a redirection service so that you get a HTTP link (because Outlook: links are probably not detected automatically if you paste is somewhere, but HTTP links are) (download), just replace the last line with:
Shell.ShellExecute "cmd", "/c echo https://api.fnkr.net/goto/jsclient/raw/?closeAfter=500#Outlook:" & SelectedItem.entryID & " | clip", "", "runas", 1

Note that you need to make Outlook: links working first.
http://www.slipstick.com/problems/outlook-missing-outlook-protocol/ (scroll down to "Do It For Me")
Tested with Outlook 2010.

A: You can do this with a little bit of code in Outlook and a little bit of code in Emacs.
First, if you're using Outlook 2007 you'll need to enable Outlook URLs with a registry addition.  Instructions and the registry file can be found here courtesy of David Tan.
Next, this macro can be added to Outlook and will get the GUID of the current email message, create a Org-Mode link and deposit it into the clipboard.
'Adds a link to the currently selected message to the clipboard
Sub AddLinkToMessageInClipboard()

   Dim objMail As Outlook.MailItem
   Dim doClipboard As New DataObject

   'One and ONLY one message muse be selected
   If Application.ActiveExplorer.Selection.Count <> 1 Then
       MsgBox ("Select one and ONLY one message.")
       Exit Sub
   End If

   Set objMail = Application.ActiveExplorer.Selection.Item(1)
   doClipboard.SetText "[[outlook:" + objMail.EntryID + "][MESSAGE: " + objMail.Subject + " (" + objMail.SenderName + ")]]"
   doClipboard.PutInClipboard

End Sub

As koushik noted in the comments, the doClipboard.SetText part can be expanded to differentiate between different item types:
If objMail.Class = olMail Then
    doClipboard.SetText "[[outlook:" + objMail.EntryID + "][MESSAGE: " + objMail.Subject + " (" + objMail.SenderName + ")]]"
ElseIf objMail.Class = olAppointment Then
    doClipboard.SetText "[[outlook:" + objMail.EntryID + "][MEETING: " + objMail.Subject + " (" + objMail.Organizer + ")]]"
ElseIf objMail.Class = olTask Then
    doClipboard.SetText "[[outlook:" + objMail.EntryID + "][TASK: " + objMail.Subject + " (" + objMail.Owner + ")]]"
ElseIf objMail.Class = olContact Then
    doClipboard.SetText "[[outlook:" + objMail.EntryID + "][CONTACT: " + objMail.Subject + " (" + objMail.FullName + ")]]"
ElseIf objMail.Class = olJournal Then
    doClipboard.SetText "[[outlook:" + objMail.EntryID + "][JOURNAL: " + objMail.Subject + " (" + objMail.Type + ")]]"
ElseIf objMail.Class = olNote Then
    doClipboard.SetText "[[outlook:" + objMail.EntryID + "][NOTE: " + objMail.Subject + " (" + " " + ")]]"
Else
    doClipboard.SetText "[[outlook:" + objMail.EntryID + "][ITEM: " + objMail.Subject + " (" + objMail.MessageClass + ")]]"
End If

Almost there, add this little bit of lisp to your emacs lisp directory to enable Outlook links.
;;; org-outlook.el - Support for links to Outlook items in Org

(require 'org)

(org-add-link-type "outlook" 'org-outlook-open)

(defun org-outlook-open (id)
   "Open the Outlook item identified by ID.  ID should be an Outlook GUID."
   (w32-shell-execute "open" (concat "outlook:" id)))

(provide 'org-outlook)

;;; org-outlook.el ends here

And lastly, update your .emacs file to include the Outlook link code.  Just add this somewhere after org-mode is setup.
(require 'org-outlook)

Now you can call the macro (I added it to my toolbar in Outlook for quick access) and you can quickly create a link to the email in Emacs.
One gotcha, GUID's change when you move a message between document stores, so if you get the GUID to the message while it's on your Exchange server and then move it to your local PST file the link will change.  Move the message before you get the GUID.

A: I don't have sufficient reputation credits to put in a comment to the accepted answer above, but I wanted to put a cross-reference in for a revision to the excellent answer provided by @user25995 - which I posted at (emacs) StackExchange.
Based on a comment I received to a question I posted there, I changed the use of (deprecated) org-add-link-type to org-link-set-parameters and included an export: function so that the HTML export backend gave me a properly formatted <a href="outlook:..."> link type.

A: came across Linker applet.going to try it out..you may want to as well
http://www.teamscope.com/otherpro/utilities.asp#linker
Here's the marketing drible..
Linker™ for Windows® creates hyperlinks to items and folders in Outlook, and to files and folders in Windows Explorer. It is a system tray applet places the hyperlink in the Windows clipboard. The hyperlink can then be pasted into any Microsoft Office document, web page, e-mail message, or any document that supports hyperlinks.
Greetings from sunny South Africa!

A: You can copy an Outlook e-mail to OneNote (comes in as a yellow letter icon), then right click and select 'link to paragraph', and then paste the link into another document that can work with links.
But anyway, Microsoft should have made this whole thing of linking to an e-mail a standard feature. It was such a useful feature of Lotus Notes.

A: I'm not sure about referencing a specific email but depending on your system you might be able to copy the email to the same location as the todo item. Just drag/drop the mail to a folder or the desktop and it will create a copy of the mail that you can treat as a normal file.
If you would be using .doc or more "advanced" files than .txt you could then link to this Outlook message file.

A: I prefer to copy the Outlook Item content to the system clipboard and then yank it into an Org-mode note.
http://www.emacswiki.org/emacs/PlannerModeContrib#toc10

A: Not without some kind of custom code.  The Outlook URI's can get you to the containing folder within Outlook, but that's about it.  You would need to come up with a clever filing strategy that aligned with your linking strategy to get more granular.

A: Probably your requirement is different with mine.
Outook 2013 > Message Tab(your normal view) > 'Actions' Button > View in Browser
Then I get that link from the browser.
Hope that help

A: I use Wunderlist to manage my tasks and found that with the Wunderlist add-in for Outlook I can create new tasks directly from an email message and Wunderlist automatically creates a link in the task notes to the original message. A few things to keep in mind:

*

*I always move the message to a folder first because (last time I
checked) the URL breaks if you later move the message to another folder.

*Even though there is an add-in for Outlook desktop, it doesn't seem to include the link, so I use Outlook on the Web when I
want to create a task.

*I have only tried this with Outlook on the
Web for Office 365 using a corporate email account. I assume it
works    equally well with consumer Office 365 accounts, but haven't
tried it.

*Even if you don't use Wunderlist, you could sign-up
and use it to generate the URL when you need it.

And just for disclosure, I do work for Microsoft, though I'm not associated with either the Outlook or Wunderlist teams.

A: In the web app (Office 365) you can right-click the message and create task/to-do. Then in the task you can right-click and get the embedded link to the message. See related answer linked below for more detail:
Link to Microsoft Outlook 365 Webmail email

A: I have found a relatively non-technical work around for this question after a lot of trial and error. I save alot of emails in OneNote, and in older versions of One Note, you can drag and drop specific emails to be saved on the page. But this isn't possible in OneNote 365 (to my knowledge).
However, I have found that I can save a print out of the email in OneNote, and then copy and paste the hyperlink to the specific email in the outlook webmail interface. However, the trick/work-around as far as I can tell, is that the email CANNOT be still in the inbox, but must have been moved to a different folder. If it remains in the inbox when you copy-and-paste the hyperlink, when you click on it, it will just open the inbox, instead of opening the specific email you want. This works for me in both Chrome and Edge, I hope others also find it useful.


text:
Q: How to send a message from the RSU to a car at a specific time (omnet++, veins, sumo) I'm using omnet++ (v5.6.2) and veins (v5.1) for the first time and I'm trying to send a message from the RSU to the first car (node[0]) at a specific time during the simulation.
My main goal is to create a way to immediately stop the car when the message is sent by the RSU. I had in mind to create a boolean variable that would turn to true when a certain amount of time has passed and that would trigger the RSU to send the message and therefore force the car to stop (probably from the handleMessage that already exists?).
I've turned the sendBeacons to true at the RSU settings from the example that does something similar to what I want to implement but can't find a way to send only one message to only one car at a given time.
I'm currently looking into MyVeinsApp and DemoBaseApplLayer but I haven't figured out a way to actually do that.
I'd appreciate any help or input! Thanks!

A: Typically, you would model this in OMNeT++ by letting the initialize method of a module schedule a "self message" for a certain time, then reacting to reception of this "self message" by executing what you wanted to happen at this time. For more details, see the OMNeT++ Tic Toc tutorial.
Veins makes this a little bit easier, by (optionally) providing a TimerManager helper component https://github.com/sommer/veins/blob/veins-5.1/doc/manual/timermanager.md, which allows you to use C++ lambdas to execute code at given times. You can see an example module using this TimerManager at https://github.com/sommer/veins/blob/veins-5.1/subprojects/veins_inet/src/veins_inet/VeinsInetSampleApplication.cc


text:
Q: Оплата товаров на сайте банковской картой Появилась задача сделать оплату на сайте по картам. У компании есть расчетный счет (банк Точка), надо что бы средства приходили на него.
Создать форму оплаты для ввода данных карты, а вот куда ее отправлять и как это делается?
Почитал что есть разные посредники типо робокассы, но интересует процесс без посредников. Подскажите с чего начать.
P.S. У точки есть интернет-эквайринг от яндекс кассы, а какие есть еще сервисы для решения этой задачи?


text:
Q: Path in a maze(2-D Array) Question: Given a maze as input alongwith the entry and exit points, find whether a path exists that leads from the entry point to the exit point.
The maze is entered as char[][] with each value being either '+' or ' '(i.e. space). A '+' denotes a wall where as space denotes that their is a way to proceed. Note that we possible moves at any point are limited to the 4 directions, i.e., no diagonal moves are allowed.
A sample maze looks like {
{'+','+','+','+','+','+','+','+','+','+','+'},
{'+',' ',' ',' ',' ','+',' ','+',' ',' ',' '},
{'+',' ','+',' ','+','+',' ',' ',' ','+','+'},
{'+',' ','+',' ',' ',' ',' ','+',' ','+','+'},
{'+',' ',' ',' ','+','+',' ','+',' ',' ','+'},
{'+','+',' ','+','+','+','+','+','+','+','+'}};

If the entry point is {5,2} and the exit point is {1,10} they are provided as input as "5:2,1:10".
Problem is: This code returns true even if path doesn't exist. What's wrong in this?
For instance, it returns true for this maze as well with input 10:7,1:10:
{
{'+','+','+','+','+','+','+','+','+','+','+'};
{'+',' ',' ',' ',' ',' ',' ',' ',' ','+',' '};
{'+',' ','+',' ','+','+',' ','+',' ','+','+'};
{'+',' ','+',' ',' ',' ',' ','+',' ','+','+'};
{'+','+','+',' ','+','+',' ','+',' ',' ','+'};
{'+',' ',' ',' ','+','+',' ',' ',' ',' ','+'};
{'+','+','+','+','+','+','+','+','+',' ','+'};
{'+',' ',' ',' ','+','+',' ',' ','+',' ','+'};
{'+',' ','+','+',' ',' ','+',' ',' ',' ','+'};
{'+',' ',' ',' ',' ',' ','+',' ','+','+','+'};
{'+','+','+','+','+','+','+',' ','+','+','+'}}

Here goes the code
public class MazePath {

    static char[][] testcase11 = {
{'+','+','+','+','+','+','+','+','+','+','+'};
{'+',' ',' ',' ',' ',' ',' ',' ',' ','+',' '};
{'+',' ','+',' ','+','+',' ','+',' ','+','+'};
{'+',' ','+',' ',' ',' ',' ','+',' ','+','+'};
{'+','+','+',' ','+','+',' ','+',' ',' ','+'};
{'+',' ',' ',' ','+','+',' ',' ',' ',' ','+'};
{'+','+','+','+','+','+','+','+','+',' ','+'};
{'+',' ',' ',' ','+','+',' ',' ','+',' ','+'};
{'+',' ','+','+',' ',' ','+',' ',' ',' ','+'};
{'+',' ',' ',' ',' ',' ','+',' ','+','+','+'};
{'+','+','+','+','+','+','+',' ','+','+','+'}}

    static String testcase12 = "10:7,1:10";

    // Getting start and end points from testcase12
    String[] parts1 = testcase12.split(":");
    String[] parts2 = parts1[1].split(",");

    int startX = Integer.valueOf(parts1[0]);
    int startY = Integer.valueOf(parts2[0]);

    int endX = Integer.valueOf(parts2[1]);
    int endY = Integer.valueOf(parts1[2]);

    static char [][] maze = testcase11;
    int[][] visited;
    int row, col;
    char d;
    int result;

    public static void main(String[] args) {
            MazePath testInstance = new MazePath();
            boolean result = testInstance.findPath(testcase11);
            System.out.print("Result is "+result);
    }

    public boolean findPath(char[][] m)
    {
        row = maze.length;
        col = maze[0].length;

        visited = new int[row][col];
        d = 'o';
        result = 0;

        //System.out.println("Enter maze elements row wise, don't give extra characters (just '+' or ' ' without any ',' or ';')");

        for (int i = 0; i < row; i++)
        {
            for (int j = 0; j < col ;j++)
            {
                if(maze[i][j] == '+')
                    maze[i][j] = 1;
                else if((maze[i][j] == ' '))
                    maze[i][j] = 0;
                visited[i][j] = -5;
            }
        }

        // 5 means visited, -5 means not visited
        visited[startX][startY] = 5;

        path(startX, startY, d);
        if(result == 0)
            return false;
        else
            return true;

    }

    public int path(int startX, int startY, char d)
    {
        if(d != 'd' && startX - 1 >= 0)
        {
            if(startX - 1 == endX && startY == endY)
            {
                result = 1;
                return 1;
            }
            else if(maze[startX - 1][startY] == 0)
            {
                if(visited[startX-1][startY] == -5)
                {
                    visited[startX-1][startY] = 5;
                    d = 'u';
                    path(startX-1, startY, d);
                }
            }
        }
        if(d != 'u' && startX + 1 <= row)
        {
            if(startX + 1 == endX && startY == endY)
            {
                result = 1;
                return 1;
            }
            if(maze[startX+1][startY] == 0)
            {
                if(visited[startX+1][startY] == -5)
                {
                    visited[startX+1][startY]=5;
                    d = 'd';
                    path(startX+1, startY, d);
                }
            }
        }
        if(d != 'r' && startY-1 >= 0)
        {
            if(startX == endX && startY-1 == endY)
            {
                result=1;
                return 1;
            }
            if(maze[startX][startY-1]==0)
            {
                if(visited[startX][startY-1]==-5)
                {
                    visited[startX][startY-1] = 5;
                    d = 'l';
                    path(startX,startY-1,d);
                }
            }
        }
        if(d != 'l' && startY+1 <= col)
        {
            if(startX == endX && startY+1 == endY)
            {
                result=1;
                return 1;
            }
            if(maze[startX][startY+1] == 0)
            {
                if(visited[startX][startY+1] == -5)
                {
                    visited[startX][startY+1] = 5;
                    d = 'r';
                    path(startX, startY+1, d);
                }
            }
        }
        return 0;
    }
}

A: Improvised version of your code.

    public class MazePath {

    static char[][] testcase11 = {
        {'+','+','+','+','+','+','+','+','+','+','+'},
        {'+',' ',' ',' ',' ',' ',' ',' ',' ','+',' '},
        {'+',' ','+',' ','+','+',' ','+',' ','+','+'},
        {'+',' ','+',' ',' ',' ',' ','+',' ','+','+'},
        {'+','+','+',' ','+','+',' ','+',' ',' ','+'},
        {'+',' ',' ',' ','+','+',' ',' ',' ',' ','+'},
        {'+','+','+','+','+','+','+','+','+',' ','+'},
        {'+',' ',' ',' ','+','+',' ',' ','+',' ','+'},
        {'+',' ','+','+',' ',' ','+',' ',' ',' ','+'},
        {'+',' ',' ',' ',' ',' ','+',' ','+','+','+'},
        {'+','+','+','+','+','+','+',' ','+','+','+'}};
    static String testcase12 = "10:7,1:10";

    public static void main(String[] args) {
        MazePath testInstance = new MazePath();
        boolean result = testInstance.findPath(testcase11,testcase12);
        System.out.print("Result is "+result);
    }

    public boolean findPath(char[][] maze, String points)
    {
        char [][] inputMaze = maze;

        int row = maze.length;
        int col = maze[0].length;

        // Getting start and end points
        String[] parts1 = points.split(":");
        String[] parts2 = parts1[1].split(",");

        int startX = Integer.valueOf(parts1[0]);
        int startY = Integer.valueOf(parts2[0]);

        int endX = Integer.valueOf(parts2[1]);
        int endY = Integer.valueOf(parts1[2]);

        char[][] visited = new char[row][col];

        boolean result = path(inputMaze, startX, startY, endX, endY, visited);
        if(!result)
            return false;
        else
            return true;
    }

    public boolean path(char[][] inputMaze,int startX, int startY, int endX, int endY, char[][] visited)
    {
        if((startX == endX) && (startY == endY))
        {
            return true;
        }
        if((startX > inputMaze.length-1) || (startY > inputMaze[0].length-1) && (startX < 0 || startY < 0))
        {
            return false;
        }
        if((inputMaze[startX][startY] == ' ') && (visited[startX][startY] != '*'))
        {
            visited[startX][startY] = '*';
        }
        else
        {
            return false;
        }
        boolean u = path(inputMaze, startX-1, startY, endX, endY, visited);
        boolean d = path(inputMaze, startX+1, startY, endX, endY, visited);
        boolean r = path(inputMaze, startX, startY+1, endX, endY, visited);
        boolean l = path(inputMaze, startX, startY-1, endX, endY, visited);

        return u || d|| l || r;
    }
}


text: Q: JavaFX polygon resize using anchor save to background image I create shapes in JavaFx using polygons and anchors.Using these I can modify the shapes on screen.After I finish editing the polygon,I need to right click and integrate the created polygon into the background image.I managed to create a polygon and turn into an image I use in the background.I dont't know how to modify the image to add another polygon to it after I finish editing a new one.I used StackPane to add the image in the background and the polygon+anchors on top of it.Sorry for not posting any code but I'm not at my computer now.Any suggestion is welcomed.


text:
Q: Primefaces Extension 11 error [...] monacoeditor.EditorOptions not present Serious error when running primefaces-extensions. From the message, it says that EditorOptions is not present:
SEVERE: java.lang.TypeNotPresentException: Type org.primefaces.extensions.model.monacoeditor.EditorOptions not present.

Log:
INFORMAÇÕES:   Loading application compras done in 17.059 ms
INFORMAÇÕES:   Using OmniFaces version 3.13
INFORMAÇÕES:   Registering WebSocket filter for url pattern /*
INFORMAÇÕES:   Initializing Soteria 1.1-b01.payara-p5 for context '/compras'
INFORMAÇÕES:   Inicializando Mojarra |version.string| para o contexto '/compras'
GRAVE:   java.lang.TypeNotPresentException: Type org.primefaces.extensions.model.monacoeditor.EditorOptions not present
    at sun.reflect.generics.factory.CoreReflectionFactory.makeNamedType(CoreReflectionFactory.java:117)
    at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:125)
    at sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:49)
    at sun.reflect.generics.visitor.Reifier.reifyTypeArguments(Reifier.java:68)
    at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:138)
    at sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:49)
    at sun.reflect.generics.repository.ClassRepository.getSuperclass(ClassRepository.java:90)
    at java.lang.Class.getGenericSuperclass(Class.java:777)
    at org.jboss.weld.util.reflection.HierarchyDiscovery.discoverFromClass(HierarchyDiscovery.java:139)
    at org.jboss.weld.util.reflection.HierarchyDiscovery.discoverTypes(HierarchyDiscovery.java:132)
    at org.jboss.weld.util.reflection.HierarchyDiscovery.discoverFromClass(HierarchyDiscovery.java:139)
    at org.jboss.weld.util.reflection.HierarchyDiscovery.discoverTypes(HierarchyDiscovery.java:113)
    at org.jboss.weld.util.reflection.HierarchyDiscovery.<init>(HierarchyDiscovery.java:94)
    at org.jboss.weld.util.reflection.HierarchyDiscovery.<init>(HierarchyDiscovery.java:87)
    at org.jboss.weld.annotated.enhanced.TypeClosureLazyValueHolder.computeValue(TypeClosureLazyValueHolder.java:41)
    at org.jboss.weld.annotated.enhanced.TypeClosureLazyValueHolder.computeValue(TypeClosureLazyValueHolder.java:31)
    at org.jboss.weld.util.LazyValueHolder.get(LazyValueHolder.java:46)
    at org.jboss.weld.annotated.slim.backed.BackedAnnotated.getTypeClosure(BackedAnnotated.java:27)
    at org.jboss.weld.annotated.AnnotatedTypeValidator.validateAnnotated(AnnotatedTypeValidator.java:44)
    at org.jboss.weld.annotated.AnnotatedTypeValidator.validateAnnotatedType(AnnotatedTypeValidator.java:62)
    at org.jboss.weld.manager.BeanManagerImpl.getInjectionTargetFactory(BeanManagerImpl.java:1503)
    at org.jboss.weld.manager.BeanManagerImpl.createInjectionTarget(BeanManagerImpl.java:1019)
    at org.glassfish.weld.services.JCDIServiceImpl.injectManagedObject(JCDIServiceImpl.java:357)
    at org.glassfish.faces.integration.GlassFishInjectionProvider.inject(GlassFishInjectionProvider.java:203)
    at com.sun.faces.config.processor.AbstractConfigProcessor.createInstance(AbstractConfigProcessor.java:233)
    at com.sun.faces.config.processor.AbstractConfigProcessor.createInstance(AbstractConfigProcessor.java:199)
    at com.sun.faces.config.processor.RenderKitConfigProcessor.addRenderers(RenderKitConfigProcessor.java:291)
    at com.sun.faces.config.processor.RenderKitConfigProcessor.process(RenderKitConfigProcessor.java:167)
    at com.sun.faces.config.ConfigManager.lambda$initialize$1(ConfigManager.java:341)
    at java.util.Iterator.forEachRemaining(Iterator.java:116)
    at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
    at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580)
    at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:318)
    at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:206)
    at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:5178)
    at com.sun.enterprise.web.WebModule.contextListenerStart(WebModule.java:681)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:5756)
    at com.sun.enterprise.web.WebModule.start(WebModule.java:619)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:958)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:941)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:694)
    at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1851)
    at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1603)
    at com.sun.enterprise.web.WebApplication.start(WebApplication.java:107)
    at org.glassfish.internal.data.EngineRef.start(EngineRef.java:123)
    at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:292)
    at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:361)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.initialize(ApplicationLifecycle.java:623)
    at com.sun.enterprise.v3.server.ApplicationLoaderService.postConstruct(ApplicationLoaderService.java:335)
    at org.jvnet.hk2.internal.ClazzCreator.postConstructMe(ClazzCreator.java:303)
    at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:351)
    at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:463)
    at org.glassfish.hk2.runlevel.internal.AsyncRunLevelContext.findOrCreate(AsyncRunLevelContext.java:281)
    at org.glassfish.hk2.runlevel.RunLevelContext.findOrCreate(RunLevelContext.java:65)
    at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2102)
    at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:93)
    at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:67)
    at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$QueueRunner.oneJob(CurrentTaskFuture.java:1213)
    at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$QueueRunner.run(CurrentTaskFuture.java:1144)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.ClassNotFoundException: org.primefaces.extensions.model.monacoeditor.EditorOptions
    at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1819)
    at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1660)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:348)
    at sun.reflect.generics.factory.CoreReflectionFactory.makeNamedType(CoreReflectionFactory.java:114)
    ... 61 more

INFORMAÇÕES:   Running on PrimeFaces 11.0.0
INFORMAÇÕES:   Running on PrimeFaces Extensions 11.0.2

Has anyone already found a solution to this problem?
Primefaces 11, Primefaces extension 11.0.2, Mojarra 2.3.14, Payara 5.2021.10.

A: This is due to the way Payara is scanning for classes.  For some bizarre reason Payara seems to class load where other containers such as Jboss Wildfly do not and thus do not have this issue.
See issue: https://github.com/primefaces-extensions/primefaces-extensions/issues/718
There is an EASY solution...simply include the Monaco extension in your pom.xml and then Payara will be happy.
<dependency>
   <groupId>org.primefaces.extensions</groupId>
   <artifactId>resources-monacoeditor</artifactId>
   <version>11.0.2</version>
</dependency>

That will make Payara work happily again.


text:
Q: db not looping in html - python, sqlalchemy, flask I'm trying to create a web that you can save bookmarks to wall and add some comments to it so you can check it out later. I made a db that keeps the data and now Im trying to display them in my html. Cant seem to fint what is wrong in my code, that its not showing up. Would love some help please. It does add it the the database. Just not show up.
routes:
@app.route('/', methods=['GET', 'POST'])
@app.route('/home', methods=['GET', 'POST'])
def home():
    form= AddLinkForm()
    bookmarks = Bookmarks.query.order_by(Bookmarks.date_posted.desc())
    if form.validate_on_submit():
        bookmark = Bookmarks(link=form.link.data, content=form.content.data, author=current_user)
        db.session.add(bookmark)
        db.session.commit()
        flash('Your post has been added!', 'success')
    return render_template('home.html', form=form, bookmarks=bookmarks)

models:
class Bookmarks(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    link = db.Column(db.String, nullable=False)
    date_posted = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
    content = db.Column(db.Text, nullable=False)
    user_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False)

    def __repr__(self):
        return f"User('{self.link}, {self.content}, {self.date_posted}')"

home.html
{% for bookmark in bookmarks.items %}

{{ bookmark.link }}

{{ bookmark.content }}

Read More

{{ bookmark.date_posted.strftime('%Y-%m-%d') }}

{% endfor %}

A: I think you forgot the .all() at the end of your query.
In addition, it makes more sense to query the data records after a new one has been added.
@app.route('/home', methods=['GET', 'POST'])
def home():
    form= AddLinkForm()
    if form.validate_on_submit():
        bookmark = Bookmarks(link=form.link.data, content=form.content.data, author=current_user)
        db.session.add(bookmark)
        db.session.commit()
        flash('Your post has been added!', 'success')
    bookmarks = Bookmarks.query.order_by(Bookmarks.date_posted.desc()).all()
    return render_template('home.html', form=form, bookmarks=bookmarks)

And now you can iterate over the results of the query.
{% for bookmark in bookmarks %}

{% endfor %}


text:
Q: Есть альтернатива size(), только для массивов? void array_print(vector<int> & arr)
{
for (int i = 0; i < arr.size(); ++i) cout<<i<<" Ячейка массива:"<<arr[i]<<endl;
}

void array_print(int arr[])
{
for (int i = 0; i < /*arr.size()*/; ++i) cout<<i<<" Ячейка массива:"<<arr[i]<<endl;
}

A: Есть шаблонная.
template<class T, size_t N>
size_t length(T(&)[N])
{
    return N;
}

int main()
{
    int a[10];
    cout << length(a) << endl;
}

Но учтите, что фокус типа
int * a = new int[20];
cout << length(a) << endl;

не пройдет.
Как не пройдет и
void func(int a[])
{
    cout << length(a) << endl;
}

A: В функции array_print параметр arr является указателем на элемент массива. Узнать размер массива по указателю на его элемент невозможно.
В ситуации, когда размер массива не фиксирован на стадии компиляции, у вас есть только один вариант - передавать размер массива извне вручную
void array_print(int arr[], int n)
{
  for (int i = 0; i < n; ++i) cout<<i<<" Ячейка массива:"<<arr[i]<<endl;
}


text:
Q: New Spring Project Build Failure I am a total beginner to spring. I have installed jdk and maven…
echo $JAVA_HOME shows:
/Library/Java/JavaVirtualMachines/jdk-9.0.4.jdk/Contents/Home

$ javac -version shows:
javac 9.0.4

mvn -version shows:
Apache Maven 3.5.2 (138edd61fd100ec658bfa2d307c43b76940a5d7d; 2017-10-18T08:58:13+01:00)
Maven home: /usr/local/Cellar/maven/3.5.2/libexec
Java version: 9.0.4, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk-9.0.4.jdk/Contents/Home
Default locale: en_GB, platform encoding: UTF-8
OS name: "mac os x", version: "10.13.2", arch: "x86_64", family: "mac"

The only thing I have done so far is create a package called "controller" with a "HomeController.java" file inside it, with this code:
package com.demo.spring.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
public class HomeController {

    @RequestMapping(value = "/", method = RequestMethod.GET)
    public String index(){

        return "Hello World.";
    }
}

But when I do mvn spring-boot:run I get:
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.561 s
[INFO] Finished at: 2018-01-17T13:28:14Z
[INFO] Final Memory: 25M/83M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:1.5.9.RELEASE:run (default-cli) on project demo: Could not exec java: Application finished with exit code: 1 -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

I have not touched spring before so having installed jdk (via java website) and maven (via homebrew) and followed tutorial for setting up spring app inside intellij I don't know what I have done wrong/not done. I see the error referencing unable to exec java and the link provided states it is a plugin issue, but how do I solve this?
pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.demo.spring</groupId>
    <artifactId>demo</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>demo-spring</name>
    <description>Demo project for Spring Boot</description>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.5.9.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>

A: You current version of jdk is 1.9.0 but in pom.xml it is point to 1.8 so you need to change that version to 1.9.
Below is your version
<properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>
    </properties>

Change it to the 1.9
<properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.9</java.version>
    </properties>

then try to run below command

mvn clean spring-boot:run

A: I think all these errors are related to Java 9.
Maven has suggested some changes for Java 9, May be you can use them like:

*

*Add Java 9 as properties:

*For Compilation failure, fix maven-compiler-plugin:

*For Test failure, fix maven-surefire-plugin

*For Packaging failure, fix maven-jar-plugin (optional)

*For Spring boot plugin failure, fix spring-boot-maven-plugin

For more informations, go this blog.


text:
Q: With regards to piping commands, what are the greater than (>) and less than (<) symbols called? On linux at least, and I think windows/dos shell too you can use > to "pipe" output into a file.  Something like:
cat myfile.txt > mightAsWellCP.txt

What is that piece of syntax sugar called?  This is a "pipe": | so what do we call the > and <  (and << and >> while were at it.)

A: They're symbols for redirection of input/output.
Quick runthrough on the differences between the redirection syntax commands

A: When speaking a command-line, I usually pronounce the symbols by their function.

*

*> "output to"

*>> "append to"

*< "input from"

*| "pipe"

So when reading your example out loud:
cat myfile.txt > mightAsWellCP.txt

I would pronounce as "cat myfile dot T X T output to might as well C P dot T X T".

A: > is used to redirect output.
$ echo "hello" > file.txt

< is used to redirect input.
$ cat < file.txt

Output:
hello

>> is used to append output to the end of the file.
$ echo "world!" >> file.txt

Output:
hello
world!

<< (called "here document") is a file literal or input stream literal.
$ cat << EOF >> file.txt

Output:
>

Here you can type whatever you want and it can be multi-line. It ends when you type EOF. (We used EOF in our example but you can use something else instead.)
> linux
> is
> EOF

Output:
hello
world!
linux
is

<<< (called "here string") is the same as <<
but takes only one "word" (i.e., string).
$ cat <<< great! >> file.txt

Output:
hello
world!
linux
is
great!

Note that we could have used $ cat <<< great! | tee file.txt instead of $ cat <<< great! >> file.txt, but that would do something different.

A: I usually refer to all four variations (< << > >>) as a "redirect" when speaking to folks that I know will understand.


text:
Q: How do I access a db container when using podman-compose? I've been trying to figure out how to connect to a mariadb container while using podman-compose and I keep getting an error.
Here's what I've done:
Software Versions
podman version = 3.3.1
podman-compose version = podman-compose-0.1.7-2.git20201120.el8.noarch`

docker-compose.yml
version: '3'
services:
  db:
    image: mariadb:latest
    environment:
      MARIADB_USER: user
      MARIADB_PASSWORD: pass
      MARIADB_DATABASE: testdb
      MARIADB_ROOT_PASSWORD: rootpass
    volumes:
      - db_data:/var/lib/mysql

When I spin this container up using: podman-compose up -d
Then try to connect to this database using:
podman exec -it project_db_1 mariadb -uroot -prootpass

I get this error:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

I get this error both as a regular user and as the root user.
Yet, when I run the same container with podman:
Podman Command
podman run -d \
--name mariadb \
-e MARIADB_USER=user \
-e MARIADB_PASSWORD=pass \
-e MARIADB_DATABASE=testdb \
-e MARIADB_ROOT_PASSWORD=rootpass \
mariadb:latest

Then try to connect to this database using:
podman exec -it mariadb mariadb -uroot -prootpass

I am able to successfully login.
Can anyone please explain to me what I'm doing wrong with podman-compose or why it's not allowing me to login with the credentials I've given?

A: OK, for anyone that want's to know what I did to fix this...
Firstly, I uninstalled podman & podman-compose because there were just too many issues with it, so I installed docker & docker-compose.
Secondly, when I ran this script in docker-compose, I got an error that wasn't showing up in podman-compose.
Error: services.db.environment must be a mapping
After Googling that error, I found out that I needed to format the environment section like this:
version: '3'
services:
  db:
    image: mariadb:latest
    environment:
      - MARIADB_USER=user
      - MARIADB_PASSWORD=pass
      - MARIADB_DATABASE=testdb
      - MARIADB_ROOT_PASSWORD=rootpass
    volumes:
      - db_data:/var/lib/mysql

After I fixed that, docker-compose ran beautifully and I could connect to my database, even from another container.  I did do a test using podman-compose with this code fix, and it still wouldn't work.  So I'm just going to use docker until podman fixes their issues.

A: You need to make sure to bind to the "public" address of the container. It will by default bind to 0.0.0.0. On that interface you cannot access it from other pods.
Add a command to the service, and set --bind-address. Like this:
services:
  db:
    image: docker.io/mariadb:latest
    command: --bind-address=db

This will make it listen to the correct interface :)


text:
Q: Inline markup blocks (@Content) cannot be nested. Only one level of inline markup is allowed Hello I am getting the error:
Inline markup blocks (@
Content
) cannot be nested.  Only one level of inline markup is allowed.

Using a Kendo UI tabstrip and MultiSelectBoxes with a Razor View and MVC4
I have tried implementing the helper class, but I am still getting the error
Here is my code, am I missing a step?  I moved the 3 multiselects out and called them with the helper!
@(Html.Kendo().TabStrip()
      .Name("tabstrip")
      .Items(tabstrip =>
      {
          tabstrip.Add().Text("One")
              .Content(@

                            @RenderSelect()

;);

          tabstrip.Add().Text("Two")
              .Content("Two");

          tabstrip.Add().Text("Three")
              .Content("Three");
      })
      .SelectedIndex(0)
)

@helper RenderSelect()
{

MyList

                                    One
                                    @(Html.Kendo()
                                          .MultiSelect()
                                          .Name("One")
                                          .AutoBind(true)
                                          .Placeholder("Select Clients...")
                                          .DataTextField("hname")
                                          .DataSource(source =>
                                          {
                                              source.Read(read =>
                                              {
                                                  read.Action("Client", "Dist");
                                              })
                                                    .ServerFiltering(true);
                                          })

                                    )
                                    Two
                                    @(Html.Kendo()
                                          .MultiSelect()
                                          .Name("Two")
                                          .AutoBind(true)
                                          .DataTextField("gname")
                                          .Placeholder("Select Recipients...")
                                          .DataSource(source =>
                                          {
                                              source.Read(read =>
                                              {
                                                  read.Action("Client", "Dist");
                                              })
                                                    .ServerFiltering(true);
                                          })

                                          )
                                     Three
                                    @(Html.Kendo()
                                          .MultiSelect()
                                          .Name("Three")
                                          .AutoBind(true)
                                          .DataTextField("id")
                                          .Placeholder("Select CLL...")
                                          .DataSource(source =>
                                          {
                                              source.Read(read =>
                                              {
                                                  read.Action("Codes", "Dist");
                                              })
                                                    .ServerFiltering(true);
                                          })

                                    )
}

A: I figured it out.
I have to chain the helpers.
So One helper class for each of the multi-selects.
Follow This:
http://www.aspnetwiki.com/telerik-mvc:nested-container-controls-and-razor-helper
Then If you want multiple MultiSelects In One Tab You will need to have a helper for each multiselect like this:
Here is the helper, just copy this for the second third and fourth and change the names etc...
@helper RenderMultiFirstBox()
{
      @(Html.Kendo()
                .MultiSelect()
                .Name("First")
                .AutoBind(true)
                .Placeholder("Select First...")
                .DataTextField("name")
                .DataSource(source =>
                  {
                      source.Read(read =>
                      {
                           read.Action("Index", "Something");
                      })
                 .ServerFiltering(true);
                   })

          )
    }

Then Call the helpers in the TabStrip 'Content' like this:
.Items(tabstrip =>
          {
              tabstrip.Add().Text("One")

                  .Content(@<text>
                                                       @RenderMultiSelectFirstBox()
                                                       @RenderMultiSelectSecondBox()</text>);


text:
Q: I am installing polymer in visual studio code but there are many errors I am getting a lot of errors C:\Program Files\nodejs>npm install -g bower
npm WARN deprecated bower@1.8.8: We don't recommend using Bower for new projects. Please consider Yarn and Webpack or Parcel. You can read how to migrate legacy project here: https://bower.io/blog/2017/how-to-migrate-away-from-bower/
C:\Users\Deepanshi\AppData\Roaming\npm\bower -> C:\Users\Deepanshi\AppData\Roaming\npm\node_modules\bower\bin\bower

*

*bower@1.8.8
added 1 package from 1 contributor in 14.243s

C:\Program Files\nodejs>npm install -g polymer-cli@next
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules\polymer-cli\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"ia32"})
npm ERR! code EEXIST
npm ERR! path C:\Users\Deepanshi\AppData\Roaming\npm\node_modules\polymer-cli\bin\polymer.js
npm ERR! dest C:\Users\Deepanshi\AppData\Roaming\npm\polymer
npm ERR! EEXIST: file already exists, cmd shim 'C:\Users\Deepanshi\AppData\Roaming\npm\node_modules\polymer-cli\bin\polymer.js' -> 'C:\Users\Deepanshi\AppData\Roaming\npm\polymer'
npm ERR! File exists: C:\Users\Deepanshi\AppData\Roaming\npm\polymer
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.
npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Deepanshi\AppData\Roaming\npm-cache_logs\2020-10-07T12_56_44_680Z-debug.log

A: Try this :
npm i -g --force npm (note the --force flag)
If your output is get running npm install -g npm:
You can fix it with "brew reinstall node"
So :
brew reinstall node
npm i -g --force npm


text:
Q: Are transparent JFrame backgrounds not possible in Windows 10? I have a JPanel in an undecorated JFrame. I want to draw an image to the JPanel. When the image contains transparent pixels, I want these to be "see-through" so that you can see whatever is behind the window.
All my research has told me that I should make
myJFrame.setUndecorated(true);
myJFrame.setBackground(new Color(0,0,0,0));
myJPanel.setOpaque(false);

, but as soon as my JFrame's background color's alpha is anything else than 255, my JPanel is not being drawn to anymore.

A: So, based on my limited testing, it seems to work fine on Windows 10

import java.awt.Color;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import javax.swing.border.LineBorder;

public class Test {

    public static void main(String[] args) {
        new Test();
    }

    public Test() {
        EventQueue.invokeLater(new Runnable() {
            @Override
            public void run() {
                try {
                    try {
                        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
                    } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) {
                        ex.printStackTrace();
                    }

                    JFrame frame = new JFrame("Testing");
                    frame.setUndecorated(true);
                    frame.setBackground(new Color(0, 0, 0, 0));
                    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                    frame.setContentPane(new TestPane());
                    frame.pack();
                    frame.setLocationRelativeTo(null);
                    frame.setVisible(true);
                } catch (IOException ex) {
                    ex.printStackTrace();
                }
            }
        });
    }

    public class TestPane extends JPanel {

        private BufferedImage img;

        public TestPane() throws IOException {
            img = ImageIO.read(...);
            setOpaque(false);
            setBorder(new LineBorder(Color.RED));
        }

        @Override
        public Dimension getPreferredSize() {
            return new Dimension(img.getWidth(), img.getHeight());
        }

        @Override
        protected void paintComponent(Graphics g) {
            super.paintComponent(g);
            Graphics2D g2d = (Graphics2D) g.create();
            int x = (getWidth() - img.getWidth()) / 2;
            int y = (getHeight() - img.getHeight()) / 2;
            g2d.drawImage(img, x, y, this);
            g2d.dispose();
        }

    }

}

And just to be sure, I did a test using a JLabel...
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import javax.swing.border.LineBorder;

public class Test {

    public static void main(String[] args) {
        new Test();
    }

    public Test() {
        EventQueue.invokeLater(new Runnable() {
            @Override
            public void run() {
                try {
                    try {
                        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
                    } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) {
                        ex.printStackTrace();
                    }

                    JFrame frame = new JFrame("Testing");
                    frame.setUndecorated(true);
                    frame.setBackground(new Color(0, 0, 0, 0));
                    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                    frame.setContentPane(new TestPane());
                    frame.pack();
                    frame.setLocationRelativeTo(null);
                    frame.setVisible(true);
                } catch (IOException ex) {
                    ex.printStackTrace();
                }
            }
        });
    }

    public class TestPane extends JPanel {

        public TestPane() throws IOException {
            BufferedImage img = ImageIO.read(...);
            setOpaque(false);
            setBorder(new LineBorder(Color.RED));
            setLayout(new BorderLayout());
            add(new JLabel(new ImageIcon(img)));
        }

    }

}

This would suggest that the issue is somewhere in the code you're not showing us. Consider providing a runnable example which demonstrates your problem. This is not a code dump, but an example of what you are doing which highlights the problem you are having. This will result in less confusion and better responses