text:
Q: Do I need both a heading tag and a caption for a table? I do a lot of documents with tables on our website.
I see conflicting arguments about whether I need a heading (<h2>...</h2>) before a table, a caption within a table, or both.
It seems to me that caption is semantic and therefore should suffice.
What is the justification for tables needing a header if there is a caption?
Having both is duplicative and would drive me crazy if I was a screen reader user.
And since caption is semantic, I shouldn't need aria.

A: Short Answer
You don't need a heading before a table, however if the heading benefits the page structure then it would be preferable to have duplication, due to how most screen reader users interact with web pages.
If in doubt add a heading as duplication is preferable to missing key document structure elements.
Longer Answer
You don't need a heading before a table but it may be appropriate depending on the document you are creating.
There is no direct guidance on this but if you break down what each element is used (semantically) for and how they are used by different people (primarily screen reader users) you can see why most people would argue for the use of both.
Headings
Obviously headings are used as primary landmarks throughout a document and to show relationships between sections.
They are also the primary way most screen reader users navigate a page when they first land on it to get a feel for what information is present and where.
So having headings above each table could be appropriate.
For example if your page contains several tables with key information within them then headings above each table would certainly improve navigation and discoverability for screen reader users who have never visited that page before.
However if the tables are included as part of a larger body of text and are supplementary / supporting information for the body of text (which may continue after the table) then adding a heading would cause unnecessary duplication and also ruin document flow. Obviously in this scenario it is assumed that this body of text has the appropriate heading so the document is easy to navigate.
Captions
99% of the time your table should have a caption (I am sure there are scenarios where a caption is unnecessary but I can't think of one right now).
The information in a caption is useful for framing the general topic of the table information.
For example, screen reader users who are familiar with your site (and know it has a lot of tables) my choose to navigate by tables.
They could land at a table out of context that may not make sense without a caption.
So what should I do?
Add a caption unless you can think of a really good reason not to.
If in doubt, add a heading (at a suitable level in the document structure).
However if you feel that the table is suitably described by the caption and is within a body of text that is supported by the table then a heading will probably not be needed.
Final thought - get someone unfamiliar with the site to test it with a screen reader, this is the best way to see if the page is easy to navigate, as developers we make assumptions and even with all the experience in the world you can get it wrong, seeing real people use a product is often very humbling!


text:
Q: How to install PDAL in Windows? I want to import .las files to PostGIS. As I found out I can do it by using PDAL.
However, I cannot find the right way to install it in Windows. I downloaded a folder from here https://www.pdal.io/download.html, but then, I don't know what to do next.

A: You downloaded the source code, not a prebuilt binary.
If you read the PDAL download page you linked to you will see:

Binaries
...
Windows
Windows builds are available via Conda Forge (64-bit only).

Install Conda (or Miniconda), run a Conda shell, install PDAL with
conda install -c conda-forge pdal

and you should be good to go. See the Conda instructions for more detail.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Delphi XE2: empty application weighs 7 Mb Why does it happen?
An empty project (application, *.exe) size is 7 Mb, why?

A: This is because you are using the Debug build configuration. change to Release and the size will be 1.5 mb (for an empty VCL project).


text:
Q: Bit swapping within a char array in C I am trying to write a program that reads in a text file and then decrypts it following these qualifications:

*

*For every 4 bytes <c0,c1,c2,c3> swap bytes c2 and c3

*For every byte <b7,b6,b5,b4,b3,b2,b1,b0> swap bits b3 and b1, and
swap bits b2 and b0

*For every 4 bytes <c0,c1,c2,c3> XOR bytes c2 and c3 with the
character 'R'

My program reads in the text file into a dynamic array called 'message'.  Below is the code I implemented for the byte/bit swapping:
//Because chars are 1 byte long, just switch elements of the message array
int i = 0;
for (i = 0; i < length; i = i+4)
{
    char temp;
    temp = message[i+3];
    message[i+3] = message[i+2];
    message[i+2] = temp;
}

//Second letter of key is 'Y'.  Swap bits b3 and b1, swap bits b2 and b0 in every byte of <b7,b6,b5,b4,b3,b2,b1,b0>
//use bit shifting and bit masks
char mask1 = 0x08; //mask of 00001000 for bit b3
char mask2 = 0x02; //mask of 00000010 for bit b1
char mask3 = 0x04; //mask of 00000100 for bit b2
char mask4 = 0x01; //mask of 00000001 for bit b0

char mask5 = 0xF0; //mask of 11110000 to preserve shifted bits but allow first four through

//and bits together and shift for every byte of message
int s = 0;
for (s = 0; s < length; s = s+1)
{
    char result = ((message[s] & mask1) >> 2 | (message[s] & mask2) << 2);
    char second = ((message[s] & mask3) >> 2 | (message[s] & mask4) << 2);
    message[s] = ((result | second) & mask5);
}

//Third letter of the key is 'R'.  XOR bytes c1 and c0 with k3 of bytes <c0,c1,c2,c3>
int j = 0;
for (j = 0; j < length; j = j+4)
{
    message[j] = message[j] ^ 'R';
    message[j+1] = message[j+1] ^ 'R';
}

//display message
printf("The message is: ");
for (i = 0; i < length; i = i+1)
{
    printf("%c", message[i]);
}
printf("\n");

The final output of the program turns all of the characters of the message to 'R'.  So if the message was 5 characters in length, the output would be "RRRRR".
I don't understand why these swaps aren't working!  Any tips or insight would be appreciated.

A: The reason you're getting all Rs is here...
for (s = 0; s < length; s = s+1)
{
    char result = ((message[s] & mask1) >> 2 | (message[s] & mask2) << 2);
    char second = ((message[s] & mask3) >> 2 | (message[s] & mask4) << 2);
    message[s] = ((result | second) & mask5);
}

mask5 clears the bottom four bits.
I think what you meant was...
for (s = 0; s < length; s = s+1)
{
    char b3 = message[s] & mask1;
    char b2 = message[s] & mask2;
    char b1 = message[s] & mask3;
    char b0 = message[s] & mask4;

    message[s] &= ~(mask1 | mask2 | mask3 | mask4);
    message[s] |= (b3 >> 2 | b1 << 2 | b2 >> 2 | b0 << 2);
}


text:
Q: databricks error IllegalStateException: The transaction log has failed integrity checks I have a table that I need drop, delete transaction log and recreate, but while I am trying to drop I get following error.
I have ran repair table statement on this one and could be responsible for error but not sure.

IllegalStateException: The transaction log has failed integrity checks. We recommend you contact Databricks support for assistance. To disable this check, set spark.databricks.delta.state.corruptionIsFatal to false. Failed verification of:
Table size (bytes) - Expected: 0 Computed: 63233
Number of files - Expected: 0 Computed: 1

A: We think this may just be related to s3 eventual consistency. Please try waiting a few extra minutes after deleting the Delta directory before writing new data to it. Also, normal MSCK REPAIR TABLE doesn't do anything for Delta, as Delta doesn't use the Hive Metastore to store the partitions. There is an FSCK REPAIR TABLE, but that is for removing the file entries from the transaction log of a Databricks Delta table that can no longer be found in the underlying file system.
We don't recommend overwriting a Delta table in place, like you might with a normal Spark table. Delta is not like a normal table - it's a table, plus a transaction log, and many versions of your data (unless fully vacuumed). If you want to overwrite parts of the table, or even the whole table, you should use Delta's delete functionality. If you want to completely change the table, consider writing to an entirely new directory, such as /table/v2/... and separately deleting the other table.

A: To skip the issue from occurring can use below command (PySpark notebook):
spark.conf.set("spark.databricks.delta.state.corruptionIsFatal", False)


text:
Q: Trying to start program on JButton press I am trying to make a simple program that will ask the user a question and then compare their answer with a stored correct answer. The problem seems to be that the main loop of the program is not running when I click the Ready JButton.
I tried changing the main method to another non-default name and adding a call to it in the actionPerformed() method, and it did seem to execute the loop at least once, but then led to not being able to close the applet without the task manager once I clicked the button. I don't know if that means it hit an endless loop or what.
I'm sure there is more to fix in this code besides this issue, but I cannot make any progress on that without clearing this up first. If there is a problem with the way I went about creating the GUI please let me know. I tried to base it off of an assignment I did that worked just fine, so I don't know whether or not that is the issue.
Any help provided is appreciated.
Here is the code:
import java.awt.*;
import javax.swing.*;

public class Langarden_App extends JApplet{
    private int width = 800, height = 600;
    private LangardenPanel langPanel;

    public void init(){
        langPanel = new LangardenPanel();
        getContentPane().add(langPanel);
        setSize(width, height);
    }
}

And the class with the logic
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.util.Arrays;
import java.util.concurrent.TimeUnit;
import java.util.*;

public class LangardenPanel extends JPanel{

    private static JButton submit;
    private static JButton ready = new JButton("Ready");
    private static JLabel instruct;
    private JTextField input = new JTextField(100);
    private static String inString;
    private static ArrayList<String> questions;
    private static ArrayList<String> answers;
    private static Random rand = new Random();

    public LangardenPanel(){
        questions = new ArrayList<String> (Arrays.asList("¿Qué es la palabra para 'inveirno' en ingles?", "¿Qué es la forma de 'yo' del verbo 'venir'?"));
        answers = new ArrayList<String> (Arrays.asList("winter", "voy"));
        instruct = new JLabel("Welcome to Langarden! Press Submit to begin. You have one minute and three attempts for each question.");
        submit = new JButton("Submit");
        this.setLayout(new BorderLayout());
        add(BorderLayout.SOUTH, ready);
        add(BorderLayout.NORTH, instruct);
        add(BorderLayout.CENTER, input);
        ready.addActionListener(new SubListener());
    }

    public static void main(String[] args){
        try{
            TimeUnit.SECONDS.sleep(3);
        } catch (InterruptedException e){
        }
        System.out.println("Setting text");
        instruct.setText("Alright! Let's Go!");
        try{
            TimeUnit.SECONDS.sleep(1);
        } catch (InterruptedException e){
        }
        do{
            System.out.println("Running loop");
            int qnum = rand.nextInt(questions.size());
            instruct.setText(questions.get(qnum));
            for (int i=0; i<3; i++){
                try {
                    TimeUnit.SECONDS.sleep(60);
                } catch (InterruptedException e) {
                }
                if(checkAnswer(qnum, inString)){
                    instruct.setText("Correct!");
                    break;
                } else {
                    instruct.setText("Try again...\n" + questions.get(qnum));
                }
            }
            instruct.setText("The correct answer was " + answers.get(qnum));
            try{
                TimeUnit.SECONDS.sleep(2);
            } catch (InterruptedException e){
            }
            questions.remove(qnum);
            answers.remove(qnum);
            instruct.setText("Would you like to continue? Enter No and click Submit to exit.");
        } while (!inString.equalsIgnoreCase("No") && questions.size() != 0);
        instruct.setText("Congratulations, you have completed this module!");
    }

    private static boolean checkAnswer(int qnum, String inString) {
        if (answers.get(qnum).equalsIgnoreCase(inString))
            return true;
        return false;
    }

    private class SubListener implements ActionListener{
        public void actionPerformed(ActionEvent e){
            System.out.println("Button Pressed!");
            if(e.getSource() == ready){
                add(BorderLayout.SOUTH, submit);
                submit.addActionListener(new SubListener());
            } else {
                inString = input.getText();
            }
        }
    }
}

A: *

*Get rid of the main method. If this is running as an applet, then the program has no business having a main method.

*Make all fields non-static. Yes all.

*Get rid of the while-true loop. If this runs, this will squelch your Swing event thread rendering your GUI frozen and helpless. Use a Swing Timer instead as a "pseudo" loop. Please check out the Swing Timer Tutorial for more on this.

*Any time you add a component to a container, you should call revalidate() and repaint() on that same container so that the container's layout managers can layout the new component, and so that the OS can repaint over any "dirty" pixels.

*Rather than add a new JButton as you're doing, much better is to swap components using a CardLayout. The tutorial can be found here: CardLayout tutorial.


text:
Q: Take initrd out of the Linux boot process I have "one" machine which is static. The following never change: CPU, GPU, motherboard, harddrive, keyboard, mouse, USB ports
I have dual-boot Windows and Linux (specifically Windows 10 and Ubuntu)
As I understand the Linux boot process, it uses initrd to load an initial root filesystem, the load the kernel, get appropriate device drivers, prepare the kernel for user space processes and finally start some process like "init".
My question is: why? Given my machine configuration above, why not have the boot process completely optimized and in a way, inflexible, but fast. It could start by directly loading exactly what it needs for my machine, and bypassing this initrd/initial root FS -> then userspace processes.
Is there a way to achieve this?


text:
Q: Compare and merge objects in List I have a class:
class CustomDetail{
 String version;
 List<String> details;
}

And in result of some method I have the list of CustomDetail like
List<CustomDetails> resultList
resultList.get(0) => CustomDetail("V1", {"123"})
resultList.get(1) => CustomDetail("V1", {"456"})
...
resultList.get(9) => CustomDetail("B", {"atr"})
resultList.get(10) => CustomDetail("B", {"atr1"})
resultList.get(11) => CustomDetail("B", {"atr3"})

CustomDetails in this list may contain same vers fild.
and i need to merge of this objects like:
List<CustomDetails> newList = ...
newList.get(0)=> CustomDetail("V1", {"123", "456"})
newList.get(1)=> CustomDetail("B", {"atr", "atr1", "atr3"})

Any ideas how to do this?

A: First implement equals and hashCode on your CustomDetail. In all likelihood your IDE has a shortcut to do  generate the necessary code.
Then create a Set (i.e. HashSet) and add both lists to it. As the set cannot contain duplicate entries you end up with a collection only containing unique members. If you need to you can then create a List from your Set.


text:
Q: pca and cluster analysis, very slow computing My data has 30,000 rows and 140 columns and I am trying to cluster the data. I am doing a pca and then using about 12 pc to use in the cluster analysis. I took a random sample of 3000 observations and ran it and it took 44 minutes to run both the pca and the hierarchal clustering.
A co-worker did the same in SPSS and it took significantly less time? Any idea why?
Here is a simplified version of my code which works fine but is really slow on anything over 2000 observations.  I included the USArrest dataset which is really small so it doesn't really represent my problem but shows what I'm trying to do.  I'm hesitant to post a large dataset as that seems rude.
I'm not sure how to speed the clustering up. I know I can do random samples of the data and then use a predict function to assign clusters to the test data. But optimally I'd like to use all of the data in the clustering since the data is static and isn't ever going to change or be updated.
library(factoextra)
library(FactoMineR)
library(FactoInvestigate)

## Data

# mydata = My data has 32,000 rows with 139 variables.
# example data with small data set
data("USArrests")
mydata <- USArrests

## Initial PCA on mydata

res.pca <- PCA(mydata, ncp=4, scale.unit=TRUE, graph = TRUE)

Investigate(res.pca)  # this report is very helpful!  I determined to keep 12 PC and start with 3 clusters.

## Keep PCA dataset with only 2 PC
res.pca1 <- PCA(mydata, ncp=2, scale.unit=TRUE, graph = TRUE)

## Run a HC on the PC:  Start with suggested number of PC and Clusters
res.hcpc <- HCPC(res.pca1, nb.clust=4, graph = FALSE)

## Dendrogram
fviz_dend(res.hcpc,
          cex = 0.7,
          palette = "jco",
          rect = TRUE, rect_fill = TRUE,
          rect_border = "jco",
          labels_track_height = 0.8
)

## Cluster Viz
fviz_cluster(res.hcpc,
             geom = "point",
             elipse.type = "convex",
             #repel = TRUE,
             show.clust.cent = TRUE,
             palette = "jco",
             ggtheme = theme_minimal(),
             main = "Factor map"
)

#### Cluster 1: Means of Variables
res.hcpc$desc.var$quanti$'1'

#### Cluster 2: Means of Variables
res.hcpc$desc.var$quanti$'2'

#### Cluster 3: Means of Variables
res.hcpc$desc.var$quanti$'3'

#### Cluster 4: Means of Variables
res.hcpc$desc.var$quanti$'4'

#### Number of Observations in each cluster
cluster_hd = res.hcpc$data.clust$clust
summary(cluster_hd)

Any idea why SPSS is so much faster?
Any idea how to speed this up? I know clustering is labor intensive but I'm not sure what the threshold is for efficiency and my data of 30,000 records and 140 variables.
Are some of the other clustering packages more efficient? Suggestions?

A: HCPC is a hierarchical clustering on the principal components using the Ward criterion. You can use k-means algorithm instead for the clustering part, which is way faster: Hierarchical clustering has a time complexity of O(n³) whereas k-means has a complexity of O(n) where n is the number of observations.
Since the criterions optimized by k-means and hierarchical clustering with Ward are the same (minimize the total within-cluster variance), you can use first k-means with a high number of clusters (say 300 for instance) and then run hierarchical clustering on the centers of the clusters if you need to keep the hierachical aspect.


text:
Q: ConEmu Underlined Text appears as different color I have ConEmu set up running Cygwin and using the Solarized colorscheme.  The only problem is that underlined text simply appears as normal text with a different color.
I am using Consolas, 16pt but I have tried other fonts and sizes with no luck.
FYI: On my Mintty terminal I get underlined text no problem.

A: Up until recently, Windows Console didn't support underline, so this was the workaround baked into Cygwin (on clients) and Termcap (on servers).
The reason it works in Mintty is Cygwin applications have 2 operating modes:

*

*Windows Console (e.g. CMD, ConEmu)

*POSIX terminal (e.g. ssh, mintty)

ConEmu (CMD, PowerShell) would cause Cygwin apps to run in Windows Console mode. While Mintty would cause Cygwin apps to run in POSIX terminal mode.


text:
Q: Adding mean value to facets I have this plot, which calculates an index of abbundance of a bird species for a given winter:

This graphic comes from this code (themes and scales excluded):
ggplot (a, aes (pentada,ika,colour=inv,group=inv,na.rm=T)) + geom_line()+
facet_wrap(~inv, ncol=3)+labs(title="SYLATR\n",x="",y="IKA")

and the data frame has 6 variables:
pentada / censos / yr / total / inv / ika
The thing is that I would like to add a line in each of the wintering seasons that shows the mean of the abbundance for all the years combined and I don't know how. should I append the mean as a new column after every wintering season? In this case, how should I do it?.
Thank you.

A: I'm not sure if you want the global mean, i.e. averaging over winters as well as days.  If so, then shadow's solution above is probably best; something like this would also do:
#toy data
df <- data.frame(t = rep(1:100,9), pop = rnorm(900)+20,
    year = rep(letters[1:9], 9, each = 100))

#make graph
ggplot(data = df, aes(x = t, y = pop, colour = year, na.rm=T)) +
    geom_line() + facet_wrap(~year, ncol = 3) +
    geom_line(aes(x=t, y = mean(pop)))

If you want the mean-over-winters-only, so that there is still a dynamic by day, I think you should probably add that to the data frame first, before calling ggplot.
#aggregate the mean population over years but not days
yearagg.df <- aggregate(data = df, pop ~ t, mean)

#make plot
ggplot(data = df, aes(x = t, y = pop, colour = year, na.rm=T)) +
    geom_line() +
    facet_wrap(~year, ncol = 3) +
    geom_line(data = yearagg.df, aes(y = pop, x=t), color = 'black')

That second code snippet results in this graph:

UPDATE: You will probably have easier plotting if you put the averaged data back into your data frame so that you can plot all layers from the same data frame instead of mixing/matching data from multiple frames into one plot.
df.m <- merge(df, yearagg.df, by = 't', suffixes = c('.raw', '.mean'))
ggplot(data = df.m, aes(x = t, colour = year, na.rm=T)) +
    geom_line(aes(y = pop.raw)) +
    facet_wrap(~year, ncol = 3) +
    geom_line(aes(y = pop.mean), color = 'gray')


text:
Q: Get stringvalue of NSTextField within a NSCollectionView I would like to know how I can get the stringvalue of a textfield thats in a NSCollectionView. The textfield is created with a prototype for the collectionview.
I dont know if I should use representedObject or something else and how.

A: In the "cellForItemAtIndexPath" method set the textfield tag to be the indexPath row.
Then set the textfield delegate to be your controller or any other desired object.
On "textFieldDidEndEditing" method from UITextFieldDelegate protocol check the tag from the textfield so you know which index was modified.
GL HF


text:
Q: Bind database image to the ad rotator control I am using asp.net 2.0 and C#.
I have a adrotator control, whcih I am binding to the database which has the three fields.
AlternateText, ImageUrl and NavigateUrl.
Now, this works fine, as per the expectation. My question is this that the ImageUrl in the table contains a URL like http://www.xyz.com/abc.jpg
but I want to store image in a database and then bind the image to the adrotator.
please help.
Thanks in advance.

A: It sounds like you want to put the data of the image into a image field in the database. This can be achieved by reading the image from the web with a HttpWebRequest. You can then get the HttpWebResponse with :
HttpWebResponse response = (HttpWebResponse)request.GetResponse();

Then  read the bytes from the response stream (See this SO question Creating a byte array from a stream) . Then insert this byte[] into your database.
Then, you could use a custom handler to read the image from the database and output it as image/jpeg (or whatever mimetype you need).


text:
Q: What does an HTML E-Mail look like? I am trying to automatically build html emails and am trying to figure out whether there are standards and what attributes in an email work and which have to exist. Do I need a ? And if no does there have to be a body? Do I need to specify what Doctype I am using?
I am working with the Zend Framework in their example they don't set anything but the content with "styling" code http://framework.zend.com/manual/de/zend.mail.html-mails.html
Just so you know why I do need HTML. This seesm stupid but our company is writing support software and the one critical "bug" or feature request all out beta testers was basic HTML so they can highlight important words by making them fat, italic, underlined etc.

A: Coding for HTML email I've always found to be a crap shoot.  Unlike browsers, few mail clients adhere to W3C standards for HTML markup. MailChimp's a pretty sweet service that will let you preview your HTML emails in 30 some odd email clients, including web-based ones.
They also have a guide freely available containing some valuable do's and don'ts.
In short, inline CSS is going to be your best bet (especially with web clients that will strip out certain CSS).  Tables are more reliable for styling in this case (though, being a standards warrior, I cringe to say it).
As for html and body tags - I send them in my emails.  You're guiding principal should be KISS (keep it simple, stupid!).

A: HTML for email is essentially the same as HTML for the web. The difference is that your email message is being treated like being in the untrusted restricted zone, which means you cannot use javascript or any other scripting technologies.
You can embed attachments in the mail (like images, style sheets, and so on) or reference them from an external source. Fact is that if you reference them from an external source, most email readers will not download them without the approval of the user. This means that often it is better to put CSS between style tags in the header and images like inline attachments.
When reading mail in ThunderBird or Outlook, obviously there are differences. One uses the rendering engine of FireFox, one uses IE's engine. This is the same as making pages for the web.
If you take those points into account, you should be able to make nice looking email messages without a problem.
Hope this helps.

A: Don't forget to include a text version. This helps people who don't want HTML e-mails.
And speaking of not wanting HTML e-mails: HTML is often used for spam, so it's possible that more e-mails get filtered than with text only versions.

A: You're looking for MIME-type encoding.  It's a standard for wrapping HTML (among other things) so mail programs can transport it.

A: Most of webclients (like gmail) won't grab external stylesheets at all, likely because it could impose a security risk.
We standardize on text-only emails for any critical email (for example email activation after registration). For marketing emails we mainly work with in-line styles, tables, and anything that was popular on the web in the 90's.
Email html has not made the same progression as web email, try to stick with absolute basics.

A: Writing HTML email that will work in all email clients is almost impossible. Expect to use many workarounds to support all of them. If you want to see which email clients support web standards the best then visit email standards.org. They have a list of email clients and the HTML and CSS support they offer.

A: I agree with Jeroen regarding styling your HTML email in the file itself rather than referencing an external .css file.  I have had problems in the past.


text:
Q: Rerender a part of a web-page I'm using JSP. I have a form needed to submit on the listUser.jsp page:
<form class="emp-delete">
    <label for="emp-id">Id:</label>
    <input type="text" id="emp-id" />
    <input type="submit" value="delete" />
    <c:out value="${message}" />
</form>

Form submition executes a business logic on the server and adds message parameter to the model as follows:
@RequestMappin(value="mapping")
public String deleteUser(Model m){
    String msg = null;
    // execute some logic
    m.addAttribute("message", msg);
    return "listUser";
}

The thing is such a method rerender the web-page entirely, but I need to just refresh value of the <c:out> tag. How can I do that?

A: You can submit your form with AJAX. E.g. using JQuery
$.ajax({
  type: "POST",
  url: url,
  data: data,
  success: success,
  dataType: dataType
});

and process the result updating necessary DOM element.
See e.g. here or here


text:
Q: Analysis Services database returns oddly formatted numbers on MDX queries I have a SQL Server 2008 Database server hosting two Analysis services databases. When from the same machine I run a MDX query in SSMS against both of these DBs (e.g. SELECT { [Gender].[M], [Gender].[W] } on 0, { [Area].[Town].[3101000], [Area].[Town].[3152007] } on 1 FROM [Population] WHERE ([Time].[Years].[2005], [Population]) the one query returns a table consisting of floating number values formatted like 123,23 while the other DB returns floating numbers formatted like 123.23
In Visual Studio, measures from both projects are defined as double values, in the source databases values are taken from NUMERIC columns.
I populated these two DBs from two different relational databases (both however share the same collation settings) and also the Visual studio solutions used to deploy the AS DBs were different (still for the second one I just took a copy of my first vs solution and basically only removed some unnecessary dimensions and cubes).
My question is: What are the suspects to look for that can cause the difference in the formatting of MDX results?

*

*I already checked the collation settings of the source DBs which seem to be identical

*I checked for language settings in the AS DB but did not find any suitable setting (did I maybe oversee something)

*I checked the FormatString properties in the cubes which were unset in both solutions

Any further ideas here?

A: Is there anything in the "Calculations" tab of the cube in VS/BIDS? You can override format strings for measures there.
Also, are you setting language in the connection string to SSAS? This is possible, and is used by clients to automatically format numbers in the locale of the user. Seems unlikely if you're  running this in in SSMS but I thought I'd ask.


text:
Q: Saving State After App Is Closed with Provider Package FLUTTER What's the best way to save an activity page state with Flutter provider package? Currently, using the provider package and doing a restart or closing the app the page gets rebuilt and all the new widgets are removed. The state is saved on hot reload not hot restart. For example, the post created by a user on the news feed page is removed when I close the app or restart it.

A: So following the comment and reading the flutter persistence cookbook, I see three common possibilites:

*

*Persist data with SQLite

*Read and write files

*Store key-value data on disk

Each has different usecases, but I think the common case is to store a few objects as JSON. SQLite seems to me in simple cases an overkill and key-values do not offer enough flexibility. So I will focus on reading and writing files.
Here comes an example. I use JSON code generation libraries as described here.
The data object I read and write to disk is looks the following way:
import 'package:json_annotation/json_annotation.dart';

// json methods generated using code geneartion
// see https://flutter.dev/docs/development/data-and-backend/json#serializing-json-using-code-generation-libraries
part 'easy_data.g.dart';

@JsonSerializable()
class EasyData {
    int counter;
    String data;

    EasyData(this.counter, this.data);

  // run the following command to generate json:
  // flutter pub run build_runner build
  factory EasyData.fromJson(Map<String, dynamic> json) => _$EasyDataFromJson(json);

  Map<String, dynamic> toJson() => _$EasyDataToJson(this);
}

The Service to load the json from disk and save looks the following way:
import 'dart:async';
import 'dart:convert';
import 'dart:io';

import 'package:flutter/material.dart';
import 'package:path_provider/path_provider.dart';

import '../model/easy_data.dart';

class FileStorage with ChangeNotifier {
  EasyData loadedData;

  Future<String> get _localPath async {
    final directory = await getApplicationDocumentsDirectory();
    return directory.path;
  }

  Future<File> get _localFile async {
    final path = await _localPath;
    return File('$path/app_data.json');
  }

  loadData() async {
    try {
      final file = await _localFile;
      // Read the file
      String contents = await file.readAsString();
      if (contents != null) {
        // parse json if file was saved before
        loadedData = EasyData.fromJson(json.decode(contents));
        notifyListeners();
      }
    } on FileSystemException catch (_) {
      // the file did not exist before
    } catch (e) {
      // error handling
      log(e);
    }
  }

  Future<File> writeData(EasyData data) async {
    final file = await _localFile;
    // Write the file
    return file.writeAsString(jsonEncode(data.toJson()));
  }
}

I used a provider for the service, because I want other services to be notified when the data is loaded from disk. The other Providers need to be declared with ChangeNotifierProxyProvider in main dart to use the information from the FileStorage Provider.
I hope it this was helpful.


text:
Q: How to set electron UserAgent I need to set the UserAgent in electron to include the touch flag since I am writing the application for touch screens and it doesn't seem to auto detect that it is running on a touch screen.
Any help would be nice, I already tried setting it in the BrowserWindow.loadURL options param.

A: Just use an option object when loading the URL.
function createWindow () {
   win = new BrowserWindow({width: 800, height: 600});
   win.loadURL('http://www.whoishostingthis.com/tools/user-agent/',
     {userAgent: 'Chrome'});

   win.on('closed', () => {
     win = null
   });
}

A: You can set the User-Agent header in the main process using onBeforeSendHeaders:
import { session } from 'electron';

session.defaultSession.webRequest.onBeforeSendHeaders((details, callback) => {
  details.requestHeaders['User-Agent'] = 'SuperDuperAgent';
  callback({ cancel: false, requestHeaders: details.requestHeaders });
});

A: Before loading file, you can call BrowserWindowInstance.webContents.setUserAgent()
mainWindow.webContents.setUserAgent(mainWindow.webContents.getUserAgent() + " Custom Value");
mainWindow.loadFile('renderer/index.html');

Works with electron 3.0.4 Previous solutions didn't work for me.

Electron 8.2.5 Update
In newer versions, setUserAgent method will be deprecated.
Instead, use this;
mainWindow.webContents.userAgent //to get
mainWindow.webContents.userAgent = "Something" //to set

A: Just use this if you're using a <webview> tag, this works better for me
<webview src="https://www.github.com/" useragent="Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; AS; rv:11.0) like Gecko"></webview>


text:
Q: using std::async with template functions How can I, or, can I, pass a template function to async?
Here is the code:
//main.cpp
#include <future>
#include <vector>
#include <iostream>
#include <numeric>

int
main
    ()
{
    std::vector<double> v(16,1);

    auto r0 =  std::async(std::launch::async,std::accumulate,v.begin(),v.end(),double(0.0));

    std::cout << r0.get() << std::endl;
    return 0;
}

Here are the error messages:
                                                                               ^
a.cpp:13:88: note: candidates are:
In file included from a.cpp:1:0:
/usr/include/c++/4.8/future:1523:5: note: template std::future::type> std::async(std::launch, _Fn&&, _Args&& ...)
     async(launch __policy, _Fn&& __fn, _Args&&... __args)
     ^
/usr/include/c++/4.8/future:1523:5: note:   template argument deduction/substitution failed:
a.cpp:13:88: note:   couldn't deduce template parameter '_Fn'
   auto r0 = std::async(std::launch::async,std::accumulate,v.begin(),v.end(),double(0.0));
                                                                                ^
In file included from a.cpp:1:0:
/usr/include/c++/4.8/future:1543:5: note: template std::future::type> std::async(_Fn&&, _Args&& ...)
     async(_Fn&& __fn, _Args&&... __args)
     ^
/usr/include/c++/4.8/future:1543:5: note:   template argument deduction/substitution failed:
/usr/include/c++/4.8/future: In substitution of 'template std::future::type> std::async(_Fn&&, _Args&& ...) [with _Fn = std::launch; _Args = {}]':
a.cpp:13:88:   required from here
/usr/include/c++/4.8/future:1543:5: error: no type named 'type' in 'class std::result_of'

A: You have to disambiguate between possible instantiations by either explicitly passing the template arguments or using static_cast, so:
auto r0 = std::async(std::launch::async
                     , &std::accumulate<decltype(v.begin()), double>
                     , v.begin()
                     , v.end()
                     , 0.0);

or:
auto r0 = std::async(std::launch::async
       , static_cast<double(*)(decltype(v.begin()), decltype(v.end()), double)>(&std::accumulate)
       , v.begin()
       , v.end()
       , 0.0);

A: The problem is that to pass the second argument to std::async the compiler has to turn the expression &std::accumulate into a function pointer, but it doesn't know which specialization of the function template you want. To a human it's obvious you want the one that can be called with the remaining arguments to async, but the compiler doesn't know that and has to evaluate each argument separately.
As PiotrS.'s answer says, you can tell the compiler which std::accumulate you want with an explicit template argument list or by using a cast, or alternatively you can just use a lambda expression instead:
std::async(std::launch::async,[&] { return std::accumulate(v.begin(), v.end(), 0.0); });

Inside the body of the lambda the compiler performs overload resolution for the call to std::accumulate and so it works out which std::accumulate to use.


text:
Q: oracle tablespace extending While under massive write (insert and create table as) load, when Oracle RAC needs to extend tablespace, all write activity gets blocked for however long it takes it to finish extending (tens of minutes), with all sessions blocked by "data file init write".  Is there way to configure Oracle to extend the file proactively so that things can keep moving while it is doing it?

A: 30min for 1TB is quite normal. That all writing stops is also normal if your tablespace completely run out of space. When writes has nowhere to go they have to wait for the RESIZE operation to complete. If one extends datafile while there is still space in it database I/O does not stop.
Just why you extended for such huge amount? Now those +1TB will add to your RMAN backup. Of course they will compress well but still not 100% and RMAN will need time to read all those blocks.
I would setup autoextend on those tablespaces:
ALTER DATABASE DATAFILE '+DG/sid/datafile/datafile_01.dbf' AUTOEXTEND ON NEXT 10G MAXSIZE 30G
Then you would not get wasted space in tablespace and also even in case your data grows fast and catches up with autoextend operation - there will be only small delay in writes because 10GB will not take a long time to format.
And Oracle will autoextend tablespace proactively. It will not wait for the last blocks to fill up.

A: We solved this at my previous company by scheduling a cron job for out of trading hours to grow the tablespace when it fell to within a couple of standard deviations of average daily growth free. I researched it extensively at the time, and there is no way to tune the threshold for when Oracle does it (and you probably wouldn't want to anyway, since you still couldn't guarantee it wouldn't hammer you at the wrong time). We could have used this mechanism exclusively and turned autoextend off completely, but we thought that pausing to autoextend during the day was at least better than running out of space altogether. It can be hard to make the judgement objectively tho' since Oracle doesn't log autoextending events anywhere (at least not as of 10g which we were on then).
Another job checked the max sizes of all the autoextending DBFs, and compared it to the space actually free on the disk, to make sure we weren't overcommitting.


text:
Q: Bubble Function sorting in C on an array of integers I have coded out a Bubble Function that is supposed to Bubble sort an array of user input integers, but for some reason, my array is only working with arrays with size 6... otherwise the array outputs a zero for the largest number. Please run this code and help me identify the problem.
        #include <stdio.h>
        //prototype
        void bubble(int array[], int size);

        int main(void)
        {
            int n,i,j,size,temp,counter = 0;
            //FOR SOME REASON, ONLY INPUT SIZE 6 WORKS PERFECTLY.
            int k;
            printf("How many numbers to sort?\n");
            scanf("%d",&size);
            int array[size];
            for(i=0;i<size;i++)
            {
                printf("Enter number %d\n",i+1);
                scanf("%d",&k);
                array[i] = k;
            }
            printf("Array before sorting:\n");

            for(i=0;i<size;i++)
            {
                printf("%d  ",array[i]);
            }

            bubble(array,size);

        return 0;
        }

        // use this if you want to test print an array
        // for(i=0;i<size;i++)
            // {
            //     printf("%d",array[i]);
            // }
        void bubble(int array[], int size)
        {
            int i, j, temp;
            for(j=0;j<size;j++)
            {
                printf("\nIteration# %d\n",j+1);
                for(i=0;i<size;i++)
                {
                    if(array[i] > array[i+1])
                    {
                        temp = array[i];
                        array[i] = array[i+1];
                        array[i+1] = temp;
                    }
                    printf("%4d",array[i]);

                }

            }
        }

        // void select(int array[], int size)
        // {
        //     int i, j, temp;
        //     min = array[0];
        //     for(j=0;j<size;j++)
        //     {
        //         if(array[j] < min)
        //         {
        //             array[j] = temp;
        //             min = array[j];

        //         }

        //     }

        // }

A: i<size in combination with i+1 will go past the bounds of the array.
You should replace this:
for(i=0;i<size;i++)

with this:
for(i=0;i<size-1;i++)

A: Your inner-loop top-end conditional break is size, but within the loop you reference array[i+1], which means you're referring to array[size]. Since C arrays are zero-base indexed, the only allowable indexing is from 0...(size-1). Your code breaches that by one item repeatedly.
Changing the top-end of the inner loop to size-1 will work in your case. but there is arguably a better alternative that alleviates you from remembering the minus-1 in the first place. It involves modifying size as you sort to control the top-end of your inner loop directly. It also eliminates one local variable that you no longer need).
    void bubble(int array[], int size)
    {
        while (size-- > 0)
        {
            for(int i=0; i<size; ++i)
            {
                if(array[i] > array[i+1])
                {
                    int temp = array[i];
                    array[i] = array[i+1];
                    array[i+1] = temp;
                }
            }
        }
    }

Often called a "goes-down-to" expression (because it looks like a long arrow pointing at a limiting value), the outer loop has been changed to become while (size-- > 0). This takes the current value of size to a temporary, decrements size, and compares the temporary against > 0 (more or less). The result is size now reflects the top limit of your inner loop that you want. Each enumeration of the outer loop will shrink the next inner loop pass by one. The point of bubble sort is that, once an element has been "bubbled up" to its proper position, you need not visit that element ever again, something your code is not taking advantage of.

Bonus Optimization
Finally, you can optimize this further and give your bubblesort the one and only redeeming quality the algorithm can offer: O(n) in best case where the sequence is already sorted. You do this by doing "swap-detection". If you ever pass over the inner loop without making a single swap, it makes no sense to perform anymore sorting. The sequence is sorted and you're done. It's a near-freebie addition to the original algorithm above, and looks like this:
void bubble(int array[], int size)
{
    int swapped = 1;
    while (swapped && size-- > 0)
    {
        swapped = 0;
        for(int i=0; i<size; ++i)
        {
            if(array[i] > array[i+1])
            {
                int temp = array[i];
                array[i] = array[i+1];
                array[i+1] = temp;
                swapped = 1;
            }
        }
    }
}

Given an already sorted sequence of a ten, a hundred, or a hundred-thousand elements, this will finish after only one pass. Worth noting: even one element out of position on one extreme end will make this optimization irrelevant. I.e. if any element that belongs near the beginning is originally near the end, it will take up to size iterations to bring it home, and with that the optimization becomes moot. In short, this sequence
1 3 4 5... 9998 9999 2

will completely foil the optimization above. There are techniques to combat this as well including a two pass inner loop enumeration, where you ascend to bubble up larger values, then reverse direction to descend, bubbling down smaller values. but at this point you're better off using a finer algorithm like quicksort or heapsort. The discussion of that, and indeed the latter half of this post, is beyond the scope of your question.


text:
Q: Metrics on $\mathbb{N}$ such that $(\mathbb{N}, d)$ and $(\mathbb{N}, d')$ are not homeomorphic I want to find two metrics $d$ and $d'$ on $\mathbb{N}$ such that $(\mathbb{N}, d)$ and $(\mathbb{N}, d')$ are not homeomorphic, but I'm having trouble doing so. I've tried using the discrete metric as this often has very different properties to the usual metric, and can be used to show it for $\mathbb{R}$ but I can't seem to get it to work for $\mathbb{N}$. I've also tried considering topological properties such as compactness, connectedness, etc, but again the two metrics always seem to have the same properties, and also considered sequences.
Any hints would be greatly appreciated!

A: Let  $A$  be a countable subset of any metric space you like. Transfer the metric to $\mathbb{N}$ with a bijection that establishes the countability.

A: A concrete example of Ethan's idea:
$d_1(n,m)=1$ for $n \neq m$ (the discrete metric), which has the property that any convergent sequence is eventually constant.
$d_2(0,n)=\frac{1}{n}$ for $n \neq 0$ and $d_2(n,m)= |\frac{1}{n}-\frac{1}{m}|$ for $n,m$ non-zero and distinct. Then $x_n = n$ converges to $0$, and such a non-trivial sequence does not exist under $d_1$, so the topologies are different (also $(\mathbb{N}, d_2)$ is compact, while $(\mathbb{N}, d_1)$ is not).


text:
Q: Decrypt a String encoded using AES 256 Totally security noob here.
I have to decrypt a String I receive, encoded in Base64. All I have is the String I need to decrypt, and a String, which the service that sents me the String to decode calls it a seed.
Based on what I have read here and in other places, I have this:
public String decrypt(String message) throws Exception
{
    String salt = "PRUEBA";
    Cipher c = Cipher.getInstance("AES");
    SecretKeySpec key = new SecretKeySpec(salt.getBytes(), "AES");
    c.init(Cipher.DECRYPT_MODE, key);
    byte[] decordedValue = Base64.decode(message.getBytes(), Base64.DEFAULT);
    byte[] decValue = c.doFinal(decordedValue);
    String decryptedValue = new String(decValue);
    String decoded=new String(Base64.decode(decryptedValue,Base64.DEFAULT));
    return decoded;
}

This returns java.security.InvalidKeyException: Key length not 128/192/256 bits.
I tried also this library, but it returns IllegalBlockSizeException: last block incomplete in decryption
Don't know if I need something else from the server side, as I said I have little to no knowledge of encryption.
I am completely lost at this issue. Can you help me?
Thank you.

A: There are multiple issues with your code and you are missing some critical information (you may ask from the system sending data)
You are missing Cipher, IV (optionally) and key

Cipher c = Cipher.getInstance("AES");

Using only AES cipher with no IV parameter means you are using AES/ECB/PKCS5Padding cipher. Are you sure you suppose to use this cipher? Shouldn't it be AES/CBC/PKCS5Padding ? Ask the system doing the encryption what the encryption should be (including mode and padding). Knowing it's AES may not be sufficient.
If the mode used needs IV (initialization vector), you need to know its value. Usually IV is 128 bits (16 bytes) prepended to the ciphertext, but  you need to know that for sure.

String salt = "PRUEBA";
  SecretKeySpec key = new SecretKeySpec(salt.getBytes(), "AES");

And - you need a key (without the key you won't decrypt).
As already commented, the key needs to be 128, 192 or 256 bits long (=16, 24 or 32 bytes). If it is to be generated from another string, you need to know how.

String decryptedValue = new String(decValue);
  String decoded=new String(Base64.decode(decryptedValue,Base64.DEFAULT));

Are you sure that the decrypted value is base64 encoding of another String?
Just to get some examples for Java crypto, you may have a loot at my blog too.


text:
Q: CoreData NSFetchedResultsController Sorting I have a small problem with sorting my NSFetchedResultsController.
My NSManagedObject has two attributes. date and startTime.
The date is of time 00:00:00 on all my objects, this way when using date as the sectionNameKeyPath it grabs all the objects with identical dates (by day) into one section. If the time of the dates were different, it would put every object into a different section.
This works well, but then inside each group I want to sort the objects by startTime. So they are list from earliest on that date to the latest in each section respectively.
My issue is when using date as the sectionNameKeyPath and startTime as an NSSortDescriptor` it doesn't like it and plays weirdly. Such as only sometimes showing certain data in what seems like an irregular way.
I think it comes down to having to have the sort descriptor and sectionNameKeyPath the same. Am I right in thinking this? If not, how should I setup my NSFetchedResultsController to list my data in the fashion mentioned?
Thanks.
EDIT: Here is come code... Also worth noting when using startTime as my second sort descriptor, it causes duplicates to display in my tableview with nil objects.
NSFetchedResultsController:
NSSortDescriptor *sortDescriptor1 = [[NSSortDescriptor alloc] initWithKey:@"date" ascending:YES];
    NSSortDescriptor *sortDescriptor2 = [[NSSortDescriptor alloc] initWithKey:@"startTime" ascending:YES];
    NSArray *sortDescriptors = @[sortDescriptor1, sortDescriptor2];

    [fetchRequest setSortDescriptors:sortDescriptors];

    // Edit the section name key path and cache name if appropriate.
    // nil for section name key path means "no sections".
    NSFetchedResultsController *aFetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest managedObjectContext:self.managedObjectContext sectionNameKeyPath:@"date" cacheName:@"Master"];

cellForRowAtIndexPath just a snippet showing how I designate each managed object:
id <NSFetchedResultsSectionInfo> sectionInfo = [self.flightFetchedResultsController.sections objectAtIndex:indexPath.section];
    NSArray *sectionFlights = [sectionInfo objects];
    Flight *flight = [sectionFlights objectAtIndex:indexPath.row];

-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return self.flightFetchedResultsController.sections.count;
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    id <NSFetchedResultsSectionInfo> sectionInfo = [[self.flightFetchedResultsController sections] objectAtIndex:section];
    return [sectionInfo numberOfObjects];
}

A: Your section key name path needs to match the first sort descriptor.
So you could do...
// sectionKeyNamePath = @"date".

NSSortDescriptor *dateSD = [NSSortDescriptor sortDescriptorWithKey:@"date" ascending:YES];
NSSortDescriptor *startTimeSD = [NSSortDescriptor sortDescriptorWithKey:@"startTime" ascending:YES];

frc.request.sortDescriptors = @[dateSD, startTimeSD];

If you do this then it will sort (and section) by date and then sort each section by startTime.
From your code
You are getting the fetched objects incorrectly.
To get an object you need to use...
Flight *flight = [self.frc objectAtIndexPath:indexPath];

A fetched results controller knows about its sections and rows. You don't need to split it apart.


text:
Q: Embed XAML file's contents in another XAML file I figured that this is pretty basic, but I need to take elements from elements.xaml and put it in Template.xaml as a child of the main grid "MainGrid". This can be done with either c# or XAML, it doesn't really matter.
Here is elements.xaml:
<TextBox Text='' FontSize='25' Grid.Column='0' Grid.Row='1'/>
<TextBox Text='' FontSize='25' Grid.Column='1' Grid.Row='1'/>
<TextBox Text='' FontSize='25' Grid.Column='2' Grid.Row='1'/>
<TextBox Text='' FontSize='25' Grid.Column='3' Grid.Row='1'/>

Here is Template.xaml:
<Grid x:Name="MainGrid" Margin="20" Background="{ThemeResource SystemControlAltMediumLowAcrylicElementMediumBrush}">
    <Grid.RowDefinitions>
        //Defs go here
    </Grid.RowDefinitions>
    <Grid.ColumnDefinitions>
        //Defs go here
    </Grid.ColumnDefinitions>
    <TextBlock x:Name="Head00" TextWrapping="Wrap" Text="Scene" FontSize="50" Grid.Column="0" Grid.Row="0"/>
    <TextBlock x:Name="Head10" Text="Characters" FontSize="50" Grid.Column="1" Grid.Row="0"/>
    <TextBlock x:Name="Head20" Text="Page" FontSize="50" Grid.Column="2" Grid.Row="0"/>
    <TextBlock x:Name="Head30" Text="Mic Assignment Number" FontSize="50" Grid.Column="3" Grid.Row="0"/>
</Grid>

I want the embedded XAML to go under the Textblocks. Can you guys help?
EDIT: elements.xaml is in the applicationdata folder, at C:\Users\USERNAME\AppData\Local\Packages\PACKAGENAME\LocalState
Thanks,
Rajan

A: Try using XamlReader, it can load XAML string content, and convert the string to the corresponding XAML element.
Here is a simple example:
        string defaultNamespace = "http://schemas.microsoft.com/winfx/2006/xaml/presentation";
        string xaml = "<TextBlock xmlns=\"" + defaultNamespace + "\">Hello, world!</TextBlock>";
        // xaml content will be:
        // <TextBlock xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">Hello, world!</TextBlock>
        var textBlock = XamlReader.Load(xaml) as TextBlock;
        this.rootGrid.Children.Add(textBlock);

This example will bring a TextBlock to UI.
For more info about XamlReader, you can visit XamlReader Class.


text:
Q: margin-top in a nested div I have a problem with the margin-top in a nested div -- when I apply margin-top to the nested div, the margin is applied to the parent div instead of the nested div.

Any ideas?

A: The reason overflow:auto changes the parent div to allow the nested margin-top is that it creates a new formatting context. Any div that's positioned absolute, fixed, floated or with overflow other than visible creates a new formatting context. The parent div then becomes the root of this new formatting context, and collapsing margins don't apply to root elements.
More in depth:
Formatting contexts can be either inline or block, and only the block formatting contexts collapse their margins. These formatting contexts form the flow of the document.
A block formatting context is simply all the block level elements (e.g. divs, p, table) laid out one after another vertically within a containing block until the end of the document/container or until a new formatting context is established.
In the case of nesting, the margin-top of the child collapses with the margin-top of the parent since both divs are part of a block formatting context. By setting overflow to auto, the parent div becomes the container of the new formatting context, and the child the first block element within it. Thus the two margins are no longer "adjoining" since the parent div is now the root.
Hope that helps.
Box model:
http://www.w3.org/TR/CSS2/box.html#collapsing-margins
Visual formatting model:
http://www.w3.org/TR/CSS2/visuren.html#normal-flow

A: I get the solution with overflow:auto in the parent div.

A: "Collapsing margins" is your problem. Here you could understand what is and why it's still alive: http://www.sitepoint.com/web-foundations/collapsing-margins/
I read across the web to look for a decent solution, and finally I found this article: http://www.seifi.org/css/understanding-taming-collapsing-margins-in-css.html
In short you have a bunch of methods to resolve your problem:
1) border in parent div (could be transparent)
2) padding in parent div
3) overflow: auto
4) float: left
You should follow the link because it explains in detail all the solutions.

A: Margins will collapse by design. Add 1px of padding as well and it should work fine.

A: This is how margins work.. the margin is the space between the next element with a margin / padding / similar. It is not necessarily defined as its parent element. Consult the spec.
Here are some things you can do as a workaround
Use Padding Instead
This just means instead of using margin-top: 10px; you use padding-top: 10px;. This is not suitable for every occasion.
Weird Hack I Discovered
I doubt I discovered this initially, but the other day I solved the problem like this. I had a <div id="header" /> that I wanted to give a top margin too, and its top margin was pushing the parent (body element) down as well. So I did this on the body element...
body {
    padding-top: 1px;
    margin-top: -1px;
}

This made my margin work. You can also try using a border, like border: 1px solid #ccc.
It would also be wise to leave a note in the CSS comments to explain why you have that peculiar pair of rules. I just added /* this is to stop collapsing margins */.
Further Reading
Check out these other questions on Stack Overflow

A: You Can also use position property for inner div to fix this. like:
position:fixed;


text:
Q: How do I use parameter expansion in find? I can use the for command to change .dat files to .txt files like this
for f in *.dat
do
  mv $f ${f/.dat/.txt}
done

where ${f/.dat/.txt} modifies the .dat in each filename to .txt.  But how can I do this with find?  An attempt to use {} as a variable fails.
find . -type f -exec echo ${} \;
-bash: ${}: bad substitution

I can get further by assigning {} to a parameter like this
find . -type f -name '*.dat'  -exec echo `f={}; echo $f` \;

but an attempt at substitution fails
find . -type f -name '*.dat'  -exec echo `f={}; echo $(echo ${f/.dat/.txt})` \;

prints
./file1.dat
./file2.dat

not
./file1.txt
./file2.txt

Does anyone know how to make find behave the way I want it?

A: You can use awk to modify filename and generate cmds that you pass to bash, i.e.
cat fixer.awk
#!/bin/awk -f
{
        outFile=$0
        sub(/\.txt/, ".dat", outFile) ; print "mv "$0 " " outFile
}

chmod 755 fixer.awk

find . -type f -name '*.dat' | /path/to/fixer.awk

output
mv 34274841/file1.txt 34274841/file1.dat
mv 34274841/file2.txt 34274841/file2.dat

When you're happy with that output, and certain there are no unforeseen consequences ;-) , then execute
 find . -type f -name '*.dat' | /path/to/fixer.awk | bash

IHTH

A: This post from @celada about systemd points to the solution.  The -exec in find does not invoke a shell, so although some parameter manipulation is supported, parameter expansion like $f{/.dat/.txt} isn't.
So the trick is to exec a shell and then escape the dollar signs like this
find . -type f -name '*.dat'  -exec sh -c "f={}; mv \$f \${f/dat/txt}" \;

A: You could just skip the exec parameter and echo the output to sed instead:
find . -type f -name '*.dat' | sed 's/.dat/.txt/'


text:
Q: Converting Decimal to Fixed Point Number I am having trouble to get the intuition behind the following approach:
We take the fraction point (say: .642) and continuously multiply by 2,
taking whatever ends up right of the point as our next number (either 0 or 1) after the fixed point in the binary number. Then we take whatever is left after the decimal point and repeat.

A: I believe there is a typo in your post; we take the integer 0 or 1 to the left of the decimal point.
The base-10 decimal $.a_1a_2a_3 ... a_n + ...$ of course represents
$a_1 * 10^{-1} + a_2 * 10^{-2} + ... + a_n * 10^-n + ...$
where all the $a_i$ are digits 0 to 9.
We want to change this to the base-2 representation
 $.c_1c_2c_3 ... c_n + ...$ representing
$c_1 * 2^{-1} + c_2 * 2^{-2} + ... + c_n * 2^-n + ...$
where all the $c_i$ are binary digits 0 or 1.
If we multiply (in base 10) $ 2 * (c_1 * 2^{-1} + c_2 * 2^{-2} + ... + c_n * 2^-n + ...) $
we obtain $ c_1 + c_2 * 2^{-1} + c_3 * 2^{-2} + ... + c_{n+1} * 2^{-n} + ...$
Thus the integer $c_1$ is separated from the rest of the fractional representation. If we then remove this $c_1$ from the decimal, another multiplication by 2 will separate the integer $c_2$, and so on, repeating either to the end or to the accuracy desired.
We note that the integers 0 and 1 (only) are the same in binary and decimal.
So we take the example $x$ = .642 base 10
Multiply by 2, and we get 2 * .642 = 1.284
It is to be noted that when we "carry" a digit in base 10 multiplication, 2 times a digit from 1 to 9, the highest result is 18 so the "carry" to the units place will always be 0 or 1, as required for our binary $c_i$.
Back to the example, we take the 1 or 0 to the left of the decimal so the binary representation starts .1 and the remaining decimal is .284
Repeating
2 * .284 = .568
Zero in units
Binary representation .10...
2 * .568 = 1.136
1 in units
Binary representation is .101...
2 * .136 = .272
0 in units
Binary representation is .1010...
2 * .272 = .544
0 in units
Binary representation is .10100...
2 * .544 = 1.088
1 in units
Binary representation is .101001...
This binary decimal is non-terminating but the calculation can be taken to any degree of accuracy required, or we can find the repeating pattern.
Check: The binary representation .101001... represents in decimal form
$ 1 * 2^{-1} + 0 + 1 * 2^{-3} + 0 + 0 + 1 * 2^{-6}$ + further smaller terms
= 1/2 + 1/8 + 1/64 + further smaller terms
= .5 + .125 + .015625 + further smaller terms
= .640625 + other smaller terms
We see we are approaching .642 base 10 as required.


text:
Q: Play 2.x @ sign in route definitions I'm learning the Play! framework (2.3.x). I am confused about the meaning of the '@' character in front of the controller in route definitions like this:
POST   /myresource/:id/custom   @controllers.MyResource.custom(id: Long)

As much as I can infer from the context I've seen this in, it probably has to do with the exact controller implementation (object vs class). Or am I completely wrong in this? I can't find anything in the docs and the code I've seen isn't exactly explanatory. Can anyone explain?

A: According to the documentation:

Play supports generating two types of routers, one is a dependency
  injected router, the other is a static router. The default is the
  static router, but if you created a new Play application using the
  Play seed Activator templates, your project will include the following
  configuration in build.sbt telling it to use the injected router:
routesGenerator := InjectedRoutesGenerator

The code samples in Play's documentation assumes that you are using
  the injected routes generator. If you are not using this, you can
  trivially adapt the code samples for the static routes generator,
  either by prefixing the controller invocation part of the route with
  an @ symbol, or by declaring each of your controllers as an object
  rather than a class.

The equivalent in Java would be static vs non-static.


text: Q: Can't access data on a hard drive The screenshot in the link below really says it all.  I have an old laptop hard drive that I've been using with a USB enclosure as a specific backup for certain files that I want to keep. As the screenshot shows, Windows Explorer says the drive is empty, but under Properties it shows 32.5 GB used... those are my files.  I've tried data recovery software (Recuva and EaseUS Data Recovery), and was only able to recover the contents of one subfolder, roughly 18GB.  I really need to get to the rest of my files.  Any ideas?


text:
Q: roman numbers are not correctly cross-referenced, conflict between hyperref and other packages? This problem only occurs in my whole PhD thesis, and not in a MWE (shown here). Would the problem be the other packages I use besides the hyperref package?
MWE code (works well, see attached image):
\documentclass[12pt,twoside]{report}

\usepackage[left=2.0cm,right=2.0cm,top=2.25cm,bottom=2.25cm,bindingoffset=6mm]{geometry}    % document format geometry
\usepackage{setspace}                                                                       % set line spacing
\usepackage[T1]{fontenc}                                                                    % font encoding
\usepackage[utf8]{inputenc}                                                                 % characters
\usepackage[hidelinks=true]{hyperref}                                                       % hyperlink for cross-references (images, references, lof, toc, etc)

\begin{document}

    \pagenumbering{roman}

    \chapter*{A}
    \addcontentsline{toc}{chapter}{A}

    \chapter*{B}
    \addcontentsline{toc}{chapter}{B}

    \chapter*{C}
    \addcontentsline{toc}{chapter}{C}

    \chapter*{D}
    \addcontentsline{toc}{chapter}{D}

    \newpage
    \addcontentsline{toc}{chapter}{Table of Contents}
    \begin{onehalfspace}
        \tableofcontents
    \end{onehalfspace}

    \clearpage
    \pagenumbering{arabic}

    \chapter*{Introduction}
    \addcontentsline{toc}{chapter}{Introduction}

\end{document}

Preamble of thesis (doesn't work correctly, see attached image):
\documentclass[12pt,twoside]{report}

% Packages
\usepackage[left=2.0cm,right=2.0cm,top=2.25cm,bottom=2.25cm,bindingoffset=6mm]{geometry}    % document format geometry
\usepackage{setspace}                                                                       % set line spacing
\usepackage[T1]{fontenc}                                                                    % font encoding
\usepackage[utf8]{inputenc}                                                                 % characters
\usepackage[bitstream-charter]{mathdesign}                                                  % Elsevier journal pseudo-font type
\usepackage{textcomp}                                                                       % font and symbols
\usepackage{textgreek}                                                                      % greek letters in text
\usepackage{fixltx2e}                                                                       % use subscript
\usepackage[font=small]{caption}                                                            % figure font size
\usepackage[hypcap]{caption}                                                                % link to top of image/table
\usepackage[hidelinks=true]{hyperref}                                                       % hyperlink for cross-references (images, references, lof, toc, etc)
\usepackage[md]{titlesec}                                                                   % remove bold of titles
\usepackage{graphicx}                                                                       % include graphics
\usepackage{subfigure}                                                                      % subfigures
\usepackage{epstopdf}                                                                       % incluir EPS
\usepackage[subfigure]{tocloft}                                                             % dots in ToC, font type, subfigure to avoid conflicts, etc
\usepackage[Lenny]{fncychap}                                                                % change font type of titles in chapters, etc
\usepackage{pdfpages}                                                                       % include pdf
\usepackage[square,authoryear]{natbib}                                                      % references
\usepackage{etoolbox}                                                                       % italics for citation
\makeatletter                                                                               % italics for citation
\patchcmd{\NAT@test}{\else\NAT@nm}{\else\NAT@nmfmt{\NAT@nm}}{}{}                            % italics for citation
\let\NAT@up\itshape                                                                         % italics for citation
\makeatother                                                                                % italics for citation
\usepackage{multirow}                                                                       % multirow in table
\usepackage{multicol}                                                                       % multicolumns in lists (eg. abbreviations)
\usepackage{wallpaper}                                                                      % background image for front/back cover
\addtolength{\wpXoffset}{-11.0cm}
% offset in x for wallpaper only for \ThisCenterWallPaper
\setlength\cftbeforefigskip{15pt}                                                           % line spacing between figures in LoF
\renewcommand\cfttoctitlefont{\huge}                                                        % remove bold from ToC title
\renewcommand\cftloftitlefont{\huge}                                                        % remove bold from LoF title
\renewcommand{\cftchapfont}{\mdseries}                                                      % remove bold in ToC contents
\renewcommand\contentsname{Table of Contents}                                               % replace 'Contents' by 'Table of Contents'
\renewcommand{\cftchapleader}{\cftdotfill{\cftdotsep}}                                      % add dots
\renewcommand{\cftchappresnum}{Chapter }                                                    % prefix 'Chapter' to chapter number in 'Table of Contents'
\cftsetindents{chapter}{0em}{6em}                                                           % indentation of chapters
\addtocontents{toc}{~\hfill\textmd{Page}\par}                                               % add 'Page' to ToC
\AtBeginDocument{\renewcommand{\bibname}{References}}                                       % replace 'Bibliography' with 'References'
\renewcommand\thesection{\arabic{section}}                                                  % change the 0.1 to 1 in sections

Any pointers are very welcomed,


text:
Q: how does $: in Svelte works was reading a svelte tutorial, it's mentioned that $: this is regular in JavaScript, but don't understand it.
let count = 0;
$: doubled = count * 2;

how would you do this in vanilla JavaScript. checking for code that has been change

A: I assume you mean these docs - https://svelte.dev/docs#component-format-script-3-$-marks-a-statement-as-reactive
In this case I think they are talking about programming language syntax feature called "label". In case of JS you may read about it here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/label
It is needed to look at Svelte source code attentively, but I guess they use this valid JS syntax pattern $: to mark top-level statements and allow them later to be parses and pre-processed.
So it's not a black JS magic, but a convention only in Svelte "world".
Update:
I think it used somewhere here in source code - https://github.com/sveltejs/svelte/blob/0d017f482016caa51d34918f79dc0b83f0428fd7/src/compiler/compile/Component.ts#L651
If you want to follow the logic, look at the usage of "LabeledStatement".

A: The $: is special Svelte syntax and doesn't "work" in vanilla javascript.
The syntax is compatible with vanilla javascript (it's a labeled statement), therefor tooling like javascript parsers and highlighters don't break.
But vanilla javascript doesn't have any reactivity built-in, so it behaves very different.
(It ignores the $:)
Listening for changes in primitive variables can't be done in vanilla.
Lots of workarounds are available.

A:
how would you do this in vanilla JavaScript. checking for code that has been change

There are various approaches to this. E.g. dirty checking by comparing previous values with current values and thus determining changes. This approach has some downsides. Among others, data might be duplicated and performance can degrade for larger amounts of data because of all the necessary comparisons.
Another method would be to make dependencies explicit and only update when one of the dependencies changes. Svelte generates the code necessary for that automatically but it can be done manually as well. If you look at generated code you will find that variables get marked as invalidated which triggers updates to the dependent variables.
E.g. in a click handler that increments a count variable you get:
const click_handler = () => $$invalidate(0, count++, count);

For the reactive statement, the code is only run if the count has been changed:
$$self.$$.update = () => {
    if ($$self.$$.dirty & /*count*/ 1) {
        $: doubled = count * 2;
    }
};

This code is optimized for performance, though. It uses array indexes for faster data access and more lean code. For code intended to be written and read by humans, you might want to not do that. Generally, I would not recommend doing this manually either way; it is more verbose and you have to make sure to always specify dependencies correctly for it to work.


text:
Q: jquery tear paper advertising I want tear paper script like as MGM Grand Hotel Website at the corner advertising, but no need flash animation. I want in jquery or any ideas.
How to call that effect?

A: Plenty of choices - http://www.jquery4u.com/plugins/10-jquery-page-peel-plugins/
Not really a good question for stackoverflow. A quick google would have yielded these possibilities for you.


text:
Q: Dynamically create apparmor hats/profiles We run an application inside apparmor which executes users code, when we execute user code I would like to dynamically generate a profile which limits their write access to a directory based on their user id.
Does apparmor support this well? The only way I can think of doing this is by creating a temp profile with the appropriate entry restricting their permissions and restarting the apparmor daemon. Is there a better way to do this? It seems like overkill.


text:
Q: $\mathbb R^3$ and 3D functions in general I have a question pertaining to the nature of graphs in 3 dimensions.
Consider Fermat's Last Theorem:
$$x^n + y^n = z^n$$
When $n$ is varied and the solution is graphed, the function is in $\mathbb R^3$ (real coordinate space, 3 dimensions) rather than $\mathbb R^2$, since it has a $z$ variable. For some reason, I have trouble wrapping my head around why, precisely, the introduction of a third variable increases the number of dimensions in a solution. Fundamentally, I mean. It's a factor in vector algebra, for example, and I know how to visualize it and do maths with it in that zone, but that's because I'm accepting the fact that it is in $\mathbb R^3$ space because it's modelling our physical world and we're considering functions with unit vectors $i$, $j$, and $k$ which all project perpendicularly to eachother. Oddly enough, that works for me, but not necessarily $x$, $y$, and $z$ instead.
Essentially, am I right in assuming adding a new variable to a function creates $\mathbb R^{n+1}$ (another "dimension", per se)? Like, if I were to take $x + y = b$ where b is some constant, this is in $\mathbb R^2$. However, if I add $z$ to it, so it's say, $x + y + z = c$ where $c$ is also a constant, is this not now in $\mathbb R^3$? If so, why?

A: If you have an equation in $n$ real variables $x_1,\ldots,x_n$, then solutions can be viewed ordered sequences of $n$ real numbers $r_1,\ldots,r_n$, so they are vectors $(r_1,\dots,r_n)\in\Bbb{R}^n$. So adding a new variable adds another dimension to the space in which solutions live.


text:
Q: importing module and create an instance of it I'm currently at the beginning of learning python. I've made a game, using classes. But now I need to put these classes in another file, and importing them from within the main file. Right now I have:
a_map = Map("scene_1")
game = Engine(a_map)
game.play()

I can't seem to make an instance like this using modules. I tried:
a_map = __import__('map')
game = Engine(a_map)
game.play()

But that gives me the error
AttributeError: 'module' object has no attribute 'first_scene'

What is going wrong here? These are the Engine / Map classes:
class Engine(object):

def __init__(self, map):
    self.map = map

def play(self):
    current_scene = self.map.first_scene()
    while True:
        next = current_scene.enter() #call return value of the current scene to 'next'
        current_scene = self.map.next_scene(next) #defines the subsequent scene

and
class Map(object):

scenes = {"scene_1" : Scene1(),
          "scene_2" : Scene2(),
          "scene_3" : Scene3()
         }

def __init__(self, start_scene):
    self.start_scene = start_scene

#defines the first scene, using the 'scenes' array.
def first_scene(self):
    return Map.scenes.get(self.start_scene)

#defines the second scene, using the 'scenes' array.
def next_scene(self, next_scene):
    return Map.scenes.get(next_scene)

I'm new to programming/this website. If I gave too less/too much script information, please let me know. Thanks in advance!

A: It appears that you are setting the map member of your Engine to the map module, not an instance of a Map object. If your Map and Engine classes are defined in map.py, then you can create your instances from the main file like this:
from map import Map, Engine
a_map = Map("scene_1")
game = Engine(a_map)
game.play()

A: At the beginning of each module you should list the functions/classes/modules you want to import.
If the files containing your classes are in the same directory as your main file, great, you can just do this (assuming the files containing your classes are called foo.py and bar.py):
from foo import Map
from bar import Engine

and then later on in your main file
a_map_instance = Map('scene_1')
an_engine_instance = Engine(a_map_instance)
an_engine_instance.play()

If you've got the files stored elsewhere, then you'll need to add that location to your python path.  See the documentation here for how to identify the locations which are in your sys.path()
http://docs.python.org/2/tutorial/modules.html#the-module-search-path.

A: Assuming your Map class is in map.py, and your Engine class is in engine.py, you just need to import them into your file.  You also need to reference the module when using something defined within it.  For example:
import map
import engine

a_map = map.Map('scene_1')
game = engine.Engine(a_map)
game.play()

You can also import specific items from modules, from map import Map would allow you to do a_map = Map('scene_1)


text:
Q: UIDocumentPickerViewController in SwiftUI on mac (macCatalyst) So I've been meddling with "moving" a small SwiftUI iPad app to the Mac, and I've hit a bit of a speed bump with UIDocumentPickerViewController.
I have wrapped the UIDocumentPickerViewController in a UIViewControllerRepresentable like so :
struct DocumentPickerView: UIViewControllerRepresentable {
  func makeUIViewController(context: Context) -> UIDocumentPickerViewController {
    let documentPicker = UIDocumentPickerViewController(documentTypes: [(kUTTypeImage as String)], in: .import)
    return documentPicker
  }

  func updateUIViewController(_ uiViewController: UIDocumentPickerViewController, context: Context) {

  }
}

And displaying it like this:
struct ContentView: View {
@State var shows = false
var body: some View {
    Button(action: { self.shows.toggle() }) {
        Text("Select File")
    }
    .sheet(isPresented: self.$shows) {
        DocumentPickerView()
    }
  }
}

On the iPad all is working well,

But when on on the Mac, the UIDocumentPickerViewControllerdoesnt show and we get this blank modal:

A: I replaced deprecated method and enabled asked entitlement for provided topic starter code and it works.
Tested with Xcode 13.3 / macOS 12.2
import UniformTypeIdentifiers
struct DocumentPickerView: UIViewControllerRepresentable {
  func makeUIViewController(context: Context) -> UIDocumentPickerViewController {
    let documentPicker = UIDocumentPickerViewController(forOpeningContentTypes: [UTType.image], asCopy: true)
    return documentPicker
  }

  func updateUIViewController(_ uiViewController: UIDocumentPickerViewController, context: Context) {

  }
}

and demo opening standard macOS picker

A: For some reason (I'm not aware of further specific details), the following worked for me (for Catalyst):
Instead of using in: .import
let documentPicker = UIDocumentPickerViewController(
    documentTypes: [(kUTTypeImage as String)],
    in: .import
)

Use in: .open
let documentPicker = UIDocumentPickerViewController(
    documentTypes: [(kUTTypeImage as String)],
    in: .open
)

I haven't checked if the functionality is maintained in iOS, but perhaps you can use some sort of "flag" to  determine wether to use .import or .open


text:
Q: overriding Content-Type cause Internal Server Error I am doing an iOS app and I require to set Content-Type headers by my own.
Whenever I override the HTTP header the web server returns 500 - Internal server error.
So I tried with a PHP code to check whether this is iOS or server side error.
    $target_url = 'http://myserver.com';
    $file_name_with_full_path = realpath('8.jpeg');
    $post = array('extra_info' => '123456','file_contents'=>'@'.$file_name_with_full_path);
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL,$target_url);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: multipart/form-data; boundary=--xxx"));
    curl_setopt($ch, CURLOPT_POST,1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
    $result=curl_exec ($ch);
    curl_close ($ch);
    echo $result;

The above code response with Internal Server Error.
but whenever I remove bellow line, it works fine.
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: multipart/form-data; boundary=--xxx"));

At last I tried to re-generate the issue with Chrome Postman plugin. I got the same result. If I set Content-Type as multipart/form-data I ended up having the same issue.
Is there anything to do with apache or php configurations to accept overriding headers?
Appreciate any clue on fixing this issue.

A: Whenever you use a parameter as param => @/test/file.txt it uses the multipart file upload by default. So when you alter this, you get error.
You can only alter the Header(without any error) only if you remove the file uploading parameter.


text:
Q: How display following text using Text I want display following text in Text widget, the code below display text in their specific area. I want have something like this : word, word, word ...
Thx for helping me
import datetime

from tkinter import *

import time

root = Tk()

ll = ['sa','fg']

for x in ll :

    tt = Text(root,wrap=WORD)
    tt.insert(INSERT,x)

    tt.pack()

root.mainloop()

A: Instead of inserting each word inside a for-loop, you can first create a string and insert the whole string. By the way, tt.pack() should be moved outside the loop in any case.
import datetime
from tkinter import *
import time

root = Tk()

ll = ['sa','fg']

tt = Text(root,wrap=WORD)
tt.insert(INSERT, ', '.join(ll))
tt.pack()

root.mainloop()


text:
Q: How do I vertically center two columns relative to each other? I've got two bootstrap columns, one containing text and the other containing an image.
Firstly, I want to vertically center both columns in the row.
Secondly, If the image height is less than the text height or vice-versa, I want the one with the smaller height to be vertically in the middle of its column.

#welcome-section {
  padding: 80px 60px;
}

#welcome-section .column {
  height: 100%;
}

#welcome-section .column .welcome-content,
#welcome-section .column img {
  width: 100%;
  height: auto;
}

#welcome-section .column img {
  -webkit-box-shadow: 4px 4px 10px #000;
  box-shadow: 4px 4px 10px #000;
}

#welcome-section .column .welcome-content .welcome-txt {
  color: #102542;
  text-transform: uppercase;
  font-size: 1.2rem;
  letter-spacing: 2px;
}

#welcome-section .column .welcome-content .subhead {
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: 1px;
}

#welcome-section .column .welcome-content p {
  font-size: 1.1rem;
  letter-spacing: 1px;
  margin-bottom: 10px;
}
<!doctype html>

  <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">

Welcome

A New Vision of Luxury

Lorem ipsum dolor, sit amet consectetur adipisicing elit.

Lorem ipsum dolor, sit amet consectetur adipisicing elit. Unde dolor est excepturi vitae perferendis totam quod sunt obcaecati ad maiores, eveniet nostrum eius libero voluptas repellat, dolores possimus nihil nam?

            - John Doe, Manager

A: With bootstrap 4 just add the class "align-items-center" on row:

JSFiddle: https://jsfiddle.net/charlesartbr/n3mo0uzq/3/