Jenkinsfile Pipeline DSL: How to Show Multi-Columns in Jobs dashboard GUI - For all Dynamically created stages - When within PIPELINE section

Question: Jenkins 2.89.4 rolling
I saw almost all stackoverflow posts which show how we can successfully run parallel steps/stages (using list/maps etc) --OR hardcoding them directly --OR even create dynamic stages for Jenkinsfile (as seen in this post: Scripted jenkinsfile parallel stage)
My requirements are:

A pipeline which builds N. no of projects under "BUILD" steps i.e. parallel builds on each of those projects. i.e. it runs Gradle on all N projects. Here I have a Jenkinsfile which was created by a declarative JOB DSL Groovy. Here my Gradle projects are not set as multi-projects so I can't call the top level gradle and say, Gradle please do your parallel magic (within Gradle).
I want to run build of these N projects in their own separate parallel dynamically created stages (GUI Columns) as seen in jenkins job's dashboard.
I want to see the output of (Gradle build/console) each project's build separately i.e. I don't want to mix the console output of each projects build which are running in parallel in just ONE COLUMN (i.e. column named BUILD).
In this URL https://jenkins.io/blog/2017/09/25/declarative-1/ I see, how you can run parallel stages/steps but in doing so, either it's mixing those parallel step's output in just one column (I mean under BUILD column) --OR if you want it under separate stages/columns (i.e. the post says Test on Linux or Windows separately then you are still hard-coding all the stages/steps in Jenkinsfile early on (rather than using just a list or array hash which I'd prefer to update for adding more or less stages / parallel steps as in my case, they all follow the same standard). What I want is to just update in one place How many steps and what are all of the stages in just one place (list/array).
I'm not using Jenkins Blue Ocean for now.

Usually if you have parallel steps within a stage, their console std output for all steps gets mixed into one console output / stage/column when you click to see the console output for that given parallel step/stage; When you hover over the BUILD column (assuming there were parallel steps in BUILD stage) in job's dashboard (std output for all those steps is mixed up and very hard to see individual project step's console output just for a given step/stage).
If we want to create separate stages (dynamically) then Jenkins should be able to show console output of a given step/dynamic stage within the parallel section (i.e. each column should show their own project's build console output).
Using the above URL, I'm able to do the following after trying this script:
// main script block
// could use eg. params.parallel build parameter to choose parallel/serial
def runParallel = true
def buildStages

node('master') {
  stage('Initializing Parallel Dynamic Stages') {
    // Set up List<Map<String,Closure>> describing the builds
    buildStages = prepareBuildStages()
    println("Initialised pipeline.")
  }

  for (builds in buildStages) {
    if (runParallel) {
      parallel(builds)
    } else {
      // run serially (nb. Map is unordered! )
      for (build in builds.values()) {
        build.call()
      }
    }
  }

  stage('Done') {
      println('The whole SHENZI is complete.')
  }
}

// Create List of build stages to suit
def prepareBuildStages() {
  def buildList = []

  for (i=1; i<4; i++) {
    def buildStages = [:]
    for (name in [ 'Alpha', 'Tango', 'Chyarli' ] ) {
      def n = "${name} ${i}"
      buildStages.put(n, prepareOneBuildStage(n))
    }
    buildList.add(buildStages)
  }
  return buildList
}

def prepareOneBuildStage(String name) {
    def proj_name = name.split(' ')[0]
    def proj_parallel_sub_step = name.split(' ')[1]

    //Return the whole chunkoni
    return {
            stage("Build\nProject-${proj_name}\nStep ${proj_parallel_sub_step}") {
                println("Building ${proj_name} - ${proj_parallel_sub_step}")
                sh(script:'sleep 15', returnStatus:true)
            }
    }
}

When I'm putting the above Groovy Script (which is creating DYNAMIC Stages) inside Pipeline Script or Pipeline Script from SCM (i.e. the same code available in a .groovy file) -- it runs successfully and creates dynamic stages under BUILD step for each of the 3 projects and runs 3 steps (Nth) for all 3 projects in parallel and then starts the next Nth step for all 3 projects and so on.
If you see below, we also got individual columns in Jenkins job dashboard for them.

Now, When I put the above script in Jenkinsfile (Pipeline DSL) where I have pipeline { .... } section, it's not working and giving me the following error.
Using my JOB DSL, I created a new Jenkins Pipeline job where Pipeline Script from SCM calls a groovy file (which now contains):
//----------------------------------------------------
// Both - Parallel Run and GUI View in JF Jenkins job.
//----------------------------------------------------
def runParallel = true
def buildStages
def wkspace = /var/lib/jenkins/workspaces/ignore_this_variale_or_its_value_for_now

// Create List of build stages to suit
def prepareBuildStages() {
  def buildList = []

  for (i=1; i<3; i++) {
    def buildStages = [:]
    for (name in [ 'Alpha', 'Tango', 'Chyarli' ] ) {
      def n = "${name} ${i}"
      buildStages.put(n, prepareOneBuildStage(n))
    }
    buildList.add(buildStages)
  }
  return buildList
}
//---
def prepareOneBuildStage(String name) {
  def proj_name = name.split(' ')[0]
  def proj_parallel_sub_step = name.split(' ')[1]
  // return the whole chunkoni (i.e. for a given stage) - will be named dynamically.
  return {
    stage("Build\nProject-${proj_name}\nStep ${proj_parallel_sub_step}") {
      println("Building ${proj_name} - ${proj_parallel_sub_step}")
      sh(script:'sleep 15', returnStatus:true)
    }
  }
}
// Set up List<Map<String,Closure>> describing the builds
buildStages = prepareBuildStages()
//---------------------

String jenkinsBaselines

// SEE NOW --- we have this section called 'pipeline'
pipeline {
    agent {
        node {
            label 'rhat6'
            customWorkspace wkspace
        }
    }

    options {
        ansiColor('xterm')
        timeout(time: 8, unit: 'HOURS')
        skipDefaultCheckout()
        timestamps()
    }

    environment {
        someEnvVar = 'aValue'

    }

    //------------- Stages
    stages {
        stage('Initializing Parallel Dynamic Stages') {
            // Set up List<Map<String,Closure>> describing the builds
            println("Initialised pipeline.")
        }

        for (builds in buildStages) {
            if (runParallel) {
                parallel(builds)
            } else {
                // run serially (nb. Map is unordered! )
                for (build in builds.values()) {
                    build.call()
                }
            }
        }

        stage('Done') {
            println('The whole SHENZI is complete.')
        }
    }
    //---------------------
}

Running the Jenkinsfile Jenkins job now gives me this error:
[BFA] Scanning build for known causes...
[BFA] No failure causes found
[BFA] Done. 1s
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
WorkflowScript: 69: Not a valid stage section definition: "buildStages = prepareBuildStages()". Some extra configuration is required. @ line 69, column 5.
            stage('Initializing Parallel Dynamic Stages') {
       ^

WorkflowScript: 69: Unknown stage section "println". Starting with version 0.5, steps in a stage must be in a steps block. @ line 69, column 5.
            stage('Initializing Parallel Dynamic Stages') {
       ^

WorkflowScript: 75: Expected a stage @ line 75, column 5.
            for (builds in buildStages) {
       ^

WorkflowScript: 86: Unknown stage section "println". Starting with version 0.5, steps in a stage must be in a steps block. @ line 86, column 5.
            stage('Done') {
       ^

WorkflowScript: 69: No "steps" or "parallel" to execute within stage "Initializing Parallel Dynamic Stages" @ line 69, column 5.
            stage('Initializing Parallel Dynamic Stages') {
       ^

WorkflowScript: 86: No "steps" or "parallel" to execute within stage "Done" @ line 86, column 5.
            stage('Done') {
       ^

6 errors

    at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:310)
    at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1085)
    at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:603)
    at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:581)
    at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:558)
    at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298)
    at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268)
    at groovy.lang.GroovyShell.parseClass(GroovyShell.java:688)
    at groovy.lang.GroovyShell.parse(GroovyShell.java:700)
    at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.doParse(CpsGroovyShell.java:133)
    at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.reparse(CpsGroovyShell.java:127)
    at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.parseScript(CpsFlowExecution.java:557)
    at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.start(CpsFlowExecution.java:518)
    at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:290)
    at hudson.model.ResourceController.execute(ResourceController.java:97)
    at hudson.model.Executor.run(Executor.java:429)
Finished: FAILURE

How can I get this working in Jenkinsfile pipeline section and still able to get individual columns per dynamically created stage for a given project N and Step M?
Tried the following way, still errors the say way.
//------------- Stages
stages {
    stage('Initializing Parallel Dynamic Stages') {
        // Set up List<Map<String,Closure>> describing the builds
        buildStages = prepareBuildStages()
        println("Initialised pipeline.")

        // tried this way too. within a stage
        buildStages.each { bld -->
            parallel(bld)
        }
    }

    stage('Done') {
        println('The whole SHENZI is complete.')
    }
}
//---------------------

Answer: So I did some poking into this and got it working.
The new code within Jenkinsfile (for STAGES) is now:
//------------- Stages
stages {
     stage('Start Pipeline') {
        steps {
            script {
                sh "echo HELLO moto razr!"
            }
        }
     }

    stage('Initializing Parallel Dynamic Stages'){
        steps {
            script {
                // Run all Nth step for all Projects in Parallel.
                buildStages.each { bs -> parallel(bs) }

                // OR uncomment the following code (if conditional on boolean variable).
                /*
                for (builds in buildStages) {
                    if (runParallel) {
                        parallel(builds)
                    } else {
                        // run serially (nb. Map is unordered! )
                        for (build in builds.values()) {
                            build.call()
                        }
                    }
                }
                */

            }
        }
     }

    stage('Done') {
        println('The whole SHENZI is complete.')
    }
}
//---------------------

That's all it took to work.
For clear messages / stage names, I tweaked the function as well and We won't set this variable buildStages within pipeline { ... }
//---
def prepareOneBuildStage(String name) {
  def proj_name = name.split(' ')[0]
  def proj_parallel_sub_step = name.split(' ')[1]
  // return the whole chunkoni (i.e. for a given stage) - will be named dynamically.
  return {
    stage("BUILD Project-${proj_name} Parallel_Step_${proj_parallel_sub_step}") {
      println("Parallel_Step # ${proj_parallel_sub_step} of Project => ${proj_name}")
      sh(script:"echo \"Parallel_Step # ${proj_parallel_sub_step} of Project => ${proj_name}\" && sleep 20", returnStatus:true)
      // -- OR -- you can call Gradle task i.e. rpm / any other / any other command here.
    }
  }
}

// Set up List<Map<String,Closure>> describing the builds. section now.
buildStages = prepareBuildStages()
//---------------------

This implementation is now creating N no. of parallel stages i.e. a separate column per project for a given Nth step (when looking at Jenkinsfile job's dashboard) for P no. of projects.

It will run All P projects for a given Nth step in parallel.
It will wait for Nth step for all Projects to complete first and then jump to the next Nth step.
What this means is, if Project ALPHA Step #1 is complete, it'll still wait for all Step #1 of other 2 projects and then launch Step #2 of all projects in parallel.
Challenge: How can we make ALPHA Project's Step #2 to start as soon as ALPHA project's Step #1 is complete i.e. it won't wait for Step 1 of other 2 projects to complete and could possibly run Step #2 of ALPHA project 1 in parallel with Step N(=1) or N+1 of other projects.
This assumes all projects are independent of each other and projects don't share contents generated by a given project/their stage/steps in any other project/stage/step.

Depending upon your own requirements, you may want to wait (i.e. don't run Step 2 of all projects until Step 1 of all projects are fully complete) --OR-- you may want to run Step 2 of ALPHA project with let's say - Step 2 of TANGO project while project CHYARLI's step 1 is still in progress.
As the main scope of this post was to get separate dynamically created columns/stages per project (running in parallel within pipeline { ... } section), I think, I got what I was looking for.
NOTE: Go easy with parallel if you want to run concurrent builds of a pipeline. For more info about issues related to running parallel build actions concurrently, see here: Jenkins - java.lang.IllegalArgumentException: Last unit does not have enough valid bits & Gradle error: Task 'null' not found in root project
Answer: You can also run the stages parallel as follow
pipeline {
    agent { node { label 'master' } }
    stages {
        stage('Add regression tests') {
            steps {
                script {
                    def testList = ["a", "b", "c", "d"]
                    def branches = [:]

                    for (int i = 0; i < 4 ; i++) {
                           int index=i, branch = i+1
                           stage ("branch_${branch}"){
                                branches["branch_${branch}"] = {
                                    node ('master'){
                                        sh "echo 'node: ${NODE_NAME},  index: ${index}, i: ${i}, testListVal: " + testList[index] + "'"
                                    }
                                }
                          }
                    }

                    parallel branches
                }
            }
        }
    }
}

Comment: Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer).


Long title (multiple lines) in heading with line-height

Question: I'm creating a H1 title with css, and added a line-height to it, so the H1 element has the right height and the text is vertically centered.
The problem is with long titles which need multiple lines.
An example is created at jsfiddle: https://jsfiddle.net/wygpfbm3/
HTML:

This is a normal title

This is a very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very long title

CSS:
h1 { background-color: #ebebeb; border: 1px solid #c7c7c7; border-left: none; border-right: none; top: 0px; line-height: 44px; font-size: 18px; font-weight: normal; color: #3e3e3e; }
h1:before { content: ''; background-color: transparent; border: 6px solid #c7c7c7; border-color: #c7c7c7 transparent transparent #c7c7c7; float: left; }
h1:after { content: ''; border: 6px solid #fff; border-color: #fff transparent transparent #fff; float: left; margin-left: -12px; margin-top: -1px; }

As you can see in the fiddle example, a normal title (single line) is working perfect. When it's a long title, the lines are too far apart (because I set the line-height).
Also the second line doesn't have the padding on the left like the first line. Another problem is with the little white triangle in the top left corner. It's moved down when the title is multiple lines long.
Anyone know how I can solve this in a clean way, preferred with CSS only?
Answer: You set the line-height to 44px, presumably so that it will be 44px as a single line.
So, instead of using line-height why not use top & bottom padding instead
44px - 18px (font-size) / 2 = 13px padding

h1 {
  background-color: #ebebeb;
  border: 1px solid #c7c7c7;
  border-left: none;
  border-right: none;
  padding: 13px 0px;
  font-size: 18px;
  font-weight: normal;
  color: #3e3e3e;
  width: 80%;
  margin: 3em;
  position: relative;
}
h1::after {
  content: '';
  position: absolute;
  top: -1px;
  left: 0;
  border-width: 6px;
  border-style: solid;
  border-color: white transparent transparent white;
}
h1::before {
  content: '';
  position: absolute;
  border-width: 6px;
  border-style: solid;
  border-color: #c7c7c7 transparent transparent #c7c7c7;
  top: 0;
  left: 1px;
}

This is a normal title

This is a very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very long title

Comment: Thanks, that does work for the line-height problem, but not for the cut off angle in the top left corner: https://jsfiddle.net/wygpfbm3/2/
Comment: However, fixed it for you.


Emulator PCSX Reloaded - Fullscreen not working on Unity

Question: I have an older PS1 console with a couple of games I bought some years ago. On my pc, I'm using PCSX Reloaded - the best PS1 emulators for Linux I found so far.
But I'm having a little issue on Ubuntu 12.04 Precise. I'm using Unity 3D and I'm trying to run some of my original PS1 games on PCSX Reloaded. Everything works nicely, except for fullscreen. I toggle fullscreen and specify maximum resolution for my monitor, but on fullscreen mode, both left and top unity bars aren't getting hidden.
I tried changing between other graphic modes like Gnome Classic and Gnome Classic w/o Effects. On both, PCSX shows bars in fullscreen mode, so it isn't an Unity-specific issue, but an emulator problem.
It's a bit annoying play games this way, so basically I'm running games on window mode for now. I'm using default OpenGL graphic plugin on this emulator. I tried changing to X11 graphic plugin and fullscreen worked, but graphics on X11 plugin aren't as good as OpenGL one.
Anyone know a way to get fullscreen working on PCSX using OpenGL plugin? Or maybe another graphic plugin w/ OpenGL support.
Answer: This is a commpatibility issue.
You can try by changing the graphic plug in in pcsx
Comment: I think that too. I tried changing between other graphic modes like  Gnome Classic and Gnome Classic w/o Effects. On both, PCSX shows bars in fullscreen mode. I'll try that later.
Answer: this sounds a bit complicated, i have a note book and run just fine, i set up full screen by changing the resolution on settings, the only thing you have to understand is that the psone resolution has to be kept as the games where made for that resolution. my unity launcher hide perfectly when i run the game.
try changing resolution, without stretching the image (keeping original psone) and run the bios right after, try till yours work.
wish you luck!!!
Answer: If you installed though synaptic, you should have a second GPU plugin pre-installed (XVideo Driver 1.1.17).
Switch to it in the configure menu. Fixed it in my case (ubuntu 12.04 64bit)


Equality proof of function $g_N(x) = \sum_{n=-N}^N \frac{1}{x+n}$

Question: I have a function
$$ g_N(x) = \sum_{n=-N}^N \frac{1}{x+n} $$
How can I prove that this function is odd, thus $ g_N(-x) = -g_N(x)$ ?
Comment: In addition to the algebraic answers, there is the simple intuition that your function consists of N + 1 poles located at -N, -N + 1, ..., 0, 1, ... N. These are all just horizontal translations of $1/x$ (a well-known odd function), symmetrically placed around 0, added together.
Answer: Hint:  $$\frac{1}{-x + n} = -\frac{1}{x - n}$$
Answer: HINT: Note that $$\sum_{n=M}^K a_n = \sum_{n=-K}^{-M} a_{-n}.$$
Comment: +1 If I had any votes left, I think both our hints combine as a full answer
Comment: @muzzlator Yep :)
Answer: Fold the sum in half at the middle ($n = 0$):
$$
\begin{align}
g_N(x) = \sum_{n=-N}^{n=N} \frac{1}{x+n} &= \frac{1}{x} + \sum_{n=1}^{n=N} \left( \frac{1}{x-n} + \frac{1}{x+n} \right) \\
&= \frac{1}{x} + \sum_{n=1}^{n=N} \frac{2x}{x^2 - n^2}
\end{align}
$$
Now, you can verify directly that $g_N(-x) = -g_N(x)$.
Answer: $$-g_N(x)=-\sum_{n=-N}^N \frac{1}{x+n} = \sum_{n=-N}^N -\frac{1}{x+n} =\sum_{n=-N}^N \frac{1}{-x+n}  $$
$$g_N(-x)=\sum_{n=-N}^N \frac{1}{-x+n}  $$


Check if Asp.Net(Core) application is hosted in IIS

Question: How can I check inside the application if it is being hosted in IIS?
Comment: You can check server implementation type, see my answer to similar question here https://stackoverflow.com/a/77009987/548540
Answer: Check if the environment variable APP_POOL_ID is set.
public static bool InsideIIS() =>
    System.Environment.GetEnvironmentVariable("APP_POOL_ID") is string;

All of environment variables that iis sets on a child process
Comment: Since Asp.Net Core 6, the 'APP_POOL_ID' variable does not seem to be available anymore. I am now using the 'ASPNETCORE_IIS_PHYSICAL_PATH' environment variable as an alternative.
Comment: I can't belive they changed this.... I'm suggest you to start using linux, uninstall any microsoft software and burn all windows servers you might have. Microsoft is cancer and .net is a joke...
Comment: On a more serious note, I'm glad you found an alternative environment variable :)
Answer: I've tried the answer by Branimir Ričko but found that it's not correct: this environment variable is also set when running under IIS express.
So here is my modified version:
static bool IsRunningInsideIIS() =>
    System.Environment.GetEnvironmentVariable("ASPNETCORE_HOSTINGSTARTUPASSEMBLIES") is string startupAssemblies &&
 startupAssemblies.Contains(typeof(Microsoft.AspNetCore.Server.IISIntegration.IISDefaults).Namespace);

Answer: I believe there is no direct way how to achieve that out of the box. At least I haven't found one. And the reason, as I can tell is the fact ASP.NET Core application is actually a self-contained application knowing nothing about it's parent context, unless the later will reveal information about itself.
For example in the configuration file we can tell which type of the installation we're running: production or development. We can assume that production is IIS, while development is not. However that didn't worked for me. Since my production setup could be either IIS or windows service.
So I have worked around this problem by supplying different command line arguments to my application depending on type of run it supposed to perform. That, actually, came naturally for me, since windows service indeed requires different approach to run.
For example in my case code looked somewhat like so:
namespace AspNetCore.Web.App
{
    using McMaster.Extensions.CommandLineUtils;
    using Microsoft.AspNetCore;
    using Microsoft.AspNetCore.Hosting;
    using Microsoft.AspNetCore.Hosting.WindowsServices;
    using System;
    using System.Diagnostics;
    using System.IO;

    public class Program
    {
        #region Public Methods

        public static IWebHostBuilder GetHostBuilder(string[] args, int port) =>
            WebHost.CreateDefaultBuilder(args)
                .UseKestrel()
                .UseIISIntegration()
                .UseUrls($"http://*:{port}")
                .UseStartup<Startup>();

        public static void Main(string[] args)
        {
            var app = new CommandLineApplication();

            app.HelpOption();
            var optionHosting = app.Option("--hosting <TYPE>", "Type of the hosting used. Valid options: `service` and `console`, `console` is the default one", CommandOptionType.SingleValue);
            var optionPort = app.Option("--port <NUMBER>", "Post will be used, `5000` is the default one", CommandOptionType.SingleValue);

            app.OnExecute(() =>
            {
                //
                var hosting = optionHosting.HasValue()
                    ? optionHosting.Value()
                    : "console";

                var port = optionPort.HasValue()
                    ? new Func<int>(() =>
                    {
                        if (int.TryParse(optionPort.Value(), out var number))
                        {
                            // Returning successfully parsed number
                            return number;
                        }

                        // Returning default port number in case of failure
                        return 5000;
                    })()
                    : 5000;

                var builder = GetHostBuilder(args, port);

                if (Debugger.IsAttached || hosting.ToLowerInvariant() != "service")
                {
                    builder
                        .UseContentRoot(Directory.GetCurrentDirectory())
                        .Build()
                        .Run();
                }
                else
                {
                    builder
                        .UseContentRoot(Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName))
                        .Build()
                        .RunAsService();
                }
            });

            app.Execute(args);
        }

        #endregion Public Methods
    }
}

This code not only allows select type of the hosting (service and console — the option that IIS supposed to use), but also allows to change port which is important, when you're running as Windows service.
Another good thing is usage of argument parsing library, McMaster.Extensions.CommandLineUtils — it will show information about configured command line switches, so it would be easy to select right values.
Comment: excuse me , when I do RunAsService, the app won't execute... do I have to create a worker?


Retaining Wall Leaking Dirt

Question: In the home my wife and I recently purchased, I noticed more and more dirt pouring out of one side of our retaining wall surrounding our driveway. It occurs right at the seam where the retaining wall meets the rest of the house

I'm not sure if a squirrel might be digging in there, if the rain is washing it out, or what.
Is this any cause for concern? Should I take any action to prevent / fix this? Is it indicative of any deeper problems?
If it helps, here's an image of the top of the retaining wall, looking down into the driveway
Comment: does not look like a problem ... the sand is simply flowing out the hole ... you could try to drive a PVC pipe or a metal pipe vertically into the corner so that it plugs the hole from the back of the wall .... or you could dig down in the corner an hang landscape fabric so that it keeps sand from escaping
Comment: Hello and welcome.Why is so much water pooling up in area?And  are you in a area that has freezing temps? Something is undermining wall needs to be fixed soon .
Comment: Also looks like the first three blocks of your house foundation are broken.
Answer: That small pile of dirt is an indication that moisture is behind your wall and is "escaping" by coming out from between the two walls. As the water runs out, it washes some dirt (fine particles) with it.
If you look closely, you'll notice there is some very small amounts of soil washing out between the joints of the "stack block" wall too. (If you notice, there is more dirt lower on the wall, because the water "escapes" at the lower levels where there is more pressure.)
The wall on the left is made to be solid and not allow any seepage, but the stack block wall on the right is made to allow water to seep through the joints.
If you plug the joint between the two walls, additional water and dirt will seep through the stack wall joints...you probably won't notice the difference.
Long term, water will continue washing soil out in order to reduce pressure on the wall. It's annoyingly to clean up every year or so, but it's not alarming.
Comment: Were have i said that ? Fabric lets water out keeps dirt in a filter.
Comment: If landscape  fabric was installed would help with some sand and water drain out cleaner.Need to fill corner with proper filler and seal corner inside to keep water out so ice does not blow wall apart
Comment: @RobertMoody "Keep water out"? There's a flower planter directly above. Fabric won't keep the water out.

Retaining Wall Leaking Dirt


How reload particular section in UITableview?

Question: When I tried to reload particular section table view scrolls in top direction automatically and I can't understand what is happening?And I used this below code.When I tap on any button full table view scroll to top direction.
        [_moviesDetailTableview beginUpdates];
        [_moviesDetailTableview reloadSections:[NSIndexSet indexSetWithIndex:1]withRowAnimation:UITableViewRowAnimationNone];
        [_moviesDetailTableview endUpdates];

Comment: What is the problem with the code? Please elaborate your question.
Comment: @Yuvraj Singh you might be using estimatedRowHeigh which might be different from actual height  for your table this issue generally occurs becoz of that.
Comment: is it happened on ios 8?
Comment: Is your section with index 1 is in visible area? if no, as you are reloading first section, tableview is focusing there...
Comment: @TusharSharma i used estimatedRowHeight
Answer: And you can store content offset of your tableview. and can do something like,
 GPoint contentOffset = _moviesDetailTableview.contentOffset;
 [_moviesDetailTableview beginUpdates];
 [_moviesDetailTableview reloadSections:[NSIndexSet indexSetWithIndex:1]withRowAnimation:UITableViewRowAnimationNone];
 [_moviesDetailTableview endUpdates];
 [_moviesDetailTableview layoutIfNeeded];
 [_moviesDetailTableview setContentOffset:contentOffset];

Answer: Try this code,
[self.tableView reloadSection:0 withRowAnimation:UITableViewRowAnimationNone];

- (void) reloadSection:(NSInteger)section withRowAnimation:(UITableViewRowAnimation)rowAnimation {
    NSRange range = NSMakeRange(section, 1);
    NSIndexSet *sectionToReload = [NSIndexSet indexSetWithIndexesInRange:range];
    [self reloadSections:sectionToReload withRowAnimation:rowAnimation];
}


How to install GalliumOS Kernel onto ubuntu installation Acer Chromebook 14

Question: So, I looked all over the web for a solution to getting the "dummy output" on my Acer Chromebook 14 fixed, and found nothing that worked, but I have an idea.
I want to install the GalliumOS kernel onto my installation, but haven't been able to find instructions on how to do so that actually worked for me. If I could get simple instructions on how to do this, it would be greatly appreciated.
Thanks in advance.
Comment: I don't know how useful this is, but I found it in a quick Google search and it looks promising -- [a Reddit user says they got it working](https://www.reddit.com/r/GalliumOS/comments/6cnb3c/running_the_galliumos_kernel_on_other_nongallium/dhyghw3/). View the whole thread if you need more context.
Answer: Following these steps I've an Ubuntu Gnome LTS with GalliumOs kernel and the sound is working.

Davide Riboli on Bazinga!

Following the steps of this post I was able to have an Ubuntu Gnome LTS installation perfectly working on my
  Toshiba Chromebook2.
1) Install Ubuntu Gnome LTS (16.04) on a USB pendrive, following the
  great Fascinating Captain
  tutorial.
2) Start your chromebook with your new Ubuntu Gnome. Do not update
  anything. Launch terminal.
3) Add the GalliumOS repository. Edit
  /etc/apt/sources.list.d/galliumos.list and put the following in it:
deb http://apt.galliumos.org xenon main
deb-src http://apt.galliumos.org xenon main

4) Import the galliumos gpg key. Make sure you have curl installed
  first.
curl https://apt.galliumos.org/galliumos.gpg | sudo apt-key

5) Update the packages. This installs galliumos-base because the
  repository requires it:
sudo apt update
sudo apt dist-upgrade

6) Edit the file /etc/apt/preferences.d/galliumos.pref. Change
  "Pin-Priority: 9999" to "Pin-Priority: 1".
7) Update and dist-upgrade again. If there are no messages saying "The
  following packages will be DOWNGRADED", you've done this correctly and
  can proceed with the upgrade.
8) Install the kernel and galliumos-baytrail packages
sudo apt install linux-image-galliumos galliumos-baytrail

9) Uninstall the old kernel
sudo apt remove linux-*generic
sudo update-grub

10) Reboot and proceed like in a normal Ubuntu installation.
Everything works perfectly, except sound-in (I'm looking for a
  workaround or a patch for this).


How should I connect bare copper ground wire from a new light fixture to a plastic junction box?

Question: It's an early 1900s house but the electrical was probably updated over a decade or so ago.  I have a new light fixture which states to wrap the bare copper ground wire around the green ground screw on the included cross bar which then connects to the copper ground wire from the outlet box.
The outlet box is plastic and the bare copper wire from the outlet box is wrapped around what appears to be a grounding screw (See picture.  Box has bare copper wire, white wire, and black wire).
So how do I connect the two copper wires given this?  Do I leave the copper wire from the outlet box on the outlet box's grounded screw, and ALSO ground the copper wire from the fixture to the ground screw on the included cross bar?  And THEN connect the two copper wires?
Comment: the light colored area to the right of the grounding screw ... is it metal under the paint?
Comment: if you're referring to the area where the two threaded holes are, it looks like the top hole is covered by metal which then wraps up the left side of the plastic and connects with the ground screw
Answer: I would use a wire nut or a WAGO to connect the two grounds together.
That ground screw might not hold two wires together enough--one might come off.
Comment: Would you leave the ground wire from the box connected to the box's ground screw AND also attach the ground wire from the fixture to the cross bar BEFORE connecting the two grounds together?
Comment: Yes that screw in a plastic box does not do except to hold the ground wire.  There might be a piece of metal that also connects to the screw from the light/cross bar which would add to ground connection.
Comment: There doesn't appear to be a piece of metal that does so.  The cross bar (AA) just has the ground screw (BB).  I added a picture of the fixture's instructions for reference.


An Exercise of Bayesian Decision

Question: Suppose we know there is a ball X in the pocket, but do not know the color of the ball (we know its color is white or black). One puts another ball Y with white color into the pocket, then takes out a ball randomly. If the ball taken out is white, What is the probability that X is white?
Answer: This is a straightforward problem using Baye's method:
Let $A$ be the event that the ball taken out is white and $B$ be the event that $X$ is white.
You wish to compute $P(B\mid A)$. This isn't straightforward to do; but $P(A\mid B)$ is easy to compute. It would thus be desirable  to switch the roles of $A$ and $B$. This is effected as follows:
$$\tag{1}
\eqalign{
  P(B\mid A)&={P(A\cap B)\over P(A)}
={P(A\mid B)P(B)\over P(A)}.\cr
}
$$
Now to find $P(A)$, we condition on what color $X$ is:
$$
P(A)= P(A\cap B)+P(A\cap B^C)=P(A\mid B)P(B)+P(A\mid B^C)P(B^C) .
$$
Substituting the above into  $(1)$, we obtain:
$$\tag{2}
\eqalign{
  P(B\mid A)
&={P(A\mid B)P(B)\over P(A\mid B)P(B)+P(A\mid B^C)P(B^C)  }.
}
$$
Now:

$P(A\mid B)$ is the probability that the ball taken out is white
given that $X$ is white; so,  $P(A\mid B)=1$.
$P(A\mid B^C)$ is the probability that the ball taken out is white
given that $X$ is not white; so,  $P(A\mid B^c)=1/2$.
Presumably $P(B)=1/2$. Then $P(B^c)=1/2$.

Now it's a matter of substituting this information into the right hand side of $(2)$.

An Exercise of Bayesian Decision


Xbox "Screenshot uploaded" notification looked like a demon had possessed my Xbox, what could the reason be?

Question: Yesterday I was testing some button remapping on my controller and saw that you could map "actions" as well, so I mapped the screenshot function to a button to test it.
I activated it, then mapped it back after seeing the notification that the screenshot had been taken, and entered a multiplayer game.
While I was playing, some time later I got a notification that looked like a demon had possessed my Xbox, telling me that the screenshot had been uploaded.
I was unable to take a photo of it because I was busy in multiplayer for quite some time and today the notification is back to normal, so the best way I can describe it is that I used an online "randomizer" to generate some text, and the notification that normally says "Screenshot uploaded to the Xbox network" looked something like this:
S̴͚̒c̴̘͚̑r̵̩͠͝ę̵̰́e̸̤͈͊ṋ̷̯͠s̶̛̱͘h̶͈̭́o̵̞̲͛t̴͔̫͗ ̸̦̑̚ṳ̵̩̿p̶̈́̚͜l̵͖̎ò̶̢̤͆à̷̢͚d̶͈̃̆ę̶͙̿d̷̫̫̿͐ ̸͕̔̀ţ̸̩̾͛o̷̙͔͊ ̴͈̿̉t̸̖͈̃h̸̤̒̈́ê̶͈̪ ̸̡̀̽X̸̠͋b̵̪̀̄o̵͚͚͝x̵̱̪͒ ̵͙̎n̷̠̓e̵̗̠̊t̸̺͙́͠ẘ̵̧̼ǫ̷̋͐r̵̼̯̽k̵͓̬̆̓
It wasn't as bad as the above example but it had lots of these weird accents on every character.
Today the message is back to normal. The Xbox has just been sleeping inbetween, no hard reset or full restart.
Does anyone know why this happened and what the reason was?
This is Xbox Series X.
OK; Scratch "nothing happened inbetween", I now see that there was a system update early this morning. While I don't know if this update fixed anything in this regard, I would assume the console did some kind of restart at the time and my game just continued from Quick Resume.
Comment: if you had taken a picture, it would have been amazing for r/softwaregore
Comment: @Eristheguest Hah, [it's already there](https://www.reddit.com/r/softwaregore/comments/ngu31e/nice_ive_got_a_demon_on_my_xbox/).
Comment: Did you try to [parse HTML with regex](https://stackoverflow.com/a/1732454/2518200)?
Comment: Yes, I did, and I was visited by Cthulhu. He did not play nice.
Comment: I agree, but sadly the notification didn't stay long enough for me to fish out my camera, and due to the multiplayer I was in (dungeon group in Elder Scrolls Online) I couldn't pause for long enough to wait for the screenshot notification to appear. The download runs through molasses when a game is running.
Comment: @mindstormsboi Haha, and they thought it was demonized as well, really nice :D
Comment: The main problem I had yesterday (in regards to this issue) was that I was playing with others, and when a game is running the upload (not download I wrote above) runs really slow to avoid impacting the game with bandwith issues. However, if I take a screenshot in a game and then forcibly quit the game, it happens in less than 10 seconds. If I ever see this again I'll make sure to come back and post an actual screenshot of this.
Comment: I love how (Chromium) Edge offers me to translate this page to English from Vietnamese.
Answer: Speaking as an ex-Microsoft employee (I worked on Windows), I saw a lot of this, because it's an intentional feature for internal users. We called it "pseudo-localization": it's basically an automatically generated "language" that we used to make sure every piece of text in the program is accessible to the translation team, without going through the expense of actually doing the translations, or the frustration of trying to use our computers in a language we don't understand. The generator just goes through all the text strings (that it can reach), and converts them by starting with the original English text, replacing each letter with a randomly chosen "demon-possessed" equivalent, and then adding about 50-60% extra nonsense (to make sure it still fits in languages like German that tend to produce longer text). If we ever see some text that's still in normal English (because it wasn't accessible by the translation system), or if something doesn't fit or looks terrible, we call up the team responsible and tell them to fix it.
Obviously this isn't supposed to be seen by external users, but it looks like there was some kind of bug and your Xbox temporarily thought it was in this "pseudo-locale". I agree, it's pretty funny to see!
Comment: I saw it in a youtuber's (Enderman) video. It looks so WIERD!
Also I like the fact an ACTUAL ex-Microsoft employee came to answer this.
Comment: @LasseV.Karlsen I've seen this claim elsewhere, by others claiming to be current or former Microsoft employees; I think it's probably legit.
Comment: @LasseV.Karlsen since the question mentioned that "*it had lots of these weird accents on every character*", I'd believe this is the case of pseudo localization, [just like what Android also uses](https://developer.android.com/guide/topics/resources/pseudolocales).
Comment: Though I don't have any way to verify any of the claims in this post, I think it is entirely plausible because we've used a similar method to make unlocalized text "painfully" visible to our testers in a product I used to work on. Basically we replaced all symbols in the text with a different unicode symbol that looked the same, just upside down. You could still read the text, though not easily, but it bugged testers enough to report it so we got it fixed. Here is an example, "ǝʃdɯɐxǝ uɐ sı ǝɹǝH", though I do believe we still had the letters "in the right order".
Comment: I'm also ex-MSFT and I can also confirm the pseudolocalized text is a thing - though I haven't seen people use it since Windows 8.1's development (but I wasn't in OSG, so my experiences are limited - in fact when my org was dogfooding Windows 10 in early 2015 I don't even remember it being an option anymore...)
Comment: Here's an (old) screenshot of mine (Windows 7, ~2011) showing pseudo-locales in the windows driver dialog: https://tbspace.de/content/images/grafik2.png
Answer: It was just a bug and the update has fixed it.
Comment: What update? None is mentioned in the Q.
Comment: The restart not update
Comment: No he does say there was a restart
Comment: @iMxqh They specifically say there has been no restart. "Today the message is back to normal. The Xbox has just been sleeping inbetween, no hard reset or full restart."
Comment: OK; Scratch "nothing happened inbetween", I now see that there was a system update early this morning. I meant system update.


Variance of a Probability density function

Question: I'm trying to find the variance of the following random variable with density function
$$f(x)=\begin{cases}
\frac{3}{2}x(1+x),& \text{ $|x|\leq1$ }  \\
 0& \text{  }  o. w
\end{cases}$$ First, we find $\displaystyle E(x)=\frac{3}{2} \int_{-1}^{1}x^2(1+x)dx=1$ and $E(x^2)= \displaystyle \frac{3}{2} \int_{-1}^{1}x^3(1+x)dx= \frac{3}{5}.$ Now, variance of the random variable $x$ is defined  by $V(x)=E(x^2)-(E(x))^2= \frac{3}{5}-1\Rightarrow \frac{-2}{5}<0$. But, variance can't be negative. Where did I made a mistake?
Answer: There is a mistake in the question.
When $x=-0.5$, $f(x) < 0$ and $f$ is continuous in that neighborhood, it can't be a pdf.
Comment: Indeed, the function maps to negative values for any $x$ between $-1$ and $0$.


Can't build Android app using crashlytics behind VPN and proxy

Question: As a teleworker I use a VPN with a proxy.pac (config file is available at http://proxy.mycompany.com/proxy.pac).
To update packages Android SDK Manager, the following proxy settings work properly:
HTTP Proxy Server: proxy.mycompany.com
HTTP Proxy Port: 80

In Android Studio I work on an Android-Gradle project using crashlytics. I have set the same parameters in Proxy HTTP.
A gradle assembleDebug command fails when checking crashlytics apikey:
:myproject-project:compileDebugNdk UP-TO-DATE
:myproject-project:preBuild
:myproject-project:preDebugBuild
:myproject-project:checkDebugManifest
:myproject-project:prepareDebugDependencies
:myproject-project:compileDebugAidl UP-TO-DATE
:myproject-project:compileDebugRenderscript UP-TO-DATE
:myproject-project:generateDebugBuildConfig UP-TO-DATE
:myproject-project:processDebugManifest UP-TO-DATE
> Building 32% > :myproject-project:crashlyticsCleanupResourcesDebug

then after timeout:
ERROR - Crashlytics Developer Tools error.
com.crashlytics.reloc.org.apache.http.conn.HttpHostConnectException: Connect to api.crashlytics.com:443 [api.crashlytics.com/22.214.171.124, api.crashlytics.com/184.108.40.206, api.crashlytics.com/126.96.36.199, api.crashlytics.com/22.214.171.124, api.crashlytics.com/184.108.40.206, api.crashlytics.com/126.96.36.199, api.crashlytics.com/18.104.22.168, api.crashlytics.com/188.8.131.52] failed: Connection timed out:     connect
    at com.crashlytics.reloc.org.apache.http.impl.conn.HttpClientConnectionOperator.connect(HttpClientConnectionOperator.java:138)
    ...

I have tried to set gradle properties in ~/.gradle/gradle.properties file:
systemProp.http.proxyHost=proxy.mycompany.com
systemProp.http.proxyPort=80

... but it not seems to be a great idea as I have a warning in HTTP Proxy settings (those settings are obsolete).
I have ask people from network to snif what happens, and there are access failure on URLs like http://dl-ssl.google.com (same that are used in Android SDK manager), or EC2 on Amazon (possibly used by crashlytics, isn't it?).
Of course all this runs perfectly when I'm directly connected in my company's LAN.
Any idea of what could happen? Any workaround?
Thanks for support. Jean
EDIT:
Solution is to set https proxy server and port in ~/.gradle/gradle.properties file. In my case, http parameters seems useless.
systemProp.https.proxyHost=proxy.mycompany.com
systemProp.https.proxyPort=80

Thanks for you help!
Answer: Hemal from Crashlytics here. Can you set https.proxyHost and https.proxyPort? In addition, if you have one, go ahead and set https.proxyUser and https.proxyPassword as well! This should take care of it for ya :)
Comment: Hi Hemal, thanks for replying.
Proxy server and port (no proxy anthentication) is configured in AndroidStudio:
 File / Settings / IDE Settings: HTTP Proxy.

I used the "Check connection" button:
 - http://api.crashlytics.com -> OK
 - https://api.crashlytics.com:443 -> Error 302

Here is error message:
ERROR - Crashlytics Developer Tools error.
com.crashlytics.reloc.org.apache.http.conn.HttpHostConnectException: Connect to api.crashlytics.com:443 [api.crashlytics.com/22.214.171.124, api.crashlytics.com/184.108.40.206, ...] failed: Connection timed out: connect

Regards.
Comment: Oups! I didn't understand your remark.

Works fine with you http**s**.proxyHost and http**s**.proxyPort.


VBA Edge gives unspecific error on ReadyState

Question: Ok so I have this script I did some time ago that was working perfectly fine 1-2 years ago on Internet Explorer however now I am on Windows 11 which has only Edge.
Every time I run this script, it hangs on Busy readystate for no reason. Has anything changed in the implementation? Because I am really confused.
Set IE = createobject("internetexplorer.application")
strURL = "http://www.website.com/"
IE.navigate strURL
IE.Visible = true
Do While (IE.Busy Or IE.ReadyState <> 4)
    WScript.Sleep 100
Loop

Edit just to clarify: This script works just fine all the way to checking the ReadyState. It opens Edge, navigates to URL but then it throws an "Unspecified Error" on the line where it checks the ReadyState.
On Windows 10, it worked perfectly fine with IE.
Comment: @SumutiuMarius so there's your answer, if IE doesn't remain whatsoever then the `InternetExplorer.Application` COM object won't exist either as it's powered by the IE engine.
Comment: https://stackoverflow.com/questions/67179738/interact-with-edge-html-through-vbscript
Comment: @QHarr I will have to disagree with you. The script works up to the first Do While part. It opens Edge to the website however it throws an "Unspecific Error" on that line.
Comment: @QHarr Are you sure you are talking about Edge on Windows 11? IE and Edge are mashed together in Windows 11
Comment: Oh..... I still don't believe it is supported though. Have you read somewhere that it is?
Comment: @QHarr Unfortunately I don't know that much about this as I only have Windows 11 since a few weeks ago. However, IE is non existent on Windows 11 so I assume that Edge will take all the functionality of IE? On Windows 10, this script would open IE, not Edge and would work just fine. I assume something changed in handling the readystate which I am not aware of.
Comment: @SumutiuMarius Edge on Windows 11 is Edge based on the Chromium Project (not the IE engine anymore) so your script would never work as VBScript isn't supported. Plus VBA and VBScript are two different things, if you are running this script via Excel or another Office product your likely using VBA. If it's standalone its a VBScript.
Comment: @user692942 So you're saying that they completly dropped support for VBScript in their only browser for Windows 11?
Comment: @SumutiuMarius If it's Edge then yes, if however it's the old IE 11 engine which runs from `iexplore.exe` then the answer is no, that should still work and your problems likely stem from the default site security in the IE internet settings. Haven't got Windows 11 so can't check but imagine the old engine is still there you just have to look for it.
Comment: @user692942 The old engine is not there. There is no remains of IE whatsoever. I even tried to install IE by downloading it from Microsoft but it doesn't even want to install it. Apparently even Microsoft hates it now. Which is understandable....
Answer: The script presented in the question works correctly in Windows 11 build 22000.348 and above. According to this article, Microsoft "inadvertently broke" IE COM automation in Windows 11, but fixed it via an update released in November 2021. As per that same article: "IE COM objects have been restored to their original functionality and will continue to work after the IE11 desktop application is disabled".
Contrary to popular belief, Internet Explorer is still included in Windows 11 and is fully functional for any scripts that depend on it. All that has changed is that IE is not available as a default browser and running iexplore.exe in the usual ways, such as double-clicking, redirects to Edge. The following three line script will continue to launch IE in Windows 11 (and Windows 10 after June 15, 2022):
Set oIE = CreateObject("InternetExplorer.Application")
oIE.Visible = True
oIE.Navigate "duckduckgo.com" 'put your URL of choice here

Comment: So in other words, it was Microsoft as always...


Additional Drivers page does not see my graphics card 16.04

Question: I am using a fresh install of Ubuntu 16.04 with all of the updates installed. When I go to additional drivers it simply shows one option with "Unknown: unkown".
The model is a Thinkpad P50s, it is supposed to have a m500m, but when I run
lshw -C display

I receive this
 *-display UNCLAIMED
   description: 3D controller
   product: GM108GLM [Quadro K620M]
   vendor: NVIDIA Corporation
   physical id: 0
   bus info: pci@0000:06:00.0
   version: a2
   width: 64 bits
   clock: 33MHz
   capabilities: cap_list
   configuration: latency=0
   resources: memory:f1000000-f1ffffff memory:c0000000-cfffffff memory:d0000000-d1ffffff ioport:d000(size=128)

I'm unsure of what else to do. I had this problem before and used bumblebee, but I would just like to install the drivers and have the card work. It is my only gripe with Ubuntu.
How do I make the card show up in additional drivers?
Answer: After some time I found the proper way to do this online. This is the webpage, but I'll explain it here incase that link dies one day.
This will not show the card in the addition drivers page, and this bricked my machine the first time I did it. It bricked because I installed the wrong driver version the first time, so back up your data.
1) Check the PPA site for the latest nvidia driver here and check that your graphics card supports it (search the nvidia driver site for the supported cards.
check your card with the command:
sudo lshw -c display

2) I didn't need to do this, but remove all nvidia drivers with
sudo apt-get purge nvidia*

3) add the PPA and then update
sudo add-apt-repository ppa:graphics-drivers
sudo apt-get update

4) Install the driver! Replace the X with the driver number
sudo apt-get install nvidia-XXX

Reboot your computer.
Check if this is working with
lsmod | grep nvidia

if this returns nothing then the install failed, as the website indicates.
This is a problem that I had been trying to fix for months.
I downgraded all the way from Ubuntu 18 to 16 for this to work.
Answer: Follow the above answer's steps from step (1) to (3), add the PPA and update.
Then you can detect the model of your nvidia graphic card and the recommended driver, the command is:
ubuntu-drivers devices
Then you can install your prefer drivers
sudo apt install nvidia-XXX XXX is the version of the driver
or
if you trust the system, then you can install all recommended drivers:
sudo ubuntu-drivers autoinstall
Last step, reboot your machine.
The above solution is from linuxconfig.


Why was a high wall plug installed in a 1959 home?

Question: In our 1959 ranch-style home there is an outlet on a living room wall more than halfway up. Anyone know for what use this may have been installed? It looks built-in when the house was built.
Comment: A picture would help.  You can press "Edit" above to edit your question and copy-paste in a JPG.
Comment: If it was recessed, then yes, it was a clock. In the 1950s-60s, electronic wrist watches weren't technologically possible; you had to wind your watch and you needed something to check its time against. Even today the Electrical Code has a special exception for wall clocks to be on circuits that don't normally allow such loads.
Comment: Any chance the room used to be a kitchen (or part of one)?  The outlets for refrigerators are also often placed higher up on the wall.
Comment: Does a switch control it or does the room have ceiling lights?
Comment: Was it for a radio on a dresser?
Comment: @Hilldilly sounds like a wall clock outlet to me. In the 50s, alkaline batteries didn't exist, the best they might've had were "heavy duty" zinc chloride batteries -- and the highest-capacity "heavy duty" batteries then pale in comparison to the cheapest alkalines you can get today... so a wall clock would've had an abysmal runtime on an AA battery. Also, 60Hz provides a relatively reliable timing pulse courtesy your local power company, vs. trying to make something that maintains stable timing as battery voltage degrades (now cheap electronics can compensate for this).
Comment: Or was it put above the flood level and the later outlets "forgot"?
Comment: Probably so, we suspected a clock, but that seems much ado about nothing. But who knows, maybe it was considered that important at the time. I did hang a picture over it. And yes, it is recessed. Thanks all for the help.
Comment: Why does it matter?
Comment: I need instructions for posting a photo...
Answer: Probably for a plug-in electric clock.
Comment: @Tetsujin [UK clock plug & socket](https://en.wikipedia.org/wiki/AC_power_plugs_and_sockets:_British_and_related_types#UK_electric_clock_connector)
Comment: A good idea in places with a stable power supply... In some places you are better off with a sun dial.
Comment: I guess this is another that depends on where you live. In the UK clock plugs are different to any other plug in the house. Small, maybe 1 1/2" square, recessed.  I can't find a picture as I doubt anyone's installed one since the 50s over here either ;)
Comment: Yep. Some were recessed into the wall so the cord could be hidden. My 1950s home had one in the dining room.
Comment: @GrahamNye - that's the one. Well found. I don't think I've seen one in 40 years.
Comment: Our 1950'S home had one in the living room above the fireplace for a clock. the outlet was recessed into the wall
Comment: Our 78 home as one also.  Thing is that even that we did the electric circuits, I have no idea why it was placed there.  The only one in the house.
Comment: The thinking was probably, "if they don't want a clock they can hang a picture over the outlet."
Comment: See also https://diy.stackexchange.com/questions/236119/why-is-there-only-one-receptacle-in-this-outlet
Comment: "hang a picture over the outlet" more than likely, an outlet over the fireplace **is** an outlet for a picture. They would use a t-base tube light in a brass housing on an arm attached to the frame at the top. ( https://www.amazon.com/Picture-light-painting-display-_PCT14/dp/B01921CKIW )
Comment: I'm in Michigan, I don't see the sun from November to March. lol
Answer: I would bet it is for a what was called a "pin up" lamp.  A wall lamp with a short cord that was considered stylish and ornamental then. Sometimes placed in pairs, one slightly higher than the other.
Answer: Is it near the front door?  It may have been for powering a doorbell.
Is it located near a telephone?  Could have powered an external ringer/clapper unit to alert on incoming phone calls.
But what can it be used for now?  Sounds like an excellent position to put a wireless repeater or access point, or even a low power LED left on all the time as a night light.


How to getIDs of SVG Paths

Question: I'm currently working on this svg file and I'm trying to get the ID of each path. I converted the image using Raphael so this was the code.
Image of path code
Then here's my svg in my html file.
Image of svg code
Comment: replace those images with code asap
Comment: @madalinivascu I did try it, works but it's gonna be a lot of work since I'm making it for the entire University. Thanks though
Comment: are you afraid someone will use / rip off your code?
Answer: just loop over all path elements and read their id...

document.querySelectorAll("path").forEach(function(item) {
  document.write(item.id + "
")
})
<svg height="0px">
  <path id="id1" d=""/>
  <path id="id2" d=""/>
  <path id="id3" d=""/>
  <path id="id4" d=""/>
  <path id="id5" d=""/>
</svg>

How to getIDs of SVG Paths


Fix specific links in website not working on iphone only

Question: I'm creating a website from this template and I've downloaded the template and uploaded it without modifications here.
I have this problem (confirmed by a ticket on templatemonster): on Iphone only (seems like both on safari and chrome), i cannot click on some links (e.g. "view charateristics" on the 4 boats images under "YACHTS FOR SALE".
I tried editing it:

adding a big z-index on the  tags
creating a custom section with bootstrap and custom link
using  tags with onclick="window.location.href='test.php'"
using a <form> and a <button>

It really seems that the browser does not "catch" the click on the element.
But still, none of them work.
Unluckily, i cannot test on a real phone, but this simulator https://appetize.io/ seems to work pretty well. I did confirm that the problem is also on real devices, thanks to a customer.
I would like to know if anybody knows to fix this issue, without making the template look much different, thanks

EDIT
Here's the page where i'm trying to fix the bug. As you can see the <ontouchstart> is also not working.
I don't know if it would help, but you can also see that the carousel is not working on iphone (not a problem itself, i'm going to hide it).
Answer: It's a known Safari Mobile bug, you should add the ontouchstart event handler
More infos here
Comment: I'm sorry, i never used it, do i just have to add something like this:  ontouchstart="window.location.href='test.php'"?
Comment: I tried doing that, but it still doesn't work on iphone. It seems it's a different problem. Still, thanks.
Comment: I've added the link to the bugfixing page in the question, could you please see if i've implemented the ontouchstart correctly? Thank you.
Comment: I tried the link you provided on iphone and the links with ontouchstart on iphone are working


ajaxSubmit uploadProgress not responding

Question: I have a problem with the $(a).AjaxSubmit of jQuery.Form, with respect of option UploadProgress. This is my code:
$("#ifrm").contents().find("form").ajaxSubmit({
    data: { " + datos + " },
    target: "#sbmt",
    forceSync: true,
    uploadProgress: function(event, position, total, percentComplete) {
        alert(percentComplete);
    },
    success: function(html, status) {},
    complete: function(xhr) {
        if (xhr.statusText == "OK") {
            eval(xhr.responseText)
        }
        else {
            msgbox("Error en el Formulario", "Se produjo un error al subir el archivo.", 1);
            return false;
        }
    }
});

The alert never appears. I need the event for a progress bar.
Comment: In IE7 and other version is not work because not soport XMLHTTPREQUEST level 2, it work the normal response but not work the upload response...
Comment: Your code doesn't have a URL parameter. Also, add a callback for `error` to see if that gets hit.
Comment: hi! the problem is that not have any problem with the firebug or the chrome and work perfect with this two browser, the problem is IE. I read that the problem recide is that IE not soport response XMLHTTPREQUEST.. In the rest of browser work perfectly..plis I need help with this..Thanks..Mery
Answer: Update the ajaxForm plugin to the latest version. the problem will be solved.
Plugin URL : http://malsup.com/jquery/form/
Comment: I'm using 3.32.0-2013.04.09 same issue.
Comment: updated to 3.33 from the repository... no dice for IE8 or IE9


CSS: Repeating linear gradients for Internet Explorer supported?

Question: I know that IE 6-9 (and 10...) support linear gradients, but my question is does it support repeating linear gradients like for Firefox? Firefox example:
<code>    -moz-repeating-linear-gradient(left, #c5ccd4, #c5ccd4 0.31098em, #cbd2d8 0.31536em,
    #cbd2d8 0.438em);
</code>
For the following IE linear gradient equivalent, what can I add to make it repeat if that is possible? IE:
<code>    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#c5ccd4',
    endColorstr='#cbd2d8',GradientType=0 );
</code>
Thank You
Answer: You might want to be careful with implementing repeating linear gradients as they have some issues in various browsers. See Eric Meyer's write up on this:
http://meyerweb.com/eric/css/tests/gradient-repeat.html


Can different threads write to different sections of the same Vec?

Question: I have 10 threads and a Vec of length 100.
Can I have thread 0 work on elements 0-9 (sort them, for example), while thread 1 is working on elements 10-19, etc.?
Or do I have to use a Vec<Vec<>> for this? (Which I would rather avoid, because the elements would no longer be contiguous in memory)
Comment: A search on the Internet for "rust vec thread" leads to http://stackoverflow.com/q/28599334/155423; http://stackoverflow.com/q/31644152/155423; http://stackoverflow.com/q/33818141/155423; and many others. Please make sure to do your own [effort and show that effort when asking a question](http://meta.stackoverflow.com/q/261592/155423).
Comment: Maybe this approach is useful for you: https://stackoverflow.com/a/70851207/286335
Answer: Yes, you can. You asked about the mutable case, but I'll preface by saying that if the Vec is read only (e.g. for a reduction) you can safely send an immutable reference to the specific slice you want in each thread. You can do this by simply using something like &my_vec[idx1..idx2] in a loop.
For the mutable case it's a bit trickier since the borrow tracker is not sophisticated enough to allow non-overlapping borrows of a Vec. However, there are a number of methods, notably split_at_mut you can call to get these subslices. By far the easiest is the chunks_mut iterator documented here. (Note that there is a matching chunks iterator for the immutable case so you only need to make minor changes when writing either case).
Be aware that the chunks and chunks_mut functions take the size of each chunk, not the number of chunks. However, deriving one from the other is fairly straightforward.
I would like to give a few words of caution with the mutable case, however. If you split the data evenly you may get abysmal performance. The reason is that the CPU doesn't work on individual addresses, instead it works on blocks of memory known as cache lines which are 64-bytes long. If multiple threads work on a single cache line, they have to write and read slower memory in order to ensure consistency between threads.
Unfortunately, in safe Rust there's no easy way to determine where on a cache line a Vec's buffer starts (because the buffer's start may have been allocated in the middle of a CPU cache line), most of the methods I know of to detect this involve twiddling with the lower bytes of the actual pointer address. The easiest way to handle this is to simply add a 64-byte pad of nonsense-data between each chunk you want to use. So, for instance, if you have a Vec containing 1000 32-bit floats and 10 threads, you simply add 16 floats with a dummy value (since 32-bits = 4-bytes, 16*4=64=1 cache line) between each 100 of your "real" floats and ignore the dummies during computation.
This is known as false sharing, and I encourage you to look up other references to learn other methods of dealing with this.
Note that the 64-byte line size is guaranteed on x86 architectures. If you're compiling for ARM, PowerPC, MIPS, or something else this value can and will vary.


How can i install imagick so that it can work in XAMPP?

Question: hello
       i m using UBUNTU 10.04 and i want to use(install)  imagick in XAMPP.i have installed imagick from synaptic package manager but when i m trying to use this in XAMPP,its not working and giving an error like"no class imagick found".
       when i open phpinfo(),i didnt find imagick there.
       pls suggest me how can i install imagick so that it can work with XAMPP???
Comment: Define "imagick". Do you mean the ImageMagick binaries, or the PHP imagick extension?
Answer: Try installing php5-imagick.  This is the package containing PHP bindings for Imagemagick.
Answer: You should use apt-get to install PHP the correct way since you're on  a Linux based OS, using XAMPP (http://www.apachefriends.org/en/xampp.html) is not the way to go.
Depending on the version of PHP you need I would use a script like this to pin your version to 5.2.x, unless you want to use 5.3.x skip to below Apt-Get commands
#! /bin/sh

#check if running as ROOT
ROOTUSER_NAME=root

username=`id -nu`              # Or...   username=`whoami`
if [ "$username" = "$ROOTUSER_NAME" ]
then
  echo "Running as ROOT!!!"
else
  echo "Please run as Root as you are just an ordinary user (but mom loves you just the same)."
  exit 0
fi

php_packages=`dpkg -l | grep php | awk '{print $2}'`

#check if PHP Packages are NULL
if [ -n php_packages ]
then
  echo "Using Found PHP Packages"
  echo $php_packages
else
  echo "Nothing found, using defaults"
  php_packages="libapache2-mod-php5 php-pear php5-cgi php5-cli php5-common php5-curl php5-gd php5-gmp php5-ldap php5-mcrypt php5-mhash php5-mysql php5-odbc php5-pgsql php5-pspell php5-recode php5-snmp php5-sqlite php5-sybase php5-tidy php5-xmlrpc php5-xsl"
fi

# Restart Apache Command
RESTART="/etc/init.d/apache2 restart"

#might need to run aptitude purge to remove all the config/ini files
#aptitude purge $php_packages
apt-get remove $php_packages
echo "Removed Packages\n"

sed s/lucid/karmic/g /etc/apt/sources.list | sudo tee /etc/apt/sources.list.d/karmic.list
echo "SED Command\n"

#Create the directory
mkdir -p /etc/apt/preferences.d/
echo "Make DIR: /etc/apt/preferences.d/\n"

# PINing the verion number so Ubuntu wont upgrade the package
for package in $php_packages;
do echo "Package: $package
Pin: release a=karmic
Pin-Priority: 991
" | sudo tee -a /etc/apt/preferences.d/php
done
echo "Finished with PIN\n"

#Update apt-get repos
apt-get update
echo "Updating Apt-Get\n"

#Just listing all the packages that should be installed
for package in $php_packages;
do echo "Package: $package "
done

echo "Starting PHP Install\n";
apt-get install $php_packages php5-mcrypt
echo "Finished Install.........\nRestarting Apache...........\n"

#Restart Apache
RESTART

#Autoclean, remove old files
apt-get autoclean

Here are the Apt-Get commands that you could run as well
# Add Repo
sudo add-apt-repository "deb http://archive.canonical.com/ lucid parnter"
sudo apt-get update

# install
sudo apt-get install apache2 imagemagick php5-imagick

# remove old files
sudo apt-get autoremove


quality of quercus translation?

Question: have someone used quercus to translate php into bytecode? if you got a big php application, will the translation be flawless? it sounds to me very impossible to just translate everything without error in code like that.
but they claim on their web page that mediawiki and other popular websites (joomla to i think) use it.
and my php code got a lot of procedural code. how will that be translated to a class in java?
sounds very impossible!
it would be good if it was true. someone that has tried it?
Comment: java byte code is not the same as java source code.
Comment: It's perfectly possible... it's just a compiler.  I have no idea how good the implementation is, but in principle, no problem.
Comment: I know of a PHP implementation by IBM: it compiles PHP sources on-the-fly to Java bytecode too. And that seems too work; so if Quercus is also a good implemenation, it should work. I'm convinced of the theory, by seeing IBM's implementation, that it should work.
Comment: In my opinion, converting languages sounds like a bad idea. just write again ...
Comment: @andrew: but it compiles to java bytecode. isnt it kind of translating to java? @michael...i will rewrite the code in the future in pure java, but i don´t have time for that right now cause the deadline is near=)
Comment: it worked very good. except for some things you have to rewrite and the mysql connection is 4 times slower than with apache. but the code runs 4-5 times faster.
Answer: this guy has drupal running on quercus. drupal makes very little use of oop and yet it seems to be running fine under quercus. apparently there are even some performance benefits of doing it this way - probably associated with the difference between compiled code vs interpreted code.
Answer: Seems like a hard way of optimising, why not run APC? you'll get similar performance benefits.

quality of quercus translation?


Too wide text for the screen?

Question: I'm building a website. On desktop the maximum width is 1140px. My body font size is 16px.
Both these feels correct. However, when I add text it's too wide to be optimal in readability. See image below:

Be aware that this image looks small in this post. Click to enlarge.
How can I solve that the text is too wide?
What I've tried to far:

Columns - I did not like when hit the bottom and need to scroll up to read the next column.
Larger body font - The readability may be increased but it feels and looks strange with "oversized" text. I tried 20px.
Sidebar - Then I need to have something on the side on every page on the site. That's not an easy task, especially not to the right of this excerpt.

So what I'm looking for is more alternatives the the above. If it's hard to find more alternatives I'm also looking for opinions of which solution I should go for and why.
Comment: I think this question is pretty relevant: http://ux.stackexchange.com/questions/3618/ideal-column-width-for-paragraphs-online
Comment: "Sidebar - Then I need to have something on the side on every page on the site" Why do you need that? Just leave the side empty. Don't be scared of whitespace!
Answer: You need to maintain a comfortable relation between the number of characters per line and the width of the container.
So either you set two or more columns, you make the font-size bigger or what I suggest which is reduce the width of the text container.
Check this calculator. According to it for a font-size of 16px you need a maximum of 685px wide. Or for a width of 1140px you need a minimum of 20px font-size.
Comment: @JensTörnell does that matter though? Many sites have small text containers. Take this very site here. We get questions that ellicit many answers, and all these answers are all within a small(ish) width content area. There's a bit more content at the top of the page but when you start scrolling all the supplementary content has gone and you're left with just the useful content in the centre of the screen. Take a question with many answers as an example: http://ux.stackexchange.com/questions/103163/should-we-kill-the-features-that-users-are-not-using-frequently-to-improve-perf
Comment: Thanks! Yes, setting a smaller container width is an option. The pitfall with it is that it does no longer match the rest of the site.

Too wide text for the screen?


replace half a drywall ceiling?

Question: I'm redoing my kitchen which adjoins the eating area.  Part of this was removing the soffits or fur downs, which has now left my ceiling without large strips of drywall on 3 sides.
The kitchen area is 10' deep and then another 10' of that is eating area, where the drywall is intact.  I'm trying to decide if I just patch this or replace the ceiling in the kitchen.  And how do I tie the new kitchen ceiling in with the eating area?  I do plan to remove all the popcorn and go over with orange peel.
But I would need to stagger sheets of drywall, right so I wouldn't have one long line across the room between the two areas?
---Edit---
Tonight I tore down the kitchen part & cut back to the nearest stud.  Here's a sketch of what I'm left to fill in (joists are dashed lines).  Any advice on staggering?  I plan to start on the left side and do 3 full sheets + 1 strip over the stove area.
Answer: If you have any small pieces of drywall up on the ceiling, I'd start by removing those to get back to as many full sheets as you can which should also minimize the cuts you need to make. As user41750 says, make sure you match the drywall thickness. The joints will only be staggered in one direction, along the 4' lengths where the drywall isn't tapered. You want those 4' long joints to meet on a joist or nailing surface.
The 8' spans will be perpendicular to the joists and be tapered. You can knock out the mud and tape from inside the taper of the existing drywall to get two tapered joints to align. If you don't have an existing tapered joint, then you'll want to cut away the taper to avoid a significant difference in height where you are mudding and taping later.
The mudding and taping is an art. There's a fair bit of advice on this site to help you there, but I wouldn't blame anyone for hiring out this part of the project. And from there, it's all about matching the finish. I'd personally prime and paint the entire ceiling, if not the walls too. This will help hide any division between the two spaces.
Comment: +1 on hiring it done. Even if you have experience, skill, and patience; mudding, taping, and sanding is a huge PITA .
Answer: I would try to keep as many joints staggered as possible of course taping every joint so it won't crack in the future.  Using the same thickness of drywall as is already there is extremely important.  I don't see where you should have any trouble tying into the ceiling that's not missing the edges in the eating area as long as you use the same thickness drywall just tape it, mud it and finish it.  You're going to be texturing it so that will also help hide any blemishes in the finishing job.  From all that I see in your picture and what you described it looks pretty straightforward patch in job. You're final finish coat of drywall compound will not even have to be that perfect if you're going with the orange peel texture.  Should turn out just fine.  Good luck.
Comment: just to add, put down a good primer base to help give it a uniform look. The primer will help if one part of the ceiling is discolored from the other and also will hide all of your compound joints.
Answer: For as little as you have left - drywall is cheap - just rip it all down and start over. You'll get done quicker, and it will look better.
Comment: I pulled it all down tonight.  There were sheets run both different directions, I guess because of the fur-downs.  Anyway, 6' of the edge hangs off past a joist, although there are cross members that were used to hang the cabinet.  The other 7' across I cut down the middle of the joist.  So I have 13' of cut edges to mate up.
Comment: Looking at your edit - it looks like you meant to type 6 in., hanging over. You can put blocking behind the 5'8" part, and piece in that small section. Then a 2x4, the full length of the ceiling joist, to help secure the tie-in between the two rooms.
Answer: Some times I fill in the cut out spaces wiith drywall then overlay the whole ceiling with new drywall drywall is cheap and finishing new is often easier than scraping off old texture and dealing with gouges and old drywall stain tannin bleeds just make sure to mark joist and use a longer screw
Comment: I really like this idea, but it would require me to re-tape & mud the eating area ceiling to wall edges, which I'd like to avoid.
Comment: @brd test to see if texture comes offfclean and easy  if so just fix the bad half  or overlay it all and instal a crown molding to cover gap at wall

replace half a drywall ceiling?


Is applyTwice a well-known Haskell idiom?

Question: Is this a well-known idiom?
applyTwice :: (a -> b -> c) -> (d -> a) -> (d -> b) -> (d -> c)
applyTwice g f1 f2 p = g (f1 p) (f2 p)

Here's a typical use:
applyTwice someFunction head tail $ this $ that $ otherThing

In this case, this $ that $ otherThing returns a list, and I want to take both the head and tail of that list, and then supply the two ends to someFunction.
Is applyTwice a standard idiom, or is there some more natural way to take both the head and tail of the result of a complex calculation? Is just using where the standard way to do this?
Comment: Definitely belongs on StackOverflow. If this was about the theory behind Haskell it might be on topic, but asking about idioms and usage is definitely for SO.
Comment: `applyTwice g f1 f2 = (g.f1) <*> f2`. So, yes, and no; it's an [**S** combinator](https://en.wikipedia.org/wiki/SKI_combinator_calculus) from combinatory logic and lambda-calculus.
Comment: a related Haskell combinator is Data.Function.on: ``(g `on` f) x y = g (f x) (f y)`` but that goes the other way around, with "one function, two arguments".
Answer: Isn't it just liftM2?          .
Comment: Also, one thing that's kind of useful about GHCi is you can use it to see if something can take on a certain type, which is nice if you have some type class complexity going on. `:t liftM2 :: (a -> b -> c) -> (d -> a) -> (d -> b) -> (d -> c)` shows that `liftM2` can have this type.
Comment: @MarshallhandheldFlax Actually, here `liftM` is using the function `Monad` instance, `(->) r`. It's unrelated to your use of arrays and will work on the fully general type you gave.
Comment: Perfect!  Hoogle didn't find the signature because my "d" wasn't any specific type.  But I was being too general -- I should have realized that my use of "d" was against an array, and liftM2 acts upon arrays-as-monads.


Summation of n(2^n)

Question: I was doing a question in which i had to find the summation of the expression $n(2^n)$ from n=1 to n=9.
I used wolfram alpha to calculate thid sum, but i was wondering if there is an easier way to calculate it?
Answer: This is an "arithmetico–geometric" progression (a product of an AP
with a GP) and there are standard methods to sum these.
Let
$$S_m=\sum_{k=1}^n k2^k=2+2\times 2^2+\cdots+m\times 2^m.$$
Then
\begin{align}
S_m&=2S_m-S_m=2^2+2\times 2^3+\cdots+m\times 2^{m+1}
-(2+2\times 2^2+\cdots+m\times 2^m)\\
&=-2-2^2-\cdots-2^m+m2^{m+1}=2-2^{m+1}+m2^{m+1}=(m-1)2^{m+1}+2
\end{align}
using the formula for the sum of a GP.
Comment: Thank you so very much for your clear answer!
Answer: Let's assume n is finite. We will now derive an explicit formula for calculating the desired sum for any $x$, you can plug in $2$ into final formula.  The sum: $S_1=\sum_{k=0}^{n} kx^{k}$ looks a lot like: $S_2=\sum_{k=0}^{n} x^{k}$. $S_2$ is of course $\mathbb{geometric}$ series: $S_2 = \frac{1-x^{n+1}}{1-x}$. Since n is finite, we can safely take the derivative of $S_2$: $S_3 = \frac{d}{dx}(\sum_{k=0}^{n} x^{k})=\sum_{k=0}^{n} kx^{k-1}=\frac{d}{dx}(\frac{1-x^{n+1}}{1-x})=...=\frac{-nx^{n}+nx^{n+1}-x^{n}+1}{(1-x)^2}$.
We wanted a sum of $kx^k, x = 2$ and we derived explicit formula for sum of $kx^{k-1}$. We now just need multiply $S_3$ by $x$: $xS_3 = x\sum_{k=0}^{n} kx^{k-1} = \sum_{k=0}^{n} kx^{k} = S_1 = x\frac{-nx^{n}+nx^{n+1}-x^{n}+1}{(1-x)^2} = \frac{-nx^{n+1}+nx^{n+2}-x^{n+1}+x}{(1-x)^2}$.
For $x=2$ we get: $\sum_{k=0}^{n} k2^{k} = -n2^{n+1}+n2^{n+2}-2^{n+1}+2 = 2^{n+1}(n-1)+2$
Answer: We will start by introducing the geometric progression summation formula:
$$\sum_{i=a}^b c^i = \frac{c^{b-a+1}-1}{c-1}\cdot c^{a}$$
Finding the sum of series $\sum_{i=1}^{n}i\cdot b^{i}$ is still an unresolved problem, but we can very often transform an unresolved problem to an already solved problem. In this case, the geometric progression summation formula will help us.
Steps:
$$
\sum_{i=1}^{n}i\cdot b^{i} =
\sum_{i=0}^{n-1}\sum_{j=n-i}^{n}b^{j}=
\sum_{i=0}^{n-1}\frac{b^{\left(n-\left(n-i\right)+1\right)}-1}{b-1}\cdot b^{\left(n-i\right)}=
\sum_{i=0}^{n-1}\frac{b^{n+1}-b^{n-i}}{b-1}=
\frac{\sum_{i=0}^{n-1}b^{n+1}-\sum_{i=0}^{n-1}b^{n-i}}{b-1}=
\frac{nb^{n+1}-\sum_{i=0}^{n-1}b^{i+1}}{b-1}=
\frac{nb^{n+1}-\frac{b^{n}-1}{b-1}\cdot b}{b-1}=
\frac{nb^{n+1}}{b-1}-\frac{b^{n+1}-b}{\left(b-1\right)^{2}}
$$
Now, just replace $b$ with $2$
$$
\frac{n\cdot2^{n+1}}{2-1}-\frac{2^{n+1}-2}{\left(2-1\right)^{2}}=
\left(n-1\right)2^{n+1}+2
$$

Summation of n(2^n)


Libre office font spacing (kerning) issue

Question: On every operating system whenever I install LibreOffice it always seems to have an issue with properly spacing characters.
Here are some examples:

The first word is the exact same word in the same document and the same font, and yet, it looks different. (around letter e and n)
Second word has a strange gap between p and a
In the last word A and d almost overlap.
All of these are regular fonts. Nothing fancy. Any way to fix this?
P.S. Format>Character>Postition>Pair Kerning is already enabled.
Comment: Please note that this problem does not seem to persist when "publishing" documents either by exporting them to pdf or by printing them.
Comment: I noticed this as well.
Comment: I never noticed this until you asked this question.  I have noticed that if you capitalize the first letter of the word changes the spacing as well.  Upvoted so hopefully this question will get enough attention.  +1
Comment: I don't think you will get an answer because you've given *very* little detail here. What fonts? What version of LibreOffice? What Operating Systems? All of these *might* contribute, but I'd start with the fonts. For example, I don't see anything like this with Liberation Sans in LO 18.104.22.168 in Ubuntu 16.04.
Comment: Same problem in Libreoffice 7.0
Answer: The kerning issues are very likely due to issues introduced in LibreOffice 5.3.
While LO 5.3 did introduce a feature targeted at complex glyph positioning (GPOS) and ligature replacement, etc., this new font rendering engine (or the tech is was attached to) was also somewhat broken/sloppy in regards to traditional kerning.
Because this question was asked shortly after the release of 5.3, the new engine seems the likely suspect here.  (Although, as one commenter above notes, we don't know the LO version in question here.)
Thus, the old workaround was to fall back to LO 5.2.x.  Very recently, however, LO 7.4 was released which has finally (6 years later) addressed some of these kerning issues.  (Well, 7.4 looks good to me thus far, but I have no expectations it will stay fixed--or fixed for all--when it comes to free software.)
If, however, you are seeing kerning issues due to hardware, OS, or app settings (maybe you turned off kerning, font smoothing, or something else), no version of LO will likely help.  These issues are typically related to things like anti-aliasing and sub-pixel positioning features such as ClearType.  If things look better printed or zoomed in, it's probably not LO's fault.
Comment: Do you happen to have information as for what else I should check if the kerning issues are definitely much worse when zoomed-out than when zoomed-in? I'm having this issue (on Gnome Wayland), but when zooming in things seem to be much more readable, though not perfect. (But exporting to PDF and opening in a PDF reader makes things readable even at small font sizes so I'm not sure)
Comment: @Ekleog - Sorry, but I'm not nearly as well versed with these things in Linux as I am in Windows. A quick web search reveals things like fontconfig hinting settings, Infinality, and the Gnome Tweak Tool. I'm guessing Infinality isn't built for Wayland, but the tweak tool may still apply: https://www.maketecheasier.com/improve-font-rendering-linux/ . PDF readers typically have their own rendering engines, so it is not surprising things look better there (and, yes, if LO was at fault, the PDF would look bad as well).
Answer: The weird letter spacing is due to bugs which have been resolved in LibreOffice 5.3.
At the time of writing, version 5.3.0 is available through a PPA, type the following into a terminal to ensure the latest version is installed:
sudo add-apt-repository ppa:libreoffice/ppa
sudo apt-get update
sudo apt-get install libreoffice

Comment: I have Libre Office 18.104.22.168 and the bug is still present. Try resizing the application window slowly and you will see the spacing around letters change as you resize it.
Comment: @Danchm01 try with pair kerning turned **off**.  GPOS kerning is the new kerning algorithm, having pair-kerning enabled _might_ be forcing use of the old algorithm.
Comment: Just upgraded from Writer 5.1 to 5.3. Kerning is *worse*.
Answer: Maybe try to disable the "hardware acceleration" option under the Tools>Properties menu, then LibreOffice>View.
It helped me to solve some letter glitches like that in the past.
Answer: Your issue can probably be fixed by adding these settings to ~/.config/fontconfig/fonts.conf:
<match target="font">
 <edit name="rgba" mode="assign">
  <const>rgb</const>
 </edit>
</match>
<match target="font">
 <edit name="hinting" mode="assign">
  <bool>true</bool>
 </edit>
</match>
<match target="font">
 <edit name="hintstyle" mode="assign">
  <const>hintslight</const>
 </edit>
</match>
<match target="font">
 <edit name="antialias" mode="assign">
  <bool>true</bool>
 </edit>
</match>

This snippet does the following:

Enables subpixel antialiasing, which improves the looks of many fonts (this is the same system used by ClearType on Windows)
Sets font hinting to slight (this is usually the global default, but LibreOffice seems to not see it)
Turns on normal antialiasing (this works in conjunction with subpixel antialiasing)

Font hinting causes letters to be aligned with the pixel grid on your monitor, which can possibly cause kerning issues. By setting this to slight, inter-character space is preserved.
These issues usually only occur with Windows fonts or fonts designed to be metrically equivalent (such as the default LibreOffice font), for those are not designed with the concern of snapping to a pixel grid.
Comment: Does not works on Libreoffice 7.0
Answer: Go to Tools - Options - (Options will pop up)
Select Libreoffice - View.
Then check mark the boxes - Hardware Acceleration, Anti-aliasing, Show Preview of Fonts, and Screen Font Anti-aliasing.
If you have any memory problems after, uncheck Show Preview of Fonts.
Answer: in my case the entire text had slightly overlapping characters and none of the previous solutions worked for me.
The only workaround was to set the font scale factor to a value other than 100, such as 99% or 101%, in format->Character->Scale width


On every children add 1 (+1) Umbraco Razor

Question: In the code below i need it to add (+1) on every children on data-slide-index="0".
Starting at 0 and then 1,2,3,4,5
It should look like this:
data-slide-index="0"
data-slide-index="1"
data-slide-index="2"

I am thinking something like this.
int theCount = 0;
theCount += 1; // Adds 1 to count

But I dont know how to use it correctly in the code.
@foreach (var image in @Model.Children)
{
foreach (dynamic d in image.imageDampSingle)
{

Or is there a easier / another way to do this?
Thanks in advance!
//René
Comment: Recursion is a principle in programming. http://en.wikipedia.org/wiki/Recursion
Comment: No way to use recursion?
Comment: I am fairly new to razor so i have to admit that i don't know what recursion is.
Comment: Is there any chance that you can post an example on how you would do it?
Comment: I don't know Razor enough to do that. That's why I ask if Razor doesn't have the option of recursion.
Comment: That's okay I will try to find a solution and post it in here when it is solved. Thanks.
Answer: Razor is just a view engine, you are using C# code in there to do some logic operation. Recursive methods are algorithmic operations that have the capability to call themselves until a certain condition is satisfied. You can use a helper in this case to achieve that. An example for your case:
@helper DoSomething(IEnumerable<Something> myList)
{
    foreach (var item in myList)
    {
         @item.CertainProperty
         @if (item.Children.Any())
         {
             @DoSomething(item.Children)
         }
    }
}

Learn and read about recursion, and a whole new world of fundamental concepts will appear.
http://en.wikipedia.org/wiki/Recursion_(computer_science)
http://learnyousomeerlang.com/recursion
It's a fundamental topic, I was actually programming some snippets right now when I read this topic, where's other example in Python:
def contaVogais(cadeia):
    if not cadeia:
        return 0
    return (1 if cadeia[0] in 'aeiou' else 0) + contaVogais(cadeia[1:])

As you can see by the examples, recursive solutions are usually more elegant, but in some cases might have a decrease the code performance.
Comment: Great, recursion is a whole new continent and an important base.
Answer: I found a solution. See below:
                    @{
                var countNum = -1;
                }
                @foreach (var image in @Model.Children)
                {
                    {
                    countNum += 1;
                    }
                    foreach (dynamic d in image.imageDampSingle)
                    {

                    }
                }

You are welcome to comment on it regarding improvement of the code.
//René


Finding values of $m$ for which $\sin{\frac{\pi}{2}}x=mx − 1$ has one real solution on the interval $[0,4]$

Question:
By considering possible points of intersection of the graphs of $y = 1 + \sin {\frac{\pi}{2}} x$ and $y = mx$, find
the values of $m$ for which the equation
$$\sin{\frac{\pi}{2}}x=mx − 1$$
has exactly one real solution in the domain
$0 \le x \le 4$.

Progress:
Tried solving it graphically to no avail.
When solving it graphically I realised that for any value of $m$ there's always one solution for the sine curve for the graph in the given domain, so what's the question asking me to do, and how do I approach it?
Comment: crap forgot to add the x hehe
Answer: Hint: Your graphical approach was correct. If $0<m\leq 0.25$, we will have two solutions. Also for $m<0$ there are $0$ solutions in domain.
Comment: Where did you get 0.25 from? Thanks.
Comment: If you draw the graph, you will understand it clearly. The equation of line is one of variable slope, with y intercept $-1$.
Comment: So at $0.25$ slope it intersects $x$ axis at $(4,0)$
Comment: Fair enough, but is there a way to show this algebraically?
Comment: Questions like this, where you have to find number of solutions rather than exact solutions, are almost always solved graphically. Algebraic approach might or might not be possible, but the graphical approach would always be quickest.
Answer: Why not to consider that the problem is to find the zero's of function
$$f(x)=\frac{\sin \left(\frac{\pi }{2}x\right)+1}{x}-m$$ since $x=0$ is not a root.
Graphically, the problem is clear and simple.


What do you do to fill in the midgame

Question: I've been playing ARK on a locally hosted server with my wife.
We're pretty goal oriented and have spreadsheets with what we need to accomplish and how / when.
However, we've now:

Constructed a three story house
Created an animal pen large enough to house our herd
Tamed 20 dodos, 2 triceratops, 2 dilos, 2 phiomas
Constructed an archery tower surrounded by several spike walls with ammo to kill just about everything on the map
Have 10 storage boxes filled with a thousand of each resource near enough
Have a garden with 8 small plots

I'm now lvl 23, and she's lvl 18. And we're not sure what to do next.
As there are no real set goals as far as we can tell, and the aspects required to summon the broodmother require increasing levels up to 55 it looks like we'll be stuck grinding levels for a while.
It feels like we hit a curve in the game where we're too well off to really need to do anything, we're lacking goals.
What are we missing, is there some mid-game content we're not seeing?
What do people tend to do in ARK once they've built a small colony?
Is it just improbable to play ARK on a local server, is the idea of humans killing humans so ingrained in the game balance that we're missing out?
Comment: we were speed leveling at that point (good method is to craft notes or kill stuff with your raptor if you can get a saddle for it somehow)

Also I have no idea how you achieved all that still being under level 30, we have similar stuff and we are a group of 5 all over level 20 now.
Comment: @RandomDisplayName Speed leveling is something we're trying to avoid. I've settled so far on building a massive structure someone in the center of the island, and using it as a base to build smaller spawn camps all across the island.
Comment: I would suggest playing online once you're familiar with the game, the social interaction between players (if on a good server) can be very entertaining.
Answer: After some careful deliberation and laying out what we had accomplished, we decided that we did in fact omit a large part of the game.
Exploration!
It's kind of simple if you think about it, the island is huge, and while we did carve out a small safe corner of it, we had not yet explored even a fraction of the island.
So now we've set off on foot, following the shore from the western to the eastern border. Due to the crafting of arrows / food / temporary shelter and the fighting involved, we've discovered new species of dinosaur and leveled up quite a bit.
So if you're in doubt after the early game on what to do, and don't want to break the feel of such an immersive and fun game by power leveling or doing stuff just to get ahead in the game, try finding out whats past that high hill near you.
Comment: You can also explore some low level caves.
Answer:
Goal 1: Local ARK is like Jurassic Park Pokemon, gotta catch em all.
Taming two of everything should keep you busy for quite some time.
Goal 2: Create bases in the harsher environments.
Swamps, frost lands, caves, underwater caves, dangerous islands all pose their own unique challenges.
Goal 3: Explore the entire map (you already figured this one out)
Not a goal but you can fiddle with the server settings to make certain aspects of the game more challenging
Harder dinos, more dinos, stricter food/water requirements, etc. This will change how you have to play to survive.

What do you do to fill in the midgame