Help converting a CFG to an APD

So I have this contest free grammar, and I’m having trouble when checking that there are more a’s than c’s, because I would have to check that the string I am processing is consumed in its entirety, but with the stack not empty, and I have no idea how to do that. The way we studied this in my class, I have no way of knowing if a string has been consumed.

$ $ \begin{align}S&\to AB | aSc\ A&\to aA | a\ B&\to bB | b\ \end{align}$ $

Maybe it’s easier to read the definition of the language: $ $ L = \{x \in L(a^∗b^∗c^∗) : |x|_a > |x|_c; |x|_b > 0; |x|_c ≥ 0\}$ $

This are the transitions I have so far: $ $ \delta(q_0, a , Z_0) = (q_0, A/Z_0)\ \delta(q_0, a, A) = (q_0, A/A)\ \delta(q_0, b, A) = (q_0, A)\ \delta(q_0, b, A) = (q_1, A)\ \delta(q_1, c, A) = (q_2, \epsilon)$ $ What I have up until here is, I read the a’s and push them on the stack, then when i read the first b I go to another state (because I have to make sure there is at least one a, otherwise I could do it in the same state) and keep the stack the same. When I read the first c I go to yet another state and start reading the c’s and popping the a’s in the stack. What I should do now is verify that the string has been consumed, while the stack still has a’s, but I can’t think of a way to do that because I have no way of knowing if the string I am processing has been consumed or not.

Conversion failed when converting the nvarchar value ‘A35’ to data type int

This is my stored procedure, that I am trying to execute.

Create Procedure CAMP_UpdateCaseProfileID as

update crcase

set crcase.UsrProfileNumber = CAMPProfileNumber.ProfileNumberCD ,crcase.UsrManufacturerID = CAMPProfileNumber.ManufacturerID ,crcase.UsrTapeModelID = CAMPProfileNumber.TapeModelID ,crcase.UsrSerialNbr = CAMPProfileNumber.SerialNbr ,crcase.UsrPRegNbr = CAMPProfileNumber.RegistrationNbr ,crcase.UsrCAMPLastActuals = current_timestamp

from CAMPProfileNumber

where crcase.UsrProfileNumber is not null and crcase.CompanyID = 2


After creating the procedure the error I am receiving is:

“Msg 245, Level 16, State 1, Procedure CAMP_UpdateCaseProfileID, Line 4 [Batch Start Line 2] Conversion failed when converting the nvarchar value ‘A35’ to data type int.”

Please Help!

Converting specific CFG to CNF

Let $ G$ be the positive, context-free grammar, and $ w$ (in $ G$ ) ambiguous word with an infinite number of parse trees.

a) Prove that $ G$ is not Chomsky.

b) Find the example of that grammar and convert it to CNF.

I wasn’t sure how to prove a) so I’m kindly asking if anyone can explain because I thought that ambiguity has nothing to do with Chomsky.

For the b) I came out with the following example:

$ S -> AA | B$

$ A -> A | a$ (this gives me infinite parse trees for a)

$ B -> abB | b | bb$

and I tried to convert it and got this:

$ S -> AA | RB | b | YY $

$ A -> A | a$

$ B -> RB | b | YY $

$ X -> a $

$ Y -> b $

$ R -> XY $

but I’m not sure how to transform the second row A -> A|a. Where is my mistake?

Thank you!

Does anyone know the answer the following questions on converting logical – physical addresses

Due to the unforeseen pandemic, I am unable to speak to my tutor about the following question. I have emailed him, but I have not had an answer for weeks. Can someone please enlighten me.

Image and question to be answered below. Please provide an explanation, as I am struggling to find an answer:

enter image description here

Converting difficulty class (DC) of checks from D&D 3E to 5E

I’m looking at converting the 5th-level D&D 3E adventure The Speaker in Dreams to the fifth edition and I’m noticing a lot of DCs from 20 to 30. Were difficulty classes higher in 3E or were players able to consistently roll higher checks because of a specific mechanic compared to 5E? Should I be reducing the DCs of checks when converting, if so is there a good fixed value or formula to decrease the DCs by?

Syntax error around converting timestamps to time

I am writing a function that requires some comparison between the difference date and time parts of the timestamp data type. However it keeps running into syntax errors and I cannot find out what is going on. I looked into this post and keep having alternating errors like

psql:ERROR: operator does not exist: time without time zone >= timestamp with time zone and

plpgsql: No function matches the given name and argument types. You might need to add explicit type casts

Can anyone enlighten me what is wrong and what could be a direction I can head towards?

create or replace function riders_available_at_date_time(specified timestamp) returns table(riderId integer) as     $  $       begin         select F.riderId         from FullTimeRiders F         where specified::date between F.startDate and F.startDate+27         and exists (             select 1             from MWSWorkDays M join ShiftsInformation S on (S.shiftNumber = M.shift)             where M.riderId = F.riderId             and (specified::time without time zone between to_timestamp(to_char(firstStartHour, '99'), 'HH24')                 and to_timestamp(to_char(firstEndHour, '99'), 'HH24')) or                 (specified::time without time zone between to_timestamp(to_char(secondStartHour, '99'), 'HH24') and                     to_timestamp(to_char(secondEndHour, '99'), 'HH24'))                   )           union         select riderId         from PartTimeWorkingHourIntervals P         where specified between calculate_start_date(P.dayIndex, P.startDate)+P.startHour             and calculate_start_date(P.dayIndex, P.startDate) + P.endHour;     end;     $  $   language plpgsql;   create or replace function calculate_start_date(index int, starting date) returns date as     $  $       declare         position integer;     begin         select extract(dow from starting::date) into position;         index = (index - position)%7;         return starting + index;     end;     $  $   language plpgsql; 

Missing DEK-Info header when converting from P12 to PEM using OpenSSL 2.8.3

I’m using openssl to convert an exported *.p12 file into a *.pem file that has a certificate and an encrypted private key.

The P12 file was exported with a password, this is the command that I’m using to generate the PEM file:

openssl pkcs12 -clcerts -in exported.p12 -out both.pem  

When I run that command I provide a PEM passphrase, the contents look like this:

Bag Attributes     friendlyName: Some Friendly Name:     localKeyID: 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99     ... other attributes omitted ... -----BEGIN CERTIFICATE----- MIIGijCCBXKgAwIBAgIIQzWHsGhNz0wwDQYJKoZIhvcNAQELBQAwgZYxCzAJBgNV ... contents of certificate ... -----END CERTIFICATE----- Bag Attributes     friendlyName: My Name     localKeyID: 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 Key Attributes: <No Attributes> -----BEGIN ENCRYPTED PRIVATE KEY----- MIIFDjBABgkqhkiG9w0BBQ0wMzAbBgkqhkiG9w0BBQwwDgQIQ9XzwbRcn0ACAggA ... contents of key ... -----END ENCRYPTED PRIVATE KEY----- 

After I have that PEM file; I’m trying to load it using Go’s crypto/tls and crypto/x509 package, like this:

var block *pem.Block for {   block, bytes = pem.Decode(bytes)   if block.Type == "PRIVATE KEY" || strings.HasSuffix(block.Type, "PRIVATE KEY") {     bytes, err := x509.DecryptPEMBlock(block, []byte(password))     if err != nil {         return nil, err     }   } } 

However that snippet returns the following error:

Error: fromPEMBytes: x509: no DEK-Info header in block 

Reading a bit on the DEK-Info header it seems that it should look like this:

-----BEGIN ENCRYPTED PRIVATE KEY----- Proc-Type: 4,ENCRYPTED DEK-Info: DES-EDE3-CBC,5B01E932988DC66B  EPESt4ZVIrxnQXxxWWVa7cCR+vgNZ/4vTu4mdq6pjaW7jMZoB8HV+mA745mQkQw7 ... contents of private key ... 

However I can’t seem to figure out how to get OpenSSL to add such headers to the PEM file, I’m using the following OpenSSL version:

➜  ~ openssl version LibreSSL 2.8.3 

Am I’ missing something obvious?, any help is really appreciated!