## How to export \$PreRead variable defined in a package to the user?

I am writing a package and I need to increase the precision in the computations. I found that if I define the

``````\$PreRead=(#/.s_String/;StringMatchQ(s,NumberString)&&Precision@ToExpression@s==MachinePrecision:>s<>"`10."&);
``````

inside the package (before and after `Begin("`Private`")`) it is not exported to the user. If I run the same line in the notebook before calling the package then it works fine.

How can one set \$PreRead inside the package and pass it to the user?

## ¿Como guardarme en una variable la clave principal de otra clase? Java

estoy haciendo un proyecto en java sobre eventos y pabellones. Tengo creado un treeSet de eventos donde me guardo los eventos con sus atributos y una en la clase pabellones me guardo estos en un arrayList. Me ha surgido una duda, y es que, como puedo guardarme el atributo numPabellon (que es la clave principal de los pabellones) en una variable que cree en la clase Eventos?? Quiero relacionar las dos clases de esta manera y no se como, es decir, que en la clase Eventos se me guarde una variable con el numero de pabellon donde este se va a celebrar.

``````    import java.io.Serializable;
import java.time.LocalDate;

public abstract class Evento implements Serializable, Comparable<Evento> {
protected LocalDate fechaInicio;
protected LocalDate fechaFin;
protected String tematica;
protected String nombre;
public String ID;
protected static int contID;

public Evento() {
Evento.contID++;
this.ID=Evento.contID + String.valueOf((char) ((int) (Math.random() * 26) + 65));
fechaInicio = LocalDate.parse("2020-05-06");
fechaFin = LocalDate.parse("2020-05-09");
tematica = "Musica";
}

public Evento(String nombre,int yearStart,int monthStart,int dayStart,LocalDate fechaFin,String tematica, double precioEntrada, String ID, int pabellon) {
this.nombre = nombre;
this.fechaInicio = LocalDate.of(yearStart, monthStart, dayStart);
this.fechaFin = fechaFin;
this.tematica = tematica;
this.ID=ID;
}

public double getPrecioEntrada() {
}

}

public LocalDate getFechaFin() {
return fechaFin;
}

public void setFechaFin(LocalDate fechaFin) {
this.fechaFin = fechaFin;
}

public LocalDate getFechaInicio() {
return fechaInicio;
}

public void setFechaInicio(LocalDate fechaInicio) {
this.fechaInicio = fechaInicio;
}

public String getTematica() {
return tematica;
}

public void setTematica(String tematica) {
this.tematica = tematica;
}

public String getNombre() {
return nombre;
}

public void setNombre(String nombre) {
this.nombre = nombre;
}

public String getID() {
return ID;
}

public void setID(String iD) {
ID = iD;
}

@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((ID == null) ? 0 : ID.hashCode());
result = prime * result + ((fechaFin == null) ? 0 : fechaFin.hashCode());
result = prime * result + ((fechaInicio == null) ? 0 : fechaInicio.hashCode());
result = prime * result + ((nombre == null) ? 0 : nombre.hashCode());
long temp;
result = prime * result + (int) (temp ^ (temp >>> 32));
result = prime * result + ((tematica == null) ? 0 : tematica.hashCode());
return result;
}

@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Evento other = (Evento) obj;
if (ID == null) {
if (other.ID != null)
return false;
} else if (!ID.equals(other.ID))
return false;
if (fechaFin == null) {
if (other.fechaFin != null)
return false;
} else if (!fechaFin.equals(other.fechaFin))
return false;
if (fechaInicio == null) {
if (other.fechaInicio != null)
return false;
} else if (!fechaInicio.equals(other.fechaInicio))
return false;
if (nombre == null) {
if (other.nombre != null)
return false;
} else if (!nombre.equals(other.nombre))
return false;

return false;
if (tematica == null) {
if (other.tematica != null)
return false;
} else if (!tematica.equals(other.tematica))
return false;
return true;
}

public abstract double precioEntrada();

public String toStringFichero() {
return nombre + ";"+ fechaInicio + ";" + tematica + ";" + precioEntrada + ";" + ID;
}

@Override
public String toString() {
return "(fechaInicio=" + fechaInicio + ", fechaFin=" + fechaFin + ", tematica=" + tematica+ ", precioEntrada=" + String.format("%.2f",precioEntrada) +"€" + ", nombre=" + nombre + ", ID=" + ID + ". pabellon=" + pabellon + ")";
}

}

import java.io.Serializable;
import java.util.HashSet;

public class Pabellon implements Serializable, Comparable<Pabellon> {
protected static int contNumero;
protected int numPabellon;
protected int aforo;
protected double precioAlquiler;
protected double m2;
HashSet <Evento> eventos = new HashSet<Evento>();

public Pabellon() {
Pabellon.contNumero++;
numPabellon=contNumero;
m2 = (Math.random()*14001+1000);
aforo = getAforoM2();
precioAlquiler=Math.random()*aforo+1001;

}

public Pabellon(int numPabellon, int aforo, double precioAlquiler, double m2) {
this.numPabellon = numPabellon;
this.aforo = aforo;
this.precioAlquiler = precioAlquiler;
this.m2=m2;
}

public HashSet<Evento> getEventos() {
return eventos;
}

public int getNumPabellon() {
return numPabellon;
}

public void setNumPabellon(int numPabellon) {
this.numPabellon = numPabellon;
}

public void setEventos(Evento evento){
}

public int getAforoM2() {

if (m2>=1000 && m2<=3000) {
aforo = 2500;
} else if (m2>=3001 && m2<=5000){
aforo = 5000;
} else if (m2>=5001 && m2 <=7000) {
aforo = 7000;
} else if (m2>=7001 && m2<=9000) {
aforo = 9000;
} else if (m2>=9001 && m2<=11000) {
aforo = 11000;
} else if (m2>=11001 && m2<=13000) {
aforo = 13000;
} else if (m2>=13001 && m2<=15000) {
aforo = 15000;
}
return aforo;
}

@Override
public int compareTo(Pabellon arg0) {
// TODO Auto-generated method stub
return 0;
}

@Override
public String toString() {
return "Pabellon (numPabellon=" + numPabellon + ", aforo=" + aforo + ", precioAlquiler=" + String.format("%.2f",precioAlquiler)
+ ", m2=" + String.format("%.2f",m2) + ", eventos=" + eventos +")";
}

public String toStringFichero() {
return numPabellon + ";" + aforo + ";" + precioAlquiler
+ ";" + m2;
}

}
``````

## javascript – como habilitar o inhabilitar un input text dependiendo de otra variable?

pregunta como haria para habilitar o inhabilitar usando el disable… el input dependiendo si analista.permisoCrear esta en true o false

``````<tr v-for="analista in detalleAnalista.data">
<th scope="row">@{{ analista.nombre }}</th>
<td>@{{ analista.cargo }}</td>
<td><input type="checkbox" v-on:change="estados(analista.id,analista.idAnaProy,proyecto.id,proyecto.id_proyecto_division, \$event)" v-model="analista.estatus" ></td>
@keyup="horasTotales"

type="text"></td>
<td>@{{ analista.suma }}</td>
<td>
<a v-bind:href="'/formCargarHoras/'+analista.idAnaProy" target="_self">
<i class="fas fa-user-edit" v-if= "analista.permisoCrear"></i>
</td>
</tr>
``````

Esta parte del js es cuando ya hice la busqueda y el self.detalleAnalista es el que tiene el permisoCrear el cual con el me gustaría habilitar o inhibilitar el input

``````if(response.status === 200 && response.data.response === true){

self.detalleAnalista.data = response.data.analistas;
self.detalleAsigproyecto.data = response.data.proyecto;

for (var i = 0; i < self.detalleAnalista.data.length; i++) {
if (self.detalleAnalista.data(i).horas_asignadas === null) {
self.horasComparar(i) = 0;
}

}
``````

## secure boot – Time Authenticated EFI Variable

I’m setting up custom secure boot keys on an Asus Z87I-Deluxe motherboard. On other computers I’ve setup with secure boot, I’ve been able to either write the PK, KEK, and DB keys into the EFI variables via the `/sys/firmware/efi/efivars` filesystem or I’ve been able to load them in via the BIOS menu. I’ve always used DER encoded x509 certificates.

On this board, I’m able to write to the PK, KEK, and DB keys in both manners and read the variables back after a reboot. However, the computer will not boot a signed UEFI image. It doesn’t give any errors, it just drops you back at the UEFI menu each time you select the boot device. I’ve verified the UEFI signature with `sbverify` successfully.

``````
\$ for file in PK KEK DB; do
sudo openssl x509 -inform DER -in /root/secure-boot/\$file.cer -outform PEM
| sudo openssl verify -CAfile /root/secure-boot/\$file.crt
done
stdin: OK
stdin: OK
stdin: OK

\$ efibootmgr --verbose
BootCurrent: 0000
Timeout: 1 seconds
BootOrder: 0000,0001,0002,0003
Boot0000* linux HD(1,GPT,12684b61-8989-4df2-bc61-c2d7c6d640d0,0x800,0x64001)/File(EFIlinux.efi)

\$ sudo sbverify --cert=/root/secure-boot/DB.crt /boot/EFI/linux.efi
warning: data remaining(24749608 vs 24759224): gaps between PE/COFF sections?
Signature verification OK
``````

The user manual for the Z87I mentions that when loading the variables in via the BIOS menu, they must be formatted as “a UEFI variable structure with time-based authenticated variable” (section 8.2.2, I presume?).

I’ve never seen another BIOS that requires such a thing and I’m not aware of any software that can generate the required format.

Am I interpreting this correctly? I’ve tried writing straight DER and PEM files without any success.

## scoping – How to return a variable name and value from within a self-contained function block?

Abstract: I have viewed other solutions on StackExchange but none actually address using a fully self-contained function to return name and value of a variable. The only function that works requires using `SetAttributes(...)` outside the function before using it: Display variable name instead of value

Goal: to create a completely self-contained function `Block(...)` or `Module(...)` that returns variable name and value without requiring using an outside function such as `SetAttributes(...)`.

About the Code: Below is the code for four different attempts. The top two are globally scoped and work fine. Bottom two are written into a function block but do not work. The output is decorated with strings to give you an idea of how I intend to use it.

``````varname=123;

(* this works *)
Row({"Global Scope Defer: ","the name is ",Defer@varname," and value is -> ",varname})

(*this works *)
SetAttributes(ShowName,HoldAll);
ShowName(name_):=Row({"Global Scope SetAttributes HoldForm: ","the name is ",HoldForm@name," and value is -> ",ReleaseHold@name});
ShowName(varname)

(* this doesn't work *)
showDeferFunction(var_):=Block({pre,arrow},
pre="the name is ";
arrow=" and value is -> ";
Row({"Functional Scoping Defer: ",pre,Defer@var,arrow,var})
);
showDeferFunction(varname)

(* this doesn't work either *)
showHoldFormFunction(var_):=Block({pre,arrow},
pre="the name is ";
arrow=" and value is -> ";
SetAttributes(ShowName,HoldAll);
ShowName(name_):=Row({"Functional Scoping SetAttributes HoldForm: "pre,HoldForm@name,arrow,ReleaseHold@name});
ShowName(var)
);
showHoldFormFunction(varname)
``````

The Output:

``````Global Scope Defer: the name is varname and value is -> 123
Global Scope SetAttributes HoldForm: the name is varname and value is -> 123
Functional Scoping Defer: the name is 123 and value is -> 123
Functional Scoping SetAttributes HoldForm:  the name is 123 and value is -> 123
``````

## regex – Set string from another file as variable in Powershell

I have this text file contains the following line

``````group1,name1
group2,name2
group3,name3
``````

How do I iterate the value of those string in a powershell script to print match string? If manually assign variable I will do it something like this

``````get-content data.csv -ReadCount 1000 | foreach { \$_ -match "group1" } | Out-File name1.txt -encoding Utf8
``````

## expected value – Integrability of random variable- theoretic aspect

in some topics (for example in martingale theory, strong law of large numbers), we have to check integrability of a given random variable $$X$$, i.e. $$E|X|.
Okay, so assume that I have some random variable $$X$$ and I know only that $$EX=3$$. I cant compute $$E|X|$$, but do I need it to confirm integrability? Random variable is integrable if $$EX^+$$ and $$EX^-$$ are finite and I think that until now we know only that $$EX^+-EX^-=3$$ and I think that it implies that integrability properties mentioned above, because we cant get the $$3$$ number as a difference of two infinities. Or maybe we can?

## Error code variable

Hello,
I'm looking for the error variable name wich I could use in a automated html error page, using SSI.
It should have the "403" value in case of "Forbiden" access attempted.
Thank you per advance.

## naming – Is it acceptable to use “or” in the name of a boolean variable?

Say we have a boolean variable indicating whether an input array is 2D or 3D (just an example). Is it acceptable to name it `is_2d_or_3d` instead of `is_2d`, to make it clearer that if false, it indicates the input is 3D?

I’ve personally been doing this for quite some time. I don’t remember if I picked it up from some guidelines or just thought of it myself. Is there any conventions suggesting this? If not, are there any drawbacks of this approach (besides not being recommended by guidelines)?

## pointer times variable value, var = (var + 1)&3

The code I am referring to occurs
here. I did not know that this was legal c that does not result in a segfault. What is its purpose?