## formal languages – Is the empty string and some words of even length are elements of this set?

$$L = {w in {a,b}^*| text{the first, the middle, and the last characters of w are identical}}$$.

I have my answers, but I need confirmation:

Is the empty string $$epsilon in L$$? Yes. Reason: there is no first, middle, or last character to break the rule.

Words of even length, assuming the first and last characters of them are identical, again, must be in $$L$$, as there is no middle character to break the rule in such words.

This is in the context of theory of computation by the way.

## javascript – SP Api Rest empty list sharepoint

I need to get a list’s items, so I created this function

``````export function retrieveSPItems(spToken, alias) {
var url = `{path_to_my_site}/_api/web/Lists/getByTitle('Briefs')/ItemCount`;
Authorization: spToken,
});
return fetch(url, {
method: "get",
}).then((response) => response.json());
}
``````

As a output I get 3000.

when I change the url to

``````var url = `{path_to_my_site}/_api/web/Lists/getByTitle('Briefs')/Items`;
``````

I get an empty list!

PS :

It’s work in Postman with no problem

The token is generated by adaljs :

Get Token

`authContext.acquireToken(SP_BASE_URL, function (error, token){....})`

``````export const adalConfig = {
tenant: CURRENT_TENANT,
clientId: CURRENT_APP_ID,
endpoints: {
api: CURRENT_APP_ID,
graph: GRAPH_BASE_URL,
sharepoint: SP_BASE_URL,
},
cacheLocation: "localStorage",
validateAuthority: true,
};
``````

So I need to know :

## algorithms – Check if intersection of several 2D half-planes is empty

I have a large set of half-planes $$a_ix+b_iy + c_i geq 0$$.
What I need is is the fastest way to determine if they have at least one common point.
Currently I build a convex polygon by adding half-planes sequentially, there are $$O(n^2)$$ checks if a point belongs to a half-plane.
I need an algorithm that does $$O(n log n)$$ or $$O(n)$$ checks.

## java – Buffered reader end of stream and empty messages while reading from socket

I read message from socket and append to my queue for processing. I need to know the difference between when empty message is received or what does end of stream means in my case. Sometimes, I receive empty messages that makes socket dirty and as a result the connection is terminated after specific number of tries. Is below piece of code correct or is there anything I need to consider.

``````public class SocketEOF {

private int invalidMsgCount = 0;

public void receiveMessages(Socket client) throws IOException {
while (true) {
try {

if (invalidMsgCount > 0) {
invalidMsgCount = 0;
System.out.println("Problem resolved in attempts: " + invalidMsgCount);
}

appendMsgAndNotifyToQueue(response);
}
catch (InvalidMessageException ex) {
invalidMsgCount++;
System.out.println("Invalid Message received at socket: " + client);
if (invalidMsgCount >= 20) {
System.err.println("Socket broken. Connection lost.");
closeSocketGracefully();
}
}
}
}

public Object readMessage(Socket client) throws IOException, InvalidMessageException {
String msgStr = null;
}

char() charBuf = new char(5);

if (noOfchar > 0) {
msgStr = new String(charBuf);
msgStr = msgStr.substring(0, noOfchar);

System.out.println("Message Received at " + client.toString() + ": " + msgStr);
}
else {
throw new InvalidMessageException("Invalid message of -1 length received at " + client.toString());
}

return msgStr;
}
``````

## Should i use free space or empty drive?

Installing ubuntu ubuntu 20.04 on windows 10, should i use free space from shrinked hard drive or
empty named partition separated from hard drive ?

## partitioning – Flash drive (ExFAT) shows as empty on Mac but not Windows

I have an ExFAT drive that I recently reformatted & erased, and also used disk utility repair on Mac. When I pop it in a Windows machine, I’m able to view and add files. But the drive appears empty on Mac.

Disk Utility shows:

• External Physical disk: 15.8 GB used (all)
• External Physical volume: 5.9 GB used, 15.8 GB free

I’m wondering what is causing this discrepancy (how can there be 15.8 GB free if 5.9/15.8 GB are used)? How can I fix this issue (e.g. make files appear on the drive on Mac)?

## 8 – Table view: “Hide Empty Column” checkbox doesn’t seem to work

I’ve created a view, formatted as a table.

I’m trying to hide empty columns – so, in the table settings, I’ve checked the “Hide Empty Column” checkbox for most of the table columns.

However, this doesn’t seem to have any effect – these columns are still included in the rendered table, with empty <td>s.

I expect this checkbox to hide the column entirely when all data cells contain an empty value. Am I understanding this correctly?

This certainly seems to be how it worked in Drupal 7. (I’m converting an existing D7 site to D8 – and this is how the table columns were hidden on the D7 site.)

Is there anything I should check which might be preventing this from working as expected?

Thanks.

## database design – Table normalisation and empty values

Here are two ways I can optimise mapping of a text field with several other attributes to question and answer. First approach is, creating a map table with both question_id and answer_id in which either of them will be null, and while querying I will query using column. In the second approach is normal like we would do normalisation.

Second approach will add one more table but in first approach there will be empty values against question_id and answer_id. Questions-

1. Is it a good practice to leave cells blank?
2. Will it have any performance issue?
3. Will it violate any normalisation rule?

## php – Image upload via FormData API and AJAX is not working (\$_FILES always empty)

When I try to do what’s mentioned in the title, my requests all work (nonce check passes, and server response 200 receveived, and server – script also working properly). My problem is that I cannot access the image file I upload on the server-side script; \$_FILES is always empty. Although there are already a lot of posts about this on stack overflow, none of their solutions works for me.

My HTML (note that I don’t use a form tag, but shouldn’t be a problem) :

``````<input type='file' name='imageupload' id='image-for-upload'>
<button onclick="testAjax()">Launch AJAX Request</button>
``````

My JavaScript :

``````function testAjax() {
let data = new FormData();
data.append("image",file);
data.append("_ajax_nonce",test_ajax.nonce);
data.append("action","test_ajax");
let xhttp = new XMLHttpRequest();
if (this.readyState == 4 && this.status == 200) {
} else {
console.log(this.status);
}
};
xhttp.open('POST', ajaxurl, true);
xhttp.send(data);
}
``````

Note that I commented the setRequestHeader line out because, with it, the server returns a client error (404), and answers with “0”. According to what I’ve found, this means that the server is not understanding the action hook. When removing the `setRequestHeader`, things worked properly (except for the concern of this question). When checking my HTTP Request Header of a sent request, I however can actuall see

``````Content-type: multipart/form-data; boundary=...
``````

… so for that header it should be alright anyway.

My Server Script:

``````<?php
// Ajax script used for testing purposes
check_ajax_referer('ajax-test');
echo 'The file is not recognized!';
} else {
//echo 'it is not working!';
echo 'It is working!';
}
?>
``````

No matter what I do, I always get a 200 server response, echoing “The file is not recognized!”. Help? (Please stick to vanilla js, I don’t wanna code in jQuery).

P.S.: When I observe my HTTP request of my ajax request more precisely, I can see that below the following (first) part of it:

``````Content-Disposition: form-data; name="image"; filename="myImage.jpg"
Content-Type: image/jpeg
``````

I get a quite long super-weird looking string of red filled dots and random types of characters, so maybe some encoding’s not working properly? Or is this usual for request bodies sending images via the form data?

Also, when I use

``````var_dump(\$_POST);
``````

…as the server’s response in my server-side script, I get an associative array with the keys

``````(image) => undefined
(_ajax_nonce) => nonce
(action) => test_ajax
``````

..when I fire the request without uploading a file in the browser.

When I upload a file into the browser and then fire the request, I get an associative array without the `(image) => undefined` element, only the latter two, so it seems like it’s not considering my image when I uploaded one…?

## css – How do I center columns in a grid when the remaining columns are empty?

I am creating a grid that contains as many 100 pixel column tracks as will fit into the container with the remaining space shared equally between the columns.

My minimum width is 100px and maximum is 200px.

My goal is to make a full grid of 100px. And if the grid is not full on the first row (ie. only 3 boxes), then those three boxes are aligned in the center. If the boxes do not fill the grid, I want to be able to just add a class to center the boxes to the screen width.

My problem is that sometimes I can fill the grid using auto-fit and auto-fill, but not center when the boxes when the first row is not filled.

``````grid-template-columns: repeat(auto-fill, minmax(100px, 1fr) ) ;
grid-template-columns: repeat(auto-fit, minmax(100px, 1fr) ) ;
``````

And then if I set the maximum to 200px, I am able to center it, but the grid leaves empty spaces at the end of the rows.

``````grid-template-columns: repeat(auto-fill, minmax(100px, 200px) ) ;
``````

This is my codepen, and hopefully it’ll be a better visual Codepen.
I am trying to avoid javascript. I am open to doing this in another way if repeat(auto….) is not the way to go.