ffmpeg and ffprobe existing library or an add-on, pros/cons of building one myself

Question: I work with video creation, animation, or fix video elements for several broadcasters in my area. My pipeline includes ffmpeg suite of libraries, and I have written one plugin specifically for ffmpeg to take care of one of the elements of my video editing.
One thing I found myself struggling with is to preserve the format of the original video, and since this is one of the requirements to return edited video in the same format as the source, my biggest challenge is to:

programmatically extract parameters of the source video (I use ffprobe)
run my editing pipeline, one of which is my ffmpeg-plugin, then
re-compress the video using the parameters extracted in step 1.

I've managed to automate big part of steps 1 & 3 with python, and I have a series of calls to extract elements of each video, my code  looks like this:
color_string = 'ffprobe -v error -select_streams v:0 -show_entries stream=' \
                   'color_space,color_primaries,color_range -of default=nw=1:nk=1 "' + filename + '"'
# following running of subprocess:
color = subprocess.run(color_string, shell=True, capture_output=True)
# then parse:
color_array = str(color.stdout).split('\\n')
    color_primaries = color_array[1]
    color_range = color_array[2]

The problem is, every broadcaster uses their own coding standards, and while I don't care about audio at all, meaning, I can -c:a copy,  all the video parameters are different from broadcaster to broadcaster.
progressive/interlaced, DVCPRO which sometimes includes screen sizes of 1280x1080 (which drives me insane), prores with all its profiles and even deeper with -qscale and -bits_per_mb options, some codecs have vtag and some don't, and there are about 100+ others. And my list of ffprobe queries keeps growing, I have about 1k lines of extraction and then putting it all together for ffmpeg to run.
My question is, is there a library to extract video parameters from a source, then once the processing is done, use that library to populate all the arguments for ffmpeg?
As it turned out, I'm building one for myself, but I have a feeling I'm wasting my time.
I know that many adobe applications use this logic, and provide an option to preserve source on re-encoding a video, but I am building one with python, and I believe this would be a great utility application as an open source, since there are simply too many options to consider for one person.
I originally posted this question on superuser site, and was advised by @Tetsujin to migrate my question to this site, since it is specifically video related.
Comment: Which parameters do you wish to extract? Certain ones are universal, like resolution or bit depth and will be printed by ffprobe whereas others are codec-specific and are only relevant for the decoder.
Comment: @Gyan thank you so much for your response. Well, the resolution is printed by the ffprobe, that's correct, and then I use that information to encode back. That is especially important if I do DVCPRO formats with weird ratio. But then, things like interlaced vs. progressive, top or bottom first, etc.
For ProRes, this is profile + vtag, + sometimes qscale or -bits_per_mb, which I started using to match the filesize, more or less.
For x264, a whole bunch of other parameters to keep track of.
+ timecodes with or w/o dropframe, -color_primaries, -color_trc, & -colorspace, max & minrate
Answer: ffprobe can output json, making it a lot simpler:
import json
from subprocess import run, PIPE, DEVNULL
import sys

def ffprobe_json(filename):
    proc = run(
        [ "ffprobe", "-hide_banner", "-print_format", "json", "-show_format", "-show_streams", filename ],
        stdin=DEVNULL, stdout=PIPE, stderr=PIPE
    )
    proc.check_returncode()
    return json.loads(proc.stdout.decode(sys.getdefaultencoding()))


finding gappy sublists within a larger list

Question: Let's say I have a list like this:
 [['she', 'is', 'a', 'student'],
 ['she', 'is', 'a', 'lawer'],
 ['she', 'is', 'a', 'great', 'student'],
 ['i', 'am', 'a', 'teacher'],
 ['she', 'is', 'a', 'very', 'very', 'exceptionally', 'good', 'student']]

Now I have a list like this:
['she', 'is', 'student']

I want to query the larger list with this one, and return all the lists that contain the words within the query list in the same order. There might be gaps, but the order should be the same. How can I do that? I tried using the in operator but I don't get the desired output.
Comment: What about if there are multiple instances that might be recognized.  How would  `['she', 'student', 'is', 'she', 'student']`, be recognized, for example?  Yes the words are present in order, but there is an overlap
Comment: yes, as long as those words are found in the list in the same order, it is considered a match
Answer: If all that you care about is that the words appear in order somehwere in the array, you can use a collections.deque and popleft to iterate through the list, and if the deque is emptied, you have found a valid match:
from collections import deque

def find_gappy(arr, m):
  dq = deque(m)
  for word in arr:
    if word == dq[0]:
      dq.popleft()
      if not dq:
        return True
  return False

By comparing each word in arr with the first element of dq, we know that when we find a match, it has been found in the correct order, and then we popleft, so we now are comparing with the next element in the deque.
To filter your initial list, you can use a simple list comprehension that filters based on the result of find_gappy:
matches = ['she', 'is', 'student']
x = [i for i in x if find_gappy(i, matches)]

# [['she', 'is', 'a', 'student'], ['she', 'is', 'a', 'great', 'student'], ['she', 'is', 'a', 'very', 'very', 'exceptionally', 'good', 'student']]

Answer: You can compare two lists, with a function like this one. The way it works is it loops through your shorter list, and every time it finds the next word in the long list, cuts off the first part of the longer list at that point. If it can't find the word it returns false.
def is_sub_sequence(long_list, short_list):
    for word in short_list:
        if word in long_list:
            i = long_list.index(word)
            long_list = long_list[i+1:]
        else:
            return False
    return True

Now you have a function to tell you if the list is the desired type, you can filter out all the lists you need from the 'list of lists' using a list comprehension like the following:
a = [['she', 'is', 'a', 'student'],
 ['she', 'is', 'a', 'lawer'],
 ['she', 'is', 'a', 'great', 'student'],
 ['i', 'am', 'a', 'teacher'],
 ['she', 'is', 'a', 'very', 'very', 'exceptionally', 'good', 'student']]

b = ['she', 'is', 'student']

filtered = [x for x in a if is_sub_sequence(x,b)]

The list filtered will include only the lists of the desired type.


Proving that removing any vector of the linearly dependent set gives a linearly independent set

Question: Consider the matrix representing 6 linearly dependent vectors:
$$\left(\begin{array}{llllll}
1 & 0 & 0 & 0 & 0 & 1 \\
0 & 1 & 0 & 0 & 0 & 1 \\
0 & 0 & 1 & 0 & 0 & 1 \\
0 & 0 & 0 & 1 & 0 & 1 \\
0 & 0 & 0 & 0 & 1 & 1
\end{array}\right)$$
I know how to prove that the vectors in this matrix are linearly dependent, but how can I show (concisely) that removing any one of the vectors we get a linearly independent set?
Comment: The statement in the titles is false. However, in this particular example it is true. But I think you would have to show it "manually" because there is no theory about removing vectors from linearly dependent set converting it to a independent set.
Comment: The only vectors in the kernel are multiples of $(1,1,1,1,1,-1)$. Since there are no $0$ in this vector, any 5 columns are linearly independent
Comment: If you compute the five $5 \times 5$ minors (determinants of the matrices obtained by removing one column), they are all non-zero. Does anybody see a fastest solution?
Comment: Well, it is true in this case, which is why I wrote *the* linearly independent set. :)
Comment: @EnderWiggins read my comment
Comment: @Exodd Thanks! But maybe I found a fastest one: the column space of any matrix is isomorphic to its row space and the rows are linearly independent.
Comment: @EnderWiggins It is not enough. You can find full rank $5\times 6$ matrices with zero minors
Comment: @Exodd yeah, you're right.. too much enthusiasm
Answer: Here the fastest method I can think of.
If (for example) the first 5 columns are linearly dependent, you can find a vector in the right kernel of the form
$$\left[
\begin{array}a
a\\
b\\
c\\
d\\
e\\
0
\end{array}\right],
$$
that is, a vector that ends with $0$. In general if you leave out the $i-th$ column and the rest are linearly dependent, you find a vector in the right kernel with a $0$ in the $i$-th position.
Since the only vectors in the right kernel of your matrix are the multiples of
$$\left[
\begin{array}a
1\\
1\\
1\\
1\\
1\\
-1
\end{array}\right]
$$
and it has no zeros, you can deduce that any 5 columns are linearly independent.
Comment: That will suffice. Thank you. :)
Answer: Note that the given matrix is in its Row Reduced Echelon Form and has rank 5. That is, its columns span $\mathbb R^5$.And basis of $\mathbb R^5$ can only have 5 vectors. There can not be more than 5 linearly independent vectors in $\mathbb R^5$. Now, coming to the given matrix, remove any column (say 3rd column), then you have $5$ by 5 matrix (rearrange the columns) in row reduced form with 5 pivots, hence the columns of this matrix are linearly independent. Same conclusion if you remove any other column from the given matrix. Hence, removing any column from the matrix (given in your post) results in a full rank square matrix.
Comment: when you remove a column, it is not in row reduced form though...
Comment: @Exodd, my point is that by rearranging the columns (after removal of a column)-say, if you remove 1st column (then clearly we don't have row reduced form), bring the last column into first column and thus you have a row reduced form. Rearranging columns (switching column no. m with column no. n) really doesn't matter as we are only talking about linear independence of columns.
Answer: You can build matrices excluding one column at a time.
If you call the original matrix $M$, and the matrix excluding column $j$ for $M_j$, then you can build a sparse matrix performing the exclusion, finding a factorization for $M_j$ in terms of $M$ like this:
$$M_j = ME_j$$
Where the $E_j$ matrices are truncated $I$(identity) matrices having row $j$ cut out.
Now to express what part of a random vector $r$ $M_j$ can capture, we can calculate
$$t_j = M_j({M_j}^{\dagger})r$$
where $\dagger$ is some suitable pseudo-inverse, for example Moore-Penrose.
If all $t_j$ are the same, then each vector is linearly dependent of all the others.
But if one is not, then it means that excluding that one loses some information.
An example when that happens is here:
$$\begin{bmatrix}0&0&0\\0&1&1\\1&1&1\end{bmatrix}$$
Excluding any one of column 2 or 3 won't make a difference, since they are the same.
But if we exclude 1, then we will lose information.
If you try it you shall find $t_2\approx t_3 \neq t_1$


How do Space Marines put their helmet over long hair?

Question: Some Imperial Space Marines in Warhammer 40K are shown with long hair and/or long beards - the Space Wolves in particular. This must get in the way if they ever have to put on a helmet quickly, in the event of a chemical attack, decompression, etc.

I get that this is sort of a "rule of cool" thing, but has there ever been an instance in the Warhammer 40K novels (or other game fluff) of a marine trying to put on their helmet, and having trouble due to their hair or beard?
Comment: If you look at the game miniatures, the heads are the same size as the helmet. Apparently, a Space Marine's head eventually gets big enough it doesn't fit inside the helmet.
Comment: They clearly just turned off the "Show Helm" option in the settings menu!
Comment: Not the same type of helmets, but many bikers in real life have beard and long hair...
Comment: Their outfits aren't sealed at the neck, though. They can put their hair down the backs of their necks.
Answer: TLDR

'Rule of Cool' applies.
Helmet necessary situations are rather limited in universe.
Not having the ability to use your helmet would limit effectiveness and capability...
There is no instance of 'having trouble' that I can recall.

So you are correct. The 'Rule of Cool' applies 100% in this situation. Models and images that we see are bursting with the impossibility of donning a vacuum seal helmet when the situation arises.
However, the chances of such a fatal situation happening do seem to be rather remote. Just about all known, un-Chaos modified, chemicals have no effect on Space Marines thanks to their Multi-Lung and the same organ grants the ability to breathe in low oxygen environments, such as decompression.
In addition, the Mucranoid implant allows Space Marines to secret a substance that creates a barrier on the user's skin for environments such as vacuum. While I have never read anything from the Black Library stating its use there is a chance the organ could also protect a user that is not wearing a helmet in a pinch.
And while there is the option for other situations that may arise where a helmet would be advisable, honestly the two you state are the not only the most obvious, but the most common as well. Vacuum aside, fighting on ships involves the same potential risks as fighting planet side. And poison aside the only advantage to having a helmet I can see would be in a situation where normal vision is completely obstructed, such as a really heavy fog or when communications break down and smart optics, like thermals, are paramount.
In universe, I would argue that not having the ability to don your helmet would limit your effectiveness and your deployment capabilities in certain situations. Should there be a need to fight in vacuum or underwater the Marine would be useless. While we don't explicitly 'see' the method of a Space marine donning their helmet, I would say there is a procedure in place to account for a Space Marine's individuality; custom helmets or some other adjustment.
And the few times that I have read of a Space Marine donning their helmet there has never been any issue. I will have to find the passage/book, but as I recall, during Warzone: Fenris all the Space Wolves fighting on Midgardia had to use their helmets to filter out a plague created by Mortarion. At some point they also found Logan Grimnar's helmet leading them to believe he was lost in battle. Depending on the image/model Grimnar himself has a great deal of excessive hair that would make wearing a helmet impossible. If he couldn't have even worn the helmet I am sure he would not have brought it with him.
Comment: "the only advantage to having a helmet" -> you mean other than deflecting bullets? I get these guys are tough, but I'm pretty sure their armored helmets are more bulletproof than their skulls.
Comment: Fair enough. I remembered the multi-lung, but had forgotten about the space mucus sheath thing. It still seems silly to me not to take advantage of the helmet, or at least have it ready and accessible. I guess my fatal flaw was trying to apply logic to the ridiculousness that is 40K.
Comment: Yeah, obviously there are situations where they have their helmet at hand and when they don't it never comes back to bite them... I feel like there was a time when Ragnar had to use his helmet as well, but I can't remember for sure. You are completely right though; Rule of Cool is the primary reasoning.
Comment: Haha, obvious skull saving advantages not included!
Answer: The majority of space wolves don't put on helmets, instead preferring to display their long locks as intimidation.
From the wiki:

Originally the VI Legion of Astartes raised by the Emperor at the dawn of the Great Crusade, the Space Wolves are renowned for their anti-authoritarian ways and their embrace of their homeworld Fenris' savage barbarian culture as well as their extreme deviation from the Codex Astartes in the Chapter's organisation.

Thus, they are hardly representative of the average space marine. They are savage and barbaric, going into battle adorned with hunting trophies.

As to your second question, I don't think such a situation has ever been depicted. Most marines with long hair forgo helmets altogether.
Comment: I get why they they typically eschew helmets; I'm wondering how they would deal with a situation where they'd have to put their helmet on or die. The models you've shown don't even have their helmets on their belts, which would be bad news in a situation where they'd need to be sealed up.
Comment: @Vanguard3000 I think it was explained away by magic bodies which allows their lungs to act as natural filters better than any gas masks. It's just a lot of rule of cool and "Insanity is power".
Answer: I always figured the helm sealed to the chest armor, not to the neck. The helmet doesn't seal tight around the neck, it seals at a ring between the helmet and body armor. So you could tuck a long beard down into the neck and chest of your armor then seal the helm over all of it. Think more like a deep sea diving rig than a skintight suit of armor, it's not tight around the neck so there's room for extra beard.
Comment: Are you basing this on any canon evidence, or are you just guessing? If it is based on evidence, you should [edit] this answer to cite your source/s.
Answer: Based on the information in this article Power Armour
it seems that since the Mark IV armour the helmet is not directly attached

The Mark IV suit's helmet was a completely new design, the basic shape inspired by the sweeping front of the Mark III. In Mark III and later versions the helmet was no longer fixed to the armour's neck plates, but moved with the wearer's head while still maintaining an environmental seal.

More relevant there is a section about the No Helmet option, with particular reference to the space wolves:

Amongst the Astartes, it is the Space Wolves who are the most fervent practitioners of this custom. In their case, it is no mere show of courage as the Canis Helix gifts them with a preternaturally acute sense of smell, rivalling that of natural wolves or trained scent-hounds.
Many Space Wolves are able to follow their targets, or the very flow of battle, thanks to minute changes in scent when fighting helmetless. The Space Wolves consider the added risk of a well-placed sniper shot to the head acceptable when equated with the ability to scent ambushes or the very moment an enemy will break or charge.
This habit of gaining information about a situation by scent is so natural to the Space Wolves that many feel slightly disoriented and claustrophobic when forced by circumstances to don their helmets.

In summary, it would seem that the power armour and helmets could probably accommodate the long hair, but the space wolves would probably still just not wear them


Usage of rebuke and abuse

Question: Is shouting at someone and using words like you will be destroyed a form of abuse? Or does abuse necessarily involve some bad word etc... Will rebuke be a more appropriate word for the former statement?
Comment: That depends on the circumstances. If you shout that at someone who is about to step onto a railway track it isn't abuse. Please give more context, but it might be a matter of opinion. But no, abuse and rebukes do not necessarily use 'bad words'.
Answer: Abuse can be purely verbal. If so, synonyms include "belittle" and "berate."
Verbal abuse need not, but frequently does, involve impolite or pejorative language.
"Abuse" does imply that it is either totally unjustified or else disproportionate. In this sense, abuse has a narrower meaning than "scold," which may be justified and proportionate.
To "rebuke" is to assert in good faith that someone has done something wrong. A rebuke may be abusive as well if it is disproportionate, but a rebuke is not necessarily abusive.
Comment: So if someone shouts in anger and says that you will be destroyed. And the context could be I mentioned `I am having chest pains`, and instead of helping me, the person shouted. In this case, can I say that the person abused me?
Comment: @rohit All I can say is that the word "abuse" is normative and therefore subjective. I can certainly agree that it would strike **me** as brutal and ugly in almost all cases to taunt someone having a heart attack with threats of destruction. But that judgment is without context. I might think differently if the heart attack was induced by the effort of beheading 90 kindergartners. The basic meaning of "abuse" is to treat someone immorally. I do not think there is an "objective" morality that applies without any reference to context.

Usage of rebuke and abuse


photorealistic glass bottle render

Question: how can I achive this kind of material for glass? (photo attached). It looks like noise texture on very high scale, but when I try to set it, the bottle roughness is rising so high it losts the shiny glass material character. Thanks for your advice.
Answer: I would use something like this for the material - use the Noise texture as the basis for a Bump Node, and then use that as the Normal for the glass. I mixed it very heavily with white first (.998) otherwise, it looks too strong and unrealistic. You can also do this by adjusting the strength on the bump node, but I feel this gives more "fine" control. Lastly, use the Facing output of a Layer Weight node, to mix the inner "lighter color" with a more opaque outer "brownish". Don't forget to adjust the Blend Mode settings if you are using EEVEE (right side):
Comment: Old habit, I guess. Carried over from Substance Designer.
Comment: Why use an extra node to mix the _Noise_ with white? The _Bump_ node has a _Strength_ value and a _Distance_ value, I usually use _Strength_, in tutorials they often say use _Distance_ to control the bump... anyway, simply decreasing the _Strength_ to 0.08 with _Distance_ = 1 gives the same result... or _Strength_ = 1 and _Distance_ set to 0.002 (there you even have a correlation to your mix factor: 1 - 0.998 = 0.002) also looks the same.

photorealistic glass bottle render


MacBookPro trackpad is on crack!

Question: It's as if an alien entity has commandeered the trackpad, and it highlights things when it has not been asked to do so; the mouse jumps erratically all over the place, AND opens up random windows unbidden. In this state it's nearly impossible to write anything on the computer in this condition.
Guidance, anyone?
MacBook Pro
Mac OSX 10.6.8
TenQ
Comment: I have had this issue with an external trackpad and keyboard, with the end result being a key on the keyboard was stuck if I remember right it was the space bar, after much frustration I ran my had across the keyboard and this resolved the issue.
Comment: I often forget a bluetooth mouse or trackpad and find that they are in a bag or otherwise pressed when I find my main trackpad is behaving like you describe.
Answer: I was having the same problem with on my Retina. Rebooting and SMC reset didn't help.
Surprisingly I was able to fix it by pressing down hard in each upper corner as recommended in this Apple Communities thread. According to it the problem is due to pressure on the trackpad and pressing down resets/releases that somehow.

MacBookPro trackpad is on crack!


can I upgrade from 6.1 to 7?

Question: It is so bothersome to reinstall everything.
Is it so difficult to provide the chance
to simply upgrade from 6.1 to 7
without erasing the disk?
As elementary OS is based on Ubuntu,
there must be a way...
Comment: Its a shame. Its a wonderful and beautiful end user OS, but until they figure it out how to allow to update from the last major release to the next, it will never make it to the big leagues.
Comment: Well, and THAT is why I only use Linux distributions that are rolling releases.
There's literally no point in any other release format in a day and age when 90% or more all software is distributed as online downloads. Fixed releases are from a time when you had to ship out CDs/DVDs to people…
Comment: It is ridiculous, and they are literally shooting themselves on the foot... At this point in time i would never think this was the case... Oh Well.. time to say goodbye for good.
Comment: It's possible to upgrade by editing /etc/apt/sources.list manually and running apt-get dist-upgrade. I had success via this method during upgrade from 5 to 6. But this is not a very safe approach.
Answer: The release upgrade guide suggests this is not possible currently, so you cannot do an in-place upgrade from 6 to 7, for this release upgrade:

a fresh install is currently the only officially-supported way to upgrade

https://github.com/elementary/os/wiki/Release-Upgrades#performing-a-release-upgrade
Comment: and that's why I will not bother moving from 6.1 to 7.0

can I upgrade from 6.1 to 7?


Difference between insignia, crest, emblem, badge

Question: What exactly is the difference between these words. When do you use one, and when the other. Dictionaries aren't too helpful, as they list them as synonyms.
Answer: Insignia:
A distinguishing badge or emblem of military rank, office, or membership of an organization.
Crest:
A distinctive device representing a family or corporate body, borne above the shield of a coat of arms (originally as worn on a helmet) or separately reproduced, for example on writing paper.
Emblem:
A heraldic device or symbolic object as a distinctive badge of a nation, organization, or family.
Badge:
A small piece of metal, plastic, or cloth bearing a design or words, typically worn to identify a person or to indicate membership of an organization or support for a cause.
A badge is typically thought of as the as the physical object that that has an emblem or crest printed or embroidered upon it.
Whilst the above dictionary entries have overlaps, insignia is most commonly used in relation to the military, crest most commonly used in relation to family and corporations and emblem is more nationalistic.
Comment: (+1) but I think you need to some links to online references to prove what you are saying is true.
Answer: A badge is originally, and still is; in heraldic terms, any emblem used by an armiger (a person with an achievement of arms) on his standard (a type of flag which is not a banner) and used by his followers.
For instance, the three feathers in a crown, with the text "Ich dien" (I serve) under, is the badge of the prince of Wales. And as a badge, it is not used by the prince himself, but rather by his staff, on letter paper and so on.
Comment: This answer would be improved by adding references. Also, you don't mention "insignia" or "crest" which the OP asked about.


Story map or flat backlog?

Question: I struggle on creating good visualization/tracking for my scrum project and are therefore considering several alternatives. One interesting concept is Story Mapping. Do you have any input on using a story map instead of a flat backlog?
Comment: I'm voting to close this question as off-topic because it is not about programming.
Answer: As ever with Scrum, do the least that you think you need. Too much documentation can become impossible to maintain and will just tie you down.
That said: in a previous role where we had around 15 Scrum teams we had a "war room" where the stories were mapped on a wall-sized whiteboard.
Most of these stories were "epics", as there was an assumption that the individual Scrum teams would break them down into smaller, more manageable stories later.
Initally, no time estimates were associated with these epics, as the objective of the map was to identify the dependencies between the epics and get a rough idea of which team would be best placed to do which epic.
In following iterations we worked out the time estimates and started to pencil in where they would sit in each team's backlog. This led to some shuffling around of the stories but on the whole the initial guess was about right.
By two or three sprints after we had started the "war room" became harder to maintain so we shifted back at that point to an Excel spreadsheet with the epics listed sequentially. However, by that time the product owners and customers had internalised the project plan so there wasn't any need to maintain it.
Answer: Tobias here are two other perspectives on story mapping: John Walpole of Twitter shares their experience with story maps and I also wrote a primer on story mapping.
Answer: As described in the article you linked the Story Mapping concept was a result of changing something that did not work well for them. All teams are different and the best thing you can do (in my opinion) is to pick one thing that you (the team) thinks looks promising and try it out for a sprint and talk about it again at the next retrospect. Make adjustments and, try some more and revisit at the retrospect again and so on.
Comment: True. I was hoping to get some feedback from others on before we go ahead trying the concept though.
Answer: Story mapping is a great planning technique, but I would not use the story map per se for tracking. I would use the Features/Scenarios identified on the map as buckets of functionality, and I would use parking lot charts to show progress on each feature. A good idea here is to identify the minimal functionality necessary for shipping each feature (of course those should be the highest priority stories for that feature), and put a line on the parking lot chart for each feature that shows when that minimal amount of functionality has been implemented. This is a clear way of showing exactly where the product is to external stakeholders.

Story map or flat backlog?


How many functional tests to write?

Question: It is quite easy to cover your code by writing tests first using TDD and you know that when to stop once you implemented a feature.
For me it is trickier to decide how many functional tests to write for say a REST service.
Currently I am in a situation where a service returns few fields in JSON and I can create/updade/retrieve/delete an entry. There are cases where errors are thrown if for example for one or more fields wrong value has been assigned. Also there are dependencies and given a value for one field would make another invalid with certain value. So service is doing some validation.
I have few options(maybe you see and suggest more):

Write functional tests for each case to verify that system behaves as expected and of course write unit tests together with it. And integration tests if you need it.
Write some functional tests to verify that the response format/status code/headers are valid but not cover each case as you can cover these with integration/unit tests say testing at the service boundary together with persistence layer(repository) without controller.So I could loose some confidence in actually guaranteeing that my REST service will marshal results back as expected.

Obviously there are trade offs. In first scenario - higher confidence, more time writing tests, takes longer to build an artifact because I have more tests that run slower. In second scenario - faster build, quite high confidence but not as high as with the scenario 1, less time spent writing functional tests.
What is your experience/view on this and what do you think is best option?
Comment: Write enough tests so that you have confidence that the code works.
Comment: And no more. (Subjective, I know. No one said this was easy.)
Answer: This is too broad of a question to answer specifically.  There are a number of textbook approaches to this and no one will be able to tell you exactly how many number of tests to run without analyzing the details of your project.  The main thing is that both you and the customer have to be satisfied.
Here is a common strategy that you didn't mention in your post:

Create a list of all the tests you can think of without regard to need, cost or difficulty.
Ask the product owner to rank them in terms of desirability. The customer might think of other tests too.
Rank the tests yourself in terms of which one you think is most important to mitigate risks of defects. For instance to address parts of the project that especially tricky.
Combine your ranking and and the customer's to prioritize all of the tests.
Starting with the highest priority tests, tell the customer which of the tests can be done within your time/cost constraints.
Focus your testing on high priority tests.

As one of the commenters alluded to, figuring all of this out is not easy. Assuming you aren't doing this as a hobby, you will actually have to talk to the customer or product owner to figure out the right number of tests.
Comment: `you will actually have to talk to the customer or product owner to figure out the right number of tests` -- Why?  Unless this is part of your requirements-gathering process or you're building a User Acceptance Test Suite, you should be figuring out stuff like this yourself.

How many functional tests to write?


GUI git mergetool for Mac/OSX with dark mode, 3 panels, and allows editing local/remote?

Question: I am currently use meld and it seems to have performance issues on Mac/OSX that I don't experience on linux. I've noticed a surprising number of meld alternatives are really poor quality and un-usable in random ways and am finding it exhausting to repeatedly try each program, configure them as a git tool, then find out they are missing what I consider extremely basic usability features.

somewhere
criteria not met

Meld
performance issues

Beyond Compare 3
no dark mode

KDiff3
no dark mode

p4merge
dark mode exists but does not work

Sublime Merge
can't edit local/remote panes

Kaleidoscope
can't edit local/remote panes

I need dark mode for medical reasons. It is a hard requirement.
Answer: Beyond Compare 4 has color schemes you can import or change, at least for the text (no idea if one can change the color of the toolbar/menu bar, for example.
Visual Studio has a tool vsdiffmerge that can be used as a mergetool, and of course, since afaik this is actually just a visual studio instance, changing the color palette works here too.


Getting more amps from a computer power supply

Question: Hey everyone I am new here and new to working on electronics. With that being said I am trying to figure out if wireing 2 of the 12v wires with 18 amps would give me 24 volts with 36 amps? I am trying to use a computer power supply to run a vape mod that is designed to run at 8.4 volts and 30 amps. I just need to figure out this part so I know what resistors I need to get and calculate the wattage. Thanks for any help! I am really looking forward to trying to get this to work
Comment: Even if they had separate grounds you can double the voltage or the current, but not both.
Comment: Welcome to EE.SE. This question has been asked before, many times. The answer is NO. The reason is that all PC supplies have a common ground pour and an IC to watch for under/over voltage and current. They usually have a PFC supply of 300V to 340V DC to feed the main supply, and it will burn you-not just shock you. I have spare PC supplies myself and will make buck or boost converters to get what I want. I leave the power supply as it was built.
Comment: I don't believe for one minute that your vape requires 8.4 volts and 30 amps - that's 252 watts of heat an inch or two from your face. It's gonna hurt.
Comment: Thanks. I will look into the boost. I have only cut the 12 v wires and hooked them to the vape curcit board. It turns on but says battery is to high. At least this way I know what I need to start looking at.
Comment: I just need to double the current and reduce the voltage. I just got to figure out how to do that and I should be good
Comment: unfortunately law of conservation of energy doesn't allow that.
Comment: I agree with Finban.  Your numbers don't make sense.  You could say you are blowing smoke at us.
Answer:
[Would] wireing 2 of the 12v wires with 18 amps would give me 24 volts with 36 amps?

No. It would give you 12V at 18A.
The multiple 12V wires on an ATX power supply are all connected together at the PSU end -- they're intended to be used together, as a single wire of that size would probably overheat if it carried the full output current itself. The ratings on the power supply are its overall capacity, not the capacity of a single wire.

I just need to figure out this part so I know what resistors I need to get and calculate the wattage.

That isn't going to work. First, resistive power dividers can only drop voltage, and even then can only do so consistently with a constant load, not with a dynamic load like your vaporiser. Second, dropping from 12V to 8.4V at 18A is 64W -- you'd be putting out a dangerous amount of heat in your voltage divider. The sizes of resistors you're probably familiar with are rated for 1/8 or 1/4 W.
Comment: I am ordering bigger resistors to handle the wattage and also looking into a DC to DC adjustable voltage regulator. If that would help it. If it does I need to find a way to increase the watts and amps after the step down to 8.4 v
Comment: Again, you are going about this the wrong way.


Ideal class group of $\mathbb{Q}(\sqrt{-103})$

Question: I want to calculate ideal class group of $\mathbb{Q}(\sqrt{-103})$. By Minkowsky bound every class has an ideal $I$ such that $N(I) \leq 6$. It is enough to consider prime ideals with the same property. Let me denote by $R$ the ring of integers. So we have
$2R= (2, \frac{1+\sqrt{-103}}{2})(2, \frac{1-\sqrt{-103}}{2})$, $3R$ and $5R$ are prime. Ideal class group is generated by $P=(2, \frac{1+\sqrt{-103}}{2})$. $N(P)=2$ and thus $P$ is not principal. Absolute norm $N(P^2)=4$ and if $P^2=(a)$ then $(a)=(2)$, but $P^2 \neq 2R$, because $2R=P \overline{P}$, $P \neq \overline{P}$. $N(P^3)$=8 and it is obvious that $P^3$ is not principal. How can I continue this argument for other powers of $P$ and when this stops?
Comment: $$N\left(\frac{5+\sqrt{-103}}2\right)=\frac{5^2+103}4=32=2^5$$
Comment: @AlexB. I'm thinking about it, but I need to convince myself first that this implies that the predicted power of $P$ is, indeed, principal. For now it just marks the spot at which the OP's argument based on studying norms of individual elements stops working. If you see how the rest follows from general principles, go ahead and save me the trouble! I'm done with my morning coffee, and need to commute next...
Comment: @Jyrki You might as well post this as an answer.
Comment: @Jyrki Done.   $ $
Answer: As Jyrki Lahtonen notes in his comment, the norm of the principal ideal $I=\left(\frac{5+\sqrt{-103}}{2}\right)$ is $2^5$. It will therefore be enough to show that $I=P^5$ or $I=\bar{P}^5$, since 5 is prime and therefore will have to be the exact order of $P$ in the class group.
Now, $P$ and $\bar{P}$ are the only two ideals of $R=\mathbb{Z}\left[\frac{1+\sqrt{-103}}{2}\right]$ above 2. So we immediately know that $I=P^n\bar{P}^{5-n}$ for some $n$ between 0 and 5. But if $n$ is neither 0 nor 5, then $P\bar{P}=2R$ divides (i.e. contains) $I$, which immediately leads to a contradiction, since the generator is not divisible by 2 in $R$. So $I\not\subseteq 2R$, thus $n=0$ or 5 and we are done.
Answer: edit, December 2022. For a short time there was a place for blog posts relating to MSE or MO.  Jyrki had asked for a brief document on this
Original:  People do not seem to like the quadratic form description of things, but it is the case that, if the discriminant $\Delta$ is negative, the group of binary quadratic forms of discriminant $\Delta$ is isomorphic to the class group of $\mathbb Q(\sqrt \Delta).$  The conditions for this are either $\Delta \equiv 1 \pmod 4$ is squarefree, or  $\Delta$  is divisible by 4,  $\Delta /4$ is squarefree, and $\Delta /4 \equiv 2,3 \pmod 4.$
For you, $\Delta = -103 \equiv 1 \pmod 4.$ The group of forms, under Gaussian composition, is cyclic of order 5:
<code>jagy@phobeusjunior:~/old drive/home/jagy/Cplusplus$ ./classGroup
Absolute value of discriminant?  103   class  number  5

( 1, 1, 26)
( 2, -1, 13)
( 2, 1, 13)
( 4, -3, 7)
( 4, 3, 7)
</code>
Each (A,B,C) refers to $A x^2 + B x y + C y^2.$
If you had a positive $\Delta,$ the congruence restrictions would be the same, we would need to also require that $\Delta$ not be a square, and we would be calculating the narrow class group. In this case, if there is an integral solution to $u^2 - \Delta v^2 = -4,$ narrow class group and class group agree, so we are done. If there is no solution to $u^2 - \Delta v^2 = -4,$ then the class group is the subgroup of squares of the narrow class group. Long story. In this latter case, you are, in effect, keeping the form that represents $1,$ but throwing out the (distinct in this case) form that represents $-1.$
Comment: Hi Will, do you have any resources you can point to for more information on this take on the class group?
Comment: @ntropy, yes, Jyrki asked me to write a blog post, http://math.blogoverflow.com/2014/08/23/binary-quadratic-forms-over-the-rational-integers-and-class-numbers-of-quadratic-%EF%AC%81elds/ and I kept copies of a few pages each from sources I used, when I did not own the book.
Comment: @ntropy, meanwhile, my favorite is Binary Quadratic Forms by Duncan A. Buell. also A Course in Computational Algebraic Number Theory by Henri Cohen, and Quadratic Irrationals: An Introduction to Classical Number Theory by Franz Halter-Koch.


Getting the Chip Name of sensors being used in Android

Question: I need to modify some sensors driver code in the Android linux kernel. I am able to get the logical name of sensors present in the phone from getevent or "sys" file system like "gyro","lighsenors" etc. But how can I get the actual chip name of sensors like (mxt224_ts) which maps to these logical names.
When I looked in linux driver directory, I found that it has separate files for each chip but many chip can implement the functionality for single sensor. Therefore I am unable to identify the actual file which is being used in the device(phone).
Answer: The sysfs directory has an entry named name.


How are the reserved GDT blocks used after online resizing in ext3 file system

Question: I am working on Ext3 and after looking at FS layout - ext3 reserves ~1024 blocks as Reserved Group Descriptor Table (reserved GDT blocks are between Group Descriptor blocks and Bitmap blocks). These blocks are used once we do online resizing. I was wondering - how these reserved blocks are used after online resizing is done? Are these free blocks used as data blocks or they can be used for other purposes as well? Also, what is the impact (apart from the fact that online -resizing will not work) if we don't leave any room for reserved GDT?
Answer: These blocks are kept for future resizing, until the filesystem reaches 1024x the original formatted size, or the filesystem hits 16TB (at which point a different resizing method is used).
If you remove the resize_inode feature, the blocks are freed, you could use them for data, and your filesystem can no longer be resized online at all, or "easily" offline (it will need to move any files using those blocks out of the way).
For the 4MB of space they consume, it is probably not worthwhile to remove this feature unless you know for a fact that you will never need to resize the filesystem.


How to close windows from alt+tab view

Question: Is there a way to close open windows directly from Alt+Tab view? Or is there any talk of this feature being included possibly in the future?
Answer: You can first press back quote while holding the Alt to emphasise the window in the selector and then press F4 again while holding Alt to close the selected window.
You can not close a window while switching with Alt+Tab because it shows a group of windows, not just one window.
Comment: This is what I have been doing. Do you know if there are any plans to include a feature to close a window in ALT+TAB in the future, like in OSX
Answer: Some things have changed on GNOME since 2012, so Scarlet's answer does not work exactly as described anymore.
Alt+Tab now shows windows previews from the current workspace, while Super+Tab shows grouped applications previews from all workspaces. Individual windows of an application can be accessed from Super+Tab by pressing ` (the key above Tab) while holding down Super. Also see this Unix & Linux question for the difference between Alt+Tab and Super+Tab.
On recent Ubuntu versions, you can press Alt+Tab and then F4 or W while holding down Alt on the selected window to close it.
You can also do the same from the Super+Tab view, but you must first enter the windows subgroup with ` and select the window you wish to close. Then press F4 or W while holding down Super on the selected window to close it.

How to close windows from alt+tab view


Do creative works that utilize generative AI require attribution?

Question: Suppose I create content (videos, essays, etc.) that utilizes generative AI to create illustrations (e.g. Midjourney, DALL-E, etc.), do I need to cite the AI tool I used? Will I still be the copyright owner of the overall work (not including the generated images)?
Comment: I don't think this is a duplicate because attribution and copyright ownership are different things.
Comment: Does this answer your question? [Who if anyone owns copyright of algorithmically produced works?](https://law.stackexchange.com/questions/77363/who-if-anyone-owns-copyright-of-algorithmically-produced-works)
Comment: Does the United States have any laws about attribution at all?
Answer:
Do creative works that utilize generative AI require attribution?

Attribution is a plagiarism concept relevant to academic ethics and in certain other non-commercial settings like contests. Plagiarism is not copying without permission (a copyright concept), it is copying without attribution. Unlike copyright law, the plagiarism requirement of attribution applies to copying ideas without attribution, as well as copying final expressions of ideas (which when done without permission violates copyright law).
Attribution is sometimes required by union-labor agreements in industries like the movie, television, and music industries, and can be necessary to assign "moral rights" in countries that have them as part of their copyright laws.
In circumstances where attribution is required for one of these reasons, attribution of an AI source for the material is also required.
Many U.S. Courts are also seriously considering imposing a rule to require a statement of whether AI was employed in drafting legal documents that are filed with them.

Will I still be the copyright owner of the overall work (not including
the generated images)?

Generally yes. See also this prior Law.SE answer, which is linked to in the comments.
Comment: Attribution may also be required by the contract for using the AI-generation software. While that attribution requirement can't be imposed on those that then copy the AI-generated content from the person that used the software to create the content, the person who used the software may have, effectively, received a discounted price for the use of the AI generation software in exchange for the advertising that is the required attribution. Obviously, this depends on the agreement for the use of the AI-generation software. The AI-generation software use agreement may or may not have such terms.
Comment: @Makyen Good point.
Answer: If you want to register your work, you need to declare usage of AI
In the somewhat recent decision of the copyright office in re: Théâtre D'opéra Spatial, an artist was denied copyright registration for not declaring that he used an AI to generate a part of the image and tried to not disclose that. The board found:

After carefully examining the Work and considering the arguments made in the First and Second Requests, the Board finds that the Work contains more than a de minimis amount of AI-generated content, which must be disclaimed in an application for registration. Because Mr. Allen has refused to disclaim the material produced by AI, the Work cannot be registered as
submitted.

Likewise, earlier, the copyright office revoked a registration earlier with in re: Zarya of the Dawn for usage of undeclared AI content, and re-issuing a registration only for the non AI-generated text:

We conclude
that Ms. Kashtanova is the author of the Work's text as well as the selection, coordination, and
arrangement of the Work's written and visual elements. That authorship is protected by
copyright.  However, as discussed below, the images in the Work that were generated by the
Midjourney technology are not the product of human authorship. Because the current
registration for the Work does not disclaim its Midjourney-generated content, we intend to
cancel the original certificate issued to Ms. Kashtanova and issue a new one covering only the
expressive material that she created.

Declaration of AI-generated content is not to be confused with attribution. It is a declaration that you did not create this aspect and do not claim copyright in that aspect. Attribution is academically telling who made the material you cite.
You can not own copyright in AI-generated content in the first place, but you can have copyright in any other aspects of a work, such as the text in the case of Zarya of the Dawn.
You can't own the AI parts
As both cases above show, you can't own copyright in the AI made parts.
You do own copyright in non-AI parts
As the Zarya of the Dawn case shows, as long as your own work is not de minimus and shows the required creativity, you do own the copyright in those parts only. In other words, if you use AI-generated images in a collage, you own the arrangement of them. If you do a comic, you own text and arrangement, and so on.
If your work contains a few small (de minimus) AI-generated parts, but is mostly your own work, you do have full copyright, following the Théâtre D'Opéra Spatial decision. A possible case would be if you used AI to generate just a pose (akin to a wood puppet) or rough sketch of an arrangement and then did the actual painting that covered it completely with expression you created, that would probably count as de minimus. Similarly, you might apply an AI-driven filter over a finished work to get a specific look or effect without lessening your copyright.


Are there any security related disadvantages if multiple ssh-agents are running?

Question: I have configured my ~/.profile file(bash login shell startup file) in a way that it starts ssh-agent automatically. It doesn't check if there is a ssh-agent already running. Are there any security related disadvantages if multiple ssh-agents are running and caching my SSH private key versus only one ssh-agent is running in the system?
Answer: It is about the attack surface.
Once there is only one you have a control of, the single instance of your encoded private key is hanging somewhere in the main memory. Once you have more of them running, you will have your private key copied all over the main memory and it is much easier to find it for the possible attacker (using different vulnerabilities).
Also if you have more agents, you have very hard time to close them and wipe the keys, if you want to lock your computer and leave it, or just suspend.
Comment: So the preferred method is to check if there already is a `ssh-agent` running and if there is, then set the `SSH_AUTH_SOCK` variable accordingly for the login shell?
Comment: If you don't have a good reason to run second agent, yes. More suitable place is some of the Xinit or Xsession init scripts, that are run only for the start of graphical environment (and set you the environment for all your future terminals). But this way, it does have a little in common with security.


How do I shorten the title lenghs with Elementor theme?

Question: Hi guys I've searched this for too long and I am getting tired now. I need to set a limit on my post titles but I don't know how to do it. On google there are snippets of 300000000 codes to do the same thing but I don't understand where to put these and HOW. I am a total newbie. I am building my website with Elementor and I need the title to trim at an exact character limit. How do I do it? Please help me!!
Comment: 3rd party plugin dev support is off topic here, if a standard WP answer does not work for you, or this isn't a standard post title, then you'll need to ask Elementor support or go to an Elementor community to ask. If you already have a snippet though you should share that and ask where it goes
Answer: Exactly "where" may differ depending on your theme setup. However, there are some global-ish ways to do this if you want to tackle it that way.
add_filter( 'the_title', 'my_trim_words' );

function my_trim_words( $title )
{
    // limit to ten words
    return wp_trim_words( $title, 10, '' );
}

If you'd like to do this for a particular post type, you can do it like this:
add_filter( 'the_title', 'my_trim_words_by_post_type', 10, 2 );

function my_trim_words_by_post_type( $title, $post_id )
{
    $post_type = get_post_type( $post_id );

    if( 'product' == $post_type ) {
        return $title;

    // limit to ten words
    return wp_trim_words( $title, 10, '' );
}

If it's within the theme templates (frontend files) that you're wanting to do this in very specific areas, you can use it this way in your templates:
<?php echo wp_trim_words( get_the_title(), 5 ); ?>


Why did Howard never use the name "Amra" in any of the stories of Conan's time as a pirate?

Question: It is well known in Hyborian lore that Conan the Cimmerian went by the name "Amra" [the lion] when he was a pirate.  From 1959 to 1982, there was a magazine named Amra—which grew from a fanzine to a professional fantasy magazine—about Conan, as well as heroic fantasy more generally.  And lots of later authors who have written about Conan's piratical career have use the name.
However—and quite peculiarly, it seems to me—Robert E. Howard only mentions the name "Amra" as Conan's former pirate alias in two stories:  "The Scarlet Citadel," the second story featuring Conan, and The Hour of the Dragon, the second to last.  Both of these stories take place in the final phase of Conan's career, when he is king of Aquilonia.  The first time the name appears, it is clearly identified as the king's former pirate alias:

"Long have I wished to meet you, Amra," the black gave Conan the name—Amra, the Lion—by which the Cimmerian had been known to the Kushites in his piratical days.

However, between the "The Scarlet Citadel" and The Hour of the Dragon, the stories Howard wrote never mention the name "Amra."  This includes multiple stories that detail parts of Conan's pirate career:  "The Pool of the Black One," "Iron Shadows in the Moon," "Queen of the Black Coast," and "The Black Stranger" (in publication order; "The Black Stranger" was written before The Hour of the Dragon but was not published until after the author's death).
Of these, "Queen of the Black Coast" is the only one in which Conan's piracy takes place predominantly off the Kushite coast, with an African crew.  Yet Conan is never referred to as "Amra," even in dialogue.  Bêlit just calls him "Conan":

"My lover, I believe there is a city somewhere on that river. I have heard tales of giant towers and walls glimpsed afar off by sailors who dared go part-way up the river. We fear nothing: Conan, let us go and sack that city."

...

"Mystery and terror are about us, Conan, and we glide into the realm of horror and death," she said. "Are you afraid?"
A shrug of his mailed shoulders was his only answer.
"I am not afraid either," she said meditatively. "I was never afraid. I have looked into the naked fangs of Death too often. Conan, do you fear the gods?"

...

"There is life beyond death, I know, and I know this, too, Conan of Cimmeria—" she rose lithely to her knees and caught him in a pantherish embrace—"my love is stronger than any death! I have lain in your arms, panting with the violence of our love; you have held and crushed and conquered me, drawing my soul to your lips with the fierceness of your bruising kisses. My heart is welded to your heart, my soul is part of your soul! Were I still in death and you fighting for life, I would come back from the abyss to aid you – aye, whether my spirit floated with the purple sails on the crystal sea of paradise, or writhed in the molten flames of hell! I am yours, and all the gods and all their eternities shall not sever us!"

Is there a known reason for this apparent inconsistency?  Did Howard forget about the pirate name, "Amra" that he had invented for Conan early on—only to rediscover it when he decided to write more about Conan's time as king of Aquilonia?
Comment: It's been a while since I read the stories, but wasn't *Queen of the Black Coast* the beginning of Conan's pirate career?  He wouldn't have earned the name, yet. I don't know why the name wouldn't have been used in other stories, except maybe REH forgot, as you suggest.
Answer: He probably didn't think that almost a century later, people would be analyzing his work in such minute detail and didn't bother to worry about the continuity.
Comment: This answer would be improved by some kind of source citation.


The role of Senghor's epistemology in African Philosophy?

Question: Please I would love it if someone could explain the role played by Senghor's epistemological theory in the development of African Philosophy.
Comment: Maybe useful [Négritude as epistemology](https://plato.stanford.edu/entries/negritude/#NegEpi).
Comment: Maybe you could indicate what you've looked at so far? WP also has a section on negritude, linking Senghor to Césaire and Damas --https://en.wikipedia.org/wiki/L%C3%A9opold_S%C3%A9dar_Senghor#N.C3.A9gritude
Answer: You might find some clues in the extract below from Michael J. C. Echeruo, 'Negritude and History: Senghor's Argument with Frobenius', Research in African Literatures, Vol. 24, No. 4, Special Issue in Memory of Josaphat Bekunuru Kubayanda (Winter, 1993), pp. 1-13 :

The "influence" of Frobenius is one that Leopold S. Senghor himself has
  acknowledged in rather profuse terms. "Et nous portons encore, dans notre esprit et dans notre ame, les marques du maitre, comme des tatouages executes aux ceremonies d'initiation dans le bois sacre" ("Les Lecons" 398). [And we still carry the mark of the master in our minds and spirits, like a form of tattooing carried out in the initiation ceremonies in the sacred grove ("Lessons" vii).] This acknowledgment has usually been read as a gesture of dependence; as positive proof of the incorporation of Senghor into the totality of Western discourse. V. Y. Mudimbe, especially in The Invention of Africa, has tried to both show how earnestly Senghor adopted what Mudimbe calls the "Western ratio" and to explain how, in the process, Senghor's Negritude has become a text constructed on the body of a larger Western discourse, and liable to collapse outside it (Invention 93ff.). Senghor is thus quite simply the efficient practitioner of a Western performance; his own contribution being to give
   a local turn to a grand European dance. Whence the suggestion, always, that Senghor is either parrot or protester: parrot to the extent that he propagates a view/system which is ultimately exterior to his own being, and therefore (for all its sense), meaningless in his context; and protester, secondly, since his desire is obviously to save his racial/cultural being from the agony of indifference and denigration that had dogged it as "[n-word]".
Frobenius is Senghor's weapon of opportunity within Western discourse, the
  text that exposes the vulnerable heel of that mighty Achilles. As if from a farce, Senghor is able to joke his way into victory by as it were masking with the enemy: "We let ourselves be seduced by Leo Frobenius's brilliant thesis according to which the Negro soul and the German soul were sisters" ("Message" 83-84; qtd. in Hymans 64-65). The underlying argument in these positions is that those African discourses which are contingent on those of the West are always and necessarily dominated or "colonized." The colonial library is the school from which every post- or ex-colonial African subject graduates. Frobenius's Destiny of Civilizations thus becomes another canonical text, "parmi les livres sacres," Senghor says, "de toute une generation d'etudiants noirs" ("Negritude" 13) [among the sacred texts of a whole generation of black students]. "From the perspective of the twentieth-century humanism, few pages have convinced me as thoroughly as those in Frobenius's Destiny of Civilization" ("Revolution" 87).
I want to re-read Senghor on Frobenius with a view to showing that these
  assumptions concerning how "Others" read and use Western discourses may need
  serious revision; and that Senghor's apparently generous appropriations of the West, far from being evidence of subordination, point to a common African discursive practice of "accommodation," a mode for negating that kind of obsessive concern for difference which is so central to European thought and (justifiably) to the Foucauldian method adopted by Mudimbe in his effort to "unmask" the Western ratio in the African literary canon" (Diawara 80). This African mode substitutes the concept for ANOTHER for ONE and OTHER, thence creating the ALL, the concept of the "universal" which is Senghor's challenge to Western discourse. And this is not to contradict the point of Abiola Irele's conclusion (in The African Experience) that Senghor's Negritude "lies outside the historical process. It is first and foremost a distinctive mode of being and of existence, particular to the black man, which can be deduced from his way of life-and which constitutes his identity, in the original sense of the word" (Irele 70-71). It is rather to argue that a European concept of "difference" rooted in the idea of the absolute "Other" is, in Senghor's text, replaced with a different concept of difference based on a necessary seriality of identities.
  Because there is ONE, there is ANOTHER; hence OTHERS. The UNIVERSAL is ALL. There is no more telling reminder of this accommodationist approach and of the particular acuity of Senghor's responses than a comparison with the comment of Nnamdi Azikiwe in My Odyssey: "By delving into various schools of philosophy"
  under the tutelage of Alain Locke, Azikiwe recalls:
...I was convinced that although the western system was more systematic than the African, nevertheless African philosophy was practical in the sense that people did not waste time on logic and frivolous arguments. Their philosophy was more pragmatic in that it was related to the practical problems of everyday life which they solved by adapting themselves to the logic of reason and experience. (120)
Mudimbe has drawn attention to one complication arising from the fact of
  African indebtedness to European ideas, namely that we fail to appreciate the
  nature of the "Africanization" of foreign ideas which results. In Mudimbe's view, those critics (especially African critics) are wrong who see Senghor as a promoter of "some famous oppositions which, out of context, could appear to embrace perspectives proper to certain racist theoreticians" including Frobenius (94). But Mudimbe equates Senghor's "use" of Western thinkers with an appropriation of them; and so constructs an immense conflict between method and theory; for instance, between Marxism as method and Marxism as a "theory of knowledge":
It is one thing to use [Marxism's] schemes for analyzing and understanding the complexity of social formations, and another to accept the idea that social complexities universally fit into the concept of the class struggle and express the need to deny religion. (94)
For to consolidate this opposition is to seek to harmonize the totality of one view into the totality of the other; to harmonize theory and method, European and African in another imperial order. Senghor's debt to Marx, as to Frobenius, is fraternal, contingent, and parallel: "We are socialists because we accept Marx and Engels and believe in the usefulness of their analysis of societies" (qtd. in Mudimbe 93).
Hence, there is an African view of discourse according to which all primary
  texts (alpha-discourses) are "fraternal," that is, they are related to one another across time and culture; with each one sustaining a crucial element of the total "inheritance" of the benevolent father, the symbolic ALL. Every Other is Another-a serial rather than an oppositional moment of difference. Senghor's "Universal" text is, thus, not the imperial, colonizing, dominating impulse which absorbs other texts into its own particular being, but a quilt of adjacent and related texts, texts which make sense because, together, they "accommodate"-make room for-themseselves and others. This concept, by virtue of which all texts are are expropriable, is alien to the kind of totalizing which informs the European discourse mode. (pp. 1-3.)

I have allowed myself a more than usual amount of quotation because the article from which the material has been taken may be dificult to obtain.
REFERENCES
Frobenius, Leo. Le Destin des Civilisations. Paris: Gallimard, 1940.
Frobenius, Leo., Histoire de la Civilisation Africaine. Paris: Gallimard, 1936.
Azikiwe, Nnamdi. My Odyssey: An Autobiography. London: C. Hurst, 1970.
Hymans, Jacques Louis. Leopold Sedar Senghor: An Intellectual Biography. Edinburgh: Edinburgh UP, 1971.
Mudimbe, V. Y. The Invention of Africa: Gnosis, Philosophy, and the Order of Knowledge. Bloomington, IN: Indiana UP; London: James Curry, 1988.


Should all questions related to Scrum and Agile tags be migrated from SO to Programmers-SE?

Question: I noticed that many questions related to Scrum, Agile and other related tags are often closed on Stack Overflow as off-topic and migrated to programmers.stacexchange. Should we simply migrate whole these tags to programmers.stackexchange? I don't see too much point in having half of questions on SO and half of questions on programmers-SE. Also it would be nice to somehow notify users when asking new questions with these tags that they should ask it on programmers instead.
Comment: See http://meta.stackexchange.com/questions/82349/disposing-of-old-questions-that-are-now-off-topic/82355#82355
Comment: This is more about migrating whole tags with their questions so that tag "doesn't exist" in SO. If new Q/A sites are created for special topics why not migrate related content to that sites?
Answer: I'm against wholesale migration of questions from one site to another (regardless of the sites involved). As I explained in my answer linked to by marcog each question must be judged on it's own merits.
A wholesale migration would migrate bad questions along with the good as well as inappropriate questions that were badly tagged. Closed questions could be ignored, so they're not an issue.
Comment: And there are mixed-tag questions as well.
Answer: No, it is not that easy, as a question may include how to write unit tests etc
Comment: If it is about "how to write unit tests" instead of "how to write unit test for this method" then it still suitable for programmers.SE.
Answer: Similar and more general question was asked today. Responses provided in that question answer my question as well.


How do I make stairs?

Question: How do I make stairs in Terraria? It's getting really annoying that NPC's can't go up platforms.
Answer: As of version 1.2.3, if you place a Platform of any type, and hit it with a hammer (essentially making it a sloped platform), the platform will transform itself into a staircase. Here's the relevant line from the changelog for 1.2.3:

You can now turn platforms into stairs using the hammer.

Here's a video from YouTube demonstrating how this works.
Comment: Can NPCs use these stairs?
Comment: Yes, I believe they can.
Answer: If you are looking for something that has the functionality like the platforms, where you can optionally go through them or up them, then that is not possible to make in a staircase.
With the changes in 1.2 though, everything should be able to walk up and down a 1 to 1 elevation change. So you can just make a tile of blocks that anyone can walk up and down. You can even use the hammer to make it look like a slope if you wanted, but this is optional and up to your taste in how you want it to appear.
Edit: interesting bit of new information from playing. You can place down Ingots of different metals and these act as a background as well as a foreground. How the AI will deal with them is a bit odd so far and I have not been able to rigorously test this, but these give you a set of stairs you can jump and land on or just simply walk past them. This may be a solution to your problem. I will update with more exact information as I find it, but it is a tentative third option.
Comment: Do you mean build a slope of blocks that npc's could walk up?
Comment: Basically yes. AI are able to go up and down and make jumps of a certain height. But if you want a true staircase its just make one out of blocks unfortunately.
Comment: is there anyway to do it in xbox360 edition?
Answer: There is now a faster way to build stairs without the hammer:
On the PC version, you can select a platform and hold down the "Ctrl" key. This will highlight a single block were the platform can be placed. If you place them in a diagonal instead of horizontal, it will automatically become stairs.
Not sure how it is done in xbox or other versions.

How do I make stairs?


All URLs Redirect to Main Page

Question: Whenever I try to access pages within my site, such as mysite.com/wp-login.php, it redirects to mysite.com. It doesn't redirect if I put www.mysite.com, however. Is this a domain configuration issue, or a WordPress issue?
Comment: Check your `.htaccess` file in the wp root (or below) dir.
Comment: I don't see one anywhere.
Comment: What changed to cause this behavior?  That will be your best starting point for debug.
Answer: Another possibility is that you haven't generated permalinks/a proper .htaccess file for your site. From within Wordpress, go to Settings > Permalinks, and update/save your link structure. See if that helps.
Answer: Try this I think it should work for you
http://example.com/your-sub-dir/wp-login.php

I had a similar problem where I couldn't login it looks like you're just missing the your-sub-dir part in the URl. I think the problem may be in your wp-login.php file if that gets you into admin great if not let me know and I'll give you a few more ways you can try to get in.
If you can get in try this.  Go to the case retrievepassword section, found under this comment:
// redefining user_login ensures we return the right case in the email
// Replace:
$user_login = $user_data["user_login"];

// With:
$user_login = $user_data->user_login;

All URLs Redirect to Main Page


What contacts can be deleted in contact builder to reduce the contacts' count in Salesforce Marketing Cloud?

Question: The count of "All contacts" has increased suddenly after integrating new business unit with sandbox. It is not possible to query all contacts, so what can be done to reduce the count of contacts? What all contacts can be deleted and how?
Answer: You should look for contacts with no channel address. They can be found using a specific data extract in your enterprise business unit, where you can store the output in a data extension, and use it to perform an automated contact deletion, as I have described here: Trying to automate contact deletion with SSJS
Contacts Without Channel Addresses is an available extract type that doesn't require support to activate the feature. Unlike other data extracts, this type outputs directly to a data extension. The process for extracting the data is following

When configuring the data extract, the File Naming Pattern field is required. But it doesn't control the output of data from the extract or the naming pattern of the data extension.
Add any File Naming Pattern to the Contacts Without Channel Address extract configuration.
Create an FTP user if one doesn't yet exist. Otherwise, you receive an error message when starting the data extract.
The Contacts Without Channel Address data extension is located under the root data extension folder.
The process takes several hours to run.
Run this extract at the Enterprise ID level.
You can't run the process more than one time in a 24-hour period.
If you had a productive run in the last 24 hours, you can submit the request and report success. No processing occurs and the contents of the data extension where the contacts are extracted remain unchanged.

You can find all these details in the documentation.
Prior to running the contact deletion, you must ensure your sandbox integration is provided with a filter, so you avoid reintroducing same number of contacts into your SFMC instance once more.


Need to fire the mountain crossbow but I have no ammunition?

Question: I've finished Lord of the Rings War in the North, but now when I am playing it again with the same character I'm stuck in the level where I need to fire the mountain crossbows. In my first playthrough it worked without complaint, but now I can't fire a crossbow. I press "E" to use it but it won't fire an arrow. Do I have to find ammunition for it? Why did it work in my first playthrough, but not now?
Answer: I think this is intentional, the game gets difficult every time you finish it, i played in in Heroic level it was working fine, but in the legendary level the mountain crossbow is not firing.
this is intentional to make the game this time more difficult.
Answer: I still figured it out!
You have to go to your Settings, Keybindings and check for the "Ranged Attack" it has to be the Left Mouse Button, so as "Attack" is, too.
Then it still works fine! Yeah! :)


Align two images vertically in Word

Question: I'm trying to align the arrow to the bird nest vertically such that they share the same center horizontal line. How can I do this?
Comment: I am not a Word user, but are you able to turn each into a like-size cell, with the content vertically centred, and then have the bird's nest in the left cell, with the arrow in the right cell? Obviously this will also depend very much on the white space in each image, and you might also have to rotate the arrow before entering it into a table.
Comment: No problem, - bearing in mind the 'fun' I had with Word before I defected to OpenOffice Writer, I am pleased and absolutely amazed... =] ...
Answer: I ended up creating a table and centering the contents. It worked perfectly.
Comment: Comments are often deleted.  Please make this a better answer by explaining the procedure in sufficient detail that somebody who isn't already familiar with the concept will be able to understand it and implement it. … … … … … … … … Please do not respond in comments; [edit] your answer to make it clearer and more complete.
Answer: One advantage of using the following approach instead of a table is that the images can overlap.
Click one image, and then hold down the Shift key while you click the other. Then, on the Picture Tools > Format tab, in the Arrange group, click Align > Align Middle.
I believe that the Shift-click approach to multi-selection works only if the Position setting of both images is something other than In Line with Text. At any rate, you may sometimes find that you just can't select both images as described above. In that case, check the Position settings. Alternatively, insert a drawing canvas on the page (on the Insert tab, in the Illustrations group, click Shapes > New Drawing Canvas) and then insert your images onto the canvas. You should then be able to select both images and click Align > Align Middle.
(Here, inserting a drawing canvas amounts to the more or less the same thing as changing the Position settings, because the objects on a drawing canvas aren't positioned in line with text.)
Comment: Thank you! I wasn't able to select two images at once for some reason but the drawing canvas method worked.

Align two images vertically in Word


UITableViewCell and strange behaviour in grouped UITableView

Question: I'm working on a grouped UITableView, with 4 sections with one row per section, and have a strange behaviour with the cells.
The cells are plain UITableViewCells, but the height of the cells are around 60 - 80 pixel.
Now the tableview renders the cells correct with round corners, but when I select the cells, they appear blue and rectangle. I don't know why the cells behave like this, because I have another grouped UITableView with custom cells and 88 pixel height and those cells work like they should.
If I change the height to the default height of 44 pixel, the cells behave like the should. Does anyone know about this behaviour and what the cause is?
Like I mentioned, I don't do any fancy stuff I use default UITableViewCells in a static, grouped UITableView with 4 sections with 1 row in each section.
evangelion2100
Edit: OK, here are the relevant parts of my code. Because I only use a fixed number of cells for this tableview I store the cells in a 2d NSMutableArray. I set up the cells in the -(void)viewDidLoad method and the respective delegate Methods access the Array with the stored cells.
I don't see anything that would cause this strange behaviour of the cells if they get selected.
Edit2: Sorry the reason why I store the cells in an array is not only the among of cells. If the view changes and UITableView reappears, the cells will be exchanged with custom cells. That the real reason for the storage of the cells.  It's like some kind of "add new email"-Type of behaviour, like in the contact app from the iphone.
<code>-(void)viewDidLoad {
    // set up the AccompanyingLecture cell
UITableViewCell *accompanyingLectureCell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"AccompanyingLectureCell"];
accompanyingLectureCell.textLabel.textAlignment = UITextAlignmentCenter;
accompanyingLectureCell.detailTextLabel.textAlignment = UITextAlignmentCenter;
accompanyingLectureCell.textLabel.text = NSLocalizedString(@"New Accompanying Lecture", @"");
accompanyingLectureCell.detailTextLabel.text = NSLocalizedString(@"Lecturer, Time, Location, etc.", @"");
accompanyingLectureCell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
accompanyingLectureCell.frame = CGRectMake(0, 0, 320, 82);

// initialize datasource for all four sections
datasource = [[NSMutableArray alloc] initWithObjects:[NSMutableArray arrayWithObject:[lecturerCell autorelease]], [NSMutableArray arrayWithObject:[lectureDetailsCell autorelease]], [NSMutableArray arrayWithObject:[timeAndLocationCell autorelease]], [NSMutableArray arrayWithObject:[accompanyingLectureCell autorelease]], nil];
</code>
}
<code>- (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

return [[datasource objectAtIndex:indexPath.section] objectAtIndex:indexPath.row];
</code>
}
<code>- (CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
CGRect currentFrame = [[[datasource objectAtIndex: indexPath.section] objectAtIndex:indexPath.row] frame];
return currentFrame.size.height;
</code>
}
Comment: It might help to post your `-tableView:cellForRowAtIndexPath:` method and any other delegate methods that touch the cells, such as `-tableView:heightForRowAtIndexPath:`
Answer: What happens if you simply return 82 in the heightForRowAtIndexPath method and don't set the cell's frame in viewDidLoad?
Comment: There is no change. If I select the cell it gets rectangle. Actually I tried various cell heights to see whether it would work or not. But only with cell height 44 pixel the strange behaviour doesn't appear.


Export MS Access query into Excel

Question: In Access, I know that there is a "Analyze it with Microsoft Office Excel" option, but i am creating a database and the person requesting this wants a command button on a form to do the same thing that the "Analyze it with Microsoft Office Excel" button does. So my question is can anyone help me write vba code to export a MS Access query into Excel, formatted the exact way the "Analyze it with Microsoft Office Excel" does?
Answer: this worked on the Northwinds db:
<code>DoCmd.OutputTo acTable, "Customers", "MicrosoftExcelBiff8(*.xls)", "", False, "", 0
</code>
http://msdn.microsoft.com/en-us/library/aa141534(v=office.10).aspx
Comment: Thanks, Chris. Had to change False to true to open Excel, but it worked
Answer: If you want a lot more flexibility as to exactly what is being exported where to Excel then see

Modules: Sample Excel Automation - cell by cell which is slow
Modules: Transferring Records to Excel with Automation

I've used such code as a starting point to, for example, include some heading and footer lines, starting the export below the above lines, remove columns from the spreadsheet which were placed there from the query, create multiple worksheets, etc, etc.
However if you want just something basic then Chris gave you the answer.

Export MS Access query into Excel


MySQL equivalent of PostgreSQL's psql \c command

Question: I'm learning PostgreSQL though oddly enough figured out to switch users while in the psql command line to use <code>\c database username</code>; what is the equivalent to switch from one user to another in MySQL's command prompt?
Answer: In the context of MySQL, you cannot switch users. You can switch database and host.
According to the MySQL Documentation on the MySQL Client

connect [db_name host_name]], \r [db_name host_name]]
Reconnect to the server. The optional database name and host name arguments may be given to specify the default database or the host where the server is running. If omitted, the current values are used.

This looks similar to how PostgreSQL does it.


Does SoftwareSerial and the servo library produce interrupt conflicts?

Question: I'm planning a project that will involve multiple serial ports and the Arduino servo library. I have heard that this may cause interrupt conflicts. Are there any simple solutions to this
Answer:
I have heard that this may cause interrupt conflicts.

Indeed. The Arduino can only run one interrupt routine at a time, and:

Servos use rapidly firing interrupts
SoftwareSerial both turns off interrupts while sending (for relatively long periods)
SoftwareSerial uses an interrupt for receiving that runs for an extended period

So really you can't use both together.
Options?

Use hardware PWM to drive the servos (There is a library for this somewhere)
Use an external servo PWM driving board (Adafruit do one IIRC)
Don't use SoftwareSerial.  IIRC AltSoftSerial is better, though no software serial implementation will ever be particularly good.

The underlying problem is that the low-end Arduinos only have on serial port. If you need to use more than one serial port then you really need to be looking at using a different Arduino - one with multiple serial ports.


Calling value in a certain offset of a searched value

Question: My goal is to make the rank appear when I enter the name of the staff in the shift schedule. For example If I enter Andrew in cell F2, A (the rank of Andrew) appears in cell E2.

I tried to make use of the VLOOKUP function and I believe that I'm tinkering with the right function, but I just can't get it to work.
Any help will be extremely helpful. Thank you!!
Answer: Use INDEX and MATCH functions. In E2, enter the formula:
=INDEX($A$2:$A$6,MATCH(F2,$B$2:$B$6,0))

Answer: Or use XLOOKUP() like so:
=XLOOKUP(F2,  $B$2:$B$6,  $A$2:$A$6)

It has some options I have not used, but can, for example, let you give a custom error message if "Andrew" is not present in the source. Perhaps something like "Did not find staff member. Perhaps the name is spelled incorrectly." which can be much more useful than an Excel error, to users that is.
You could actually do this with VLOOKUP() if you really wish. Like all "you could actually" things it would use a trick. Actually, there are several ways to do it, this is just the slickest, in my opinion. I recommend XLOOKUP() though since it needs no tricks and offers the useful error message feature. Still, if ever useful to you:
=VLOOKUP(F2, INDEX($A$2:$B$6,, {2,1} ), 2, FALSE)

INDEX() will take those two columns and rearrange them so that the staff member's name column is FIRST, not second. So the table is acceptable to VLOOKUP() as the lookup column (the names) is the now the leftmost column.
If they were in, say, columns A and G, you'd just use the range $A$2:$G$6 in INDEX() and then give it the two columns you want, 1 and 7, in the order {7,1} and VLOOKUP() would be happy.
INDEX() is the gift that keeps on giving. Look at this question for a similar, but more interesting use of it:  How to merge multiple Mac excel files all with headers that are the same but out of order
There we used column headers to rearrange table columns to match a standard order. Same idea for pretty different situations. The gift that keeps on giving!
Answer: Please check if the answers from Reddy and Jeorje are helpful to you.
If you still want to use the VLOOKUP function to do this, I suggest you manually swap the Name column with the Rank column, then everything becomes simpler:
=IFERROR(VLOOKUP(F2,$A$2:$B$3,2,FALSE),"")

Answer:
In VlookUp see that Table you use to look-up, must contain the first column as Name of Employee

That column must be sorted on Employee

If there are similar names, again it will give wrong answer.

Ideal thing is table must be arranged on UNIQUE EMPLOYEE NUMBER, and not on Names. All other columns of data can be added like Name, Position, Sex, Age, Grade, Date of joining......and all..

Thanks.


Difference between segmentation and classification

Question: I have been wondering the real difference between segmentation and classification. Classification using the decision tree algorithm has any difference from segmentation?
Comment: By segmentation do you mean stuff like image segmentation?
Comment: Train is the best example for classification & segmentation where each coaches can be considered as segments & class (like first,sleeper,second & general) is considered as classification.
Answer: Segmentation, as in Image Segmentation means creating parts of an image into segments which are conceptually meaningful or simple for further analysis. Usually we want to locate objects and boundaries in the images. Simplest example is removing background from foreground.

You can relate it with edge detection and countour detection. There are various methods to do this like clustering using K-Means, compressing image to reduce texture, edge detection or markov fields.
Classification is entirely different. In classification, you want to find LABEL of the given data item. The Labels are usually predefined classes or categories - like whether an email is spam or not, or an image contains a human or animal. Decision tree is one of the approaches to do this.
There have been experiments on segmenting images with the help of classification algorithms. Nikamanon's method (link in reference) tries to create too many segments using cut algorithm and use classification to combine them based on whether it is a good segment based on human intervention or not. Their algorithm didn't perform very well but gave a sign that classification can be used in this task.
p.s. Segmentation is more related to clustering than classification.
Comment: Thank you for your answer and can you pleasebtell me why segkentation is more related to clustering?
Comment: Read the books dude. Your questions are too wide.
Answer: If you want to know the difference between decision trees (used for classification) and segmentation trees (used for segmentation), a brief explanation is:
Decision trees: optimize for purity of leaf nodes (i.e., they want to classify as good as possible
Segmentation trees: optimize for a "good segmentation of the data", not for purity. A "good segmentation" could be that some classification algorithm (for example logistic regression) performs well on the population segments in the leaves. So the tree doesn't do the classification, but rather tries to find segments of the population for which another model works well. The end goal may not be the classification, but rather the segments themselves (i.e. if you want to identify customers that behave a certain way)
Comment: Hi @marianne, do you have a reference that describes an implementation or a python module that implements this?


Should I Trust a Certificate

Question: Basically, my school is apparently having a network 'update' and are telling us to go to keychain access and trust a certificate. This is what they sent us.

Exactly what will happen if I do this any? Do you have any recommendations for what I should do?
Comment: Are you a student or a member of staff? Is this your personal computer or a device supplied by the school?
Comment: Personal Computer
Answer: Trusting a certificate gives the owner of that certificate the ability to limit security warnings when performing some tasks. These tasks include installing new software, and intercepting & proxying secure connections.
Whether you should follow the request to trust the certificate depends on who owns the computer.
See Should I let my child's school have access to my kid's personal laptop? for a related question over on the Information Security site.
School Device
If the computer is supplied by the school and the school want you to install their trusted certificate, then you should do so.
Personal Device
If this computer is yours, I would not trust their certificate. Adding an always trusted certificate is significant step and should rarely be needed on a personal device.
Minimum Trust
Note the sub-options in step 5:

You can choose to trust the certificate only for certain functions. If the certificate is intended to allow locally developed and signed software to run, then only Code Signing should be required. Maybe X.509 Basic Policy also.
I would avoid trusting Secure Sockets Layers (SSL) until it is proven essential. This trust would allow the school to intercept previously secure Internet connections.
You could incrementally trust/distrust parts the certificate until you found the minimum set of trust required.
Comment: I do not want to assume the reason why. We do not know the owner of the device or the intent of the certificate.
Comment: I'd second this. But I believe the school is deploying some internal application and has saved on getting a certificate from a trusted third party. The app has created its own certificate and hence require trusting.
Comment: I also found it suspicious as they gave us only a week to do it
Comment: Would SSL stop VPNs from working at school?
Comment: Your VPN would continue to work. However, your VPN software would *always trust* the school's certificate for SSL/TLS and thus the school can undermine the security of connections via the VPN.
Answer: Personally, I'd say no. This is an intermediate CA (and below that a Root CA). This enables the owner of that CA to man in the middle your connections. There is no reason to accept such a CA unless there is a large volume of internal applications. The general application of a CA like that is for SSL man in the middle boxes that do traffic inspection — often badly configured.
Comment: Is it possible that they are trying to look for hackers on the network
Comment: Possible, this would be a crappy way to try to do that

Should I Trust a Certificate


How to count non empty and empty directories with size 4096

Question: I want to count empty and non empty directories. But all the empty directories and directories that contains files and subdirectories have same size 4096. So empty directories also count in non empty directories because of 4096 size. And count of empty directories obtains zero.
Comment: Note: "to count non empty and empty directories with size 4096" (the title) and "to count empty and non empty directories" (the first sentence of the body) are two different tasks. [In ext a directory can take more bytes regardless whether it's empty or not](https://unix.stackexchange.com/q/495176/108618). It's not clear which task you want. Please [edit] and clarify.
Comment: the 4096 size is the size of the inodes needed to contains the list of files+dirs within that directory. It will be 1 block of inodes (4k) if the dir was always empty or always had few files+dirs within, or more if you have many files+dirs within that directory. Once it is enlarged to hold a long list of filenames, it will not shrink back after you delete those files. You would need to create another dir and replace it with that new one.
Answer: If all you care about is emptiness, find seems like the most straightforward tool for the job.
find . -type d -empty will list all empty folders in the current directory. Change the dot to search elsewhere.
find . -maxdepth 1 -type d -empty will avoid looking at subdirectories.
The end goal was to count them, so based on @alecxs comment :
find . -maxdepth 1 -type d -empty -printf '\n' | wc -l.
This has the advantage of not forking a process for every directory so should be faster, especially if the number of empty directories is large.
Comment: it will recursively look for empty directories. E.g. it'll find `./foo/bar/` too, if it's empty
Comment: Just add `-maxdepth 1` if that's undesirable.
Answer: I normally put an alias to my bash for folder size into (/root/).bashrc
alias ds='du --max-depth=1 -ch'

So I don't type whole thing every time.  This will list folder sizes in human readable format ie (4K, 1M, 2G)

so then you can just issue this command and pipe through grep like following:
ds |grep -c 4.0K

this will count empty directories or:
ds |grep -cv 4.0K

will count non-empty directories
if you don't want to use alias, just replace ds with du --max-depth=1 -ch
If you want to be absolutely precise you can skip h and just do:
du --max-depth=1 -cb |grep -c "^4096"$'\t'

Please note that directory size of 4096B will also be shown if directory has symbolic links inside or files with size of 0B, so this will NOT correctly display empty directory count, thus probably better to use above solution with find
Another useful thing that I normally use is to list large directories (larger than 1G and sort them)
ds |grep "G"$'\t' |sort -n

This should help.


Networking with C/C++ in a Windows environment

Question: What is the best way to use sockets on the Windows platform?
Basic sockets I guess, TCP/IP.
Maybe for a chat client, or just for learning.
Could someone give me an example of WININET usage?
maybe ftpgetfile()
Answer: That is a very broad question, and depends a lot on your needs.
What level do you need? HTTP/FTP? Or "just sockets" for your own protocol? What kind of performance do you need (amount of connections, expected speed)?
If you choose to go raw API, you should generally stay away from WSAAsyncSelect since performance is abysmal above "a few" concurrent connections. Blocking sockets and thread-per-socket isn't too hot either. WSAEventSelect is slightly tricky, but gets the job done nicely (µtorrent handles a lot of concurrent connections this way). Fancypants really-high-load would be I/O Completion Ports. You could also look into boost ASIO for some portability.
If you want to use standard protocols like HTTP/FTP, check libcurl. Or, for lesser needs and smaller overhead, the standard Windows WININET functions (has a lot of restrictions though).

For using WinINet functions, try starting here - might not be a sample, but at least gives you enough stuff to google for ;)
Answer: For basic client server application with TCP/UDP winsock should be sufficient.
Answer: Do you mean asynchronous I/O model on windows?
There are select, WSAAsyncSelect, WSAEventSelect, Overlapped I/O, I/O Completion Port, also you may want to use Libevent and Boost Asio which are both cross platform.
Answer: WinInet examples you could find in msdn or codeproject.con
Ways to use you could find in nice platofrm independed lib - boost::asio
Answer: If you are looking to use this as a learning experience I would also look at ACE. A C++ cross platform framework that implements a lot of the patterns discussed in Patterns for Concurrent Network and Networked Objects. The author has also written on ACE as well (see here).


Where should a glossary be placed in a book?

Question: I am writing a book for a technical industry. I'm planning on including a glossary, I wanted to know, should I place this at the beginning of the book or at the end of the book?
Answer: There is no "correct" answer here. It really depends on what your goal is: if it's to inform the audience of terms before they start reading the main text, then it might make sense to place it in the "front matter." On the other hand, if you expect readers to consult it as needed when they're reading, then typically you'd place it at the end of the book with the appendices.
Comment: The publisher might also have something to say about this.
Comment: Yes, beginning or end as long as it is not missing...
Comment: Virtually all books I've seen with a glossary (easily in the hundreds --- including quite a few of my pre-university and university textbooks in most every subject) have the glossary at the end, usually before the index. However, the beginning might be a better choice for the OP's situation, but this decision requires a lot more specific information about the book, and it's likely that the decision is not entirely up to the OP (as @Buffy suggests).