electronic voting – How can a “cosmic radiation bitflip” possibly change the election results?

I started watching this ridiculous video before I had to quit it: https://www.youtube.com/watch?v=AaZ_RSt0KP8

It talks about how the election of some country got messed up due to a “bitflip”, which gave one person 4096 votes due to “cosmic rays” messing with the computer, “changing one bit”.

What?

Surely, a government doesn’t implement a digital voting mechanism as a single database table where they do:

UPDATE votes SET count = count + 1 WHERE person = $1

?? That’s something that a single 16-year-old amateur programmer would do in the year 2002 for his Counter-Strike statz website. Not a professional working for a government for an election. Surely they would do it like:

INSERT INTO votes (person, voter) VALUES ($1, $2);

And recording the timestamp as its own “row”, so that any “bitflips” could not possibly change the vote results besides possibly one extra/too few votes by having the query/transaction failing.

What am I missing?

strings – Trying to make this VBA code run faster / possibly make it easier to read and update?

Apologies for the long code below in advance. The code simply looks at 1 cell in sheet 2 that is a date to determine what to do with the cells in sheet 1. The code that I have below works, but it takes about 20 seconds to run it which seems like more than it should, and I feel like the code could be a lot shorter (if only I was better with coding frowns ) I had to find a similar code online that would work, I figure it’s not the best one to use in this situation.

End goal here is to take cell C:24 from sheet2 and find this date in Row 4 of sheet1. Then in sheet 1 I am just copying and pasting cells as values in their specific rows in that same column. The rows are listed below (I only need the cells in those rows for the specific column pasted as a value)

Example: Sheet2 cell C:24 = 9/2/2021 In sheet1 “9/2/2021” is in column ABC:4 According to the code below I would want ABC:18 , ABC:19 (and so on) copied and pasted as a value in the same cell that they are currently in (they are currently formulas in their respective cells)

Public Sub Paste_Amounts_As_Values()
Dim todayDate, tomorrowDate As Date
Dim sourceID, targetID As Integer
Dim countdate As Range
Dim wS As Worksheet
Dim aRowVal, bRowVal, cRowVal, dRowVal, eRowVal, fRowVal, gRowVal, hRowVal, jRowVal, kRowVal, 
lRowVal, mRowVal, nRowVal, oRowVal, pRowVal, qRowVal, rRowVal, sRowVal As String

Worksheets("Sheet2").Activate

todayDate = Sheets("Sheet2").Range("C24").Value

Worksheets("Sheet1").Activate

Set wS = ThisWorkbook.Worksheets("Sheet1")
lastcol = wS.Cells(4, 4).End(xlToRight).Column
'dateRow = wS.Range("C24").Cells(4, lastcol).Value

ReDim selectData(1 To lastcol) As Variant

For i = 1 To lastcol - 1
selectData(i) = wS.Cells(4, i + 1)
Next i

For i = 1 To lastcol - 1
If selectData(i) = todayDate Then  'Cells to Copy

aRowVal = ActiveSheet.Cells(18).Formula
bRowVal = ActiveSheet.Cells(19).Formula

cRowVal = ActiveSheet.Cells(29).Formula
dRowVal = ActiveSheet.Cells(30).Formula

eRowVal = ActiveSheet.Cells(40).Formula
fRowVal = ActiveSheet.Cells(41).Formula

gRowVal = ActiveSheet.Cells(51).Formula
hRowVal = ActiveSheet.Cells(52).Formula

jRowVal = ActiveSheet.Cells(62).Formula
kRowVal = ActiveSheet.Cells(63).Formula

lRowVal = ActiveSheet.Cells(73).Formula

mRowVal = ActiveSheet.Cells(84).Formula

nRowVal = ActiveSheet.Cells(94).Formula

oRowVal = ActiveSheet.Cells(105).Formula

pRowVal = ActiveSheet.Cells(115).Formula
qRowVal = ActiveSheet.Cells(116).Formula

rRowVal = ActiveSheet.Cells(126).Formula

sRowVal = ActiveSheet.Cells(179).Formula

sourceID = i + 1
'Debug.Print aRowVal
'Debug.Print bRowVal

  End If
  Next i


If sourceID = 0 Then
MsgBox ("There is no match date with Today")
Else
For i = 1 To lastcol - 1
If selectData(i) = todayDate Then  'Pasting as Value
     
     ActiveSheet.Cells(18) = aRowVal
     ActiveSheet.Cells(18, sourceID) = ActiveSheet.Cells(18, sourceID)
     ActiveSheet.Cells(19) = bRowVal
     ActiveSheet.Cells(19, sourceID) = ActiveSheet.Cells(19, sourceID)
     
     ActiveSheet.Cells(29) = cRowVal
     ActiveSheet.Cells(29, sourceID) = ActiveSheet.Cells(29, sourceID)
     ActiveSheet.Cells(30) = dRowVal
     ActiveSheet.Cells(30, sourceID) = ActiveSheet.Cells(30, sourceID)
     
     ActiveSheet.Cells(40) = eRowVal
     ActiveSheet.Cells(40, sourceID) = ActiveSheet.Cells(40, sourceID)
     ActiveSheet.Cells(41) = fRowVal
     ActiveSheet.Cells(41, sourceID) = ActiveSheet.Cells(41, sourceID)
     
     ActiveSheet.Cells(51) = gRowVal
     ActiveSheet.Cells(51, sourceID) = ActiveSheet.Cells(51, sourceID)
     ActiveSheet.Cells(52) = hRowVal
     ActiveSheet.Cells(52, sourceID) = ActiveSheet.Cells(52, sourceID)
     
     ActiveSheet.Cells(62) = jRowVal
     ActiveSheet.Cells(62, sourceID) = ActiveSheet.Cells(62, sourceID)
     ActiveSheet.Cells(63) = kRowVal
     ActiveSheet.Cells(63, sourceID) = ActiveSheet.Cells(63, sourceID)
     
     ActiveSheet.Cells(73) = lRowVal
     ActiveSheet.Cells(73, sourceID) = ActiveSheet.Cells(73, sourceID)
     
     ActiveSheet.Cells(84) = mRowVal
     ActiveSheet.Cells(84, sourceID) = ActiveSheet.Cells(84, sourceID)
     
     ActiveSheet.Cells(94) = nRowVal
     ActiveSheet.Cells(94, sourceID) = ActiveSheet.Cells(94, sourceID)
     
     ActiveSheet.Cells(105) = oRowVal
     ActiveSheet.Cells(105, sourceID) = ActiveSheet.Cells(105, sourceID)
     
     ActiveSheet.Cells(115) = pRowVal
     ActiveSheet.Cells(115, sourceID) = ActiveSheet.Cells(115, sourceID)
     ActiveSheet.Cells(116) = qRowVal
     ActiveSheet.Cells(116, sourceID) = ActiveSheet.Cells(116, sourceID)
     
     ActiveSheet.Cells(126) = rRowVal
     ActiveSheet.Cells(126, sourceID) = ActiveSheet.Cells(126, sourceID)
     
     ActiveSheet.Cells(179) = sRowVal
     ActiveSheet.Cells(179, sourceID) = ActiveSheet.Cells(179, sourceID)
     
     
     
     targetID = i + 1
    'Debug.Print ActiveSheet.Cells(9, i + 1)
    'Debug.Print ActiveSheet.Cells(11, i)
End If
Next i
If targetID = 0 Then
MsgBox ("There is no match date with Tomorrow")
End If
End If
End Sub

multiple Mac performance issues, possibly related?

In the last few years my Mac has acquired several annoying quirks. In order of severity:

  • Save-dialogs take 15~45 sec to appear – and take awhile to dismiss if I hit cmd-S by accident.
  • Hitting caps lock often freezes the keyboard for several seconds.
  • In a few old fonts (Courier, Times, Palatino, Helvetica) lowercase ‘z’ and ‘y’ vanish, and ‘x’ appears as ‘”’ (double closing quotation mark) – in Firefox and a few other apps but not everywhere.
  • Although I turned off screensavers (and hot corners), once in a while the Flurry screensaver activates while I’m working, after freezing all inputs for several seconds.

Other than the caps lock thing, each of these has persisted through a couple of major OS updates; I didn’t notice that any of them began soon after an update.

There’s no obvious link among these, so I won’t be surprised if you tell me they ought to be separate Questions. But maybe they’re all related to hidden Preferences and the like, accumulated over the years (this is my third or fourth Mac Mini since 2005), and I need to purge all that?

laravel – Malformed UTF-8 characters, possibly incorrectly encoded

este error me aparece cuando intento hacer un inicio de sesion en mi aplicacion antes no me aparecia, tuve que reiniciar mi pc y ahora no me deja iniciar sesion, este es el problema un poco mas detallado:

exception: “InvalidArgumentException”
file: “C:laragonwwwLaravelVuevendorlaravelframeworksrcIlluminateHttpJsonResponse.php”
line: 84
message: “Malformed UTF-8 characters, possibly incorrectly encoded”

esto es lo tengo en mi archivo de login.vue para iniciar la sesion:

login(){
            if (this.validarLogin())
            {
                return;
            }
            this.fullscreenLoading=true;
            var url= "/authenticate/login"
            axios.post(url,{
                    'cEmail' : this.fillLogin.cEmail,
                    'cContraseña': this.fillLogin.cContraseña
            }).then(response=>{
                console.log("El codigo es:" + response.data.code);
                if(response.data.code==401)
                {
                    this.loginFailed();
                }
                if(response.data.code==200)
                {
                    this.getListarRolPermisosByUsuario(response.data.authUser);
                }
                this.fullscreenLoading=false;
            }) 
        },

esto es lo tengo en mi loginController:

public function login(Request $request)
    {
        $cEmail         =   $request->cEmail;
        $cContrasena    =   $request->cContraseña;

        $rpta = Auth::attempt(('email' => $cEmail, 'password' => $cContrasena, 'state'=> 'A'));

        if ($rpta) {
            return response()->json((
                'authUser'  =>  Auth::user(),
                'code'      =>  200
            ));
        } else {
            return response()->json((
                'code'      =>  401
            ));
        }
    }

he intentado haciendo un dd() en los datos que recive y si llegan correctamente, tambien he intentando con un dd($rpta) pero no funciona, ahi es donde falla la consulta

sql server – Query taking extremely long to execute first time (Possibly due to Index Caching?)

I have a rather large table, ~ 3,5b rows and growing. For each row I have a specific ID which I wish to retrieve faster than currently. The current run-time is 5 minutes the first time I exectue the query, but instant for other queries subsequently. The table is approximately 603.628,430MB and the Index space takes up 406.398,570MB.

A sample row is:

documentID          pages   sort_id       word_bbox            page_bbox
asfdfdddee23333rtfds    1   1        2030 12 2123 55      0 0 2479 3508
aavfcbu4lobfhlyguicl    1   2        2144 12 2157 45      0 0 2479 3508

The query I wish to execute is:

SELECT p.documentID
, p.pages
, convert(integer, REPLACE(p.word_id, 'word_1_', '')) as sort_id
, p.word
, p.word_bbox
, p.page_bbox
FROM (MY).(DB).(DOCUMENTS) p with (NOLOCK)

where p.documentID = 'asfdfdddee23333rtfds'

I suspect that the rather long execution time ~5 minutes is the read operations from the server?

I have created a clustered index on the documentID and a Non-clustered Index as well on the documentID as well (just as a test, I have no reason for this to work).

The execution plan is shown here:

execution plan

Execution plan XML:
https://www.brentozar.com/pastetheplan/?id=r1W0GAACu

differential equations – (Possibly bugs? ) Wrong results provided by `DEigensystem`

I was trying DEigensystem with the following code:

DEigensystem({-u''(x) + x u'(x), DirichletCondition(u(x) == 0, True)},u(x), {x, 0, 1}, 2)

And after a period of time of calculation, it returns the following results:enter image description here

It surprised me that the first eigen value is a complex Root expression while the second one is a simple integer 10, however after a while I realized that the second solution was actually zero:enter image description here
So 10 should not be the eigen value of this operator. The plot of the following code shows that every even integer is the solution of u(1)==0 with boundary condition u(0)==0

Plot(Log@RealAbs(DSolveValue({-u''(x) + x u'(x) - (Lambda) u(x) == 0, u(0) == 0}, u(x), x) /. {C(_) :> 1, x :> 1} // Evaluate), {(Lambda), 0, 15})

enter image description here

However, when (Lambda) equals to even numbers, the general solution is actually zero, and the special solution is not zero at point x==1:

Limit(DSolveValue({-u''(x) + x u'(x) - (Lambda) u(x) == 0, u(0) == 0}, u(x), x) /. {C(_) :> 1}, (Lambda) -> 10) // Simplify

(*0*)

DSolveValue({-u''(x) + x u'(x) - (Lambda) u(x) == 0, u(0) == 0} /. (Lambda) -> 10, u(x), ) /. {C(_) :> 1} // Simplify

(*(-2 E^(x^2/2) x (2895 - 2640 x^2 + 588 x^4 - 44 x^6 + x^8) + 
 Sqrt(2 (Pi)) (-945 + 4725 x^2 - 3150 x^4 + 630 x^6 - 45 x^8 + x^10) Erfi(x/Sqrt(2)))/7257600*)

% /. x -> 1

(*(-1600 Sqrt(E) + 1216 Sqrt(2 (Pi)) Erfi(1/Sqrt(2)))/7257600*)

So my question is: How to get the right DEigensystem result of the operator above automatically? By the way, all of the codes give the same result in version 12.1, 12.2 and 12.3.

magento 2.3.6 error Unable to unserialize value. Error: Control character error, possibly incorrectly encoded

when i try to access from admin panel to any option, i have this page error.
i read some solution about this error:
i cant find (framework-Serialize..)folder in magento folder!
/vendor/magento/framework/Serialize/Serializer/Json.php
how can i solve this error?
enter image description here

enter image description here

c# – Concatenating two possibly null strings with a separator

I have two strings (aggregatePath and pathFromParent), either of which might be null or an empty string. I want to concatenate the two strings with a separator only if neither is null or empty. This is what I’ve ended up with:

FullPath =
    aggregatePath +
    aggregatePath is not (null or "") && pathFromParent is not (null or "") ? "." : "" +
    pathFromParent;

but it seems overly complex for what I’m trying to do.

How can I better clarify the intent of this code?

I’m not asking about performance. I’ve just come back to this code after a while, and it took me a few moments to figure out the intent. Is there perhaps some better idiom for this?

Using C# 9.

lubuntu & ubuntu desktops, possibly causing additonal keyboard layout (stuck on us alt international)

so I have sevral keyboard layouts installed, I’ve orginaly installed lbuntu, but I also wanted to install ubuntu desktop, incase I wanted to ever just use my computer as a tablet, no mater what keyboard layout it says I’m in, it gives me the us alt intenratlnal keyboard layout